// TP01.sci
function prob01()
    disp('Probleme 01 :')
    t = 0.1:0.01:50;
    clf()
    subplot(2,3,1)
    k1 = 10; k2 = -0.1; N_t1 = k1*exp(k2*t);
    k1 = 10; k2 = -0.5; N_t2 = k1*exp(k2*t);
    k1 = 0.1; k2 = 0.1; N_t3 = k1*exp(k2*t);
    plot(t,[N_t1',N_t2',N_t3'])
    legend(['k1=10 k2=-0.1','k1=10 k2=-0.5','k1=0.1 k2=0.1'],[5,13])
    xstring(5,13.5,'Exponentiel')
    
    subplot(2,3,2)
    k1 = 0; k2 = 0.1; k3 = 1.75; N_t1 = k1+k2*t^k3;
    k1 = 0; k2 = 3; k3 = 0.75; N_t2 = k1+k2*t^k3;
    k1 = 50; k2 = -0.001; k3 = 3; N_t3 = k1+k2*t^k3;
    a=gca(); a.data_bounds=[t(1),0;t($),100];
    plot(t,[N_t1',N_t2',N_t3'])
    legend(['k1=0 k2=0.1 k3=1.75','k1=0 k2=3 k3=0.75',...
            'k1=50 k2=-0.001 k3=3'],[2,90])
    xstring(2,91,'Puissance')
    
    subplot(2,3,3)
    t = 0.1:0.01:100;
    k1 = 1; k2 = 1; N_t1 = k1*t./(k2+t);
    k1 = 1; k2 = 10; N_t2 = k1*t./(k2+t);
    k1 = 1; k2 = 30; N_t3 = k1*t./(k2+t);
    a=gca(); a.data_bounds=[t(1),0;t($),1];
    plot(t,[N_t1',N_t2',N_t3'])
    legend(['k1=1 k2=1','k1=1 k2=10','k1=1 k2=30'],[40,0.4]);
    xstring(40,0.45,'saturation');
    
    subplot(2,3,4)
    t = 0.1:0.01:500;
    k1 = 100; k2 = 100; k3 = 0.02; N_t1 = k1./(1+k2*exp(-k3*t));
    k1 = 100; k2 = 100; k3 = 0.03; N_t2 = k1./(1+k2*exp(-k3*t));
    k1 = 100; k2 = 100; k3 = 0.05; N_t3 = k1./(1+k2*exp(-k3*t));
    a=gca(); a.data_bounds=[t(1),0;t($),170];
    plot(t,[N_t1',N_t2',N_t3'])
    legend(['k1=k2=100 k3=0.02','k1=k2=100 k3=0.03',...
            'k1=k2=100 k3=0.05'],[50,160]);
    xstring(50,165,'Richards');
    
    subplot(2,3,5)
    t = 0:0.01:1;
    k1 = 0.5; k2 = 1; k3 = 2; N_t1 = k1*t.^k2.*(1-t.^k3);
    k1 = 0.75; k2 = 0.5; k3 = 1.7; N_t2 = k1*t.^k2.*(1-t.^k3);
    k1 = 1; k2 = 0.2; k3 = 0.5; N_t3 = k1*t.^k2.*(1-t.^k3);
    a=gca(); a.data_bounds=[t(1),0;t($),1];
    plot(t,[N_t1',N_t2',N_t3'])
    legend(['k1=0.5 k2=1 k3=2','k1=0.75 k2=0.5 k3=1.7',...
            'k1=1 k2=0.2 k3=0.5'],[0.05,0.9]);
    xstring(0.05,0.93,'Blumberg');
    
    subplot(2,3,6)
    t = 0:0.01:100;
    k1 = 1; k2 = 1; k3 = 0.1; N_t1 = k1*t.^k2.*exp(-k3*t);
    k1 = 0.5; k2 = 1; k3 = 0.1; N_t2 = k1*t.^k2.*exp(-k3*t);
    k1 = 0.05; k2 = 2; k3 = 0.077; N_t3 = k1*t.^k2.*exp(-k3*t);
    a=gca(); a.data_bounds=[t(1),0;t($),7];
    plot(t,[N_t1',N_t2',N_t3'])
    legend(['k1=1 k2=1 k3=0.1','k1=0.5 k2=1 k3=0.1',...
            'k1=0.05 k2=2 k3=0.077'],[5,6]);
    xstring(5,6.3,'maximum');
    
    xs2png(gcf(),'../Images/imgTP01_01.png')
    
endfunction

function prob02()
    rand('seed',getdate('s'))
    x = grand(1000,1,'nor',0,3);
    y = grand(1000,1,'nor',0,3);
    xx = x+2*y; yy = x+y;
    clf()
    f = gcf(); f.figure_size = [700,400];
    subplot(1,2,1)
    plot(x,y,'.k','MarkSize',3)
    xlabel('X et Y non corrélées')
    a = gca(); a.isoview = 'on'; a.data_bounds = [-10,-10;10,10];
    gcf()
    subplot(1,2,2)
    plot(xx,yy,'.k','MarkSize',3)
    xlabel('X et Y corrélées')
    a = gca(); a.isoview = 'on'; a.data_bounds = [-10,-10;10,10];
    
    
    xs2png(gcf(),'../Images/imgTP01_02.png')
    
endfunction

prob01()
//prob02()