Iteration to convergance

3 views (last 30 days)
x y
x y on 11 Sep 2011
Hi there, I have an equation in which the variable I'm solving for is in the equation. I'm working on solving my equation by using iterations until the variable converges. I have a painfully basic method of doing this but I'm looking to program this with something like a "for loop". Unfortunately I have Noo Idea how to. Any help would be greatly appreciated.
Thanks,
Ethan
Ps. this is an equation to determine heat flow.
clear all
close all
%Constants
lambdaE=2.8; %Effecitve Thermal Conductivity
p=2.7; %Density of Fluid and Sediment
c=4.2; %Heat Capacity of Fluid and Sediment
Ke=[lambdaE/(p*c)]; %Effective Thermal Diffusivity
f=2; %Frequency
P=(1/f); %Period
v=10; %Fluid Velocity (initial)
deltaPhi = 0.004; %Phase shift between shallow and deep points [Measured in the Lab]
Ar = 0.1; %Amp ratio of shallow and deep points[Measured in the Lab]
deltaZ=.2; %Distance between shallow and deep points
alpha=sqrt(v^4+(8*pi*Ke/P)^2);
Amp Method
%Ar=exp((deltaZ/(2*Ke))*(v-sqrt((alpha + v^2)/2)))
v1=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v^2)/2)
v2=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v1^2)/2)
v3=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v2^2)/2)
v4=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v3^2)/2)
v5=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v4^2)/2)
v6=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v5^2)/2)
v7=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v6^2)/2)
v8=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v7^2)/2)
v9=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v8^2)/2)
v10=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v9^2)/2)
v11=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v10^2)/2)
v12=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v11^2)/2)
v13=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v12^2)/2)
v14=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v13^2)/2)
v15=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v14^2)/2)
v16=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v15^2)/2)
v17=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v16^2)/2)
v18=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v17^2)/2)
v19=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v18^2)/2)
v20=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v19^2)/2)
v21=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v20^2)/2)
v22=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v21^2)/2)
v23=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v22^2)/2)
v24=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v23^2)/2)
v25=(((2*Ke)/deltaZ)*log(Ar))+ sqrt((alpha+v24^2)/2)

Answers (1)

Walter Roberson
Walter Roberson on 11 Sep 2011
I already showed the method in response to your previous question on this topic, http://www.mathworks.com/matlabcentral/answers/15351-iteration-to-convergence

Categories

Find more on Computational Fluid Dynamics (CFD) in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!