資源簡(jiǎn)介
用C編的互相關(guān)程序,與matlab中的xcorr相對(duì)應(yīng),correlation
代碼片段和文件信息
#include?
#include?
#include?
#define?NN?10
void?xcorr(float?*r?unsigned?short?*x?unsigned?short?*y?int?N);
int?main()
{??
????unsigned?short?x[10]={1122345678};
????unsigned?short?y[10]={1345678952};
????float?r[19]?=?{0};
????
????FILE?*fp_out;
????int?delay;
????
????xcorr(r?x?y?NN);
//Open?the?file?to?write
????if((fp_out=fopen(“out_xcorr.txt““wt“))?==?NULL)
{
????printf(“Cannot?open?this?file!\n“);
exit(0);
}
for(delay?=?-NN?+?1;?delay?????????fprintf(fp_out“%d?%f\n“delayr[delay?+?NN
評(píng)論
共有 條評(píng)論