-2

syms b1 b2 b3 b4 b5 b6 b7

syms x11 x12 x13 x21 x23 x31 x32 x33

syms S11 S12 S22 S33 ;

B= [b1 b2 b3; b4 0 b5; b6 b7 0];

X= [x11 x12 x13 ; x21 x22 x23 ; x31 x32 x33];

C= BX + Xtranspose(B);

C1=reshape(C,9,1);

x= [x11 x12 x13 x21 x22 x23 x31 x32 x33];

The probelem is to get the co-efficient matrix A such that: A*x= 0. I have carried out the solution by hand as:

a1= [2*b1,b2,b3,b2,0,0,b3,0,0];

a2= [b4,0,0,b1,b2,b3,b5,0,0];

a3= [b6,0,0,b7,0,0,b1,b2,b3];

a4= [b4,b1,b5,0,b2,0,0,b3,0];

a5= [0,b4,0,b4,0,b5,0,b5,0];

a6= [0,b6,0,0,b7,0,b4,0,b5];

a7= [b6,b7,b1,0,0,b2,0,0,b3];

a8= [0,0,b4,b6,b7,0,0,0,b5];

a9= [0,0,b6,0,0,b7,b6,b7,0];

AA= [a1;a2;a3;a4;a5;a6;a7;a8;a9]; #the A matrix should be of this form.

Community
  • 1
  • 1
FAM
  • 101
  • 4
  • 1
    Do you know how to use documentation? `help syms` and `help global`? These are two completely different things. Please refrain from using StackOverflow as a substitute for looking at the documentation or doing some basic research. – horchler May 24 '15 at 15:23
  • My problem is actually to get the matrix form of a system of linear equations in MATLAB. Can you help me?? @horchler – FAM May 25 '15 at 18:36
  • That's not what your question says at all. That sounds like a new and separate question. StackOverflow questions must be specific and show some effort. You're not just asking for yourself, but for anyone else who might have a similar question. A good question should concisely out line the problem, provide runnable code to [demonstrate the issue](http://stackoverflow.com/help/mcve), and list any errors or exactly what the problem is. Proper [formatting](http://stackoverflow.com/help/formatting) is also good. Please [read the FAQ about asking questions](http://stackoverflow.com/help/on-topic). – horchler May 25 '15 at 20:24

1 Answers1

0

syms declares symbolic variables, while global declares a variable to belong to the global scope. The variables declared via global are not symbolic, but numeric.

Tamás Szabó
  • 733
  • 6
  • 9
  • I am a beginner, could you please explain the term 'global scope'?? – FAM May 24 '15 at 12:55
  • In matlab you have three workspaces (or scopes) for your variables: _global_, _base_ and _local_. Typically when you run a script, it uses variables from the _base_. That's the one you can see in your Workspace window. Functions typically have their own workspace. When you declare a variable to be _global_, you "pull" that variable from the _global_ scope to your local workspace. Than, you can access and change its value and any change will be reflected in all the workspaces where you use it. – Tamás Szabó May 24 '15 at 13:00
  • I need to solve an equation: B*Z + Z * B' = S where all $B, Z , S$ are 3 * 3 matrices of unknown variables. I need to find the matrix Z. I tried to use the 'syms' command to define the variables. But I was unable to solve the problem. Ultimately I was able to get 9 equations , Now I just have to write it in matrix form in MATLAB. However, I was not able to convert the equations in matrix form, so I did it by hand. I had used the "equationsToMatrix" command. – FAM May 24 '15 at 13:17
  • The problem I am having is that I have to write the 9 inequations in the form: AX=B, But for that I have to convert the set of equations into the form AX= B. Since all the elements of the matrices I am using are symbolic variables. I am not being able to do so by using "equationsTomatrix" command. Could you suggest an alternative?? I need to solve!!! Numerically or analytically it doesn't matter! :) – FAM May 24 '15 at 14:04