Effacer les filtres
Effacer les filtres

I dont know how to integrate a function with variables depending on time

3 vues (au cours des 30 derniers jours)
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
fmov(t) = 
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 commentaires
Torsten
Torsten le 26 Jan 2024
Modifié(e) : Torsten le 26 Jan 2024
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
John D'Errico le 26 Jan 2024
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.

Connectez-vous pour commenter.

Réponse acceptée

Sam Chak
Sam Chak le 26 Jan 2024
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)
V = 
S = 
M = matlabFunction(V, 'vars', {'t', 'Y'})
M = function_handle with value:
@(t,Y)[Y(2);((sin(Y(1)).*1.09e+2-sin(Y(1).*2.0).*Y(2).^2.*5.0e+1).*(-9.0./1.0e+2))./(cos(Y(1)).^2.*9.0+2.0)]
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)')

Plus de réponses (0)

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by