How to Plot in specific interval

94 ビュー (過去 30 日間)
Amelia Jemy
Amelia Jemy 2019 年 11 月 13 日
回答済み: KSSV 2019 年 11 月 13 日
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)

回答 (1 件)

KSSV
KSSV 2019 年 11 月 13 日
Read about xlim
xlim([-5 5])

カテゴリ

Help Center および File ExchangeVisual Exploration についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by