フィルターのクリア

How to assign negative and positive values to specific numbers in array?

9 ビュー (過去 30 日間)
Zach Dunagan
Zach Dunagan 2017 年 10 月 20 日
コメント済み: Zach Dunagan 2017 年 10 月 20 日
How would I flip the signs in the array? a = xp', where 'a' is the array.
ans =
0.0581
0.0562
0.0544
0.0525
0.0506
0.0488
0.0469
0.0450
0.0431
0.0412
0.0394
0.0375
0.0356
0.0338
0.0319
0.0300
0.0281
0.0262
0.0244
0.0225
0.0206
0.0188
0.0169
0.0150
0.0131
0.0112
0.0094
0.0075
0.0056
0.0038
0.0019
0
-0.0019
-0.0038
-0.0056
-0.0075
-0.0094
-0.0112
-0.0131
-0.0150
-0.0169
-0.0188
-0.0206
-0.0225
-0.0244
-0.0262
-0.0281
-0.0300
-0.0319
-0.0338
-0.0356
-0.0375
-0.0394
-0.0412
-0.0431
-0.0450
-0.0469
-0.0488
-0.0506
-0.0525
-0.0544
-0.0562
-0.0581
-0.0600
I need all negative numbers to be positive and all positive numbers to be negative. Sign needs to flip after the zero in the middle of the array.

採用された回答

KSSV
KSSV 2017 年 10 月 20 日
編集済み: KSSV 2017 年 10 月 20 日
Let a be your column matrix.
b = -a ;
Note that
-1X-1 = +1
-1X+1 = -1

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by