How to generate random two concentric spheres synthetic data with radius1=40 and radius2 =100 in MATLAB and save that data in format *.mat with one variable.(1000*3 double)? Also, how to plot this data in 3D with 2 colors: red and blue?
rng(0,'twister');rvals = 2*rand(1000,1)-1;elevation = asin(rvals);azimuth = 2*pi*rand(1000,1);radii = 3*(rand(1000,1).^(1/3));[x,y,z] = sph2cart(azimuth,elevation,radii);data=[x,y,z];figureplot3(x,y,z,'.');axis equal
The output should look like this photo.
Best Answer