avg

2
clc;close all; clear all; %newmarks average acceleration %eqn for newmarks avg acceleration m=1000;k=10000;wn=3.162;c=63.24; %initial condition u0=0; v0=0; a0=0; t=0:.01:300; t1=100;%t1=(.1,1,10,100); t2=200; t3=300; delt=.01; u=zeros(1,length(t)); v=zeros(1,length(t)); a=zeros(1,length(t)); p=zeros(1,length(t)); for n=1:length(t) if t(n)<t1 p(n)=1000*t(n); elseif t(n)>=t1 && t(n)<=t2; p(n)=100; else p(n)=0; end end %u(i)=P(i)*25*10^-8+ui+100*uvi+2.5*10^-5*uai; %uv(i)=-uvi+200*(u(i)-ui); %ua(i)=40000*(u(i)-ui)-400*uvi-uai; %t0 to t1 for i=2:length(t) u(i)=(p(i)+((4*m/delt^2)+(2*c/delt))*u(i-1)+((4*m/delt)+c)*v(i-1)+m*a(i-1))/ ((4*m/delt^2)+(2*c/delt)+k); v(i)=(2/delt*(u(i)-u(i-1)))-v(i-1); a(i)=(4/delt^2*(u(i)-u(i-1)))-4/delt*v(i-1)-a(i-1); end subplot(3,1,1);plot(t,u);title('Displacement'); subplot(3,1,2);plot(t,v);title('Velocity'); subplot(3,1,3);plot(t,a);title('acceleration');

description

Dynamic analysis of structures.average acceleration method matlab code

Transcript of avg

Page 1: avg

clc;close all; clear all;%newmarks average acceleration%eqn for newmarks avg accelerationm=1000;k=10000;wn=3.162;c=63.24; %initial conditionu0=0;v0=0;a0=0;t=0:.01:300;t1=100;%t1=(.1,1,10,100);t2=200;t3=300;delt=.01;u=zeros(1,length(t));v=zeros(1,length(t));a=zeros(1,length(t));p=zeros(1,length(t));for n=1:length(t)if t(n)<t1 p(n)=1000*t(n);elseif t(n)>=t1 && t(n)<=t2; p(n)=100; else p(n)=0;endend %u(i)=P(i)*25*10^-8+ui+100*uvi+2.5*10^-5*uai;%uv(i)=-uvi+200*(u(i)-ui);%ua(i)=40000*(u(i)-ui)-400*uvi-uai; %t0 to t1for i=2:length(t)u(i)=(p(i)+((4*m/delt^2)+(2*c/delt))*u(i-1)+((4*m/delt)+c)*v(i-1)+m*a(i-1))/((4*m/delt^2)+(2*c/delt)+k);v(i)=(2/delt*(u(i)-u(i-1)))-v(i-1);a(i)=(4/delt^2*(u(i)-u(i-1)))-4/delt*v(i-1)-a(i-1); end subplot(3,1,1);plot(t,u);title('Displacement');subplot(3,1,2);plot(t,v);title('Velocity');subplot(3,1,3);plot(t,a);title('acceleration');