请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
部件号:TMS320C5505 工具/软件:Code Composer Studio
大家好,
是否有人知道如何在c代码中实现集成?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
工具/软件:Code Composer Studio
大家好,
是否有人知道如何在c代码中实现集成?
您好,
首先,感谢您的快速回复。
我正在使用参数扬声器。 在这些扬声器中,我们调节高频超声波载波信号上的音频信号(信封),并将此调制信号发送到空中。 收听者听到的声音与信封平方的第二次派生成正比。
因此,我的目标是读取音频输入,集成它,然后是平方根,然后将这个平方根信号用作封套。
我不知道如何编写代码来集成音频信号,然后再取其平方根。
如果可以,请提供帮助。
谢谢,此致,
Satyajit
您已接近有效值算法:
en.wikipedia.org/.../Root_mean_square
不要对 正输入。
假设样本数量相等,则需要对一组值求和,然后除以时间间隔。
我做了一个实验。 通过计算数据子集的平均值,我可以获得以下数据:
这与集成非常接近。 但是,如果平均间隔=得到此值的时间段:
这在您思考时是有意义的。 代码如下:
因为它吸引了我,我做了一个实验。 代码为C#,因此您可能需要调整一下: const int points =5万; const int cycles = 5; const int intpoints =1万; float[] datSine =新float[points]; float[] datInt =新float[points]; float[] datrm =新float[points]; 对于(int i = 0;i <点;I++) { datSine[i]=(浮点) Math.Sin (2 * Math.PI * I*周期/点); datInt[i]= 0.0f; } 对于(int i = intpoints / 2;i < points - intpoints / 2;I++) { 如果(I >点- 1)断裂; 浮点和=0; FLOAT SUMSQ = 0; 对于(int j = i;j < i + intpoints;j++) { 如果(j >点- 1)断裂; SUM ++ datSine[j]; SUMSQ += datSne[j]* datSne[j]; } datInt[i]=总和/点; datrms[i]=(float) Math.sqrt(SUMSQ / intpoints); }