MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
Asked by Sivakumaran Chandrasekaran on 30 Mar 2013

x+3y=5;2x+4y=4. In general maths, we can be able to find the values of 'x' and 'y' from the above equations. How to find it in MATLAB?

Answer by Walter Roberson on 30 Mar 2013

If you have the Symbolic toolbox,

syms x y solve(x + 3*y - 5, 2*x + 4*y - 4)

Sivakumaran Chandrasekaran on 30 Mar 2013

x: [1x1 sym] y: [1x1 sym]. this is the answer which i got.. but i want to know the value of x and y.. no values are stored in workspace also

Answer by Anand on 30 Mar 2013

A = [1 3;... 2 4;]; b = [5;... 4];

%Solve Ax=b as A\b X = A\b >> A\b

ans =

-4 3

Read more here: http://www.mathworks.com/help/matlab/ref/mldivide.html

## 0 Comments