avg
-
Upload
shirishrao2 -
Category
Documents
-
view
212 -
download
0
description
Transcript of avg
![Page 1: avg](https://reader036.fdocuments.us/reader036/viewer/2022083011/5695d08e1a28ab9b0292ed00/html5/thumbnails/1.jpg)
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');