Click here to Skip to main content
15,921,905 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Working with CFile!!!! Pin
Maxwell Chen28-Jan-08 22:04
Maxwell Chen28-Jan-08 22:04 
GeneralRe: Working with CFile!!!! Pin
Cedric Moonen28-Jan-08 22:12
Cedric Moonen28-Jan-08 22:12 
GeneralRe: Working with CFile!!!! Pin
Maxwell Chen28-Jan-08 22:16
Maxwell Chen28-Jan-08 22:16 
GeneralRe: Working with CFile!!!! Pin
Cedric Moonen28-Jan-08 22:06
Cedric Moonen28-Jan-08 22:06 
GeneralRe: Working with CFile!!!! Pin
rowdy_vc++28-Jan-08 22:38
rowdy_vc++28-Jan-08 22:38 
GeneralRe: Working with CFile!!!! Pin
Maxwell Chen28-Jan-08 23:05
Maxwell Chen28-Jan-08 23:05 
GeneralRe: Working with CFile!!!! Pin
Rajesh R Subramanian28-Jan-08 22:51
professionalRajesh R Subramanian28-Jan-08 22:51 
QuestionProblem in AfxBeginThread Pin
gReaen28-Jan-08 21:35
gReaen28-Jan-08 21:35 
GeneralRe: Problem in AfxBeginThread Pin
Cedric Moonen28-Jan-08 22:01
Cedric Moonen28-Jan-08 22:01 
GeneralRe: Problem in AfxBeginThread Pin
Iain Clarke, Warrior Programmer28-Jan-08 22:34
Iain Clarke, Warrior Programmer28-Jan-08 22:34 
GeneralRe: Problem in AfxBeginThread Pin
gReaen28-Jan-08 23:11
gReaen28-Jan-08 23:11 
GeneralPlot graph using MFC Pin
Kennis28-Jan-08 21:34
Kennis28-Jan-08 21:34 
GeneralRe: Plot graph using MFC Pin
Cedric Moonen28-Jan-08 21:44
Cedric Moonen28-Jan-08 21:44 
GeneralRe: Plot graph using MFC Pin
Maxwell Chen28-Jan-08 21:48
Maxwell Chen28-Jan-08 21:48 
GeneralOops! Pin
Maxwell Chen28-Jan-08 21:52
Maxwell Chen28-Jan-08 21:52 
QuestionRe: Plot graph using MFC Pin
CPallini28-Jan-08 22:50
mveCPallini28-Jan-08 22:50 
GeneralRe: Plot graph using MFC Pin
Iain Clarke, Warrior Programmer28-Jan-08 23:07
Iain Clarke, Warrior Programmer28-Jan-08 23:07 
GeneralRe: Plot graph using MFC Pin
Maxwell Chen28-Jan-08 23:10
Maxwell Chen28-Jan-08 23:10 
QuestionRe: Plot graph using MFC Pin
Mark Salsbery29-Jan-08 5:57
Mark Salsbery29-Jan-08 5:57 
GeneralRe: Plot graph using MFC Pin
Kennis29-Jan-08 16:24
Kennis29-Jan-08 16:24 
GeneralRe: Plot graph using MFC Pin
Mark Salsbery30-Jan-08 5:08
Mark Salsbery30-Jan-08 5:08 
QuestionRe: Plot graph using MFC Pin
Mark Salsbery30-Jan-08 5:15
Mark Salsbery30-Jan-08 5:15 
GeneralRe: Plot graph using MFC Pin
Kennis30-Jan-08 15:06
Kennis30-Jan-08 15:06 
Questioncould anyone tell me what's the error with this code? Pin
ashwiny28-Jan-08 20:14
ashwiny28-Jan-08 20:14 
// nonrec.cpp -- non-recursive filter design

// NRLowPass() build NR low-pass filter
// NRHighPass() build NR high-pass filter
// NRBandPass() build NR band-pass filter

#include "tools.h"
#include "ltisys.h"

// sinc() or sin(x)/x function
double sinc(double x)
{
if (x==0)
return cos(x);
else
return sin(x)/x;
}

// Create non-recursive low-pass filter by Fourier Transform method
LTISystem NRLowPass(
double freq, // corner freq (fraction of sampling rate)
int ncoeff // # coefficients
) // returns LTI system to specification
{
int i;

// convert frequency
double omega = 2 * PI * freq;

// build half-sized window from sinc function
int nhalf = ncoeff/2;
Waveform hwv(nhalf,1.0);
for (i=1;i<=nhalf;i++)
hwv[i] = omega * sinc(i*omega)/PI;

// window with (half-)hamming window
for (i=1;i<=nhalf;i++)
hwv[i] *= 0.54 + 0.46 * cos(i*PI/nhalf);

// create new LTI System
LTISystem lpfilt(2*nhalf,0);

// copy impulse response into system
// (indexed -nhalf .. 0 .. nhalf)
lpfilt.a[nhalf] = omega/PI;
for (i=1;i<=nhalf;i++) {
lpfilt.a[nhalf-i] = hwv[i];
lpfilt.a[nhalf+i] = hwv[i];
}

return lpfilt;
}




// create high-pass non-recursive filter from low-pass prototype
LTISystem NRHighPass(
double freq, // corner freq (fraction of sampling rate)
int ncoeff // # coefficients
) // returns LTI system
{
// get low-pass version
LTISystem hpfilt = NRLowPass(0.5-freq,ncoeff);

// now modulate with cos(n*PI) = +1,-1,+1,-1,...
int nhalf = hpfilt.a.count()/2;
for (int i=1;i<=nhalf;i+=2) {
hpfilt.a[nhalf-i] = -hpfilt.a[nhalf-i];
hpfilt.a[nhalf+i] = -hpfilt.a[nhalf+i];
}

return hpfilt;
}

// create band-pass non-recursive filter from low-pass prototype
LTISystem NRBandPass(
double lofreq, // low corner freq (fraction of sampling rate)
double hifreq, // high corner freq (fraction of sampling rate) }
int ncoeff // # coefficients
) // returns LTI system
{
// get low-pass prototype
LTISystem bpfilt = NRLowPass((hifreq-lofreq)/2,ncoeff);

// now modulate with cos(n*centrefreq)
int nhalf = bpfilt.a.count()/2;
double cf = 2*PI*(lofreq+hifreq)/2;
bpfilt.a[nhalf] = 2 * bpfilt.a[nhalf];
for (int i=1;i<=nhalf;i++) {
bpfilt.a[nhalf-i] = 2 * bpfilt.a[nhalf-i] * cos(i*cf);
bpfilt.a[nhalf+i] = 2 * bpfilt.a[nhalf+i] * cos(i*cf);
}

return bpfilt;
}
AnswerRe: could anyone tell me what's the error with this code? Pin
Stephen Hewitt28-Jan-08 20:15
Stephen Hewitt28-Jan-08 20:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.