How am I suppose to fix this error. I am trying to run the code in order to get a stress vs strain plot and find the value described in the script.

조회 수: 1 (최근 30일)
clear all
close all
clc
S = readtable("/Users/nickolibrice/Downloads/526projdata.xlsx");
y = S(: , 1); %load
x = S(:, 2); %deflection
Stress = y/(3.14*4*4) ;% r is the original radius of specimen
Strain = (x - lo)/lo % lo is the original length of specimen
plot(strain,stress)
%In the plot of stress strain curve choose any two points before proportionality limit and export it to the workspace as point1 and point2. Now if you enter the point1 in the workspace, then it will show the corresponding stress and strain value. Let the stress and strain at point1 be y1 and x1, similarily for point2 stress and strain be y2 and x2.
Elastic modulus(m) = Stress/Strain = (y2-y1)/(x2-x1)
%Yield point is a point where the stress strain curve and 0.2% offset yield line intersects.
let X = 0.002 : 0.000001 : 0.006
Y = m*(X-0.002)
hold on
plot(X,Y,'r')
%After plotting you will see both offset line graph and previous stress strain curve on the same graph. The intersection of these two graph will be the Yield point.
%Ultimate Strength is the maximum value of stress the specimen can bear.
Ultimate strength = max(Stress)
%Breaking Strength is the stress value at the point of fracture i.e the end point
Breaking strength = Strength(end)
Error using /
Arguments must be numeric, char, or logical.
Error in Finalprojectscript (line 14)
Stress = y/(3.14*4*4) ;% r is the original radius of specimen
  댓글 수: 3
Nick Olibrice
Nick Olibrice 2021년 11월 24일
Excel? Not sure what you mean by this but I assume this is what you mean.
Dyuman Joshi
Dyuman Joshi 2021년 11월 24일
Data type meaning - char/double/string etc.
When you load the excel file and define "y" check in the workspace what it says.

댓글을 달려면 로그인하십시오.

채택된 답변

per isakson
per isakson 2021년 11월 24일
편집: per isakson 2021년 11월 24일
This script runs without throwing errors; the syntax is correct. I assigned values to some undefined variables, lo, m, x, y.
Comparing this script with your script will help you spot your errors.
%%
% clear all
% close all
% clc
lo = 1;
m = 1;
% S = readtable("/Users/nickolibrice/Downloads/526projdata.xlsx");
% y = S(: , 1); %load
% x = S(:, 2); %deflection
x = rand(12,1);
y = x + 0.1*rand(12,1);
Stress = y/(3.14*4*4); % r is the original radius of specimen
Strain = (x - lo)/lo; % lo is the original length of specimen
% plot(strain,stress)
plot( Strain, Stress, '+b' )
% In the plot of stress strain curve choose any two points before proportionality limit
% and export it to the workspace as point1 and point2. Now if you enter the point1 in the
% workspace, then it will show the corresponding stress and strain value. Let the stress
% and strain at point1 be y1 and x1, similarily for point2 stress and strain be y2 and x2.
% Elastic modulus(m) = Stress/Strain = (y2-y1)/(x2-x1)
ElasticModulus = Stress/Strain; % = (y2-y1)/(x2-x1);
% Yield point is a point where the stress strain curve and 0.2% offset yield line
% intersects.
% let X = 0.002 : 0.000001 : 0.006 ;
X = 0.002 : 0.000001 : 0.006 ;
Y = m*(X-0.002);
hold on
plot(X,Y,'r')
% After plotting you will see both offset line graph and previous stress strain curve on
% the same graph. The intersection of these two graph will be the Yield point.
% Ultimate Strength is the maximum value of stress the specimen can bear.
% Ultimate strength = max(Stress)
UltimateStrength = max(Stress);
% Breaking Strength is the stress value at the point of fracture i.e the end point
% Breaking strength = Strength(end)
BreakingStrength = Stress(end);

추가 답변 (0개)

카테고리

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