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

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

How to input and solve non-linear system of equations in a matrix form

Asked by Marko on 5 Dec 2012

Hi!

I am trying to solve the following system of non-linear equations in Matlab and I am stucked with it for a few days...

(x_Tx - x_Rx_i).^2 + (y_Tx - y_Rx_i).^2 = 10.^( (P_Tx - P_L0 - P_Rx_i) / 5n )

Unknowns are:

x_Tx (Transmitter x location)

y_TX (Transmitter y location)

P_Tx (Transmitter power)

Knowns are:

x_Rx_i (measuremetns' x location) - vector of i elements

y_Rx_i (measurements' y location) - vector of i elements

P_Rx_i (received power at locations x_Rx_i, y_Rx_i ) - vector of i elements

P_L0 (reference power) - scalar

n (path loss coeficient) - scalar

i (number of measurement points at locations x_Rx_i, y_Rx_i and received power P_Rx_i )

My questions are:

1. How to input such non-linear system of equations into Matlab in a matrix form?

2. Which functions can be used to solve this?

Thank you for your help!

0 Comments

Marko

Products

No products are associated with this question.

2 Answers

Answer by Babak on 5 Dec 2012

Offcourse you cannot write a nonlinear equation in a matrix form.

Matrix form is only possible for linear sets of equations.

You need to use a nonlinear equation solver or you write one yourself. If you have license to MAATLAB's Optimization toolbox (check it by giving the >>ver command in the command window) then you can use the command fsolve().

By the way, you need to have at least as many equations as the number of your unknowns, which doesn't seem true in your case. If x_Tx, y_Tx, P_Tx are scalar (for example), you have only one equation but 3 unknown. If they are vectors of 2 element, you have 2 equations but 6 unknowns.. Please check your equations again because I think you need to have more equations.

5 Comments

Babak on 5 Dec 2012

What I see, is one equation and 3 unknowns. Now your equation may be of dimension n and unknowns be of dimension n too, in this case you will have n eqauations and 3n unknowns. To solve the equations you need to have as many equations as unknowns. If you ahve 3 unknowns you need to provide 3 equations.

John Petersen on 5 Dec 2012

Not 3n unknowns. Just 3. The unknowns are scalars.

Babak on 5 Dec 2012

I don't understand. There is only one equation and he is using the notation .^ repeatedly which gives the impression that there are vectors under the operator .^ but obviously there are 3 unknowns and 1 equation...

Marko: You need to find more equations because only 1 equation for 3 unknowns is not sufficient.

Babak
Answer by Marko on 5 Dec 2012

That's right I have always 3+ elements in vectors thus I have the same or even more equations than unknowns...

So how to input all these equations into Matlab to use them e.g. with fsolve()?

I can't put them in manually if I have few 100 or 1000 elements in vectors

I need to input them somehow with matrices of coefficients, etc... and I don't know how to do this...

And yes, all these unknowns are scalars while I have the Transmitter on location x_Tx,y_Tx, which is transmitting with the power P_Tx...

x_Tx (Transmitter x location) - scalar

y_TX (Transmitter y location) - scalar

P_Tx (Transmitter power) - scalar

0 Comments

Marko

Contact us