MATLAB: Symbolic computation yes Could you tell me how to define a array containing more than hundred symbolic variable using loop or commands? Best Answer e.g. (R2011b):A = sym('A',[10 10])A1 = sym('A1_',[100 1])OR[x y] = meshgrid(1:10);for i1 = 1:numel(x) A2(y(i1),x(i1)) = sym(sprintf('A2_%d_%d',y(i1),x(i1)));endOR[x y] = meshgrid(1:10);k = arrayfun(@(i1)sym(sprintf('A3_%d_%d',y(i1),x(i1))),1:numel(x),'un',0);A3 = reshape([k{:}],10,[]); Related SolutionsMATLAB: Create symbolic expressions when using ndgrid [m, n] = size(M);temp = mat2cell(M, m, ones(1, n) );[X{1:n}] = ndgrid(temp{:});temp2 = cellfun(@(v) v(:), X, 'uniform', 0);result = horzcat(temp2{:}); MATLAB: Matlab (2010b) permute does not work for symbolic arrays http://www.mathworks.com/support/bugreports/659647 Related QuestionHow to combine two arraysFinding points of zero slope from 3D functionIndex exceeds the number of array elements (11)For loop
Best Answer