谁能教我一下用matlab怎样模拟出siren的声音。还要对频普进行观测。

来源:百度知道 编辑:UC知道 时间:2024/04/27 11:07:19

%siren
f_m=500;
f_p=660;
f_e=1.5;
A=2;
t=[1/44100:1/44100:5];
ip=2*pi*(f_m*t-1/2*(f_p-f_m)/pi/f_e*cos(2*pi*f_e*t));
y=A*sin(ip);
wavplay(y,44100);
Y= fft(y);

Pyy = Y.*conj(Y)/256;% this is psd
subplot(2,2,1);
plot(Pyy)
title('psd')
xlabel('Frequency (Hz)')

x=1..1*E8;
y=sin(x/2000);
ploy(x,y);