フィルターのクリア

How to...Matri​x_1(Matrix​_2)=anothe​r_Matrix

1 回表示 (過去 30 日間)
Konstantin
Konstantin 2011 年 3 月 11 日

Hello!

I want to optimize the next process.

1) I have a matrix (2*N), which define, where I'll go from this state, where I got 1 or 2. For states on left side of the picture it is

NStates=
 1  33
 2  34
 L  K

2) Also I have vector (N*1) of decisions, am I going up or down dec = 1 2 1 1 2 ....

3) The last one - I want to get vector of next states - look at right side of picture. In MATLAB now I'm doing it with "for..."

clear all;
clc;
tr=poly2trellis(7,[171,133]);
NStates==tr.nextStates; %(2*N matrix of next states)
dec=randi([1,2],1,64);  %(N*1 matrix of decisions Up or Down
for j=1:64
  A(j)=tr.nextStates(j,lin(j));
end

Can I do it in one string? In cicle it works too slow.

I'm sorry for my English, I hope you understood me :-)

  2 件のコメント
Andrew Newell
Andrew Newell 2011 年 3 月 11 日
What is lin(j)?
Konstantin
Konstantin 2011 年 3 月 11 日
Sorry, i mean lin=dec (vector of decision 121122...)

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

回答 (2 件)

Konstantin
Konstantin 2011 年 3 月 11 日
NStates=
1 33
2 34
....
L K

Andrew Newell
Andrew Newell 2011 年 3 月 11 日
If your question is just how to index tr.nextStates, you can do this:
A = tr.nextStates([(1:64)' dec']);

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by