Help with iteration!!?

Can anyone help me with iteration and convergence? I need my new Wd to converge with the old Wd in my loop.
ci=174.0453; %Cone index in psi
hr=15.1; %rear tire section height (in)
br=19; %unloaded tire section width rear (in)
dr=80.8; %unloaded overall diameter (in)
SLRR= 37; %static loaded radius of rear tire (in)
Wsar=22575; %the static rear axle load
t=18*(pi/180); %18 degree angle
deltar= ((80.8/2)-27);
dbh=20.5; %drawbar height (in)
bf=16.5; %unloaded tire section width (in)
hf=14.06; %front tire section height (in)
df=62.6; %unloaded overall diameter (in)
SLRF= 28.4; %static loaded radius of rear tire (in)
Wsaf=17455; %the static rear axle load
deltaf= ((62.5/2)-28.4);
s=.01:.001:.2; %slip range 1-20 increments of .1
Wstf= Wsaf/4;
Wstr=Wsar/6;
Wdf=Wstf;
Wdr=Wstr;
for s=.01:.001:.2;
Bnf=((ci*bf*df)/Wdf)*((1+5*(deltaf/hf))/(1+3*(bf/df)));
Bnr=((ci*bf*dr)/Wdr)*((1+5*(deltar/hr))/(1+3*(br/dr)));
NTf=Wdf*(.88*(1-exp(-.1*Bnf))*(1-exp(-7.5*s))-(1/Bnf)-((.5*s)/sqrt(Bnf)));
NTr=Wdr*(.88*(1-exp(-.1*Bnr))*(1-exp(-7.5*s))-(1/Bnr)-((.5*s)/sqrt(Bnr)));
Px=NTf+NTr;
omega= 72*(pi/180);
Py= ((Px/sin(omega))*sin(t));
P=sqrt((Py).^2+(Px).^2);
Wd=Wstf-Py;
Wd1=Wstr-Py;
while (Wdf-Wd)> 0.0001;
(Wdr-Wd1)>0.0001;
Wd1=Wdr;
Wd=Wdf;
end
end

1 Comment

can you edit your message with a empty space in front of the code?.
%space ... then the code

Answers (1)

Roger Stafford
Roger Stafford on 9 Apr 2016

0 votes

Your while-loop does not seem to be very useful. On the first pass through it sets Wd equal to Wdf and because the "(Wdf-Wd)> 0.0001" condition will then fail, that is also its last pass through the loop. You need to rethink what you are trying to accomplish here.

2 Comments

Garrett
Garrett on 9 Apr 2016
So if I need my new W to converge with my old W, should I run a for loop instead of a while loop? I'm new to matlab so this is a lot to take in.
You will have to do some explaining about what you are trying to accomplish. We don't know what you mean by the "old W" and the "new W". Give a good explanation in plain English about what you are trying to achieve with your variable Wd and Wd1.

This question is closed.

Asked:

on 9 Apr 2016

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!