Spring Mass Problem - Code not working

1 回表示 (過去 30 日間)
Rupak
Rupak 2014 年 9 月 15 日
コメント済み: Sean de Wolski 2014 年 9 月 16 日
I am trying to learn to model with matlab. I started at the symbolic math toolbox and went through the Mass-Spring-Damper System Modeling. The link is given here
However, the code given there starts to give error. What am I doing wrong?
My input was (as copied from the link)
f1 := ode({m*x''(t) + R*x'(t) + k*x(t), x(0) = 0 , x'(0) = 1}, x(t))
The error I received was
f1:= ode({m*x''(t) + R*x'(t) + k*x(t), x(0) = 0 , x'(0) = 1}, x(t))
|
Error: The expression to the left of the equals sign is not a valid
target for an assignment.
Can someone tell me what i am doing wrong?

採用された回答

Sean de Wolski
Sean de Wolski 2014 年 9 月 16 日
The code above is part of the MuPad language and needs to be run inside of a MuPad notebook, not at the MATLAB command prompt.
You can open a MuPad notebook by clicking the MuPad app or running the following at the command line:
>>mupad

その他の回答 (1 件)

Image Analyst
Image Analyst 2014 年 9 月 16 日
Well I don't know how to use the Symbolic toolbox, so I could be wrong, but I'd try getting rid of the colon and use only the equal sign. What language are you most familiar with, Pascal? Or maybe some other language that uses := ????? I've never seen that in MATLAB, but then again, I don't use the Symbolic Math toolbox and I don't know if it has special syntax.
  1 件のコメント
Sean de Wolski
Sean de Wolski 2014 年 9 月 16 日
It does, it breaks all of the rules :)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeUtilities for the Solver についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by