Hello again,
At first I want to show you my script to get an Imagination of what i want to do.
genr a= 1000
genr t0=0
genr t= 40
genr t1=98
genr t2=150
genr t3=180
############################
#####Basic Functions
# Nr. 1 GO
genr b1=0.01
function series GO (scalar a, scalar b1, series v1,scalar t0)
return a1*(1-exp(-b1*v1-t0))
end function
# Nr. 2 GOS
genr b2=0.01
function series GOS (scalar a, scalar b2,series v1,scalar t0)
return a1*(1-(1+b1*v1-t0)*exp(-b1*v1-t0))
end function
# Nr.3 HD
genr b3=.01
genr c3=10
function series HD (scalar a, scalar b3, scalar c3, series v1,scalar t0)
return a3*(1-exp(-b3*v1-t0))/(1+c3*exp(-b3*v1-t0))
end function
# Nr.4 LIN
function series LIN (scalar m, series v1)
return m*v1
end function
####################################################################
# For example an idividuell Model with 1. GO, 2. GOS, 3. HD
function series model (scalar a, scalar b1, scalar b2, scalar b3, scalar c3, series v1)
scalar n1 = GO (t1, a, b1, v1, t)
scalar n2 = GOS(t2, a, b2, v1, t)+n1
scalar n3 = HD (t3, a, b3, c3 , v1, t)+n2
return (t<=v1)*GO (t1, a, b1, v1, t)\
+ (t>v1)*(t<=t2)*GOS(t2, a, b2, v1, t)+n1\
+ (t>v1)*(t<=t3)*HD (t3, a, b3, c3 , v1, t)+n2
end function
here you see the first part of my script. What i want to do is, with the 4 "Basic functions" to create on a easy way a new as i called individuel Model. v1 is a Variable for the time like the whole t's a b & c are scalars and constants for the Basic functions .
In the Individual Model i want to set the "n's" to get a constant function if the Model change.
the continous of the script is not really finished i just give some datas to see if the function above is working.... but it's not :
smpl full
i=24
day=v1[i]
genr v8=v1-day+1
genr j=70
loop 5
catch nls v4 = model
params a b1 b2 b3
end nls --robust
end loop
smpl 50
gnuplot v4 v8 --output=display
-------------------------------------------
What i want to have is an easier script , i just want to give the name of the Basic functions also the n's to have a constant function in the individual model. and that's all.
I don't want to declare the scalars and series again.
Is this possible? If yes, how can i do it ? If not, is there any way to make it easier, shorter and clearlier???
Thanks for your help =)