How to plot the magnitude and phase of this Fourier Transform frequency response that contains jw?
7 次查看(过去 30 天)
显示 更早的评论
I have a frequency response X1 = ((j.*w+100).*(j.*w+200))./((j.*w+10).*(j.*w+1000).*(j.*w+10000)); and would like to plot its magnitude in dB and phase versus the log of frequency with frequency from 0.5Hz to 3000Hz in steps of 5Hz but it doesn't seem to work because of the 'j' in my function.
This is my code:
clf % Clear any existing figure
w = log(0.5):log(5):log(3000); % Frequency from 0.5Hz to 3000Hz with increment of 5Hz
X1 = ((j.*w+100).*(j.*w+200))./((j.*w+10).*(j.*w+1000).*(j.*w+10000)); % Blue
subplot(2,1,1)
plot(w,abs(X1));
title('Magnitude')
ylabel('Magnitude (db)')
xlabel('Log of Frequency')
ylim([-1 10]);
grid on
subplot(2,1,2)
plot(w,angle(X1));
title('Phase')
ylabel('Phase (°)')
xlabel('Log of Frequency')
grid on
0 个评论
采纳的回答
Star Strider
2018-4-2
If you define ‘w’ differently, and change (or delete) the ‘ylim’ assignment, you can see it.
I defer to you to determine if it does what you want.
w = logspace(-3,4);
X1 = ((j.*w+100).*(j.*w+200))./((j.*w+10).*(j.*w+1000).*(j.*w+10000)); % Blue
subplot(2,1,1)
semilogx(w,20*log10(abs(X1)));
title('Magnitude')
ylabel('Magnitude (dB)')
xlabel('Log of Frequency')
set(gca, 'XLim',[0.5 3000])
% ylim([-1 10]);
grid on
subplot(2,1,2)
semilogx(w,angle(X1)*180/pi);
title('Phase')
ylabel('Phase (°)')
xlabel('Log of Frequency')
set(gca, 'XLim',[0.5 3000])
grid on
I added the conversion to dB in the magnitude plot, and the conversion from radians to degrees in the phase plot, since you apparently want those.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Digital Filter Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!