Peak Value from bodemag plot

80 次查看(过去 30 天)
I am trying to calculate the peak value of the bodemag plot. Attached is the code I am trying to use
[gpeak,fpeak] = getPeakGain(SS_1)
gpeak_dB = 20*log10(gpeak);
However that doesn't seem to work for bodemag plots, only for bode plots because it isn't giving me the correct peak for the plot attached.
How do I calculate the peak of a bodemag plot?

采纳的回答

Star Strider
Star Strider 2020-3-1
Try this:
F = openfig('untitled.fig');
getF = get(F);
Lines = findobj(F, 'Type','Line');
for k = 1:numel(Lines)
X{k} = Lines(k).XData;
Y{k} = Lines(k).YData;
[Ymax,Idx] = max(Y{k});
FM{k,:} = [X{k}(Idx) Ymax Idx];
end
MagFreq = array2table(cell2mat(FM), 'VariableNames',{'Frequency','Magnitude','Index'})
producing:
MagFreq =
Frequency Magnitude Index
_________ ___________ _____
NaN NaN 1
NaN NaN 1
1e-20 1.2722e-14 1
1e-20 0 1
1e-20 1.2722e-14 1
1e-20 2.5444e-14 1
1e-20 0 1
1e-20 1.7358e-14 1
1.6051 0.52101 35
1e-20 -2.5073e-14 1
1.3159 0.062431 32
1e-20 -2.5073e-14 1
It is not difficult to extract the values, however it is definitely not straightforward.
  4 个评论
JD
JD 2020-3-1
That makes a lot of sense! Thank you so much for your input and help!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Time and Frequency Domain Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by