Grant Mathieson
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Gallery
Posts posted by Grant Mathieson
-
-
Thanks Attila, but I still have not got this working in Logging. The same error re-appeared. When I changed the Scope script to Scope1. etc., that stopped working. BTW I'm only using one scope at present.
Thanks for the tip on addressing measurements in short form. In Scope, I used Scope.measure("Phase") and it gives identical numbers to the long form script.
Any other advice?
-
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/PIVersion 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
Phase difference measurement in Logging on Analog Discovery 2
in Test and Measurement
Posted
Hi Attila,
Yes, I see that Scope and Scripting can do it, thank you. But I want to get it working in Logger. This is because I have signal changes that occur in the 10 ns to 100 ns timescale, but these occur in response to inputs that change over 0.1 s to 10 s. The Record mode in Scope seems limited by buffer size. Is it any better in Logger? I also want to log the difference between Ch1 and Ch2, and preferably calculate the AC RMS, Peak2Peak, rise/fall time of that difference in Logger. Those calculations are trivial in Scope. Any advice would be appreciated. I'll keep trying in the meantime. Thank you. Regards, Grant