adding +-10% for each y columns

조회 수: 1 (최근 30일)
Khalid
Khalid 2016년 1월 20일
댓글: Khalid 2016년 1월 22일
I have an data in matrix 100X6 (the first two columns are x1 & y1, other two columns x2 & y2 etc.) and I would like to make a plus and minus 10% in each y column data!! old matrix: x1 y1 x2 y2 x3 y3 " " " " " " " " " " " " " " " " " " new matrix: x1 y1 y12 y13 x2 y2 y22 y23 x3 y3 y32 y33 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " then plot x1 with y1,y12, and y13 data then plot x2 with y2,y22, and y23 data etc
Thanks

채택된 답변

Ingrid
Ingrid 2016년 1월 20일
you do not need to create new columns to do this, just add/subtract the 10% in the plot command directly
plot(x1,y1,'k-',x1,0.9*y1,'r:',x1,1.1*y1,'r:')
  댓글 수: 3
Ingrid
Ingrid 2016년 1월 21일
if your original matrix is A and the new matrix you want is B you can just do:
B = [A(:,1), A(:,2), 0.9*A(:,2), 1.1*A(:,2), A(:,3), ...
A(:,4),0.9*A(:,4), 1.1*A(:,4), A(:,5), A(:,6), 0.9*A(:,6), 1.1*A(:,6)];
Khalid
Khalid 2016년 1월 22일
Thanks Ingrid a lot.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by