Computational problem!!!

Hi I have a problem with a matrix calculation. This code doesn't work because I can't explain to the code that the part that is elevated at the cube is a number and not a vector. How could I do ??? Regards
function F=System11(x)
m=5;
n=6;
g=m*n;
pc=(1:1:m);
pr=(m+1):m:((m*(n-1))+1);
ur=(2*m:m:(m*n));
uc=((m*(n-1))+2):1:((m*n)-1);
F=zeros(2*g,1);
%%%%
for p=2:1:(n-1)
cc=(2+(m*(p-1))):1:(m*p-1);
F(cc,1)=x(cc)-(x(g+cc,1))^3;
end
F(pc,1)=x(pc)-(x(g+pc))^3;
F(pr,1)=x(pr)-(x(g+pr))^3;
F(ur,1)=x(ur)-(x(g+ur))^3;
F(uc,1)=x(uc)-(x(g+uc))^3;
%%%%
for p=2:1:(n-1)
cc=(2+(m*(p-1))):1:(m*p-1);
F(g+cc,1)=x(g+cc)-6;
end
F(g+pc,1)=x(g+pc)-1;
F(g+pr,1)=x(g+pr)-2;
F(g+ur,1)=x(g+ur)-3;
F(g+uc,1)=x(g+uc)-4;
end
SOLVER
m=5;
n=6;
g=n*m;
%Initial Condition
KI=ones(g,1);
TI=ones(g,1);
iniz = [KI; TI];
options=optimset('Display','iter');
[x,fval,exitflag,output,JAC] = fsolve(@System11,iniz,options);

 채택된 답변

Daniel Shub
Daniel Shub 2012년 3월 26일

0 개 추천

A stab here ... There is a difference between x^3 and x.^3, just like there is a difference between x.*y and x*y.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics and Optimization에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by