Plot measured Filter data
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
VBBV
2022 年 5 月 20 日
編集済み: VBBV
2022 年 5 月 20 日
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 件のコメント
VBBV
2022 年 5 月 20 日
frequency is 1st column of table. while plotting, use frequency as xscale and gain/phase as yscale.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!