フィルターのクリア

Computational problem!!!

1 回表示 (過去 30 日間)
Nello Troccia
Nello Troccia 2012 年 3 月 26 日
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 日
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.
  1 件のコメント
Nello Troccia
Nello Troccia 2012 年 3 月 26 日
thanks a lot!!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePCM についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by