How to plot a 3d function on a sphere?

2 次查看(过去 30 天)
I want to plot the following function on a sphere to obtain the figures below. The function is
P11 and P12 are two row vectors in my directory with sizes
.
The required figures are
The first figure is generated by using the values [1,1,0,0] and the second is generated by [1,0,0,1] of the vector [I0,Q0,U0,V0]. My coded program and its output are
clear all;
clc;
%% ------------------------------Program-------------------------------------
N0=100;
r_med=[1];
sigma_g=7;
N_ang=91;
theta=1:1:181;
phi=1:1:360;
for i=1:length(r_med)
[P11(i,:),P12(i,:),P33(i,:),P34(i,:),~,~,~] = ZK_W_Cloud_PhaseFunc(N0,r_med(i),sigma_g,N_ang)
end
figure
hold on
[theta,phi]=meshgrid(theta,phi);
P122=P12(i,:).*cos(2*phi);
P(i,:)=P11(i,:)+P122(i,:);
x=P(i,:).*cos(phi).*sin(theta);
y=P(i,:).*sin(phi).*sin(theta);
z=P(i,:).*cos(theta);
plot3(x,y,z)
xlabel('X');ylabel('Y');zlabel('Z');
%%%-------------------------------------------------------------------%%%

回答(1 个)

Jai Khurana
Jai Khurana 2021-7-6
Hi Wiqas,
Hope it helps.

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by