MATLAB: Making a point of data into matrix/vector form

graphplot

my while loop for my every variable, n run ill get my i and therefore i got a few x and y coordinate in which when i use plot (x,y) they appear in dots only not in line how i make my graph into both dots and line?

Best Answer

You did not post any code, but this is not the first time this problem has presented here.
Subscript your ‘x’ and ‘y’ values in the loop, then plot them after the loop.
For example:
for k1 = 1:10
x(k1) = k1.^2;
y(k1) = 3 + 2*k1;
end
figure(1)
plot(x, y)
grid
Also, it is best not to use ‘i’ or ‘j’ as variables or loop counters in your code. MATLAB uses them for its imaginary operators, and using them as variables can be confusing.