# Symbolic matrix with symbolic size

조회 수: 8(최근 30일)
BERKE CAN KIRAL 2020년 12월 23일
답변: Raunak Gupta 2020년 12월 28일
I am trying to define a symbolic matrix with symbolic indices
Normally, I know that a symbolic matrix A which has 2 rows and 4 columns is defined as :
A = sym('A', [2 4])
But I want to define it with m rows and n columns, when I use the following code, I have an error message: Error using sym (line 253) Second argument must be assumption or size vector:
syms m n
assume(m,'integer')
assumeAlso(m>=0)
assumeAlso(m<=M-1)
assume(n,'integer')
assumeAlso(n>=1)
assumeAlso(n<=2^(k-1))
A = sym('A', [m n])
So, how can I accomplish this?

댓글을 달려면 로그인하십시오.

### 채택된 답변

Raunak Gupta 2020년 12월 28일
Hi,
As mentioned in this question , Matrices with unknown size is not supported in MATLAB and thus the correct error message is displayed. You can try the workaround given in the answer by defining a large matrix and then cropping it based on the actual values of ‘m’ and ‘n’.

댓글을 달려면 로그인하십시오.

### 범주

Find more on Linear Algebra 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!

Translated by