[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
deleting duplicities, diag, equidistant data
From: |
Jiri Pachman |
Subject: |
deleting duplicities, diag, equidistant data |
Date: |
Mon, 28 Feb 2005 09:03:19 +0100 |
User-agent: |
Opera M2/7.51 (Win32, build 3798) |
thanks to all for answers to my previous questions
Hi everybody,
I have this simple problem. During data manipulation I create two
(sometimes 3) columns of data. First contains x values the others are y,
y2 values. It sometimes happens that I get two values of y are for the
same value of x (around 5 couples in matrix of 200 lines). This makes
problems in further calculations. I tried gnuplot´s smoothing (smooth
spline) function and it works well, taking the duplicate values and making
y average for particular x. Unfortunately I do not know, how to extract
this data in numeric format from gnuplot. I was looking for something
similar in octave, but without luck. Is there something like this in
octave?
For now I am using the following script that finds the duplicate values
and deletes them, but I would prefer to average them. I also tried to work
with diagonal using matlabs diag function, but it seems to work quite
differently (that is why I use rather complicated way to change 1 on the
diagonal to 0).
x = G12;
vel = rows(x);
indexy = zeros(vel);
for i = 1:vel
ind = x(:,1) == x(i,1);
indexy(:,i) = ind;
diamat(i,i) = 1;
endfor
#% -------- indexes of duplicate values -------------
err = (indexy - diamat);
max(err)
#%--------------------- adding err columns creating index ---------
ind = err(:,1);
for k=1:vel-1
ind = ind + err(:,k+1);
G12_nove = x(~ind, :);
endfor
I am also interested, if there is some elegant way how to create
equidistant data from nonequidistant data. I use polynomial fit and then I
calculate the new values in linspace or logspace depending on the need.
thanks for help
Jiri
--
***************************************************
Ing. Jiri Pachman
Katedra teorie a technologie vybusnin
Univerzita Pardubice
Studentska 95
532 10 Pardubice
tel.: +420-46-603-8018
fax.: +420-46-603-8024
***************************************************
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- deleting duplicities, diag, equidistant data,
Jiri Pachman <=