How can i define a m by n symbolic matrix?
2 views (last 30 days)
I know how to for example define a 3 by 4 symbolic matrix with this:
but I don't know how to define this:
(m and n aren't variables,i just want to get something like
a11 a12 ... a1n
. . .
. . .
am1 am2 ... amn
John D'Errico on 19 Nov 2021
Edited: John D'Errico on 19 Nov 2021
If m and n are themselves symbolic, you cannot do so. However, you can do this:
matfun = @(m,n) sym('a',[m,n]);
Now you can use it to create a matrix of any desired size. Thus
But you cannot create something of indeterminate size or dimensions.
Could you write your own class of objects, that do as you wish? Well, yes. I suppose you could. I'm not sure what value it would offer, but you would need to write the code to do so yourself. And as well, you would then need to write code to manipiulate those objects, as MATLAB will not automatically know how to multiply such objects without your explicit direction.