Stability boundaries - intersection with real and Imaginary axis
Afficher commentaires plus anciens
I am plotting the stability regions (please see the code below).
How can I calculate the intersections with real and imaginary axis for each stability region, please?

I was trying to filter the data in the matrix M (size 200x200), but unfortunately, I was not very successulf:
For example, I was trying to filter the matrix data to get the intersection with real axis:
I tried to get the entries where imaginary part of M equals to zero, and then get the maximum real value, but it seems it does not work correclty:
zeroImag = M(imag(abs(M)) == 0);
maxReal = max(real(abs(zeroImag)))
The code for plotting the stability regions:
x = linspace(-5, 2, 200);
y = linspace(-3.5, 3.5, 200);
[X,Y] = meshgrid(x,y);
Z = X + 1i*Y;
% Stability function
% R(z) = 1 + z + z^2/2! + z^3/3! + z^4/4 + ...
nom = Z;
denom = 1;
M = 1;
figure;
color = {'b','r','g','m','c','k'};
for j=2:5
M = M + nom/denom;
nom = Z.^j;
denom = j * denom;
% plot the stability region of order "j"
contour(x,y,abs(M),[1 1], 'Color', color{j}, 'LineWidth',2);
hold on;
end
grid on;
% plot real and imaginary axis
plot([-5, 2],[0 0],'k-')
hold on;
plot([0 0],[-3.5, 3.5],'k-')
xlabel('Re')
ylabel('Im')
title('Runge-Kutta - orders 1,2,3,4')
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!