x = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 ];
y = cell(1, 4);
for k = 1:4
y{k} = x(1-k:end) - x(1:end-k);
end
Prefer a cell array instead of hiding indices in the names of variables.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!