当前位置:网站首页>matlab 短时自相关实现
matlab 短时自相关实现
2022-07-26 21:12:00 【胡刚2016】
使用的voice.txt内容如下,是由很多行组成的

fid=fopen('voice.txt', 'rt');
x=fscanf(fid, '%f');
fclose(fid);
%矩形窗做自相关
s1=x(1: 320);%取数组x的前320个数字
N=320;
A=[];
for k=1:320
sum=0;
for m=1:N-k+1
sum=sum+s1(m)*s1(m+k-1);%自相关
end
A(k)=sum;
end
disp(A);
for k=1:320
A1(k)=A(k)/A(1); %归一化A(k);
end
%hamming窗做自相关
f=zeros(1, 320);
n=1;
j=1;
while j<=320
f(1, j)=x(n)*[0.54-0.46*cos(2*pi*n/319)];%x(n)*hamming窗
j=j+1;
n=n+1;
end
B=[];
for k=1:320
sum=0;
for m=1:N-k+1
sum=sum+f(m)*f(m+k-1);%自相关
end
B(k)=sum;
end
for k=1:320
B1(k)=B(k)/B(1);%归一化
end
s2=s1/max(s1);
figure(1);
subplot(3,1,1);
plot(s2);
xlabel('样点数');
ylabel('幅值');
axis([0, 320, -1, 1]);
subplot(3, 1, 2);
plot(A1);
xlabel('延时k');
ylabel('R(k)');
axis([0, 320, -1, 1]);
subplot(3,1,3);
plot(B1);
xlabel('延时k');
ylabel('R(k)');
axis([0, 320, -1, 1]);

边栏推荐
- Object. getOwnPropertyNames() VS Object.keys()
- 方法重载与方法重写
- Solution to the problem of sticking and unpacking TCP
- Leetcode exercise - Sword finger offer II 005. maximum product of word length
- 月薪5万的朋友告诉我,你只是在打杂
- 谈谈 TCP 的 TIME_WAIT
- What to do if the browser home page is tampered with, and how to recover if the home page is tampered with
- Pytorch torch. add() torch. add_ () usage
- 商汤科技发布人脸识别一体机SensePass Pro
- 六、微信小程序发布流程
猜你喜欢
随机推荐
Arm Mali GPU的噩梦:三星、华为纷纷转向自研!
Also on Data Governance
Smooth scroll to element
A friend with a monthly salary of 50000 told me that you were just doing chores
Filtering and distortion
仅需一个依赖给Swagger换上新皮肤,既简单又炫酷
In depth interpretation of happens before principle
虾皮shopee根据关键词取商品列表 API
七月集训(第26天) —— 并查集
Oppo self-developed large-scale knowledge map and its application in digital intelligence engineering
Li Kou daily question - day 43 -168. Name of Excel table column
Tester: "I have five years of testing experience" HR: "no, you just used one year of work experience for five years."
小米1亿像素摄像头揭秘:1/1.3英寸COMS传感器、分辨率12032×9024
Uncover the secrets of Xiaomi 100million pixel camera: 1/1.3 inch COMS sensor, resolution 12032 × nine thousand and twenty-four
京东一面:Redis 如何实现库存扣减操作?如何防止商品被超卖?
Flink 在讯飞 AI 营销业务的实时数据分析实践
5、 Applet error: message:error: system error, error code: 80058, desc of scope userLocation is empty
按图搜索义乌购商品(拍立淘) API
Selenium自动化测试面试题全家桶
Jd.com: how does redis realize inventory deduction? How to prevent goods from being oversold?








