Help Figure out the error
조회 수: 1 (최근 30일)
이전 댓글 표시
IVP=ode({y''(x)+4*y'(x)+3*y,y(0)=3,y'(0)=4},y(x));
|
Error: Unbalanced or unexpected parenthesis or bracket.
댓글 수: 0
답변 (2개)
Nick Counts
2016년 11월 5일
Joshua,
Looks like there's a lot going on here.
It appears that ode() is a function and you are attempting to pass two arguments. The first argument is enclosed in {} which, in Matlab-land, defines a cell (variable type).
You are attempting to assign the following as the contents of a cell: y''(x)+4*y'(x)+3*y,y(0)=3,y'(0)=4
Data Types:
This is very confusing to poor Matlab (and others as well!) You can assign all kinds of variable types to the contents of a cell: numerical, string, objects, other cells... but you can't mix types within a cell.
Understanding the Error:
Matlab is trying to intemperate your code something like this:
"This cell contains the value of y, an empty string, possibly an index to something I don't understand or maybe just the value of x, maybe the string "(x)+4*y"... and so on.
Hopefully that makes sense.
Symbolic Math and Matlab
If you are trying to use Matlab's symbolic math capabilities, I suggest starting here:
Or possibly:
help syms
doc syms
Good luck!
댓글 수: 0
Walter Roberson
2016년 11월 5일
You are trying to use MuPAD syntax inside of MATLAB.
You already know how to correct for this: you did it in http://www.mathworks.com/matlabcentral/answers/310276-just-for-clarification-below-is-the-question-again-d-2-y-dx-2-4dy-dx-3y-0-subject-to-initial-co#comment_403416 where you posted
dsolve('D2y-4*Dy+3*y','y(0)=3','Dy(0)=4')
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!