how to plot functions of theta and phi..for example {cos(phi).^3 * sin(theta)+sin(phi)} in spherical coordinates.

조회 수: 26 (최근 30일)
how to plot functions of theta and phi..for example {cos(phi).^3 * sin(theta)+sin(phi)} in spherical coordinates.
  댓글 수: 2
Mohamed Abdul-Al
Mohamed Abdul-Al 2021년 2월 26일
How to wirte a matlab code to plot the 3D image of the helix using these parameters and equations that define the axes in 3D:
p=0.199; Pitch distance
a=0.02999500; Radius of the helis wire
b=0.191; Radius of the helix
n = 5, is the number of turns.
δ = atan(p/(2*pi*b));
x= b + a cos(Ө)
y= -a sin(Ө) sin(δ)
x = xsin(ф)+ycos(ф);
y =-xcos(ф)+ysin(ф);
z = p*ф/(2*pi)+a*sin(Ө)*cos(δ);
Walter Roberson
Walter Roberson 2023년 5월 28일
syms theta phi
Q = @(v) sym(v);
Pi = sym(pi);
p = Q(0.199) %Pitch distance
p = 
a = Q(2999500)/Q(10)^8 %Radius of the helis wire
a = 
b = Q(0.191) %Radius of the helix
b = 
n = 5; % is the number of turns.
delta = atan(p/(2*Pi*b))
delta = 
x_prime = b + a * cos(theta)
x_prime = 
y_prime = -a * sin(theta) * sin(delta)
y_prime = 
x = x_prime * sin(phi) + y_prime * cos(phi)
x = 
y = -x_prime * cos(phi) + y_prime * sin(phi)
y = 
z = p * phi/(2*pi) + a * sin(theta)*cos(delta)
z = 
fsurf(x, y, z, [0, 2*pi, 0, 2*pi]*n)

댓글을 달려면 로그인하십시오.

답변 (2개)

Teja Muppirala
Teja Muppirala 2011년 9월 13일
First create a grid using spherical coordinates, and then convert the result into Cartesian coordinates.
[theta,phi] = meshgrid(linspace(-pi,pi,41),linspace(-pi/2,pi/2,41));
R = cos(phi).^3 .* sin(theta)+sin(phi);
[X,Y,Z] = sph2cart(theta,phi,R);
surf(X,Y,Z)
alpha 0.5
axis vis3d

aisha chauhan
aisha chauhan 2023년 5월 28일
How to define the the function of phi and theta in matlab code

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by