Jump to content
  • 0

Analog Discovery 2 script for finding Maximum


mdup

Question

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...