行列の範囲指定の書き方
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
f=10*x(1,:)+5*(2,:)
のx(1,:)と(2,:)に出てくる数値を0.1から10に範囲を設定したい時、xmとxMはそれぞれどのように書けばいいですか?
2 Kommentare
Atsushi Ueno
am 14 Nov. 2023
どういう状況ですか?目一杯想定してみましたが、何を計算したいのか良くわかりません
x = 20 * rand(2,10) - 5 % 適当な値で行列 x を作成(xの範囲は-5~15)
temp = 0.1 <= x & x <= 10 % 0.1~10 の要素に 1 、それ以外に 0 をインデックス付け
xm = temp(1,:) % 1行目の0.1~10インデックスがxmで、
xM = temp(2,:) % 2行目の0.1~10インデックスがxMという事ですか?
f = 10 * x(1,xm) + 5 * x(2,xM) % 0.1~10の要素数が合わないから加算出来ません!
Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!