Azzera filtri
Azzera filtri

How can I extract the x and y values of the phase- and magnitude graph of a .fig file plotted with bodeplot() or bode()?

3 visualizzazioni (ultimi 30 giorni)
I got a myBodeplot.fig file with two subplots and want to extract the x and y values for magnitude and phase.

Risposta accettata

Paul
Paul il 16 Dic 2023
Modificato: Paul il 16 Dic 2023
sys = tf(1,[1 1]);
bode(sys);
hf = gcf;
hax = hf.Children
hax =
3×1 graphics array: ContextMenu Axes Axes
hax(2).Children % the first child is the phase plot
ans =
2×1 graphics array: Group (sys) Line
hax(2).Children(1)
ans =
Group (sys) with properties: Children: [1×1 Line] Visible: on HitTest: on Use GET to show all properties
hax(2).Children(1).Children
ans =
Line with properties: Color: [0 0.4471 0.7412] LineStyle: '-' LineWidth: 0.5000 Marker: 'none' MarkerSize: 6 MarkerFaceColor: 'none' XData: [1.0000e-20 2.0000e-17 2.0000e-12 2.0000e-08 2.0000e-05 0.0020 0.0200 0.0234 0.0273 0.0320 0.0374 0.0437 0.0511 0.0598 0.0699 0.0818 0.0956 0.1118 0.1308 … ] (1×63 double) YData: [0 0 -1.1459e-10 -1.1459e-06 -0.0011 -0.1146 -1.1458 -1.3398 -1.5666 -1.8318 -2.1418 -2.5042 -2.9277 -3.4225 -4.0005 -4.6754 -5.4629 -6.3811 -7.4508 -8.6949 … ] (1×63 double) ZData: [1×0 double] Use GET to show all properties
w = hax(2).Children(1).Children.XData;
phase = hax(2).Children(1).Children.YData;
figure
semilogx(w,phase),grid
Note that bode keeps reasonable limits on the frequency axis
figure
semilogx(w,phase),grid
xlim([0.01 100])
Repeat for magnitude plot.

Più risposte (0)

Prodotti


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by