LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

signal filtering

Solved!
Go to solution

Hi,

Greetings. I have attached a feedback control code here. The code works well. But due to the sensing value fluctuation, I want to add a filter. I added a Savitzky Golay filter, but the code didn't perform as before. Is it due to the sample rate?

Would anyone explain the problem, please? Thanks in advance...

Normal condition.JPGSignal_processing.JPG

0 Kudos
Message 1 of 11
(5,114 Views)

Did you look at the Example that ships with LabVIEW?  You need to apply the filter to an existing array of number.  This is not a "point-by-point" filter that you can put in successive "last value" elements and get out a one-sided filtered estimate of that point and its preceding points ...

 

Bob Schor

Message 2 of 11
(5,062 Views)

Respected Mr. Bob_Schor

 

Greetings. Thanks for your nice explanation. Actually, in my experiment, I have to control actuators based on sensors. But the sensor's reading/data fluctuation is very high. I am trying to apply some filters.  Would you suggest some "point-by-point" filter, please? 

0 Kudos
Message 3 of 11
(5,020 Views)

I have searched some point by point filter (picture attached) and tested them by adding in my code. No one is working as I desired. 

PtByPt filter.jpg

0 Kudos
Message 4 of 11
(5,010 Views)

@Chowdhury_Milon wrote:

Respected Mr. Bob_Schor

 

Greetings. Thanks for your nice explanation. Actually, in my experiment, I have to control actuators based on sensors. But the sensor's reading/data fluctuation is very high. I am trying to apply some filters.  Would you suggest some "point-by-point" filter, please? 


If you are going to be all Formal, it should be "Dr. Robert Schor", but Bob works for me, too.

 

The LabVIEW Help function can "help" you find things.  You can't easily search for "Point by Point" (since it only seems to take the first word), but it may lead you to look at the Signal Processing Palette on the Block Diagram.  There you might see an entry (the last one) for Point By Point, which has a folder called Filters.  Choose the one that seems appropriate for your needs (but don't "over-engineer" the problem).  You should also take advantage of the "Help" on the individual functions (if you type Ctrl-H, you'll turn "Help" on so that a Help menu pops up when you hover over a function on the Block Diagram or on the Function Palette).

 

Bob Schor

Message 5 of 11
(5,009 Views)

@Chowdhury_Milon wrote:

I have searched some point by point filter (picture attached) and tested them by adding in my code. No one is working as I desired. 


Such a picture is not at all helpful!  We can't tell what you did (because you didn't attach the VI you are using), so we can't tell if you are using the filter incorrectly, have mis-wired its inputs or outputs, or just don't understand what it is meant to do or how to use it.

 

We also don't know what you mean by "working as I desired".  We don't know what you wanted it to do, and (because we don't have your code to examine and test,) we don't know what the filter really did.

 

Here is a suggestion.  In the Signal Processing Palette, there are some functions that will generate "example data" that you can feed into a filter.  Generate, say, one second of data that you want to filter (use the characteristics of the signals you expect to see, i.e. "10 kHz sinusoid with white noise added").  Pass this through a filter that you want to test, and plot both the input signal and the filtered result.  Attach your VIs so we can see what you did, can duplicate it (and "play" with it), and if it doesn't do what you'd like it to do, explain clearly what is wrong/missing so that we can help you find the right answer.

 

Bob Schor

Message 6 of 11
(5,003 Views)

Respected Dr. Robert Schor,

Greetings.1st picture shows the filtering result of the Median PtByPt filter's when I tested during data acquisition only. 

Median Filter PtByPt.JPG

2nd picture shows the result when I added the Median PtByPt filter in my experimental code. The same problem still exists. 

Median Filter PtByPt_test.JPG

0 Kudos
Message 7 of 11
(5,001 Views)

I'm not even going to look at these pictures!  I cannot execute a picture (though there are certainly times I'm tempted to "execute" those that post them instead of attaching the VIs, which lets me view the code without needing a magnifying glass, examine hidden case structures if present, test the code, modify the code, etc.).  You are clearly on line now, so you should be able to take your two VIs and attach them to your Reply.  When I see them (I'm also reading the Forum now), I'll examine them and have something that I hope will be helpful to you (since you will have been helpful to me).

 

Bob Schor

Message 8 of 11
(4,995 Views)

Respected Dr. Robert Schor,

 

Greetings. I am really sorry for my misunderstanding. Here are those codes. 

Download All
0 Kudos
Message 9 of 11
(4,988 Views)

Hi Milon,

 

please learn to stay away from ExpressVIs!

 

Using a PtByPt-Filter on a DDT wire, containing waveforms with 100 samples, will result in "unexpected" results…

Doing the same without ExpressVI would be much less error prone!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 11
(4,978 Views)