I have a vector A of 30 elements. Each of those elements could be one of three values (1, 2 or 3). There are therefore there are 30^3=27000 possible vectors A. How could I create a matrix [30 x 27000] where each colum in that matrix is a unique A?
ANSWER
Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.
If you don't have the Deep Learning toolbox, [c{1:30}]=ndgrid(1:3);
allAs=cat(31,c{:});
allAs=reshape(allAs, [],30).';
Otherwise, you can use combvec,
c(1:30)={1:3};
allAs=combvec(c{:});
Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.
[c{1:30}]=ndgrid(1:3); allAs=cat(31,c{:}); allAs=reshape(allAs, [],30).';
Otherwise, you can use combvec,
c(1:30)={1:3}; allAs=combvec(c{:});
Comments
Post a Comment