現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
How to get πx (steady-state probabilities of x?in order to plot these equations in MATLAB?
2 ビュー (過去 30 日間)
古いコメントを表示
Sir,
I want to plot these attached equations using MATLAB. For plotting these equations, there are three variables. Out of which, I have values of two variables with me. So, I am looking for the value of the third variable 'πx'. How to get the values of πx (also called steady state probability of x). I have attached the screenshot of equations. Actually, if I get the values of πx, I would easily be able to plot the equations in MATLAB. I am unable to get the steady-state probabilities of x.
Please help
I have also attached the values of x along with these equations.
Regards
Surabhi
Whatever, the case is either simulation or plotting. I am confused on how to solve to get steady-state probabilities and hence plot the equations.
11 件のコメント
Rik
2017 年 10 月 15 日
surabhi sachdeva
2017 年 10 月 18 日
Sir, the authors have written using MATLAB program they have found out the steady-state probability and then plotted the equations in MATLAB.
Jan
2017 年 10 月 18 日
編集済み: Jan
2017 年 10 月 18 日
@surabhi sachdeva: What exactly is your question? Which are "these" equations? You did not post the complete definition, but only a screen shot of two equations. But even if you post the full PDF, you cannot expect the readers of a forum to do your work. Please post, what you have tried so far and ask a specific question concerning Matlab.
Please do this by editing the question, not by adding a comment or pseudo-answer. Thanks.
If you consider the two links provided by Rik, your chances to get an answer will grow.
Walter Roberson
2017 年 10 月 18 日
What would you expect the plot to look like? You have a 729 by 729 numeric array: are you looking to create a 729 x 729 image with the locations color-coded by numeric value? Are you looking to create a 729 x 729 surface with the z being the numeric value?
surabhi sachdeva
2017 年 10 月 18 日
Sir,
I want to plot these attached equations using MATLAB. For plotting these equations, there are three variables. Out of which, I have values of two variables with me. So, I am looking for the value of the third variable 'πx'. How to get the values of πx (also called steady state probability of x). I have attached the screenshot of equations and the plot.
Walter Roberson
2017 年 10 月 18 日
編集済み: Walter Roberson
2017 年 10 月 18 日
I already directed you to the steady-state formulas at https://www.mathworks.com/matlabcentral/answers/359900-how-to-calculate-steady-state-probability#answer_284483 . Use them to calculate your πx values and then you should be able to go on to the calculations to plot.
surabhi sachdeva
2017 年 10 月 18 日
編集済み: Walter Roberson
2017 年 10 月 18 日
Sir, I am unable to understand how the transition matrix got defined in he link suggested by you?
how do I have to define the transition matrix?
How have they been marked the values as attached?
Could you suggest something for my 36X36 matrix?
I mean to ask do I have to individually check each of my rows and the column for the values?
How to apply the rules? How to get such values in the transition matrix?
Walter Roberson
2017 年 10 月 18 日
You would create a matrix of the initial transition probabilities, and you would manipulate it in the way shown in order to arrive at the steady-state probabilities.
The transition matrix would be the usual: entry (J,K) says "Given that you are already in state J, what is the probability of transitioning to state K?". If you have algorithms that allow you to fill out that initial table, then you should use the algorithms.
surabhi sachdeva
2017 年 10 月 19 日
編集済み: surabhi sachdeva
2017 年 10 月 19 日
Sir, I have state transition rules available to me, which I am not able to understand how to apply to the states(J, K)
Could you please give me a hint on how to apply this kind of rules to (J, K)
I have attached rules, kindly suggest something regarding how these rules to be applied.
Here (i,j,k,l,m,n) represents a state (J,K)
Each state is represented by (i,j,k,l,m,n) e.g. 101101, 101110,..... and many more.
As, if we say for all i<Np and there is a transition from (i,j,k,l,m,n) to (i+1, j, k,l,m,n) then it should be displayed 'λp'. How is this possible?
What code is to be written in MATLAB that automatically checks for the same type of transitions?
Kindly suggest
採用された回答
Walter Roberson
2017 年 10 月 19 日
Constructing the state tables is easy if you use the 12D array that I said you should use. I already showed you how it could be done; it is frustrating that you did not carry through.
Np = 2; %last state number for each entry, states are numbered from 0 to Np
%fill in the appropriate values for these probabilities. rand() is used to have _some_ value
lam_p = rand(); %lambda subscript p
gam_p = rand(); %gamma subscript p
gam_f = rand(); %gamma subscript f
%start building the table
Index = @(state_number) 1+state_number; %helper to allow us to use state numbers instead of indices
Ns = Index(Np); %number of states
TT = zeros( Ns * ones(1, 12) ); %transition table
case1_src_i = 0:Np-1;
TT(Index(case1_src_i), :, :, :, :, :, Index(case1_src_i+1), :, :, :, :, :) = lam_p;
case2_src_i = 1:Np;
case2_src_j = 0:Np-1;
case2_src_k = 1:Np;
TT(Index(case2_src_i), Index(case2_src_j), Index(case2_src_k), :, :, :, Index(case2_src_i-1), Index(case2_src_j+1), Index(case2_src_k-1), :, :, :) = gam_p;
case3_src_n = 0:Np-1;
case3a_src_j = 1:Np;
case3b_src_k = 1:Np;
case3c_src_l = 1:Np;
TT(:, Index(case3a_src_j), :, :, :, Index(case3_src_n), :, Index(case3a_src_j-1), :, :, :, Index(case3_src_n+1)) = gam_f;
TT(:, :, Index(case3b_src_k), :, :, Index(case3_src_n), :, :, Index(case3b_src_k-1), :, :, Index(case3_src_n+1)) = gam_f;
TT(:, :, :, Index(case3c_src_l), :, Index(case3_src_n), :, :, :, Index(case3c_src_l-1), :, Index(case3_src_n+1)) = gam_f;
T2 = reshape(TT, Ns^6, Ns^6); %2D transition table
Here, T2 is the 729 x 729 array that you are expecting -- the one that you would proceed to use the numeric steady-state calculations on.
23 件のコメント
surabhi sachdeva
2017 年 10 月 19 日
Sorry, sir for the frustration I gave.
And thank you so much for your help.
I will try it right now as said by you
Regards
Surabhi
surabhi sachdeva
2017 年 10 月 27 日
Sir, Why have you used 12-D array? Can you please specify the reason?
surabhi sachdeva
2017 年 10 月 27 日
編集済み: surabhi sachdeva
2017 年 10 月 27 日
and sir,
I tried all the possible ways but I am not getting the results as expected
not able to get the values of steady-state probabilities.
Please help me out.
Regards
Surabhi
Walter Roberson
2017 年 10 月 27 日
Your rules are written in terms of (for example)
(i,j,k,l,m,n) to (i+1, j, k,l,m,n)
You have a source which is 6 dimensions long, and a destination that is 6 dimensions long, for a total of 12 dimensions. You can handle all of the (i,j,k,l,m,n) sources at once by using
(1:end-1,:,:,:,:,:)
in your source portion, and
(2:end,:,:,:,:,:)
as your destination
If you do not do this, if you encode the (i,j,k,l,m,n) into base 3 numbers from 0 to 728, then you need to figure out the decimal difference in indices between source and destination 6-tuples. For Case 1 and Case 2 that can be done as constants (same numeric difference for each situation within those two cases), but for the Case 3 situation, the difference in base 3 numbers pretty much needs to be calculated for each individual source because the numeric relationships between source and destination decimal representation are icky.
Using a 12-D representation makes the work easy and clear, and it is simple and fast to switch back to 2-D representation for final presentation.
surabhi sachdeva
2017 年 10 月 27 日
編集済み: Walter Roberson
2017 年 10 月 27 日
Now, I am trying to code the leftover 3 cases(rules) given
case4_src_n = 1:Np-1;
case4a_src_i = 0;
case4b_src_i = 1:Np;
TT(:, Index(case4a_src_i), :, :, :, Index(case4_src_n), :, Index(case4a_src_k+1), :, :, :, Index(case4a_src_n-1)) = gam_r;
TT(:, :, Index(case4b_src_i), :, :, Index(case4_src_n), :, :, Index(case4b_src_i-1), :, :, Index(case4b_src_j+1)), Index(case4b_src_n-1) = gam_r;
Why is there an error Undefined function or variable 'case4a_src_k'.
I have to code the other 3 rules as well.
Walter Roberson
2017 年 10 月 27 日
You wrote,
TT(:, Index(case4a_src_i), :, :, :, Index(case4_src_n), :, Index(case4a_src_k+1), :, :, :, Index(case4a_src_n-1)) = gam_r;
Notice this includes Index(case4a_src_k+1) but you did not define case4a_src_k .
I recommend that you re-examine the line, marking each field
i j k l m n I
TT(:, Index(case4a_src_i), :, :, :, Index(case4_src_n), :,
J K L M N
Index(case4a_src_k+1), :, :, :, Index(case4a_src_n-1))
Your variable names disagree with the slot they correspond to.
surabhi sachdeva
2017 年 10 月 27 日
Thanks, sir,
I will get back to you after coding all the rules in the way you taught me to do.
Thanks again.
Regards
Surabhi
surabhi sachdeva
2017 年 10 月 28 日
Sir
Please see once
I have got this table.
I wanted to know how can I change the values of the input rows and columns from 1,2,3,4,........... to 100001,110011,...........?
Are these values in the file states is the initial input of the matrix?
I want the entities of the file states as an input for the matrix, How can it be done?
Kindly suggest
Regards Surabhi
Walter Roberson
2017 年 10 月 28 日
I do not know where that "states" matrix came from, or why it has duplicates. If for some reason you need to convert those to 2D index numbers, then
base2dec(states, 3) + 1
surabhi sachdeva
2017 年 10 月 30 日
Sir, this doesn't work out. I am not getting the steady-state probabilities as expected. What can I do? I am feeling helpless, not able to draw the graphs.
Please help.
Walter Roberson
2017 年 10 月 30 日
Could you remind me of the full set of rules? I think I've only seen 6 of them including the three case 3s.
Also please post your current code.
surabhi sachdeva
2017 年 10 月 31 日
編集済み: surabhi sachdeva
2017 年 10 月 31 日
Sir, I want to tell you the complete scenario starting from the first.
Actually, I have been given a state-transition matrix Q having only 7 states as input. And it was mentioned it's just a part of state space and transition rates. Also, there are rules defined about these transitions.
I thought to generate the complete state space first. For which I used the MATLAB code and got 729 states with me.
Now, in order to generate the complete state transition matrix, I have to apply the transition rules to these 729 states I got. As from this state transition matrix only I will get the steady-state probabilities so as to plot the equations.
Firstly, sir I am confused do I have to generate the complete transition matrix for 729 elements or I have to use the Q (having 7 states) given to me? Can you help me regarding this?
Secondly, * If I have to generate the complete state transition matrix, please help me generating it for the entire 729 states.*
I have attached the sets of rules and the state space I got. I have also attached the state transition matrix which is given to me and I am expecting the same kind of transition rate matrix for the 729 elements.
Regards
Surabhi
Request you to also please suggest whether my idea of generating state space is right or do I have to use only the state space of 7 elements given to me?
Walter Roberson
2017 年 10 月 31 日
You need to use the full 729 states.
You did not post your current code.
surabhi sachdeva
2017 年 10 月 31 日
Currently, by using the code suggested by you, I made the code for 5 out of 6 cases given which I have attached.
I don't know whether I am going the right way or not? Please help.
I am expecting a 729 X729 matrix representation to be of the same kind as that of state space file I m uploading.
Please help me generating a 729X729 state transition matrix sir.
I would be very thankful.
Regards
Surabhi
surabhi sachdeva
2017 年 10 月 31 日
I am so sorry, sir
Please continue
Whenever you get free kindly respond
Regards
Surabhi
surabhi sachdeva
2017 年 11 月 1 日
Sir,
Kindly help me in the coding. I have attached the code file as well.
I want to use all the 729 states generated in the form of state transition matrix file I uploaded before as well.
Please help in writing the code for the same.
Regards
Surabhi
surabhi sachdeva
2017 年 11 月 1 日
Sir,
I need your help. Request you to kindly help me out solving the problem.
Regards
Surabhi
surabhi sachdeva
2017 年 11 月 4 日
@Walter Roberson sir,
You have not responded. Request you to please help me.
Regards
Surabhi
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Function Creation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)