Loop is not running in Matlab
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Flower Rose
am 29 Nov. 2019
Bearbeitet: Flower Rose
am 29 Nov. 2019
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 Kommentare
Akzeptierte Antwort
Stijn Haenen
am 29 Nov. 2019
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.
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Stress and Strain finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!