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!

