当前位置:网站首页>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

边栏推荐
- :active vs :focus
- Oppo self-developed large-scale knowledge map and its application in digital intelligence engineering
- Basic operation of (C language) files
- Attack and defense world ----- ics-07
- Finding a new direction for the development of digital retail is the key to ensure that digital retail can enter a new stage of development
- 分布式 session 的4个解决方案
- 测试员:“我有五年测试经验”HR: “不,你只是把一年的工作经验用了五年”
- Dream weaving prompt dedecms error:tag disabled:php!
- Flag decodes token, mounts token, decorator, and seven cattle cloud upload
- Alkbh1
猜你喜欢

6、 Wechat applet release process

彻底搞通服务发现的原理和实现

A friend with a monthly salary of 50000 told me that you were just doing chores

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

测试员:“我有五年测试经验”HR: “不,你只是把一年的工作经验用了五年”

Content management tools, blue bookmarks are enough

也谈数据治理

Jd.com: how does redis realize inventory deduction? How to prevent goods from being oversold?

2022年简历石沉大海,别投了,软件测试岗位饱和了....

7、 Wechat applet running error: error: illegal appid, invalid appid
随机推荐
Ren Zhengfei talked about the suppression of the United States again: to live is to win, and to defeat the United States
45. Instance segmented labelme dataset to coco dataset and coco dataset to labelme dataset
The United States once again challenged: Forbidding contractors to purchase the equipment and technology of these five Chinese companies
Drag and drop table rows
Highlight the secondary and tertiary columns under the primary column of pbootcms
2022年简历石沉大海,别投了,软件测试岗位饱和了....
同花顺上面开户安全吗,开户怎么选券商
Supplement - nonlinear programming
5、 Applet error: message:error: system error, error code: 80058, desc of scope userLocation is empty
方法重载与方法重写
Pytoch squeeze() unsqueeze() usage
五、小程序报错:message:Error: 系统错误,错误码:80058,desc of scope.userLocation is empty
imshow()函数后面如果不加waitKey()函数就不显示
Props with type Object/Array must...
Selenium automated test interview questions family bucket
day07-
日本批准向韩出口EUV光刻胶,三星、SK海力士危机或将缓解
Can you use redis? Then come and learn about redis protocol
华为发布2025十大趋势:5G、机器人、AI等上榜
Use of cmake