RT
如果有的话。
做作业要用的,非常紧急。

解决方案 »

  1.   

    其实就是这样一个题目:
    x(t)->【抽样】-->【h(n)】-->【重构】-->y(t)
    x(t)-->【h(t)】-->y1(t)
    在【】内的表示系统环节
    问如何选择h(n),如何抽样,如何重构,使y(t)=y1(t)
      

  2.   

    google "the MFFM FFTw Wrapper library"
    下载很早了,也忘了原来从哪里弄得.
    它是一个tc下的fft库,他提供了一个例子,你先看看能不能用:
    #include <fstream>
    #include <iomanip>#include <rfftw.h>#define INPUTFILE "audio.raw.txt"
    #define OUTPUTFILE "audio.fft.txt"main (){
      ifstream input(INPUTFILE);
      ofstream output(OUTPUTFILE);
      int count=0;
      short int var;
      // Get the file size ...
      if (!input){
        cout <<"input not opened !"<<endl;
        exit(-1);
      }
      while (input >> var)
        count++;
      input.close();
      
      // alloc memory for the data
      short int *data = new short int[count];
      if (!data){
        cout << "Couldn't allocate the array"<<endl;
        exit(-1);
      }  input.open(INPUTFILE);  // alloc memory for the fft :
      // init the rfftw
      fftw_real in[count], out[count], power_spectrum[count/2+1];
      rfftw_plan p;
      int k;
      cout <<"creating plan ... "<<'\t';
      p = rfftw_create_plan(count, FFTW_REAL_TO_COMPLEX, FFTW_ESTIMATE);
      cout << "created"<<endl;  // read data into data and rdata :
      for (int i=0; i<count; i++){
        input >> data[i];
        in[i] = (double)data[i];
      }
      input.close();  // forward transform :
      rfftw_one(p, in, out);
      power_spectrum[0] = out[0]*out[0];  /* DC component */
      for (k = 1; k < (count+1)/2; ++k)  /* (k < N/2 rounded up) */
        power_spectrum[k] = out[k]*out[k] + out[count-k]*out[count-k];
      if (count % 2 == 0) /* N is even */
        power_spectrum[count/2] = out[count/2]*out[count/2];  /* Nyquist freq. */  rfftw_destroy_plan(p);  // output to file :
      for (int i=0; i<(count+1)/2; i++){
        output << power_spectrum[i]<<' ';
      }
      cout <<(count+1)/2<<endl;
      output.close();  delete [] data;
    }