Help needed in some qutions about normalize histogran functions(in Q3 bulding like "plot (X'Y)

2 visualizaciones (últimos 30 días)
Hello, I am very much starting in Matlab and got stuck with difficulties with questions 3 and 4 (attaching my solutions to the previous sections) Can anyone prepare me for question 3?
%% Question 1:
Yi_mean=2;
Yi_STD=1;
M=10000;
Yi=normrnd(Yi_mean,Yi_STD,1,M);
figure(1)
NUM_BINS=50;
h1=histogram(Yi,NUM_BINS);
xlabel('Y');
ylabel('Frequency');
%% Question 2:
hold on;
NUM_BINS=100;
h2=histogram(Yi,NUM_BINS);
hold off;
legend('Question 1','Question 2');
title('Histograms Q1,Q2: not normalized');

Respuestas (1)

Steven Lord
Steven Lord el 19 de Abr. de 2021
Read through the documentation page for the histogram function to see if it has any options and/or properties that will be of use in normalizing the histogram.
doc histogram
Spoiler alert: it does!

Categorías

Más información sobre Histograms en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by