How can I solve this system of equation
7 views (last 30 days)
syms thetaF thetaR thetaM sigmaLB jx KXsym tx Fz h theta
[thetaSol,hSol]=vpasolve([eqn1 eqn2 eqn3 eqn4 eqn5 eqn6 eqn7 eqn8 eqn9],[theta,h]);
I hope you are all doing well despite the virus. My goal is to obtain the values of theta and h for Fz=W.
r, lambda, a0, a1, kc, b, kpsi, s_LB, beta_LB, psi, c and W are known constants. Because of MATLAB giving me the error "A and B must be floating-point scalars" in eqn8, I added the double(). Now I have the error Unable to convert "expression into double array". I made some research and I think it doesn't work because it is in a loop but I didn't clearly understand. That's why I am now asking for your help.
First I would like to know if MATLAB can resolve this system numerically? If yes, I would like to know where I made my error(s) to correct it (them). I'll add that I am using 2019b.
Thank you in advance for your help.
Andreas Bernatzky on 24 Mar 2020
Hey Vince Ugo,
you can not convert a variable into a symbolic expression (subsituting) and convert them into double() values and than expect a numerical solver to work with it. The double value first exists after you have run the numerical solver. But I see your struggle with the integrate function, because matlab expects double() Values here. you have to find another way to express the integral symbolic.
btw in this line you are using the variable "c". c is no where defined
Have a look at this example of mine for a numerical solving of a overdetermined system:
syms x y z
eqn1 = x + -0.25*y + (1/16) * z == 0;
eqn2 = x + 0.5*y + 0.25 * z == 1;
eqn3 = x + 2*y + 4*z == 0;
eqn4 = x + 2.5*y + (25/4)*z == 1;
% [Alin,B] = equationsToMatrix([eqn1, eqn2, eqn3], [x, y, z]);
[Alsq,B] = equationsToMatrix([eqn1, eqn2, eqn3, eqn4], [x, y, z]);%overdetermined system
% X = linsolve(Alsq,B);
Xlsqr = lsqlin(double(Alsq),double(B))
Alex Sha on 20 Apr 2020
Hi, VinceUgo, the eqn8 and eqn9 can be combined into one equation, so your problem become a system equation solving with eight equations but nine parameters, theoretically, there are mulit-solutions: