Making a point of data into matrix/vector form
2 views (last 30 days)
Show older comments
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?
0 Comments
Accepted Answer
Star Strider
on 9 May 2015
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.
12 Comments
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!