So apparently my textbook is out of date
2 views (last 30 days)
Show older comments
I've been working out of DeVries' text on mathematical modeling for biological systems, and am working on the chapter that actually teaches you how to do all of this in Matlab. One of the examples I'm working through concerns the SIR model, and asks you to use the dsolve function to solve an ODE symbolically and for non-explicit solution, as such:
I = dsolve('DI = -1 + a/(b*S)','S')
According to the textbook, I should get a nice solved equation out of this (though it doesn't say what it should look like). However, when I actually type it into the terminal, I get
Warning, it is required that the numerator of the given ODE depends on the highest derivative. Returning NULL.
Warning, it is required that the numerator of the given ODE depends on the highest derivative. Returning NULL.
Warning, cannot find an explicit solution
{Error using maplemex Error, (in MTM:-dsolve) invalid input: indices received E, which is not valid for its 1st argument, t Error in dsolve (line 13) r = sym(maplemex(0,'MTM:-dsolve',varargin{:},'returnlist=true')); Error in matlab2211324625 (line 4) I = dsolve('DI = -1 + a/(b*S)','S');}
I'm assuming (as is my professor) that somewhere along the line, Matlab updated their formatting, and now the example equation is set up correctly. Can anyone give me any pointers on how it's supposed to look?
Thanks!
0 Comments
Answers (1)
Matt Tearle
on 22 Oct 2014
Edited: Matt Tearle
on 22 Oct 2014
What version of MATLAB are you running? (Enter version at the command prompt and it will tell you, if you're not sure.) The code you pasted works fine for me on 14b, so, if anything, you're perhaps using an older version than whatever is used in the textbook.
You could also try this:
syms I(S) a b
Isol = dsolve(diff(I) == -1 + a/(b*S))
(I get the same result -- C2 - S + (a*log(S))/b -- either way.)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!