Quick Question - Wave Equation - what does N do?
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Muthu Annamalai
am 27 Feb. 2013
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)
Akzeptierte Antwort
Youssef Khmou
am 27 Feb. 2013
Bearbeitet: Youssef Khmou
am 27 Feb. 2013
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!