• 0
Sign in to follow this  
mdup

Analog Discovery 2 script for finding Maximum

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.

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

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")

Share this post


Link to post
Share on other sites
  • 0
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")

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this