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

1 view (last 30 days)
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 Comments
Rik
Rik on 10 Sep 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.

Sign in to comment.

Answers (2)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 9 Sep 2021
Edited: Sulaymon Eshkabilov on 9 Sep 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 on 9 Sep 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.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!