Getting empty solution for second order differential equation

2 ビュー (過去 30 日間)
Gopalji Kalojiya
Gopalji Kalojiya 2022 年 4 月 7 日
回答済み: Sam Chak 2022 年 4 月 8 日
initial conditions are, x(0)=0 and dx/dt(0)=0
I want equation of x in terms of t. But I am not getting.
  5 件のコメント
Gopalji Kalojiya
Gopalji Kalojiya 2022 年 4 月 7 日
I want to solve differential equation given above. I just want to know that why I am getting empty solution for that.
Star Strider
Star Strider 2022 年 4 月 7 日
Note that implies .
MATLAB makes the appropriate assumption about it, and defines x as .

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2022 年 4 月 7 日
It apparently does not have an analytic solution.
Integrate it numerically —
syms x(t) t Y
ode = diff(x,2) + 2*diff(x) + 5*sin(x) == 5
ode(t) = 
Dx = diff(x);
% cond = [x(0) == pi/2, Dx(0) == 0]
[VF,Subs] = odeToVectorField(ode)
VF = 
Subs = 
ode_fcn = matlabFunction(VF, 'Vars',{t,Y})
ode_fcn = function_handle with value:
@(t,Y)[Y(2);sin(Y(1)).*-5.0-Y(2).*2.0+5.0]
tspan = [0 10];
ic = [pi/2, 0];
[t,y] = ode45(ode_fcn, tspan, ic);
figure
plot(t,y)
grid
legend(string(Subs))
.

その他の回答 (1 件)

Sam Chak
Sam Chak 2022 年 4 月 8 日
I believe that the question never ask you to find the analytical solution of the damped pendulum system, because it doesn't exist. The analytical solution only exists for undamped pendulum system:
and it is in the form of Jacobi elliptic function and the inverse sine function. For more info, please check the suggested article:
Ochs, K. (2011). A comprehensive analytical solution of the nonlinear pendulum. European Journal of Physics, 32(2), 479–490. doi:10.1088/0143-0807/32/2/019.
Script for the forced responses of the damped pendulum system:
% Damped Pendulum ODE
f = @(t, x) [x(2); ...
5 - 5*sin(x(1)) - 2*x(2)];
tStart = 0;
tEnd = 10;
step = 0.01;
numel = length(tStart : step : tEnd);
tspan = linspace(tStart, tEnd, numel)';
init = [pi/2 0]; % initial condition
% Runge-Kutta Dormand-Prince 4/5 solver
[t, x] = ode45(f, tspan, init);
plot(t, x, 'linewidth', 1.5)
grid on
xlabel('Time, t [sec]')
ylabel({'x(t), and x''(t)'})
title('Forced responses of the damped pendulum system')
legend('x(t)', 'x''(t)')
Result:
If you can continuously supply a torque that generates the angular acceleration of 5 rad/s², then the bob of a nearly 2-m length pendulum will look as if it is suspended at 90°. When the pendulum is in steady-state, , and thus,
.
Since the initial value for is already in equilibrium, it will continue to stay so until the constant torque is removed or changed.
Script for the free responses of the damped pendulum system:
% Damped Pendulum ODE
f = @(t, x) [x(2); ...
0 - 5*sin(x(1)) - 2*x(2)];
tStart = 0;
tEnd = 10;
step = 0.01;
numel = length(tStart : step : tEnd);
tspan = linspace(tStart, tEnd, numel)';
init = [pi/2 0]; % initial condition
% Runge-Kutta Dormand-Prince 4/5 solver
[t, x] = ode45(f, tspan, init);
plot(t, x, 'linewidth', 1.5)
grid on
xlabel('Time, t [sec]')
ylabel({'x(t), and x''(t)'})
title('Free responses of the damped pendulum system')
legend('x(t)', 'x''(t)')
Result:
If the torque is removed, the bob takes approximately 5 seconds to converge to 0°. You may think that 5-sec is rather slow. After all, the pendulum length is nearly 2 meters long .

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by