How to set up a value limit to measure a waveform

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)

a)
find((max(w)-min(w))<Limit,1)
b)
find(abs(w)<Limit,1)
w is the waveform, Limit is your setpoint/comparison value.

2 Comments

Sorry, the first one gives me a blank result. because this is not exactly a sin wave but a normal waveform. Any possible solution to that or using a window to check?
a) will only give a blank result if the pk-pk difference is never less than the Limit value set. Every signal has a max() and a min() and the difference is, by definition, the pk-pk range over the duration.

Sign in to comment.

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

This is an example of the waveform. not exactly a sin wave, sorry. What i need to know is that when will it stay in a, for example, 10 region? What kind of solution can i do about this?
...when will it stay in a, for example, 10 region?
What does this mean, precisely?
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.
i mean that i need to know when will the value stay in a 10W difference region so that i could define it as'recover'..
For example, the image will 'recover', which means it could be flat or floating in a small region. And i want to know the time that, after it the waveform will not float exceed 10. and i could call this time as recover time.
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?

Sign in to comment.

Categories

Asked:

on 30 Jul 2014

Commented:

on 1 Aug 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!