error in solving system of nonlinear equations

I am trying to solve four nonlinear equation simultaneously on matlab. But I am getitng the "Comma separated list expansion has cell syntax for an array that is not a cell".
The screenshot of error is attached.
My code is given below.
syms x y z T
x1=1;
x2=1;
x3=1;
x4=1;
y1=1;
y2=1;
y3=1;
y4=1;
z1=1;
z2=1;
z3=1;
z4=1;
c=1;
t1=1;
t21=1;
t31=1;
t41=1;
eq1 = ((x1 - x)^2 + (y1 - y)^2 + (z1 - z)^2 )^1/2 - (c * t1) + (c * T)==0;
eq2 = ((x2 - x)^2 + (y2 - y)^2 + (z2 - z)^2 )^1/2 - (c * t21) - (c*t1) + (c*T)==0;
eq3 = ((x3 - x)^2 + (y3 - y)^2 + (z3 - z)^2 )^1/2 - (c * t31) - (c*t1) + (c*T)==0;
eq4 = ((x4 - x)^2 + (y4 - y)^2 + (z4 - z)^2 )^1/2 - (c * t41) - (c*t1) + (c*T)==0;
sol = solve(eq1, eq2, eq3, eq4);
xSol = sol.x
ySol = sol.y
zSol = sol.z
TSol = sol.T

2 comentarios

Rik
Rik el 4 de Jun. de 2020
What release are you using? When I run this code I don't get this error.
Did you notice the warning above the error? There is no explicit solution, so when you try to extract it that doesn't really make sense.
Muhammad Ali
Muhammad Ali el 4 de Jun. de 2020
I am using R2014a release.
Kindly guide what should I do

Iniciar sesión para comentar.

Respuestas (1)

madhan ravi
madhan ravi el 4 de Jun. de 2020
Editada: madhan ravi el 4 de Jun. de 2020
sol = solve([eq1, eq2, eq3, eq4],[x,y,z,T]); %proper way to use solve

3 comentarios

madhan ravi
madhan ravi el 4 de Jun. de 2020
Why not use fsolve(...)?
Muhammad Ali
Muhammad Ali el 4 de Jun. de 2020
getting the same error using the command you gave for solve function.
Kinldy guide how can I use fsolve in this code
Rik
Rik el 4 de Jun. de 2020
Are you sure there should be an explicit solution? What would you expect your output to be if you wanted to solve sin(x)==2?

Iniciar sesión para comentar.

Categorías

Más información sobre Symbolic Math Toolbox en Centro de ayuda y File Exchange.

Preguntada:

el 4 de Jun. de 2020

Comentada:

Rik
el 4 de Jun. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by