Generates for loop for Stress and Strain

11 次查看(过去 30 天)
I am given a problem where I have to generate data point to plot. This values will show how a biomaterial is reacting.
Here are the values given to me.
Question : Model the elastic-plastic behavior of the sample polymer given above. Create a Matlab
program to model the above equations to plot a stress-strain curve.
This what I done so far yet my for loop is not working; thus I can generate the nessary data points to plot. Please help I am not very verse in Matlab.
E1=4.0; %4 is in GPa
E2=5.0; %5 is in GPa
Mu= 1.2*10^5; %this measures creep
stressO = 800*10^6; %this is initial stress
for i=0:stressO
data.less(i)=i/(E1); % Yielding when applies stress is less than initial stress
end
for i=stressO:(1.5*10^9)
data.great(i)=(i/(E1))+((i-stressO)/E2); % Yielding when applies stress is less than initial stress
end
subplot (2,1,1)
plot (data.less);
subplot (2,1,2)
plot (data.great);

采纳的回答

darova
darova 2020-4-14
编辑:darova 2020-4-14
Here is the problem
The solution:
sp = stress0.plus10:1500
for i = 1:length(sp);
strain.stressplus10(i)=(sp(i)/E1)+((sp(i)-stress0.plus10)/E2);
end

更多回答(1 个)

darova
darova 2020-4-13
编辑:darova 2020-4-13
here are modifications needed to be done. No for loop is needed
  1 个评论
Pablo Tejada Jr.
Pablo Tejada Jr. 2020-4-14
I Thank you for your answer and aiding me. Yet the reason I opt to a "For Loop" becuase I wanted to have a singular data variable that is chaning over stresses. I was able to modify my code to anwers question A through D; However, I am facing another problem with part E. I get an error message when I add/subtract .1 from stress0 in the "for Loop"
a) Model the elastic-plastic behavior of the sample polymer given above. Create a Matlab, Simulink (or other appropriate platform) program to model the above equations to plot a stress-strain curve.
b) Use the given constants and yield point above to plot the stress-strain curve. Vary stress from 0 to 1.5 GPa for the graphs. Note this plot has two ranges and two equations that go into the same graph.
c) Change E1 by + and – 10% and plot the result on the graphs above. Describe how this element changes the behavior of the material.
d) Change E2 by + and – 10% and plot the result on a new set of graphs. Describe how this element changes the behavior of the material.
e) Change the yield stress0 by + and – 10% and plot the result on a new set of graphs. Describe how this element changes the behavior of the material.
Here is my code
%% Assigning Values to the Variables
clc
clear all
close all
E1=4000; %4GPa written in 4000 MPa
E2=5000; %5GPa written in 5000 MPa
Mu= 1.2*10^5; %this measures creep
stress0.norm = 800; %this is initial stress value is in MPa
%The Following values are used to answer part E
stress0.plus10 = 800+.1;
stress0.minus10 = 800-.1;
%% Generating Data Points Using "For Loop"
% The following loop generates points with E1 and E2. Answers for part
% B,C&D
for i=1:stress0.norm
strain.normal(i)=i/E1; % This is storing the values before yielding
%Answer for part C
strain.E1plus10(i)=i/(E1+.1); % This is storing the values before yielding with E1 + 10%
strain.E1minus10(i)=i/(E1-.1); % This is storing the values before yielding with E1 - 10%
%Answer for part D
strain.E2plus10(i)=i/E1; % This is storing the values before yielding
strain.E2minus10(i)=i/E1; % This is storing the values before yielding
end
for i=stress0.norm:1500 %this is the finising stress in MPa (after yielding
strain.normal(i)=(i/E1)+((i-stress0.norm)/E2); % This is storing the values after yielding
%Answer for part C
strain.E1plus10(i)=(i/E1+.1)+((i-stress0.norm)/E2); % This is storing the values after yielding with E1 + 10%
strain.E1minus10(i)=(i/E1-.1)+((i-stress0.norm)/E2); % This is storing the values after yielding with E1 + 10%
%Answer for part D
strain.E2plus10(i)=(i/E1)+((i-stress0.norm)/(E2+.1));
strain.E2minus10(i)=(i/E1)+((i-stress0.norm)/(E2-.1));
end
% Creating a another seperated loop for changes in stress0
% for stress0+10%
for i=1:stress0.plus10
strain.stress0plus10(i)=i/E1;
end
for i=stress0.plus10;1500
strain.stressplus10(i)=(i/E1)+((i-stress0.plus10)/E2);
end
% for stress0-10%
for i=1:stress0.minus10
strain.stressMinus10(i)=i/E1;
end
for i=stress0.minus10;1500
strain.stressMinus10(i)=(i/E1)+((i-stress0.minus10)/E2);
end
%% The following lines plots the data before stress0 is modified

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Stress and Strain 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by