行列の範囲指定の書き方
Show older comments
f=10*x(1,:)+5*(2,:)
のx(1,:)と(2,:)に出てくる数値を0.1から10に範囲を設定したい時、xmとxMはそれぞれどのように書けばいいですか?
2 Comments
Dyuman Joshi
on 14 Nov 2023
What is the objective here?
What are xm and xM?
どういう状況ですか?目一杯想定してみましたが、何を計算したいのか良くわかりません
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の要素数が合わないから加算出来ません!
Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!