Friday, 16 November 2012

Standing wave visualisation

Code showing standing wave due to terminator absorbing wave power

I've discussed how reflection results in a standing wave. It can be useful to visualise how complete and partial reflection look.

At some point I'll make this into something more fun and user-friendly. For now, if you are really curious to visualise how a standing wave looks when 96% of the energy has been absorbed, then paste the following into Octave (Matlab will do), and change Ar to 0.04:

Ai = 1; %incident amplitude
Ar = 0.9; %amplitude of combined radiated and reflected waves - try varying between 0 (full absorption) and 1(no absorption).
NumWaves = 2;
wtmax = NumWaves*2*pi; %maximum time to plot to give NumWaves # of cycles

kx= 1:100;
wt = 1:wtmax/(20*NumWaves):wtmax %discretisation: 20 points per wave
for ii = 1:length(wt)
     wi(ii,:) = Ai*sin(wt(ii)+kx);
     wr(ii,:) = Ar*sin(wt(ii)-kx);

ws = wi+wr;

No comments:

Post a Comment