Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE WRITE MATLAB PROGRAM Create a function called histogram that returns an array containing the histogram of a data set that is passed to the
PLEASE WRITE MATLAB PROGRAM
Create a function called histogram that returns an array containing the histogram of a data set that is passed to the function. Write the algorithm yourself: do NOT use the MATLAB function hist * Your function should accept four parameters: max, min, Nbins and the input data vector. o max: upper edge value of the largest bin (note: this value is independent of the actual maximum value of your data); min: lower edge value of the smallest bin (note: this value is independent of the actual minimum value of your data); Nbins: the number of data bins to display. Given these parameters, set o o max- min AbinNbins o the input data vector. Your function should return the histogram vector of length Nbins In the event your input data falls outside of the available range, increment the nearest edge bin. For example, assume that you have specified a max of 10 but vou encounter a value of 11-vou are then to increment the bin that has 10 as the upper edge value, * You should normalize your histogram result such that the total "area" under your histogram is one (like a PDF). Hint: what normalization factor would you choose if all of your data belonged to a single bin (i.e., divide by the area of the bin, which would be the height or number of input points times the width of the bin)? Your function should include error checkingStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started