フィルターのクリア

Create an image filter

2 ビュー (過去 30 日間)
Alber
Alber 2020 年 4 月 29 日
回答済み: Walter Roberson 2020 年 4 月 29 日
I want to create a filter that looks like this:
I would like to create a filter that goes from 0 to alpha, then go to -alpha and go back to 0 in an interval called N.
  7 件のコメント
Walter Roberson
Walter Roberson 2020 年 4 月 29 日
That is not clear to me. Perhaps after I get some sleep...but I suspect what you are trying to say would still not be clear to me. Further explanation might help.
Alber
Alber 2020 年 4 月 29 日
I think explaining it well will be much more complicated. Better if I want to do what you said before: "For example, you could say that the first climb should be the first 1/6 of the time, the hold should be the next 1/6, that the descent should be the next 2 / 6, negative hold should be the next 1/6, and rise to 0 should be the last 1/6 ", how would you do it? from there I think I can work.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2020 年 4 月 29 日
NS = 180; %choose appropriate number of samples
N6 = NS/6;
pattern(1:N6) = linspace(0, alpha, N6);
pattern(N6+1:2*N6) = alpha;
pattern(2*N6+1:4*N6) = linspace(alpha, -alpha, 2*N6);
pattern(4*N6+1:5*N6) = -alpha;
pattern(5*N6+1:N6) = linspace(-alpha, 0, N6);
There are more efficient ways to handle this.
If this is to be part of a repeated pattern then you need to worry about where the leading and trailing 0s are coming from, and how many of those there should be.
If this is to be part of a repeated pattern, then you need to worry that the last sample does not close the pattern: for example [0 1 2 3 2 1 0] repeated is not [0 1 2 3 2 1 0 1 2 3 2 1 0], it is [0 1 2 3 2 1 0 0 1 2 3 2 1 0] because [0 1 2 3 2 1 0] closes back to the original value. Sometimes the easiest way to proceed is to compute with one more sample (the one that will return to the beginning) and then throw that away -- e.g., for NS = 180, planning for sample 181 to be the one that returns back to 0, and then throwing that away, so that 180 is the cycle width, 2 copies = 360 samples would start at 0, give the pattern twice, and end just before returning to 0.
This is important if you are going to be doing fourier transform. Do not start and end with at the same value "because it is easier", knowing that it means that you would get the repeated start value when you start making copies. That repeated start value will distort the fourier transform even though it is only a single extra sample. fft() mathematics only applies to cases where the signal is assumed to be repeated indefinitely.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatched Filter and Ambiguity Function についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by