How to solve pendulum ode function?

9 ビュー (過去 30 日間)
Bloom
Bloom 2019 年 10 月 10 日
コメント済み: Bjorn Gustavsson 2019 年 10 月 10 日
Hello I have now spent some hours trying to plot my pendulums for different initial conditions.
I want to plot a linear and a none linear pendulum. With regards to angular velocity
My pendulum functions are:
α''+ (-ω^2*sin(α ) = 0
α''+ (-ω^2 *α = 0
where ω is sqrt(g/L). In my case sprt(9.82/0.5)
with my initial conditions
a(0)=10
Da(0)=0
My code might be all wrong for this, I dont know
***************************************
my code right now:
close all;
clear;
global w a b a0
w=sqrt(9.82/0.5);
a = 0;
b = 10;
a0 = 10;
[T,X] = ode45(@invpen,[0,20],[10,10]);
plot(T,X(:,1),'.',T,X(:,2),'-')
function dx = invpen(~,x)
dx = zeros(2,1);
w=sqrt(9.82/0.5);
dx(1) = x''+(w^2*sin(x));
dx(2) = x''+(w^2*x);
end
  1 件のコメント
Bjorn Gustavsson
Bjorn Gustavsson 2019 年 10 月 10 日
The linearization of is only true for small angles, you feed it 10 radians, which is something like - and not small enough to approximate sin with a straight line...

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

採用された回答

Stephan
Stephan 2019 年 10 月 10 日
編集済み: Stephan 2019 年 10 月 10 日

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by