Any advice on how to get a phase measurement (between Ch1 and Ch2) included in Logging?
Digilent offer the following code, which works fine for me on Scope, but not (so far) Logging. I get the error, "Uncaught exception at <anonymous script, id=2091515652512>:6: ReferenceError: Can't find variable: Scope"
Thanks in advance.
Version from Digilent
// initialize local variables
var sum1 = 0
var sum2 = 0
var sum12 = 0
// for better performance get and use local copy of data array
var d1 = Scope.Channel1.data
var d2 = Scope.Channel2.data
var c = d1.length
for(var i = 0; i < c; i++){
sum1 += d1*d1
sum2 += d2*d2
sum12 += d1*d2
}
sum1 /= c
sum2 /= c
sum12 /= c
// last line of code is the measurement value
acos(sum12/sqrt(sum1*sum2))*180/PI
Version I use on Scope but does not work on Logging
Question
Grant Mathieson
Any advice on how to get a phase measurement (between Ch1 and Ch2) included in Logging?
Digilent offer the following code, which works fine for me on Scope, but not (so far) Logging. I get the error, "Uncaught exception at <anonymous script, id=2091515652512>:6: ReferenceError: Can't find variable: Scope"
Thanks in advance.
Version from Digilent
// initialize local variables
var sum1 = 0
var sum2 = 0
var sum12 = 0
// for better performance get and use local copy of data array
var d1 = Scope.Channel1.data
var d2 = Scope.Channel2.data
var c = d1.length
for(var i = 0; i < c; i++){
sum1 += d1*d1
sum2 += d2*d2
sum12 += d1*d2
}
sum1 /= c
sum2 /= c
sum12 /= c
// last line of code is the measurement value
acos(sum12/sqrt(sum1*sum2))*180/PI
Version I use on Scope but does not work on Logging
var sum1 = 0
var sum2 = 0
var sum12 = 0
var d1 = Scope.Channel1.data
var d2 = Scope.Channel2.data
for(var i = 0; i < d1.length; i++){
sum1 += d1*d1
sum2 += d2*d2
sum12 += d1*d2
}
sum1 /= d1.length
sum2 /= d1.length
sum12 /= d1.length
acos(sum12/sqrt(sum1*sum2))*180/PI
Link to comment
Share on other sites
10 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now