필터 지우기
필터 지우기

How can I define this differential equation in matlab syntax to solve it using ode45 ?

조회 수: 2 (최근 30일)
I want to solve this equation for tau,
gammadot is not a differential term
the values for lamda1, lambda2, eta0, gamma are known
edit: I just want to know how to write this equation in a way that matlab understands
  댓글 수: 2
Torsten
Torsten 2023년 12월 5일
Was there something unclear about the responses you already received for this question ?
Namit Dayal
Namit Dayal 2023년 12월 5일
Hi Torsten , I apologize, I didnt frame my question correctly, For this equation i just want to understand how to define this equation as there are two differential terms in here and the syntax I've seen is for one term or 2nd order equations with the same differential.

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

채택된 답변

Sam Chak
Sam Chak 2023년 12월 6일
Depending on the values of , this is one way to solve the differential equations using the 'ode45()' solver. Here, I assume that grows linearly with time, as illustrated in the third subplot.
tspan = [0 1000];
y0 = [1 0 0];
[t, y] = ode45(@odefcn, tspan, y0);
subplot(311)
plot(t, y(:,1)), grid on, ylabel \tau
subplot(312)
plot(t, y(:,2)), grid on, ylabel \gamma
subplot(313)
plot(t, y(:,3)), grid on, ylabel \gamma\prime, xlabel t
%% Differential equations
function dydt = odefcn(t, y)
dydt = zeros(3, 1);
eta0 = 8080;
lambda1 = 1.109;
lambda2 = lambda1;
dydt(1) = - (y(1) + eta0*y(3) + eta0*lambda2*1)/lambda1;
dydt(2) = t; % gammadot = t (grows linearly from 0 to 1000 in 1000 s)
dydt(3) = 1; % d gammadot/dt = 1 (differentiate t with respect to t)
end

추가 답변 (1개)

Sam Chak
Sam Chak 2023년 12월 5일
Hmm... @Namit Dayal, but you declared that "gammadot is not a differential term". Thus, only is regarded as the differential term. Also, the values for the rest of the parameters , , , and are known. If these values are constants such that , then , and the differential equation can be reduced to .
The analytical solution for this first-order ODE is given by
where is the initial value.
I hope you have disclosed all information regarding this math problem. If my assumption about is incorrect, then the solution becomes illegitimate.
  댓글 수: 4
Torsten
Torsten 2023년 12월 5일
I have a doubt, suppose gamma is a set of values from 0.001 to 1000, then will d(gamma)/dt be equal to zero as well ?
In your preceding question that can be found here
I asked
Do you want to compute one function for tau and treat gamma(dot) is a function of t
or
do you want to compute as many functions tau as there are parameters for gamma(dot) and treat gamma(dot) as constant for each of these computations ?
and you answered
I want to treat gamma(dot) as a vector of constants and solve for tau for all values of gamma(dot) separately
Assuming the same is true here, @Sam Chak gave you the solution of the differential equation with gammadot = constant and thus d(gammadot)/dt = 0 (although I doubt this is meant in the differential equation).
Sam Chak
Sam Chak 2023년 12월 6일
편집: Sam Chak 2023년 12월 6일
Perhaps the OP didn't know how to express the problem to us. 'gammadot' () is indeed a differential term, but it appears as a time-dependent term in data form. If that's the case, then the interpolation method using interp1() can be applied.

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

카테고리

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

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by