フィルターのクリア

How can I extract a vector of values from a spectrum?

2 ビュー (過去 30 日間)
Enrico Zanazzi
Enrico Zanazzi 2018 年 4 月 10 日
回答済み: NISARGA G K 2018 年 4 月 30 日
I have an optical spectrum that is represented by two vectors: X and Y. In X I have all the values (X1,X2,X3...) and in Y their absolute frequncies (Y1,Y2,Y3...) (namely counts). Let us suppose, for example, that X1 has 4 counts (Y1=4) and X2 has 5 counts (Y2=5) and so on and I want to exctract the following vector:
X1 X1 X1 X1 X2 X2 X2 X2 X2 .....
How can it be done? thank you!

採用された回答

NISARGA G K
NISARGA G K 2018 年 4 月 30 日
I understand that you would like to extract a vector with X values repeated as per the count in Y. The following code would help you do the same.
c=[];
for i=1:length(x)
c=[c;repmat(x(i),y(i),1)];
end

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by