# How to input a half sine pulse force with varying loads for different time variables?

28 views (last 30 days)
Robert Cecala on 10 Apr 2016
Answered: sam0037 on 13 Apr 2016
I am working on replicating a Half Sine Pulse Force Function from Dynamics of Structures (4th edition by Chopra). The loading function, p(t)=10*sin(pi*t/0.6). It is a piecewise function in that the load is present from 0 to 0.6 seconds, and is zero therafter. I have tried creating a "for" if-else loop but with little success.
Additionally, the problem is Example 5.2 in Dynamics of Structures, which includes solving through central difference method.
My m file reads as such:
%VARIABLES delt=0.1; %time step m=0.2533; k=10; zeta=0; t=[0:delt:2]'; td=0.6; T=1;
wn=sqrt(k/m); c=2*zeta*wn*m;
for t=0:n+2 if t<0.6 P=10*sin(pi*t/0.6) else P=0 end end
%define initial values F(1)=0; F(2)=0; d(2)=0; v(2)=0; a(2)=1/m*(P(2)-c*v(2)-k*d(2)); d(1)=d(2)-delt*v(2)+delt^2/2*a(2);
%coefficient of d(i+1) A=m/delt^2-c/(2*delt); B=k-2*m/(delt^2); C=m/delt^2+c/(2*delt);
%iteration
for i=3:n+2 TT(i)=t(i-2); F(i)=P(i-2); d(i)=2*delt*v(i-1)+d(i-2); d(i+1)=1/C*(F(i)-A*d(i-1)-B*d(i)); v(i)=(d(i+1)-d(i-1))/(2*delt); a(i)=(d(i+1)-2*d(i)+d(i-1))/delt^2; v(i+1)=v(i); %virtual a(i+1)=a(i); %virtual TT(i+1)=TT(i); %virtual F(i+1)=F(i); %virtual end
result=[TT' F' d' v' a']; xlswrite('cdm result.xls',result)

sam0037 on 13 Apr 2016
Hi,
delt = 0.1;
t = [0:delt:2]';
plot(t,P,'-r*');
hold on;
P(t>0.6)=0; % values where t>0.6 will be assigned to zero
plot(t,P,'-co');