MATLAB. Using Matlab, simulate 20 independent observations on X, where X~unif[-1,1], X be a standard Cauchy, and X is gamma distributed, respectively.
MATLAB code
close all
clear
clc
rng('default') % For Reproducibility
% Uniform Distribution
x_unif = random('Uniform',-1,1,1,20); % Interval [-1 1] and 1x20
=> 20 samples
disp('Uniform Distribution');
disp(x_unif);
% Gamma Distribution
x_gamma = random('Gamma',10,5,1,20); % Parameters a = 10 & b =
5
disp('Gamma Distribution');
disp(x_gamma);
% Standard Cauchy Distribution
x_cauchy = trnd(1,1,20);
disp('Standard Cauchy Distribution');
disp(x_cauchy);
output
Get Answers For Free
Most questions answered within 1 hours.