How can I run a calculation multiple times?
3 views (last 30 days)
Show older comments
friedl hulsmans
on 17 Nov 2017
Commented: friedl hulsmans
on 17 Nov 2017
How can I run this calculation multiple times?
c1 = 40 - 10;
c2 = 40 + ((600/210) + (275/21));
c = c1 + rand * (c2 - c1);
fck = 26 + rand * (34-26);
b1 = 300 - ((300/50)+7);
b2 = 300 + ((300/50)+7);
b = b1 + rand * (b2 - b1);
h1 = 600 - ((600/140)+(85/7));
h2 = 600 + ((600/140) + (85/7));
h = h1 + rand * (h2 - h1);
qb = 9.9775+rand *(10.0225-9.9775);
qs1 = 24.9775+ rand * (25.0225-24.9775);
ns1 = 2;
qs2 = 13.9775+ rand * (14.0225-13.9775);
ns2 = 2;
q1 = 0.8*1.5;
q2 = 1.4 * 1.5;
q = q1 + rand * (q2 - q1);
med = 96 * (10^6)+ rand * (144 * (10^6) - 96 * (10^6));
Es = 200000;
fyk = 500;
fcm = fck + 4 +rand * (12 - 4) ;
Ecm = 22000*((fcm/10)^0.3);
Ec = Ecm / (1 + q);
alpha = Es / Ec;
d1 = c + qb + (qs1/2);
d2 = c + qb + (qs2/2);
d = h - d1;
As1 = (pi * ns1 * (qs1^2))/4;
As2 = (pi * ns2 * (qs2^2))/4;
Astot = As1 + As2;
x = ((-alpha *Astot)/b)+ sqrt(((alpha*Astot/b)^2)+((2*alpha*(As1*d+As2*d2))/b));
fctm = 0.3 * (fck ^(2/3));
I = ((b*(x^3)/3))+ alpha * As1*((d-x)^2)+ alpha * As2*((x-d2)^2);
sigmac = med*x /I;
sigmas = alpha * sigmac * (d-x)/x;
h1 = (h-x)/3;
h2 = 2.5*(h-d);
h3 = h/2;
H = [h1 h2 h3];
Aceff = b*min(H);
rhoeff = As1/Aceff;
Srmax = 3.4 * c + 0.17* qs1 / rhoeff;
epsilon1 = 0.6*sigmas/200000;
epsilon2 = (sigmas / 200000)-(0.4*fctm*(1+alpha*rhoeff)/(rhoeff*200000));
epsilon = max(epsilon1,epsilon2);
wk = Srmax*epsilon
1 Comment
Walter Roberson
on 17 Nov 2017
This is an expansion of https://www.mathworks.com/matlabcentral/answers/367558-how-can-i-run-a-calculation-multiple-times which also has an answer
Accepted Answer
Birdman
on 17 Nov 2017
for i=1:N
_your code goes here_
end
N denotes the number of times your code is going to be operated.
More Answers (0)
See Also
Categories
Find more on Data Preprocessing 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!