LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PtByPt; Derivative issue

Solved!
Go to solution

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 Smiley Frustrated 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???Smiley Mad   

0 Kudos
Message 1 of 5
(3,551 Views)

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.


GCentral
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
0 Kudos
Message 2 of 5
(3,537 Views)

Thank you crossrulz!

 

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

0 Kudos
Message 3 of 5
(3,525 Views)
Solution
Accepted by topic author ahmalk71

ahmalk71 wrote:  I started with your suggestion what I get it is a derivative that is 63,8 time higher Smiley Surprised

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


GCentral
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,493 Views)

DarnSmiley Mad I forgot about the internal derivativeSmiley Embarassed

 

ThanksSmiley Happy

0 Kudos
Message 5 of 5
(3,484 Views)