寄蜉蝣于天地,渺沧海之一粟。相信大家都知道,宇宙是空旷的,甚至我们的太阳系都无比空旷。可是,轨道半径那长长的数据也许很难让我们切...
寄蜉蝣于天地,渺沧海之一粟。
相信大家都知道,宇宙是空旷的,甚至我们的太阳系都无比空旷。可是,轨道半径那长长的数据也许很难让我们切实地感受到太阳系的渺小。因此,我决定基于MATLAB绘制一下太阳系的真实比例。
代码本身并不复杂,主要是太阳系行星照片和数据[1]的查询较为繁琐。
演示视频如下:
MATLAB中的太阳系https://www.zhihu.com/video/1452037361307303936代码链接如下:
clcclear%% paramters(1 = 100km)Rs = 6955.00; %Sun RadiusRm = 24.397; %Mercury RadiusRv = 60.518; %Venus RadiusRe = 63.710; %Earth RadiusRma= 33.895; %Mars RadiusRj = 699.11; %Jupiter RadiusRsa = 543.64; %Saturn RadiusRu = 249.73; %Uranus RadiusRn = 243.41; %Neptune Radiusr_mer = 579091.00; %Mercury Orbitr_ven = 1082080.00; %Venus Orbitr_ear = 1495980.23; %Earth Orbitr_mar = 2279366.00; %Mars Orbitr_jup = 7785472.00; %Jupiter Orbitr_sat = 14334493.70; %Saturn Orbitr_ura = 28766790.82; %Uranus Orbitr_nep = 45034436.61; %Neptune Orbitlabel = 1.2;%% plot modelhold on% draw SunSun = imread('Solar_System/Sun.jpg');Sun = imresize(Sun, [2 * Rs 2 * Rs]);image(-Rs, -Rs, Sun);text(0, Rs * label, 'Sun', 'color', 'w');% draw MercuryMercury = imread('Solar_System/Mercury.jpg');Mercury = imresize(Mercury, [2 * Rm 2 * Rm]);image(r_mer-Rm, -Rm, Mercury);text(r_mer, 0, 'Mercury', 'color', 'w');% draw VenusVenus = imread('Solar_System/Venus.jpg');Venus = imresize(Venus, [2 * Rv 2 * Rv]);image(r_ven-Rv, -Rv, Venus);text(r_ven, 0, 'Venus', 'color', 'w');% draw EarthEarth = imread('Solar_System/Earth.jpg');Earth = imresize(Earth, [2 * Re 2 * Re]);image(r_ear-Re, -Re, Earth);text(r_ear, 0, 'Earth', 'color', 'w');% draw MarsMars = imread('Solar_System/Mars.jpg');Mars = imresize(Mars, [2 * Rma 2 * Rma]);image(r_mar-Rma, -Rma, Mars);text(r_mar, 0, 'Mars', 'color', 'w');% draw JupiterJupiter = imread('Solar_System/Jupiter.jpg');Jupiter = imresize(Jupiter, [2 * Rj 2 * Rj]);image(r_jup - Rj, -Rj, Jupiter);text(r_jup, 0, 'Jupiter', 'color', 'w')% draw SaturnSaturn = imread('Solar_System/Saturn.jpg');Saturn = imresize(Saturn, [2 * Rsa 2 * 2.515 * Rsa]);image(r_sat - 2.515 * Rsa, -Rsa, Saturn);text(r_sat, 0, 'Saturn', 'color', 'w')% draw UranusUranus = imread('Solar_System/Uranus.jpg');Uranus = imresize(Uranus, [2 * Ru 2 * Ru]);image(r_ura - Ru, -Ru, Uranus);text(r_ura, 0, 'Uranus', 'color', 'w')% draw NeptuneNeptune = imread('Solar_System/Neptune.jpg');Neptune = imresize(Neptune, [2 * Rn 2 * Rn]);image(r_nep - Rn, -Rn, Neptune);text(r_nep, 0, 'Neptune', 'color', 'w')title('Solar System');xlabel('100km=1');ylabel('100km=1');set(gca, 'color',[0 0 0]);image(2 * r_nep, r_nep, Neptune); %没有特别用途,支撑图片边框用image(-r_nep, -r_nep, Neptune); %没有特别用途,支撑图片边框用axis([-100000 1.1 * r_nep -300000 300000]);box ongrid onaxis equal
参考
- ^相关数据来源主词条: https://en.wikipedia.org/wiki/Solar_System
本文标题: 基于MATLAB的太阳系真实比例绘制
本文地址: http://www.lzmy123.com/jingdianwenzhang/163879.html
如果认为本文对您有所帮助请赞助本站