# How to connect the dots

10 vues (au cours des 30 derniers jours)
Atom le 22 Juin 2012
I am plotting with plot(x,var(x),'o')
var(x) is the variance. These points (x,var(x)) are the discrete points in a x-var(x) plane. How write the plot command so the there discrete points be joined by st. line (or a smooth curve)
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Walter Roberson le 22 Juin 2012
variance essentially applies to an unordered list of points (a "multi-set"): each of the unique permutations of x necessarily has the same variance. That would not often be referred to as "discrete points" in the plane.

Connectez-vous pour commenter.

### Réponses (2)

Thomas le 22 Juin 2012
Dunno if this is what you want..
DO realize that var(x) is a single scalar value as the variance of x
x=rand(10,1)
y=repmat(var(x),length(x),1)
plot(x,y,'Marker','o')
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

Adam Filion le 22 Juin 2012
You can use
plot(x,var(x),'-o')
to connect the dots. This draws a straight line from one to the next.
EDIT: As Thomas pointed out, var(x) returns a single value, so the above command doesn't connect the dots without using repmat as Thomas suggested to create a vector of matching size.
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by