Curious
Posts:
2,015
Registered:
12/6/04


Re: root mean square error calculation matlab code
Posted:
Feb 21, 2014 10:10 AM


"Ong Teng" <ongwenteng0227@gmail.com> wrote in message <le6kh0$6am$1@newscl01ah.mathworks.com>... > Hi Greetings, > > Can I know whats wrong with my code below? Anyone can help? EvalHeartSet is my data set that loaded into matlab to evaluate the data. > > ev=EvalHeartSet(:,end); > rmse(1)=norm(evu(1,:)ev)/sqrt(length(evu(1,:))); > rmse(2)=norm(evu(2,:)ev)/sqrt(length(evu(2,:))); > > subplot(2,1,1); > if rmse(1)<rmse(2) > r=1; > else > r=2; > end > > str=sprintf('Testing Set RMSE: %f',rmse(r)); > disp(str); > ctr=0; > for i=1:m > if evu(r,i)==ev(i) > ctr=ctr+1; > end > end > > Thanks.
What makes you think anything is wrong with it? What error messages are you getting? Wrong answers?
Without knowing the values of ev & evu, there is not much we can do to help.
One possibility: it is bad practice to compare real numbers for equality as in:
if evu(r,i)==ev(i)
You should consider something like:
if abs(evu(r,i)  ev(i)) < tol
instead. Where tol is a "small" number.

