Unit
SignalUtils
Example: Sampling frequency is 11kHz. The audio card is recording hammer impacts which occur once every five seconds. Because the duration of the hammer impact is very short, the 0.2 Hz frequency will not show up in the frequency spectrum of the signal, regardless of the frequency resolution, especially because the audio card filters out everything below 20 Hz. By selecting FrameSize = 2000 the sampling frequency will be reduced by 2000x, by averaging together groups of rectified samples. The frequency spectrum of the filtered signal will show a clear peak at 0.2 Hz.
| See Also |
|---|
| FirFilter |
| KaiserImpulse |
uses MtxExpr, Math387, MtxVec, SignalUtils, MtxVecTee, MtxVecEdit; procedure TForm1.Button1Click(Sender: TObject); var b,c,Response,x: Vector; FS: TSample; begin FS := 2; b := Sin(Ramp(3000,0,2*Pi*0.02/FS))*Sin(Ramp(3000,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,0,1.0/Response.Length); DrawIt(x,Response,'Original frequency spectrum'); FrequencyResponse(c,nil,Response,8,true,wtHanning); x := Ramp(Response.Length,0,0.1/Response.Length); DrawIt(x,Response,'Envelope - frequency spectrum'); end;
#include "MtxVecCPP.h" //MtxVecCPP.cpp must be included in the project #include "MtxVecEdit.hpp" #include "MtxVecTee.hpp" #include "SignalUtils.hpp" void __fastcall TForm1::BitBtn1Click(TObject *Sender) { Vector b,c,Response,x; double FS = 2; b = Sin(Ramp(3000,0,2*PI*0.02/FS))*Sin(Ramp(3000,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,0,1.0/Response->Length); DrawIt(x,Response,"Original frequency spectrum",false); FrequencyResponse(c,NULL,Response,8,true,wtHanning); x = Ramp(Response->Length,0,0.1/Response->Length); //Shows frequency at 0.04Hz: DrawIt(x,Response,"Envelope - frequency spectrum",false); }
using Dew.Math; using Dew.Math.Editors; using Dew.Math.Units; using Dew.Signal; using Dew.Signal.Units; using Dew.Math.Tee; using Dew.Signal.Tee; private void button1_Click(object sender, EventArgs e) { Vector Response = new Vector(0); Vector x; double FS = 2; Vector b = MtxExpr.Sin(MtxExpr.Ramp(3000,0,2*Math.PI*0.02/FS))* MtxExpr.Sin(MtxExpr.Ramp(3000,0,2*Math.PI*0.2/FS)); Vector c = new Vector(b.Length); SignalUtils.EnvelopeDetector(b,c,10); //reduce sampling frequency by 10x SignalUtils.FrequencyResponse(b,null,Response,8,true, TSignalWindowType.wtHanning, 0); x = MtxExpr.Ramp(Response.Length,0,1.0/Response.Length); TeeChart.DrawIt(x,Response,"Original frequency spectrum",false); SignalUtils.FrequencyResponse(c,null,Response,8,true, TSignalWindowType.wtHanning, 0); x = MtxExpr.Ramp(Response.Length,0,1.0/Response.Length); TeeChart.DrawIt(x, Response, "Envelope frequency spectrum", false); }
| Copyright 2008 Dew Research |