MATLAB Answers


colour dependent on the value at a certain point

Asked by Bran
on 18 Jan 2013

So I plan to represent some data in terms of a sphere. I want to draw a sphere using my x y and z coordinates which I think I know how to do but then I would like to colour code the surface of the sphere dependent on the values of my function which depend on x and y z so to have for example, red for high values blue for low etc. any ideas how I go about this?

Many thanks guys! :)


The input was 3D arranged in a sphere :)

Ah, then spherical output representation becomes reasonable -- though surface of the sphere vs sphere as a volume becomes a consideration.

I take it you wrote your own spherical FFT routine? For any particular cubiod array input indices (I,J,K), what location is mapped to in your array that you put through your FFT routine? I presume here that the FFT routine puts its results into exactly the same logical shape as what was passed to it? If so then you should then be able to reverse the process to map the outputs back to cubiod array indices. Not using sphere(), just based on the exact reverse of the mapping that was used in the input processing. Once the FFT values are mapped back to cubiod array locations, we can proceed to do a voxel viewing or spherical surface generation.

Hi there well yea my samples were taken of coordinates that are arranged in a spherical volume. However a map of the points of the surface where the colour reflects the value of the points would be enough. Yea the FFT routine retains the shape of the input, so for example if I simply use scatter all the points can be seen. But it's difficult to see a peak in the middle thats in red amongst densely packed blue points so I was thinking to just show the peak at the surface. The suggestion is really good but how would I go about coding for this?

as I say I dont need to go back to the original locations as the output is already in the correct locations. Hence I just need to use the points at the surface to draw the sphere and then somehow use the FFT vlaues at the points to map for colour?? What do you reckon?? PS I really appreciate you taking so much time Walter!!!! :)


No products are associated with this question.

0 Answers

Join the 15-year community celebration.

Play games and win prizes!

Learn more
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

MATLAB Academy

New to MATLAB?

Learn MATLAB today!