Clear Filters
Clear Filters

How to Numerical Nyquist Plot?

1 view (last 30 days)
Hello there! I'm trying to make a numerical nyquist plot of the following system
a = [-1 0; 0 -1] b = [1 99; 0 1] c = [1 0; 0 1] d = [0 0 ; 0 0]
The correct plot is achieved analytically by: phi = -1 + det[I+G(S)] = (2s +3)/(s+1)^2
In Matlab:
s = tf('s')
phi = (2s +3)/(s+1).^2
nyquist(phi)
The thing is, I want to automate this operations, once Matlab doesn't work very well with symbolic variables, I need to do this numerically.
1. The first way I tried this was(actually, this was an analytic solution):
nyquist(tf(ss(a,b,c,d)))
but this gives me a graph I cannot understand and tell why it's wrong:
Why is it wrong? What is happening there?
2. I know I must find the Characteristic polynomial and I believe I must plot all the values of F(s) for s being a contour that encompasses the right-half of the complex plane. SO I tried something like this:
w = logspace(0,10,1000) for k=1:length(w) G = (2*i+3)/((w(k)*i+1).^2) plot(real(G),imag(G),'bo') hold on end
And got something REALLY different from what I wanted:
Please, someone help me!! : )

Accepted Answer

Stefan Raab
Stefan Raab on 2 Nov 2015
Hello,
actually the following code doesn't work:
s = tf('s')
phi = (2s +3)/(s+1).^2
nyquist(phi)
I have to ask what you want to calculate with this: phi = -1 + det[I+G(S)] = (2s +3)/(s+1)^2 ? I'm not quite sure what you want to do there. Now, to your questions:
1) As your system is MIMO (Multiple Input Multiple Output) because of the dimensions of B and C, your transfer function is acutally a transfer matrix (which input to which output) according to: G(s) = C*(s* I- A)^(-1)* B . Therefore MATLAB plots all four transfer functions (see the labels: Input .. to Output ..).
tf(ss(a,b,c,d)) =
From input 1 to output...
1
1: -----
s + 1
2: 0
From input 2 to output...
99
1: -----
s + 1
1
2: -----
s + 1
2) In your code is a little mistake I think. You forgot the w(k) in your numerator: G = (2 * w(k) *i+3)/((w(k)*i+1).^2) . Beside this fact, your numerical nyquist plot for this transfer function should be fine, but it won't start from w = 0, as logspace starts from 10^0 = 1 (if you're wondering why your plot is not complete).
I hope I could help you, best regards,
Stefan
  1 Comment
Rafael Sanchez Souza
Rafael Sanchez Souza on 10 Nov 2015
Edited: Rafael Sanchez Souza on 10 Nov 2015
It worked! I added the w(k) : )
The other code didn't work because of syntax. There was a missing * between 2 and s. 2*s instead of 2s.
Thanks a lot,
Rafael

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Performance 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!