Plotting runge kutta 4 stability region

Click For Summary
SUMMARY

The discussion focuses on plotting the stability region of the Runge-Kutta 4 method, which forms a heart shape on the complex plane with a maximum on the imaginary axis of \(\pm 2\sqrt{2}\). Users encountered issues with MATLAB code, specifically an error related to the undefined function 'contourplot'. One participant successfully created a plot using custom MATLAB code that utilizes meshgrid and imagesc functions to visualize the stability region. The provided resources include a detailed article and a sample image of the plot.

PREREQUISITES
  • Understanding of Runge-Kutta methods, specifically Runge-Kutta 4
  • Familiarity with MATLAB programming, including functions like meshgrid and imagesc
  • Knowledge of complex analysis as it relates to stability regions
  • Ability to troubleshoot MATLAB errors and implement custom functions
NEXT STEPS
  • Research how to implement custom plotting functions in MATLAB
  • Learn about stability analysis in numerical methods, focusing on Runge-Kutta methods
  • Explore advanced MATLAB visualization techniques for complex functions
  • Study the theoretical background of stability regions in numerical analysis
USEFUL FOR

Mathematicians, numerical analysts, and MATLAB users interested in visualizing the stability regions of numerical methods, particularly those working with Runge-Kutta techniques.

Dustinsfl
Messages
2,217
Reaction score
5
How can I plot the runge kutta 4 stability region? I know on the i axis the max is \(\pm 2\sqrt{2}\). The plot makes a heart type shape. I don't know how to plot it though but would like to.
 
Physics news on Phys.org
Here is an article explaining how to plot this stability region:

http://homepages.cwi.nl/~jason/Classes/numwisk/ch10.pdf
 
MarkFL said:
Here is an article explaining how to plot this stability region:

http://homepages.cwi.nl/~jason/Classes/numwisk/ch10.pdf

I just tried their Matlab code to plot the region but it returns an error:

Undefined function 'contourplot' for input arguments of type 'double'.

Have you tried to plot it?
 
No, I don't have Matlab, and I didn't realize their code was calling an extrinsic function. (Rain)
 
Beautiful image, Dustin! (Clapping)

Did you write your own contourplot function?
 
MarkFL said:
Beautiful image, Dustin! (Clapping)

Did you write your own contourplot function?

Definitely not:

Code:
[X, Y] = meshgrid(-3:.01:1, -3:.01:3); 
Mu = X + i*Y; 
R = 1 + Mu + .5*Mu.^2 + (1/6)*Mu.^3 + (1/24)*Mu.^4; 
Rhat = abs(R); 
Rhat = Rhat.*(Rhat<1);  %# here I truncate 
imagesc([min(X(:)) max(X(:))],[min(Y(:)) max(Y(:))], Rhat) 
colormap(flipud(bone))
 
Last edited:

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 65 ·
3
Replies
65
Views
8K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 26 ·
Replies
26
Views
4K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 15 ·
Replies
15
Views
3K