Plotting a specific part of the array

15 次查看(过去 30 天)
I have a problem with plotting a specific part of the array. I have 3 arrays x(1,n), y1(1,n) and y2(1,n). Values in arrays y1 and y2 initially have the same value then they starting to differ to finally have the same value. A simple example is:
x1= 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14 , 15,
y1 = 4.5, 5, 5.5, 6, 7, 8, 9, 8, 7, 7, 6, 5.5, 5, 5, 4.5,
y2 = 4.5, 5, 5.5, 4, 3, 2, 1, 1, 2, 3, 4, 5.5, 5, 5, 4.5,
I would like to use the figure function but limit the input size to the only part where they differ so:
x1= 4, 5, 6, 7, 8, 9, 10, 11
y1 = 6, 7, 8, 9, 8, 7, 7, 6,
y2 = 4, 3, 2, 1, 1, 2, 3, 4,
I will apreciate any help or hint.

采纳的回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2020-9-23
编辑:KALYAN ACHARJYA 2020-9-23
idy1=y1(y1~=y2)
idy2=y2(y2~=y1)
Results:
idy1 =
6 7 8 9 8 7 7 6
idy2 =
4 3 2 1 1 2 3 4
Note: x1 having length 14, whereas y1 and y2 having length 15, Now x1 comparision with?

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by