2nd Order Nonlinear Differential Equation Solving with Newton Method
Show older comments
Hello,
I have a question about the spring mass system below.

I have solved this problem by hand till a final equation which is 2. order nonlinear differential equation. The equation is;

Now, ı need to solve this equation by using matlab.I have assigned logical values to parameters as my code below and simplified the equation,
clear all;
syms Theta(t);
ab=diff(Theta,2);
aa=diff(Theta);
m1=1; %kg
m2=1.5; %kg
m3=2; %kg
b1=0.5; %m
b2=1; %m
k=10; %N/m2
g=9.81; %m/s2
T=15; %N.m
F=20; %N
dx=(F/k)*cos(90-Theta);
h=b1+b2+dx;
s=sqrt((h-(b1*cos(Theta)+b2))^2+(b1*sin(Theta)^2));
c1=0.1;
c2=0.1;
ode=(m2+m3*cos(Theta).^2)*b1^2*ab-m3*b1^2*aa.^2*sin(Theta)...
*cos(Theta)+ (c1*cos(Theta).^2+c2*sin(Theta).^2)*b1^2*aa...
+(m2*g*b1*sin(Theta))+(k*(b1^2*sin(Theta)+((s*b1^2*sin(Theta))/(sqrt(s^2+2*b1^2*(1-cos(Theta))))))-T+F*b1*cos(Theta));
Now I am confused about how to solve this equation by using newton's method.
Can you help me ?
Answers (1)
darova
on 5 May 2020
You can try dsolve or re-write your equations and use ode45
Express
= ...
ddtheta = @(th,dth) m3*b1^2*dth^2*sin(th)*cos(th) - ...
f = @(t,u) [u(2);ddtheta(u(1),u(2))];
[t,u] = ode45(f,[0 5],[1 1]);
plot(t,u)
See more: ode45
7 Comments
Mete Altay
on 6 May 2020
darova
on 6 May 2020
I don't see this expression the same as on the picture
ab = @(Theta,aa)m3*b1^2*aa^2*sin(Theta)...
*cos(Theta)- (c1*cos(Theta)^2+c2*sin(Theta)^2)*b1^2*aa...
-(m2*g*b1*sin(Theta))-(k*(b1^2*sin(Theta)+((s*b1^2*sin(Theta))/(sqrt(s^2+2*b1^2*(1-cos(Theta))))))*T-F*b1*cos(Theta))...
/((m2+m3*cos(Theta)^2)*b1^2)

Can you explain more? what is
and
? What is s?
Mete Altay
on 7 May 2020
darova
on 7 May 2020
Try this
Mete Altay
on 8 May 2020
Meryem EL Abdi
on 25 Nov 2020
Edited: darova
on 30 Jan 2021
Hello Darova,
i need your help in solving an ODE of a Newton’s cradle consisting of a pair of pendulums with mass 1 and 2 as shown in Figure

I determinated those equations:


I dont know how to use the ODE.
close all
clear all
clc
%Initial Conditions
r = 0.05; % Radius beider Kugeln
l = 0.3; % Seillänge
m_rechts = 50; % Masse der rechten Kugel
m_links = 50; % Masse der linken Kugel
start = [pi/3;0];
phi_rechts_initial = pi/3;
phidot_rechts_initial =0;
phi_links_initial = 0;
phidot_links_initial =0;
J_rechts = (m_rechts*l^2);
J_links = (m_links*l^2);
%ts = 0.001;
%timespan = 0:ts:40;
g = 9.81;
odefun= @(t,phi) [phi(3);...
phi(4);...
-(m_rechts*g*sin(phi(1)*l))/ J_links;...
-(m_links*g*sin(phi(2)*l))/ J_rechts];
tspan=linspace(0,5);
[t, phi]= ode45(odefun,tspan,start);
plot(t, phi(:,1)*180/pi,'linewidth',2)
xlabel('time(s)','FontSize',16,'Fontname', 'Arial', 'FontWeight','bold')
ylabel('phi in degrees','FontSize',16,'Fontname', 'Arial', 'FontWeight','bold')
title('Pendulum Motion','FontSize',16,'Fontname', 'Arial', 'FontWeight','bold')
darova
on 30 Jan 2021
please create your own question
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!