Getting Started |
Working with Matrices
This section introduces you to other ways of creating matrices:
Generating Matrices
MATLAB provides four functions that generate basic matrices.
zeros |
All zeros |
ones |
All ones |
rand |
Uniformly distributed random elements |
randn
|
Normally distributed random elements |
Z = zeros(2,4) Z = 0 0 0 0 0 0 0 0 F = 5*ones(3,3) F = 5 5 5 5 5 5 5 5 5 N = fix(10*rand(1,10)) N = 4 9 4 4 8 5 2 6 8 0 R = randn(4,4) R = 1.0668 0.2944 -0.6918 -1.4410 0.0593 -1.3362 0.8580 0.5711 -0.0956 0.7143 1.2540 -0.3999 -0.8323 1.6236 -1.5937 0.6900
Examples of Expressions | The load Function |