Posts

Showing posts with the label randn in matlab

MATLAB Tutorials Class3 : How to Generate random number in MATLAB

MATLAB Tutorials Class3: How to Generate a  random number in MATLAB Hai... We addressed the creation of an array and matrix in my previous post . We will see how to generate a random number in MATLAB here.  1. How to generate uniformly distributed random numbers in MATLAB? Syntax is                           rand_val_creation=rand() The uniformly distributed number 0 to 1 range is generated by the rand function. We can create a random matrix, just like the creation of zeros and one's matrix.  Case 1:if we give syntax like 'rand' means it creates 1 x 1 rand matrix range between 0 to 1. >> rand_no_creation=rand rand_no_creation =     0.8147 Case 2: If we mention a number, that number is considered to be a row and column count. >> rand_no_creation=rand(4) rand_no_creation =     0.9058    0.0975    0.9649    0.4854     0.1270...