Generating a matrix

9 visualizzazioni (ultimi 30 giorni)
kash
kash il 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

Risposta accettata

Andrei Bobrov
Andrei Bobrov il 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);

Più risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by