distr( 4 );
distr( 4 )
ans =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
distr( 4, 5 )
ans =
Columns 1 through 4
0.8147 0.6324 0.9575 0.9572
0.9058 0.0975 0.9649 0.4854
0.1270 0.2785 0.1576 0.8003
0.9134 0.5469 0.9706 0.1419
Column 5
0.4218
0.9157
0.7922
0.9595
distr( [ 1 2 3; 1 2 3; 1 2 3 ] )
ans =
0.6557 0.9340 0.7431
0.0357 0.6787 0.3922
0.8491 0.7577 0.6555
[A,nor] = distr( [ 1 2 3; 1 2 3; 1 2 3 ] )
A =
0.1712 0.2769 0.8235
0.7060 0.0462 0.6948
0.0318 0.0971 0.3171
nor =
6.4807
A
A =
0.1712 0.2769 0.8235
0.7060 0.0462 0.6948
0.0318 0.0971 0.3171
nor
nor =
6.4807
[A,nor] = distr( [ 1 2 3; 1 2 3; 1 2 3 ] )
Error in ==> distr at 3
[p,q] = size(A);
{??? Output argument "M" (and maybe others)
not assigned during call to
"/Users/pauldj/Documents/MATLAB/distr.m>distr".}
[A,nor] = distr( [ 1 2 3; 1 2 3; 1 2 3 ] )
Error in ==> distr at 3
[p,q] = size(A);
{??? Output argument "M" (and maybe others)
not assigned during call to
"/Users/pauldj/Documents/MATLAB/distr.m>distr".}
[A,nor] = distr( [ 1 2 3; 1 2 3; 1 2 3 ] )
A =
0.9597 0.2238 0.5060
0.3404 0.7513 0.6991
0.5853 0.2551 0.8909
nor =
6.4807
[A,nor] = distr( [ 1 2 3; 1 2 3; 1 2 3 ] )
A =
0.9293 0.2511 0.3517
0.3500 0.6160 0.8308
0.1966 0.4733 0.5853
nor =
1.4320
[A,nor] = distr( [ 1 2 3; 1 2 3; 1 2 3 ] )
A =
0.5497 0.7572 0.5678
0.9172 0.7537 0.0759
0.2858 0.3804 0.0540
nor =
6.4807
[A,nor] = distr( [ 1 2 3; 1 2 3; 1 2 3 ] )
A =
1 1 1
2 2 2
3 3 3
A =
0.5308 0.1299 0.0119
0.7792 0.5688 0.3371
0.9340 0.4694 0.1622
nor =
6.4807
[A,nor] = distr( [ 1 2 3; 1 2 3; 1 2 3 ] );
A =
1 1 1
2 2 2
3 3 3
[A,nor] = distr( [ 1 2 3; 1 2 3; 1 2 3 ] )
A =
0.4505 0.9133 0.5383
0.0838 0.1524 0.9961
0.2290 0.8258 0.0782
nor =
6.4807
[A,nor] = distr( [ 1 2 3; 1 2 3; 1 2 3 ] )
Error in ==> distr at 3
[p,q] = size(A);
{??? Output argument "M" (and maybe others)
not assigned during call to
"/Users/pauldj/Documents/MATLAB/distr.m>distr".}
[A,nor] = distr( [ 1 2 3; 1 2 3; 1 2 3 ] )
Error in ==> distr at 3
[p,q] = size(A);
{??? Output argument "out" (and maybe others)
not assigned during call to
"/Users/pauldj/Documents/MATLAB/distr.m>distr".}
A = distr( [ 1 2 3; 1 2 3; 1 2 3 ] )
A =
6.4807
A = distr( [ 1 2 3; 1 2 3; 1 2 3 ] )
Error in ==> distr at 3
[p,q] = size(A);
{??? Output argument "M" (and maybe others)
not assigned during call to
"/Users/pauldj/Documents/MATLAB/distr.m>distr".}
help if
IF Conditionally execute statements.
The general form of the IF statement is
IF expression
statements
ELSEIF expression
statements
ELSE
statements
END
The statements are executed if the real part of the expression
has all non-zero elements. The ELSE and ELSEIF parts are optional.
Zero or more ELSEIF parts can be used as well as nested IF's.
The expression is usually of the form expr rop expr where
rop is ==, <, >, <=, >=, or ~=.
Example
if I == J
A(I,J) = 2;
elseif abs(I-J) == 1
A(I,J) = -1;
else
A(I,J) = 0;
end
See also relop, else, elseif, end, for, while, switch.
Reference page in Help browser
doc if
help for
FOR Repeat statements a specific number of times.
The general form of a FOR statement is:
FOR variable = expr, statement, ..., statement END
The columns of the expression are stored one at a time in
the variable and then the following statements, up to the
END, are executed. The expression is often of the form X:Y,
in which case its columns are simply scalars. Some examples
(assume N has already been assigned a value).
for R = 1:N
for C = 1:N
A(R,C) = 1/(R+C-1);
end
end
Step S with increments of -0.1
for S = 1.0: -0.1: 0.0, do_some_task(S), end
Set E to the unit N-vectors
for E = eye(N), do_some_task(E), end
Long loops are more memory efficient when the colon expression appears
in the FOR statement since the index vector is never created.
The BREAK statement can be used to terminate the loop prematurely.
See also parfor, if, while, switch, break, continue, end, colon.
Reference page in Help browser
doc for
doc for
Overloaded functions or methods (ones with the same name in other directories)
doc distcomp/for
diary