DSP Master VCL
|
Flip the frequency band.
procedure BandFlip(const X: TVec); overload;
Flip the freqencies of the time domain signal stored in X, so that the DC becomes the Nyquist frequency and the Nyquist frequency becomes the DC. (mirror all frequencies around FS/4) The routine is very fast and can also be used for streaming. X.length must be even.
The sampling frequency is 256 Hz. A tone has a frequency 6Hz. After flipping the frequencies, the tone has a frequency of: FS/2 - 6 = 122Hz.
uses MtxExpr, Math387, MtxVec, SignalUtils, MtxVecTee, MtxVecEdit; procedure TForm1.Button1Click(Sender: TObject); var b,c,Response1, Response2: Vector; begin b := Sin(Ramp(256, mvDouble, 0,2*Pi*6/256)); c.Copy(b); BandFlip(b); DrawIt([c,b],['Original signal','Flipped signal']); FrequencyResponse(c,nil,Response1,1,True); FrequencyResponse(b,nil,Response2,1,True); DrawIt([Response1,Response2],['Spectrum: original signal','Spectrum: flipped signal']); end;
#include "MtxExpr.hpp" #include "MtxVecEdit.hpp" #include "MtxVecTee.hpp" #include "SignalUtils.hpp" void __fastcall TForm1::BitBtn1Click(TObject *Sender) { Vector b,c, Response1, Response2; b = Sin(Ramp(256, mvDouble, 0,2.0*PI*6/256)); c.Copy(b); BandFlip(b); DrawIt(OPENARRAY(TVec*,(c,b)),OPENARRAY(AnsiString,("Original signal","Flipped signal"))); FrequencyResponse(c,NULL,Response1,1,true); FrequencyResponse(b,NULL,Response2,1,true); DrawIt(OPENARRAY(TVec*,(Response1,Response2)),OPENARRAY(AnsiString,("Spectrum: original signal","Spectrum: flipped signal"))); }
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
|
What do you think about this topic? Send feedback!
|