Generating a matrix

9 views (last 30 days)
kash
kash on 13 Feb 2012
I want to generate a matrix as
first column must consist values of =.31,.33,.35,.37,.39..........
2nd column=.32,.34,.36,.38,.41.............
3rd column=.41,.43,.45,.47,.49,.51...............
4th column=.42,.44,.46,.48,50,,,,,,,,,,,
5th column=0.51,0.53,0.55,.57,.59,.61...........
6th column =0.52,0.54,0.56,.85,.60
with 100 rows and 6 columns,please help

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 13 Feb 2012
out = ...
bsxfun(@plus,reshape(bsxfun(@plus,.31:.1:.51,[0;.01]),1,[]),[0; .02*(1:99)']);
OR
out = reshape(permute(reshape(...
bsxfun(@plus,.31:.1:.51,[0;.01*(1:199)']).',3,2,[]),[3 2 1]),[],6);

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!