Error using symengine, Either base or exponent must be a scalar.
8 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
採用された回答
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!