3
Hello,
I’m getting this mistake:
Conversion to function_handle from double is not possible.
I have already searched for the bug and tried to change the code but without success. Could you give a help?
A=[99.23;100.05;91;107.71;104.1];
B=[3441 3441 301720.5;68750 1068750 0;170040 13085020 0;229350 229350 5729350;34194000 0 0];
N=[300000;1000000;13000000;5500000;32800000];
E=[-0.00302;-0.00261;-0.00208];
[c3,r3]=size(A);
[c4,r4]=size(B);
x=sym ('x',[1 c3]);
x=transpose(x);
for i=1:c3
Valor(i,1)=0;
for j=1:r4
Valor(i,1)=@(x)(Valor(i,1)/((1+E(j,1)+x(j,1))^j))+(B(i,j)/((1+E(j,1)+x(j,1))^j));
end
end
My goal is to discover the vector x through the Solve with the vector Valorantigo.
Valorantigo(1:c3,1)=A(1:c3,1).* N(1:c3,1) ./100;
eqn=Valor(1:c3,1)==Valorantigo(1:c3,1);
[solx, param, cond] = solve(eqn, x, 'ReturnConditions', true);
That is x, will be the solution of:
- Value(1,1)=3441/(1-0.00302+X1) + 3441/(1-0.00261+X1) 2 + 301720.5/(1-0.00208+X1) 3
- Value(2,1)=68750/(1-0.00302+x2) + 1068750/(1-0.00261+x2) 2 + 0/(1-0.00208+x2) 3
- Value(3,1)=170040/(1-0.00302+X3) + 13085020/(1-0.00261+X3) 2 + 0/(1-0.00208+X3) 3 the same for other lines...