日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人工智能 > 循环神经网络 >内容正文

循环神经网络

matlab中如何打出心,如何在MATLAB中再现这个心形网格?

發布時間:2023/12/14 循环神经网络 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 matlab中如何打出心,如何在MATLAB中再现这个心形网格? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

這是我最好的復制整個人物的嘗試:

生成輪廓心網:

我使用CONTOURC函數在x-y,x-z和y-z平面中生成一系列輪廓.請注意,在要重現的圖像中,心臟背面側的網格線不會呈現.我想到的最簡單的方法就是使用ISOSURFACE渲染一個白色表面,正好在網格的內表面之下,阻擋了背面的視圖.

這是功能心臟的代碼:

function heart

% Initialize the volume data, figure, and axes:

[X,Y,Z] = meshgrid(linspace(-3,3,101));

F = -X.^2.*Z.^3-(9/80).*Y.^2.*Z.^3+(X.^2+(9/4).*Y.^2+Z.^2-1).^3;

hFigure = figure('Position',[200 200 400 400],'Color','w');

hAxes = axes('Parent',hFigure,'Units','pixels',...

'Position',[1 1 400 400],'NextPlot','add',...

'DataAspectRatio',[1 1 1],'Visible','off',...

'CameraViewAngle',10,...

'XLim',[32 70],'YLim',[39 63],'ZLim',[34 73]);

view([-39 30]);

% Create and plot contours in the y-z plane:

for iX = [35 38 41 45 48 51 54 57 61 64 67]

plane = reshape(F(:,iX,:),101,101);

cData = contourc(plane,[0 0]);

xData = iX.*ones(1,cData(2,1));

plot3(hAxes,xData,cData(2,2:end),cData(1,2:end),'k');

end

% Create and plot contours in the x-z plane:

for iY = [41 44 47 51 55 58 61]

plane = reshape(F(iY,:,:),101,101);

cData = contourc(plane,[0 0]);

yData = iY.*ones(1,cData(2,1));

plot3(hAxes,cData(2,2:end),yData,cData(1,2:end),'k');

end

% Create and plot contours in the x-y plane:

for iZ = [36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 69 71]

plane = F(:,:,iZ);

cData = contourc(plane,[0 0]);

startIndex = 1;

if size(cData,2) > (cData(2,1)+1)

startIndex = cData(2,1)+2;

zData = iZ.*ones(1,cData(2,1));

plot3(hAxes,cData(1,2:(startIndex-1)),...

cData(2,2:(startIndex-1)),zData,'k');

end

zData = iZ.*ones(1,cData(2,startIndex));

plot3(hAxes,cData(1,(startIndex+1):end),...

cData(2,(startIndex+1):end),zData,'k');

end

% Fill the inside of the mesh with an isosurface to

% block rendering of the back side of the heart:

p = patch(isosurface(F,-0.001));

set(p,'FaceColor','w','EdgeColor','none');

end

將圖合在一起:

為了再現整個圖形,我首先使用上面的心臟功能生成心臟網格,然后在其周圍添加其他元素.我還使用了The MathWorks File Exchange的一些提交:

這里是函數I_Heart_Math(生成上圖)的代碼:

function I_Heart_Math

% Initialize heart plot and adjust figure and axes settings:

heart;

set(gcf,'Position',[200 200 700 300],'Name','Original image');

offset = get(gca,'CameraPosition')-get(gca,'CameraTarget');

offset = 35.*offset./norm(offset);

set(gca,'Position',[65 -9 300 300],'CameraViewAngle',6,...

'XLim',[21+offset(1) 70],'YLim',[16+offset(2) 63],...

'ZLim',[32 81+offset(3)]);

% Create the axes and labels, offsetting them in front of the

% heart to give the appearance they are passing through it:

arrowStarts = [81 51 51; 51 86 51; 51 51 32]+repmat(offset,3,1);

arrowEnds = [21 51 51; 51 16 51; 51 51 81]+repmat(offset,3,1);

arrow(arrowStarts,arrowEnds,5,40,40);

text('Position',[22 52 48]+offset,'String','x','FontSize',12);

text('Position',[50 17 49]+offset,'String','y','FontSize',12);

text('Position',[46.5 51 81.5]+offset,'String','z','FontSize',12);

% Create the equation text:

text('Position',[51 47 28],'FontName','Bookman','FontSize',8,...

'HorizontalAlignment','center',...

'String',{'(x^2+^9/_4y^2+z^2-1)^3-x^2z^3-^9/_{80}y^2z^3=0'; ...

'-3 \leq x,y,z \leq 3'});

% Create the large-type text:

hI = text('Position',[4 52 69.5],'String','I',...

'FontAngle','italic','FontName','Trebuchet MS',...

'FontSize',116,'FontWeight','bold');

hM = text('Position',[80.5 50 42.5],'String','Math',...

'FontAngle','italic','FontName','Trebuchet MS',...

'FontSize',116,'FontWeight','bold');

% Create an anti-aliased version of the figure too (the larger

% fonts need some adjustment to do this... not sure why):

set(hI,'Position',[4 52 68],'FontSize',86);

set(hM,'Position',[80.5 50 41],'FontSize',86);

myaa;

set(hI,'Position',[4 52 69.5],'FontSize',116);

set(hM,'Position',[80.5 50 42.5],'FontSize',116);

set(gcf,'Name','Anti-aliased image');

end

總結

以上是生活随笔為你收集整理的matlab中如何打出心,如何在MATLAB中再现这个心形网格?的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。