Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

An important phenomenon in acoustics is the Doppler Effect, which is the apparen

ID: 3812089 • Letter: A

Question

An important phenomenon in acoustics is the Doppler Effect, which is the apparent change in the frequency of a sound wave due to the relative motion of the source, receiver, or both. We are interested in writing a C++ Function that computes the frequency of the sound wave heard by the receiver.

The relationship is given by this formula:

where

fr = the frequency of the sound wave heard by the listener (standard units: Hz)

fs = the frequency of the sound wave at the source (standard units: Hz)

vw = the velocity of the sound wave (the speed of sound is 340 m/s)

vr = the velocity of the receiver (standard units: m/s)

vs = the velocity of the source (standard units: m/s)

Finally, we follow these rules for the signs:

When the source is moving toward the receiver, the sign on vs is negative.

When the source is moving away from the receiver, the sign on vs is positive.

When the receiver is moving toward the source, the sign on vr is positive.

When the receiver is moving away from the source, the sign on vr is negative.

Write a function that computes and returns fr . You'll need three parameters: fs , vr , and vs .

Since the speed of sound is a constant, it does not need to be a parameter.

vw, t vs

Explanation / Answer


/**
C ++ program that prompts user to enter freqeuncey of sound at sounce,
velocity of receiver and velocity of source and then find the frequencey of
receiver and print to console.
*/
//main.cpp
//header file
#include <iostream>
using namespace std;
//set speed of sound wave
float Vw = 340;
//function prototype
float getFrequencyOfSoundByReceiver(float Fs,float Vr, float Vs) ;
int main()
{
   float Fr; //freq of receiver
   float Fs;//freq of source
   float Vr;//speed of receiver
   float Vs;//speed of source

  
   cout<<"Enter frequency of the sound wave at the source ";
   cin>>Fs;
   cout<<"Enter velocity of the receiver (standard units: m/s)";
   cin>>Vr;
   cout<<"Enter velocity of the source (standard units: m/s)";
   cin>>Vs;

   //calling getFrequencyOfSoundByReceiver with three parameters
   Fr=getFrequencyOfSoundByReceiver(Fs,Vr,Vs);

   cout<<"Frequency of the sound wave (Hz)"<<Fr<<endl;

   system("pause");
   return 0;
}
//function that calculates teh frequencey of the sound wave by receiver
float getFrequencyOfSoundByReceiver(float Fs,float Vr,float Vs)
{
   return Fs*((Vw+Vr)/(Vw+Vs));
}

---------------------------------------------------------------------------------------------

Sample result:

Enter frequency of the sound wave at the source 150
Enter velocity of the receiver (standard units: m/s)50
Enter velocity of the source (standard units: m/s)30
Frequency of the sound wave (Hz)158.108

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote