📄 examp.m
字号:
%% Reinitialize everything.%clearrand('seed',0);randn('seed',0);%% This script generates the example problem %%% First, the v,D transport parameters.%params=[1.0, 1.0]; % [v,D]%% Locations and times of samples.%xsample=5:5:300;tsample=300;nt=100;tmax=300.;tmin=0.;%% And the time points at which we'll estimate the source concentration%if (tmax == tsample) t=linspace(tmin,tsample,nt+1); t=t(1:nt);else t=linspace(tmin,tmax,nt);end%% Make t a column vector.%t=t';%% Compute the G matrix.%g=getrep('kernel',t',xsample,tsample,params);%% Compute the correct data. %cin=cintrue(t);cout=g*cin;% set the random number generator to its initial state so the% problem is repeatable;randn('state',0);% compute data with measurement error (d vector)d=cout+0.005*randn(size(cout));%% Now, setup the prior expected value, lower bounds, and upper bounds, etc.%upper=1.1*ones(nt,1);lower=zeros(nt,1);%% Gaussian expected value function.%expvalue=zeros(nt,1);expvalue=exp(-((t-150).^2)/(2*20^2));%% Noise level in the form noise = [epsilon_a epsilon_m]. %noise=[0.005 0.0];%% Finally, have the MRE routine solve the problem.%[x,lambda,beta,a,p5,p95]=mre(g,d,upper,lower,expvalue,noise)%%%figure(1);clf;bb=plot(t,cin,'k-',t,expvalue,'k--');set(bb(1),'linewidth',1.0)set(bb(2),'linewidth',1.0)aa=gca;set(aa,'linewidth',1.0,'fontsize',18);axis([0 250 0 1.2]);H=ylabel('C_{in}(t)');set(H,'Fontsize',18);H=xlabel('Time (days)'); set(H,'Fontsize',18);H=legend('True Model','Prior Mean');set(H,'Fontsize',18);set(H,'LineWidth',1.0);figure(2);cc=plot(t,x,'k-',t,p5,'k--',t,p95,'k--');set(cc(1),'linewidth',1)set(cc(2),'linewidth',1)set(cc(3),'linewidth',1)axis([0 250 0 1.2]);aa1=gca;set(aa1,'linewidth',2,'fontsize',18)H=ylabel('C_{in}(t)');set(H,'Fontsize',18);H=xlabel('Time (days)'); set(H,'Fontsize',18);H=legend('MRE Model','90% Interval');set(H,'Fontsize',18);set(H,'LineWidth',1.0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -