08-18-2016 06:55 AM
Hi,
I'm working on a program that continously read data from serial port (FS =1000). I have chosen to read the data in blocks of 512 in producer loop and send it via FIFO to the consumer loop. At the consumer loop I would like to filter and get derivate the signal. I wrote a simple program to illustrate my problem, the program simply produce a sine wave of 128 point per cycle and i filter that wave with a band pass filter (assuming a FS of 1280 Hz). That works fine! What I dont understand is the derivative part and the meaning of dt. I expect it should be 1/1280 but this givs a wronge answear. I saw a solution in which they take the difference between Xn-1 and X0 of the signal block and insert it in dt If I read the description in the derivtive the meaning of dt is sampling interval and it should not be equal or less than zero. So what have I missed???
Solved! Go to Solution.
08-18-2016 07:35 AM - edited 08-18-2016 07:36 AM
This looks correct to me. A few things I did:
1. Set the Initial Condition to the first data point
2. Removed the First Call since that is done inside of the VI anyways.
3. Set the dt to be 1/1280.
08-18-2016 08:29 AM
Thank you crossrulz!
I started with your suggestion what I get it is a derivative that is 63,8 time higher
08-18-2016 09:28 AM
ahmalk71 wrote: I started with your suggestion what I get it is a derivative that is 63,8 time higher
If you go through the math, that is correct.
d(sin(2*pi*128x)/dt = 2*pi*128*cos(2*pi*128x)/dt. With dt = 1/1280 you end up with 20*pi*cos(2*pi*128x). 20*pi = ~63.8
08-18-2016 09:50 AM
Darn I forgot about the internal derivative
Thanks