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!