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 CenterFile Exchange에서 Matched 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