Useful Gibberish

Posts tagged ‘data’

Purify excel/gnumeric sheetdata

When extract data from a simulation, maybe sometimes we have too much data and we don’t really need all data point, so these questions may pop out:

  • How to make data less?

  • How to plot every 5 data point.

Let me explain, for example we have (x,y) data in column A and B, each column has 1000 data point and we want to plot/mahe chart for only 1st,5th,10th data point, so here is what we need to do:

  • In column C, input this function

    The function row() will return the number of the line that the cell belong to, so in A1, row A1 will return 1.
    The function mod() will return the modulus of, for in stance mod(5,2), 5 divide by 2, is 3.
    So the function mentioned above will return from top to bottom the sequence 0,1,2,3,4,0,1…..

Now create an auto filter of that data, and criteria should be the column C, if you want to plot only the line 2, choose it 2 for example.
That’s it. Pretty easy. I’ll find a way to plot in Matlab too.

Update: For matlab it very easy.
For example we have x and y as the arrays. And we want ot plot only every 5 pairs of the data set.
We do like this:


Adding point to Matlab plot

Here is the code to plot a data point to a 2D diagram.

plot(x,y) %plot the line
% a is a real number of the
% x-axis value of the data point
hold on

For example:

% Now add a data point with x=0.25
hold on;

Tag Cloud