MATLAB Answers

How to Plot in specific interval

조회 수: 4(최근 30일)
Amelia Jemy
Amelia Jemy 13 Nov 2019
Answered: KSSV 13 Nov 2019
Hey! I cant figure out how to zoom a graph.
When I run my coding, the supposed interval from -5 to 5 is changed because of the bar graph. How do I change (or zoom) the graph so it only show the range from -5 to 5?
Thanks!
x = [-5:0.01:5];
y = x.^3 + 2.*x.^2 - x + 3;
dx = diff(x)
dy = diff(y)
slope = dy ./ dx
figure(1)
plot(x,y)
hold on
bar(slope)

  댓글 수: 0

로그인 to comment.

답변 수 (1)

KSSV
KSSV 13 Nov 2019
Read about xlim
xlim([-5 5])

  댓글 수: 0

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

태그

제품


Translated by