Plotting a specific part of the array

15 Ansichten (letzte 30 Tage)
Mateusz Brzezinski
Mateusz Brzezinski am 23 Sep. 2020
Bearbeitet: KALYAN ACHARJYA am 23 Sep. 2020
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.

Akzeptierte Antwort

KALYAN ACHARJYA
KALYAN ACHARJYA am 23 Sep. 2020
Bearbeitet: KALYAN ACHARJYA am 23 Sep. 2020
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?

Weitere Antworten (0)

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by