# MATLAB Stability issues of ODE solutions using Matlab

#### Ein Krieger

Hello, guys

I am struggling with attaining stability values for u in solving the diffusion equation. The stability of u depends on the value of r from :

Code:
D=1000;
r0=1000;
std=1.0;
tau=1.0;

IP=2500;  %initial pressure
%
% Radial grid and inhomogeneous term
nr=51;
dr=r0/(nr-1);
dr=50;
for i=1:nr
r(i)=(i-1)*dr+200;
end
Values of u doesn't oscillate and follow stable path from r at i=1 i.e. at r=200 as can be seen from the code above. Ideally u should vary with time and r exponentially as you will see from the graph in the code attached. However, when I replace 200 from the above equation with 1 to obtain u at r=1, the results become unstable and oscillates. So I would like to obtain variation of u from r=1 not from r=200 without osciallation

All necessary codes are attached.

#### Attachments

• 3 KB Views: 160
• 940 bytes Views: 165
• 9.6 KB Views: 174
Related Math Software Workshop News on Phys.org

"Stability issues of ODE solutions using Matlab"

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving