computing matrix in for loop

2 vues (au cours des 30 derniers jours)
astronot
astronot le 29 Nov 2020
Modifié(e) : VBBV le 29 Nov 2020
hi friends ı want to calculate matrix of ZMN in for loop , it must have values like Z11,Z12,...Z55, but my code just calculate Z11 value . after that ı defined matrix as VM (1x5) and [VM] = [Z]*[IN] how can ı find IN matrix? How can ı do this ? ı hope you help me, ı desing this below code:
l=1;
a=0.001;
V=1;
delta=l/5;
for n = 1:5
for m = 1:5
dminus(m,n) = l-delta;
dplus(m,n) = l+ delta;
if (m==n) ZMN=2*log (delta+ (sqrt( a*a +delta*delta))/a);
elseif (2>= abs(m-n)) ZMN=log ( (dplus+ sqrt(dplus*dplus +a*a))/ (dminus +sqrt(dminus*dminus+a*a)));
else log(dplus/dminus);
end
end
end
A = [1.11*(10^-10),1.11*(10^-10),1.11*(10^-10),1.11*(10^-10),1.11*(10^-10)];
VM=A.';

Réponse acceptée

VBBV
VBBV le 29 Nov 2020
l=1;
a=0.001;
V=1;
delta=l/5;
for n = 1:5
for m = 1:5
dminus(m,n) = l-delta;
dplus(m,n) = l+ delta;
if (m==n)
Z(m,n)=2*log (delta+ (sqrt( a*a +delta*delta))/a);
elseif (2>= abs(m-n))
Z(m,n)=log ( (dplus(m,n)+ sqrt(dplus(m,n)*dplus(m,n) +a*a))/ (dminus(m,n) +sqrt(dminus(m,n)*dminus(m,n)+a*a)));
else
Z(m,n) = log(dplus(m,n)/dminus(m,n));
end
end
end
  2 commentaires
astronot
astronot le 29 Nov 2020
thank you can ı ask anthing else ? after that ı defined matrix as VM (1x5) and [VM] = [Z]*[IN] how can ı find IN matrix?
A = [1.11*(10^-10),1.11*(10^-10),1.11*(10^-10),1.11*(10^-10),1.11*(10^-10)];
VM=A.';
VBBV
VBBV le 29 Nov 2020
Modifié(e) : VBBV le 29 Nov 2020

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Spline Postprocessing dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by