当前位置:网站首页>【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
据说是失传的老代码
边栏推荐
- 【mysql学习】8
- 5.索引和切片
- 数字图像处理——第六章 彩色图像处理
- 7.合并与分割
- GBASE 8C——SQL参考6 sql语法(15)
- Inno setup package jar + H5 + MySQL + redis into exe
- Emoji Emoji for text emotion analysis -improving sentimental analysis accuracy with Emoji embedding
- 贪心高性能神经网络与AI芯片应用研修
- 李宏毅 2020 深度学习与人类语言处理 DLHLP-Coreference Resolution-p21
- Activity之应用进程创建流程简析
猜你喜欢

11.感知机的梯度推导

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

Digital image processing Chapter 5 - image restoration and reconstruction

西瓜书第三章---线性模型学习笔记

Global evidence of expressed sentimental alterations during the covid-19 pandemics
![[Haowen planting grass] knowledge of root domain name - Ruan Yifeng's Weblog](/img/75/8f41db9f9c077b43751d63b7b5b57e.png)
[Haowen planting grass] knowledge of root domain name - Ruan Yifeng's Weblog

3. Classification problems - initial experience of handwritten digit recognition

Digital image processing Chapter 2 fundamentals of digital image

导数、偏导数以及梯度

数字图像处理 第二章 数字图像基础
随机推荐
Digital image processing -- Chapter 9 morphological image processing
Rk3399 GPIO port how to find which GPIO port it is
3.分类问题---手写数字识别初体验
7.合并与分割
Gbase 8C - SQL reference 6 SQL syntax (6)
Day 4.Social Data Sentiment Analysis: Detection of Adolescent Depression Signals
18.卷积神经网络
Handler操作记录 Only one Looper may be created per thread
GBASE 8C——SQL参考6 sql语法(5)
Day 11. Evidence for a mental health crisis in graduate education
Gbase 8C - SQL reference 6 SQL syntax (7)
4. Tensor data type and creation tensor
Auto Encoder(AE),Denoising Auto Encoder(DAE), Variational Auto Encoder(VAE) 区别
1. Introduction to pytorch
服务器相关的指标解释
贪心高性能神经网络与AI芯片应用研修
Unittest套件与运行器
数字图像处理——第九章 形态学图像处理
Day 11. Evidence for a mental health crisis in graduate education
5.索引和切片