Create an image filter
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Alber
el 29 de Abr. de 2020
Respondida: Walter Roberson
el 29 de Abr. de 2020
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 comentarios
Walter Roberson
el 29 de Abr. de 2020
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.
Respuesta aceptada
Walter Roberson
el 29 de Abr. de 2020
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Matched Filter and Ambiguity Function en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!