フィルターのクリア

Add weightage to the points.

2 ビュー (過去 30 日間)
SUSHMA MB
SUSHMA MB 2015 年 4 月 29 日
編集済み: Martin Martínez 2016 年 9 月 1 日
I have coordinates of some points, example: q = [1,2;3,4;5,6;9,10]; Now i want to add some weightage to the points so that as per the weightage i can select the points. How can i add it?
  1 件のコメント
Michael Haderlein
Michael Haderlein 2015 年 4 月 29 日
What do you mean, you want to select the points by the weightage? Can you give an example?

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

回答 (1 件)

Martin Martínez
Martin Martínez 2016 年 9 月 1 日
編集済み: Martin Martínez 2016 年 9 月 1 日
Hi, correct me if I am wrong but if I understood .. you have 4 2-D points (i.e., q1 = [1,2], q2 = [3 4], q3 = [5 6], q4=[9 10]) and you want to add different weights to the coordinates (i.e., w1 = 2, w2 = 4, w3 = 2, w4 = 1) so you would obtain a transformed vector (i.e., q_modd). I attach you the code.
q = [1,2; 3,4; 5,6; 9,10];
weights = [2, 4, 2, 1];
q_modd = [];
for i = 1 : length(weights)
a = q(i,1) * weights(i);
b = q(i,2) * weights(i);
q_mod(i,:) = [a b];
q_modd = [q_modd q_mod(i,:)]
end

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by