How to split into small pieces of ranges of this graph?

How to split into small pieces of ranges from this graph?
Range=[ ] ?
I am not sure how to cut these graphs into smaller parts to analyze them.
I keep getting this error!!
"Array indices must be positive integers or logical values."

Answers (2)

LO
LO on 13 Jun 2021
Edited: LO on 13 Jun 2021
this plots first the first half then the second
subplot 211
plot(x(1:numel(x)/2),y(1:numel(y)/2))
subplot 212
plot(x(numel(x)/2:end),y(numel(y)/2:end))
you can also plot other ranges or segment, just indicate the proper indexes for x and y (if you have only one variable per plot then forget about the y).
for example, the following lines plot the first 100 points in 1 subplot, the second 100 are plotted in the other
subplot 211
plot(x(1:100))
subplot 212
plot(x(101:200))

6 Comments

I want both to be splitting in the same range. How do i do that one?
you probably mean this ?
range = [200:275];
subplot 211
plot(x1(range))
subplot 212
plot(x2(range))
SZ N
SZ N on 13 Jun 2021
Edited: SZ N on 13 Jun 2021
yes, exactly!
So for example, How do i split for these marked portions on the picture below and so on? Im a little confused on how to get those values for the range [ ],so that i can split them into pieces so that i can align them?
Well the values for range can be set arbitrarily by you or sequentially through a for loop For example if the ranges should be 50 points each
for n = 1:50:1000
range = n:n+49
end
Thank you so much for your help!
You're welcome! Just mark the answer accepted if it fits😊

Sign in to comment.

If you simply want to zoom in and look at a narrower viewport window, you can set the left and right ends of the x axis with the xlim() function. For example to have the graph show only the plot between 0.2 and 0.4, do
xlim([0.2, 0.4]);
after you've called plot().

Categories

Asked:

on 13 Jun 2021

Answered:

on 14 Jun 2021

Community Treasure Hunt

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

Start Hunting!