function fern(N)
% This routine draws Barnsley's fern
% The transformations for the fern are each in the form
% T(x,y = (a*x+b*y+e, c*x+d*y+f). If the probability that a
% particular transformation T is selected is p, you can characterize
% each transformation by providing the values of
% a,b,c,d,e,f, and p, in that order.
%
% T1 -> 0,0,0,.16,0,0,.01
% T2-> .85,.04,-.04,.85,0,1.6,.85
% T3-> .2,-.26,.23,.22,0,1.6,.07
% T4-> -.15,.28,.26,.24,0,.44,.07
%
% INPUT
% N -> The number of iterations.
% Close all existing figure windows. Delete this line
% if you do not want this action.
close all
% Initialize figure window and axes
fig1=figure;
ax1=axes;
% Initialize some space to hold the sequence of points
% X1, X2, ..., XN
X=zeros(N,2);
% The initial value X1 = [0.5,0.5].
X(1,:)=[0.5,0.5]; % X(1,:) means "first row, every column."
% The main loop where the iterations are performed.
for k=1:N-1
r=rand;
if r<.01
X(k+1,:)=T(X(k,:),0,0,0,.16,0,0);
elseif r<.86
X(k+1,:)=T(X(k,:),.85,.04,-.04,.85,0,1.6);
elseif r<.93
X(k+1,:)=T(X(k,:),.2,-.26,.23,.22,0,1.6);
else
X(k+1,:)=T(X(k,:),-.15,.28,.26,.24,0,.44);
end
end
plot(X(:,1),X(:,2),'.','markersize',1)
% The transformation T
axis off
function U=T(X,a,b,c,d,e,f)
U=zeros(1,2);
U(1)=a*X(1)+b*X(2)+e;
U(2)=c*X(1)+d*X(2)+f;
fern.rar_Fern matlab_barnsley fern_fern_probability
版权申诉
158 浏览量
2022-07-15
15:41:41
上传
评论
收藏 1KB RAR 举报
JaniceLu
- 粉丝: 78
- 资源: 1万+
最新资源
- Springboot开发-将springboot与mongodb数据库相结合.zip
- 基于深度学习图像分割Unet的肿瘤区域识别辅助诊断系统python源码(高分项目).zip
- 基于ssm+jsp的母婴用品网站+数据库(毕业设计,包括源码,教程).zip
- Android简单的页面启动器,不用再使用onActivityResult来取得返回值 Kotlin + androidx 实现
- 基于深度学习图像分割Unet的肿瘤区域识别辅助诊断系统python源码(含模型构建、后端架设和前端访问功能).zip
- 各种fortran代码
- Springboot开发-使用springboot实现发邮件功能.zip
- Java SSM 生鲜果蔬电商系统【优质毕业设计分享】.rar
- 20、Java SSM 生鲜果蔬电商系统【优质毕业设计分享】.rar
- Python桌面应用开发图书信息管理系统 应用Python开发,基于最新的QT6桌面开发 用于本科专科阶段毕设模板
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0