[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.

 채택된 답변

Star Strider
Star Strider 2018년 3월 22일
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!
As always, my pleasure!
Simon Robinson
Simon Robinson 2018년 3월 22일
편집: Simon Robinson 2018년 3월 22일
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에 대해 자세히 알아보기

질문:

2018년 3월 22일

편집:

2018년 3월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by