Difference between consecutive maxima and minima in a .csv dataset - excel

I have a dataset which represents tracking data of a mouse's paw moving up and down in the y-axis as it reaches up for and pulls down on a piece of string.
The output of the data is a list of y-coordinates corresponding to a fraction of a second. For example:
1 333.9929833
2 345.4504726
3 355.7046572
4 367.6136684
5 379.7906121
6 390.5470788
7 397.9017118
8 403.677123
9 412.1550843
10 416.516814
11 419.8205706
12 423.7994881
13 429.4874275
14 419.2652898
15 360.1626136
16 298.8212249
17 264.3647809
18 265.0078862
19 268.1828407
20 283.101321
21 294.8219163
22 308.4875135
In this series, there is a max value of 429... and a minimum of 264... - however, as you can see from an example image:
(excuse the gaps), there are multiple consecutive wave-like maxima and minima.
The goal is to find the difference between each maxima and consecutive minima, and each minima and consecutive maxima (i.e. max1-min1, min2-max1, max2-min2...). Ideally, this would also provide the timepoints of each max and min (e.g. 13 and 17 for the provided dataset) - there is a column with integer labels (1, 2, 3...) corresponding to each coordinate.
Thanks for your help!

Related

How to use Excel Solver for piecewise linear fit?

I am trying to use Excel Solver to get fits for a piecewise linear function (here, a three line fit). The Solver explanation here is helpful for a single linear case, but I am not sure how to set the model up "smartly" so that it re-calculates the hinge-points (i.e., x-values of line intersections will change with the input data). I've never used Solver before.
x y
1 0.1552
2 0.1877
3 0.2016
4 0.2094
5 0.2142
6 0.2176
7 0.2201
8 0.2220
9 0.2235
10 0.2247
11 0.2256
12 0.2265
13 0.2272
14 0.2278
15 0.2283
16 0.2288
17 0.2292
18 0.2296
19 0.2299
20 0.2302

How can I read this stem-leaf plot correctly?

Like the title, I used online an online data set for stem-leaf plot. But I don't know how to read it. For example, in the line of Stem 7. and Leaf .5555, why Frequency = 18? And what does the line Each leaf: 4 case(s) mean?
Every answer is very helpful to me.
Here is an example.
DATA LIST FREE /x1.
BEGIN DATA.
10 22 22 13 14 10 16 17 17 17
END DATA.
EXAMINE VARIABLES=x1 /PLOT STEMLEAF.
x1 Stem-and-Leaf Plot
Frequency Stem & Leaf
4.00 1 . 0034
4.00 1 . 6777
2.00 2 . 22
Stem width: 10.00
Each leaf: 1 case(s)
In these data, the "Stem" is the tens place of each value and the "Leaf" is the ones place. There are four cases in the first line, representing the values 10, 10, 13, and 14 in the data. That's why "Frequency" is 4; there are four cases. There are only 2 in the last one, for both values of 22 in the original data. As the data get larger, StemLeaf plots can get a little harder to read, but the other real value of them is their shape, which gives you an idea of the shape of the distribution. For another view of that shape, ask SPSS to produce a histogram.

Create a Histogram in Excel with three different level

Based on the picture that I have uploaded, how should I create it in Excel with three different level?
Thanks!
Grades Bins Frequency Intervals
9 9 0 0-9
6 19 2 10-19
1 29 1 20-29
7 39
5
5
2
4
6
2
10
11
15
18
20
21
23
25
26
27
29
To create a histogram in Excel you would use FREQUENCY
This is no diferent in using something such as the groups for colours.
The difference is that you would use an IF statement referring to the group column.
=FREQUENCY(IF(GroupRange="GroupName",DataRange),BinRange)
So if your data was in B2:B40 and your group delimiter in C2:C40 and your bin sizes was in E2:E12 you would use a formula such as:
=FREQUENCY(IF($C$2:$C$40="B",$B$2:$B$40),$E$2:$E$12)
Then pop each group next to each other changing the "B" (or whatever) as you go.
Hopefully this will get oyu on the right track.
(note: with FREQUENCY you must array enter into all cells in line with the bin range... [ctrl]+[shift]+[enter])

Percentage Greater than/Less than in a table

