Extract data points from bodemag plot

4 views (last 30 days)
Looking for a way to extract the data points of the magnitude from a bodemag plot. How can this be done?

Accepted Answer

Star Strider
Star Strider on 25 Sep 2022
it would likely be easier to use the approach bode in Obtain Magnitude and Phase Data. (Remember to use the squeeze function with those, if necessary.)
This seems to work —
H = tf([1 0.1 7.5],[1 0.12 9 0 0]);
bodemag(H)
Ax = gca;
% get(Ax)
Lines = findobj(Ax, 'Type','Line');
% L1 = Lines(1);
L2 = Lines(2);
X = L2.XData
X = 1×88
0.0000 0.0000 0.0000 0.0000 0.0001 0.0055 0.0548 0.0640 0.0747 0.0873 0.1019 0.1190 0.1390 0.1623 0.1896 0.2214 0.2586 0.3020 0.3527 0.4119 0.4811 0.5618 0.6561 0.7663 0.8950 1.0452 1.2207 1.4257 1.5382 1.7142
Y = L2.YData
Y = 1×88
798.4164 648.8739 448.8739 288.8739 168.8739 88.8739 48.8734 46.1771 43.4807 40.7842 38.0875 35.3907 32.6936 29.9961 27.2982 24.5995 21.8999 19.1990 16.4963 13.7912 11.0825 8.3690 5.6486 2.9181 0.1728 -2.5953 -5.3997 -8.2660 -9.7058 -11.8313
.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by