Extract data from a bode plot.
38 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Star Strider
el 10 de Mayo de 2022
Editada: Star Strider
el 10 de Mayo de 2022
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 comentarios
Star Strider
el 11 de Mayo de 2022
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.)
.
Ver también
Categorías
Más información sobre Plot Customization en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

