Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
simultaneous equations

Subject: simultaneous equations

From: Omkar Palsule-Desai

Date: 30 Sep, 2008 08:55:04

Message: 1 of 3


Hi,
I am trying to solve a system of linear equations simultaneously. The coeffients of each variables in these equations come from another *.m file, depending upon the values of parameters and other things. This makes it difficult for me to write the linear equations in the matrix form. Is there a way (or a matlab command) which I can use and solve the system of equations withouts explicitly writing it in the matrix form? For example:

eq1: para1*x + para2*y = 0;
eq2: para3*x + para4*y = 0;

variables are x and y. the values of para1 to para4 are coming from some other .m files. I need to know if it possible to get value of x and y by a command such as

solve_equations(eq1, eq2 for x and y)

or any other simple way?

Thank you,

Omkar

Subject: simultaneous equations

From: David

Date: 30 Sep, 2008 10:03:02

Message: 2 of 3

"Omkar Palsule-Desai" <omkardpd@iimahd.ernet.in> wrote in message <gbsph8$him$1@fred.mathworks.com>...
>
> Hi,
> I am trying to solve a system of linear equations simultaneously. The coeffients of each variables in these equations come from another *.m file, depending upon the values of parameters and other things. This makes it difficult for me to write the linear equations in the matrix form. Is there a way (or a matlab command) which I can use and solve the system of equations withouts explicitly writing it in the matrix form? For example:
>
> eq1: para1*x + para2*y = 0;
> eq2: para3*x + para4*y = 0;
>
> variables are x and y. the values of para1 to para4 are coming from some other .m files. I need to know if it possible to get value of x and y by a command such as
>
> solve_equations(eq1, eq2 for x and y)
>
> or any other simple way?
>
> Thank you,
>
> Omkar

yes, there are several ways. and if you would start by opening the matlab help, going to the search tab, and typing in 'solve simultaneous linear equations' it would give you several starting points. you may need to do a little bit of work to get your para* values into a matrix though, since many matlab methods use the Ax=b form of representing simultaneous linear equations.

Subject: simultaneous equations

From: Dinant

Date: 30 Sep, 2008 18:03:24

Message: 3 of 3

>Is there a way (or a matlab command) which I can use and solve the system of equations withouts explicitly writing it in the matrix form? For example:
>
> eq1: para1*x + para2*y = 0;
> eq2: para3*x + para4*y = 0;
>

A=[para1 para2;para3 para4];
b=[0;0];

%We have rewritten your linear equations in matrix form: %(A*sol=b)

sol=A\b;
x=sol(1);
y=sol(2);

By the way, if your set of linear equations are independent, x and y will always be zero if b=[0;0];

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us