Send the little princess a bow (matlab code implementation)

content

1 The tenderness of the bow

2 bow tie code


1 The tenderness of the bow

Every time I tie her shoelaces, she looks down at me, reminding me of Xu Zhimo's tenderness and shyness, such beautiful flowers, sweet to my heart; every time I tie a bow to her, she is like a Flower Fairy, there are flying butterflies around her. With you this spring, the air is sweet. Once love enters my heart, it is a lifetime of true love . Even if I can never reach your world, my heart will only fall in love with you alone.

I have traveled many roads and met many people, but no matter how many encounters there are in this world, no matter how good others are, it will be difficult to enter my heart, because my heart has long been occupied by you.

You are the only one I love, and all I miss. The world is thousands of miles away, holding your hand, watching the flowers, watching the moon, listening to the wind, listening to the rain, but in my soul world, the wind is also you, and the rain is also You, Sunny is you, Feixu is you.


2 bow tie code


%=====欢迎关注公众号:电力系统与算法之美========
dx=pi/60;
col=0:dx:pi;
az=0:dx:2*pi;
[phi,theta]=meshgrid(az,col);
%% 计算 l=3 的网格上的 P_{l}^{m}(\cos \theta)
l=3;
Plm=legendre(l,cos(theta));
% 由于 legendre 为 m 的所有值计算答案,因此 Plm 会包含一些额外的函数值。
% 提取 m=2 的值并丢弃其余值。
% 使用 reshape 函数将结果定向为与 phi 和 theta 具有相同大小的矩阵。
m=2;
if l~=0
    Plm=reshape(Plm(m+1,:,:),size(phi));
end
%% 
a=(2*l+1)*factorial(l-m);
b=4*pi*factorial(l+m);
C=sqrt(a/b);
Ylm=C.*Plm.*exp(1i*m*phi);
%% 球面坐标转换为笛卡尔坐标并绘图
[Xm,Ym,Zm]=sph2cart(phi,pi/2-theta,abs(real(Ylm)));
surf(Xm,Ym,Zm)
title('wlz','interpreter','latex')

 

 

Guess you like

Origin blog.csdn.net/weixin_46039719/article/details/124060297
BOW