当前位置:网站首页>【5·20特辑】MatLAb之我在和你表白
【5·20特辑】MatLAb之我在和你表白
2022-07-27 05:19:00 【垮起个老脸】
520到了,准备好和心爱的他(她)来一场浪漫的科技表白嘛?
剑指“白”科技-----> MatLAb(矩阵实验室)
MATLAB是matrix&laboratory两个词的组合,意为矩阵工厂(矩阵实验室),软件主要面对科学计算、可视化以及交互式程序设计的高科技计算环境。它将数值分析、矩阵计算、科学数据可视化以及非线性动态系统的建模和仿真等诸多强大功能集成在一个易于使用的视窗环境中,为科学研究、工程设计以及必须进行有效数值计算的众多科学领域提供了一种全面的解决方案,并在很大程度上摆脱了传统非交互式程序设计语言(如C、Fortran)的编辑模式。
浪漫“花心”
------------我可不花心
clear; clc; close all;
% NOTICE: Your MATLAB version should be at least R2019a !
% --------------------------- functions -------------------------------
f = @(x, y, z)(x.^2 + 2.25*y.^2 + z.^2 - 1).^3 - ...
x.^2.* z.^3 - 0.1125*y.^2.*z.^3;
g = @(x, y, z)(sqrt(x.^2+y.^2)-2.5).^2 + z.^2 - 0.4^2;
% -------------------------- generate data ----------------------------
t = linspace(-5, 5);
[x1, y1, z1] = meshgrid(t);
[x2, y2, z2] = meshgrid(t);
val1 = f(x1, y1, z1);
val2 = g(x2, y2, z2);
[p1, v1] = isosurface(x1, y1, z1, val1, 0);
[p2, v2] = isosurface(x2, y2, z2, val2, 0);
% --------------------------- basic plot ------------------------------
figure()
subplot(1, 1, 1)
h = patch('faces',p1,'vertices',v1,'facevertexcdata',jet(size(v1,1)),...
'facecolor','w','edgecolor','flat'); hold on;
patch('faces',p2,'vertices',v2,'facevertexcdata',jet(size(v2,1)),...
'facecolor','w','edgecolor','flat');
grid on; axis equal; axis([-3,3,-3,3,-1.5,1.5]); view(3)
title(["$(x^2+\frac{9}{4}y^2+z^2-1)^3-x^2z^3-\frac{9}{80}y^2z^3=0$",...
"$(\sqrt{x^2+y^2}-R)^2 +z^2 = r^2$"],'Interpreter','latex','position',[3.3,4])
warning('off');
% 请在此处进行您的演讲!% 请在此处进行您的演讲!
T = suptitle("$I\ Love\ U\ !$");
% 请在此处进行您的演讲!% 请在此处进行您的演讲!
set(T,'Interpreter','latex','FontSize',24)
% -------------------------- generate gif -----------------------------
pic_num = 1;
for i = 1:20
v1 = 0.98 * v1;
set(h, 'vertices', v1); drawnow;
F = getframe(gcf);
I = frame2im(F);
[I,map]=rgb2ind(I,256);
if pic_num == 1
imwrite(I,map,'BeatingHeart.gif','gif','Loopcount',inf,'DelayTime',0.05);
else
imwrite(I,map,'BeatingHeart.gif','gif','WriteMode','append','DelayTime',0.05);
end
pic_num = pic_num + 1;
end
for i = 1:20
v1 = v1 / 0.98;
set(h, 'vertices', v1); drawnow;
F = getframe(gcf);
I = frame2im(F);
[I,map] = rgb2ind(I,256);
imwrite(I,map,'BeatingHeart.gif','gif','WriteMode','append','DelayTime',0.05);
pic_num = pic_num + 1;
end
% ----------------------------- dynamic -------------------------------
while true
for i = 1:20
v1 = 0.98 * v1;
set(h, 'vertices', v1); drawnow;
end
for i = 1:20
v1 = v1 / 0.98;
set(h, 'vertices', v1); drawnow;
end
end
效果展示:(动态效果哦~)

还有姐妹版
clc
[email protected](x,y,z)(x.^2+ (9./4).*y.^2 + z.^2 - 1).^3 - x.^2.*z.^3 - (9./80).*y.^2.*z.^3;
[x,y,z]=meshgrid(linspace(-3,3));
val=f(x,y,z);
[p,v]=isosurface(x,y,z,val,0);
patch('faces',p,'vertices',v,'facevertexcdata',jet(size(v,1)),'facecolor','w','edgecolor','flat');
view(3);grid on;axis equal;

因为是妹妹,所以不会动~5555555
据说是失传的老代码
边栏推荐
- 数字图像处理 第一章 绪论
- 13. Logistic regression
- Day 6.重大医疗伤害事件网络舆情能量传播过程分析*———以“魏则西事件”为例
- Brief analysis of application process creation process of activity
- Auto Encoder(AE),Denoising Auto Encoder(DAE), Variational Auto Encoder(VAE) 区别
- GBASE 8C——SQL参考6 sql语法(10)
- 视觉横向课题bug1:FileNotFoundError: Could not find module ‘MvCameraControl.dll‘ (or one of it
- A photo breaks through the face recognition system: you can nod your head and open your mouth, netizens
- Emoji Emoji for text emotion analysis -improving sentimental analysis accuracy with Emoji embedding
- leetcode系列(一):买卖股票
猜你喜欢

17.动量与学习率的衰减

Day 9. Graduate survey: A love–hurt relationship

Social media user level psychological stress detection based on deep neural network

新冠时空分析——Global evidence of expressed sentiment alterations during the COVID-19 pandemic

数字图像处理 第一章 绪论

为什么交叉熵损失可以用于刻画损失

Day14. Using interpretable machine learning method to distinguish intestinal tuberculosis and Crohn's disease

李宏毅 2020 深度学习与人类语言处理 DLHLP-Coreference Resolution-p21

4.张量数据类型和创建Tensor

维度问题以及等高线
随机推荐
cycleGAN解析
Day 4.Social Data Sentiment Analysis: Detection of Adolescent Depression Signals
How to not overwrite the target source data when dBSwitch data migrates data increments
GBASE 8C——SQL参考6 sql语法(11)
leetcode系列(一):买卖股票
Handler操作记录 Only one Looper may be created per thread
13.逻辑回归
服务器相关的指标解释
Digital image processing Chapter 4 - frequency domain filtering
Gbase 8C - SQL reference 6 SQL syntax (1)
维度问题以及等高线
Day 17.The role of news sentiment in oil futures returns and volatility forecasting
面试常问Future、FutureTask和CompletableFuture
15. GPU acceleration, Minist test practice and visdom visualization
GBASE 8C——SQL参考6 sql语法(6)
9. High order operation
Day 7. Towards Preemptive Detection of Depression and Anxiety in Twitter
andorid检测GPU呈现速度和过度绘制
Chrome 如何快速将一组正在浏览的网页(tabs)转移到另一台设备(电脑)上
pytorch中交叉熵损失函数的细节