function err = RMSE(x, y, z, b)
%UNTITLED2 Summary of this function goes here
%   Detailed explanation goes here
    if(z == 8)
        orig = cos((1:2^(12))*2*pi*64*x/2^(13)) + cos((1:2^(12))*2*pi*64*2*x/2^(13));
    elseif (z == 3)
        orig = cos((1:2^(12))*2*pi*64*x/2^(13)) + cos((1:2^(12))*2*pi*64*1.5*x/2^(13));
    elseif (z == 5)
        orig = cos((1:2^(12))*2*pi*64*x/2^(13)) + cos((1:2^(12))*2*pi*64*1.25*x/2^(13));
	elseif (z == 16)
	    orig = cos((1:2^(12))*2*pi*64*x/2^(13)) + cos((1:2^(12))*2*pi*64*2*x/2^(13)) + cos((1:2^(12))*2*pi*64*2*x/2^(13));
    else
        orig = cos((1:2^(12))*2*pi*64*x/2^(13));
    end
    if(y == 1)
        comp = simplecodecw(orig, b)';
	elseif (y ==2)
		comp = simplecodecis(orig, b)';
    else
        comp = simplecodec(orig, b)';
    end
    torig = orig(33:(2^12 - 32));
    torig=0.3*torig/max(abs(torig));
    %figure();h=1000;
    %plot(1:50, torig(h+1:h+50), 1:50, comp(h+1:h+50));
    err = sqrt(sum(abs((comp - torig).^2))/length(torig));
end