简体   繁体   English

MATLAB-仅绘制三次数据集的球形截面

[英]MATLAB - Only plot a spherical section of data set which is cubic

I have a physics model that simulates a few things in a radius of 5000 km around an object in spherical coordinates. 我有一个物理模型,可以在球形坐标中围绕对象围绕5000公里半径内的某些事物进行仿真。 I found no way to interpolate spherical coordinates in MATLAB so I changed them to Cartesian with sph2cart function. 我没有找到在MATLAB中内插球坐标的方法,因此我使用sph2cart函数将其更改为笛卡尔坐标。 Then I used scatteredinterpolant function with a 10000 by 10000 by 10000 km meshgrid to interpolate the data. 然后,我使用具有10000 x 10000 x 10000 km网格的分散插值函数对数据进行插值。 I want to plot this data but only the sphere of a radius 5000 km. 我想绘制此数据,但仅绘制半径为5000 km的球体。 Is there a nice way to plot a certain specified volume of the data? 有没有一种很好的方法来绘制特定数量的数据?

If you just want to delete part of your data "spherically" you can do 如果您只想“部分地”删除部分数据,则可以

being x,y,z your geometric data and v the values: 分别为x,y,z的几何数据和v的值:

level=5000; %km (or whatever value it is in your data)
V(sqrt(X.^2+Y.^+Z.^2)>level)=0;

%or depending in the plotting functions.

V(sqrt(X.^2+Y.^+Z.^2)>level)=NaN; 

% plot things

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM