Contour with discrete (x,y) and continuous z

4 visualizaciones (últimos 30 días)
Zulkifli Hidayat
Zulkifli Hidayat el 16 de Jul. de 2011
I have a 3D data in which the x and y are piece-wise constant and z is constant in the interval of x and y. I would like to plot them with Matlab contourf function. The problem is that for an interval x,y the value z is interpolated. For example for x between x1 and x2 and y between y1 and y2, the value of z is k. Currently contourf in Matlab plots the interpolation of z around the region of x1,x2 and y1,y2. How can I keep the values of z is set constant in region between x1 and x2 and y1 and y2?
Thank you in advance.
Zul

Respuesta aceptada

Image Analyst
Image Analyst el 16 de Jul. de 2011
That is 2D data. You have a matrix that has a value for two independent dimensions, x and y. That is 2D data. It can be represented as a image. You can increase the resolution with imresize (to get "in between" values of x and y) and the 'nearest' option if you want it to have a blocky stair step appearance. Then you can display it with imshow(), or with surf if you want a surface kind of appearance. I (and some others) call something like surf a 2.5D representation since it's not really 3D data (like a CT or MRI image where you have 3 dimensions or indexes into an array) but rather a 3D representation of 2D data.
  1 comentario
Zulkifli Hidayat
Zulkifli Hidayat el 16 de Jul. de 2011
I have not used image processing toolbox. What function is used as a start, to create the image?
Then, I guess I can play with imresize.

Iniciar sesión para comentar.

Más respuestas (2)

Fangjun Jiang
Fangjun Jiang el 16 de Jul. de 2011
I am not sure if I fully understand your need. Does the following options for contourf() fit you need?
[x,y,z]=peaks(10);
figure(1);contourf(x,y,z);
figure(2);contourf(x,y,z,10);
figure(3);contourf(x,y,z,z);
Or do you want to achieve the same effect as below but want to apply to 3D?
figure(4);plot(1:50);
figure(5);stairs(1:50);
  2 comentarios
Zulkifli Hidayat
Zulkifli Hidayat el 16 de Jul. de 2011
Yes, like the second but in 3D and regular grid.
Fangjun Jiang
Fangjun Jiang el 16 de Jul. de 2011
Please provide an example with small number of data. I don't think contourf() is the right function to look at at the first place.

Iniciar sesión para comentar.


Zulkifli Hidayat
Zulkifli Hidayat el 16 de Jul. de 2011
It seems that I am not clear enough. I need something like function stairs, but in 3D and the amplitude is in color. I hope it is more clear now.

Categorías

Más información sobre Lighting, Transparency, and Shading en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by