clear all; close all; maxX=10; minX=-10; x=linspace(minX,maxX,2000); startTime=.75; deltaTime=1.5; maxTime=90; x0=0; c=0.0001; minD=.1; maxD=5; D=[.01 .1 .5 3]; figure; set(gcf,'Position',[200 100 800 600]); hold on; %suptitle_withpatch('Ornstein-Ehrenfest process') for t=startTime : deltaTime : maxTime mu=x0*exp(-c*t); for p=1:4 subplot(2,2,p); var=(D(p)/c)*(1-exp(-2*c*t)); std=sqrt(var); F = 1/(std*sqrt(2*pi)).*exp(-(1/2)*((x-mu)/std).^2); time=repmat(t,2000,1); plot3(x,time,F); %view([-130,44]); %view([172,56]); view([170,46]); %front view % view([116,26]); %side view %view([158,42]); %view; ylim([startTime maxTime]); xlim([minX maxX]); %zlim([0 .5]); xlabel('x'); ylabel('time'); zlabel('f(x,t)'); title(sprintf('D=%3.2f, c=%5.4f, time=%4.2f',D(p),c,t),'fontsize',10); hold on; end drawnow; %pause(.5); end