Plot data in the surface of a sphere

3 views (last 30 days)
Pablo
Pablo on 24 May 2016
Commented: jeewan atwal on 13 Aug 2020
Hello everybody
I have a matrix of data collected when measuring in different angles theta, phi. This matrix is 100 x 100 where each line gives a different value of theta and each column a different value for phi. I want to plot this data as a density plot over the surface of a sphere. So long I know how to do this for a given function but not for my data.
My best try, (to be honest I saw this code in a document) :
res = 100;
lambda = linspace(-pi,pi,res);
theta = linspace(-pi/2,pi/2,ceil(res/2));
[L,T] = meshgrid(lambda,theta);
f=sphHarm(8,0,L,T)+sphHarm(8,7,L,T);
[X,Y,Z] = sph2cart(L,T,1);
clf;
surf(X,Y,Z,f);
colorbar; shading interp; daspect([1 1 1]); axis tight; view([70 25]);
title('3D Plot of f on the sphere')
This code does what I want but instead of represent a function f I want to plot my collection of data:
A = importdata(filename)
which contains the information about the values for phi and theta in files and columns as told.
Can someone help me to represent also this?
Many thanks in advance!

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!