I'm complitily lost with that error: Error using horzcat Dimensions of matrices being concatenated are not consistent
古いコメントを表示
I have that code, to do some mathematic problem:
ER = 1.0;
EO = 8.8541e-12;
VO = 1.0;
AA = 0.001;
L = 1.0;
N = 20;
DELTA = L/N;
%--------------------------
% Matrix A
%--------------------------
I = 1:N;
Y = DELTA*(I-0.5);
for i = 1:N
for j = 1:N
if (i ~= j)
A(i,j) = DELTA/abs(Y(i)-Y(j));
else
A(i,j) = 2.0*log(DELTA/AA);
end
end
end
%---------------------
% Vector B
%-------------------
B = 4.0*pi*EO*ER*VO*ones(N,1);
C = inv(A);
RHO = C*B;
SUM = 0.0;
for I=1:N
SUM = SUM + RHO(I);
end
Q = SUM*DELTA;
diary c:magMetMom.txt
[EO,Q]
[ [1:N] ' Y' RHO ]
diary off
%------------------
% Plot
%----------------
plot(Y,RHO)
xlabel('y (cm)'), ylabel('rho_L (pC/m)')
ERROR Message:
"ans =
1.0e-11 *
0.8854 0.8579
Error using horzcat
Dimensions of matrices being concatenated are not consistent."
DOES anyone can help? Tks a lot !! =))))
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!