close

flag1=0;
flag2=0;
flag3=0;
flag4=0;
flag5=0;
var1=0;
var2=0;
var3=0;
var4=0;
var5=0;

while(flag1==0)
    var1 = input('Enter a value for the first weight parameter a: ');
    if(var1>0)
        a=var1;
        flag1=1;
    else
        disp('        ')
        disp('ERROR: a must be positive.')
        disp('        ')
    end
end
flag1=0;
disp('          ')
while(flag1==0)
    var1 = input('Enter a value for the second weight parameter b: ');
    if(var1>0)
        b=var1;
        flag1=1;
    else
        disp('        ')
        disp('ERROR: b must be positive.')
        disp('        ')
    end
end
flag1=0;
disp('          ')
while(flag1==0)
    var1 = input('Enter a value for the third weight parameter c: ');
    if(var1>0)
        c=var1;
        flag1=1;
    else
        disp('        ')
        disp('ERROR: c must be positive.')
        disp('        ')
    end
end
flag1=0;
disp('          ')
while(flag1==0)
    var1 = input('Enter an initial glucose level (x_10): ');
    if(var1>0)
        x10=var1;
        flag1=1;
    else
        disp('        ')
        disp('ERROR: x_10 must be positive.')
        disp('        ')
    end
end
flag1=0;
disp('          ')
while(flag1==0)
    var1 = input('Enter a value for the weight parameter beta: ');
    if(var1>0)
        beta=var1;
        flag1=1;
    else
        disp('        ')
        disp('ERROR: beta must be positive.')
        disp('        ')
    end
end
flag1=0;
disp('          ')
while(flag1==0)
    var1 = input('Enter a value for the desired glucose level (l): ');
    if(var1>0)
        level = var1;
        flag1=1;
    else
        disp('        ')
        disp('ERROR: l must be positive.')
        disp('        ')
    end
end
flag1=0;
disp('          ')
while(flag1==0)
    var1 = input('Enter the number of days you would like to run this model: ');
    if(0<var1);
        T=var1;
        flag1=1;
    else
        disp('            ')
        disp('ERROR: T must be positive.')
        disp('            ')
    end
end
disp('           ')
disp('One moment please...')
y1=labten(a,b,c,x10,beta,level,T);

disp('               ')

while(flag3==0)
    disp('Would you like to plot')
    disp('   1. Glucose Concentration')
    disp('   2. Hormonal Concentration')
    disp('   3. Insulin')
    disp('   4. all three')
    var3=input('Type 1, 2, 3, or 4: ');
    
    if(var3==1)
        plot(y1(1,:),y1(2,:))
        xlabel('Days')
        ylabel('Glucose Concentration')
        flag3=1;
    elseif(var3==2)
        plot(y1(1,:),y1(3,:))
        xlabel('Days')
        ylabel('Hormonal Concentration')
        flag3=1;
    elseif(var3==3)
        plot(y1(1,:),y1(4,:))
        xlabel('Days')
        ylabel('Insulin')
        flag3=1;
    elseif(var3==4)
        subplot(3,1,1);plot(y1(1,:),y1(2,:))
        subplot(3,1,1);xlabel('Days')
        subplot(3,1,1);ylabel('Glucose Concentration')
        subplot(3,1,2);plot(y1(1,:),y1(3,:))
        subplot(3,1,2);xlabel('Days')
        subplot(3,1,2);ylabel('Hormonal Concentration')
        subplot(3,1,3);plot(y1(1,:),y1(4,:))
        subplot(3,1,3);xlabel('Days')
        subplot(3,1,3);ylabel('Insulin')
        flag3=1;
    else
        disp('           ')
        disp('Pardon?')
        disp('            ')
    end
end
