So apparently my textbook is out of date

조회 수: 1(최근 30일)
Tessa
Tessa 2014년 10월 22일
댓글: Star Strider 2014년 10월 23일
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!

답변(1개)

Matt Tearle
Matt Tearle 2014년 10월 22일
편집: Matt Tearle 2014년 10월 22일
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.)
  댓글 수: 6
Star Strider
Star Strider 2014년 10월 23일
There is also Julia, although I don’t know if it has a symbolic toolbox.

댓글을 달려면 로그인하십시오.

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by