Dear Matlab Community,
I would like to ask a question regarding the solving of a 4 equations non-linear system.
I have tried two approaches: the first one by defining a system and use solve to extract the solutions, but I get into an infinite loop and Matlab doesn't give any solution:
syms E1 X P E2
eq1 = E0 + E1*(X)^(sr(1))+E2*(P)^(sr(1)) == Eapp(1);
eq2 = E0 + E1*(X)^(sr(2))+E2*(P)^(sr(2)) == Eapp(2);
eq3 = E0 + E1*(X)^(sr(3))+E2*(P)^(sr(3)) == Eapp(3);
eq4 = E0 + E1 + E2 == Ei
eqns = [eq1 eq2 eq3 eq4];
vars = [E1 X P E2];
A = solve(eq1, eq2, eq3, eq4)
My unknown are E1, X, E2, P and all the others are defined parameters.
I have also tried to implement a function:
function F = root2d(x)
sr = [0.05 0.1 0.5 1];
Eapp = [2.09 2.18 2.27 2.4].*1e6;
Ei = 2.55e6;
E0 = 2.14e6;
F(1) = E0 + x(1)*(x(2))^(sr(1))+x(3)*(x(4))^(sr(1)) - Eapp(1);
F(2) = E0 + x(1)*(x(2))^(sr(2))+x(3)*(x(4))^(sr(2)) -Eapp(2);
F(3) = E0 + x(1)*(x(2))^(sr(3))+x(3)*(x(4))^(sr(3)) - Eapp(3);
F(4) = E0 + x(1) + x(3) - Ei;
Said function is called in the main script and I have used fsolve to extract the solutions:
fun = @root2d;
x0 = [1.5e6,1,1.5e6,1];
x = fsolve(fun,x0)
In this case, my problem is that I cannot properly set an initial interval x0 where I can look for the solutions, since I cannot plot a 4 variables function to visually see the zeros, I get the following error (I have estimated the values of E1 and E2 as order of magnitude but I have no clue of which the values of P and X should be):
No solution found.
fsolve stopped because the relative size of the current step is less than the
value of the step size tolerance squared, but the vector of function values
is not near zero as measured by the value of the function tolerance.
Does anyone have any tip to solve this problem?