05-31-2010 02:15 PM
Hi
My attachment tries to show you what I mean. I log signals from a gyro, but due to it's nature the signal drifts over time (blue graph in the attachment). What I would like to do in the post process analysis is to "normalize" the signal by removing the drift as shown in the red graph in the attachment. Is there a function in DIAdem that could be useful for this task, or am I better off trying to do some scripting? One can assume that the drift is linear over time.
06-01-2010 06:10 AM
hibux,
Assuming your assumption is correct that the drift is linear over time, here is what might solve the problem : You run a linear regression for your signal. As a result you will get new channel. If you then subtract the new channel from your signal, the result should be your signal minus the drift.
If you want to, you could provide one or more example signals and post them so that we can create an example script for your.
Andreas
06-02-2010 03:53 PM
06-03-2010 02:01 AM
06-03-2010 01:11 PM
06-04-2010 03:44 AM
Hello Hibux,
please see the script below. It describes the solution step by step. You can also execute all of the steps interactively. The one thing to keep an eye on is that you have to set the number of output point for the linear regression to the number of point of theinput signal.
Andreas
Option Explicit 'Forces the explicit declaration of all the variables in a script.
Dim oChannel,sgTempChannel,sgDataFilename
' set the following to the name of teh dtafile on your harddisk
sgDataFilename = "C:\Dokumente und Einstellungen\GrHauba\Desktop\Customer_gyro\gyro signal.TDM"
Call Data.Root.Clear()
' Load dataset
Call DataFileLoad(sgDataFilename ,"TDM","Load") '... DataFilename,FileImportFilter,ImportAction
' Process channel "D1_GyroPos" in the first group
Set oChannel = data.Root.ChannelGroups(1).Channels("D1_GyroPos")
sgTempChannel = "RegressionY"
' Calculate linear regression.
' Set number of output points to the length of the input channel
Call ChnRegrXYCalc("",oChannel,"","/"&sgTempChannel,"linear","Partition complete area",oChannel.Size,1) '... XW,Y,E,E,RegrType,XChnStyle,XNo,XDiv
' Subtract, createing a new channel
' Call ChnSub(oChannel,"/"&sgTempChannel,"/D1_GyroPos_NoDrift") '... Y,Y1,E
' Subtract, overwriting original channel
Call ChnSub(oChannel,"/"&sgTempChannel,oChannel.GetReference(eRefTypeIndexName))
data.Root.ActiveChannelGroup.Channels.Remove(sgTempChannel)
06-08-2010 04:05 PM