How do I shift ONLY the y axis in a plot?
6 views (last 30 days)
Show older comments
Hello,
I want to create a graph where y runs from 0 to 500 with intervals of 20 and x runs from -0.3 to 0.3 with intervals of 0.1 each. I have written the following code which plots the graph:
% Plot for lambda = 0.5
n = 30;
dc1 = 1/30*(0.5*66+0.5*62);
dc2 = 1/30*(0.5*57+0.5*55);
dn1 = 1/30*(0.5*40+0.5*30);
dn2 = 1/30*(0.5*35+0.5*20);
dn3 = 1/30*(0.5*20+0.5*27);
e = -0.3:0.01:0.3;
bc1 = 30*dc1*(1+(dc1./(10+e)));
bc2 = 30*dc2*(1+(dc2./(10+e)));
bn1 = 30*dn1*(1+(dn1./(2+e)));
bn2 = 30*dn2*(1+(dn2./(2+e)));
bn3 = 30*dn3*(1+(dn3./(2+e)));
plot(e, bc1, 'g')
hold all
plot(e, bc2, 'r')
hold all
plot(e, bn1, 'b')
hold all
plot(e, bn2, 'y')
hold all
plot(e, bn3, 'black')
When I run this, a normal graph with the y axis at the left appears. What should I add to the code so that I can shift only the y axis at (0,0)such that (1) there's no change in the x axis, (2) no negative y axis appears.
Thank you!
4 Comments
Answers (1)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!