in Education by
I have a distribution of tube radius r, and I would like to plot tubes for all the sampled r in single figure as shown in the figure above. The tubes have following characteristics: The length of all tubes is constant, but radius is varying. The narrowest tube will be completely filled with light gray color. The length of the light gray color from bottom in all other tubes is inversely proportional to the radius of the tube i.e. length of light grey color from bottom = constant/r The remaining length of the tube will be filled with dark gray color. Magnitudes of r and total length of each tube is of the order of 1e-005m and 1e-002 m, respectively, so they need to be standardized compared to the X and Y axes units. The white interspaces are just spaces and not tubes. UPDATE (Based on the answer by Boris) This is the code from Boris in which I made certain changes based on the characteristics of the tubes that I have described above. I am having scaling issues as I am not able to visualize my network of tubes as clearly as can be seen in the figure above. function drawGrayTube (x, r, sigma_wn, theta, del_rho, rmin, rmax,L) % sigma_wn is in N/m (=Kg/s^2), theta is in degrees, del_rho is in Kg/m^3 % and L is in m h=((2*sigma_wn*cos((pi/180)*theta))./(del_rho*9.81.*r)); hmin=((2*sigma_wn*cos((pi/180)*theta))./(del_rho*9.81.*rmax)); hmax=((2*sigma_wn*cos((pi/180)*theta))./(del_rho*9.81.*rmin)); rectangle ('Position',[x,0,r/rmax,h], 'FaceColor',[0.7,0.7,0.7]); ylim([0 1]); if L>h rectangle ('Position',[x,L,r/rmax,L-h], 'FaceColor',[0.3,0.3,0.3]); ylim([0 1]); else rectangle ('Position',[x,L,r/rmax,L], 'FaceColor',[0.3,0.3,0.3]); ylim([0 1]); end end JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
A simple function to draw the gray tubes could be for instance function drawGrayTube (x, w, h) rectangle ('Position',[x,0,w,h], 'FaceColor',[0.7,0.7,0.7]); rectangle ('Position',[x,h,w,100-h], 'FaceColor',[0.3,0.3,0.3]); end Hereby, x is the x position of the tube, w denotes the width and h between 0 and 100 the height of the light gray part of the tube. You can now use it in your example by calling drawGrayTube (x, r, 100*constant/r) where you have to adapt the constant such that constant/r is at most 1. You can write a similar function for the white interspaces. Assume that you have given a vector of radii (already scaled such that the values are between 0 and 1), e.g., r=[0.5, 0.7, 0.9, 0.1, 0.5, 0.01] then on possibility to draw the tubes is interspace = 0.5; for i=1:length(r) drawGrayTube(sum(r(1:i-1))+i*interspace, 100*r(i)+1e-10, r(i)+1e-10); end

Related questions

0 votes
    Write the functions of the following organs: i. Ovary. ii. Uterus. iii. Fallopian tubes/ducts. iv. Vagina. v. Placenta. Select the correct answer from above options...
asked Nov 9, 2021 in Education by JackTerrance
0 votes
    I have a dataset with labels and datapoints, problem is that rather then a classification problem I want to ... quadratic estimation. Select the correct answer from above options...
asked Feb 3, 2022 in Education by JackTerrance
0 votes
    Why Should I Use Numpy Rather Than Idl, Matlab, Octave, Or Yorick?...
asked Apr 25, 2021 in Technology by JackTerrance
0 votes
    the second generation of computer used what to control operation a. integrated circuits b.transistors c.vaccum tubes d.microchips Select the correct answer from above options...
asked Dec 26, 2021 in Education by JackTerrance
0 votes
    I have a 2D space in which a function value is defined (you can think of it as a manifold). Now ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 16, 2022 in Education by JackTerrance
0 votes
    Is is possible to change the item selection focus color and text color in a TListBox? When themes are ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 15, 2022 in Education by JackTerrance
0 votes
    I am trying to calculate Euclidean Distance for MNIST data set. X_Train = 60,000*784 and X_Test = ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 14, 2022 in Education by JackTerrance
0 votes
    How would you identify specific points in an image based on the pixels around the point(s) that you ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    Every now and then, variables just stop showing up in the Workspace pane. who and whos show that there ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 21, 2022 in Education by JackTerrance
0 votes
    Why is NumPy preferred to other programming tools such as Idl, Matlab, Octave, Or Yorick?...
asked Apr 24, 2021 in Technology by JackTerrance
0 votes
    How can you draw straight horizontal and vertical lines with the help of the line tool ? Select the correct answer from above options...
asked Dec 22, 2021 in Education by JackTerrance
0 votes
    ______tool is used to draw a circle. (I). filter. (ii). ellipse. (iii). rectangle. gūys jaldi answer do exam chl rha hai! please! Select the correct answer from above options...
asked Dec 14, 2021 in Education by JackTerrance
0 votes
    1 Choose the correct option:- 1) It is the blank area where you can draw and color in MS Paint. a) Line ... ans please tell me fast Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    1 Choose the correct option:- 1) It is the blank area where you can draw and color in MS Paint. a) ... give me ans subject computer Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    the mode in which you can draw picture no computer screen (1) Graphic mode (2) text mode (3) input mode (4) output Select the correct answer from above options...
asked Dec 14, 2021 in Education by JackTerrance
...