MATLAB: Can’t I plot such an easy graph

cell arrayplot

Dear community,
Why can't I plot such an easy graph?
for i = 1:100
x(1,:) = 1 + 2*i;
y(1,:) = 3 + i;
end
plot(x,y)
I have two arrays, how can I plot this?
Thanks in advance

Best Answer

  • Use
    v = 1:100;
    x(1,:) = 1+2.*v;
    y(1,:) = 3+v;
    plot(x,y)
    Why loop when you don't have to?