1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    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

    Redbelly98

    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 Discussions: Creating an arbitary symbolic matrix in Matlab
Loading...