What's going on when setting these parameters?
Afficher commentaires plus anciens
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!
Réponses (2)
Les Beckham
le 28 Fév 2022
0 votes
That sets the increment for the x vector.
Read the documentation for the colon operator: colon
Image Analyst
le 28 Fév 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.
Catégories
En savoir plus sur Plot Customization dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
