Thread Subject: create n x n symbolic matrix in symbolic math toolbox?

Subject: create n x n symbolic matrix in symbolic math toolbox?

From: BHUPALA

Date: 4 Nov, 2009 09:22:02

Message: 1 of 2

Dear friends,

can you help me in creating n x n symbolic matrix like

       [a11 a12 ... a1n]
       [a21 a22 ... a2n]
A = [ ... ]
      [an1 an2 ... ann ]

Can anybody help me?

Regards.

Bhupala.

Subject: create n x n symbolic matrix in symbolic math toolbox?

From: Steven Lord

Date: 4 Nov, 2009 14:32:40

Message: 2 of 2


"BHUPALA" <bhupala@gmail.com> wrote in message
news:09744d62-04cb-4543-bb3a-95b45c87d0ac@x6g2000prc.googlegroups.com...
> Dear friends,
>
> can you help me in creating n x n symbolic matrix like
>
> [a11 a12 ... a1n]
> [a21 a22 ... a2n]
> A = [ ... ]
> [an1 an2 ... ann ]
>
> Can anybody help me?
>
> Regards.
>
> Bhupala.

A = sym(zeros(n, n));
for rows = 1:n
    for cols = 1:n
        A(rows, cols) = sym(sprintf('a%d%d', rows, cols));
    end
end

You should watch out if you want to create a moderately sized matrix like
this -- is a111 element (1, 11) of A or element (11, 1)? I would personally
use some separator between the row and column components of the sym variable
name.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread

Contact us at files@mathworks.com