利用fourier函数求频谱图
步骤:
一、写出信号表达式
二、求表达式的傅里叶逆变换
三、求出幅度谱
四、求出相位谱
ft=sym('(t+4)/2*heaviside(t+4)-t*heaviside(t)+(t-4)/2*heaviside(t-4)');
Fw=simplify(fourier(ft));
subplot(211);
ezplot(abs(Fw),[-pi,pi]);grid on;
subplot(212);
ezplot(atan(imag(Fw)/real(Fw)));
PS:符号解有其局限性,如果返回函数中友dirac(t)等项,则用ezplot函数无法作图。对某些信号求变换时,其返回函数可能包含一些不能直接用符号表达的式子,甚至可能出现提示“未被定义的函数或变量”,因而也不能对此返回函数作图