had a trouble in the following program
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
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
Image Analyst
2014년 2월 24일
You forgot to describe the trouble. What's going wrong?
답변 (2개)
Mischa Kim
2014년 2월 24일
0 개 추천
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).
댓글 수: 0
Image Analyst
2014년 2월 24일
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);
댓글 수: 0
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!