matrix for Ternary ABC points

2 ビュー (過去 30 日間)
M
M 2012 年 3 月 29 日
hello,
i need to generate a matrix with an interval of 0.05 for a ternary system, like;
[0 0 100 -------------> sum of each row must be 100
0 0.05 99.95
. . .
. . .
0.05 0 99.95
0.05 0.05 99.9
. . .
. . .
100 0 0]
help would be greatly appreciated.
Emre

採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 3 月 29 日
so?
a = (0:.05:100)';
[x y] = ndgrid(a);
out = [y(:) x(:) flipud(x(:))];
  1 件のコメント
M
M 2012 年 3 月 29 日
sorry, i forgot to type that sum of data in each rows must be 100.

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

その他の回答 (1 件)

M
M 2012 年 3 月 29 日
i just modified Mr.Bobrov's answer in order to obtain the sum of each row equal to 100;
a = (0:0.05:100)';
[x y] = ndgrid(a);
out = [y(:) x(:) flipud(x(:))];
out(:,3)=(100-(out(:,1)+out(:,2)));
[badrows,c]=find(out<0);
newOut = out(setdiff(1:size(out,1),badrows),:);

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by