From: Rick T on
Greetings All

I'm trying to create a standing wave animation and export both
channels to a left and right audio waves file to play but I'm having
problems. I can create the wave by just using the standard wave
equation for the left channel and 180 degree phase difference for the
right channel but when I try and figure out how I can get the right
channel to play backward I'm at a lost.

Here's an example of a standing wave The blue wave goes left and green
wave goes right and it creates the red standing wave.
http://www.phys.unsw.edu.au/jw/strings.html

Example Code:
clear;
x=linspace(0,1,100);
wt=2*pi*x;

deg1 =0;
deg2=180;
phase1=deg1*pi/180;
phase2=deg2*pi/180;
pchange1=linspace(0,360,100);
pchange2=linspace(360,0,100);

vertshift1=0;
vertshift2=0;

y1=sin(1*wt+phase1+pchange1)+vertshift1;
y2=sin(1*wt+(phase2+pchange2)-(phase1+pchange1))+vertshift2;

plot(x,y1,'r', x,y2,'b')

Question 1) How can I get y2 to play backwards (have it's phase shift
decrease over time)?
Question 2) How can I animated the plot to show what happens over
time.

At first I thought I could have y2's equation be y2=sin(1*wt+
(phase2+pchange2)-(phase1+pchange1))+vertshift2;

But that looks nothing like the animation at this website
http://www.phys.unsw.edu.au/jw/strings.html

tia sal22
 | 
Pages: 1
Prev: convert 3D matrix into 2D
Next: help