How to update variable content for every iteration?

hi everyone. i need some help regarding to my code which is as follow. this is what i am doing initially i have assume the value ti0 and tb0. after some process new ti1 and tb1 is calculated the problem which i am facing is that i have to update tb0 and ti0 with this new value until it reaches to 1. hope i can get some help with this
while(ti0<=1&&tb0<=1)
tin=0;
tbn=0;
p0=1-(1-ti0).^(n-1);
p1=1-(1-tb0).^(n-1);
q0=(1-ti0).^n;
q1=(1-tb0).^n;
Pidl=q1./(1-q0+q1);
ti=b0./Pidl;
tb=b1./(1-Pidl);
ti1=0.5.*ti0+0.5.*ti;
tb1=0.5.*tb0+0.5.*tb;
tin=tin+ti1;
ti0=tin;
tbn=tbn+tb1;
tb0=tbn;
end

Respuestas (1)

Image Analyst
Image Analyst el 20 de Ag. de 2016

0 votos

It looks like you are assigning some new values to them at the end of the loop. Now whether those are the right values, I don't know, since there are no comments in this code to explain what it's doing and therefore I didn't want to spend much time delving into it. So all I can suggest is that since you want to exit the while loop when both values equal one, you'll want to remove the equal signs from "while(ti0<=1&&tb0<=1)" otherwise when it reaches 1 it will still keep on doing the loop.
Any other problem you have can be solved after looking at this link

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Preguntada:

el 19 de Ag. de 2016

Respondida:

el 20 de Ag. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by