Plot measured Filter data
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all,
I got mearsurement data from a real band pass filter. To make a professional plot, I am using matlab. The x-axis is in logarithmic scale. While plotting the magnitude it is working perfectly. Unfortunately, it does not work for the phase. But when I plot it with libre office calc, I get the correct result. The excel file is attached. It would be great if you could give a hint. Thank you in advance!
Plot with libre office calc:
The code is as follows:
T = readtable('Plot.xls');
gain = T{(22:109),1};
frequency = T{(22:109),2};
phase = T{(22:109),3};
%plot gain
subplot(2,1,1);
semilogx(gain, frequency); %x axis has log scale
title('Bode Diagram')
xlabel('Frequency [Hz]')
ylabel('Magnitude [dB]')
%plot phase
subplot(2,1,2);
semilogx(phase, frequency); %x axis has log scale
xlabel('Frequency [Hz]')
ylabel('Phase [deg]')
grid on
0 commentaires
Réponse acceptée
VBBV
le 20 Mai 2022
Modifié(e) : VBBV
le 20 Mai 2022
T = readtable('Plot.xls')
frequency = T{(22:109),1}; % change this to ffequency
gain = T{(22:109),2};
phase = T{(22:109),3};
%plot gain
subplot(2,1,1);
semilogx(frequency,gain); %x frequency as x-scale
grid
title('Bode Diagram')
xlabel('Frequency [Hz]')
ylabel('Magnitude [dB]')
%plot phase
subplot(2,1,2);
semilogx(frequency,phase); %x here too
xlabel('Frequency [Hz]')
ylabel('Phase [deg]')
grid on
2 commentaires
VBBV
le 20 Mai 2022
frequency is 1st column of table. while plotting, use frequency as xscale and gain/phase as yscale.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots 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!