freqimp

Capsim Block Documentation

Short Description

Calculate impulse response from frequency response

Top
Input Connections
Port Type Name
0 float xfreq
Top
Output Connections
Port Type Name
0 float ximp
Top
Parameters
Num Description Type Name Default Value
0 Number of frequency points to input int nfft 64
1 Conjugatate (0=No, 1=Yes) int conjFlag 0
Top
States
Num Type Name Initial Value Description
0 float* freqRes_A
1 float* impRes_A
2 int numSamples
3 float conj
Top

Declarations


 

	int 	i;
	int	j;



Top

Initialization Code



 

	numSamples=0;
	/*
	 * Allocate array for frequency response 
	 */
	freqRes_A= (float *)malloc(nfft*sizeof(float));
	if(freqRes_A==NULL) {
		fprintf(stderr,"Unable to allocate space in freqimp star \n");
		return(1);
	}
	/*
	 * Allocate array for impulse response
	 */
	impRes_A= (float *)malloc(2*nfft*sizeof(float));
	if(impRes_A==NULL) {
		fprintf(stderr,"Unable to allocate space in freqimp star \n");
		return(2);
	}
	if (conjFlag) conj= -1.0;
		else conj = 1.0;




Top

Main Code



 

for (j = MIN_AVAIL(); j > 0; --j) {
	/*
	 * Get frequency response 
	 */

	IT_IN(0);
	freqRes_A[numSamples]=xfreq(0);
	numSamples++;
	/*
	 * Check if nfft samples read in
	 */
	if(numSamples == 2*nfft) {
		for(i=0; i
    
Top

Wrapup Code



 

	free(impRes_A);
	free(freqRes_A);




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



 

/*
 *

freqimp


Calculate impulse response from frequency response


Sasan H. Ardalan

 *
 */