welcome to nls2C Site Plan

 

How to use nls2C

 

1/   Create a file containing the data. See an example and the files suffixed by .input in the directory examples. to know more
2/   Describe your model in a formal syntax.

See an example and the files suffixed by .m and .mod in the directory examples. See the help-files of nls2
3/   If you have not described the formal expression of your model in this file, write the subroutines required.

See the files suffixed by .c and .f in the directory examples. See the help-files of nls2.
4/   Compile and link the programmes by the command :
cr2C <formal-model-filename>
example to know more
5/   Execute by the command :
<formal-model-filename>.exe -i <data-filename>
example to know more

Example:

  1. The input file called nas.input:
    # ****** Nasturium example ******
    
    x # one independant variable
    0.000 0.000 0.000 0.000 0.000 0.000 
    0.025 0.025 0.025 0.025 0.025 0.025 
    0.075 0.075 0.075 0.075 0.075 0.075 
    0.250 0.250 0.250 0.250 0.250 0.250 
    0.750 0.750 0.750 0.750 0.750 0.750 
    2.000 2.000 2.000 2.000 2.000 2.000 
    4.000 4.000 4.000 4.000 4.000 4.000
    
    y # values of the response
     920 889 866 930 992 1017 919 878 882 854 851 850 870 825 953 
     834 810 875 880 834 795 837 834 810 693 690 722 738 563 591 
     429 395 435 412 273 257 200 244 209 225 128   221
    
    # the name of the model-description file:
    file nas.mod
    
    # the initial values of the parameters:
    theta.start 900 -.5 1
    
    # End of the input-file
    
    
  2. The model-description file called nas.mod:
    % model NASTURTIUM
    resp y; 
    varind x; 
    parresp t1,t2,t3;
    subroutine;
    begin 
    y =  if x==0 then t1 else 
         t1/(1+exp(t2+t3*log(x)))
              fi; 
    end
    
  3. Creation of the executable file called nas.mod.exe:
    cr2C nas.mod
    
    This command creates the files:
    - nas.mod.c, the C-programme which evaluates the model; this programme is automatically generated from nas.mod,
    - nas.mod.o, its compiled version,
    - nas.mod.exe, the executable file.

  4. Execution:

    nas.mod.exe -i nas.input
    

    More examples.

    Retour au début

    You can also:

     


    © INRA, 2001-