Info

# I need some help getting my loop to work, I'll post a full script below, Thanks in advance.

1 view (last 30 days)
Jim Tom on 27 Feb 2018
Closed: MATLAB Answer Bot on 20 Aug 2021
if true
% code
end
Do = 15; % diameter of die inlet [mm]
D1 = 9; % diameter of die outlet [mm]
Eps = 300; % strain hardening exponent [N/mm^2]
u = 0; % friction coefficient
Yo = 250; % yield stress [n/mm^2]
x(1) = 0;
sigma_x(1) = 0;
D(1) = Do;
Y(1) = Yo;
p(1) = Yo; % die pressure
alpha = 12*(180/pi);
n = 10; % number of slices
dD = (Do-D1)/n; % step size
dx = (dD)/(2*tan(alpha));
for count=1:n
dsigma_x = (2/D)*(sigma_x + (Y-sigma_x)*(1+u*cot(alpha)))*dD;
sigma_x(count+1) = sigma_x(count)+dsigma_x;
D = D-dD;
strain = 2*log(Do/D);
Y = Yo + Eps*strain;
p(count+1) = Y - sigma_x(count+1);
x(count+1) = x(count)+dx;
end
figure(1)
plot(x, sigma_x)
xlabel('x')
ylabel('y')
figure(2)
plot(x, p)
xlabel('x')
ylabel('y')

KSSV on 27 Feb 2018
Do = 15; % diameter of die inlet [mm]
D1 = 9; % diameter of die outlet [mm]
Eps = 300; % strain hardening exponent [N/mm^2]
n = 10; % number of slices
u = 0; % friction coefficient
Yo = 250; % yield stress [n/mm^2]
x(1) = 0;
sigma_x(n,1) = 0;
D(1) = Do;
Y(1) = Yo;
p(1) = Yo; % die pressure
alpha = 12*(180/pi);
dD = (Do-D1)/n; % step size
dx = (dD)/(2*tan(alpha));
for count=1:n
dsigma_x = (2/D)*(sigma_x(count) + (Y-sigma_x(count))*(1+u*cot(alpha)))*dD;
sigma_x(count+1) = sigma_x(count)+dsigma_x;
D = D-dD;
strain = 2*log(Do/D);
Y = Yo + Eps*strain;
p(count+1) = Y - sigma_x(count+1);
x(count+1) = x(count)+dx;
end
figure(1)
plot(x, sigma_x)
xlabel('x')
ylabel('y')
figure(2)
plot(x, p)
xlabel('x')
ylabel('y')