What's going on when setting these parameters?
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!
Answers (2)
Les Beckham
on 28 Feb 2022
0 votes
That sets the increment for the x vector.
Read the documentation for the colon operator: colon
Image Analyst
on 28 Feb 2022
0 votes
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.
Categories
Find more on Plot Customization 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!