网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
08月15日漏签0天
matlab吧 关注:291,898贴子:1,658,389
  • 看贴

  • 图片

  • 吧主推荐

  • 游戏

  • 1回复贴,共1页
<<返回matlab吧
>0< 加载中...

MATLAB报错:Vectors must be the same lengths.怎么解决?

  • 只看楼主
  • 收藏

  • 回复
  • 雪鱼汉堡包
  • 无名之辈
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
报错是:
??? Error using ==> plot
Vectors must be the same lengths.
程序是计算语音短时能量
程序如下
clear all; clc; close all;
%Open speech file and read the data in it
[speechSignal Fs]=wavread('E:\CoolEdit_Recording\speech.wav');
%Energy is calculated every period samples
period=50;
%4 different window lengths
winLens=[161 321 501 601];
nWindows=length(winLens);
k=0;
for i=1:nWindows
%i=1;
iWinLen=winLens(i);
k=k+1;
wHamm=hamming(iWinLen);
%Short-Time energy calculation
ienergyST=STenergy1(speechSignal,wHamm,iWinLen,period);
%plot(ienergyST)
%break
%Time in second for the graph
t=(0:length(speechSignal)-1)/Fs;
%Display results
subplot(nWindows,1,k);
delay=(iWinLen-1)/2;
plot(t(delay+1:iWinLen-period:end-delay),ienergyST);
if (k==1)
title('Short-Time energy for various Hamming windows lengths');
end
if (k==4)
xlabel('Time/sec');
end
legend(['Window length:',num2str(iWinLen),'Samples']);
end
%STenergy M函数
%计算短时能量的M文件
function f=STenergy1(speechSignal,wHamm,winLen,winOverlap)
%Framing and windowing the singnal without loops.
sigFramed=buffer2(speechSignal,winLen,winOverlap);
sigWindowed=diag(sparse(wHamm))*sigFramed;
%Calculate the short time energy
f=sum(sigWindowed.^2,1);
function out = buffer2(y, frameSize, overlap)
% buffer2: Frame blocking
% Usage: out = buffer2(y, frameSize, overlap)
% This is almost the same as "buffer" except that there is no leading/trailing zeros
% Roger Jang, 20010908
if nargin<3, overlap=0; end
if nargin<2, frameSize=256; end
y = y(:);
step = frameSize-overlap;
frameCount = floor((length(y)-overlap)/step);
out = zeros(frameSize, frameCount);
for i=1:frameCount,
startIndex = (i-1)*step+1;
out(:, i) = y(startIndex:(startIndex+frameSize-1));
end
请问要怎么办?急!在线等!


  • 我家狗狗叫壮壮
  • 武林高手
    9
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
Plot的两参数维度不一样


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 1回复贴,共1页
<<返回matlab吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示