How to set up a value limit to measure a waveform
Show older comments
I got one (sin) waveform which will attenuate and floating. And i want to know, for example, when will the peak to peak(or the whole waveform) magnitude is smaller than 100(or a certain value)?
Answers (2)
dpb
on 30 Jul 2014
a)
find((max(w)-min(w))<Limit,1)
b)
find(abs(w)<Limit,1)
w is the waveform, Limit is your setpoint/comparison value.
Image Analyst
on 31 Jul 2014
0 votes
Will you need to first find the "envelope" of the decaying sine wave? Please attach a picture of your signal, and the actual signal in an m-file if you can.
7 Comments
Frank
on 31 Jul 2014
Frank
on 31 Jul 2014
dpb
on 31 Jul 2014
...when will it stay in a, for example, 10 region?
What does this mean, precisely?
Image Analyst
on 31 Jul 2014
You can get "envelopes" by smoothing the signal with conv(). Different windows give different amounts of smoothing. Then you can subtract the smoothed version from your actual signal and look where the deviation is more than 5. That would indicate it's outside of the +/- 5 vertical range
windowSize = 21; % Some odd number
smoothSignal = conv(signal, ones(1, windowSize)/windowSize), 'same');
highlyVariableElements = abs(smoothSignal - signal) > 5 % a logical array
highlyVariableIndexes = find(highlyVariableElements); % Actual index numbers.
Frank
on 1 Aug 2014
Frank
on 1 Aug 2014
Image Analyst
on 1 Aug 2014
You need to define the window width of the region. Would it be the entire signal, or just some portion of the signal. When deciding whether a value at x=12 is in a range of 10 in y, do you want to look from 0 to 20? Or just within the local x=10 to 14 range?
Categories
Find more on Signal Generation, Analysis, and Preprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!