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:
您先试一下,若是有其他问题欢迎随时发帖