TI中文支持网
TI专业的中文技术问题搜集分享网站

DSP28335 计算均方根

Other Parts Discussed in Thread:CONTROLSUITE

请问是否有函数库或者直接调用函数,对DSP28335计算均方根值,或者能提供对应C的算法

Susan Yang:

您可以在文件中包含“ math.h”,而后调用sqrt()函数。

,

user5197967:

这是求平方根,有求均方根的吗

,

Green Deng:

没有这个函数,只有平方根的。你可以自己编程实现,就是复制一点,,涉及①平方②求和③均分④开方。

,

Susan Yang:

我找了一下,在controlSUITE\development_kits\HV_SOLAR_DC_AC_v1.1\SolarHv_DCAC_PiccoloB_Rev_02的SolarHv_DCAC-main.c内有相关的计算函数,您可以参考一下

/*------------------------------------------------------------------------* Function Name: sRMSCal* Description: Calculate the RMS value of the AC sample* Parameter: dwSum --- The squre sum of the AC sample*dwRatio -- Q24 * dwRatio = Real value*wFormat -- The float point* -----------------------------------------------------------------------*/
int16sRMSCal(long dwSum,long dwRatio,int wFormat)
{_iq24 sqrt_in,sqrt_out;longdwTemp;int16 wTemp;sqrt_in = (long)(dwSum/wSumCnt);sqrt_out = _IQ24sqrt(sqrt_in);dwTemp = _IQ7mpyIQX(sqrt_out,24,dwRatio,18);wTemp = (int16)((long)dwTemp*wFormat>>7);return wTemp;
}

,

user5197967:

太感谢了

,

Susan Yang:

您先试一下,若是有其他问题欢迎随时发帖

赞(0)
未经允许不得转载:TI中文支持网 » DSP28335 计算均方根
分享到: 更多 (0)