I am new in matlab and recently, I have tried coding in matlab. So far, I have been getting error msg(adsbygoogle = window.adsbygoogle || []).push({});

"Warning: Failure at t=2.859413e+002. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.015868e-012) at time t."

I have referred back to my codes and realized that the problems occurs due to the conditional statement. To cut the story short, the ode doesn't seem to want to read the if, else-if statement in my codes.

e.g

if yY(1)<=Y(1)<yY(2)

hY = -0.0014*(Y(1)-yY(1))^3+ 0.0200*(Y(1)-yY(1))^2+ 0.8515*(Y(1)-yY(1));

elseif yY(2)<=Y(1)<yY(3)

hY = -0.0014*(Y(1)-yY(2))^3+ 0.0151*(Y(1)-yY(2))^2+ 0.8935*(Y(1)-yY(2))+ 1.0431;

elseif yY(3)<=Y(1)<yY(4)

hY = -0.0012*(Y(1)-yY(3))^3+ 0.0088*(Y(1)-yY(3))^2+ 0.9306*(Y(1)-yY(3))+ 2.4600;

else

hY = 1.0000*(Y(1)-yY(19))+ 510.8083;

end

It only wants to read the first highlighted piece of the code.

Anyone help please!!!

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Conditional statement problem in ode Matlab

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**