Creating an arbitary symbolic matrix in Matlab

  • Thread starter Thread starter EbolaPox
  • Start date Start date
  • Tags Tags
    Matlab Matrix
Click For Summary
SUMMARY

The discussion focuses on creating an n by n symbolic matrix in MATLAB, where each element is named using the format aij, corresponding to its row and column indices. The user seeks guidance on how to dynamically generate these symbolic variable names within a loop structure. It is established that using nested loops is necessary to achieve this, and the user is encouraged to utilize the 'syms' function effectively to create symbolic variables with the desired naming convention.

PREREQUISITES
  • Familiarity with MATLAB syntax and functions
  • Understanding of symbolic mathematics in MATLAB
  • Basic programming concepts, including loops
  • Knowledge of variable naming conventions in programming
NEXT STEPS
  • Explore MATLAB's 'syms' function for creating symbolic variables
  • Learn about nested loops in MATLAB for matrix generation
  • Investigate MATLAB's symbolic toolbox for advanced symbolic computations
  • Review examples of dynamic variable naming in MATLAB
USEFUL FOR

Students, educators, and researchers in mathematics or engineering who are learning MATLAB and need to create symbolic matrices for computational purposes.

EbolaPox
Messages
99
Reaction score
1

Homework Statement


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!
 
Physics news on Phys.org
I'm not familiar with Matlab. But wouldn't this involve two nested loops, no matter what programming language is used?
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 4 ·
Replies
4
Views
4K
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K