Re: Filled contour plot from vectors
- From: "Daniel Ennis" <daniel.ennis@xxxxxxxxxxx>
- Date: Fri, 21 Oct 2005 15:46:16 -0400
> BS = textread([char(fname(1)) '.txt']);
> X = BS(:,1);
> Y = BS(:,2);
> [P,Q] = meshgrid(X,Y);
>
> for ii = 2:length(fname)
> file = textread([char(fname(ii)) '.txt']);
> x = file(:,1);
> y = file(:,2);
> z = ((x-X).^2 + (y-Y).^2).^0.5;
> Z = griddata(X,Y,z,P,Q);
> g = contourf(X,Y,Z);
> title(char(mytitle(ii-1)));
> axis equal;
> axis tight;
> saveas(gcf,[char(fname(ii)) '.jpg'],'jpg');
> end
>
> Basically, I have text files of x and y data in columns. These x
> and
> y data are changing in time, and i would like to plot a surface
> corresponding to displacement for each of the grid points.
I just looked at this quickly, but it looks like the problem is in
how you define P and Q. I think you want the inputs to meshgrid to
be monotonically increasing vectors that span the space of each
coordinate direction. Presumably X and Y are long vectors
corresponding to to coordinates of each of your data points. If
these data points reside within the interval of [0,1] or [min(X)
max(X)] then you want the input to meshgrid to be linspace(0,1,10) or
something similar. Give that a shot and report back.
.
- Follow-Ups:
- Re: Filled contour plot from vectors
- From: Matt
- Re: Filled contour plot from vectors
- References:
- Filled contour plot from vectors
- From: Matt
- Re: Filled contour plot from vectors
- From: John D'Errico
- Re: Filled contour plot from vectors
- From: Matt
- Filled contour plot from vectors
- Prev by Date: Re: max ||Ax-b|| subject to x(i) in [l,u], how ?
- Next by Date: Re: Filled contour plot from vectors
- Previous by thread: Re: Filled contour plot from vectors
- Next by thread: Re: Filled contour plot from vectors
- Index(es):