当前位置:网站首页>matlab 画短时平均幅度谱
matlab 画短时平均幅度谱
2022-07-26 21:12:00 【胡刚2016】
和上一节 matlab 画短时能量图 的区别在于,上一节是求平方,现在是求绝对值。但是得到的图形和上一节一样,短时平均幅度谱 相比 短时能量谱 的好处在于节省计算量,而且不会出现计算溢出错误。
fid=fopen('zqq.txt', 'rt');
x=fscanf(fid, '%f');
fclose(fid);
%计算窗长为50,帧移=0时的语音能量
s=fra(50, 50, x);%帧长为50个数字,帧移为50个数字, 得到s为1319行,50列的矩阵。也就是每一行有50个数字,这50个数字为一帧
%disp(length(s2));
%disp(size(s2, 1));
%disp(size(s2, 2));
s2=abs(s);
%b=sum(a,dim); a表示矩阵;dim等于1或者2,1表示每一列进行求和,2表示每一行进行求和;表示每列求和还是每行求和;b表示求得的行向量
energy=sum(s2, 2);%对矩阵s2每一行求和, energy为1319行,1列,也就是每个数字代表一帧能量
%disp(size(energy, 1));
%disp(size(energy, 2));
subplot(2, 2, 1);
plot(energy);
xlabel('帧数');
ylabel('短时能量E');
legend('窗长N=50');
axis([0, 1500, 0, 10*10^5]);
%计算窗长为100,帧移=0时的语音能量
s=fra(100, 100, x);
s2=abs(s);
energy=sum(s2, 2);
subplot(2, 2, 2);
plot(energy);
xlabel('帧数');
ylabel('短时能量E');
legend('窗长N=100');
axis([0, 750, 0, 2*10^6]);
%计算窗长为400,帧移=0时的语音能量
s=fra(400, 400, x);
s2=abs(s);
energy=sum(s2, 2);
subplot(2, 2, 3);
plot(energy);
xlabel('帧数');
ylabel('短时能量E');
legend('窗长N=400');
axis([0, 190, 0, 7*10^6]);
%计算窗长为800,帧移=0时的语音能量
s=fra(800, 800, x);
s2=abs(s);
energy=sum(s2, 2);
subplot(2, 2, 4);
plot(energy);
xlabel('帧数');
ylabel('短时能量E');
legend('窗长N=800');
axis([0, 95, 0, 14*10^6]);
function f=fra(len, inc, x)
%len为帧长,inc为帧长一帧移
%size(X,1),返回矩阵X的行数;
%size(X,2),返回矩阵X的列数;
%disp(size(x, 1));
fh=fix(((size(x, 1) - len)/inc) + 1);%计算帧数,fh=1319
%disp(fh);
f=zeros(fh, len);%fh行,len列的0矩阵,这里是1319行,50列的0矩阵
i=1; n=1;
while i<=fh
j=1;
%下面的循环是每次循环一次填满一行50个数字,也就是一帧,填满一行以后,将行数加1后再次填
while j<=len
f(i, j)=x(n);
j=j+1;
n=n+1;
end
n=n-len+inc;% n-len代表将恢复到上帧的末尾,+inc的意思是在上一帧的末尾再移动inc长度
i=i+1;
end
end

边栏推荐
- Shrimp Shope takes the commodity list API according to keywords
- Go----Go 语言命名规范
- Search Yiwu shopping (PAI Li Tao) API by image
- 三星发布1.08亿像素图像传感器ISOCELL Bright HMX,小米将首发
- 按关键字搜索易贝商品 API
- A unified label space for entity relationship extraction
- 日本批准向韩出口EUV光刻胶,三星、SK海力士危机或将缓解
- Circular progress bar animation based on cashapelayer and Bezier curve
- 方法重载与方法重写
- Pytoch uses RNN model to build person name classifier
猜你喜欢

Resume in 2022 is dead in the sea. Don't vote. Software testing positions are saturated

补充—非线性规划

Use of cmake

从手动测试,到自动化测试老司机,只用了几个月,我的薪资翻了一倍

If you do not add waitkey() function after imshow() function, it will not be displayed

技术分享 | 服务端接口自动化测试, Requests 库的这些功能你了解吗?

cmake编译obs-studio-27.2.0

Flink 在讯飞 AI 营销业务的实时数据分析实践

逻辑漏洞----任意账号注册

吃透负载均衡
随机推荐
Leetcode exercise - Sword finger offer II 005. maximum product of word length
基于memcache的缓存机制的6个指令
Go----Go语言中的变量使用方法
Object. getOwnPropertyNames() VS Object.keys()
Pytorch torch.add() torch.add_() 用法
Shangtang technology releases sensepass pro, an all-in-one face recognition machine
同花顺上面开户安全吗,开户怎么选券商
Method overloading and method rewriting
Solution to the problem of sticking and unpacking TCP
AFNetworking了解
Uncover the secrets of Xiaomi 100million pixel camera: 1/1.3 inch COMS sensor, resolution 12032 × nine thousand and twenty-four
深入源码剖析String类为什么不可变?(还不明白就来打我)
Pbootcms一级栏目下的二级三级栏目高亮
kalibr标定realsenseD435i --多相机标定
任正非再谈美国打压:活下去就是胜利,要战胜美国
LDAP——实现用户统一登录管理
FreeRTOS personal notes - Software Timer
When deploying Flink on a single machine and creating the connection table of oracle19c RAC, the error ora-12505 is reported. Who can help
小米1亿像素摄像头揭秘:1/1.3英寸COMS传感器、分辨率12032×9024
A bowl of noodles in a dream