Problem with noisy gaussian function

Hello everyone ,
I'm student(from France). This is the problem : "Create a noisy gaussian function using the Matlab built-in function rand . You'll first check what rand is doing using help rand. The idea will be to create random-numbers having a mean value zero(i.e positive and negative numbers)."
I did for help rand . It's an array but I didn't understand how can i create this function . If you have clue or some advice . Thanks you very much .

 採用された回答

Dimitris Kalogiros
Dimitris Kalogiros 2018 年 9 月 16 日

1 投票

Bellow is an rough attempt of mine:
clearvars; clc; close all;
%%parameters
N=2^16; % rand() outputs
M=2^7; % number of rand that we will use
%%uniformly distributed random numbers
x1=rand(1,N)-0.5;
% probability density function
h1=histogram(x1);
h1.Normalization = 'probability';
title('uniform distribution')
%%combination of M rand() functions
x2=zeros(1,N);
for k=1:M
x2=x2+rand(1,N)-0.5;
end
%probability density function
h2=histogram(x2);
h2.Normalization = 'probability';
h2.FaceColor=[0 .5 0];
title('Normal distribution');
If you run this script, you will receive :

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

リリース

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by