Date: Dec 8, 2012 8:40 PM
Author: Vsh
Subject: Summation over for loop-Subscripted assignment dimension mismatch.
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. Thanks for the help.
clear all
close all
%Crack length
b=10;
% # of elements on the line
N=10;
% Poisson's ratio
v=0.1;
%Pressure
PR=1;
%Shear modulus
G=1000;
%BE Length
a=b/N;
x=linspace(0,b,2*N+1);
y=x;
for i=1:N
X(i)=x(2*i-1)+a/2;
end
xp=X';
XX=zeros(N,N);
for i=1:N
for j=1:N
XX(i,j)=xp(i)-xp(j);
end
XX(i,i)=a/N^2;
end
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