x=linspace(0,pi,100) and x=0:0.01:pi
Mostra commenti meno recenti
what is different with x=linspace(0,pi,100) and x=0:0.01:pi??
Risposta accettata
Più risposte (1)
madhan ravi
il 26 Mar 2019
linspace creates vector from to 0 to pi with 100 numbers
The other creates a vector with a step .01.
Please read the below documentations:
doc linspace
doc colon
3 Commenti
Allan Lee
il 26 Mar 2019
Walter Roberson
il 26 Mar 2019
Also, there are some differences in how the two handle round-off error.
linspace calculates the average step size, and then each entry is the first entry plus an integer multiple of the step size.
The colon operator controls for round off from the middle, calculating the first half and second half separately to try to reduce drift.
madhan ravi
il 26 Mar 2019
Thank you sir Walter.
Categorie
Scopri di più su Creating and Concatenating Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!