MATLAB Answers

plot corresponding rows of 2 matrices

1 view (last 30 days)
MatG
MatG on 8 Sep 2020
Answered: madhan ravi on 8 Sep 2020
Is there an easy way to use plot, or a similar plottign command, to plot rows of matrix X as x value vs rows of matrix Y as y value?
x=[1 2 3 4;1.5 2 3.4 4.3];
y=2*[1 2 3 4;1.5, 2 3.4, 4.3];
% I want to replace the following for loop
for i = 1:siz(x,1)
plot(x(i,:),y(i,:));hold on;
end

  0 Comments

Sign in to comment.

Accepted Answer

madhan ravi
madhan ravi on 8 Sep 2020
plot(x.', y.')

  0 Comments

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!