Тёмный

Matlab Basics: Histograms 

CodingLikeMad
Подписаться 3,4 тыс.
Просмотров 51 тыс.
50% 1

In this video we go over making and plotting histograms, both with Matlab's new Histogram command and the older hist command. We look at customizing histograms, normalizing histograms and plotting figure with histograms.
Code for this tutorial can be found on our gitHub Repo:
github.com/codinglikemad/Matl...
Read more about histograms at the Matlab documentation:
www.mathworks.com/help/matlab...

Опубликовано:

 

29 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 15   
@yesitasnow
@yesitasnow 5 лет назад
Hello! Thanks for the video, I was looking for a way to obtain the values of the histogram and I just couldn't find them until I saw this video. Thanks! I needed the values to do other things. What I did was: 1. I created a random vector (just to see if the code worked) 2. I calculated the histogram and saved it in a variable "h" 3. I took the values with that command and saved them in another vector and now they are available for use Be careful with the capital V in values ;) prueba=rand(10000,1); h=histogram(prueba,256); h2=h.Values;
@andreeapetronelabalasca7212
@andreeapetronelabalasca7212 5 лет назад
Amazing explanation!!
@dellonerf3140
@dellonerf3140 4 года назад
Hello, great video it helped a lot. But i have one question, i currently count how many times a letter appears in a text and try to visualize the number they appear in a histogram. But how can i rename the x axis that each bar of the histogram is assigned to a letter?
@CodingLikeMad
@CodingLikeMad 4 года назад
Hi dello, I would suggest looking at the documentation for histogram: www.mathworks.com/help/matlab/ref/matlab.graphics.chart.primitive.histogram.html What you want to do is plot Categorical data. The right way to do this is shown in an example ("Plot Categorical Histogram"), where you provide the data as a categorical. In your case, each letter would be a different category. I think you can basically just convert the text corpus letter by letter to categorical and it will do the rest for you :)
@KayIgwe
@KayIgwe 5 лет назад
I get the following error when I use histogram(X, 'BinWidth', 7): Invalid or deleted object. here is an example running the same code you presented in the video: >> myHist.morebins(); Invalid or deleted object. Error in matlab.graphics.chart.primitive.Histogram/morebins What am I doing wrong? I am running this in Matlab 2017b
@CodingLikeMad
@CodingLikeMad 5 лет назад
The most common way to see this error is if you close the figure window which had the histogram in it. If you keep it open while you adjust the bin count it should just dynamically update the figure. Let me know if it still doesn't work, and thanks for asking :)
@KayIgwe
@KayIgwe 5 лет назад
@@CodingLikeMad Is there any way to then plot the log of the histogram? I read in various places that the only way to do this would be to use the hist function, but I saw that that function is being decommissioned. Nevermind, I got it... set(gca, 'Yscale', 'log')
@CodingLikeMad
@CodingLikeMad 5 лет назад
Correct, I was just about to reply! You can set it back with set(gca, 'Yscale', 'linear'), and also use the normal yticks and ylabels to make the spacing to be powers of 10.
@KayIgwe
@KayIgwe 5 лет назад
@@CodingLikeMad Hopefully this is the last question, but is there a way to save the log data? even after the graph has been closed, so that I can send the log transformed histogram, data, into a function?
@CodingLikeMad
@CodingLikeMad 5 лет назад
I don't know of a perfect way to do what you want, but it depends on exactly what you mean. So you can save the bin values (which will not be in log space), and then use a log10() on them to move them to log space if you want (or just save the values and do what you want with them). This won't save the histogram itself, but you can get the bin values and their positions which let you do most things you might want. Now it IS possible to save a histogram and restore it, but I don't think you want to do this. It took me some work to figure out, but if you save the FIGURE the histogram is plotted in, and then reload the figure, you can get the original histogram from the Children variable inside the figure. But this is really not the right way to do this. I'm pretty sure you can do everything you want from the bin values.
@banumathik.l375
@banumathik.l375 3 года назад
Hello good evening, Please let me know how to calculate standard deviation, arithmetic mean and variance of an image
@CodingLikeMad
@CodingLikeMad 3 года назад
Images are basically arrays, so you do it the same way you would any array. You just need to figure out how you want to deal with the 3 color channels.
@juandiegorodriguezavila8961
@juandiegorodriguezavila8961 2 года назад
whats r-x?
Далее
Matlab Tutorial: Introduction to Logical Indexing
3:24
3D Plotting in Matlab
34:58
Просмотров 236 тыс.
The last one surprised me! 👀 🎈
00:30
Просмотров 3 млн
Histograms In Matlab
8:35
Просмотров 313
Printing a Table using fprintf in Matlab
13:37
Просмотров 98 тыс.
Constructing a Histogram with MATLAB
4:18
Просмотров 1,6 тыс.
Working with Time Series Data in MATLAB
53:29
Просмотров 162 тыс.
Data Analysis with MATLAB for Excel Users
59:52
Просмотров 353 тыс.
Introduction to ggplot in R
1:17:25
Просмотров 151 тыс.
Signal Analysis using Matlab -  A Heart Rate example
18:04