How to resize (shrink) 3d surface ?
3 ビュー (過去 30 日間)
古いコメントを表示
syms x y z
f = @(x,y,z) cos(x) + cos(y) + cos(z) ;
interval = [-pi:0.1:pi];
a= interval ;
b= interval;
c= interval;
[X,Y,Z] = meshgrid(a,b,c);
data = f(X,Y,Z);
p = patch(isosurface(a,b,c,data,0));
cdata = smooth3(rand(size(data)),'box',7);
isonormals(X,Y,Z,data,p)
isocolors(X,Y,Z,cdata,p)
p.FaceColor = 'interp';
p.EdgeColor = 'none';
view(150,30)
daspect([1 1 1])
colorbar
axis tight
camlight
lighting gouraud
Now I have plot a unit cell with domension of -pi to pi
I would like to have the same shape but shrink to a smaller size let say 1*1*1
how can I do that
0 件のコメント
回答 (1 件)
Image Analyst
2020 年 11 月 21 日
1*1*1 would be a single 1*1*1 would be a single element, right? What sense does that make?element, right? What sense does that make? You can vary the number of elements in the grid by adjusting the starting, step, and stopping parameters in this line:
interval = [-pi:0.1:pi];
Just look at the length of interval. Alternatively you could use linspace() to more directly specify how many elements there should be:
interval = linspace(-pi, pi, numElements);
2 件のコメント
Image Analyst
2020 年 11 月 21 日
2 pi is not even divisible by 0.5 so you have to decide what's more important: the spacing per element, or the ending values of the range.
>> 2*pi/0.5
ans =
12.5663706143592
You can't have 12.566 elements. You can have either 13 or 14 with a spacing of 0.5 but then the ending value won't be pi:
>> interval = -pi : 0.5 : pi
interval =
Columns 1 through 11
-3.1416 -2.6416 -2.1416 -1.6416 -1.1416 -0.64159 -0.14159 0.35841 0.85841 1.3584 1.8584
Columns 12 through 13
2.3584 2.8584
Or you can have exactly 13 elements with the starting point = -pi and the ending point = pi, but the spacing (step) won't be exactly 0.5:
>> interval = linspace(-pi, pi, 13)
interval =
Columns 1 through 11
-3.1416 -2.618 -2.0944 -1.5708 -1.0472 -0.5236 0 0.5236 1.0472 1.5708 2.0944
Columns 12 through 13
2.618 3.1416
参考
カテゴリ
Help Center および File Exchange で Volume Visualization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!