I am triying to solve values of g and h. I am getting " Empty sym: 0-by-1 ". How can I solve this ?

1 次查看(过去 30 天)
x1 = 78.478396;
x2 = 76.732051 ;
x3 = 76.733861;
y1 = 12.926837;
y2 = 14.000000;
y3 = 11.966986;
syms g h;
A1 = abs((x2*y3 - x3*y2 + x3*h - g*y3 + g*y2 - x2*h)/2);
A2 = abs((g*y3 - x3*h + x3*y1 - x1*y3 + x1*h - g*y1)/2);
A3 = abs((x2*h - g*y2 + g*y1 - x1*h + x1*y2 - x2*y1)/2);
eqn = area == A1+A2+A3
SS=vpasolve(eqn,[g,h])
SS.g
SS.h

回答(1 个)

Mahesh Taparia
Mahesh Taparia 2021-3-31
Hi
Variable 'area' in your code is not defined. Either it is defined as a symbolic variable or some value needs to be assigned, i.e either the code will be
syms area;
eqn = area == A1+A2+A3
SS=vpasolve(eqn,[g,h,area])
or it will be
area = 50;
eqn = area == A1+A2+A3
SS=vpasolve(eqn,[g,h])
Moreover, to get a unique solution, the number of equations should be equal to the number of unknowns.

类别

Help CenterFile Exchange 中查找有关 Equation Solving 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by