当前位置:网站首页>matlab 基音周期估计后处理
matlab 基音周期估计后处理
2022-07-26 21:12:00 【胡刚2016】
fid=fopen('zhouqi.txt', 'rt');
zhouqi=fscanf(fid, '%f');
fclose(fid);
zhouqi0=medfilt1(zhouqi, 5);
zhouqi1=medfilt1(zhouqi0, 3);
zhouqi2=linsmooth(zhouqi0, 5);
w=[];
w=zhouqi;
w1=w-zhouqi2;
w1=linsmooth(w1, 5);
zhouqi3=w1+zhouqi2;
v=[];
v(1)=0;v(2)=0;v(3)=0;v(4)=0;
for i=1:(length(zhouqi) - 4)
v(i+4)=zhouqi(i);
end
%v(:,1)为取v矩阵中第一列元素
%v(1,:)为取v矩阵中第一行元素
%v(:)矩阵v转换为一个行向量,就是一行
%例如:
%>> A = rand(2,3)
%
%A =
%0.6925 0.3965 0.7802
%0.5567 0.0616 0.3376
%>> B = A(:)
%B =
%0.6925
%0.5567
%0.3965
%0.0616
%0.7802
v=v(:);
v1=v-zhouqi2;
v1=medfilt1(v1, 5);
v1=linsmooth(v1, 5);
zhouqi4=v1+zhouqi2;
figure(1);
subplot(511);
plot(zhouqi);
xlabel('帧数');
ylabel('样点数');
title('原始基音周期轨迹')
subplot(512);
plot(zhouqi1);
xlabel('帧数');
ylabel('样点数');
axis([0, 360, 0, 150]);
title('五点中值平滑和三点中值平滑组合')
subplot(513);
plot(zhouqi2);
xlabel('帧数');
ylabel('样点数');
axis([0, 360, 0, 150]);
title('五点中值平滑和五点线性平滑组合')
subplot(514);
plot(zhouqi3);
xlabel('帧数');
ylabel('样点数');
axis([0, 360, 0, 150]);
title('二次平滑算法')
subplot(515),plot(zhouqi4);
xlabel('帧数')
ylabel('样点数')
axis([0,360,0,150])
title('加延时的二次平滑算法')
function [y]=linsmooth(x, n)
%disp(size(x));% x 是360行,1列的矩阵
win=hann(n);
win=win/sum(win); % 归一化
%disp(size(win));
disp(win);
[r,c]=size(x);%size(x)返回 [行数,列数]
if min(r,c)~=1 % ~=代表不等于
error('sorry, no matrix here!:')
end
if r==1 % 行向量
len=c;
else % 列向量
len=r;
x=x.';% 将列向量转置为行向量
end
%disp(len);
%走到这里 x 一定是行向量
y=zeros(len,1);
if mod(n,2)==0 %返回用 m 除以 2 后的余数
m=n/2;
x = [ones(1,m)*x(1) x ones(1,m)*x(len)]';
else
m=(n-1)/2; %这里实验的n=5, m=2
x = [ones(1,m)*x(1) x ones(1,m+1)*x(len)]';%生成新的数组,在数组 x 前面加2个元素,在数组 x 后面加3个元素
end
for k=1:len
y(k) = win'*x(k:k+n-1); % 一行五列 * 五行一列
end
end

边栏推荐
- Flink's real-time data analysis practice in iFLYTEK AI marketing business
- Uncover the secrets of Xiaomi 100million pixel camera: 1/1.3 inch COMS sensor, resolution 12032 × nine thousand and twenty-four
- When deploying Flink on a single machine and creating the connection table of oracle19c RAC, the error ora-12505 is reported. Who can help
- 月薪5万的朋友告诉我,你只是在打杂
- Shrimp Shope takes the commodity list API according to keywords
- Japan approves the export of EUV photoresist to South Korea, and the crisis of Samsung and SK Hynix may be alleviated
- 虾皮shopee根据ID取商品详情 API
- 分布式 session 的4个解决方案
- 成功上岸了自动化测试岗,最高月薪15.4K,自己真棒~
- Technology sharing | do you know the functions of the server interface automated testing and requests library?
猜你喜欢
随机推荐
仅需一个依赖给Swagger换上新皮肤,既简单又炫酷~
Dream weaving prompt dedecms error:tag disabled:php!
基于CAShapeLayer和贝塞尔曲线的圆形进度条动画
My SQL is OK. Why is it still so slow? MySQL locking rules
1 - "pytorch deep learning practice" - linear model
Li Kou daily question - day 43 -168. Name of Excel table column
【音视频】ijkplayer播放器参数说明文档
Four solutions of distributed session
传三星从比利时获得EUV光刻胶
Isilon's onefs common operation commands (I)
I successfully landed the automatic testing post, with a maximum monthly salary of 15.4k. I'm great~
Technology sharing | do you know the functions of the server interface automated testing and requests library?
Japan approves the export of EUV photoresist to South Korea, and the crisis of Samsung and SK Hynix may be alleviated
(C语言)文件的基本操作
Thoroughly understand the principle and implementation of service discovery
45. Instance segmented labelme dataset to coco dataset and coco dataset to labelme dataset
ansible安装及使用
LDAP——实现用户统一登录管理
When deploying Flink on a single machine and creating the connection table of oracle19c RAC, the error ora-12505 is reported. Who can help
npm, npm中文文档, npm学习使用









