# Signal into tolerance range - Comparison algorithm

6 ビュー (過去 30 日間)
Ali Sahouli 2020 年 1 月 12 日

Hello all,
we have a referenze-signal and a test-signal both are saved into a 1x1 double timeseries. In the first column are time-datas (x-axis) and in the second one signal-datas (y-axis).
The referenc-signal can take any shape, for example: square wave signal, triangular signal or anything else.
We need to create a tube around our referenc-signal which gets created by a given tolerance range.
At the end there should be a test, to find out if the test signal is in that range of tolerance or not.
Does any one have a idea if there is someting like a coparison algorithm in matlab which can check if a signal is into a tolerance range or not?
Or any other kind of solution?
Thank you for any help!

#### 0 件のコメント

サインイン to comment.

### 回答 (1 件)

John D'Errico 2020 年 1 月 12 日

It is often the case when my answer wants to be both no and yes. That is, no, there is no direct tool that does what you seem to be asking, and yes, I've written a tool, and it is on the file exchange. However, then I feel it necessary to point out that I think you should not use that tool!
You seem to be wanting to create this tube of essentially constant width that follows your curve. If a point is inside the tube, then the tool should be returned telling you it is or is not inside the tube.
The probem is, that treats distance as if distance in time and distance in y are the same thing, that you can trade them off as equivalent things. This makes little sense, unless you are talking about space time. I mean, you can do it mathematically, but it makes no real sense on most problems.
So my argument is that even though my distance2curve utility can do exactly what you seem to be wanting, DON'T USE IT!
Instead, you should consider just vertical distance. A point is inside the "tube" only if the reference signal at the same time is within a tolerance, on y ONLY. That is, given a reference signal, and a test signal then all you need to do is test if:
abs(y_ref - y_test) <= tol
where that test returns true, then the test signal is within the tube. This is a vector test, so it would operate on all elements of both time series, assuming they both live on the same time domain.
For a single point, (t,y_test), the test will look something like:
abs(y_ref(t) - y_test) <= tol
A serious virtue of treating the tube as if it is a tube that acts only on distance in y, is it is now trivial to implement. You need no specialized utility. And unless treating distance in time and space as if they are the same makes sense, you don't want to do what you seem to have been asking to do.
A nice thing is it even makes the tube itself easy to plot. You will plot it as three lines, where you just offset y_ref by adding and then subtracting tol from it. You could even get a but more fancy, and plot the tube as a translucent overlay. still not that difficult, as long as the offset is just +/-tol applied to y_ref.

#### 0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。

Translated by