MHB Plotting runge kutta 4 stability region

AI Thread Summary
To plot the Runge-Kutta 4 stability region, the maximum on the imaginary axis is noted as ±2√2, resulting in a heart-shaped plot. An article was referenced for guidance on plotting, but attempts to use the provided Matlab code led to an error due to an undefined function 'contourplot'. One participant successfully created a plot without using the original code, sharing a link to their image. They used a custom meshgrid and calculations for the stability region, demonstrating an alternative approach. The discussion highlights the challenges and solutions in visualizing the stability region for Runge-Kutta 4 methods.
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.
 
Mathematics 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:
Back
Top