What's going on when setting these parameters?
1 view (last 30 days)
Show older comments
So my question is quite simple.
I'm plotting, for example:
x=[0:0.1:4]
plot(x, sqrt(x), 'b.-')
title('Square root')
grid on
From trial & error I see that the numbers 0, 4 are my x-axis parameters, i.e. I'm printing the function for XE[0,5].
What exactly is the 0.1 for? What's that number doing? What's its purpose?
Thanks!
0 Comments
Answers (2)
Les Beckham
on 28 Feb 2022
That sets the increment for the x vector.
Read the documentation for the colon operator: colon
0 Comments
Image Analyst
on 28 Feb 2022
It's the step distance from one x value to the next. Look at your x values:
x = 0 0.1000 0.2000 0.3000 0.4000
See, they're 0.1 apart.
0 Comments
See Also
Categories
Find more on Creating and Concatenating Matrices 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!