plot a certain x,y values from a large matrix
조회 수: 3 (최근 30일)
이전 댓글 표시
hi,
i have a 4000rows(with x value from 1:4000) and 2 column (of y values) matrix. How can i plot x&y with, say, taking x value from x > 500 and x<2500 and their corresponding y values?
thank you very much.
댓글 수: 0
답변 (2개)
Lessmann
2015년 8월 13일
You can use the colon operator to select a subset of your vector, like
plot(x(500:2500),y(500:2500))
Star Strider
2015년 8월 13일
This works:
x = randi(4000, 1, 100); % Create Data
y = randi(99, 2, 100);
xp = x(x>500 & x<2500);
yp = y(:,(x>500 & x<2500));
figure(1)
plot(xp, yp, 'bp')
grid
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!