I dont know how to integrate a function with variables depending on time
3 次查看(过去 30 天)
显示 更早的评论
I have a function
syms theta(t)
fmov(t) = (2943*sin(theta(t)))/200 - (27*sin(2*theta(t))*diff(theta(t), t)^2)/4 + (3*(9*cos(theta(t))^2 + 2)*diff(theta(t), t, t))/2
Which I want to integrate twice respect to time in order to obtain a function with just theta(t) and t as variables.
And I only have the min and max values of theta(t). It is an angle and range is from 60º until 0º.
I dont know what the final time will be and starting time is 0.
Can anyone help me?
3 个评论
Torsten
2024-1-26
编辑:Torsten
2024-1-26
I have a function
fmov(t) =
(2943*sin(theta(t)))/200 - (27*sin(2*theta(t))*diff(theta(t), t)^2)/4 + (3*(9*cos(theta(t))^2 + 2)*diff(theta(t), t, t))/2
fmov(t) is a given function of t and it equals the expression
(2943*sin(theta(t)))/200 - (27*sin(2*theta(t))*diff(theta(t), t)^2)/4 + (3*(9*cos(theta(t))^2 + 2)*diff(theta(t), t, t))/2
, so e.g.
sin(t) = (2943*sin(theta(t)))/200 - (27*sin(2*theta(t))*diff(theta(t), t)^2)/4 + (3*(9*cos(theta(t))^2 + 2)*diff(theta(t), t, t))/2
for fmov(t) = sin(t) ?
?
John D'Errico
2024-1-26
This is a second order nonlinear differential equation, where theta(t) is the unknown function. You generally can't just integrate it twice. Instead, this is why entire courses and sequences of courses are taught about how to solve differential equations. Since the ODE is not at all in a standard form, I have a funny feeling there will be no analytical solution. And that means only a numerical solution is probably an option. Since it is second order, you will need two initial values or a pair of boundary values. Regardless, two pieces of information will need to be provided by you. Tools like ODE45 or a bvp solver will be necessary.
采纳的回答
Sam Chak
2024-1-26
You can utilize the odeToVectorField() function to convert the 2nd-order differential equations to a system of 1st-order differential equations. Once you have the 1st-order form, you can then apply the ode45() solver to solve the problem.
syms theta(t)
myODE = (2943*sin(theta))/200 - (27*sin(2*theta)*diff(theta, t)^2)/4 + (3*(9*cos(theta)^2 + 2)*diff(theta, t, t))/2 == 0;
[V, S] = odeToVectorField(myODE)
M = matlabFunction(V, 'vars', {'t', 'Y'})
tspan = [0 30];
Y0 = [3*pi/4 0];
sol = ode45(M, tspan, Y0);
fplot(@(t) deval(sol, t, 1), tspan), grid on
xlabel('t'), ylabel('\theta(t)')
更多回答(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!