Help Figure out the error
1 view (last 30 days)
Show older comments
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 Comments
Answers (2)
Nick Counts
on 5 Nov 2016
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 Comments
Walter Roberson
on 5 Nov 2016
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 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!