# Need half of my contour plot

9 views (last 30 days)

Show older comments

##### 0 Comments

### Accepted Answer

Kye Taylor
on 18 Jul 2013

Edited: Kye Taylor
on 18 Jul 2013

Check out the tril and triu functions. For example if you have data similar to

[x,y]= meshgrid(-1:.05:1);

z = x.^2+y.^2;

contour(x,y,z)

Try something like

zLowerTri = tril(z);

contour(x,y,zLowerTri)

Since contour plots with the origin at lower left instead of upper right, you may prefer either

zLowerTri = tril(z);

contour(x,y,zLowerTri)

axis ij

or

contour(x,y,fliplr(tril(fliplr(z))))

##### 4 Comments

Pourya Alinezhad
on 19 Jul 2013

### More Answers (1)

Pourya Alinezhad
on 18 Jul 2013

Edited: Pourya Alinezhad
on 18 Jul 2013

hello maryam, run following lines of code.

x=0:0.1:10;

y=x;

j=1;

z=meshgrid(x,y);

h=ones(length(x),length(x))*nan;

for i=1:length(x)

for j=1:length(y)

if i>j

h(i,j)=z(i,j);

end

end

end

surf(sin(h)./sqrt(h))

figure

contourf(sin(h)./sqrt(h))

##### 0 Comments

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!