MATLAB: How to save and plot all values of x and y for each value of V? x and y values are in the vertical axis and V in the horizontal axis in the graphic

equation systemMATLAB

V=[1,2,3,4];
i=1;
while i<=4
syms x y
eqn1 = V(i)*x + y == 2;
eqn2 = -x + y == 3;
sol = solve([eqn1, eqn2], [x, y]);
xSol = double(sol.x);
ySol = double(sol.y);
end

Best Answer

Try this instead:
V=[1,2,3,4];
for k = 1:numel(V)
xy(:,k) = [V(k) 1; -1 1] \ [2; 3];
end
figure
plot3(xy(1,:), xy(2,:), V, '-p')
grid
view(30, 30)
xlabel('x')
ylabel('y')
zlabel('V')
axis([-0.6 -0.1 2.4 2.9 0 5])
text(xy(1,:), xy(2,:), V, compose('V = %.1f',V), 'HorizontalAlignment','right', 'VerticalAlignment','middle')
producing:
EDIT — (26 Jan 2021 at 13:54)
Added plot image.