LabVIEW

cancel
Showing results for
Search instead for
Did you mean:

Solved!
Go to solution

PtByPt; Derivative issue

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???

Message 1 of 5
(3,403 Views)

Re: PtByPt; Derivative issue

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.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 5
(3,389 Views)

Re: PtByPt; Derivative issue

Thank you crossrulz!

I started with your suggestion what I get it is a derivative that is 63,8 time higher

Message 3 of 5
(3,377 Views)
Solution
Accepted by topic author ahmalk71

Re: PtByPt; Derivative issue

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

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 5
(3,345 Views)

Re: PtByPt; Derivative issue

Darn I forgot about the internal derivative

Thanks

Message 5 of 5
(3,336 Views)