is A a mxn matrix?
Plot data in the surface of a sphere
2 次查看(过去 30 天)
显示 更早的评论
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!
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!