How can I plot the difference of the solution of two differential equations vs time?
조회 수: 2 (최근 30일)
이전 댓글 표시
syms x(t)
ode = diff(x,t) == (((1/x))-1)*(1/sqrt(x));
cond = x(0) == 2;
xSol(t) = dsolve(ode,cond)
syms y(t)
ode = diff(y,t) == (2*((1/y))-1)*(1/sqrt(y));
cond = y(1) == 2;
ySol(t) = dsolve(ode,cond)
t= 0:0.1:10;
fplot(xSol(t)-ySol(t),t)
댓글 수: 0
답변 (1개)
Yogesh Khurana
2019년 10월 16일
Hi,
Difference in the solutions of two differential equations can be obtained by using diff command in MATLAB. Afterwards you can use plot function and provide the arguments properly.
In case of some missing data in some of the timestamps in any of the differential equation’s solution, you can use interpolation.
Documentation link:
You can find some more details in the solution posted in the below link:
Hope this helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!