"Vsh" wrote in message <email@example.com>... > Hi guys, I'm trying to get the summation over for loop statement for A(i,j). First, I'm not sure if i'm doing the whole summation right, secondly, I get a subscripted assignment dimension mismatch error, but I quiet don't understand why. ..... > ......... > B=(-G/pi/(1-v))*ones(N,N); > a1=a*ones(N,N); > > K=1; > A=ones(N,N); > for i=1:N > for j=1:N > A(i,j)=B*(XX(i,j).^2-(a1).^2) > end > K=K+1; > end - - - - - - - - - - - - In the line
on the right side you have an entire 10 by 10 matrix product and you are trying to squeeze it into the scalar, A(i,j). It just won't fit! What is it you expect to happen here?
In any case, the expression B*(XX(i,j).^2-(a1).^2) would be an awfully hard way to calculate that result there, which tells me that you meant something altogether different for the right side, presumably something that is also a scalar. Also there is a K counter here which you have made no use of at all. Only you can determine what is "right". However I would hazard the guess that you meant this: