mdup Posted January 18, 2017 Share Posted January 18, 2017 Hello, I want to find a maximum value during a period with a script on the scope. I have done that but the result is wrong: Scope1.single() Scope1.wait() Scope1.Time.Base.value = (1/freq) var data = Scope1.Channel1.data data.forEach(function(sample){ Vin_Max = Math.max(sample); }) print("Vin_Max: ",Vin_Max,"V") Do you have an idea? Thank in advance. Link to comment Share on other sites More sharing options...
attila Posted January 18, 2017 Share Posted January 18, 2017 Hello, How is the result wrong ? What result do you get for what data ? Did you initialize the variable ? like: var Vin_Max = -999 You could also use the builtin measurements like: var Vin_Max = Scope1.Channel1.measure("Maximum") Link to comment Share on other sites More sharing options...
mdup Posted January 18, 2017 Author Share Posted January 18, 2017 1 hour ago, attila said: Hello, How is the result wrong ? What result do you get for what data ? Did you initialize the variable ? like: var Vin_Max = -999 You could also use the builtin measurements like: var Vin_Max = Scope1.Channel1.measure("Maximum") Link to comment Share on other sites More sharing options...
mdup Posted January 18, 2017 Author Share Posted January 18, 2017 Hello, Thanks! Now is perfectly working with : var Vin_Max = Scope1.Channel1.measure("Maximum") Link to comment Share on other sites More sharing options...
Question
mdup
Hello,
I want to find a maximum value during a period with a script on the scope.
I have done that but the result is wrong:
Scope1.single()
Scope1.wait()
Scope1.Time.Base.value = (1/freq)
var data = Scope1.Channel1.data
data.forEach(function(sample){
Vin_Max = Math.max(sample);
})
print("Vin_Max: ",Vin_Max,"V")
Do you have an idea?
Thank in advance.
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.