I did try that,
As far as the model is concerned, it didn’t change anything, I’m still getting those residuals.
I tried to write a solver to find the starting value of all k, I tried by hand and it ended up being too much RAM for my brain, as I have problems with the timing of the choices.
I then tried to write a solver and it doesn’t work because I end up having Ct* in Ct expression and I can’t seem to find a way to reduce the entire expression. I thought the solver would end up able to solve it, but I must have made a mistake.
Here’s the solver code, maybe thats where my mistake is.
"clear
clc
x0 = [0.1;0.1;0.1;0.1;0.1;0.1;0.1;0.1];
solution = fsolve(@sol,x0)
function f = sol(x)
kt1 = x(1);
kt1 = x(2);
knt1 = x(3);
knt1 = x(4);
kst1 = x(5);
kst1 = x(6);
ksnt = x(7);
knst = x(8);
kt0 = 1 ;
knt0 = 1;
kst0 = 1;
knst0 = 1;
delta = 0.1;
beta = 0.96;
f1 = ((((((((kt0)^(.4))+((kst0)^(.4)) - Cts - ((kt1 - (.9)(kt0))))^(1-2.5)) - ((kst1 - (.9)(kst0))^(1-(2.5)) + ((((knt0)^(.4))-(knt1 - (0.9)(knt0)))^(1-2.5)))))^(3.866666667))/((kt0)^(.4))+((kst0)^(.4)) - Cts - ((kt1 - (.9)(kt0))-((kst1 - (.9)kst0))^(2.5))) * 0.4/((kt0)^(0.6)) + (0.9);
f2 = 0.96((((((((kt1)^(.4))+((kst1)^(.4)) - Cts - ((kt2 - (.9)kt1)))^(1-2.5)) - ((kst2 - (.9)(kst1))^(1-(2.5)) + ((((knt1)^(.4))-(knt2 - (0.9)(knt1)))^(1-2.5)))))^(3.866666667))/((kt1)^(.4))+((kst1)^(.4)) - Cts - ((kt2 - (.9)kt1)-((kst2 - (.9)kst1))^(1-2.5))) * 0.4/((kt1)^(0.6)) + (0.9) - 1;
f3 = ((((((((kt0)^(.4))+((kst0)^(.4)) - Cts - ((kt1 - (.9)(kt0))))^(1-2.5)) - ((kst1 - (.9)(kst0))^(1-(2.5)) + ((((knt0)^(.4))-(knt1 - (0.9)(knt0)))^(1-2.5)))))^(3.866666667))/((((knt0)^(.4))-((knt1 - (0.9)(knt0)))^(2.5))) ((0.4)/((knt0)^(.6)))+(0.9));
f4 = 0.96*((((((((kt1)^(.4))+((kst1)^(.4)) - Cts - ((kt2 - (.9)(kt1))))^(1-2.5)) - ((kst2 - (.9)(kst1))^(1-(2.5)) + ((((knt1)^(.4))-(knt2 - (0.9)(knt1)))^(1-2.5)))))^(3.866666667))/((((knt1)^(.4))-((knt2 - (0.9)(knt1)))^(2.5)))* ((0.4)/((knt1)^(.6)))+(0.9)) -1 ;
f5 = ((((((((kt0)^(.4))+((kst0)^(.4)) - Ct - ((kt1 - (.9)(kt0))))^(1-2.5)) - ((kst1 - (.9)(kst0))^(1-(2.5)) + ((((ksnt0)^(.4))-(ksnt1 - (0.9)(ksnt0)))^(1-2.5)))))^(3.866666667))/((kt0)^(.4))+((kst0)^(.4)) - Ct - ((kt1 - (.9)(kt0))-((kst1 - (.9)kst0))^(2.5))) * 0.4/((kst0)^(0.6)) + (0.9);
f6 = 0.96((((((((kt1)^(.4))+((kst1)^(.4)) - Ct - ((kt2 - (.9)(kt1))))^(1-2.5)) - ((kst2 - (.9)(kst1))^(1-(2.5)) + ((((ksnt1)^(.4))-(ksnt2 - (0.9)(ksnt1)))^(1-2.5)))))^(3.866666667))/((kt1)^(.4))+((kst1)^(.4)) - Ct - ((kt2 - (.9)(kt1))-((kst2 - (.9)kst1))^(2.5))) * 0.4/((kst1)^(0.6)) + (0.9) -1 ;
f7 = ((((((((kt0)^(.4))+((kst0)^(.4)) - Cts - ((kt1 - (.9)(kt0))))^(1-2.5)) - ((kst1 - (.9)(kst0))^(1-(2.5)) + ((((ksnt0)^(.4))-(ksnt1 - (0.9)(ksnt0)))^(1-2.5)))))^(3.866666667))/((((ksnt0)^(.4))-((ksnt1 - (0.9)(ksnt0)))^(2.5))) ((0.4)/((ksnt0)^(.6)))+(0.9));
f8 = 0.96 * ((((((((kt1)^(.4))+((kst1)^(.4)) - Cts - ((kt2 - (.9)(kt1))))^(1-2.5)) - ((kst2 - (.9)(kst1))^(1-(2.5)) + ((((ksnt1)^(.4))-(ksnt2 - (0.9)(ksnt1)))^(1-2.5)))))^(3.866666667))/((((ksnt1)^(.4))-((ksnt2 - (0.9)(ksnt1)))^(2.5)))* ((0.4)/((ksnt1)^(.6)))+(0.9)) - 1; "
and the error codes :
end
Unrecognized function or variable ‘Cts’.
Error in solverIME>sol (line 27)
f1 = ((((((((kt0)^(.4))+((kst0)^(.4)) - Cts - ((kt1 - (.9)(kt0))))^(1-2.5)) - ((kst1 - (.9)(kst0))^(1-(2.5)) + ((((knt0)^(.4))-(knt1 -
(0.9)(knt0)))^(1-2.5)))))^(3.866666667))/((kt0)^(.4))+((kst0)^(.4)) - Cts - ((kt1 - (.9)(kt0))-((kst1 - (.9)*kst0))^(2.5))) * 0.4/((kt0)^(0.6)) + (0.9);
Error in fsolve (line 258)
fuser = feval(funfcn{3},x,varargin{:});
Error in solverIME (line 6)
solution = fsolve(@sol,x0)
Caused by:
Failure in initial objective function evaluation. FSOLVE cannot continue.
So I’m stuck at the fact that Ct is Xt + Xt* - Ct* - It - It* leading me to have a Ct* in my Ct equation and a Ct in my Ct* equation and I’m getting real stuck at that point.
Continuing on, trying by hand, always interested in your pointers.