Reply by Mark December 6, 20052005-12-06
Flat white noise fed into a flat FM modulator will produce 1/F^2
shaped phase noise.

Most phase noise is usually 1/F^2.

1/F noise (flicker noise)  in transistors etc usually creates phase
noise that is 1/F^3 very close to the carrier.

Why do you want to create 1/F shaped phase noise?

Mark

Reply by signal December 3, 20052005-12-03
Hi,
You can read this article for generate 1/f noise
http://www.istia.univ-angers.fr/~chapeau/papers/jautotel.pdf (in french)
http://www.istia.univ-angers.fr/~chapeau/papers/psiplrc2.pdf (in english)

ok




>Yu Xiaodong wrote: >> Hi All, >> >> Is there anyone know how to generate 1/f noise for simulating the
phase
>> noise. Someone told me though passing a white noise to a FIR the noise
can
>> be generated. Any clue about the FIR? >> >> Thanks alot >> >> R. Y. > >R.Y.: > >Here's some C++ code that I wrote that will create phase noise samples >from a user-specified phase noise profile. The code uses the GNU >Scientific Library (freely available). > >Good luck, >OUP > >//-------------------------------------------------------------------------------------------------- >// >// phase_noise >// >// Generate random deviates whose spectrum matches a phase noise >profile. This code uses the >// GNU Scientific Library (GSL) v1.1.1. >// >// Revisions >// --------- >// 25-Jun-02 Initial version written. >// >//-------------------------------------------------------------------------------------------------- > >#include <stdio.h> >#include <stdlib.h> >#include <iostream.h> >#include <math.h> > >#include <gsl/gsl_complex.h> >#include <gsl/gsl_complex_math.h> >#include <gsl/gsl_errno.h> >#include <gsl/gsl_fft_complex.h> >#include <gsl/gsl_fft_halfcomplex.h> >#include <gsl/gsl_fft_real.h> >#include <gsl/gsl_randist.h> >#include <gsl/gsl_rng.h> >#include <gsl/gsl_spline.h> >#include <gsl/gsl_vector.h> > >#include "phase_noise.h" > >//-------------------------------------------------------------------------------------------------- >// >// main >// >//-------------------------------------------------------------------------------------------------- > >int main (int argc, char *argv[]) >{ > int i, numSamples; > double fs; > double xi, yi; > > // number of samples > numSamples = atoi(argv[1]); > > // sample frequency in Hz > fs = atof(argv[2]); > > InitPhaseProfile(); > > double *phi = new double [numSamples]; > > GenPhaseNoiseDeviates(phi, numSamples, fs); > > for (i = 0; i < numSamples; i++) > { > fprintf(stdout,"%d %19.16e\n", i, phi[i]); > } > >} > >//-------------------------------------------------------------------------------------------------- >// >// GenPhaseNoiseDeviates >// >// Inputs >// ------ >// numSamples number of samples to generate >// fs sample frequency (a.k.a. PRF) >// >// Input/Output >// ------------ >// phiRandom array to hold random deviates >// >// Revisions >// --------- >// 25-Jun-02 Initial version written. >// >//-------------------------------------------------------------------------------------------------- >int GenPhaseNoiseDeviates(double phiRandom[], int numSamples, double fs) >{ > int i; > > extern int numPointsProfile; > > //------------------------------- > // Generate white Gaussian noise > //------------------------------- > > gsl_rng_env_setup(); > > const gsl_rng_type *T = gsl_rng_default; > gsl_rng *r = gsl_rng_alloc(T); > > double *wn = new double [numSamples]; > > for (i = 0; i < numSamples; i++) > { > wn[i] = gsl_ran_gaussian(r, 1.0); // zero mean, unity sigma > //cout << wn[i] << "\n"; > } > > // Store the white noise samples in a GSL "packed" array. A "packed" >array holds complex data > // in a double arrray. The order is real, imag, real, imag, and so
on.
> > double *packedWn = new double [2*numSamples]; > > for (i = 0; i < numSamples; i++) > { > REAL_PACKED(packedWn,i) = wn[i]; > IMAG_PACKED(packedWn,i) = 0.0; > } > > //------------------------------------------------------ > // forward Fourier transform of the white noise samples > //------------------------------------------------------ > > gsl_fft_complex_workspace *workspace = >gsl_fft_complex_workspace_alloc(numSamples); > gsl_fft_complex_wavetable *wavetable = >gsl_fft_complex_wavetable_alloc(numSamples); // we'll use this for the >inverse too > > gsl_fft_complex_forward(packedWn, 1, numSamples, wavetable,
workspace);
> > //-------------------------------------------- > // Construct the aliased phase noise response > //-------------------------------------------- > > int nFold = int( fInputPhaseProfile[numPointsProfile-1] / fs ) + 1; > > if (nFold > nFoldMax) nFold = nFoldMax; > > int nHalf = numSamples/2; > > double *hMag = new double [nHalf]; > double *f = new double [nHalf]; > double *mSSB = new double [nHalf]; > > double fMin = 1.0; > double fMax = fs / 2.0; > double fStep = (fMax - fMin)/(nHalf-1); > > int k; > double summation; > > for (i = 0; i < nHalf; i++) > { > summation = 0.0; > f[i] = fMin + i*fStep; > for (k = -nFold; k <= nFold; k++) > { > summation = summation + GetPhaseNoiseValue(f[i] + k*fs); > } > hMag[i] = summation; > mSSB[i] = GetPhaseNoiseValue(f[i]); > } > >// for (i = 0; i < nHalf; i++) >// { >// fprintf(stdout,"%f %19.16e %19.16e\n", f[i], mSSB[i], hMag[i]); >// } > > // Construct a double-sided phase noise profile. This has even >symmetry. Note that the > // GSL stores the positive frequencies first, then the negative >frequencies in reverse > // order. We'll construct our DSB profile the same way. > > double *mDSB = new double [numSamples]; > > for (i = 0; i < nHalf; i++) > { > mDSB[i] = hMag[i]; > mDSB[i+nHalf] = hMag[nHalf - 1 - i]; > } > > double *packedDSB = new double [2*numSamples]; > > for (i = 0; i < numSamples; i++) > { > REAL_PACKED(packedDSB,i) = mDSB[i]; > IMAG_PACKED(packedDSB,i) = 0.0; > //cout << mDSB[i] << "\n"; > } > > //---------------------------- > // Convolve the two sequences > //---------------------------- > > double *packedY = new double [2*numSamples]; > > gsl_complex h, x, z; >// double hx, hy, wx, wy; > > for (i = 0; i < numSamples; i++) > { >// wx = REAL_PACKED(packedWn,i); >// wy = IMAG_PACKED(packedWn,i); > >// hx = REAL_PACKED(packedDSB,i); >// hy = IMAG_PACKED(packedDSB,i); > >// GSL_SET_COMPLEX(&x, wx, wy); >// GSL_SET_COMPLEX(&h, hx, hy); > > GSL_SET_COMPLEX(&x, REAL_PACKED(packedWn,i),
IMAG_PACKED(packedWn,i));
> GSL_SET_COMPLEX(&h, REAL_PACKED(packedDSB,i), >IMAG_PACKED(packedDSB,i)); > > z = gsl_complex_mul(h,x); > > REAL_PACKED(packedY,i) = GSL_REAL(z); > IMAG_PACKED(packedY,i) = GSL_IMAG(z); > >// packedY[i] = packedDSB[i] * packedWn[i]; // this only works >because imaginary part is zero! > } > > //--------------------------- > // Inverse Fourier transform > //--------------------------- > > gsl_fft_complex_inverse(packedY, 1, numSamples, wavetable,
workspace);
> > for (i = 0; i < numSamples; i++) > { > phiRandom[i] = REAL_PACKED(packedY,i); > } > > // free some stuff > > gsl_fft_complex_workspace_free(workspace); > gsl_fft_complex_wavetable_free(wavetable); > > gsl_spline_free (spline); > gsl_interp_accel_free(acc); > > return 0; >} > >//-------------------------------------------------------------------------------------------------- >// >// InitPhaseProfile >// >// Initialize stuff for the phase profile interpolation. >// >// Revisions >// --------- >// 25-Jun-02 Initial version written. >// >//-------------------------------------------------------------------------------------------------- >int InitPhaseProfile() >{ > int i; > extern int numPointsProfile; > > numPointsProfile = sizeof(fInputPhaseProfile)/sizeof(double); > > double *fLog = new double [numPointsProfile]; > > extern double fInputPhaseProfile[], mInputPhaseProfile[]; > extern gsl_interp_accel *acc; > extern gsl_spline *spline; > > for (i = 0; i < numPointsProfile; i++) > { > fLog[i] = log10(fInputPhaseProfile[i]); > } > > // printf ("#m=0,S=2\n"); > // for (i = 0; i < numPointsProfile; i++) > // { > // printf ("%g %g\n", fInputPhaseProfile[i],
mInputPhaseProfile[i]);
> // } > > acc = gsl_interp_accel_alloc (); > spline = gsl_spline_alloc (gsl_interp_linear, numPointsProfile); > > gsl_spline_init (spline, fLog, mInputPhaseProfile, numPointsProfile); > > return 0; >} > >//-------------------------------------------------------------------------------------------------- >// >// GetPhaseNoiseValue >// >// Given the desired frequency, this function uses linear interpolation
>in log-space to >// calculate the phase noise power. >// >// Input >// ----- >// f frequency (Hz) >// >// Output >// ------ >// sf phase noise power in absolute units >// >// Revisions >// --------- >// 25-Jun-02 Initial version written. >// >//-------------------------------------------------------------------------------------------------- >double GetPhaseNoiseValue(double f) >{ > double sf; > const double noiseFloor = -150.0; > > extern int numPointsProfile; > extern double fInputPhaseProfile[]; > extern gsl_interp_accel *acc; > extern gsl_spline *spline; > > f = abs(f); > > if (f > fInputPhaseProfile[numPointsProfile-1]) > { > sf = noiseFloor; // dBc/Hz > } > else > { > // interpolate to get phase noise power at desired frequency > sf = gsl_spline_eval (spline, log10(f), acc); > } > > sf = pow(10.0, 0.1*sf); > > return(sf); >} > > >
Reply by signal December 3, 20052005-12-03
>Yu Xiaodong wrote: >> Hi All, >> >> Is there anyone know how to generate 1/f noise for simulating the
phase
>> noise. Someone told me though passing a white noise to a FIR the noise
can
>> be generated. Any clue about the FIR? >> >> Thanks alot >> >> R. Y. > >R.Y.: > >Here's some C++ code that I wrote that will create phase noise samples >from a user-specified phase noise profile. The code uses the GNU >Scientific Library (freely available). > >Good luck, >OUP > >//-------------------------------------------------------------------------------------------------- >// >// phase_noise >// >// Generate random deviates whose spectrum matches a phase noise >profile. This code uses the >// GNU Scientific Library (GSL) v1.1.1. >// >// Revisions >// --------- >// 25-Jun-02 Initial version written. >// >//-------------------------------------------------------------------------------------------------- > >#include <stdio.h> >#include <stdlib.h> >#include <iostream.h> >#include <math.h> > >#include <gsl/gsl_complex.h> >#include <gsl/gsl_complex_math.h> >#include <gsl/gsl_errno.h> >#include <gsl/gsl_fft_complex.h> >#include <gsl/gsl_fft_halfcomplex.h> >#include <gsl/gsl_fft_real.h> >#include <gsl/gsl_randist.h> >#include <gsl/gsl_rng.h> >#include <gsl/gsl_spline.h> >#include <gsl/gsl_vector.h> > >#include "phase_noise.h" > >//-------------------------------------------------------------------------------------------------- >// >// main >// >//-------------------------------------------------------------------------------------------------- > >int main (int argc, char *argv[]) >{ > int i, numSamples; > double fs; > double xi, yi; > > // number of samples > numSamples = atoi(argv[1]); > > // sample frequency in Hz > fs = atof(argv[2]); > > InitPhaseProfile(); > > double *phi = new double [numSamples]; > > GenPhaseNoiseDeviates(phi, numSamples, fs); > > for (i = 0; i < numSamples; i++) > { > fprintf(stdout,"%d %19.16e\n", i, phi[i]); > } > >} > >//-------------------------------------------------------------------------------------------------- >// >// GenPhaseNoiseDeviates >// >// Inputs >// ------ >// numSamples number of samples to generate >// fs sample frequency (a.k.a. PRF) >// >// Input/Output >// ------------ >// phiRandom array to hold random deviates >// >// Revisions >// --------- >// 25-Jun-02 Initial version written. >// >//-------------------------------------------------------------------------------------------------- >int GenPhaseNoiseDeviates(double phiRandom[], int numSamples, double fs) >{ > int i; > > extern int numPointsProfile; > > //------------------------------- > // Generate white Gaussian noise > //------------------------------- > > gsl_rng_env_setup(); > > const gsl_rng_type *T = gsl_rng_default; > gsl_rng *r = gsl_rng_alloc(T); > > double *wn = new double [numSamples]; > > for (i = 0; i < numSamples; i++) > { > wn[i] = gsl_ran_gaussian(r, 1.0); // zero mean, unity sigma > //cout << wn[i] << "\n"; > } > > // Store the white noise samples in a GSL "packed" array. A "packed" >array holds complex data > // in a double arrray. The order is real, imag, real, imag, and so
on.
> > double *packedWn = new double [2*numSamples]; > > for (i = 0; i < numSamples; i++) > { > REAL_PACKED(packedWn,i) = wn[i]; > IMAG_PACKED(packedWn,i) = 0.0; > } > > //------------------------------------------------------ > // forward Fourier transform of the white noise samples > //------------------------------------------------------ > > gsl_fft_complex_workspace *workspace = >gsl_fft_complex_workspace_alloc(numSamples); > gsl_fft_complex_wavetable *wavetable = >gsl_fft_complex_wavetable_alloc(numSamples); // we'll use this for the >inverse too > > gsl_fft_complex_forward(packedWn, 1, numSamples, wavetable,
workspace);
> > //-------------------------------------------- > // Construct the aliased phase noise response > //-------------------------------------------- > > int nFold = int( fInputPhaseProfile[numPointsProfile-1] / fs ) + 1; > > if (nFold > nFoldMax) nFold = nFoldMax; > > int nHalf = numSamples/2; > > double *hMag = new double [nHalf]; > double *f = new double [nHalf]; > double *mSSB = new double [nHalf]; > > double fMin = 1.0; > double fMax = fs / 2.0; > double fStep = (fMax - fMin)/(nHalf-1); > > int k; > double summation; > > for (i = 0; i < nHalf; i++) > { > summation = 0.0; > f[i] = fMin + i*fStep; > for (k = -nFold; k <= nFold; k++) > { > summation = summation + GetPhaseNoiseValue(f[i] + k*fs); > } > hMag[i] = summation; > mSSB[i] = GetPhaseNoiseValue(f[i]); > } > >// for (i = 0; i < nHalf; i++) >// { >// fprintf(stdout,"%f %19.16e %19.16e\n", f[i], mSSB[i], hMag[i]); >// } > > // Construct a double-sided phase noise profile. This has even >symmetry. Note that the > // GSL stores the positive frequencies first, then the negative >frequencies in reverse > // order. We'll construct our DSB profile the same way. > > double *mDSB = new double [numSamples]; > > for (i = 0; i < nHalf; i++) > { > mDSB[i] = hMag[i]; > mDSB[i+nHalf] = hMag[nHalf - 1 - i]; > } > > double *packedDSB = new double [2*numSamples]; > > for (i = 0; i < numSamples; i++) > { > REAL_PACKED(packedDSB,i) = mDSB[i]; > IMAG_PACKED(packedDSB,i) = 0.0; > //cout << mDSB[i] << "\n"; > } > > //---------------------------- > // Convolve the two sequences > //---------------------------- > > double *packedY = new double [2*numSamples]; > > gsl_complex h, x, z; >// double hx, hy, wx, wy; > > for (i = 0; i < numSamples; i++) > { >// wx = REAL_PACKED(packedWn,i); >// wy = IMAG_PACKED(packedWn,i); > >// hx = REAL_PACKED(packedDSB,i); >// hy = IMAG_PACKED(packedDSB,i); > >// GSL_SET_COMPLEX(&x, wx, wy); >// GSL_SET_COMPLEX(&h, hx, hy); > > GSL_SET_COMPLEX(&x, REAL_PACKED(packedWn,i),
IMAG_PACKED(packedWn,i));
> GSL_SET_COMPLEX(&h, REAL_PACKED(packedDSB,i), >IMAG_PACKED(packedDSB,i)); > > z = gsl_complex_mul(h,x); > > REAL_PACKED(packedY,i) = GSL_REAL(z); > IMAG_PACKED(packedY,i) = GSL_IMAG(z); > >// packedY[i] = packedDSB[i] * packedWn[i]; // this only works >because imaginary part is zero! > } > > //--------------------------- > // Inverse Fourier transform > //--------------------------- > > gsl_fft_complex_inverse(packedY, 1, numSamples, wavetable,
workspace);
> > for (i = 0; i < numSamples; i++) > { > phiRandom[i] = REAL_PACKED(packedY,i); > } > > // free some stuff > > gsl_fft_complex_workspace_free(workspace); > gsl_fft_complex_wavetable_free(wavetable); > > gsl_spline_free (spline); > gsl_interp_accel_free(acc); > > return 0; >} > >//-------------------------------------------------------------------------------------------------- >// >// InitPhaseProfile >// >// Initialize stuff for the phase profile interpolation. >// >// Revisions >// --------- >// 25-Jun-02 Initial version written. >// >//-------------------------------------------------------------------------------------------------- >int InitPhaseProfile() >{ > int i; > extern int numPointsProfile; > > numPointsProfile = sizeof(fInputPhaseProfile)/sizeof(double); > > double *fLog = new double [numPointsProfile]; > > extern double fInputPhaseProfile[], mInputPhaseProfile[]; > extern gsl_interp_accel *acc; > extern gsl_spline *spline; > > for (i = 0; i < numPointsProfile; i++) > { > fLog[i] = log10(fInputPhaseProfile[i]); > } > > // printf ("#m=0,S=2\n"); > // for (i = 0; i < numPointsProfile; i++) > // { > // printf ("%g %g\n", fInputPhaseProfile[i],
mInputPhaseProfile[i]);
> // } > > acc = gsl_interp_accel_alloc (); > spline = gsl_spline_alloc (gsl_interp_linear, numPointsProfile); > > gsl_spline_init (spline, fLog, mInputPhaseProfile, numPointsProfile); > > return 0; >} > >//-------------------------------------------------------------------------------------------------- >// >// GetPhaseNoiseValue >// >// Given the desired frequency, this function uses linear interpolation
>in log-space to >// calculate the phase noise power. >// >// Input >// ----- >// f frequency (Hz) >// >// Output >// ------ >// sf phase noise power in absolute units >// >// Revisions >// --------- >// 25-Jun-02 Initial version written. >// >//-------------------------------------------------------------------------------------------------- >double GetPhaseNoiseValue(double f) >{ > double sf; > const double noiseFloor = -150.0; > > extern int numPointsProfile; > extern double fInputPhaseProfile[]; > extern gsl_interp_accel *acc; > extern gsl_spline *spline; > > f = abs(f); > > if (f > fInputPhaseProfile[numPointsProfile-1]) > { > sf = noiseFloor; // dBc/Hz > } > else > { > // interpolate to get phase noise power at desired frequency > sf = gsl_spline_eval (spline, log10(f), acc); > } > > sf = pow(10.0, 0.1*sf); > > return(sf); >} > > >
Reply by One Usenet Poster July 7, 20032003-07-07
Yu Xiaodong wrote:
> Hi All, > > Is there anyone know how to generate 1/f noise for simulating the phase > noise. Someone told me though passing a white noise to a FIR the noise can > be generated. Any clue about the FIR? > > Thanks alot > > R. Y.
R.Y.: Here's some C++ code that I wrote that will create phase noise samples from a user-specified phase noise profile. The code uses the GNU Scientific Library (freely available). Good luck, OUP //-------------------------------------------------------------------------------------------------- // // phase_noise // // Generate random deviates whose spectrum matches a phase noise profile. This code uses the // GNU Scientific Library (GSL) v1.1.1. // // Revisions // --------- // 25-Jun-02 Initial version written. // //-------------------------------------------------------------------------------------------------- #include <stdio.h> #include <stdlib.h> #include <iostream.h> #include <math.h> #include <gsl/gsl_complex.h> #include <gsl/gsl_complex_math.h> #include <gsl/gsl_errno.h> #include <gsl/gsl_fft_complex.h> #include <gsl/gsl_fft_halfcomplex.h> #include <gsl/gsl_fft_real.h> #include <gsl/gsl_randist.h> #include <gsl/gsl_rng.h> #include <gsl/gsl_spline.h> #include <gsl/gsl_vector.h> #include "phase_noise.h" //-------------------------------------------------------------------------------------------------- // // main // //-------------------------------------------------------------------------------------------------- int main (int argc, char *argv[]) { int i, numSamples; double fs; double xi, yi; // number of samples numSamples = atoi(argv[1]); // sample frequency in Hz fs = atof(argv[2]); InitPhaseProfile(); double *phi = new double [numSamples]; GenPhaseNoiseDeviates(phi, numSamples, fs); for (i = 0; i < numSamples; i++) { fprintf(stdout,"%d %19.16e\n", i, phi[i]); } } //-------------------------------------------------------------------------------------------------- // // GenPhaseNoiseDeviates // // Inputs // ------ // numSamples number of samples to generate // fs sample frequency (a.k.a. PRF) // // Input/Output // ------------ // phiRandom array to hold random deviates // // Revisions // --------- // 25-Jun-02 Initial version written. // //-------------------------------------------------------------------------------------------------- int GenPhaseNoiseDeviates(double phiRandom[], int numSamples, double fs) { int i; extern int numPointsProfile; //------------------------------- // Generate white Gaussian noise //------------------------------- gsl_rng_env_setup(); const gsl_rng_type *T = gsl_rng_default; gsl_rng *r = gsl_rng_alloc(T); double *wn = new double [numSamples]; for (i = 0; i < numSamples; i++) { wn[i] = gsl_ran_gaussian(r, 1.0); // zero mean, unity sigma //cout << wn[i] << "\n"; } // Store the white noise samples in a GSL "packed" array. A "packed" array holds complex data // in a double arrray. The order is real, imag, real, imag, and so on. double *packedWn = new double [2*numSamples]; for (i = 0; i < numSamples; i++) { REAL_PACKED(packedWn,i) = wn[i]; IMAG_PACKED(packedWn,i) = 0.0; } //------------------------------------------------------ // forward Fourier transform of the white noise samples //------------------------------------------------------ gsl_fft_complex_workspace *workspace = gsl_fft_complex_workspace_alloc(numSamples); gsl_fft_complex_wavetable *wavetable = gsl_fft_complex_wavetable_alloc(numSamples); // we'll use this for the inverse too gsl_fft_complex_forward(packedWn, 1, numSamples, wavetable, workspace); //-------------------------------------------- // Construct the aliased phase noise response //-------------------------------------------- int nFold = int( fInputPhaseProfile[numPointsProfile-1] / fs ) + 1; if (nFold > nFoldMax) nFold = nFoldMax; int nHalf = numSamples/2; double *hMag = new double [nHalf]; double *f = new double [nHalf]; double *mSSB = new double [nHalf]; double fMin = 1.0; double fMax = fs / 2.0; double fStep = (fMax - fMin)/(nHalf-1); int k; double summation; for (i = 0; i < nHalf; i++) { summation = 0.0; f[i] = fMin + i*fStep; for (k = -nFold; k <= nFold; k++) { summation = summation + GetPhaseNoiseValue(f[i] + k*fs); } hMag[i] = summation; mSSB[i] = GetPhaseNoiseValue(f[i]); } // for (i = 0; i < nHalf; i++) // { // fprintf(stdout,"%f %19.16e %19.16e\n", f[i], mSSB[i], hMag[i]); // } // Construct a double-sided phase noise profile. This has even symmetry. Note that the // GSL stores the positive frequencies first, then the negative frequencies in reverse // order. We'll construct our DSB profile the same way. double *mDSB = new double [numSamples]; for (i = 0; i < nHalf; i++) { mDSB[i] = hMag[i]; mDSB[i+nHalf] = hMag[nHalf - 1 - i]; } double *packedDSB = new double [2*numSamples]; for (i = 0; i < numSamples; i++) { REAL_PACKED(packedDSB,i) = mDSB[i]; IMAG_PACKED(packedDSB,i) = 0.0; //cout << mDSB[i] << "\n"; } //---------------------------- // Convolve the two sequences //---------------------------- double *packedY = new double [2*numSamples]; gsl_complex h, x, z; // double hx, hy, wx, wy; for (i = 0; i < numSamples; i++) { // wx = REAL_PACKED(packedWn,i); // wy = IMAG_PACKED(packedWn,i); // hx = REAL_PACKED(packedDSB,i); // hy = IMAG_PACKED(packedDSB,i); // GSL_SET_COMPLEX(&x, wx, wy); // GSL_SET_COMPLEX(&h, hx, hy); GSL_SET_COMPLEX(&x, REAL_PACKED(packedWn,i), IMAG_PACKED(packedWn,i)); GSL_SET_COMPLEX(&h, REAL_PACKED(packedDSB,i), IMAG_PACKED(packedDSB,i)); z = gsl_complex_mul(h,x); REAL_PACKED(packedY,i) = GSL_REAL(z); IMAG_PACKED(packedY,i) = GSL_IMAG(z); // packedY[i] = packedDSB[i] * packedWn[i]; // this only works because imaginary part is zero! } //--------------------------- // Inverse Fourier transform //--------------------------- gsl_fft_complex_inverse(packedY, 1, numSamples, wavetable, workspace); for (i = 0; i < numSamples; i++) { phiRandom[i] = REAL_PACKED(packedY,i); } // free some stuff gsl_fft_complex_workspace_free(workspace); gsl_fft_complex_wavetable_free(wavetable); gsl_spline_free (spline); gsl_interp_accel_free(acc); return 0; } //-------------------------------------------------------------------------------------------------- // // InitPhaseProfile // // Initialize stuff for the phase profile interpolation. // // Revisions // --------- // 25-Jun-02 Initial version written. // //-------------------------------------------------------------------------------------------------- int InitPhaseProfile() { int i; extern int numPointsProfile; numPointsProfile = sizeof(fInputPhaseProfile)/sizeof(double); double *fLog = new double [numPointsProfile]; extern double fInputPhaseProfile[], mInputPhaseProfile[]; extern gsl_interp_accel *acc; extern gsl_spline *spline; for (i = 0; i < numPointsProfile; i++) { fLog[i] = log10(fInputPhaseProfile[i]); } // printf ("#m=0,S=2\n"); // for (i = 0; i < numPointsProfile; i++) // { // printf ("%g %g\n", fInputPhaseProfile[i], mInputPhaseProfile[i]); // } acc = gsl_interp_accel_alloc (); spline = gsl_spline_alloc (gsl_interp_linear, numPointsProfile); gsl_spline_init (spline, fLog, mInputPhaseProfile, numPointsProfile); return 0; } //-------------------------------------------------------------------------------------------------- // // GetPhaseNoiseValue // // Given the desired frequency, this function uses linear interpolation in log-space to // calculate the phase noise power. // // Input // ----- // f frequency (Hz) // // Output // ------ // sf phase noise power in absolute units // // Revisions // --------- // 25-Jun-02 Initial version written. // //-------------------------------------------------------------------------------------------------- double GetPhaseNoiseValue(double f) { double sf; const double noiseFloor = -150.0; extern int numPointsProfile; extern double fInputPhaseProfile[]; extern gsl_interp_accel *acc; extern gsl_spline *spline; f = abs(f); if (f > fInputPhaseProfile[numPointsProfile-1]) { sf = noiseFloor; // dBc/Hz } else { // interpolate to get phase noise power at desired frequency sf = gsl_spline_eval (spline, log10(f), acc); } sf = pow(10.0, 0.1*sf); return(sf); }
Reply by Allan Herriman July 7, 20032003-07-07
On Mon, 07 Jul 2003 09:32:00 -0400, Jerry Avins <jya@ieee.org> wrote:

