function plot_flat_chute_mueff(Frmin,Frmax,num,holdupin,nu0in,ewi,muwi,b0wi,eei,muui,b00i,muEi,flagres,rguessi)

% Calculates and graphs the effective friction on a flat, frictional
% base in terms of the Froude number for a given value of the
% solid volume fraction in the basal layer. For more comments,
% see flat_chute.m
%
% Michel Louge 4/14/2006
%
%	input	-	** Note our convention that global variables are input with a name followed by the letter i **
%
%           -   Frmin       =	minimum Froude number of interest
%           -   Frmax       =   maximum Froude number of interest
%           -   num         =   number of points for the graph and/or results file
%			-	holdupin    =	row array of desired holdups to plot eg, [1 2 3 4 5 6]
%           -   nu0in       =   row array of volume fractions in the basal layer
%           -   muwi        =   collisional friction with flat wall
%           -   ewi         =   collisional normal restitution with flat wall
%           -   b0wi        =   collisional tangential restitution with flat wall
%           -   muui        =   collisional binary friction
%           -   eei         =   collisional binary normal restitution
%           -   b00i        =   collisional binary tangential restitution
%           -   muEi        =   enduring friction of spheres with the base
%           -   flagres     =   flagres =1  output results in a file and plot
%                                       ­1  do not
%           -   rguessi     =   initial guess for the contact point velocity/sqrt(3T) at Frmin
%                               (This may require trial and error - use flat_chute.m to that end).
%
%	output	-	none
%
%   Example: the command...
%
%       plot_flat_chute_mueff(.2,10,50,[3],[.2 .4 .6],.8,.141,.35,.972,.177,.25,.593,1,.4)
%
%   ... calculates mueff versus Fr for holdup=3 and nu0 = 0.2, 0.4 & 0.6 for the particle 
%       properties of Louge & Keast's experiments; 
%       then plots all corresponding curves and outputs 3 files with the data.
%

% 	other internal variables
%
%           -   Fr  	=   array of Froude numbers > 0
%           -   mueff	=   corresponding array of effective friction
%           -   r       =   value of r from solution
%           -   muef    =   placeholder value of mueff
%			-	holdupi	=	holdup
%           -   nu0i    =   basal volume fraction
%           -   numhold =   number of holdups to plot
%           -   numnu0	=   number of basal volfracs to plot
%           -   i       =   index
%           -   ii      =   index
%           -   iii     =   index
%           -   fid     =   output file number
%           -   datime  =   date/time string in year month day hour min sec
%

datime  =   datestr(fix(clock),30)  ;

numhold     =   size(holdupin,2)	;
numnu0      =   size(nu0in,2)       ;

scrsz = get(0,'ScreenSize');
figure('Position',[1 scrsz(4) scrsz(3)/4 scrsz(4)/4])

for iii=1:numnu0
    nu0i        =   nu0in(iii)      ;

for ii=1:numhold
    holdupi     =   holdupin(ii)	;
    
    rguess      =   rguessi       	;

for i=1:num
    Fr(i,1)     =   Frmin+(Frmax-Frmin)/(num-1)*(i-1)                                           ;
    [r,muef]	=   flat_chute(Fr(i,1),holdupi,nu0i,ewi,muwi,b0wi,eei,muui,b00i,muEi,rguess)	;
    mueff(i,1)  =   muef                                                                        ;
    rguess      =   r                                                                           ;
end

plot(Fr,mueff)
ylabel('effective friction')
xlabel('Fr')
axis([0 max(Fr) 0 muEi*1.2])
title(['holdup =',num2str(holdupi) ' nu0 =',num2str(nu0i)])

hold on     ;

				if flagres==1

fid =   fopen(strcat('res',datime,'_',num2str(ii),'_',num2str(iii),'.txt'),'wt')	;

fprintf (fid,'%s\t%s\t%s\t%s\t%s\t%s\r','year','month','day','hour','min','sec')	;
fprintf (fid,'%u\t%u\t%u\t%u\t%u\t%u\r\r',fix(clock))  ;

fprintf (fid,'%s\r\r','created by flat_chute.m of 4/14/06')                         ;

fprintf (fid,'%s\t%g\r','holdup = ',holdupi)	;
fprintf (fid,'%s\t%g\r','nu0 = ',nu0i)          ;
fprintf (fid,'%s\t%g\r','ew = ',ewi)            ;
fprintf (fid,'%s\t%g\r','muw = ',muwi)          ;
fprintf (fid,'%s\t%g\r','b0w = ',b0wi)          ;
fprintf (fid,'%s\t%g\r','e = ',eei)             ;
fprintf (fid,'%s\t%g\r','mu = ',muui)           ;
fprintf (fid,'%s\t%g\r','b0 = ',b00i)           ;
fprintf (fid,'%s\t%g\r\r','muE = ',muEi)        ;

fprintf (fid,'%s\t%s\r','Fr', 'mueff')          ;
    
for i=1:num
fprintf (fid,'%g\t%g\r',Fr(i,1),mueff(i,1))     ;
end

fclose(fid) ;

                end

end

end

hold off	;
