how can i shrink my plot to fit into a given range on the x axis

4 ビュー (過去 30 日間)
omar mahallawy
omar mahallawy 2019 年 2 月 27 日
回答済み: Yasasvi Harish Kumar 2019 年 3 月 1 日
hello, i needed to know if there is a way were i can shrink my plot.
i have a graph that repeats its self (n) number of times depending on a variable in a loop
the problem is that, when it comes to plotting the data, it doubles its self using using double the specified length on the x-axis.
as you can see here, point 2 should be placed at point 1, and point 1 should be shifted to the left (i.e) the x axis should not exceed the 3.2*10^5.
attached here is a text file with my code
matlab.PNG
  3 件のコメント
omar mahallawy
omar mahallawy 2019 年 2 月 28 日
but this isn't the answer to my question!
axis limits crops the whole graph to the speficied range not the plot!
i want my graph to end at a certain value

サインインしてコメントする。

回答 (1 件)

Yasasvi Harish Kumar
Yasasvi Harish Kumar 2019 年 3 月 1 日
Hi,
Say you have y data and x data.
count = 0;
for i = 1:length(y)
if y(i) == 0
count = count + 1;
xli(count) = x(i);
end
end
for i = 1:count
subplot(count,1,i);
plot(x,y);
xlim(xli(i));
end
The above should help you.
Regards

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by