ode solvers & loops for various values
Show older comments
hello i have shown part of a code below. The first 'Rh' value of 70 is used to find 'EMC' & 'Kx' and the 'Kx' is used in the ode45 solver. What i am trying to do is when my 'x' value gets to say 0.5 i want to stop the ode45 solver and use the next 'Rh' value of 60 to say x=0.25 and the same with the next 'Rh' value of 50 to say x=0.1. any help would be appreciated.
Rh = [70 60 50];
EMC = (18/W)*((K1*K2*(Rh/100))/(1+K1*K2*(Rh/100)) + (K2*(Rh/100)/(1+K2*(Rh/100))));
Kx = 1/ (a0*exp(c0/(T))*e + (b0*exp(c0/(T))*v^-p)*exp(-z/(FSP-EMC)));
[t,x]=ode45('Mass_bal_func',(t0:60:tf),IMC);
Accepted Answer
More Answers (1)
Mischa Kim
on 17 Sep 2014
0 votes
Harley, you are looking for something called events in MATLAB. Check out the section Events Location that explains how to use events in combination with ode solvers with the bouncing ball example.
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!