Use matlab draw intersecting plane

Primer

matlab as scientific computing artifacts, can easily achieve the computing and 3D graphics rendering matrix,

So today with matlab draw graphics in a high number of questions.

Topics are as follows:

Wherein x + y = pi / 2 has proved to be wrong question, it should be x + z = pi / 2.

analysis

therefore:

Want to achieve draw a closed area enclosed, it is to achieve:

1) y ^ 2 = x

2) = 0

3) y = 0

4) x = pi / 2 - z

Four or more drawing plane.

program

matlab programming procedure is as follows:

 1 [x z] = meshgrid([0:0.1:pi])
 2 y = sqrt(x)
 3 mesh(x,y,z,'FaceColor','r','EdgeColor','none') % 绘制曲面 y^2=x
 4 x = pi/2 - z
 5 hold on
 6 mesh(x,y,z,'FaceColor','g','EdgeColor','none') % 绘制曲面 x+z=pi/2
 7 xlabel('x');ylabel('y');zlabel('z');alpha(0.5)
 8 z = ones(size(x))-1
 9 mesh(x,y,z,'FaceColor','b','EdgeColor','none') % 绘制曲面 z=0
10 [x z] = meshgrid([0:0.1:pi])
11 y = ones(size(x))-1
12 mesh(x,y,z,' FaceColor ' , ' Y ' , ' EdgeColor ' , ' none ' ) = 0% to draw a curved surface Y
 13 is Alpha ( 0.5 )

The final renderings

Program analysis

The core program analysis:

. 1) meshgrid now () for the number of meshes, Line. 1 range for generating the x and z. [0: 0.1: pi] x is the generator of the domain (0, pi), as a separator every 0.1.

2)  Line 2 function  mesh (x, y, z, 'FaceColor', 'r', 'EdgeColor', 'none') represented generated surface, x, y, z is unknown, FaceColor a surface color, EdgeColor is border color.

3)  Line 5  of the HOLD ON , express drawn graphics remain, not erased, otherwise it will erase the previous graphics.

. 4)  Line. 8 is z = ones (size (x) ) - 1  is the generator matrix is an all 0's (single vector array). Because of the need to generate z = 0; 0 and direct access, error. Error demonstration as follows:

>> [ab &] = meshgrid now ([ 0 : 0.1 : PI])
 >> C = 0 
>> Mesh (A, B, C)
 Error the using Mesh (Line 76) 
the Z Matrix MUST BE A, A Not Scalar or Vector This Description of the Z axis, as an unlimited amount, not a single number, but rather a matrix.

Z-axis must be unlimited amount is 0, z = 0 plane is, therefore, a need to generate ones (N) of the number N, the value is limited to a matrix, i.e. matrix, then the resulting plane before It is the axial plane.

While ones (N) -1; is generated, i.e., 0 matrix. Presentation as follows:

 . 5) the xlabel (STR), ylabel (STR), zlabel (STR) function is passed a string, as an axis title (title), Alpha (n-) incoming floating-point numbers, as a percentage of transparency.

 The above graphic for a little rotation, to obtain title figure, the conditions justify the title wrong. Should be x + z = pi / 2

Compare :

Answer the original question:

All

More closer study can proceed and intersecting planes intersecting line representation, see Reference [6].

However References 6 using  contourslice  function is to achieve the contours of the painting, not the final idea, and then follow-up study.

 references

[1] made with parabolic y and matlab ^ 2 = x plane x + z = 1 Step particular pattern of intersecting _ know Baidu

[2].  MATLAB experts to help me look at how to get transparent surfaces several intersecting, export the intersection line ~~~~~~~~~~~~~~~ _ Baidu know

[3].  Creating three-dimensional graphics - MATLAB & Simulink Example - MathWorks China

[4].  Using Matlab --colormap drawing based on digital image processing and display of three-dimensional graphics (hypsometric) - Fresh green Situ - Park blog

. [5]  Matlab plot - very detailed, very comprehensive - Octal_H's blog - CSDN blog

[6]  made with parabolic y and matlab ^ 2 = x plane x + z = 1 Step particular pattern of intersecting _ know Baidu

Guess you like

Origin www.cnblogs.com/yqmcu/p/11488845.html