資源描述:
《沖擊響應(yīng)譜計(jì)算的matlab程序.doc》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫(kù)。
1、disp('')dispCsrs.mver2.0July3,2006')disp(‘byTomIrvineEmail:tomirvine@aol.com,)disp('')dispCThisprogramcalculatestheshockresponsespectrum')disp('ofanaccelerationtimehistory,whichispre-loadedintoMatlab.')disp(‘Thetimehistorymusthavetwocolumns:time(sec)&acceleration^)disp
2、('')%cleart;cleary;clearyy;clearn;clearfn;clearal;cleara2clearbl;clearb2;clearjnum;clearTIIM;clearresp;clearxpos;clearxneg;%iunit=inputCEnteraccelerationunit:1=G2=m/sec2');%disp('')disp('Selectfileinputmethod');disp(,l=externalASCIIfile');dispC2=filepreloadedintoMatlab
3、');filechoice=inputC');%if(f訂echoice二二1)[filermme,pathrmme]二uigetf訂e('*.京');fi1ename二ful1fi1e(pathname,fi1ename);%fid=fopen(filename,,rJ);THM=fscanf(fid,'%g%g,[2inf]);THM二THM';elseTHM=input(,Enterthematrixname:');end%t=double(THM(:,1));y=double(THM(:,2));%tmx=max(t);tm
4、i=min(t);n=length(y);%outl=sprintfC%dsamples,n);disp(outl)%dt二(tmx-tmi)/(n-1);sr=l./dt;%outl二sprintfCSR二%gsamples/secdt二%gsec,sr,dt);disp(outl)%fn(l)=inputCEnterthestartingfrequency(Hz),);iffn(l)>sr/30.fn(l)=sr/30.;end%idamp=inputCEnterdampingformat:1=dampingrati
5、o2二Q');disp(,')if(idamp==l)damp^inputCEnterdampingratio(typicallyQ.05)');elseQ=inputCEntertheamplificationfactor(typicallyQ=10)');damp二1./(2.*Q);end%disp(,,)dispCSelectalgorithm:,)disp('l=Kelly-Richman2=Smallwood');ia1gorithm=input('');%tmax=(tmx-tmi)+1./fn(l);limit二ro
6、und(tmax/dt);n=limit;yy=zeros(1,limit);fori=l:length(y)yy(i)=y(i);end%disp('')disp('Calculatingresponse')%%SRSengine%forj二1:1000%omega=2.*pi*fn(j);omegad^omega^sqrt(1.-(damp2));cosd=cos(omegad^dt);sind=sin(omegad^dt);domegadt二damp^omega^dt;%if(ialgorithm==l)al(j)二2.*ex
7、p(-domegadt)*c()sd;a2(j)=-exp(~2.^domegadt);bl(j)二2.^domegadt;b2(j)=onieg8*dt*exp(-domegadt);b2(j)=b2(j)*((omega/omegad)*(1.-2.*(damp*2))*sind-2.^damp^cosd);b3(j)=0;%elseE=exp(-damp*()mega*dt);K=omegad^dt;C=E*cos(K);S二E*sin(K);Sp=S/K;%sl(j)二2*C;a2(j)=4T2;bl(j)=l.-Sp;b2
8、(j)=2?*(Sp-C);b3(j)=E^2-Sp;endforward=[bl(j),b2(j),b3(j)];back=[1,-al(j),-a2(j)];%resp=fi1ter(forward,back,yy);%x_pos