I have a table that I want to find the percentage greater than and percentage less than compared to a baseline, for the total group based on the weights of each group.
Here is my example table:
Benchmark GRP 1 GRP 2 GRP 3 GRP 4
10 10 11 10 12
14 12 15 11 15
17 11 17 13 16
18 14 15 14 17
Poulation 40 45 30 80
What I want to do is find out for each level of the benchmark what % of the total population of all four groups is above or below the bench mark value.
I have tried various sumproducts and sumifs but can't seem to get it work.
Let me know your thoughts!
Thanks as always!
Assuming your sample data is in A1:E7 put the following formula into B9 and use Ctrl+Shift+Enter to record it as an array formula:
=SUM(IF(B$2:B$5>$A$2:$A$5,1,0))/COUNTA($A$2:$A$5)
This can then be copied across under the other groups. Below is showing how it works for me.
Note: The array formula will display with braces ({...}) around it but you do not type these.

A problem with connected points and determining geometry figures based on points' location analysis

In school we have a really hard problem, and still no one from the students has solved it yet. Take a look at the picture below:
http://d.imagehost.org/0422/mreza.gif
That's a kind of a network of connected points, which doesn't end and each point has its own number representing it. Let say the numbers are like this: 1-23-456-78910-etc. etc.. (You can't see the number 5 or 8,9... on the picture but they are there and their position is obvious, the point in middle of 4 and 6 is 5 and so on).
1 is connected to 2 and 3, 2 is connected to 1,3,5 and 4 etc.
The numbers 1-2-3 indicate they represent a triangle on the picture, but the numbers 1-4-6 do not because 4 is not directly connected with 6.
Let's look at 2-3-4-5, that's a parallelogram (you know why), but 4-6-7-9 is NOT a parallelogram because the in this problem there's a rule which says all the sides must be equal for all the figures - triangles and parallelograms.
Also there are hexagons, for ex. 4-5-7-9-13-12 is a hexagon - all sides must be equal here too.
12345 - that doesn't represent anything, so we ignore it.
I think i explained the problem well. The actual problem which is given to us by using an input of numbers like above to determine if that's a triangle/parallelogram/hexagon(according to the described rules).
For ex:
1 2 3 - triangle
11 13 24 26 -parallelogram
1 2 3 4 5 - nothing
11 23 13 25 - nothing
3 2 5 - triangle
I was reading computational geometry in order to solve this, but i gave up quickly, nothing seems to help here. One friend told me this site so i decided to give it a try.
If you have any ideas about how to solve this, please reply, you can use pseudo code or c++ whatever. Thank you very much.
Let's order the points like this:
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28
You can store this in a matrix. Now let row[i] = the row number i is on and col[i] = the column number i is on. These can be computed more or less efficiently for each i.
First, sort your given numbers ascendingly. You will need exactly 3 points for a triangle, 4 for a parallelogram and 6 for a hexagon - anything else and you can dismiss it as no-figure.
Notice that we can only have right-angled triangles in this matrix, according to your rules. Label the three points A, B, C. You can check if these form a triangle by iterating from row[A] to row[B], then from col[B] to col[C] and then diagonally from row[C] to row[A] and checking to see if the distances are the same and if you get to the right positions. You can terminate this early, for example if B is 8 and A is 1, then you can tell you won't find it once you hit 11 on column 1.
For parallelograms a similar reasoning can be made. Label the 4 points A, B, C, D and remember to sort them ascendingly (remember, your points here are actually numbers). See if you can get from col[A] to col[B] on the same line, then from col[C] to col[D] on the same line and then diagonally or vertically-down from row[A] to row[C] and then (in the same direction you went the previous diagonal!) from row[B] to row[D].
Hexagons are also have a specific format you must test for. Here's how hexagons look like in this representation:
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35 36
You can notice that every two pairs of points share the same column, and that the horizontal distance between the two middle points is twice the vertical distance between any two points and also twice the horizontal distance between any other two points.
You will also want to consider rotations, so you'll need to do more tests for each case.
You don't even really need the row and col arrays unless you plan on computing them efficiently. Just walk over your matrix until you identify the first point in sorted order and try to get to the others while following each of the rules.
Not exactly a nice way, but you will only need a 256x256 matrix for this, so while this does result in quite a lot of code, it's pretty efficient. I hope I made myself clear, if not please say what isn't clear. Anyway, maybe someone else will post a better solution, so wait a while longer if you can..

Resources