Plot measured Filter data
조회 수: 1 (최근 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!