differential equation 2DOF

조회 수: 21 (최근 30일)
alsgud qor
alsgud qor 2020년 3월 20일
댓글: Birdman 2020년 3월 23일
------------------------------------------------------
function homework2 = main2(t,X1,X2)
global m1 c1 k1 m2 c2 k2
M=[m1 0;0 m2];
C=[c1+c2 -c2; -c2 c2];
K=[k1+k2 -k2; -k2 k2];
F=[3*cos(t);10*cos(3*t)];
X=[X1;X2];
homework2=M*X(3)+C*X(2)+K*X(1)-F;
end
-------------------------------------------------------
tspan= 0:0.1:50 ;
X0 = [0 0;0 0] ;
[t, X] = ode45(@main2, tspan, X0);
plot(X1,X2)
I do it here and it 's ain't working....

채택된 답변

Birdman
Birdman 2020년 3월 20일
You may try Symbolic Toolbox to solve the problem. Run the attached script to see the result.
  댓글 수: 5
alsgud qor
alsgud qor 2020년 3월 21일
um sorry.because of time lag, I just recieved it. let me ask some Q
  1. dydt = zeros(4,1); what does it mean?
  2. dydt(2) = (-k1/m1)*y(1)+(-c1/m1)*y(2)+F1; this part should be changed into 'F1/m1'? same with dydt(4)
Birdman
Birdman 2020년 3월 23일
  1. It means that I created a vector of zeros with 4 elements.
  2. Yes exactly, I missed that.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by