Вы находитесь на странице: 1из 2

Problem 1

%Analytical Piece Wise solution


syms t U21 U31
m=2;k=50;M=(pi/2);u0=0;v0=0;Wn=sqrt(k/m);P=2;
% Response for 0<= t < 1
t1=linspace(0,1,200);
U1=u0.*cos(Wn.*t1)+(v0/Wn).*sin(Wn.*t1);
plot(t1,U1,'b--', 'linewidth', 2);
hold on
% Response for1<=t<=3
U21=(P./(k-m.*M^2)).*(sin(M.*(t-1))-(M./Wn).*sin(Wn.*(t-1)));
t2=linspace(1,3,200);
U2=(P/(k-m*M^2)).*(sin(M.*(t2-1))-(M/Wn).*sin(Wn.*(t2-1)));
plot(t2,U2, 'r-', 'linewidth',2);
hold on
% Response for t>3
u2=double(subs(U21,t,3))
v20=diff(U21,t);
v2=double(subs(v20,t,3))
U31=u2*cos(Wn*t)+(v2/Wn)*sin(Wn*t);
t3=linspace(3,8,200);
U3=u2*cos(Wn.*(t3-3))+(v2/Wn).*sin(Wn.*(t3-3));
plot(t3,U3, 'r--','linewidth',2)
ylabel('Response')
xlabel('Time')
title(' Response to a delayed sine pulse ')
legend('\bfUt1', '\bfUt2', '\bfUt3')
grid on

Problem 2.
%Analytical Piece Wise solution
syms t U21 U31
m=2;k=50;M=(pi/2);u0=0;v0=0;Wn=sqrt(k/m);P=1.2;
% Response for 0<= t < 5
t1=linspace(0,5,200);
U1=u0.*cos(Wn.*t1)+(v0/Wn).*sin(Wn.*t1);
plot(t1,U1,'b--', 'linewidth', 2);
hold on
% Response for 5<=t<= 7
U21= (P/k).*(1-cos(Wn.*(t-5)));
t2=linspace(5,7,200);
U2=(P/k).*(1-cos(Wn.*(t2-5)));
plot(t2,U2, 'r-', 'linewidth',2);
hold on
% Response for t>7
u2=double(subs(U21,t,7))
v20=diff(U21,t)
v2=double(subs(v20,t,7))
U31=u2*cos(Wn*t)+(v2/Wn)*sin(Wn*t);
t3=linspace(7,8,200);
U3=u2*cos(Wn.*(t3-7))+(v2/Wn).*sin(Wn.*(t3-7));
plot(t3,U3, 'r--','linewidth',2)
ylabel('Response')
xlabel('Time')
title(' Response to a delayed rectangular pulse
legend('\bfUt1', '\bfUt2', '\bfUt3')
grid on

')

Вам также может понравиться