|
my program, It returns the error message:
??? Error using ==> Index exceeds matrix dimensions.please help me to resolve this problem and thanks
clc
X=[0.1802,0.2547,0.2955,0.3229,0.3443,0.3631,0.3798,0.3953,0.4101,0.4244,0.4389,0.4534,0.4679,0.4837,0.5005,0.5149,0.5394,0.5641,0.6019,0.6404];
for i=1:20
A=(((2.*X(i))-1).^0).*(((2*2).*X(i))-1);
end
for i=1:20
B=(((2.*X(i))-1).^1).*(((2*3).*X(i))-1);
end
for i=1:20
C=(((2.*X(i))-1).^2).*(((2*4).*X(i))-1);
end
for i=1:20
D=(((2.*X(i))-1).^3).*(((2*5).*X(i))-1);
end
for i=1:20
E=(((2.*X(i))-1).^4).*(((2*6).*X(i))-1);
end
for i=1:20
F=(((2.*X(i))-1).^5).*(((2*7).*X(i))-1);
end
for i=1:20
G=(((2.*X(i))-1).^6).*(((2*8).*X(i))-1);
end
disp('_________________________________________________________')
disp(' X A B C D E F G ')
disp('_________________________________________________________')
for i=1:20
fprintf('%10.4f %10.3f %10.3f %10.3f %10.3f %10.3f %10.3f %10.3f\n',X(i),A(i),B(i),C(i),D(i),E(i),F(i),G(i))
end
|