plot hist in matlab

To plot a histogram in Matlab, you can use the histogram function. Here's an example:

main.m
% generate random data
data = randn(1000, 1);

% create histogram
histogram(data);

% add title and axis labels
title('Histogram of Random Data');
xlabel('Data');
ylabel('Count');
180 chars
11 lines

This will generate a histogram of the 1000 random data points and display it on the screen. You can customize the number of bins by specifying the NumBins argument, like histogram(data, 'NumBins', 50) for 50 bins.

related categories

gistlibby LogSnag