Matlab中音频信号的PSNR [英] PSNR for audio signal in matlab

查看:567
本文介绍了Matlab中音频信号的PSNR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找出项目中音频文件的MSE和PSNR值.到目前为止,我编写的代码如下:

I am trying to find out the values of MSE and PSNR for audio files in my project. The code i have written so far is as follows:

[y1,fs1, nbits1,opts1]=wavread('one.wav');
[y2,fs2, nbits2,opts2]=wavread('newOne.wav');
[c1x,c1y]=size(y1);
[c2x,c2y]=size(y1);
if c1x ~= c2x
    disp('dimeonsions do not agree');
 else
 R=c1x;
 C=c1y;
 err = (((y1-y2).^2)/(R*C));
 MSE=sqrt(err);
 MAXVAL=65535;
  PSNR = 20*log10(MAXVAL/MSE); 
  disp(['mse=' num2str(MSE) ' PSNR=' num2str(PSNR)]);
end

但是我收到如下错误:

要级联的矩阵的维数不一致.

我在做什么错??

推荐答案

您需要 sum 平方误差才能计算MSE-更改:

You need to sum the squared errors in order to calculate MSE - change:

err = (((y1-y2).^2)/(R*C));

收件人:

err = sum((y1-y2).^2)/(R*C);

这篇关于Matlab中音频信号的PSNR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