Evaluate for specific frequencies using freqs

11 views (last 30 days)
N/A
N/A on 26 Oct 2021
Commented: Rena Berman on 13 Dec 2021
Hello all,
I have evaluated a specific system (with a transfer function) for a range of frequencies and successfully plotted the outputs for both phase and magnitude using freqs (Frequency response of analog filters). I would now like to evaluate my systems magnitdue and phase at a specifc frequency of approx 9.68 rad/s. How can I go about extracting this at the specific freuqncy value? The documentation was limited and I couldn't make any progress. I would appreciate any and all help.
Thank you.
  2 Comments
Star Strider
Star Strider on 29 Oct 2021
This was originally Evaluate for specific frequencies using freqs and my Answer was initially accepted so I won’t delete it.
The (now deleted) text of the question asked to plot and return a specific frequency (9.68 rad/s) for a transfer function using freqs. The transfer function itself was not provided.
.

Sign in to comment.

Answers (1)

Star Strider
Star Strider on 26 Oct 2021
Using an example from the freqs documentation —
a = [1 0.4 1];
b = [0.2 0.3 1];
w = logspace(-1,1.3);
h = freqs(b,a,w);
fp = 9.68;
hfp = freqs(b,a,[1;1]*fp)
hfp =
0.1923 - 0.0233i 0.1923 - 0.0233i
mag = abs(h);
phase = angle(h);
phasedeg = phase*180/pi;
subplot(2,1,1)
loglog(w,mag)
hold on
plot(fp, abs(hfp(1)),'+r')
hold off
grid on
xlabel('Frequency (rad/s)')
ylabel('Magnitude')
subplot(2,1,2)
semilogx(w,phasedeg)
hold on
plot(fp, rad2deg(angle(hfp(1))),'+r')
hold off
grid on
xlabel('Frequency (rad/s)')
ylabel('Phase (degrees)')
The magnitude and phase at the given frequency are plotted as red (+) signs. (Creating ‘fp’ as a vector is necessary in order to define it as a frequency.)
.

Tags

Products

Community Treasure Hunt

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

Start Hunting!