Quick Question - Wave Equation - what does N do?

조회 수: 7 (최근 30일)
Benjamin Rodgers
Benjamin Rodgers 2013년 2월 27일
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