how to create a variable matrix

5 views (last 30 days)
UJWALA DONGARE
UJWALA DONGARE on 15 Apr 2020
Answered: Sameer on 4 Jun 2025
I want to create a 4x3 matrix with two variables and cosine function

Answers (1)

Sameer
Sameer on 4 Jun 2025
To create a symbolic matrix with variables and functions like cosine, use the Symbolic Math Toolbox. Symbolic variables can be defined using the "syms" function, and then assembled into a matrix as needed.
For example, to create a 4x3 matrix with symbolic variables "x" and "y", and expressions involving cosine:
syms x y
A = [x, y, cos(x);
cos(y), x + y, x*y;
x^2, y^2, cos(x + y);
cos(x*y), x - y, cos(x - y)]
A = 
This creates a 4-by-3 symbolic matrix containing a mix of variables and cosine expressions.
For more details please refer to the following MathWorks documentation:
Hope this helps!

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!