01-03-2006 10:11 AM
01-04-2006 03:35 AM
01-05-2006 01:53 AM
01-05-2006 02:17 AM
01-05-2006 04:50 AM
Dear Ingo,
I thought I had to divide the data into intervals, but I misunderstood you reply. And your are right, I need a script.
Could you please send me an example of how I could divide the data into intervals of 1 sec, copy in temporary channels, and do the regression?
Regards,
Koniker
01-05-2006 11:39 AM
01-09-2006 03:29 AM
' Create some data
Call DATADELALL(1)
Call CHNLINGENIMP("GenImplicit",1001,1,0.01)
Cn(1)="Time"
Call FormulaCalc("ch(#) := sin(ch(1)*10)*ch(1)")
Cn(2)="Data"
' Allocate temporary and result channels - if channels allready exist, delete them
if cno("Temp_x") > 0 then Chndel("Temp_x")
Call chnalloc("Temp_x",1024): Tx=cno("Temp_x")
if cno("Temp_y") > 0 then Chndel("Temp_y")
Call chnalloc("Temp_y",1024): Ty=cno("Temp_y")
if cno("Regression_Time") > 0 then Chndel("Regression_Time")
Call chnalloc("Regression_Time",1024): Rt=cno("Regression_Time")
if cno("RegrCoeffA") > 0 then Chndel("RegrCoeffA")
Call chnalloc("RegrCoeffA",1024): Rx=cno("RegrCoeffA")
if cno("RegrCoeffB") > 0 then Chndel("RegrCoeffB")
Call chnalloc("RegrCoeffB",1024): Ry=cno("RegrCoeffB")
first = 1 ' first row of data to calculate
sec = trunc(cmin("Time"))+1 ' actual second to ccalculate
count = 1 ' number of calculations (seconds)
do
last = Find("ch(1)>="&str(sec)) ' last row of data to calculate
if last <> 0 and last <> first then
call datablcopy("1,2",first,last-first,str(Tx)&","&str(Ty),1) 'copy to temporary channels
Call CHNREGRXYCALC(Tx,Ty,Tx,Ty,"linear","Partition complete area",2,1) 'calculate regression
chd(count,Rt)=sec - 0.5 ' store regression results in result channels
chd(count,Rx)=RegrCoeffA
chd(count,Ry)=RegrCoeffB
count = count+1
first=last ' prepare search for next interval
end if
sec=sec+1
loop until last = 0
call Chndel("Temp_x") 'delete temporary channels
call Chndel("Temp_y")
01-10-2006 01:26 AM
Dear Ingo,
Thanks very much for your help.
Only one note. The "CHNLINGENIMP" function is not recognized by Diadem 8.1 that I have to use, so I could not manage to run your example directly, but I will find a solution.
Regards,
Koniker
01-10-2006 01:36 AM
Call CHNLINGEN("gen_X_Kanal",1,10,1001)Ist working much in the same way.