-1

I have channel measurements which has values > 20,000, which has to be divided into discrete levels, as in my case K=8 and which has to be mapped to channel measurements with states. I have to find state-transition probability matrix for this in Matlab.

My question is, I need to know how to divide these values into 8 states and to find the state-transition probability matrix for these 8 states in Matlab.

CraigTeegarden
  • 8,173
  • 8
  • 38
  • 43
Ram Sundar
  • 13
  • 1
  • 6
  • This doesn't really seem like a Matlab question to me. Perhaps you could provide some more detail of what you've done already or how you would go about finding the state transition matrix in pseudocode. – Ryan J. Smith May 03 '13 at 14:22
  • The main idea is to divide set of channel measurements into finite number of discrete levels which are mapped to states. The transitions between the states are then estimated using the measured data to yield a homogenous Markov chain representation of the fading process. t_(j,k) = P_r(S_(n+1)= s_k | S_n= s_j) = N_(j,k)/(∑_(l=0)^(K-1)▒N_(l,j) ) = N_(j,k)/N_j , j,k – {0,1,…K-1} – Ram Sundar May 03 '13 at 14:44
  • @RamSundar: so are you asking how to divide the continuous values into 8 discrete levels? or are you asking how to compute the transition matrix from those discretized values? I guess the first can be done using `histc`, the second using `accumarray`. – Amro May 03 '13 at 14:49
  • @RyanJ.Smith ya..i need to divide those values to discrete levels of 8 and also to find the transition between those 8 states. I hope you know that there wont be any transitions for example from state 1 to state 3(FSMC model). – Ram Sundar May 03 '13 at 14:56
  • @Amro ya..i need to divide those values to discrete levels of 8 and also to find the transition between those 8 states. I hope you know that there wont be any transitions for example from state 1 to state 3(FSMC model). – Ram Sundar May 03 '13 at 15:23
  • @RamSundar: ok, how do you want to discretize the values? an example would be "equal width bins", i.e intervals like [1,2), [2,3), [3,4)? As to your second point, I'm not sure what you mean by that.. – Amro May 03 '13 at 15:57
  • @Amro ya...similar like quantize the total values to 8 states, so that transitions between the states can be found, i hope so..and to the second point, in Finite state markov chain(FSMC), the transition probability will be there from state 1 to state 2 and vice versa but there is no transition probability from state 1 to state 3, it is just like feed forward network.. – Ram Sundar May 03 '13 at 18:25
  • @RamSundar: I posted an example of how I would implement this. – Amro May 03 '13 at 19:22
  • @Amro Thank u so much. sry for de delayed reply, my data's are in my work place...i will let u know once i got my results. Thanks for your timely help..u r my saviour.. – Ram Sundar May 06 '13 at 07:30
  • @Amro The transition matrix works perfect for my case. Thank u so much. I have small question for you. I have to calculate PDF from the transition matrix and i calculted using 'ksdensity'.. [f,xi] = ksdensity(trans(:),'function','PDF');...is this correct?? i need your suggestion... – Ram Sundar May 07 '13 at 09:31
  • @RamSundar: you should create a separate question for that. Of course make it complete on its own by providing enough explanation, and link to this question if needed. – Amro May 07 '13 at 17:22

1 Answers1

1

Here is a made-up example:

%# some random vector (load your data here instead)
x = randn(1000,1);

%# discretization/quantization into 8 levels
edges = linspace(min(x),max(x),8+1);
[counts,bins] = histc(x, edges);

%# fix last level of histc output
last = numel(counts);
bins(bins==last) = last - 1;
counts(last-1) = counts(last-1) + counts(last);
counts(last) = [];

%# show histogram
bar(edges(1:end-1), counts, 'histc')

%# transition matrix
trans = full(sparse(bins(1:end-1), bins(2:end), 1));
trans = bsxfun(@rdivide, trans, sum(trans,2));

A few things to note:

  • Discretization is performed simply by dividing the whole range of data into 8 bins. This is done using histc. Note that due to the way the function works, we had to combine the last two counts and fix the bins accordingly.

  • the transition matrix is computed by first counting the co-occurrences using a less-known call form of the sparse function. The accumarray could have also been used. The count matrix is then normalized to obtain probabilities that sum to one.

  • You mentioned that your MC model should only allow transitions between adjacent states (1 to 2 or 8 to 7, but not between 2 and 5). I did not enforce this fact since this should be a property of the data itself, which is not applicable in this example with random data.

Amro
  • 123,847
  • 25
  • 243
  • 454