Error using symengine, Either base or exponent must be a scalar.

8 ビュー (過去 30 日間)
N/A
N/A 2020 年 12 月 6 日
回答済み: Ameer Hamza 2020 年 12 月 6 日
I keep getting this error and don't know how to fix it. Code is below
Error is:
"Error using symengine
Either base or exponent must be a scalar."
syms x y
r = [3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7];
for i = 1:9
eq1 = (x+1)^2 + (y+1)^2 - r(i).^2;
eq2 = (3*x)+2-y;
[x,y] = vpasolve(eq1,[x,y], eq2,[x,y]);
disp(x)
disp(y)
end

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 12 月 6 日
You are overwriting x and y inside the for-loop. The syntax for vpsaolve() is also incorrect.
syms x y
r = [3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7];
for i = 1:9
eq1 = (x+1)^2 + (y+1)^2 - r(i).^2;
eq2 = (3*x)+2-y;
[x_sol,y_sol] = vpasolve([eq1 eq2], [x,y]);
disp(x_sol)
disp(y_sol)
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by