matlab圖像
阿新 • • 發佈:2017-12-31
axis const 技術分享 view ron lin inf 繪制 log
1、在網絡上發現matlab能畫出一些很有意思的圖形(立體愛心)
clc; const=0; x=-5:0.05:5;y=-5:0.05:5;z=-5:0.05:5; [x,y,z]=meshgrid(x,y,z); f=(x.^2 + (9/4)*y.^2 + z.^2 - 1).^3 - x.^2.*z.^3 - (9/80)*y.^2.*z.^3-const; p=patch(isosurface(x,y,z,f,0)); set(p, ‘FaceColor‘, ‘red‘, ‘EdgeColor‘, ‘none‘); daspect([1 1 1]) view(3) camlight; lighting phong
2、在網絡上發現matlab能畫出一些很有意思的圖形(平面愛心)
clc;clear; [x,y,z]=meshgrid(linspace(-2,2)); f=@(x,y,z)(x.^2 + (9/4)*y.^2 + z.^2 - 1).^3 - x.^2.*z.^3 - (9/80)*y.^2.*z.^3; p=patch(isosurface(x,y,z,f(x,y,z),0)); view(3); axis equal set(p,‘FaceVertexCData‘,jet(size(get(p,‘faces‘),1)) ,‘FaceColor‘, ‘flat‘, ‘EdgeColor‘, ‘none‘);
3、繪制標準三維曲面圖形。
t=0:pi/20:2*pi; [x,y,z]= cylinder(2+sin(t),30); subplot(1,3,1); surf(x,y,z); subplot(1,3,2); [x,y,z]=sphere; surf(x,y,z); subplot(1,3,3); [x,y,z]=peaks(30); meshz(x,y,z);
matlab圖像