xiazai2.m

来自「x=2*sin(4*pi*t)+5*cos(8*pi*t) 对其进行快速傅立叶变」· M 代码 · 共 12 行

M
12
字号
t = 0:1/100:10-1/100;
x = sin(2*pi*15*t) + sin(2*pi*40*t);
y = fft(x); 
m = abs(y);
p = unwrap(angle(y));
f = (0:length(y)-1)'*100/length(y);
subplot(2,1,1), plot(f,m), 
ylabel('Abs. Magnitude'), grid on
subplot(2,1,2), plot(f,p*180/pi)
ylabel('Phase [Degrees]'), grid on
xlabel('Frequency [Hertz]')

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?