Plot different Y values for certain range of X

Let's say I have:
X = [1:10];
Y = [10:20];
I want to plot Y vs X, but in the range of X=[5:10] I want Y values to be (Y+20). And have the same plot line for all.
How can I do it?

Respuestas (1)

Jonas
Jonas el 7 de Mayo de 2022
you can just calculate the values before plotting
Y(X>=5 & X<=10)=Y(X>=5 & X<=10)+20;

1 comentario

Paz Yedidim
Paz Yedidim el 7 de Mayo de 2022
It is for analyzing big amount of data, and I will have to a edit Y values in several ranges of X.
Is there a more suitable way for it?

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 7 de Mayo de 2022

Comentada:

el 7 de Mayo de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by