What Are the Correct Steps to Plot Stability Regions in Numerical Methods?

In summary: Euler's Method Stability Region');In summary, the Euler's Method stability region is found by using a function that takes in y as input and z as output.
  • #1
Ally1
3
0
In many cases one finds code such as
x = linspace(-3,1.5,200);
y = linspace(-3.5,3.5,200);
[X,Y] = meshgrid(x,y);
Z = X +Y*i;
%Euler's Method
M = abs(1+Z);
[c,h] = contour(X,Y,M,[1,1]);
set(h,'linewidth',2,'edgecolor','g')
to plot the stability region of the Euler's Method, where in fact the definition of is Z = lambda*h, where h is a step-size and lambda an eigenvalue.

1. How do I modify this program the above in terms of Z = lambda*h?

2. How do I plot different regions on same plot?

Thanking you in advance.
 
Physics news on Phys.org
  • #2
Hi Ally,

For 2), you can plot different/multiple regions on the same plot by using the "hold on" and "hold off" command.
 
  • #3
Ok thanks but I am more concern about point 1).
 
  • #4
Ally said:
Ok thanks but I am more concern about point 1).

Well, if $\lambda$ is an eigenvalue, then it's the eigenvalue of some operator. I have one possibility in mind for what that operator is, but what do you think it is?
 
  • #5
Thank for your respond.

To clear my question, let me take an example of the Exponential Time Differencing-Runge-Kutta Method [F. de la Hoz and F. Vadillo Computer Physics Communications 179 (2008) 449–456 ], I tried to code the stability regiong of this method as you can see below but the code is not giving me the correct regions within each other.
function stability_of_cancer_hiv(y)
%
ROOT = []; ROOT0 = []; lambda = 0.05; h = 0.6; z = lambda*h;
%
if y==0;
% y=-0.5*h;
c0 = exp(y);
c1 = 1 + y + 1/2*y^2 + 1/6*y^3 + 13/320*y^4 + 7/960*y^5;
c2 = 1/2 + 1/2*y + 1/4*y^2 + 247/2880*y^3 + 131/5760*y^4 + 479/96768*y^5;
c3=1/6+1/6*y+61/720*y^2+1/36*y^3+1441/241920*y^4+67/120960*y^5;
c4=1/24+1/32*y+7/640*y^2+19/11520*y^3-25/64512*y^4-311/860160*y^5;
else
c0=exp(y);
c1=-4/y^3+8*exp(y/2)/y^3-8*exp(3*y/2)/y^3+4*exp(2*y)/y^3-1/y^2+4*exp(y/2)/y^2-...
6*exp(y)/y^2+4*exp(3*y/2)/y^2-exp(2*y)/y^2;
c2=-8/y^4+16*exp(y/2)/y^4-16*exp(3*y/2)/y^4+8*exp(2*y)/y^4-5/y^3+12*exp(y/2)/y^3-...
10*exp(y)/y^3+4*exp(3*y/2)/y^3-exp(2*y)/y^3-1/y^2+4*exp(y/2)/y^2-3*exp(y)/y^2;
c3=4/y^5-16*exp(y/2)/y^5+16*exp(y)/y^5+8*exp(3*y/2)/y^5-20*exp(2*y)/y^5+8*exp(5*y/2)/y^5+...
2/y^4-10*exp(y/2)/y^4+16*exp(y)/y^4-12*exp(3*y/2)/y^4+6*exp(2*y)/y^4-2*exp(5*y/2)/y^4+...
4*exp(y)/y^3-2*exp(3*y/2)/y^3;
c4=8/y^6-24*exp(y/2)/y^6+16*exp(y)/y^6+16*exp(3*y/2)/y^6-24*exp(2*y)/y^6+8*exp(5*y/2)/y^6+...
6/y^5-18*exp(y/2)/y^5+20*exp(y)/y^5-12*exp(3*y/2)/y^5+6*exp(2*y)/y^5-2*exp(5*y/2)/y^5+...
2/y^4-6*exp(y/2)/y^4+6*exp(y)/y^4-2*exp(3*y/2)/y^4;
end
for theta = 1:200;
p0 = [z^4/24 z^3/6 z^2/2 z (1-exp(1i*theta))];
ROOT1 = roots(p0);
ROOT = [ROOT ROOT1];
%
p1 = [c4*z^4/24 c3*z^4/6 c2*z^4/2 c1*z c0*(1-exp(1i*theta))];
ROOT2 = roots(p1);
ROOT0 = [ROOT0 ROOT2];
end
% disp(ROOT);
figure(1); plot(real(ROOT),imag(ROOT),'k','linewidth',0.1);
figure(2); plot(real(ROOT0),imag(ROOT0),'k','linewidth',1);
 

FAQ: What Are the Correct Steps to Plot Stability Regions in Numerical Methods?

What is the purpose of plotting stability regions?

The purpose of plotting stability regions is to visually represent the stability of a system, which is determined by the location of its roots or eigenvalues. This allows scientists and engineers to analyze and understand the behavior of a system, and make predictions about its stability under different conditions.

How are stability regions plotted?

Stability regions are typically plotted by finding the roots or eigenvalues of the system's characteristic equation, which is a function of the system's parameters. These roots are then plotted on a complex plane, with the real part on the horizontal axis and the imaginary part on the vertical axis. The resulting shape is known as the stability region.

What does the shape of a stability region indicate?

The shape of a stability region indicates the stability of the system. A stability region that is completely contained within the left half of the complex plane (i.e. all roots have negative real parts) indicates that the system is stable. On the other hand, if the stability region extends into the right half of the complex plane, the system is unstable.

How can stability regions be used to improve a system?

By analyzing the stability regions, scientists and engineers can identify the critical regions where the system becomes unstable. This information can then be used to make adjustments to the system's parameters or design in order to improve its stability. Additionally, stability regions can be used to determine the maximum stable region or the optimal parameters for a stable system.

Are there any limitations to using stability regions?

While stability regions are a useful tool for analyzing the stability of a system, they do have limitations. They are based on linear models and may not accurately represent the behavior of nonlinear systems. Additionally, they only consider the system's stability and do not account for other important factors such as performance or robustness.

Similar threads

Replies
1
Views
1K
Replies
4
Views
2K
Replies
2
Views
2K
Replies
1
Views
3K
Replies
1
Views
2K
Replies
2
Views
3K
Back
Top