STORING RESULTS OF MULTIPLE EQUATION INTO A CUSTOMIZED ARRAY

5 ビュー (過去 30 日間)
Sandip Ghatge
Sandip Ghatge 2020 年 5 月 7 日
コメント済み: Sandip Ghatge 2020 年 5 月 7 日
If x varies as 0:0.1:1.57
and if you have y = sin (x) and z = cos(x)
and if you want to store values of sin(x) lesser than 0.6 into a (m,1) matrix 'A', followed by a values of cos(x) greater than 0.8 in the same matrix 'A' finally giving you a (n,1) matrix like below,
A =
0
0.0998
0.1987
0.2955
0.3894
0.4794
0.5646
1.0000
0.9950
0.9801
0.9553
0.9211
I know this is possible, just can't figure out how? can you please help.
Thank you

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 5 月 7 日
編集済み: Ameer Hamza 2020 年 5 月 7 日
Try this
x = (0:0.1:1.57).';
y = sin(x);
z = cos(x);
A = [y(y<0.6); z(z>0.8)];
Result
>> A
A =
0
0.0998
0.1987
0.2955
0.3894
0.4794
0.5646
1.0000
0.9950
0.9801
0.9553
0.9211
0.8776
0.8253
  3 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 5 月 7 日
It is called MATrix LABoratory for a reason ;)
I am glad to be of help.
Sandip Ghatge
Sandip Ghatge 2020 年 5 月 7 日
Yes, Indeed:)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeArithmetic Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by