|
Im tryng to write an iteration using a "for" loop concerning this equation:
PI = 0.5*((PI+1) + (PI-1) + ((deltaX * 3 * 0.2)/(0.00001))*(((PI+1) - (PI-1))/(2*deltaX)) + (((deltaX)^2 * 6 * 0.01 * 0.2 * 2)/0.00001^3))
The equation is concerning pressure differences over change in length (deltaX) where PI is just the next pressure (e.g. P1, P2, P3...). I need to find P1 over a range of values of deltaX:
>> deltaX = 0,0.005,0.01,0.015,0.02,0.025,0.03,0.035,0.04,0.045,0.05,0.055,0.06,0.065,0.07,0.075,0.08,0.085,0.00,0.095,0.1
My first problem is that im not sure on how to get a rage of values for P1 from each different deltaX, although I am taking (PI+1)=0 and (PI-0)=0 for my first set of pressures (P1). My second problem is I need to not only find P1 but rather keep on iterating the equation untill I get a convergance. Now I think I know what to do to get values for P1 - put deltaX into a matrix and slove for a range of P1's - but how do i create an overall "for" loop which will keep on iterating this equation using (PI-1) and (PI+1)=0
Any help in pointing me in the right direction would be fantastic and Im sorry if this is presented in an odd or confusing way, it's one of the first times I've ever used MATLAB or any other maths software so I'm still very much finding my feet.
Thanks very much,
Dave
|