Could someone please provide MATLAB code wave propagation?

 採用された回答

chia ching lin
chia ching lin 2021 年 5 月 31 日

2 投票

v=343; % m/s
f=1000; % Hz
w=2*pi*f; % angular frequency
lambda=v/f; % wavelength
k=2*pi/lambda; % k-vector
x=-2:0.01:2;
y=x;
[X,Y]=meshgrid(x,y);
A=1; % amplitude
t=linspace(0,pi,50);
for a=1:length(t)
r=sqrt(X.^2+Y.^2);
E=(A./r).*exp(1i.*(k.*r-w.*t(a))); % wave equation
pcolor(X,Y,real(E)); shading flat; axis equal;
caxis([-5 5]);
drawnow;
end
Is this what you are looking for ?

1 件のコメント

Jahnavi Mudiyala
Jahnavi Mudiyala 2021 年 6 月 1 日
編集済み: Jahnavi Mudiyala 2021 年 6 月 1 日
Thank you so much

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeAcoustics, Noise and Vibration についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by