在网上发现 很多用matlab写的有趣的小程序,整理如下。哈哈,娱乐一下。
著作属于原作者。
Part1:matlab自带的彩蛋
-
输入:vibes
- Vibrating L-shaped membrane.
-
输入:spy
-
输入:life
-
输入:penny
-
输入:why
-
输入:teapotdemo
- A demo that uses the famous Newell teapot to demonstrate MATLAB graphics features.
-
输入:logo
surf(membrane(1))
shading interp
-
输入:travel
- Traveling salesman problem demonstration.
-
输入:life
- MATLAB's version of Conway's Game of Life.
-
输入:makevase
- Generate and plot a surface of revolution.
-
输入:truss
- Animation of a bending bridge truss.
-
输入:fifteen
- A sliding puzzle of fifteen squares and sixteen slots.
-
输入:xpquad
- Superquadrics plotting demonstration.
-
输入:wrldtrv
- Show great circle flight routes around the globe.
Part2:网络上大家编的有趣的小程序
- 传递爱的正能量
[x,y]=meshgrid(-10:0.1:10);
z=-(17*x.^2-16*y.*abs(x)+17.*y.^2);
[c,h]=contourf(z,100);set(h,'linestyle','none')
-
最炫民族风歌曲
作者:叫我电气小混混
链接:https://www.zhihu.com/question/20818028/answer/22905358
来源:知乎著作权归作者所有,转载请联系作者获得授权。 -
义勇军进行曲
链接:https://mp.weixin.qq.com/s?__biz=MzAwODc0NzI1NQ==&mid=2663903506&idx=1&sn=8f21cc32c00dd200afa16a62f81c93a2&mpshare=1&scene=1&srcid=12015nDyJkAj8nnitSKmc4U3&pass_ticket=zCXdLVtlZwGvHbX%2FFQg%2BWFxQiS4owWlvemWhNQuiFT9THfUWIUXNzzMgXfnXJ2ir#rd
来源:微信公众号:美哉数学; 文章《【趣味】| 用MATLAB弹奏义勇军进行曲》 -
修改matlab初始显示内容
作者:Elsa
链接:https://www.zhihu.com/question/20818028/answer/41326109
来源:知乎
著作权归作者所有,转载请联系作者获得授权。
不算是命令吧,一个脑洞很大的英国老师教的一个小script,轻度调教Matlab,打开程序可以显示你想它显示的内容,并且自动把workspace设置到常用路径,这个脚本后来就被大家愉快地玩坏了。
首先写一个script,命名为startup.m
fprintf里面就是你想显示的内容啦,你写hello world也好,keep calm and zhao lanxiang 也罢,都有一种调教自家Matlab的快感。
cd里是你的常用workspace directory
------------------------------------------
%startup.m
fprintf(1,'Hello! This is your beloved Queen MATLAB! \n');
fprintf(1,'Message form start.m\n\n');
fprintf(1,'I would like to torture you even more today-just kidding:)');
fprintf(1,'Reminder:when you add a new function to a tool box, issue command:\n');
fprintf(1,' rehash toolboxcache\n\n');
cd ('~/Documents/MyMath/project');
------------------------------------------
然后!把你存放这个脚本的路径加入Matlab搜索路径里!home-set path-add with subfolder!后生切记!
-
**知乎问题:Matlab 可以做一些什么有意思的事? **
链接:https://www.zhihu.com/question/31328614 (知乎大神们的作品) -
世界及各国地图
自行搜索。 -
圣诞小礼物
链接1:http://www.ilovematlab.cn/thread-156623-1-1.html
链接2:http://cn.mathworks.com/matlabcentral/newsreader/view_thread/30480 (好像下载不下来) -
爱心表白
链接:https://mp.weixin.qq.com/s?__biz=MzI4ODIxNDcxOA==&mid=2247483674&idx=1&sn=e0c29b8b33710cf95cb144366e9cf471&mpshare=1&scene=1&srcid=1201Il63rN8uIFB4HJ6TueTP&pass_ticket=zCXdLVtlZwGvHbX%2FFQg%2BWFxQiS4owWlvemWhNQuiFT9THfUWIUXNzzMgXfnXJ2ir#rd
来源:微信公众号:苏克萨哈;文章《另类浪漫——matlab下的表白》- 3D心形:
clf
clear
clc
f=@(x,y,z) x.^2.*z.^3+9*y.^2.*z.^3/80-(x.^2+9*y.^2/4+z.^2-1).^3;%心形曲面函数
[x,y,z]=meshgrid(-1.5:0.1:1.5);%画图范围
v=f(x,y,z);
%画图
h=patch(isosurface(x,y,z,v,0));
isonormals(x,y,z,v,h)
set(h,'FaceColor','r','EdgeColor','none');
title('Programmed By Suksaha age')
alpha(0.6)
grid off;
axis([-1.5 1.5 -1.5 1.5 -1.5 1.5])
lighting Gouraud
h = camlight('left');
for i = 1:180;%水平旋转照相机
camorbit(1,0)
camlight(h,'left');
drawnow;
end
- 酷炫心形:
clf
clear
clc
[x,y]=meshgrid(-10:0.01:10);
z=-(17*x.^2-16*y.*abs(x)+17.*y.^2);
[c,h]=contourf(z,100);
set(h,'linestyle','none')
axis off
legend('bi simbe buyelembi, mini boobai')
网友评论