ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

calculating offset

Hallo,

how can I calculate the offset of two functions?

(Details: I have two 1D-arrays Y[1,...,N] and Z[1,...,N] with the N values of the two functions. I want to substract them from each other in a way that a part of the function is eliminated. My idea is the following:

sub[1,...,N]=0
for k=1 to N
for i=k to k+m (only the part [1,...,m] of Y is interesting to me and the offset i of Z)
if i<=N then sub[i]=Y[k]-Z[i] else sub[i]=0
next i
next k

I save each substration-array and select the one with the lowest sum. That index j should be the required offset.)

Note that my idea isn't programmed in LabVIEW yet, perhaps one of you has a better idea.

Arno

PS: If you attach a VI: I use LabVIEW 6.1, so please it in a way I can read it.
0 Kudos
Message 1 of 5
(3,401 Views)
Hi,
iam sorry i coud not understand what you wanted ,are you looking for a VI which takes in 2 1D arrays and subtracts one another with a given offset.
plz explain it.
0 Kudos
Message 2 of 5
(3,401 Views)
Hallo,

sorry for writing to complicated. Details:

I have two 1D-arrays. I want to substract one from the other. That's easy, if they don't have an offset. How can I calculate an existing one? As soon I have it, my problem is solved:

use the offset (x[i] -> x[i+offset]) and substract (y[i]-x[i+offset])

Example: First array: 1000 values of the sin x-function. Second array: 1000 values of the sin(x+1)-function. How can I calculate the "1"? Note: My function is NOT sin, and I do not know an analytic formula for it.

Perhaps now I am clearer.

Arno
0 Kudos
Message 3 of 5
(3,401 Views)
You have to compute the cross-correlation of the two vectors and the maximum will be you offset
Doc-Doc
http://www.machinevision.ch
http://visionindustrielle.ch
Please take time to rate this answer
0 Kudos
Message 4 of 5
(3,401 Views)
You have to compute the cross-correlation of the two vectors and the maximum will be you offset
Doc-Doc
http://www.machinevision.ch
http://visionindustrielle.ch
Please take time to rate this answer
0 Kudos
Message 5 of 5
(3,401 Views)