%% Solve System of Equations
% Solve a system of equations. Use one output argument to return the solutions in the form of a structure array.

syms u v
Y = vpasolve([v^3 + 2*u == v, v^2 == u], [u,v])

% Display the solutions by accessing the fields of the structure array Y.

uSol = Y.u
vSol = Y.v

% If vpasolve cannot find a solution, it returns an empty object.

syms x
eqns = [3*x+2, 3*x+1];
Y = vpasolve(eqns,x)

% Copyright 2012-2019 The MathWorks, Inc.