当前位置: 代码迷 >> 综合 >> C++实现传递函数的波特图
  详细解决方案

C++实现传递函数的波特图

热度:10   发布时间:2024-02-04 23:45:00.0
#ifndef BODE_H
#define BODE_H
/******************************************************************************
* 文件       :    bode.h
* 作者       :    dhs
* 版本       :    V1.0
* 日期       :    2020-7-31
* 描述       :    给定传递函数绘制,计算对应的波特图坐标的数据(幅值、相角)
*
******************************************************************************/
#include <complex>
#include <cmath>
using namespace std;#define PI 3.1415926535
/*传递函数结构体*/
struct TransferFunctiona
{double num[10]; //传递函数分子项double den[10]; //传递函数分母项char  n;       //分子个数char  d;       //分母个数
};
/*幅值、相角结构体*/
struct BodeNum
{double mag;      //幅值 dbdouble phase;    //相角 度(角度)
};
/*频率、角频率结构体*/
struct fre
{double f;       //频率 Hzdouble w;       //角频率 rad/s
};
class Bode
{
public:Bode(struct TransferFunction TF);  //传入传递函数~Bode();struct BodeNum *compute();         //完成计算struct fre *logspace(int start, int stop, int num=50, int base=10.0);int getWlen(){return _wlen;}      /
  相关解决方案