[Beginner] How to plot the resonance frequency with bandwidth
5 views (last 30 days)
Show older comments
Ben Cartwright
on 22 Mar 2018
Edited: Simon Robinson
on 22 Mar 2018
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.

0 Comments
Accepted Answer
Star Strider
on 22 Mar 2018
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 Comments
Simon Robinson
on 22 Mar 2018
Edited: Simon Robinson
on 22 Mar 2018
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 :)
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!