How to find the differential equation ? ode solver

조회 수: 3 (최근 30일)
STP
STP 2019년 2월 5일
댓글: STP 2019년 2월 11일
So I am very new to matlab ; now wish to use ode solver. I am a little stuck with a thing ; If I have an ouput plot as my objective to plot ; and I have the solutions of the differential equations - is there a way to know he differential equation which can be put in the ode solver in order to reach the objective plot ?

채택된 답변

Torsten
Torsten 2019년 2월 5일
If the output plot function is f(t) and f(t0)=f0, then the corresponding ODE reads
dy/dt = f'(t) with y(t0) = f0.
This ODE should reproduce y = f.
Best wishes
Torsten.
  댓글 수: 16
STP
STP 2019년 2월 7일
Thanks a ton! :)
STP
STP 2019년 2월 11일
Hi, sorry to bother again, I found out the initial conditions; and wanted to check whether they after ode solver and the above back drafting method you showed me leads to the same output; but somehow it doesnt; Can you make out whatsa wrong?
Tc = 2.0, alfa = beta=5; alfa = 2.beta/(beta+1); tau1= 2; tau2= 2.4; gamma=alfa.(2-exp(-tau1));*
Tc.*dEe/dt + Ee = -alfa.*Ek ... 1
initial condions be : for time span1= [0 t1] or eg [0 4.2] Ek = -1
for time span2 = [t1 t2] or [4.2 5] Ek = 1 How does solving eq.1 lead to below
EeA = @(t) -alfa .*exp(-t) + alfa; EeB = @(t) gamma.*exp(-(t-tau1)) - alfa;
My output comes nowhere like it should; its a straight line than the exponential curve it should be Eeplot.PNG
beta = 5;
Ek = -1;
Tc = 2.0;
tau1 = 2;
tau2 = 2.4;
gamma=alfa.*(2-exp(-tau1));
alfa = 2.*beta/(beta+1);
dEedt = @(t,y) ((-alfa.*Ek) - Ee)./Tc
t1 = [0 4.2]
y0 = 0;
[t1, EeA] = ode15s(dEedt,t1, y0);
plot(t1,EeA)

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by