Using ODE to solve pendulum damping differential equation

The required "code to call your function" is [x,Y] = ode_integration().
How do I implement this given differential equation into an ODE function? Which variables are 'x' and 'Y' supposed to be?

5 Comments

What have you done so far? What specific problems are you having with your code?
function [x,Y] = ode_integration()
[x,Y] = ode45((Y(2)/x(2))+(2/3)*(Y(1)/x(1))+(9.81*sin(x(0))),[0,10],[0;pi/6])
end
This is what I have so far. I'm getting a "Unrecognized function or variable 'Y'." error.
Can you use ode45( ) for this, or are you supposed to write your own integration function (e.g., Euler or RK4)? Have you looked at the documentation for how to set up a 2nd order problem? See the 2nd example here:
You need to ask your professor what x and Y are supposed to be. It could be the coordinates ot the pendulum mass, or it could be theta and thetadot. I can't tell from the problem wording.
Let me try following this example and I'll get back to you with my results.
I got it to run beautifully. Thanks for your help!

Sign in to comment.

Answers (0)

Asked:

on 24 Apr 2020

Commented:

on 24 Apr 2020

Community Treasure Hunt

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

Start Hunting!