Vibration

Distribution of rand function

25 Dec 2013

In Matlab, rand() generates a uniform distribution no matter how large the requested number is.

Sample Code

% 20131215
% test distribution of random number

clear all;
close all;
a = randi([0,100], 1000,1);
figure;
subplot(2,2,1);
plot(a);
b = sort(a);
subplot(2,2,2);
plot(b);
subplot(2,2,3);
hist(b);
subplot(2,2,4);
hist(b,50);

What’s next?

  • Suitable for Monte Carlo simulation/method
  • Generate large number of measurement withing a range of error to evaluate the next step