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.
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개)

카테고리

질문:

2018년 6월 2일

댓글:

2018년 6월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by