How to Preallocate memory in Large Symbolic Matrix manipulation in MATLAB.
For eg: In code given below size of variable "Toc" and "Tnw" increase in each iteration. I have tried preallocation by Toc = zeros(0,50)
but there is error "error occurred converting from sym to double". So what is symbolic version of syntax for Preallocation?
syms c z
Tnw = 1;
for i = 1:9
Toc(c, z) = [(1-c)*z c-c*z ; -c+c*z (1+c)*z];
f = collect(Toc(c,z));
Tnw = Tnw*f;
end
So what is best practice used for Preallocation in large symbolic manipulation?
Thanks in advance