![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/351425/image.jpeg)
Producing a distribution for categorical data
6 次查看(过去 30 天)
显示 更早的评论
Hi,
I am relatively new to MATLAB, and to this point have been following tutorials slowly and effectively although came unstuck today.
In the following video, at around 37:00
the presenter uses the data he is extracted to produce a distribution. However as I understand it, my matlab package does not allow for the use of the function 'mpgdistribution()'. I don't fully understand how this function has been formed. I am looking for an alternative way of producing the same plot. I am capable of producing a histogram for MPG, but am unable to separate the data into two different distributions based on their category, (City/Highway).
Using R, I would use GGPlot. However, after around an hour of googling, Ive found no alternative.
0 个评论
采纳的回答
Abdolkarim Mohammadi
2020-8-25
编辑:Abdolkarim Mohammadi
2020-8-25
You can find all of the files in the video at the end of the discription, including mpgdistribution(). It basically contains codes to fit the Normal distribution to the data and draw some figures. It contains functions like fitdist() for distribution fitting and pdf() for probability density function, which requires Statistics and Machine Learning toolbox. You couldn't find documentation for mpgdistribution() because it is not a standard MATLAB library.
https://www.mathworks.com/matlabcentral/fileexchange/64219-beyond-excel-enhancing-your-data-analysis-with-matlab-august-2017
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/351425/image.jpeg)
3 个评论
Abdolkarim Mohammadi
2020-8-25
Exactly. You should also notice that mpg in mpgdistribution() refers to Mile Per Gallon (MPG), which is one of the variables in that example, so it wouldn't be a general MATLAB function.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!