choose and change data partially

Hi, i'm beginner on MATLAB.
I take a sinelike data 0 to 2pi.
I want to change some of values and make monotonic increase data.
For example,
  • when theta is 0 to pi/2, data is keeping,
  • theta is pi/2 to 3pi/2, change values 90-original data,
  • theta is 3pi/2 to 2pi, change values 180+original data.
maximum value of original data is 45 at theta pi/2, and minimum value of it is -45 at theta 3pi/2
All of method is ok. thanks to read it.

1 件のコメント

FirefoxMetzger
FirefoxMetzger 2016 年 8 月 16 日
is your data given by a discrete array / vector of values or via a continous (analytic) function?

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

回答 (1 件)

Thorsten
Thorsten 2016 年 8 月 16 日

0 投票

theta = linspace(0, 2*pi);
idx1 = theta >= pi/2 & theta <= 3*pi/2;
idx2 = theta >= 3*pi/2 & theta <= 2*pi;
theta(idx1) = 90 - theta(idx1);
theta(idx2) = 180 + theta(idx2);

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

質問済み:

2016 年 8 月 16 日

回答済み:

2016 年 8 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by