How do I find the first 30 percent of each period of cosine?

1 visualización (últimos 30 días)
wobbly
wobbly el 9 de Sept. de 2021
Comentada: Walter Roberson el 10 de Sept. de 2021
I want to find and plot points of the graph with the find function to locateeach period of the cosine , how would i go about this?
  4 comentarios
Rik
Rik el 10 de Sept. de 2021
I recovered the removed content from the Google cache (something which anyone can do). Editing away your question is very rude. Someone spent time reading your question, understanding your issue, figuring out the solution, and writing an answer. Now you repay that kindness by ensuring that the next person with a similar question can't benefit from this answer.

Iniciar sesión para comentar.

Respuestas (2)

Sulaymon Eshkabilov
Sulaymon Eshkabilov el 9 de Sept. de 2021
Editada: Sulaymon Eshkabilov el 9 de Sept. de 2021
In this case, if you are working and need to work with your plot, then you should work with ginput to locate where your full period is and then pick up the 30% of the data along x - axis. E.g:
[x, y] = ginput(5); % 5 points catch 4 periods. Click 1 picks up the starting point, click 2 end of 1st period, click 3 the end of 2nd period, etc.
% Then process the slected data with logical indexing (T is your known time signal along x axis):
T1 = T(T>=x(1) & T<=x(2));
T2 = T(T>=x(2) & T<=x(3));
...
% Then you can process the chosen data T1, T2, ... by reselecting only 1/3
% or 30% of it

Walter Roberson
Walter Roberson el 9 de Sept. de 2021
look for the places where sign(diff()) of the signal changes from positive to negative. If you do not have noise, then those are the peaks. The difference in indices tells you how long that cycle is, so you can calculate how many points is 30% there. Then you can extract that subset, such as into a cell array.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by