You are here: Symbol Reference > SignalUtils Namespace > Functions > SignalUtils.EnvelopeDetector Function
DSP Master VCL
ContentsIndex
Example

A simple test of the function: 

 

  uses MtxExpr, Math387, MtxVec, SignalUtils, MtxVecTee, MtxVecEdit;

  procedure TForm1.Button1Click(Sender: TObject);
  var b,c,Response,x: Vector;
      FS: double;
  begin
      FS := 2;

      b := Sin(Ramp(3000, mvDouble, 0,2*Pi*0.02/FS))*Sin(Ramp(3000, mvDouble, 0,2*Pi*0.2/FS));
      EnvelopeDetector(b,c,10); //reduce sampling frequency by 10x

      FrequencyResponse(b,nil,Response,8,true,wtHanning);
      x := Ramp(Response.Length, mvDouble, 0,1.0/Response.Length);
      DrawIt(x,Response,'Original frequency spectrum');

      FrequencyResponse(c,nil,Response,8,true,wtHanning);
      x := Ramp(Response.Length, mvDouble, 0,0.1/Response.Length);
      DrawIt(x,Response,'Envelope - frequency spectrum');
  end;

 

  #include "MtxExpr.hpp"
  #include "MtxVecEdit.hpp"
  #include "MtxVecTee.hpp"
  #include "SignalUtils.hpp"

  void __fastcall TForm1::BitBtn1Click(TObject *Sender)
  {
      sVector b,c,Response,x;
      double FS = 2;

      b = Sin(Ramp(3000, mvDouble,0,2*PI*0.02/FS))*Sin(Ramp(3000, mvDouble,0,2*PI*0.2/FS));
      EnvelopeDetector(b,c,10); //reduce sampling frequency by 10x

      FrequencyResponse(b,NULL,Response,8,true,wtHanning);
      x = Ramp(Response.Length, mvDouble, 0,1.0/Response.Length);
      DrawIt(x,Response,"Original frequency spectrum",false);

      FrequencyResponse(c,NULL,Response,8,true,wtHanning);
      x = Ramp(Response.Length, mvDouble, 0,0.1/Response.Length);

      //Shows frequency at 0.04Hz:
      DrawIt(x,Response,"Envelope - frequency spectrum",false);
  }
Copyright (c) 1999-2025 by Dew Research. All rights reserved.