Crtomir Posted December 22, 2015 Report Share Posted December 22, 2015 Hello, I have created code to filter a signal and calculate its peaks. The code is doing perfectly good until..... the signal frequency gets lower (about 10 Hz). The problem is as shown in Peak detector VI. My code needs to execute under 100 ms. Because Peak detector VI takes to much time at low frequency, my program fails. My thinking: Peak detector does a quadratic fit on the points (maybe here hides the time problem ?). I already did FIR filtering, so quadratic fit is not needed? I have added the code for you all to test and use it if you want (try changing frequency at the top of graph and look at how calculation takes more time). Please comment on what i created and if there are some FASTER peak calculation alternatives... for us all to use. PS: you are looking at a test. This is not my program arhitecture (queued state machine) Thank you forum question peak finder.vi Quote Link to comment
drjdpowell Posted December 22, 2015 Report Share Posted December 22, 2015 I suggest you just decimate your data after the filter. 2 Quote Link to comment
Crtomir Posted December 22, 2015 Author Report Share Posted December 22, 2015 I added continuous decimation and already at decimating factor = 2 the speed is 3x faster ! So execution problem is solved Thank you, your answer is excellent. Still i'm curious to know. Would you as an expert, do the same peak detection and filtering as i did? forum question peak finder with decimate.vi Quote Link to comment
Chris_Collier Posted December 22, 2015 Report Share Posted December 22, 2015 One note: you will want to move your location back to where it should be if you're decimating (multiply by the decimation factor). There're a couple other logic things which are also redundant. The biggest time sink would probably be polling your controlls. Try this version (it's in 2013). And of course I didn't test my code properly, and it seems to run more slowly than yours... I'll have to dig more deeply into why... Peak Finder 2013.zip Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.