[Beginner] How to plot the resonance frequency with bandwidth

Been looking for ages and struggling to find how to plot a bandwidth line onto a graph for an AC circuit. I've managed to gather the resonance frequency, bandwidth and current. How would I go about plotting these into the graph? Image shows what I'm looking for. Thanks in advance.

 采纳的回答

Try this:
f = linspace(0, 10); % Create Data: Frequency
h = exp(-(f-5).^2); % Create Data: Transfer Function
[hmax,idx] = max(h); % Maximum
dB3 = hmax * 10^(-3/20); % -3 dB Amplitude
f_lower3dB = interp1(h(1:idx), f(1:idx), dB3); % Lower -3 dB Frequency
f_upper3dB = interp1(h(idx+1:end), f(idx+1:end), dB3); % Upper -3 dB Frequency
figure(1)
plot(f, h, '-r')
hold on
plot(xlim, [1 1]*hmax, '-k')
plot(xlim, [1 1]*dB3, '-k')
plot([1 1]*f_lower3dB, [0 dB3], '-b')
plot([1 1]*f_upper3dB, [0 dB3], '-b')
plot([1 1]*f(idx), [0 hmax], ':b')
hold off
text(7, hmax, ' 0 dB', 'HorizontalAlignment','left', 'VerticalAlignment','bottom')
text(7, dB3, '-3 dB', 'HorizontalAlignment','left', 'VerticalAlignment','bottom')
text(f_lower3dB, 0.3, '\leftarrow', 'HorizontalAlignment','left', 'VerticalAlignment','middle')
text(f_upper3dB, 0.3, '\rightarrow', 'HorizontalAlignment','right', 'VerticalAlignment','middle')
text(5.2, 0.3, '\itB\rm', 'HorizontalAlignment','right', 'VerticalAlignment','middle')
axis([xlim [0 1.1*hmax]])
Experiment to get the result you want.

3 个评论

Perfect, works a charm. Thanks very much!
Will be interesting to see how your's has worked Ben. I'm doing very much the same but can not convert this to my script using my data for Fr, Fh, Fl and I. Do not share until after hand in though :)

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by