-2

I have a system of equations,

constant + C.x + D.y = P 

where C and D are 25*4 matrices. x and y are 4*1 matrices and P is a 25*1 matrix. How do I solve this system of equations in MATLAB?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Paindoo
  • 173
  • 3
  • 8
  • This question needs a lot of work. Can you show us what you've tried? Have you tried googling a little bit? What operator did the first 2 or 3 google hits say you should look at? As it stands there is a great risk this will be closed as not a real question. – carlosdc May 06 '13 at 12:04
  • @Paindoo It seems that your linear equation is overdetermined. You have 25 equations and only 8 unknowns. – Eitan T May 06 '13 at 12:11
  • I forgot to mention that Matrices C, D and P are known and x and y are to be determined. x and y are not scalers but 4*1 matrices – Paindoo May 06 '13 at 12:11
  • @Eitan, yes, it is an overdetermined set of equations. – Paindoo May 06 '13 at 12:12
  • @Paindoo then you should take a look at the following related question: [Solving an overdetermined constraint system](http://stackoverflow.com/questions/7118274/solving-an-overdetermined-constraint-system) – Eitan T May 06 '13 at 12:15

1 Answers1

1

You can write the equations as

 [C D] * [x ;y ] = P - constant

where [C D] is a horizontal concatenation of C and D ( 25 * 8 matrix ).
[x;y] is a vertical concatenation of x and y ( 8*1 vector )

You can solve this in Matlab using backslash operator:

 xy = [C D] \ ( P - constant ); 

 x = xy(1:4);
 y = xy(5:end);
Shai
  • 111,146
  • 38
  • 238
  • 371