How to store vectors with different size and how to access them. M(k) found_roots
F = @(t) cos(t)*exp(-t);A = @(s) arrayfun(@(s)-integral(F,-10,s),s);Z = @(t1,t2) -integral(A,t1,t2);interval = [-5, 5];N = 100;start_pts = linspace(interval(1),interval(2),N);found_roots = []; for k = 1:10 t2 = k; for i=1:numel(start_pts)-1 try found_roots(end+1) = fzero(@(t1)Z(t1,t2),[start_pts(i),start_pts(i+1)]); end % i
end M(k) = found_roots % vector of different length
kend
Best Answer