adding +-10% for each y columns

1 visualizzazione (ultimi 30 giorni)
Khalid
Khalid il 20 Gen 2016
Commentato: Khalid il 22 Gen 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

Risposta accettata

Ingrid
Ingrid il 20 Gen 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 Commenti
Ingrid
Ingrid il 21 Gen 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 il 22 Gen 2016
Thanks Ingrid a lot.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by