- #1
Hells_Kitchen
- 62
- 0
Homework Statement
Can someone help me set up a "for loop" for this equation
I intialize hc = x0 then I have to compute
hc1 = C.*(log(hc./b)+1)+ gamma.*(1-exp(-hc./gamma))
hc2 = C.*(log(hc1./b)+1)+ gamma.*(1-exp(-hc1./gamma))
hc3 = C.*(log(hc2./b)+1)+ gamma.*(1-exp(-hc2./gamma))
hc4 = C.*(log(hc3./b)+1)+ gamma.*(1-exp(-hc3./gamma))
.
.
.
hcn = blah blah blah
for some certain number of iterations n.
Here C, gamma and b are constants.
I'm strugling for hours with this thing.
Ultimately, though i need to set a condition when hc(n+1)-hc(n) < 0.001 then stop the loop and somehow record or print that last number of the loop
Thank you.
If someone could help me with this I would greatly greatly appreciate it!