How to record all the values from my previous loop?
Show older comments
Hi, guys! I want to retrieve all the data from my previous loop in x & y values. I want to sum up all the y values to calculate the final answer in the equation: Total_reinforcement.
This script has a problem. It only considered the final y value and put it into the equation: Total_reinforcement.
I want to sum all the y values into Total_reinforcement. How can I do that? Thank you guys. I have been hard struggle in this script.
% Circular + Retangular Shape
% Reinforcement quantity
clear
% Input
Diameter = 9100 % mm
Radius = Diameter/2 % mm
Cover = 75 % mm
Bar_Diameter = 40 % mm
Spacing = 150 % mm
Steel = 7850 % kg
% Output
R = Radius - Cover - Bar_Diameter/2
Bar_No = fix(R/Spacing)
Total_Bar_No = Bar_No * 2 + 1
x_1 = Cover + Bar_Diameter/2
x_range = 1:R;
for i = x_1:Spacing:length(x_range)
x = x_range(i)
syms y1
assume(y1 >= 0)
y = vpa(solve(sqrt((x-Radius)^2+(y1-0)^2) == Radius),5)
y1 = sum(y)
end
Total_reinforcement = vpa(y/1000*((Bar_Diameter/2)/1000)^2 * Total_Bar_No* Steel/1000 *pi*2.5,4)
Accepted Answer
More Answers (0)
Categories
Find more on Function Creation 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!