How to force positive entries in unknown variable in ODE-solver

Hi,
I am trying to solve an ODE with ODE45. My equation is only physical for positive entries of my unknown variable x. Therefore I only want to evaluate my equation for positive entries of x starting at the initial value 0. I have not been able to do this and get complex numbers in my solution. The option "NonNegative" does not seem to work in this case as it does not work for defining entries into the ODE45. Can you please help me solve this problem?
Best regards, Torleif

2 Comments

You may want to change the tolerance first (odeset) and maybe switch to ode15s.
I figured it out, there was an error in my equation. Thanks for the reply though.

Answers (0)

This question is closed.

Tags

Asked:

on 6 May 2014

Closed:

on 8 May 2014

Community Treasure Hunt

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

Start Hunting!