2022年9月7日星期三 BPP的球面N个点的matlab仿真

matlab代码

clc;
close all;
clear all;
fclose('all');
format shortG;
 
nums_points = 1000; % 点数量
radius = 10;
loc = zeros(nums_points, 3);
for ii = 1 : nums_points
    phi = acos(-1.0 + (2.0 * ii - 1.0) / nums_points);
    theta = sqrt(nums_points * pi) * phi;
    loc(ii, 1) = radius * cos(theta) * sin(phi);
    loc(ii, 2) = radius * sin(theta) * sin(phi);
    loc(ii, 3) = radius * cos(phi);
end
 
figure
plot3(loc(:, 1), loc(:, 2), loc(:, 3), '.');hold on;% 画结果
[xx, yy, zz]=sphere(50); 
h2=surf(xx * radius, yy * radius, zz * radius); % 画一个球面做参考
set(h2,'edgecolor','none','facecolor','r','facealpha',0.7);
axis equal;
axis([-radius, radius, -radius, radius, -radius, radius]);
hold off;

参考:在球面上生成均匀分布点方法总结_八步赶蝉的博客-CSDN博客_球面均匀分布

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值