How to plot a sphere with lines of latitude (constant phi) for a given center (xo, yo, zo) and radius (R)
5 ビュー (過去 30 日間)
古いコメントを表示
How do I construct a sphere with lines of latitude using loops and not the inbuilt sphere function in matlab
0 件のコメント
回答 (1 件)
Wick
2018 年 5 月 6 日
編集済み: Wick
2018 年 5 月 6 日
clearvars
R = 1;
xo = 10;
yo = 20;
zo = 30;
num_angles = 3600;
latitudes = -80:20:80; % latitudes in degrees
theta = linspace(0,2*pi,num_angles)';
% lat_angle = latitides*pi/180;
x = R * cosd(latitudes);
z = R * sind(latitudes);
X = cos(theta) * x + xo;
Y = sin(theta) * x + yo;
Z = repmat(z, size(X,1),1) + zo;
clf
plot3(X,Y,Z);
axis equal
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!