Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7853193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:36:39+00:00 2026-06-02T19:36:39+00:00

How do I create a matrix consisting of symbol elements in MATLAB R2009b? The

  • 0

How do I create a matrix consisting of symbol elements in MATLAB R2009b?

The tedious way of doing this would be:

syms a11 a12 a21 a22
A = [a11 a12; a21 a22]

But if I want a 10×10 matrix I need something better.

Here I found the following command:

A = sym('A%d', [2 2]);

But it seems to only work in more recent versions of MATLAB while I’m using R2009b.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:36:42+00:00Added an answer on June 2, 2026 at 7:36 pm

    A not-so-efficient way of doing it would be to write a script to create a string and execute it with eval.

    cmd_var = 'syms';
    cmd_mat = 'A=[';
    for i = 1:3
        for j = 1:3
            var = sprintf(' a_%d_%d ',i,j);
            cmd_var = [cmd_var var];
            cmd_mat = [cmd_mat var];
        end
        cmd_mat = [cmd_mat ';'];
    end
    cmd_var = [cmd_var ';'];
    cmd_mat = [cmd_mat '];'];
    

    So, the command strings look like this:

    cmd_var =
    syms a_1_1  a_1_2  a_1_3  a_2_1  a_2_2  a_2_3  a_3_1  a_3_2  a_3_3 ;
    
    cmd_mat =
    A=[ a_1_1  a_1_2  a_1_3 ; a_2_1  a_2_2  a_2_3 ; a_3_1  a_3_2  a_3_3 ;];
    

    Now execute the command strings:

    eval(cmd_var)
    eval(cmd_mat)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I'm trying to find a way to create a matrix in MatLab with
I am trying to create a matrix to look like this: [1 x x^2
When I create a matrix using Eigen, like this: Eigen::MatrixXd M(3,3); M<< 1.0, 4.0,
What is the best way to create the matrix C ? string A; char[]
I am trying to create a matrix that is 3 x n, with each
I have a need to basically create a matrix of values in my Silverlight
How to create the transformation matrix (4x4) that transforms a cylinder (of height 1
I am trying to create the below matrix in my vb.net so during processing
How can I create a const boost matrix? The following did not work: const
Using JavaScript, how do I create an HTML table that can "accept" numeric matrix

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.