Loop is not running in Matlab
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Flower Rose
le 29 Nov 2019
Modifié(e) : Flower Rose
le 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 commentaires
Réponse acceptée
Stijn Haenen
le 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 commentaire
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Stress and Strain dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
