adding +-10% for each y columns

3 vues (au cours des 30 derniers jours)
Khalid
Khalid le 20 Jan 2016
Commenté : Khalid le 22 Jan 2016
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

Réponse acceptée

Ingrid
Ingrid le 20 Jan 2016
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 commentaires
Ingrid
Ingrid le 21 Jan 2016
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 le 22 Jan 2016
Thanks Ingrid a lot.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by