Академический Документы
Профессиональный Документы
Культура Документы
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
')