Error using symengine, Either base or exponent must be a scalar.
2 次查看(过去 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!