////////////////////////////////////////
% M5_8.m
close all; clear
x1=1; dotx1=1; x2=0; dotx2=0;
x0=[x1; dotx1; x2; dotx2]; t=0:0.01:10;
[t,x]=ode23('song5_8',t,x0); plot(t, x(:,1), 'linewidth', 2); hold on
plot(t, x(:,3), 'r:'); hold on plot(t, 0*t, 'black')
axis([0 10 -1.5 1.5]) xlabel('Time (s)'); xlabel('Displacement (m)'); grid legend('x_1(t)', 'x_2(t)');
///////////////////////////////////////
% song5_8.m
funtion y=song5_8(t,x) y=zeros(4,1); m1=1; m2=1; c1=0; c2=0; c3=0; k1=4; k2=4; k3=4; f1=0; f2=0; w1=3; w2=5;
y(1)=x(2);
y(2)=(-(k1+k2)*x(1)-(c1+c2)*x(2)+k2*x(3)+c2*x(4)+f1*cos(w1*t))/m1;
y(3)=y(4);
y(4)=(k2*x(1)+c2*x(2)-(k2+k3)*x(3)-(c2+c3)*x(4)+f2*cos(w2*t))/m2;
//////////////////////////////////////////////////////
출처 | 감사합니다!! |