How to plot the magnitude and phase of this Fourier Transform frequency response that contains jw?
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Harrison Ahn
le 2 Avr 2018
Réponse apportée : Star Strider
le 2 Avr 2018
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 commentaires
Réponse acceptée
Star Strider
le 2 Avr 2018
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Digital Filter Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!