From help-request at octave dot org Mon Feb 28 08:24:53 2005 Subject: RE: deleting duplicities, diag, equidistant data From: "Hall, Benjamin" To: "'Jiri Pachman'" , octave list Date: Mon, 28 Feb 2005 09:23:45 -0500 Have you tried interp1 for creating equidistant samples from = non-equidistant ones? -----Original Message----- From: Jiri Pachman [mailto:jiri dot pachman at upce dot cz] Sent: Monday, February 28, 2005 3:03 AM To: octave list Subject: deleting duplicities, diag, equidistant data thanks to all for answers to my previous questions Hi everybody, I have this simple problem. During data manipulation I create two =20 (sometimes 3) columns of data. First contains x values the others are = y, =20 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 =20 problems in further calculations. I tried gnuplot=B4s smoothing (smooth = =20 spline) function and it works well, taking the duplicate values and = making =20 y average for particular x. Unfortunately I do not know, how to extract = =20 this data in numeric format from gnuplot. I was looking for something =20 similar in octave, but without luck. Is there something like this in =20 octave? For now I am using the following script that finds the duplicate values = =20 and deletes them, but I would prefer to average them. I also tried to = work =20 with diagonal using matlabs diag function, but it seems to work quite =20 differently (that is why I use rather complicated way to change 1 on = the =20 diagonal to 0). x =3D G12; vel =3D rows(x); indexy =3D zeros(vel); for i =3D 1:vel ind =3D x(:,1) =3D=3D x(i,1); indexy(:,i) =3D ind; diamat(i,i) =3D 1; endfor #% -------- indexes of duplicate values ------------- err =3D (indexy - diamat); max(err) #%--------------------- adding err columns creating index --------- ind =3D err(:,1); for k=3D1:vel-1 ind =3D ind + err(:,k+1); G12_nove =3D x(~ind, :); endfor I am also interested, if there is some elegant way how to create =20 equidistant data from nonequidistant data. I use polynomial fit and = then I =20 calculate the new values in linspace or logspace depending on the need. thanks for help Jiri --=20 *************************************************** 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 ------------------------------------------------------------- ------------------------------------------------------------- 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 -------------------------------------------------------------