Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

If N = 75, find the value of the Hamming window coefficient for n = -5 Solution

ID: 641985 • Letter: I

Question

If N = 75, find the value of the Hamming window coefficient for n = -5

Explanation / Answer

#include #include #include #include #include #include #define MAXFILT 200 /* maximum dimension for filter */ #define WDIM 640 /* width of VGA graphics screen */ #define pi 3.141592653589793 float fwind[MAXFILT+1],h[MAXFILT+1],fw[MAXFILT+1]; #define SEEDIM 200 #define HDIM 480 float fSEE[SEEDIM + 1], fH[HDIM + 1], fW[WDIM + 1]; /* ******************* Variables for ************************* **** NONRECURSIVE FILTER DESIGN WITH THE KAISER WINDOW **** */ int iCount, iCount2, iX, iM; float fM, fP, fQ, fR, fSHz, fT, fA, fA0, fB, fC, fD, fALPHA, fBETA, fTEMP, fI, fH0, fW0, fW1, fFREQ, fMax, fDB; /* Prototypes */ void Beep( int frequency, int duration ); void mySleep( clock_t wait ); main() { int n, n2, m, wtype, ndb, type, flag_graphics, dummy, color, status, control; float fwT0=0.0, fwT1=0.0, fa=0.0, fb=0.0, fc, fd=0.0; float ffreq=0.0, fmax=1.0, fdb=0.0, fs=0.0; float fmax_lynn=1.0; //_clearscreen(_GCLEARSCREEN); /* Save speaker control byte. */ control = _inp( 0x61 ); /* Turn off the speaker (with bits 0 and 1). */ _outp( 0x61, control & 0xFC ); printf("FIRFILT: "); printf("FIR filter design using Fourier series. "); printf("impulse response truncated to 2M+1 terms. "); printf("Choice of windows: "); printf("Rectangular, "); printf("von Hann, "); printf("Hamming,"); printf("Blackman or "); printf("Kaiser. "); printf(" Enter type of filter: "); printf(" 0=low-pass; 1=high pass; 2=bandpass; 3=band-reject: "); scanf("%d",&type); while((type3) { printf(" 0=low-pass; 1=high pass; 2=bandpass; 3=band-reject"); printf(" Please type integer value between 0 and 3: "); scanf("%d",&type); } while((fa>=fs/2)||(fb>=fs/2)) { printf("Enter sampling frequency (in Hertz): "); scanf("%f",&fs); // printf("%f ",fs); switch(type) { /* 0: Low-pass */ case 0: printf("Enter cutoff frequency (in Hertz): "); scanf("%f",&fa); break; /* 1: High pass */ case 1: printf("Enter cutoff frequency (in Hertz): "); scanf("%f",&fa); break; /* 2: Band-pass */ case 2: printf("Enter lower cutoff frequency (in Hertz): "); scanf("%f",&fa); printf("Enter higher cutoff frequency (in Hertz): "); scanf("%f",&fb); break; /* 3: Band-reject */ case 3: printf("Enter lower cutoff frequency (in Hertz): "); scanf("%f",&fa); printf("Enter higher cutoff frequency (in Hertz): "); scanf("%f",&fb); break; } } printf("Enter code for choice of window: "); printf("0=rectangular (Boxcar); 1=von Hann; 2=Hamming; 3=Blackman; 4=Kaiser: "); scanf("%d",&wtype); fwT0 = 2.0 * pi * fa / fs; fwT1 = 2.0 * pi * fb / fs; //printf(" fa=%.6f, fb=%.6f, fwT0=%.6f, fwT1=%.6f ",fa,fb,fwT0,fwT1); //getch(); /* Calculating values for windows */ switch(wtype) { /* 0: Rectangular (Boxcar) */ case 0: fa =1; fb = 0; fc=1; break; /* 1: von Hann */ case 1: fa =0.5; fb = 0.5; fc=(float)m + 1.0; break; /* 2: Hamming */ case 2: fa =0.54; fb = 0.46; fc=(float)m; break; /* 3: Blackman */ case 3: fa =0.42; fb = 0.5; fc=(float)m; fd = 0.08; break; /* 4: Blackman */ case 4: // Kaiser break; } if(wtypeMAXFILT) { printf("Enter (integer) order M (max=%d): ",MAXFILT); scanf("%d",&m); } } if(wtype 49.0) fALPHA = 0.1102 * (fA - 8.7); else if (fA > 21) fALPHA = 0.5842 * pow((fA - 21.0), 0.4) + (0.07886 * (fA - 21.0)); else fALPHA = 0; printf (" For this window, ALPHA = %f ", fALPHA); printf ("Press any key to start..."); getch(); /* ******************* COMPUTE WINDOW VALUES ***************** */ for (iCount = 0; iCount
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote