clc; clear all; close all; R = 3; time = 10000; origin = [0,0,0]; %%======绘制球体====== t=linspace(0,pi,25); p=linspace(0,2*pi,25); [theta,phi]=meshgrid(t,p); x=R * sin(theta).*sin(phi) + origin(1); y=R *sin(theta).*cos(phi) + origin(2); z=R *cos(theta)…