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

I am trying to show the propogation of this wave using matlab but i cannot get i

ID: 1993180 • Letter: I

Question

I am trying to show the propogation of this wave using matlab but i cannot get it to work properly. please only answer if you manage to show the wave animation correctly. here's my code:

% show the animation of the wave
clear;
x=0:0.0005:1; % 1 meter space, resolution of image is 0.0005
t= 0:0.1:100; % total period of time, resolution of time is 0.1 second
period = 10; % period
wavelength = 0.30 % wavelength
A = 1; % amplitude

figure(1);
for ctime = t
wave_1 = exp(-((2*x-3*t)^2)/4)-exp(-((2*x+3*t-10)^2)/4);
plot(x, wave_1,'b');

pause(0.025);
end

Explanation / Answer

i didnt get the presence of period, wavelength and amplitude in code.

and in function wave_1, (2*x-3*t),here x and t should be of same order.

if youhave matlab2014b then code could be,

x=0:0.0005:1;
t= 0:0.0005:1;

wave_1 = exp(-((2*x-3*t)^2)/4)-exp(-((2*x+3*t-10)^2)/4);

for i=length(x)

addpoints(curvex(i),wave_1(i));

drawnow

end

if your matlab is prior to 2014, then code should be ,

x=0:0.0005:1; % 1 meter space, resolution of image is 0.0005
t= 0:0.0005:1; % total period of time, resolution of time is 0.1 second
period = 10; % period
wavelength = 0.30 % wavelength
A = 1; % amplitude
fig=figure(1);
for i=length(x)
wave_1 = exp(-((2*x-3*t).^2)/4)-exp(-((2*x+3*t-10).^2)/4);
plot(x, wave_1,'b');
comet(x,wave_1)
  end

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