⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compnent.cpp

📁 这个我写的一个计算LC滤波器的程序
💻 CPP
字号:
// Compnent.cpp: implementation of the CCompnent class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Fileter.h"
#include "Compnent.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CCompnent::CCompnent()
{
	Value0=0;
}
CCompnent::CCompnent(double value)
{
	Value0=value;
}
CCompnent::~CCompnent()
{

}
CComplex_num CCompnent::GetComplexVal(double frequence)
{
	return CComplex_num(0,Value0);
}

///////////////////////////////////////////////
//THE R COMPNENT
CRCompnent::CRCompnent():CCompnent()
{
}
CRCompnent::CRCompnent(double value):CCompnent(value)
{
}
CComplex_num CRCompnent::GetComplexVal(double Frequence)
{
	return CComplex_num(Value0,0);
}
///////////////////////////////////////////////
//THE C COMPNENT
CCCompnent::CCCompnent():CCompnent()
{
	RValue=1e10;
}

CCCompnent::CCCompnent(double value):CCompnent(value)
{
	RValue=1e10;
}

CCCompnent::CCCompnent(double value,double rval):CCompnent(value)
{
	RValue=rval;
}

CComplex_num CCCompnent::GetComplexVal(double Frequence)
{
	if(Frequence<1.0) Frequence=1;
	if(Value0<1e-17) Value0=1e-17;

	CComplex_num CVal=CComplex_num(0,-1.0/(2*PI*Frequence*Value0));
	CComplex_num RVal=CComplex_num(RValue,0);

	return CVal%RVal;
}
///////////////////////////////////////////////
//THE L COMPNENT
CLCompnent::CLCompnent():CCompnent()
{
	RValue=0;
}
CLCompnent::CLCompnent(double value):CCompnent(value)
{
	RValue=0;
}
CLCompnent::CLCompnent(double value,double Rval):CCompnent(value)
{
	Value0=value;
	RValue=Rval;
}

CComplex_num CLCompnent::GetComplexVal(double Frequence)
{
	return CComplex_num(RValue,2*PI*Frequence*Value0);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -