Extract data from a bode plot.
조회 수: 38 (최근 30일)
이전 댓글 표시
How do I extract an Excel table from the Bode of this transfer function:
format long;
s = tf('s');
HLM = ((2.524e-06)*s^3 + 37.11*s^2 + 37.6*s)/((2.704e-07)*s^3 + 1.767*s^2 + 41.36*s + 80);
Finf = 1e-3; %Hz
Fsup = 1e9; %Hz
options = bodeoptions;
options.FreqUnits = 'Hz';
Wmin = 2*pi*Finf;
Wmax = 2*pi*Fsup;
bode(HLM,{Wmin,Wmax}, options);
The bode was plotted in Hz, degrees, and from 1mHz to 1GHz.
댓글 수: 0
답변 (1개)
Star Strider
2022년 5월 10일
편집: Star Strider
2022년 5월 10일
s = tf('s');
HLM = ((2.524e-06)*s^3 + 37.11*s^2 + 37.6*s)/((2.704e-07)*s^3 + 1.767*s^2 + 41.36*s + 80);
Finf = 1e-3; %Hz
Fsup = 1e9; %Hz
options = bodeoptions;
options.FreqUnits = 'Hz';
Wmin = 2*pi*Finf;
Wmax = 2*pi*Fsup;
figure
bode(HLM,{Wmin,Wmax}, options) % Plot With Options
[mag,phase,wout] = bode(HLM,{Wmin,Wmax}); % Return Calculated Data
mag = squeeze(mag);
phase = squeeze(phase);
fout = wout/(2*pi); % Convert To 'Hz'
BodeTable = table(fout,mag,phase)
EDIT — (10 May 2022 at 22:06)
Initially forgot that frequency vector was to be in Hz. Corrected.
.
댓글 수: 4
Star Strider
2022년 5월 11일
The frequency vector is an argument to the bode function (here ‘wv’) not the bodeoptions structure —
s = tf('s');
HLM = ((2.524e-06)*s^3 + 37.11*s^2 + 37.6*s)/((2.704e-07)*s^3 + 1.767*s^2 + 41.36*s + 80);
Finf = 1e-3; %Hz
Fsup = 1e9; %Hz
options = bodeoptions;
options.FreqUnits = 'Hz';
Wmin = 2*pi*Finf;
Wmax = 2*pi*Fsup;
wv = logspace(-3, 9, 1000)*2*pi; % Vector Of 500 Radian Frequencies (Logarithmically Scaled)
figure
bode(HLM, wv, options) % Plot With Options
[mag,phase,wout] = bode(HLM, wv); % Return Calculated Data
mag = squeeze(mag);
phase = squeeze(phase);
fout = wout/(2*pi); % Convert To 'Hz'
BodeTable = table(fout,mag,phase)
As requested, it produces a 1000-element frequency vector, and transfer function results at those values. (The plot does not appear to me to be different from the plot with the default frequencies, except for the higher frequency resolution.)
.
참고 항목
카테고리
Help Center 및 File Exchange에서 Plot Customization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

