1. PF Contest - Win "Conquering the Physics GRE" book! Click Here to Enter
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Creating an arbitary symbolic matrix in Matlab

  1. Jul 3, 2009 #1
    1. The problem statement, all variables and given/known data
    Hi everyone, I'm new to using matlab and had a quick question. I'm trying to write a function such that my input into it is a number, say n, and it produces an n by n matrix with symbolic variables with names of the form aij , where i and j are numbers that refer to its row and column positions. This didn't seem like it would be too terribly tough, but I'm not sure how to make give my matrix these variable names of the form aij. I figured I could write a loop of some form that went from 0 to n and gave each an a1n or something of that form name, just to get at least one row, but I'm not too sure what syntax to use to give the symbolic variable its name. I was hoping I could write a loop with a variable i that ranged from 0 to n, and then do something like syms a'i' or something like that. I thought maybe if I turned the number i into a string, I could do something like that to make a bunch of symbolic variables, but I still had no luck. Any suggestions would be very appreciated. Thanks!
  2. jcsd
  3. Jul 5, 2009 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    I'm not familiar with Matlab. But wouldn't this involve two nested loops, no matter what programming language is used?
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Threads - Creating arbitary symbolic Date
Creating a 1Hz square pulse Jun 15, 2017
Array is printing out weird symbols Feb 28, 2017
Storing a string in a created obj type Feb 14, 2017
Creating Gears in Inventor Apr 8, 2016
Algorithm for creating unique groups of elements Jul 22, 2015