had a trouble in the following program
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
x=55125;
y=54900;
function[ABSE,MSE,RMSE,SNR]=objectiveanalysis(x,y)
L=length(x);
y=y(1:L);
ABSE=sum(abs(x-y));
MSE=(sum(((x-y).^2))).*(1/L);
RMSE=MSE.^.5;
nem=sum((x).^2);
den=sum(((x-y).^2));
SNR1=nem./den;
SNR=10*log10(SNR1);
fprintf ('Absolute Error : %g\n\n',ABSE);
fprintf ('Mean Square Error : %g\n\n',MSE);
fprintf ('Root Mean Square Error : %g\n\n',RMSE);
fprintf ('Signal to Noise Ratio : %g\n\n',SNR);
note... actuly x is my speech signal and its length is i define same y is my encoded speech and its length i defined
1 comentario
Image Analyst
el 24 de Feb. de 2014
You forgot to describe the trouble. What's going wrong?
Respuestas (2)
Mischa Kim
el 24 de Feb. de 2014
0 votos
The first two lines of your code (assigning values to x and y) you should execute in the MATLAB command window. Only the code including and following the function definition should be in the function file (named objectiveanalysis.m).
Image Analyst
el 24 de Feb. de 2014
Or, have it all in a single m-file called test (if you want to do it that way, in a single m-file):
function test
x=55125;
y=54900;
[ABSE,MSE,RMSE,SNR]=objectiveanalysis(x,y)
function[ABSE,MSE,RMSE,SNR]=objectiveanalysis(x,y)
L=length(x);
y=y(1:L);
ABSE=sum(abs(x-y));
MSE=(sum(((x-y).^2))).*(1/L);
RMSE=MSE.^.5;
nem=sum((x).^2);
den=sum(((x-y).^2));
SNR1=nem./den;
SNR=10*log10(SNR1);
fprintf ('Absolute Error : %g\n\n',ABSE);
fprintf ('Mean Square Error : %g\n\n',MSE);
fprintf ('Root Mean Square Error : %g\n\n',RMSE);
fprintf ('Signal to Noise Ratio : %g\n\n',SNR);
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!