Plot measured Filter data

1 Ansicht (letzte 30 Tage)
Sebastian D.
Sebastian D. am 20 Mai 2022
Bearbeitet: Sebastian D. am 20 Mai 2022
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

Akzeptierte Antwort

VBBV
VBBV am 20 Mai 2022
Bearbeitet: VBBV am 20 Mai 2022
T = readtable('Plot.xls')
T = 121×3 table
F A P _______ _______ ______ 0.1 -19.679 44.63 0.11221 -30.408 -160.9 0.1259 -26.056 98.76 0.14127 -24.935 87.441 0.15851 -25.049 84.581 0.17786 -24.997 95.553 0.19957 -24.801 66.816 0.22393 -22.482 92.478 0.25127 -21.834 95.452 0.28194 -20.728 80.841 0.31635 -19.421 94.68 0.35497 -18.53 92.847 0.39829 -17.533 92.878 0.44691 -16.923 88.998 0.50146 -15.615 90 0.56267 -14.874 90.817
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 Kommentare
VBBV
VBBV am 20 Mai 2022
frequency is 1st column of table. while plotting, use frequency as xscale and gain/phase as yscale.
Sebastian D.
Sebastian D. am 20 Mai 2022
Bearbeitet: Sebastian D. am 20 Mai 2022
Thank you very much for your help!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by