The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Finding average distance between the datapoints
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

newmanderland

8 Posts

Posted - 12/28/2011 :  4:16:19 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver 8.6. Operating System: Windows 7.

Hello,
I am trying the new Origin version (for the first time) for the following task: I need to write a script to calculate the histogram of the frequencies of distances between the data points in my column. Say, I have in my column the values 3,5,7,9 and I need a histogram of distances from each X point to each of the neighboring points, which in this case will be as follows:
X=0, Y=0;
X=1, Y=0;
X=2, Y=3;
X=4, Y=2;
X=6, Y=1;
(The histogram shows the frequency, or the number of occurencies for each distance). I am thinking, whether such a standard task is already realized as a function in Origin?
Thanks!

couturier

France
291 Posts

Posted - 12/29/2011 :  07:41:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Don't know if I understand well what you need to do, but there's a distance function that returns the distance bewtween 2 points.

If you want to get the distance between the neighboring points, you can add a third column and set column value like this:

distance(Col(A)[i],Col(B)[i],Col(A)[i+1],Col(B)[i+1])

Hope it helps
Go to Top of Page

newmanderland

8 Posts

Posted - 12/29/2011 :  09:48:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
couturier,

That's great, I was looking for such a distance function.
But I still need to get the distance from a given point to all the other points, not just to the neighboring point. Is there an easy way to do this?

I actually need to plot the histogram of all distances.
Go to Top of Page

couturier

France
291 Posts

Posted - 12/30/2011 :  11:23:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
the syntax for the distance function is
distance(x1,y1,x2,y2)

If you want the distance from a given point (say 3rd point) to the others, you can make the additionnal column value like this:

distance(Col(A)[3],Col(B)[3],Col(A)[i],Col(B)[i])
Go to Top of Page

pazliberty

USA
4 Posts

Posted - 01/09/2012 :  5:47:12 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This is a known bug in Origin 8.0 SR6, which we aren't going to fix. Sorry for that.

In your case, if you only want show a specified range of the curve and know the X/Y range exactly, how about fixing the X/Y range in Axis dialog?
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000