(1)程序代码之 头文件
// SigTranmit.h: interface for the SigTranmit class.
//
//
#if !defined(AFX_SIGTRANMIT_H__1E1D11BF_1E65_4834_9496_4E5CAA470F68__INCLUDED_)
#define AFX_SIGTRANMIT_H__1E1D11BF_1E65_4834_9496_4E5CAA470F68__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define PI 3.1415926
#define N 63
#define T 0.005
#define M 20
#define freq 4000
#define fh 200
#define fc 1000
class SigTranmit
{
public:
SigTranmit();
virtual ~SigTranmit();
void SetDigtal(int ID, int Intensity);
void Basesignal();
void Lpf();
void modulate();
void Channel();
void Bpf();
void Demodulate();
void Adjust();
void Dft(float x[],int m);
void Idft(float h[]);
void Hnc();
void Hmc();
void Blkmc();
void Conv(float array1[],float array2[]);
void Noise(int inten);
void SetHl(float H[]);
void SetHb(float H[]);
void Setc(int Myc);
int GetmyIntensity();
int Getc();
float* GetSa();
float* GetA();
float* GetHl();
float* GetH2();
float* GetHb();
float* GetNo();
private:
int myID;
int myIntensity;
int c;//用来存放创函数选择
int S0[16];
int S1[16];
float Mod[16*M];
float Sa[16*M];//用来存放信号
float Sal[16*M];
float AR[16*M];
float AI[16*M];
float A[16*M];//用来存放频域幅值
float Hl[16*M];//生成的低通滤波器的响应
float H2[16*M];进行IDFT的数据
float No[16*M];//用来存放生成的噪声
float Hb[N];//用来存放带通频域数据
float P[N];
float Wn[N];
};
#endif // !defined(AFX_SIGTRANMIT_H__1E1D11BF_1E65_4834_9496_4E5CAA470F68__INCLUDED_)
(2)程序代码之 源文件
// SigTranmit.cpp: implementation of the SigTranmit class.
//
//
#include "stdafx.h"
#include "计算机仿真.h"
#include "SigTranmit.h"
#include "math.h"
#include "stdio.h"
#include "stdlib.h"
#include "iostream"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//