How to plot a graph in Scilab showing the interference of two waves?

Theory:

Before writing the program let’s have a look at the interference of waves.

What is Interference of Waves?

In physics, interference is a phenomenon in which two waves superimpose to form a resultant wave of greater, lower, or the same amplitude.

What is the Principle of Superposition of Waves?

The principle of superposition of waves states that

When two or more waves incident on the same point, the resultant amplitude at that point is equal to the vector sum of the amplitude of the wave.

The nature of the resultant wave depends on the phase difference between two superposing waves. On this basis, interference is classified into two types, Constructive interference, and Destructive interference.

What Is Constructive Interference?

Constructive interference occurs when two superposing waves are in phase. That is the phase difference is even multiple of \pi.

\Delta \phi = 2n\pi

What Is Destructive Interference?

Constructive interference occurs when two superposing waves are out of phase. That is the phase difference is an odd multiple of \pi.

\Delta \phi = (2n+1)\pi

Now let’s make a program to show the interference of two waves in Scilab.

A Program in Scilab for the Constructive Interference

Open the Editor and type your program. As you know there are two types of interference, Constructive interference, and Destructive interference. So first let’s make the program for constructive interference. I have made this program.

Decoding:

  • In line no. 1, command clf(); is used to erase the previous plot in the graphic window.
  • Line no. 2 is written for the loop over t from t = 0 to t = 10\rm \ sec with step size 0.01.
  • Line no. 3 is written for the frequency of the first wave.
  • Line no. 4 is written for the frequency of the second wave.
  • Line no. 5 is written for the equation of the first wave.
  • Line no. 6 is written for the equation of the second wave.
  • Line no. 7 is written for the resultant of two waves.
  • Line no. 8 is written to plot the first wave. (In the bracket, I have written 1. It gives the color of the line black.)
  • Line no. 9 is written to plot the second wave (The number 6 inside the bracket gives the color of the line pink.)
  • Line no. 10 is written to plot the resultant wave. Here, leg is the command used for the legend which will appear in the graphics window.

Now let’s execute the program by pressing the key “F5”, assigning its name, and pressing the “Enter” key. You will get a graph of the waves as shown below.

Output

A Program in Scilab for the Destructive Interference

Now, let’s write the program for destructive interference.

As you know for destructive interference, the phase difference should be an odd multiple of \pi. So, let’s edit a little bit in the previous program so that the phase difference between two waves becomes an odd multiple of \pi. For this, let’s rewrite the sixth line as y_2=4\sin(v_2t+\pi). So, the complete program for destructive interference is

Now execute the program and you see a graph of destructive interference as shown below. Here black and blue curves are for the two waves and the pink curve is for the resultant of two waves.

Output

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart
Right click not allowed
Index
Scroll to Top