How to link the wave equation with guitar string
    조회 수: 7 (최근 30일)
  
       이전 댓글 표시
    
I am totally a new user of Matlab, and my final year project is requested to use Matlab, so I really need your help to answer my questions...thanks a lot!
dx = .01 ; % Spacing of points on string dt =.01 ; % Size of time step
 c = 1 ;% Speed of wave propagation
 L = 1 ;% Length of string
stopTime = 30 ; % Time to run the simulation
 r = c*dt/dx ;
 n=L/dx+1
 % Set current and past to the graph of a plucked string
current = .5-.5* cos (2* pi /L * [ 0 : dx :L ] ) ;
past = current ;
for t=0: dt : stopTime
 % Calculate the future position of the string
future ( 1 ) = 0 ;
 future ( 2 : n-1) = r^2*( current ( 1 : n-2)+current ( 3 : n ) ) + 2*(1-r^2)* current ( 2 : n-1) - past ( 2 : n-1);
future (n) = 0 ;
 % Set things up for the next time step
past = current ;
current = future ;
 % Plot the graph after every 10th frame
if mod( t /dt , 10) == 0
plot ( [ 0 : dx :L] , current )
axis ( [ 0 L -2 2 ] )
pause ( .001 )
end
end
The above code i get from website and anyone can explain to me how to link this code with wave equation and guitar string (fixed at both ends)?
댓글 수: 0
답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Audio Processing Algorithm Design에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
