How to draw a circle from a 3 dimensional array ?and how to get out all the values inside of it

1 view (last 30 days)
hello guys I will try to explain things very quickly my data are in NetCDF format I am able to extract it in an array in Matlab we have 4 variables
y distance in the y-axis
z distance in the z-axis
time in seconds
xu velocity in m/s so to get the velocity as an output, you need to input f(z,y,time) let's say our time is constant, so our velocity is a function of y and z so we got 2 axes to coordinate the position of the velocity value in the y z plan
WHat I need to do
I need to draw on my plane a circle starting from a specific center with a specific radius
so when I plot the yz plane i will see values of the velocities and a circle connecting all of the point
the second task should be that i sum all the values inside of the circle and on the boundaries of the circle
i do not know where should i start
any functions that might help me ??
  1 Comment
mostafa haggag
mostafa haggag on 27 Apr 2018
Edited: mostafa haggag on 27 Apr 2018
this a code a wrote but it is not working something is wrong with the if condition any ideas ??
if true
clc
ncid=netcdf.open('doubleturbinewindref1_yz.nc');
data=netcdf.getVar(ncid,8,[0 0 0 0],[1 193 194 300]);
zu=netcdf.getVar(ncid,6,0,194);
y=netcdf.getVar(ncid,4,0,193);
time=netcdf.getVar(ncid,0,0,300);
radius=63;
centery=480;
centerz=90;
sumation1=zeros(300);
for s=1:300
sumationofspeed=0;
counter =0;
for p=1:193
for q=1:194
map(q,p)=data(1,p,q,s);
if((((p-centery)^2) +((q-centerz)^2)) <= radius^2 )
sumationofspeed=sumationofspeed+map(q,p);
counter =counter+1;
end
end
end
sumation1(s)= sumationofspeed/counter ;
end
end

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!