你似乎遇到了很多麻烦搞清楚了这一点。这是我想你想生成图像:
首先,我开始与功能heart
和I_Heart_Math
,我张贴在my answer to your other question(使用arrow.m和myaa.m从The MathWorks File Exchange)。我删除了I_Heart_Math
中与绘制单词“数学”相关的所有代码,并减小了数字窗口的大小。
接下来,我必须生成并绘制MATLAB L形膜徽标。在MATLAB中,你可以输入logo
,它会打开一个黑色背景上显示徽标的新图。您可以通过在MATLAB中输入type logo
来查看生成该图的代码,也可以查看this MathWorks demo page。
logo
代码需要进行一些修改。由于我想将徽标添加到已有的数字窗口中,因此我删除了创建新数字窗口的代码。我还更改了徽标轴的一些属性:'Parent' property已设置为当前数字窗口(GCF),'Units' property已设置为“像素”,并且'Position' property已更改为将徽标轴置于心轴旁边数字窗口。
全部放在一起,这里的新I_Heart_MATLAB
代码来生成上图:
function I_Heart_MATLAB
% Initialize heart plot and adjust figure and axes settings:
heart;
set(gcf,'Position',[200 200 640 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');
% Create and plot the L-shaped membrane logo:
logoData = 40*membrane(1,25);
logoAxes = axes('Parent',gcf,'Units','pixels',...
'Position',[335 21 280 280],...
'CameraPosition', [-193.4013 -265.1546 220.4819],...
'CameraTarget',[26 26 10],'CameraUpVector',[0 0 1],...
'CameraViewAngle',9.5,'DataAspectRatio',[1 1 .9],...
'XLim',[1 51],'YLim',[1 51],'ZLim',[-13 40],...
'Visible','off');
surface(logoData,'Parent',logoAxes,'EdgeColor','none',...
'FaceColor',[0.9 0.2 0.2],'FaceLighting','phong',...
'AmbientStrength',0.3,'DiffuseStrength',0.6,...
'Clipping','off','BackFaceLighting','lit',...
'SpecularStrength',1.1,'SpecularColorReflectance',1,...
'SpecularExponent',7);
light('Parent',logoAxes,'Position',[40 100 20],'Color',[0 0.8 0.8],...
'Style','local');
light('Parent',logoAxes,'Position',[.5 -1 .4],'Color',[0.8 0.8 0]);
% Create an anti-aliased version of the figure too (the larger
% fonts need some adjustment to do this... not sure why):
set(hI,'FontSize',86);
myaa;
set(hI,'FontSize',116);
set(gcf,'Name','Anti-aliased image');
end
@izzat:我不愿意帮你了,因为很可能你只是要删除这个问题在你得到你的答案之后,就像你以前做过的那样。 Stack Overflow的要点不仅仅是为了回答*你的问题,而是为了创建* others的编程帮助库来使用。如果你要自私而不让其他人阅读,为什么我应该花大力气发布一个答案? – gnovice 2009-10-22 17:48:22
我为了设置'位置'我必须'看''把我想放的所需数字放在哪里。我怎么能'看到'? – izzat 2009-10-22 17:58:26
我不会自私 – izzat 2009-10-22 19:08:53