Problem with noisy gaussian function
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Lucas Alonso
am 15 Sep. 2018
Beantwortet: Dimitris Kalogiros
am 16 Sep. 2018
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 .
0 Kommentare
Akzeptierte Antwort
Dimitris Kalogiros
am 16 Sep. 2018
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 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!