Wave simulation

5 ビュー (過去 30 日間)
Joaquim
Joaquim 2012 年 4 月 15 日
編集済み: Image Analyst 2025 年 5 月 4 日
Hello I'm trying to simulate a single source wave in matlab does anyone know how to do that? (code tips)
Thanks

回答 (2 件)

Sambit Supriya Dash
Sambit Supriya Dash 2021 年 4 月 20 日
編集済み: Image Analyst 2025 年 5 月 4 日
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.

Aniket
Aniket 2025 年 5 月 4 日
編集済み: Image Analyst 2025 年 5 月 4 日
fc=10000;
fm=1000;
fs = 10.00000;
m = 0.5;
A = 1/m;
opt = -A;
t = 0:1/fs:((2/fm)-(1/fs));
Vc = cos(2*pi*fc*t);
Vm = cos(2*pi*fm*t);
y = modulate(Vm, fc, fs, 'amdsb-tc', opt);
Error using modulate (line 86)
The carrier frequency must be less than half the sampling frequency.
subplot(3,2,1);
plot(t, Vm);
title('Original modulating signal');
xlabel('time');
ylabel('Amplitude of original signal');
subplot(3,2,2);
plot(t, Vc);
title('Unmodulating carrier signal');
xlabel('time');
ylabel('Amplitude of carrier signal');
subplot(3,2,3);
plot(t, y);
title('Amplitude modulated signal m=0.5');
xlabel('time');
ylabel('Amplitude of AM signal');
m = 1.0;
opt = -1/m;
y = modulate(Vm, fc, fs, 'amdsb-tc', opt);
subplot(3,2,4);
plot (t,y);
title ('Amplitude modulated signal m=1.0');
xlabel ('time');
ylabel ('Amplitude of AM signal');
m=1.5;
opt = -1/m;
y = modulate (Vm,fc,fs,'amdsb-tc',opt);
subplot(3,2,5);
plot (t,y);
title ('Amplitude modulated signal m=1.5');
xlabel ('time');
ylabel ('Amplitude of AM signal');

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by