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?

답변 (1개)

Jonas
Jonas 2022년 5월 7일

0 개 추천

you can just calculate the values before plotting
Y(X>=5 & X<=10)=Y(X>=5 & X<=10)+20;

댓글 수: 1

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?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

2022년 5월 7일

댓글:

2022년 5월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by