syms x(t) y(t) v(t) m c g s=symengine disp ('1)------------------------------------------') cond1=x(0)==0; cond2=diff(x,t)==0; conds=[cond1 cond2] dx=diff(x,t); dx2=diff(x,t,2); dv=diff(v,t); dx2=diff(x,t,2); ode=m*diff(v,t)+c*v==m*g
Sol=solve(ode,conds,dx,x)

 採用された回答

Ameer Hamza
Ameer Hamza 2018 年 6 月 2 日

0 投票

You can access the fields of a struct using dot notation. For example
Sol.c
Sol.g
Also, since you are trying to solve a differential equation, use dsolve(),
Sol=dsolve(ode,conds)

8 件のコメント

madhan ravi
madhan ravi 2018 年 6 月 2 日
but still I cannot find the result I wanted :/
madhan ravi
madhan ravi 2018 年 6 月 2 日
madhan ravi
madhan ravi 2018 年 6 月 2 日
Ameer Hamza
Ameer Hamza 2018 年 6 月 2 日
It is not clear which differential equation you are trying to solve. Can you clearly specify the required equations.
madhan ravi
madhan ravi 2018 年 6 月 2 日
編集済み: madhan ravi 2018 年 6 月 2 日
I want to solve m(dx.^2/dt.^2)+c(dx/dt)=m*g; where m = mass, c=air resistance , g=acceleration due to gravity , x=distance travelled , x(0)=0, dx/dt(0)=0.
Ameer Hamza
Ameer Hamza 2018 年 6 月 2 日
You can solve this equation as follow
syms x(t) m c g
disp ('1)------------------------------------------')
dx = diff(x);
cond1=x(0)==0;
cond2=dx(0)==0;
conds=[cond1 cond2];
ode = m*diff(x,2) + c*diff(x) == m*g;
Sol=dsolve(ode,conds)
Sol =
(g*m*t)/c - (g*m^2)/c^2 + (g*m^2*exp(-(c*t)/m))/c^2
madhan ravi
madhan ravi 2018 年 6 月 2 日
Thank you so much you are great
Ameer Hamza
Ameer Hamza 2018 年 6 月 2 日
You are welcome.

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

その他の回答 (1 件)

カテゴリ

ヘルプ センター および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by