gusucode.com > 三维物体放大缩小源码程序 > 三维物体放大缩小源码程序/Exploration.m

    % This prototype presents a way to make virtual reality  and can be enhanced
% by a physical model.

% The simulation is based on moving a spaceship passing near a
% meteorite, so that  the Temperature , based on random model,
% is  recorded starting at distance  d=1500 km from the meteorite .

% (c)  KHMOU Youssef,  Applied Mathematics, 2013
close all
fp1=figure;
tic
set(fp1,'Name','Space ship : Simulation');
%set(fp1,'PaperSize',[1000 1000]);
set(fp1,'WindowStyle','modal');
[x,y,z]=ellipsoid(0,0,0,20,20,3,50);
[m n]=size(x);
z=z+2*ones(m,n);
I=randn(m,n);
I=I./max(I(:));
z=z+0.1*randn(size(z));
surf(x,y,-z,I,...
    'EdgeColor','none');
shading interp
set(fp1,'Color',[0.1 0.001 0.2]);
hold on,
%colormap autumn
colormap gray
axis off
axis vis3d
N=300;
p1=-1500;
p2=1300;
xp = linspace(p1,p2,N);
%  Physical paramters
T0=3000; %  Kelvin
R=80.32;
T=T0*exp(-abs(xp)/R);
D=xp;
for i=1:N
     campos([xp(i),5,10]);
     Information=strcat('Data :      Distance=',num2str(D(i)),' Km','  Temperature=',num2str(T(i)),'Kelvin');
     if mod(i,2)==0
     set(fp1,'Name',Information);
     end
     drawnow
     pause(0.1)
end

figure,
plot(xp,T),xlabel(' Distance recorded (km)');
ylabel(' Temperature (kelvin)');
title('  Temperature recorded by  thermal sensor ')
grid on;
set(fp1,'WindowStyle','normal');
%fp1,zoom(4), view(-77,22),
toc