Creating Histogram & PDF for Data Sample

In summary, Yaseen needs to change the code in the attached file to reproduce the graph in the attachment.
  • #1
mmmd_yaseen
3
0
Hi All,

I just need your small help in Matlab programming of histogram and PDF

Task to create and reproduce histogram and Probability distribution function for a given data sample (Inter packet arrival times).please see the attachment for the data (TV_80_port_testing.dat) and appropriate graph (Port80_IPTV.jpg) . Say I have 50000 entries in a DAT file with three columns of data 1.port no 2 and 3 are inter packet times of a subsequent packet.I have to plot and analyse the data using the statistical methodology. I need your help in inputting my value inside the code.

I have to reproduce the same plot as in the attachment(Port80_IPTV.jpg). Below are the code I have just written.

load TV.dat
x=TV(:,2);
[a,b] =hist(x,-2:30);
plot(b,a/3/sum(a),'LineWidth',1.5);[/COLOR][/FONT]

Please see the attachment of "myplot" of the above code.
Note: I couldn't attach my .DAT file here.Please let me know if you need it . I'll send it through email.

I am not sure of how to specify the number of bins and range for the attached data and its graph.
Please help me in reproducing the graph which are at-least should be closest resemblance in the attachment (Port80_IPTV) for the PDF.Once I know what iam doing and get a full confidence ,I will proceed further with my other cases and it's all about in how to start with it and i struggling in it.

Regards
Yaseen
 

Attachments

  • myplot.jpg
    myplot.jpg
    12.1 KB · Views: 495
  • Port80_IPTV.jpg
    Port80_IPTV.jpg
    15.3 KB · Views: 455
Physics news on Phys.org
  • #2
Hi Yaseen, To reproduce the graph that is in the attachment, you need to change the range and number of bins in the code. To do this, you could specify the range and number of bins as parameters in the hist function. For example, if you wanted to have a range of 0-100 and 10 bins, you could modify the code as follows: load TV.datx=TV(:,2);[a,b] = hist(x,0:10:100);plot(b,a/3/sum(a),'LineWidth',1.5);This will create a histogram with 10 bins, ranging from 0 to 100. I hope this helps!
 

1. What is a histogram?

A histogram is a graphical representation of the distribution of data, where the data is divided into intervals and the height of each bar represents the frequency or count of data falling within that interval.

2. What is the purpose of creating a histogram?

The purpose of creating a histogram is to visualize the distribution of data and identify patterns or trends that may not be evident from a simple list of numbers. It can also help in identifying outliers or unusual values in the data.

3. How do I create a histogram for my data sample?

To create a histogram, you first need to determine the number of intervals (or bins) you want to divide your data into. Then, you plot the intervals on the x-axis and the frequency or count of data falling within each interval on the y-axis. You can use software such as Microsoft Excel or R to create a histogram automatically, or you can manually draw one using a graphing tool.

4. What is a probability density function (PDF)?

A probability density function (PDF) is a mathematical function that describes the probability of a continuous random variable taking on a certain value. In the context of a histogram, the PDF is represented by the shape of the bars and can provide insights into the underlying distribution of the data.

5. How is a PDF different from a histogram?

A histogram is a visual representation of data, whereas a PDF is a mathematical function. The histogram shows the frequency or count of data falling within each interval, while the PDF shows the relative likelihood of a value occurring within a given interval. Additionally, a histogram can only be created for discrete data, while a PDF can be created for both discrete and continuous data.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
2K
  • Programming and Computer Science
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
Back
Top