MATLAB Answers

Hold on Not showing all of my plots on one graph

25 views (last 30 days)
Q = .07; %(kg/s)
H = 225; %(m)
x = 0.2:10^-3:100;
Bx = 0.2:10^-3:100;%(km)
y = 0 ;%(km)
z = 0; %(km)
U = 3.1 ;%(m/s)
a = 68;
b = .894;
if x < 1 %(km)
c = 33.2;
d = .725;
f = -1.7;
else c = 44.5;
d = .516;
f = -13;
sigmay = a*x.^b;
sigmaz = c*x.^d + f;
Ba = 156;
Bb = .894;
if x < 1 %(km)
Bc = 106.6;
Bd = 1.149;
Bf = 3.3;
else Bc = 108.2;
Bd = 1.098;
Bf = 2.0;
Bsigmay = a*Bx.^b;
Bsigmaz = c*Bx.^d + f;
loglog(Bx,Bsigmay,'b')
hold on
loglog(Bx,Bsigmaz,'r')
hold on
loglog(x,sigmay)
hold on
loglog(x,sigmaz)
end
end
I am trying to plot for lines on one graph but only two lines are showing up. I have used the "hold on" command but it still only plots two lines instead of four.

Accepted Answer

Alex Mcaulley
Alex Mcaulley on 4 Feb 2020
Take a look at the variables you are plotting, they are duplicated. I mean Bsigmay is equal to sigmay, Bsigmaz is equal to sigmaz and Bx is equal to x. Then, your lines are overlapped and you can see just two lines.

More Answers (1)

Ari Henderson
Ari Henderson on 4 Feb 2020
I realized that mistake right before you answered. Thank you!!!

Community Treasure Hunt

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

Start Hunting!