Plotting vectors making chart

1 次查看(过去 30 天)
Vc27
Vc27 2022-11-17
编辑: Voss 2022-11-18
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

采纳的回答

Voss
Voss 2022-11-17
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 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Polynomials 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by