sqrtnyq

Capsim Block Documentation

Short Description

This star performs square root Nyquist pulse shaping for a baseband transmitter.

Top
Input Connections
Port Type Name
0 float x
Top
Output Connections
Port Type Name
0 float y
Top
Parameters
Num Description Type Name Default Value
0 samples per baud interval. int smplbd 8
1 expfft: 2^expfft=fft length to use. int expfft 8
2 beta: filter rolloff factor, 0 float beta .5
Top
States
Num Type Name Initial Value Description
0 cap_fft_cpx* nyqfresp
1 cap_fft_scalar* temp
2 cap_fft_scalar* temp2
3 cap_fft_cpx* freqBuffCx
4 cap_fft_scalar* save
5 cap_fftr_cfg preverse
6 cap_fftr_cfg pforward
7 int fftl 1 << expfft
8 int impl IMPBAUD * smplbd
9 int pcount impl
10 double norm
Top

Declarations


 

   	int i;
   	int j;
	float freq;			/* fractional norm. frequency */
	float val;			/* temporary */
	int	no_samples;



Top

Initialization Code



 

	if(smplbd < 2) {
	   	fprintf(stderr,"sqrtnyq: do not use if smplbd < 2\n");
		return(1);
	}
	if(fftl <= impl) {
	   	fprintf(stderr,"sqrtnyq: fft length too short\n");
		return(2);
	}
	if(beta <= 0. || beta > .5) {
	   	fprintf(stderr,"sqrtnyq: beta param out of range\n");
		return(3);
	}
	if( (nyqfresp = (cap_fft_cpx*)calloc(fftl,sizeof(cap_fft_cpx))) == NULL ||
	    (temp = (cap_fft_scalar*)calloc(fftl,sizeof(cap_fft_scalar))) == NULL ||
	    (temp2 = (cap_fft_scalar*)calloc(fftl,sizeof(cap_fft_scalar))) == NULL ||
	    (freqBuffCx = (cap_fft_cpx*)calloc(fftl,sizeof(cap_fft_cpx))) == NULL ||
	    (save = (cap_fft_scalar*)calloc(impl,sizeof(cap_fft_scalar))) == NULL ) {
	   	fprintf(stderr,"sqrtnyq: can't allocate work space\n");
		return(4);
	}

	preverse = cap_fftr_alloc(fftl, INVERSE_FFT, NULL,NULL);
	pforward = cap_fftr_alloc(fftl, FORWARD_FFT, NULL,NULL);

	/* Compute nyquist frequency response */
	/* store in `folded, real fft' form */
	/* note: frequency is normalized to unity at baud rate */
	for(i=0; i= .5 + beta) temp[2*i] = 0.;
		else {	/* frequency in rolloff region */
			val =  cos(PI * (freq -.5 + beta)/(4.* beta));
			temp[2*i] = smplbd * val ;
		}
	}
	for(i=0; i
    
Top

Main Code



 


	for(no_samples=MIN_AVAIL();no_samples >0; --no_samples) {
		IT_IN(0);
		temp[pcount++] = x(0);
		if(pcount == fftl){
			for(i=0; i
    
Top

Wrapup Code



 

#if 1 // PROBLEM NEED TO FIND LINK SINCE MOVING TO FFTW
        free(nyqfresp); 
        free(save); 
        free(freqBuffCx);
	free(temp);
	free(temp2);
#endif


        free(preverse);
        free(pforward);




Top

License



/*  Capsim (r) Text Mode Kernel (TMK) Star Library (Blocks)
    Copyright (C) 1989-2017  Silicon DSP Corporation

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    http://www.silicondsp.com
    Silicon DSP  Corporation
    Las Vegas, Nevada
*/


Top

Description



 

/* sqrtnyq.s */
/***********************************************************************
                             sqrtnyq()
************************************************************************
This star performs Nyquist pulse shaping for a baseband transmitter.
See Carlson, Communications Systems, page 381, equation 17b.
The Nyquist criterion in the frequency domain is to have an amplitude
rolloff which is symmetric about Fb/2 (half baud frequency).
First, a frequency-domain amplitude response is created using a raised
cosine shape.  This computation is affected by:
Param:	1 - (int) smplbd: samples per baud interval. default=>8
	2 - (int) expfft: 2^expfft = fft length to use.  default=>8
	3 - (float) beta: filter rolloff factor, 0.5
The amplitude response is changed to impulse response via inverse fft.
The impulse response is made causal by right shifting (filter delay),
and is time limited to "IMPBAUD" baud intervals (set by definition).
(This filter will cause a delay of IMPBAUD/2 baud intervals.)
Finally, the impulse response is transformed back to a frequency
response, which is used in subsequent linear convolution with the input,
which is implemented by the Fast Fourier Transform overlap-save method.
The fft length must be greater than the impulse response length;
for efficiency, a factor of two or more in length is desirable.
This implies that 2^expfft > smplbd * IMPBAUD.
Nyquist shaping has no meaning if smplbd = 1; this implies that
each sample would go through the filter unchanged!

sqrtnyq


This star performs Nyquist pulse shaping for a baseband transmitter.
See Carlson, Communications Systems, page 381, equation 17b.
The Nyquist criterion in the frequency domain is to have an amplitude
rolloff which is symmetric about Fb/2 (half baud frequency).
First, a frequency-domain amplitude response is created using a raised
cosine shape.  This computation is affected by:
Param:	1 - (int) smplbd: samples per baud interval. default=>8
	2 - (int) expfft: 2^expfft = fft length to use.  default=>8
	3 - (float) beta: filter rolloff factor, 0.5
The amplitude response is changed to impulse response via inverse fft.
The impulse response is made causal by right shifting (filter delay),
and is time limited to "IMPBAUD" baud intervals (set by definition).
(This filter will cause a delay of IMPBAUD/2 baud intervals.)
Finally, the impulse response is transformed back to a frequency
response, which is used in subsequent linear convolution with the input,
which is implemented by the Fast Fourier Transform overlap-save method.
The fft length must be greater than the impulse response length;
for efficiency, a factor of two or more in length is desirable.
This implies that 2^expfft > smplbd * IMPBAUD.
Nyquist shaping has no meaning if smplbd = 1; this implies that
each sample would go through the filter unchanged!


Programmer: L.J. Faber
Date: Jan. 14, 1987
Modified: 6/88 ljfaber.  expand comments, fix flaws
Modified: 6/89 S. H. Ardalan.  

*/