had a trouble in the following program
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
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 Kommentar
Image Analyst
am 24 Feb. 2014
You forgot to describe the trouble. What's going wrong?
Antworten (2)
Mischa Kim
am 24 Feb. 2014
0 Stimmen
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
am 24 Feb. 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);
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!