Problems with matlab symbolic dsolve function

1 回表示 (過去 30 日間)
Amit Kumar
Amit Kumar 2014 年 10 月 16 日
回答済み: Stefan Wehmeier 2014 年 10 月 30 日
Hi I feel that something is going wrong with matlab dsolve function. Here is simple code:
syms y x
dsolve('9*D2y+y=x*exp(-x^2)')
answer:
x*exp(-x^2) + C2*cos(t/3) + C3*sin(t/3)
Solution does not have the first term. Still, how matlab gives such answer? Any ideas?

回答 (2 件)

Amit Kumar
Amit Kumar 2014 年 10 月 16 日
Any ideas?

Stefan Wehmeier
Stefan Wehmeier 2014 年 10 月 30 日
The correct syntax is
syms y(x)
dsolve(diff(y, x, x) +y==x*exp(-x^2))
as it declares y as a function of x (and not of t). Alternatively, you can add x as a second argument to your input; but we do not recommend to use character strings.

カテゴリ

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