필터 지우기
필터 지우기

How to plot a 3d function on a sphere?

조회 수: 1 (최근 30일)
Wiqas Ahmad
Wiqas Ahmad 2021년 7월 6일
답변: Jai Khurana 2021년 7월 6일
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에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by