http://www.mathworks.com/matlabcentral/newsreader/view_thread/281569
MATLAB Central Newsreader  Probability
Feed for thread: Probability
enus
©19942014 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Fri, 07 May 2010 17:59:06 +0000
Probability
http://www.mathworks.com/matlabcentral/newsreader/view_thread/281569#743135
Gema Olivarria
Hi this is my 3rd time using matlab i need help with something really simple. Here's my problem:<br>
<br>
Start with point #1(i=1) whose coordinates are X(i)=0 and Y(i)=0.<br>
<br>
Calculate the coordinates of the nxt point according to the following rule:<br>
<br>
Randomly choose one of the following four events: A,B,C or D. <br>
probability of A is 0.01;<br>
probability of B is 0.06;<br>
probability of C is 0.08;<br>
probability of D is 0.85.<br>
<br>
The coordinates of the nxt pt are:<br>
<br>
If A occurred, X(i+1)=0, Y(i+1)=0.16Y(i);<br>
If B occurred, X(i+1)=0.20X(i)0.26Y(i), Y(i+1)=0.23X(i)+0.22Y(i)+1.6;<br>
etc.,<br>
<br>
My question is, how do i assign the probabilities to each of these functions? what syntax do i use?

Fri, 07 May 2010 18:12:04 +0000
Re: Probability
http://www.mathworks.com/matlabcentral/newsreader/view_thread/281569#743138
us
"Gema Olivarria" <gforgamgee@yahoo.com> wrote in message <hs1kd9$evs$1@fred.mathworks.com>...<br>
> Hi this is my 3rd time using matlab i need help with something really simple. Here's my problem:<br>
> <br>
> Start with point #1(i=1) whose coordinates are X(i)=0 and Y(i)=0.<br>
> <br>
> Calculate the coordinates of the nxt point according to the following rule:<br>
> <br>
> Randomly choose one of the following four events: A,B,C or D. <br>
> probability of A is 0.01;<br>
> probability of B is 0.06;<br>
> probability of C is 0.08;<br>
> probability of D is 0.85.<br>
> <br>
> The coordinates of the nxt pt are:<br>
> <br>
> If A occurred, X(i+1)=0, Y(i+1)=0.16Y(i);<br>
> If B occurred, X(i+1)=0.20X(i)0.26Y(i), Y(i+1)=0.23X(i)+0.22Y(i)+1.6;<br>
> etc.,<br>
> <br>
> My question is, how do i assign the probabilities to each of these functions? what syntax do i use?<br>
<br>
a this point in your ML life, you should dig into<br>
<br>
<a href="http://www.mathworks.com/access/helpdesk/help/techdoc/learn_matlab/bqr_2pl.html">http://www.mathworks.com/access/helpdesk/help/techdoc/learn_matlab/bqr_2pl.html</a><br>
<br>
us

Fri, 07 May 2010 19:08:04 +0000
Re: Probability
http://www.mathworks.com/matlabcentral/newsreader/view_thread/281569#743166
Roger Stafford
"Gema Olivarria" <gforgamgee@yahoo.com> wrote in message <hs1kd9$evs$1@fred.mathworks.com>...<br>
> Hi this is my 3rd time using matlab i need help with something really simple. Here's my problem:<br>
> <br>
> Start with point #1(i=1) whose coordinates are X(i)=0 and Y(i)=0.<br>
> <br>
> Calculate the coordinates of the nxt point according to the following rule:<br>
> <br>
> Randomly choose one of the following four events: A,B,C or D. <br>
> probability of A is 0.01;<br>
> probability of B is 0.06;<br>
> probability of C is 0.08;<br>
> probability of D is 0.85.<br>
> <br>
> The coordinates of the nxt pt are:<br>
> <br>
> If A occurred, X(i+1)=0, Y(i+1)=0.16Y(i);<br>
> If B occurred, X(i+1)=0.20X(i)0.26Y(i), Y(i+1)=0.23X(i)+0.22Y(i)+1.6;<br>
> etc.,<br>
> <br>
> My question is, how do i assign the probabilities to each of these functions? what syntax do i use?<br>
       <br>
Urs has given you excellent advice, Gema. However, I am guessing that if I give you the following matlab code as a hint for part of your problem without any explanation whatever, then having to figure out how and why it works and just what role it will play in your problem, should give you an added motivation to do the studying he recommends. I hope I am right.<br>
<br>
r = rand;<br>
k = (r<=.85)+(r<=.85+.08)+(r<=.85+.08+.06)+1;<br>
<br>
Roger Stafford

Fri, 07 May 2010 19:25:06 +0000
Re: Probability
http://www.mathworks.com/matlabcentral/newsreader/view_thread/281569#743173
Roger Stafford
Please don't enter multiple threads with the same query, Gema. It creates resentment on the part of us who are endeavoring to answer you. I know I resent it.<br>
<br>
Roger Stafford