필터 지우기
필터 지우기

Wave simulation

조회 수: 16 (최근 30일)
Joaquim
Joaquim 2012년 4월 15일
답변: Sambit Supriya Dash 2021년 4월 20일
Hello I'm trying to simulate a single source wave in matlab does anyone know how to do that? (code tips)
Thanks

답변 (1개)

Sambit Supriya Dash
Sambit Supriya Dash 2021년 4월 20일
This answer may not be useful for the author (it's getting answered after a decade), but could possibly useful for others...
Try to run this code, you will get an idea of it
Suppose, the parameters are as such....
%%%%%%%%% CODE %%%%%%%%%%
% Parameters
L = 10; T = 10; H = 2;
k = 2*pi/L; sigma = 2*pi/T;
dx = L/50;
dt = T/20;
x = 0:dx:L;
t = 0:dt:T;
%%%%%%%% PLOTTING %%%%%%%%%%
figure(1)
for i = 1:length(t)
tt = t(i);
z = 0.5*H*sin(k*x-sigma*tt);
plot(x,z,'-ob','MarkerFaceColor','b')
yline(0,'-.r','M.S.L','LineWidth',2)
xlabel('x (m)')
ylabel('\eta (m)')
axis([x(1) x(end) -H*2/3 H*2/3])
drawnow
end
Hope this helped.

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by