computing matrix in for loop
2 次查看(过去 30 天)
显示 更早的评论
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.';
0 个评论
采纳的回答
VBBV
2020-11-29
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spline Postprocessing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!