当前位置:网站首页>[5.20 special] MATLAB, I'm confessing to you
[5.20 special] MATLAB, I'm confessing to you
2022-07-27 06:06:00 【Collapse an old face】
520 here we are , Be ready and love him ( she ) Let's have a romantic technological confession ?
The finger of the sword “ white ” Technology -----> MatLAb( Matrix lab )
MATLAB yes matrix&laboratory Two word Combine , It means matrix factory ( Matrix lab ), Software mainly faces scientific computing 、 High tech computing environment for visual and interactive programming . It will numerical analysis 、 Matrix computing 、 Scientific data visualization and non linear Dynamic system modeling And simulation are integrated into an easy-to-use Windows environment , For scientific research 、 Engineering design and many scientific fields where effective numerical computation is necessary provide a comprehensive solution , And to a large extent, it gets rid of the traditional non interactive Programming language ( Such as C、Fortran) The editing mode of .
romantic “ Flower heart ”
------------ I don't bother
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');
% Please give your speech here !% Please give your speech here !
T = suptitle("$I\ Love\ U\ !$");
% Please give your speech here !% Please give your speech here !
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
Effect display :( Dynamic effect ~)

And the sister version
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;

Because it's my sister , So it won't move ~5555555
It is said to be a lost old code
边栏推荐
- 百问网驱动大全学习(二)I2C驱动
- [first song] rebirth of me in py introductory training (3): if conditional sentence
- 【头歌】重生之我在py入门实训中(4):循环程序
- [Haowen planting grass] knowledge of root domain name - Ruan Yifeng's Weblog
- System Design的相关准备材料
- Chrome 如何快速将一组正在浏览的网页(tabs)转移到另一台设备(电脑)上
- 力扣题解 单调栈
- PZK学C语言之数据类型,进制转换,输入输出,运算符,分支语句ifelse
- 【头歌】重生之我在py入门实训中(2):公式编程
- C language - linear sequence table
猜你喜欢

Lightroom classic 2022 v11.4 Chinese version "latest resources"

物联网操作系统

Speech and Language Processing (3rd ed. draft) Chapter 2 ——正则表达式,文本归一化,编辑距离 阅读笔记

ps 2022 六月更新,都新增了哪些功能

Lightroom Classic 2022 v11.4中文版「最新资源」

PZK学C语言之数据类型,进制转换,输入输出,运算符,分支语句ifelse

Live Home 3D Pro室内家居设计工具

根据SQL必知必会学习SQL(MYSQL)

Leetcode one question per day 30. Concatenate substrings of all words

发布 分辨率0.22m的建筑物分割数据库
随机推荐
One of the usage of operator()
力扣题解 动态规划(7)
Multi task foundation of IOT operating system
【头歌】重生之数据科学导论——回归进阶
这是我的博客
【头歌】重生之深度学习篇-Keras(初级)
使用Markdowm
[song] rebirth of me in py introductory training (10): numpy
PS 2022 updated in June, what new functions have been added
文件的路径
socket编程二:使用select
使用-Wall清除代码隐患
编程学习记录——第8课【数组与设计五子棋,扫雷游戏】
力扣160. 相交链表
力扣题解 二叉树(6)
【头歌】重生之我在py入门实训中(8): 模块
Xmind 思维导图 2022 v12.0.3中文版更新了哪些内容?
pycharm安装及导入项目注意事项
acwing每日一题 正方形数组的数目
AE 3D粒子系统插件:Trapcode Particular