Message Boards Message Boards

0
|
3804 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:
GROUPS:

Table doesn't work as it should

Posted 9 years ago

I have a really embarrassing problem here. I have plotted a ChiSquaredDistribution like

Plot[Evaluate@PDF[ChiSquareDistribution[4], x*(15/100)], {x, 0, 100}, PlotStyle -> Orange, Filling -> Axis]

and than I wanted to evaluate the distribution at certain values from the table I named data

hecer = Table[
   With[{i = i}, 
    Evaluate@
     PDF[ChiSquareDistribution[4], data[[i, 1]]*(15/100)]], {i, 1, 
    Length[data[[All, 1]]], 1}];

However, this (surprisingly) doesn't work as planned. If one ListPlots that last table, you will see that the x axis goes from 0 to 1000, while it should only go from 0 to 100 as in the first Plot.

My question is why and how can I correct it. I attached the file where my data[[All,1]] is exported, so you can see that the values do NOT exceed 100. Strange. O.o I don't get it.

Attachments:
POSTED BY: Mitja Jan?i?
2 Replies

If you give a list of numbers to ListPlot, it will put the first one at x=1, the second one at x=2, etc. If there are 1000 points the last x will be 1000.

Perhaps you want to give ListPlot a list of pairs of numbers. In that case the x values will be taken from the first elements of the pairs.

POSTED BY: Gianluca Gorni

That was even more embarrassing that I thought it was going to be. -.-

Thank you!

POSTED BY: Mitja Jan?i?
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract