Loop is not running in Matlab
조회 수: 2 (최근 30일)
이전 댓글 표시
I`m trying to update the variables inside the loop .
I`m sypposed to get a plot where stress and strain respectively as x and y coordinates.Unfortunately i got nothing at all.
Please help.
clc;clear;
%disp('................................Concrete properties');
Fcu=0.3; %input('Ultimate compressive strength(t/cm2)');
Ec=240.9; % Modulus of Elasticity
u=0; % Strain at oroginal point
s=0; %Stress aat original point
uy=-Fcu/Ec; % uy is the concrete strain corresponding to ultimate stress.
%number of steps for strain increment=150
%%%%%%%%%%%% Elastic Branch %%%%%%%%%%%%%%%%%%%
for i=0.0015:-0.0015:0.00001; %deltau is strian increment
if deltau(i)<0 && deltau(i)<uy
factor=(-uy-u(i))/deltau(i);
if factor>1.0 %Elastic Branch
E(i)=Ec;
u(i)=u(i)+deltau(i);
s(i)=s(i)+deltau(i)*Ec;
end
Array=[u(i),s(i)]
plot(u(i),s(i))
hold on
댓글 수: 0
채택된 답변
Stijn Haenen
2019년 11월 29일
There are some errors in your script:
i=0.0015:-0.0015:0.00001;
Only gives the number 0.0015 as output, if you want that i goes from -0.0015 to 0.0015 with steps of 0.00001 use:
i=-0.0015:0.00001:0.0015.
in your for loop i is not an integer so you cannot use deltau(i), the same hold for u(i) and s(i).
maybe you should use this:
i_list=-0.0015:0.00001:0.0015
for i=1:numel(i_list)
...
end
and two 'end' commands are missing in your script.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Stress and Strain에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!