How to return all points in a polyshape

6 vues (au cours des 30 derniers jours)
Te Jones
Te Jones le 26 Sep 2018
Modifié(e) : jonas le 1 Oct 2018
I have a signal that I am trying to modify. On the spectrogram of this signal, I have drawn a polygon using polyshape around a portion that I would ultimately like to remove/silence so that I can extract frequency information only from the portion of the signal I am interested in. How can I return all the data points of the spectrogram within the polygon so that I can use this in later functions? The inpolygon and isinterior functions allow me to verify if certain points I provide are within the polygon. However, both require me to input a series of coordinates to check. I do not want to provide the points. I would like to draw the shape and have a function that just returns the values within it.
  5 commentaires
Te Jones
Te Jones le 1 Oct 2018
My issue is that the spectrogram function returns time and frequency vectors that aren't equal. I don't know how I can take all of that data and check it against what is or isn't in the polygon. The goal is to be able to remove parts of the audio file that can't be removed with filters, like echoes. I want to be able to draw a shape around the section and eventually output a new data file that doesn't contain those portions so that I can continue with frequency analysis. So what is the way to check the output of Matlab's spectrogram so I can use x and y the way you have done with your randomly generated data?
jonas
jonas le 1 Oct 2018
Modifié(e) : jonas le 1 Oct 2018
Could you upload one such file/code and mark the areas that you would like to remove? I have never used the spectogram function so I dont know the nature of its output.

Connectez-vous pour commenter.

Réponses (2)

Steven Lord
Steven Lord le 27 Sep 2018
Actually, instead of extracting the vertices from the polyshape and calling inpolygon, I would call isinterior instead.
I think that's what Te Jones referred to as the "TFin" function. To address the comment "there are too many points to check them all individually", realize that the inputs representing the points to check can be vectors instead of just scalars. So you can check many points at once with one call to isinterior.

jonas
jonas le 26 Sep 2018
Modifié(e) : jonas le 26 Sep 2018
This is exactly what inpolygon is for

Catégories

En savoir plus sur Elementary Polygons dans Help Center et File Exchange

Produits


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by