Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
高级会员
注册日期: 2019-11-21
帖子: 3,006
声望力: 66 ![]() |
![]()
我将要介绍我在MATLAB中创建的工作,但是在使用plot函数将数据处理为可呈现的形式时遇到了麻烦。
我的代码如下所示: [inputname, pathname] = uigetfile('*.wav', 'Select WAV-file'); thumb1 = inputname; %# Get filename information fprintf('\n%s is being turned into a 30s thumbnail...\n', thumb1); fprintf('Please wait..!\n\n'); %# load the signal [y, fs, nb] = wavread(thumb1); y = mean(y,2); %# stereo, take avrg of 2 channels %# Calculate frame energy fWidth = round(fs*10e-3); %# 10ms numFrames = floor(length(y)/fWidth); energy = zeros(1,numFrames); for f=1:numFrames energy(f) = sum( y((f-1)*fWidth+1:f*fWidth).^2 ); end 基本上,我想绘制随时间变化的轨迹能量(以秒为单位)。 plot(energy) 几乎可以满足我的要求,但是在曲目的末尾我有非常少的空白空间,.wav文件中没有 ![]() 编辑1: 使用第一个建议的方法: ![]() 回答: 还有 axis tight 设置轴的“紧”限。参见文档: http : //www.mathworks.com/help/techdoc/ref/axis.html 更多&回答... |
![]() |
![]() |