How to plot the magnitude and phase of this Fourier Transform frequency response that contains jw?
조회 수: 8 (최근 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!