Quick Question - Wave Equation - what does N do?

6 次查看(过去 30 天)
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)
  2 个评论
Muthu Annamalai
Muthu Annamalai 2013-2-27
It seems like you are plotting the Fourier Series solutions of the particular PDE, and you are calculating the first N modes as I figure from the comments.
I recommend you play with the script by plotting the charts for various N = 4:10:50 and see the resolution / detail in the wave functions (solutions to your original wave equation)
Benjamin Rodgers
Benjamin Rodgers 2013-2-27
Thankyou for the reply.
Yea i think it is Fourier Series so the N value changes the resolution. So the higher the N value the greater the resolution? as I do not have access to a working version of MATLAB until monday but need this done by the end of the week

请先登录,再进行评论。

采纳的回答

Youssef  Khmou
Youssef Khmou 2013-2-27
编辑:Youssef Khmou 2013-2-27
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by