# Why is the resulting time-domain curve from Euler method and ode45 not stable?

4 views (last 30 days)

Show older comments

Ni Made Ayu Sinta Dewi
on 12 Jan 2021

Answered: Mischa Kim
on 13 Jan 2021

##### 2 Comments

### Accepted Answer

Mischa Kim
on 13 Jan 2021

Hi Ni Made Ayu Sinta Dewi, there is nothing you are doing wrong. What you are seeing is expected behavior. This is because you are using a numerical solver (e.g. ode45) to solve the differential equation. Numerical solutions are not exact solutions, they are only approximations. However, you have some control regarding the accuracy of the solution. E.g. you can set tolerance levels:

options = odeset('RelTol',1e-13); % the smaller the tolerance, the more accurate the result

[t,x] = ode45(@state_space,tspan,x0,options);

##### 0 Comments

### More Answers (0)

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!