function effectOfM(inputfile,uploadfile,EN0,E_dividedByN0,min,inue_js_animationNumberOfFrames,filename)
%The first function to be called in this slide
%this function shows the effect of m (the number of repeated elements of a vector
%when encoding this vector using the repetition code as an error-correcting code)on a picture 
%for a fixed value of SNR(SNRs/SNRb) chosen by the user
%Inputs defined by the user from the webdemo page:
%inputfile is a file to be chosen
%uploadfile is a file to be uploaded
%EN0 is the value of SNR to be selected(SNRb or SNRs)
%E_dividedByN0 the the value of the EN0 in dB
%min is the minimal value of m
%NumberOfFrames is the number of pictures to be shown
step=2;
m=min:step:(min+step*(inue_js_animationNumberOfFrames-1))   ;
if(  strcmp(inputfile,'OwnFile'))
    Im = imread (uploadfile);
    
else
    Im=imread(inputfile);
end
imageDimensions = size(Im);


img_index=0;
for n = m
    if( EN0 ==  2)

SNR=E_dividedByN0+10*log10(1/n);
    else

SNR=E_dividedByN0;
    end
    sigma_ch=1/sqrt(2*power(10,SNR/10));
    B=dec2bin(Im,8);
    strBinaryVector=reshape(B.',1,[]);

    
    w1=repmat(strBinaryVector,n,1);
    strRepeated=w1(:);
    strRepeated=strRepeated';
    
    intRepeated =strVecToIntVec(strRepeated);
    ModulatedVector=modulation(intRepeated);
    VerrauschtesSignal = awgn_channel(ModulatedVector,sigma_ch) ;
    
    DemodulatedSignal=demodulation(VerrauschtesSignal);

    
    K = correction(DemodulatedSignal,n);
    R = reshape (K', 8, [])';
    S2 = bin2dec(int2str(R));
    S4 = uint8(reshape(S2,imageDimensions));
  
    new_filename = [filename '_' num2str(img_index)];
    
    imwrite (S4,new_filename,'png');
    img_index = img_index+1;
    
end

end