MATLAB: Quick Question – Wave Equation – what does N do

basicsMATLABwave equation

Hi,
I am a fairly new user of MATLAB and need a quick bit of help. I have been given some code(located below) and been asked to discover what N does. The values for N that I have are 5, 10 and 50. Can anyone please explain what this value represents.
Thankyou in advance
% initialise constants
L=3; mu=1; N=5; b=21/11; c=10;
% set up x-vector for plots
x = L*linspace(0,1,500);
% set up limits for x and y axes
v = [0 L -1.1*mu 1.1*mu];
% set up value for time step T
% T is the period of oscillation divided by 15
T = 2/75;
% set up for loop for incrementing t in 16
% equal steps of length T
for m = 1:16
t = (m-1)*T;
% initialise u to be zero then sum first N terms
u = 0;
for n = 1:N
u = u+2*mu*L^2/(pi^2*b*(L-b)*n^2)*sin(n*pi*b/L)*sin(n*pi*x/L)*cos(n*pi*c*t/L);
end
% plot this sum and store for movie using getframe
figure(1),plot(x,u),axis(v)
M(m) = getframe;
%replot in a 4X4 array for displaying frames
figure(2),subplot(4,4,m),plot(x,u),axis(v)
end
% show movie with 10 periods
firgure(1),movie(M(1:15),10)
% display the individual frames
figure(2)

Best Answer

hi,
like Muthu said , its the number of Modes for Fourier series of that rope's movement, the only thing i want to add is that according to the code, the best "resolution" or "Reality representation" is configured when N<10 , but when N >10 the code is correct but gives a sort of artificial movement. When you have acces, try with N <10 & with N > 10 and conclude.
Related Question