MATLAB社区

MATLAB,,,,社区& more

情人节快乐!

要做什么吗?近2月14日,什么,oh what will you get your sweet one? Your very own osculating curve? The one who rounds you up every day? Who's always acute even when you're obtuse?
不用担心,我的朋友们!MATLAB社区博客已涵盖您。我们一直在努力工作,通过文件交换,寻找您需要的东西。因为没有什么能像一束精致的代码(及其随附的图像)那样说“我爱你”。
文件交换上有很多隐藏的宝石,珍贵的大小,耐心地等待发现。我在这里向你介绍情人,理查德·舒尔曼(Richard Schulman)
情人
But wait... there's more! Don't just pique their interest when you can bowl them over.
As an extra floral bonus. I'm going to give you something written by Alison Eele, from our UK office. Alison fashioned this from an algorithm originally written by Paul Nylander (you'll want to check out his good work here:数学艺术品)。
花算法来自保罗,但这首诗都是艾莉森!我建议您在送花时背诵它。
艾莉森·埃勒(Alison Eele)的情人节诗
玫瑰是[1,0,0]
紫罗兰是[0,0,1]
Matlab说数学
(也是诗歌!)
现在,如果那不会在情人节那天给您带来幸福,为什么我不知道会怎样。
祝你好运!
n = 800;
A = 1.995653;
b = 1.27689;
C = 8;
r = linspace(0,1,n);
theta=linspace(-2,20*pi,n);
[r,theta] = ndgrid(r,theta);
%定义我们每个周期所需的花瓣数量。玫瑰有3个和一点。
petalnum = 3.6;
x = 1-(1/2)*((5/4)*(1- mod(petalnum*theta,2*pi)/pi)。^2-1/4)。^2;
phi = (pi/2)*exp(-THETA/(C*pi));
y = a*(r.^2)。*(b*r -1)。^2.*sin(phi);
r2 = x。*(R.*sin(phi) + y。*cos(phi));
x = r2。*sin(theta);
y = r2。*cos(theta);
z = x。*(r。*cos(phi)-y。*sin(phi));
%%为我们的玫瑰色定义红地图
red_map = linspace(1,0.25,10)';
red_map(:,2)=0;
red_map(:,3)= 0;
Clf
冲浪(X,Y,Z,'LineStyle',,,,'没有任何'
查看([-40.50 42.00])
colormap(red_map)
n = 800;
r = linspace(0,1,n);
theta = linspace(0,2*pi,n);
[r,theta] = ndgrid(r,theta);
%定义我们每个周期所需的花瓣数量。Violets have 5!
petalNum=5;
x = 1-(1/2)*((5/4)*(1- mod(petalnum*theta,2*pi)/pi)。^2-1/4)。^2;
%更新PHI的公式以阻止螺旋效应
phi =(pi/2)*exp(-2*pi/(8*pi));
y = 1.95653*(R.^2)。*(1.27689*r -1)。^2.*sin(phi);
r2 = x。*(R.*sin(phi) + y。*cos(phi));
x = r2。*sin(theta);
y = r2。*cos(theta);
z = x。*(r。*cos(phi)-y。*sin(phi));
Blueviolet RGB的颜色代码138,43,226
%Indigo RGB值(75,0,130)
映射= 20;
blue_map = linspace(138,75,映射)';
blue_map(:,2)=linspace(43,0,mapSize)';
blue_map(:,3)= linspace(226,130,映射)';
%和中间有点
gold_map=[255 215 0; 250 210 0];
% combine to form a full flower map
Violet_map = [gold_map;blue_map];
% Now lets plot it and try and pick an attractive angle
冲浪(X,Y,Z,'LineStyle',,,,'没有任何'
colormap(Violet_map/255)
查看([ - 12.700 81.200])

|
  • 打印
  • 发送电子邮件

Comments

要发表评论,请单击here登录您的数学帐户或创建一个新帐户。