% 传函定义
s=tf('s');
Gs=1/(s^2+s+1)
% 频率范围
w=logspace(-2,2,100)';
% 频率特性(复数)
[n d] = tfdata(G);
for i=1:length(w)
Gjw(i)=( n{1}*((j*w(i)).^(2:-1:0)).') / ( d{1}*((j*w(i)).^(2:-1:0)).');
end
% 绘制对数频率特性曲线
subplot(211)
semilogx(w,20*log10(abs(Gjw)))
ylabel('Magnitude (dB)')
subplot(212)
semilogx(w,angle(Gjw)*180/pi)
ylabel('Phase (deg)')
xlabel('Frequency (rad/sec)')
[num.den] = tfdata(GS);
明天给你答案