How do I shift ONLY the y axis in a plot?
조회 수: 6 (최근 30일)
이전 댓글 표시
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
답변 (1개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!