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
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 = x’ sin(ф)+y’ cos(ф);
y =-x’ cos(ф)+y’ sin(ф);
z = p*ф/(2*pi)+a*sin(Ө)*cos(δ);
Walter Roberson
2023-5-28
syms theta phi
Q = @(v) sym(v);
Pi = sym(pi);
p = Q(0.199) %Pitch distance
a = Q(2999500)/Q(10)^8 %Radius of the helis wire
b = Q(0.191) %Radius of the helix
n = 5; % is the number of turns.
delta = atan(p/(2*Pi*b))
x_prime = b + a * cos(theta)
y_prime = -a * sin(theta) * sin(delta)
x = x_prime * sin(phi) + y_prime * cos(phi)
y = -x_prime * cos(phi) + y_prime * sin(phi)
z = p * phi/(2*pi) + a * sin(theta)*cos(delta)
fsurf(x, y, z, [0, 2*pi, 0, 2*pi]*n)
回答(2 个)
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!