Extract random sample x,y,z data inside the circle
Show older comments
Hello,
I want to know how to extract x,y,z data inside a circle. I already make a code. Here is my code :
clear;
deformA = xlsread ('deform.xlsx');
x=deformA(:,1)';
y=deformA(:,2)';
z=deformA(:,3)';
figure
scatter3(x,y,z,5,z,'filled') %plot x,y,z data
view (5,90)
r = 50; %circle radius
t = 0 : .01 : 2*pi; % 0 - 360 degree
a0 = 440250; % x point center in UTM
b0 = 9164550; % y point center in UTM
a1 = a0 + r*cos(t);
b1 = b0 + r*sin(t);
???
I have almost 232.040 deformation data and I want to take some sample points inside the circle. I just feel confuse with the next step. I want to save the x,y,z data inside the circle in excel file. I will very happy if somebody can help me. thanks
regards, Herlan
Accepted Answer
More Answers (1)
Image Analyst
on 4 Nov 2014
0 votes
Get all the XYZ locations, which I think you know how to do.
Then get random selections using the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_create_a_set_of_random_locations_within_a_circle.3F. Adapt it slightly from a circle to a sphere of course.
Let us know if you still can't figure it out.
1 Comment
Image Analyst
on 4 Nov 2014
Use xlswrite if you want to save the x,y,z locations and the data value at those locations to an Excel workbook.
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!