>Allan Herriman wrote: >> > ... >> >> I don't think that applies in this case. There is usually an easily >> identifiable 1/f section in the phase noise of many oscillators. >> This comes from 1/f noise in transistors affecting the phase directly. >> >> There is also 1/f^3 noise, which comes from 1/f noise on the control >> voltage of a VCO. For a VCO though, the 1/f^2 noise (which comes from >> white noise on the control voltage) is usually dominant over most of >> the spectrum. It's only for low offset frequencies that the 1/f^3 >> noise dominates. >> >> For a reference crystal oscillator, white phase noise (1/f^0) is >> usually dominant at offset frequencies > a few kHz. >> > ... > >Allan, > >What is an "offset frequency"? For that matter, what is meant by >"Fourier frequencies" in the part I snipped?
The same thing. Phase noise is a measure of the modulation of a carrier. We can measure phase noise with a spectrum analyser. There will be a peak on the spectrum analyser display at the carrier frequency (e.g. 10MHz). Move an offset frequency (e.g. 1kHz) away from the carrier (to 10.001 MHz), and ideally we would have no power. In practice, we have a certain noise density, which can be expressed in dB(whatever)/Hz, e.g. dBm/Hz. We can also express the power relative to the carrier power to get dBc/Hz, which is the (one sided) phase noise. Note that the phase noise is independent of the carrier frequency. We can heterodyne it up and down all day, and the phase noise will be the same (well... the phase noise of the local oscillators will add to the phase noise of the signal, and the mixers will add a little noise too.) Note also that an amplifier will add some noise, and some of this (half the power) will be phase noise. The phase noise is, of course, a fuction of the offset frequency, so it's usually specified as dBc/Hz @ so many Hz, e.g. -170dBc/Hz @ 1kHz (which incidentally is only a few dB above the thermal noise floor of a 0dBm carrier). -170dBc/Hz is actually a lot better than the phase noise floor of any spectrum analyser that I've ever used. Measurements of this sort require a phase noise test set (e.g. HP3048), which is really just an extra low noise spectrum analyser with a bad user interface. It will have an analog quadrature mixer that mixes to DC, and the result is analysed with the help of an FFT. Note: the mixer requires a local oscillator, of course. This either has to be a lot better than the device under test, or perhaps it could be a copy of the dut, and the software will divide the result by 2 (i.e. take off 3db). BTW, When the OP asked for 1/f noise, the 'f' was the offset frequency. Here's another example: http://www.miteq.com/micro/fresourc/frequencysynthesizers/mfs_4.htm Regards, Allan.
Reply by Jerry Avins July 7, 20032003-07-07
Allan Herriman wrote:
>
...
> > I don't think that applies in this case. There is usually an easily > identifiable 1/f section in the phase noise of many oscillators. > This comes from 1/f noise in transistors affecting the phase directly. > > There is also 1/f^3 noise, which comes from 1/f noise on the control > voltage of a VCO. For a VCO though, the 1/f^2 noise (which comes from > white noise on the control voltage) is usually dominant over most of > the spectrum. It's only for low offset frequencies that the 1/f^3 > noise dominates. > > For a reference crystal oscillator, white phase noise (1/f^0) is > usually dominant at offset frequencies > a few kHz. >
... Allan, What is an "offset frequency"? For that matter, what is meant by "Fourier frequencies" in the part I snipped? Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by Jerry Avins July 7, 20032003-07-07
Ian Buckner wrote:
> > "Jerry Avins" <jya@ieee.org> wrote in message > news:3F089FB3.47729442@ieee.org... > > Andor wrote: > > > > > > Yu Xiaodong wrote: > > > > Hi All, > > > > > > > > Is there anyone know how to generate 1/f noise for simulating > the phase > > > > noise. > > > > > > How do you define 1/f noise? How is does DC behave in this noise? > > > > > > Regards, > > > Andor > > > > Ideal 1/f ("pink") noise increases 3 dB/octave as the frequency goes > > down. Just as ideal white noise doesn't exist because infinite power > > would come from extending it at the high end, ideal pink noise can't > > exist because of trouble as DC is approached. Nevertheless, both are > > useful abstractions. > > > > Jerry > > -- > > Engineering is the art of making what you want from things you can > get. > > > &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295; > &#4294967295; > As Jerry says, ideal pink noise can't exist, as the total power goes > infinite (equal power per octave, infinite octaves as you reduce > frequency). > However, nobody has found a lower frequency limit yet. I recall some > measurements done on galactic background radiation which went down > to some ridiculously low frequencies without deviating from 1/f. > > If you are simulating phase noise you may wish to include a 1/f^2 term > as well. > > Regards > Ian
Some of those galactic sources are pretty powerful! (But even f = 1/A, where A is the age of the universe, isn't thought to be zero.) Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by Allan Herriman July 7, 20032003-07-07
On 7 Jul 2003 04:12:31 -0700, an2or@mailcircuit.com (Andor) wrote:

>Jerry Avins wrote: >> Andor wrote: >> > >> > Yu Xiaodong wrote: >> > > Hi All, >> > > >> > > Is there anyone know how to generate 1/f noise for simulating the phase >> > > noise. >> > >> > How do you define 1/f noise? How is does DC behave in this noise? >> > >> > Regards, >> > Andor >> >> Ideal 1/f ("pink") noise increases 3 dB/octave as the frequency goes >> down. Just as ideal white noise doesn't exist because infinite power >> would come from extending it at the high end, ideal pink noise can't >> exist because of trouble as DC is approached. > >Is anybody familiar with fractional gaussian noise? It also has a pole >at DC in the PSD and an exponential drop-off (for 1/2 < H < 1, H the >Hurst parameter), but it is integrable. > >Perhaps some people mean fractional gaussian noise when they say pink >noise (or 1/f noise)?
I don't think that applies in this case. There is usually an easily identifiable 1/f section in the phase noise of many oscillators. This comes from 1/f noise in transistors affecting the phase directly. There is also 1/f^3 noise, which comes from 1/f noise on the control voltage of a VCO. For a VCO though, the 1/f^2 noise (which comes from white noise on the control voltage) is usually dominant over most of the spectrum. It's only for low offset frequencies that the 1/f^3 noise dominates. For a reference crystal oscillator, white phase noise (1/f^0) is usually dominant at offset frequencies > a few kHz. From http://www.wenzel.com/documents/ulntests.html (which describes tests on a reference oscillator): "The following model agrees with all the phase noise measurements for oscillator 8339045 to within 1.5 dB for Fourier frequencies from 1 to 100,000 Hz. &#4294967295;(f) (8339045) = 10^-l2.86 / f^3 + 10^-15.0 / f + 10^-178.7 . " (units are dB) Regards, Allan.
Reply by Andor July 7, 20032003-07-07
Jerry Avins wrote:
> Andor wrote: > > > > Yu Xiaodong wrote: > > > Hi All, > > > > > > Is there anyone know how to generate 1/f noise for simulating the phase > > > noise. > > > > How do you define 1/f noise? How is does DC behave in this noise? > > > > Regards, > > Andor > > Ideal 1/f ("pink") noise increases 3 dB/octave as the frequency goes > down. Just as ideal white noise doesn't exist because infinite power > would come from extending it at the high end, ideal pink noise can't > exist because of trouble as DC is approached.
Is anybody familiar with fractional gaussian noise? It also has a pole at DC in the PSD and an exponential drop-off (for 1/2 < H < 1, H the Hurst parameter), but it is integrable. Perhaps some people mean fractional gaussian noise when they say pink noise (or 1/f noise)? Regards, Andor
Reply by Ian Buckner July 7, 20032003-07-07
"Jerry Avins" <jya@ieee.org> wrote in message
news:3F089FB3.47729442@ieee.org...
> Andor wrote: > > > > Yu Xiaodong wrote: > > > Hi All, > > > > > > Is there anyone know how to generate 1/f noise for simulating
the phase
> > > noise. > > > > How do you define 1/f noise? How is does DC behave in this noise? > > > > Regards, > > Andor > > Ideal 1/f ("pink") noise increases 3 dB/octave as the frequency goes > down. Just as ideal white noise doesn't exist because infinite power > would come from extending it at the high end, ideal pink noise can't > exist because of trouble as DC is approached. Nevertheless, both are > useful abstractions. > > Jerry > -- > Engineering is the art of making what you want from things you can
get.
>
&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295; &#4294967295; As Jerry says, ideal pink noise can't exist, as the total power goes infinite (equal power per octave, infinite octaves as you reduce frequency). However, nobody has found a lower frequency limit yet. I recall some measurements done on galactic background radiation which went down to some ridiculously low frequencies without deviating from 1/f. If you are simulating phase noise you may wish to include a 1/f^2 term as well. Regards Ian