Jump to content

danaur

Members
  • Posts

    6
  • Joined

  • Last visited

danaur's Achievements

Newbie

Newbie (1/4)

1

Reputation

  1. Ah, yes, thanks - without "_" in the variable name the auto complete is recognized. The "Acq" value from the Measurements table is called "count".
  2. Hi @attila, I know that I can operate measurements on channels. I am using the results from the Measurements tab directly. This is a releatively new feature and has the possibillity of scripted values. In this example I calculate the current over a shunt. I need to access the Mean, Median, Acq, etc. of the calculated value i_max. This works for every value but Acq. And the auto-complete does not work on the Measurements object attributes.
  3. Hi, I try to access ths acq value from the Scope measurements tab in some script within the build-in scripting editor. Auto-complete seems not to work for this feature. And apparently it is not "acq". I am using the most ecent beta 3.20.10. Please educate me. Thank you.
  4. Thanks @attila print(u_max.reduce(function(total, num){return total + num;}) / u_max.length; does work like a charm. I want to calculate the standard deviation and just for the completeness is there a cleaner way than doing a loop? What works: // calculation standard deviation var SDprep = 0; for(var key in u_max) SDprep += Math.pow((parseFloat(u_max[key]) - u_max_mean),2); const u_max_dev = Math.sqrt(SDprep/(u_max.length-1)); This throws a parse exception: u_max_dev = Math.sqrt(u_max.map(function(x){return Math.pow(x - u_max_mean, 2);}).reduce(function(total, num){return (total + num)/u_max.length;}) I wonder if array.map is the issue here. It's propably a stupid mistake again. Edit: I know about the inbuild measurement functions. Quite useful. I couldn't figure out how to access the Scope.Measurements.Frequency Mean value in a script and how to reset the measurements from script.
  5. Hi, I'm trying to calculate the deviation from an array. Something like var u_max = [] for(var idx = 0; wait(1) && idx < samples; idx++){ const frequ = Scope.Channel1.measure("Frequency"); u_max[idx] = Scope.Channel1.measure("Maximum"); Scope.wait(); } const u_max_mean = u_max.reduce((a, b) => a + b, 0) / u_max.length; But I get a parse exception Uncaught exception at <anonymous script, id=1898586689712>:48: SyntaxError: Parse error 48 const u_max_mean = u_max.reduce((a, b) => a + b, 0) / u_max.length; Is array.reduce not available in the WaveForms inbuild scripting engine?
  6. Hi, I've started to use my Analog Discovery 2 and WaveForms more extensively lately. I want to do some characterization of magnetic ring cores. Worked on a workbench for B-H diagram measurement. I am using custom math channels and global measurement scripts directly from the scope view. The workbench does make the beta and least stable crash (Window closes without any warning). I have attached the corrupt file. I am faceing this situation the second time. Some notes: I am sure I used the custom math channels wrongly by using a return statement at the last line. Have not figured out how to use calculated measurement values in another measurement script. Scope.Measurements.<name> does not seem to work. Any suggestions on how to avoid this and how to extract measurement and channel math scripts from the corrupt file? Thanks B-H.dwf3work
×
×
  • Create New...