- #1

- 3

- 0

## Homework Statement

I'm trying to solve a system of two second order linear differential equations with the ode45 function. It is a two degree of freedom problem with 2nd order derivatives of both variables, u and theta. I believe that's referred to as a "stiff matrix").

I'm very confident in the A and B matrices themselves, but not on the running of ode45. One of the two problems I'm having is the values in my y matrix. I'm just not sure what should be there. 1's have the same result as zeros. I know y is the dependent variable, I just don't understand what the function would want me to type there. What does its being zeros mean? What does its being ones mean?

My second problem is that I only know how to give a step input of force (f). As far as I can tell, the force input will be 628 Newtons the entire time. I tried to say f=628 when t<=0.015, but there is no "t" in the ode45 function. I'd like to give it an impulse if I can.

## Homework Equations

My code so far is:

u0 = [0 ; 0];

theta0 = [0 ; 0];

FUN = @FUNA;

T = [0 10];

y0 = [u0 ; theta0];

[TT,YY] = ode45(FUN,T,y0);

plot(TT,YY(:,3));

function dy = FUNA(t,y)

%Constants of system

M = 70-5.876;

m = 5.876;

a = (((0.05)^2)+((0.13)^2))^0.5;

IG= 0.0233;

k = 500;

g = 9.81;

N = 2; %number of degrees of freedom

%Define sub matrices

MM=[(M+m) m*a ; m*a (IG+(m*a^2))];

K =[ 0 0 ; 0 (k-m*g*a)];

C =[0 0 ; 0 d*a*a];

F =[1; 0];

MI= inv(MM);

Z = zeros(N,N);

I = eye(N);

%Define matrices

A = [ Z I ; -MI*K -MI*C];

B = [ zeros(N,1); (MI*F) ];

f = 628;

y = [0; 0; 0; 0];

dy= A*y + B*f;

## The Attempt at a Solution

I'd like to split this into four single order differential equations, but the second order derivative of both variables seems to stop me. I've run this code and I actually get plots, but they are either flat lines or ramp functions, depending on which of the four outputs I choose. I'm sure it's my use of the y matrix that's beating me.