⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 li1.m

📁 这是机械工业张德丰《MATLAB与外部程序接口编程》随书源码
💻 M
字号:
%gasket.m
function tehImage=gasket(numPoints)
%GASKET函数得到一个Sierpinski Gasket图像
%用法:IM=GASKET(NUMPOINTS)
%
%如:
%x=gasket(50000);
%imagesc(x);colormap([0 0 0;1 1 1]);
axis equal tight
theImage=zeros(1000,1000);
corners=[866 1;1 500; 866 1000];
startPoint=[866 1];
theRand=rand(numPoints,1);
theRand=ceil(theRand*3);
for i=1:numPoints
    startPoint=floor((corners(theRand(i),:)+startPoint)/2);
    theImage(startPoint(1),startPoint(2))=1;
end
2. foo M-文件
%foo.m
function[a,b]=foo(x,y)
if nargout==0
elseif nargout==1
    a=x;
elseif nargout==2
    a=x;
    b=y;
end
3. fun M-文件
%fun.m
function a=fun(b)
a(1)=b(1).*b(1);
a(2)=b(1)+b(2);
a(b)=b(2)/4;
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -