Azzera filtri
Azzera filtri

Plotting vectors making chart

1 visualizzazione (ultimi 30 giorni)
Vc27
Vc27 il 17 Nov 2022
Modificato: Voss il 18 Nov 2022
I have a 25x5 matrix, M, I want to obtain values from the third column which are >1.5, <0.5, and the remaining values of the third column. I would ideally like to plot them in different colors on the same graph. so far I have got this but I don't think its correct, N=M(:,3) if N>1.5 plot(N, 'r') hold on if N<0.5 plot(N, 'b') hold on plot(N, 'g') end
Thanks

Risposta accettata

Voss
Voss il 17 Nov 2022
Maybe something like this?
M = randn(100,5); % some random data for demo
N = M(:,3);
idx = find(N > 1.5);
plot(idx, N(idx), 'r.')
hold on
idx = find(N < 0.5);
plot(idx, N(idx), 'b.')
idx = find(N >= 0.5 & N <= 1.5);
plot(idx, N(idx), 'g.')
  4 Commenti
Vc27
Vc27 il 17 Nov 2022
Thank you!
Voss
Voss il 17 Nov 2022
You're welcome!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Polynomials 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