- refactored
This commit is contained in:
Executable
+32
@@ -0,0 +1,32 @@
|
||||
% ##################################################################################
|
||||
% ## Loesung: Gleichverteilter zeitdiskreter stochastischer Prozess ##
|
||||
% ##################################################################################
|
||||
N=10000;
|
||||
|
||||
% ##### Teilaufgabe a: Rauschfolge #####
|
||||
n = rand(N,1);
|
||||
|
||||
% ##### Teilaufgabe b: Histogramm #####
|
||||
n = rand(N,1);
|
||||
[H,x] = hist(n,30);
|
||||
H = H/N; % Damit H eine Schaetzung der Wahrscheinlichkeitsdichte
|
||||
% ist, muss die Flaeche eins sein
|
||||
|
||||
figure; bar(x,H);grid; xlabel('x'); ylabel('f_X(x)');
|
||||
title(['Gleichvert. Mittelw.=',num2str(mean(n)),' Var.=',num2str(std(n).^2)]);
|
||||
|
||||
% ##### Teilaufgabe c: Mittelwert und Varianz #####
|
||||
n = rand(N,1);
|
||||
m = mean(n);
|
||||
s = std(n);
|
||||
|
||||
% ##### Teilaufgabe d: Musterfunktion #####
|
||||
for k=1:5
|
||||
n = rand(N,1);
|
||||
[H,x]=hist(n,30);
|
||||
H = H/N;
|
||||
|
||||
figure; bar(x,H); grid; xlabel('x'); ylabel('f_X(x)');
|
||||
title(['Gleichvert. Mittelw.=',num2str(mean(n)),' Var.=',num2str(std(n).^2)]);
|
||||
end;
|
||||
% ##### EOF #####
|
||||
Reference in New Issue
Block a user