Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
spline contour

Subject: spline contour

From: mona

Date: 6 Jan, 2010 09:52:04

Message: 1 of 2

Hi all;
I want to plot contour as following
xlin=linspace(min(x),max(x),33);
ylin=linspace(min(y),max(y),33);

[X,Y]=meshgrid(xlin,ylin)
Z=griddata(x,y,z,X,Y)
[c,h]=contour(X,Y,Z,[ 0.0 0.0 ],'r','LineWidth',3);
but Idon't knwo how can I use spline command to plot smooth contour
can you help me please;
mona

Subject: spline contour

From: Jonas Lundgren

Date: 13 Jan, 2010 12:25:07

Message: 2 of 2

"mona " <iee2006@yahoo.com> wrote in message <hi1mg4$pk8$1@fred.mathworks.com>...
> Hi all;
> I want to plot contour as following
> xlin=linspace(min(x),max(x),33);
> ylin=linspace(min(y),max(y),33);
>
> [X,Y]=meshgrid(xlin,ylin)
> Z=griddata(x,y,z,X,Y)
> [c,h]=contour(X,Y,Z,[ 0.0 0.0 ],'r','LineWidth',3);
> but Idon't knwo how can I use spline command to plot smooth contour
> can you help me please;
> mona

Hi mona,
You can try to increase the resolution and use griddata with cubic interpolation.
Maybe this will give you a smoother curve. For example:

   xlin=linspace(min(x),max(x),330);
   ylin=linspace(min(y),max(y),330);

   Z=griddata(x,y,z,X,Y,'cubic');

Jonas

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us