MATLAB: Zero-crossings of Nyquist Diagram

complex numberscrossing pointdiagramextract valueimaginary partincreasenyquistobtain valuesplotreal parttransfer functionzeropoints

Hi,
I have been trying to extract all the zero-crossings of the Nyquist plot of my transfer function zp. So I want to obtain the real part value where the Nyquist plot crosses the Real Axis.
Here is an example of how the Nyquist diagram could look like (I keep changing specific parameters so the Nyquist diagram also keeps changing):
I already tried extracting the zero crossings with the folloing code,
[re,im] = nyquist(zp);
Re = squeeze(re);
Im = squeeze(im);
With the given values I searched where the imaginary part was close to zero. But unfortunately it isn't precise enough and what I need is very detailed data. Increasing the amount of values also didn't get me much further. This is the code I used to increase my amount of values:
upperbound = 2*pi*(1600);
lowerbound = 2*pi*(-1600);
increase_number_of_Values = linspace(lowerbound,upperbound,5000);
[re,im] = nyquist(zp, increase_number_of_Values);
Re = squeeze(re);
Im = squeeze(im);
This code doesn't give me every zero-crossing of the Nyquist plot. I already changed the frequency interval various times, yet it doesn't show me every zero-crossing. Then I tried to extract the zero crossings directly from the transfer function itself. With the following code:
fp = [-1600:0.1:1600];
zp_values = [];
for k = 1 : length(fp)
w= 2*pi*fp(k);
zp_values(k) = (my transfer function); %it calculates the value of zp for every frequency in my array fp
end
However this also did not work. I chose the frequency interval -1600Hz <= fp <= 1600Hz because the values which I want to observe in the Nyquist plot have a frequency between -10000 rad/s to 10000 rad/s.
Has anybody an idea how I can extract the zero-crossings of my Nyquist plot, as accurately as possible?
Thanks very much for your help!

Best Answer

Hi Leopold,
I understand that you need to find the zero-crossings of the imaginary part of the Nyquist diagram. I assume that you have already extracted the real-part and the imaginary part separately.
In that case you can refer the following answer thread for a solution,
The following is a specific example
H = tf([2 5 1],[1 2 3]);
[re,im] = nyquist(H);
re = squeeze(re);
im = squeeze(im);
plot(re,im)
zci = @(v) find(v(:).*circshift(v(:), [-1 0]) <= 0);
zind = zci(im);
figure(1)
plot(re,im,'r');
hold on
plot(re(zind),im(zind),'bp')
hold off
grid
You can also try interpolating your data for a more accurate values.