B = 5;
L0 = 0:10;
A0 = 0:10;
tau = 1:100;
% Open and read the file
fid = fopen('first.txt', 'r');
data = cell2mat(textscan(fid, '%d'));
data = dlmread('first.txt');
% Two columns in the file
% First corresponds to time
t = data(:,1);
% Second to data values for luminosity
d = data(:,2);
% Posteriors for the three models 0,1&2
p0 = ((1./sqrt(2.*pi))^10).*(exp(-sum(0.5.*(d-B).^2)));
p1 =@(L0)((1./sqrt(2.*pi))^10).*(exp(-sum(0.5.*(d-B-L0).^2)));
p2 = @(A0,tau)((1./sqrt(2.*pi))^10).*(exp(-sum(0.5.*(d-B-A0.*exp(-t/tau)).^2)));
I1 = integral (p1, 0,10);
I2 = integral2 (p2,0, 10, 1, 100);
fclose(fid);
对于正常积分I1似乎工作正常但是对于双积分I2崩溃。有什么建议? PS。抱歉,长方程式
PS2。我使用Octave而不是Matlab,所以dblquad本质上意味着整数。
在文件中,我有这个:
0 7.108842
1 5.360705
2 5.871565
3 4.441087
4 6.877640
5 6.049399
6 5.587317
7 6.687828
8 7.390521
9 5.646180