Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Math Forum
»
Discussions
»
Software
»
comp.softsys.matlab
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
root mean square error calculation matlab code
Replies:
3
Last Post:
Feb 23, 2014 1:17 AM



Curious
Posts:
2,359
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.



