Error using symengine, Either base or exponent must be a scalar.
7 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Ameer Hamza
on 6 Dec 2020
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 Comments
More Answers (0)
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!