How do you plot two vectors starting from different points

2 visualizaciones (últimos 30 días)
Suppose I have three vectors: Year=[2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010], X=[1 2 1 4 5 6 7 2 3 5 6], and Y=[12 3 4].
I want to plot them on the same graph where 'Year' is on the X axis but where 'Y' starts at the year 2004. How do I do this?

Respuesta aceptada

David Hill
David Hill el 7 de Abr. de 2022
Year=[2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010];
X=[1 2 1 4 5 6 7 2 3 5 6];
Y=[12 3 4];
plot(Year,X,Year(5:7),Y)

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by