# 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 日間)
Hidayet Akkas 2021 年 3 月 29 日

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 件のコメント表示非表示 なし
KSSV 2021 年 3 月 29 日
eqn = area == A1+A2+A3
The above line will throw a error.

サインインしてコメントする。

### 回答 (1 件)

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.

サインインしてコメントする。

### Community Treasure Hunt

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

Start Hunting!

Translated by