double for loop and integral
Afficher commentaires plus anciens
m=1.24;
w_n=55;
w=0.7*w_n;
zeta=0.05;
td=2*pi/w;
P_0=1;
t=[0:100/1000:100];
ksi=[0:t/1000:t];
for ii=1:length(t);
jj=1:length(ksi);
f_t(ii)=((2*P_0*t(ii))/td);
zt1(ii)=(-1)/w_n*sqrt(1-zeta^2);
zt2(ii)= exp(-zeta*w_n*(t(ii)-ksi(jj)))*sin(w_n*sqrt(1-zeta^2)*(t(ii)-ksi(jj)))
zt(ii)=integral(zt2(ii),ksi,0,t(ii))
ztf(ii)=zt(ii)*zt1(ii)
I am getting erros when trying to do integration while using double for loop
t is variable =0,................
ksi is also variable but=0,........,t
Réponses (1)
Torsten
le 13 Mar 2022
m=1.24;
w_n=55;
w=0.7*w_n;
zeta=0.05;
td=2*pi/w;
P_0=1;
t=[0:0.1:100];
for ii=1:length(t)
f_t(ii)=2*P_0*t(ii)/td;
zt1(ii)=-sqrt(1-zeta^2)/w_n;
fun=@(x)exp(-zeta*w_n*(t(ii)-x)).*sin(w_n*sqrt(1-zeta^2)*(t(ii)-x));
zt(ii) = integral(fun,0,t(ii));
ztf(ii)=zt(ii)*zt1(ii) ;
end
plot(t,zt)
1 commentaire
Torsten
le 13 Mar 2022
@fatmah hasan Comment moved here:
Thaanks it worked.
Catégories
En savoir plus sur Programming 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!