フィルターのクリア

help me about drawing 3D in matlab ?

1 回表示 (過去 30 日間)
Nguyen Trong Nhan
Nguyen Trong Nhan 2013 年 12 月 30 日
回答済み: Walter Roberson 2013 年 12 月 30 日
Let D is the region limit by: y = x^2 + 1, y = 0, x = 0, x = 3. Now I can draw the region D by fill command. Could you please help me how to draw the round cubic created by rotating D around x axis. thanks (like the picture below)

採用された回答

Walter Roberson
Walter Roberson 2013 年 12 月 30 日
xvals = linspace(0, 3, 1025);
yvals = x.^2 + 1;
zvals = zeros(size(xvals));
xyz = [xvals(:), yvals(:), zvals(:)];
now you put xyz through standard rotation matrices, using a variety of angles, getting a series of output xyz for each input xyz. Put all of the resulting coordinates into arrays as vertices. Then construct edge lists, linking in a rectangular mesh -- the xyz for the N'th point on the K'th angle connecting to the (N-1)'st point and the (N+1)'th point at the K'th angle, and linking to the N'th point on the (K-1)'st and (K+1)'th angle. Toss everything into appropriate arguments for patch(). Adjust the face color parameters as you prefer: if you want everything to be the same nominal color then you will probably want to set up a lighting object (your sample diagram is lit from the right-and-back somewhere.)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by