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

1 回表示 (過去 30 日間)
wobbly
wobbly 2021 年 9 月 9 日
コメント済み: Walter Roberson 2021 年 9 月 10 日
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 件のコメント
Rik
Rik 2021 年 9 月 10 日
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.

サインインしてコメントする。

回答 (2 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 9 月 9 日
編集済み: Sulaymon Eshkabilov 2021 年 9 月 9 日
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 2021 年 9 月 9 日
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.

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by