MATLAB Answers

# plotting a straight line with slope and a single point

2 views (last 30 days)
Eddy Ramirez on 4 May 2021
Commented: Eddy Ramirez on 4 May 2021
Greetings,
I am trying to plot the following items with given slope and x,y coordinate (single points)
%%%Y-Values
Stress_fail_GF=2.1;
Stress_fail_AF=2.8;
Stress_fail_Matrix=0.1;
%%%X-Value
Strain_fail_GF=.0054;
Strain_fail_AF=.021;
Strain_fail_Matrix=.33;
%%%Modulus - Slope
GF_Modulus=Stress_fail_GF/Strain_fail_GF;
AF_Modulus=Stress_fail_AF/Strain_fail_AF;
Matrix_Modulus=Stress_fail_Matrix/Strain_fail_Matrix;
%%% I tested the following, but it provides a blank graph
x = Stress_fail_GF;
m = GF_Modulus;
b = Strain_fail_GF;
y = m*x + b;
figure(1)
plot(x, y)
grid
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Answers (1)

VBBV on 4 May 2021
Edited: VBBV on 4 May 2021
%if true
%%%Y-Values
Stress_fail_GF=[1.2 2.1];
Stress_fail_AF=2.8;
Stress_fail_Matrix=0.1;
%%%X-Value
Strain_fail_GF=[0.0032 .0054];
Strain_fail_AF=.021;
Strain_fail_Matrix=.33;
%%%Modulus - Slope
GF_Modulus=Stress_fail_GF/Strain_fail_GF;
AF_Modulus=Stress_fail_AF/Strain_fail_AF;
Matrix_Modulus=Stress_fail_Matrix/Strain_fail_Matrix;
%%%I tested the following, but it provides a blank graph
x = Stress_fail_GF;
m = GF_Modulus;
b = Strain_fail_GF;
y = m.*x + b;
figure(1)
plot(x, y)
grid
##### 5 CommentsShowHide 4 older comments
Eddy Ramirez on 4 May 2021
gotcha yeah I need a straight line that goes up to that point

Sign in to comment.

### Community Treasure Hunt

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

Start Hunting!