필터 지우기
필터 지우기

How to substitute a value for the time derivative of a function

조회 수: 13 (최근 30일)
Hazim Nasir
Hazim Nasir 2018년 12월 17일
댓글: madhan ravi 2018년 12월 17일
Hellow
I have a dispalcemet function of time defined as:
syms d(t)
>> a = d^2+sin(d)
The first derivative is the velocity:
>> v = diff(a)
v(t) =
cos(d(t))*diff(d(t), t) + 2*d(t)*diff(d(t), t)
the parameter diff(d(t), t) means the velocity value but How I can substitute a value for it using subs or any other function?
thank you

채택된 답변

madhan ravi
madhan ravi 2018년 12월 17일
편집: madhan ravi 2018년 12월 17일
use subs() like below:
syms d(t)
a = d^2+sin(d);
v = diff(a);
after=subs(v,diff(d),2) % here diff(d) is replace number 2
Gives:
after(t) =
2*cos(d(t)) + 4*d(t)
or use ode45() -> diff(d,2)==>acceleration the right hand side is as it is so we treat them now as second order ode which is then further reduced to first order odes.
[t,x]=ode45(@myod2,[0 2],[0;1]);
figure(1)
plot(t,x(:,1),'-ok')
figure(2)
plot(t,x(:,2),'-or')
function dxdt = myod2(t,Y)
dxdt=[Y(2);
sin(Y(1)) + Y(1)^2];
end
  댓글 수: 4

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by