%Program to solve toy beam bending problem

%Calculate reactions
[A] = [1 1; 0 12];
B = [400;  2400];
R = A\B

%Calculate sigma at o
M = -600;
ro = 2e-2;
for k=1:11
    ri(k) = 1e-2*( 0.5 + 0.1*(k-1) ) ;
    I = pi*(ro^4-ri(k)^4)/4;
    sigma_x(k) = -1e-6*M*ro/I;
end

%Plot sigma_x vs. ri
plot(1e2*ri,sigma_x,'-r');
xlabel('r_i (cm)'); 
ylabel('\sigma_x at O (MPa)');
