what's the problem with my for loop ?
Afficher commentaires plus anciens
function [responces] = int_method(records,DT,Tn)
%This function calculates interpolation method's parameter and spectral
%displacement and spectral pseudo-velocity and pseudo-acceleration.
% Parameter defining:
M = 1; % Mass in units of kg.
XI = 0.05; % damping ration.
% Calculation of displacement, pseudo-velocity and pseudo-acceleration
% spectrums:
for m=1:length(DT);
for i=1:numel(Tn);
Wn=(2*pi)/Tn(i,1); % Radial/Angular frequency in units of rad/sec.
K=Wn^2*M; % Stiffness in units of kg/cm
Wd=Wn*sqrt(1-XI^2); % rad/sec
DT1=DT(m);
a=(exp(-XI*Wn*DT1));
b=((2*XI)/(Wn*DT1));
c=(XI/sqrt(1-XI^2));
d=((Wn)/(sqrt(1-XI^2)));
e=sin(Wd*DT1);
f=cos(Wd*DT1);
A=a*(c*e+f);
B=a*(e/Wd);
C=(1/K)*(b+a*((((1-2*XI^2)/(Wd*DT1))-c)*e-(1+b)*f));
D=(1/K)*(1-b+a*(((2*XI^2-1)/(Wd*DT1))*e+b*f));
A1=-a*(d*e);
B1=a*(f-c*e);
C1=(1/K)*(-1/DT1+a*((d+c/DT1)*e+f/DT1));
D1=(1/(K*DT1))*(1-a*(c*e+f));
for j=1:numel(records.Ag{1,m})-1;
% Intial conditions:
u(1,1)=0;
v(1,1)=0;
u(j+1,1)=A*u(j,1)+B*v(j,1)+C*records.Ag{1,m}(j,1)+D*records.Ag{1,m}(j+1,1);
v(j+1,1)=A1*u(j,1)+B1*v(j,1)+C1*records.Ag{1,m}(j,1)+D1*records.Ag{1,m}(j+1,1);
end
responces.Sd{1,m}(i,1)=max(abs(u)); % Spectral displacement (cm).
responces.Spv{1,m}(i,1)=Wn*responces.Sd{1,m}(i,1); % Spectral pseudo-velocity (cm/s).
responces.NSpv{1,m}(i,1)=responces.Spv{1,m}(i,1)./records.MVg{1,m}; % Spectral shape
responces.Spa{1,m}(i,1)=Wn^2*responces.Sd{1,m}(i,1); % Spectral psudo acceleration (cm/s^2).
end
end
responces.MeanNSpv=(mean((cell2mat(responces.NSpv))'))';
end
it does'nt give right answer
record argument contains 8 accelerogram
DT argument contais records sampling time
Tn is equal to Tn = 0.01:0.01:4; % periods in units of sec.
when i use one accelerogram the answer is rigth but as i use 2 or more it doesn't give the right answer for each one.
Réponses (0)
Catégories
En savoir plus sur Vibration Analysis dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!