Matlab :Error using ==> subsref Index exceeds matrix dimensions.Error in ==> sym.subsref at 17我在运行以下程序的时候:R0=0.03;S0=45;T=12;Sigmar=0.02;Sigmas=0.2;I=0.02;Cb=35;M=100;a=0.015;b=0.3;for i=1:11; syms x s u;x=linspace(1,T-1,T-1);
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/23 22:43:31
Matlab :Error using ==> subsref Index exceeds matrix dimensions.Error in ==> sym.subsref at 17我在运行以下程序的时候:R0=0.03;S0=45;T=12;Sigmar=0.02;Sigmas=0.2;I=0.02;Cb=35;M=100;a=0.015;b=0.3;for i=1:11; syms x s u;x=linspace(1,T-1,T-1);
Matlab :Error using ==> subsref Index exceeds matrix dimensions.Error in ==> sym.subsref at 17
我在运行以下程序的时候:
R0=0.03;S0=45;T=12;Sigmar=0.02;Sigmas=0.2;I=0.02;Cb=35;M=100;
a=0.015;b=0.3;
for i=1:11;
syms x s u;
x=linspace(1,T-1,T-1);
cl(i)=int(int(exp(-int(b,x,0,u))/exp(-int(b,x,0,s)),s,0,u),u,x(i),T);
cl(i)=vpa(cl(i),6);
end;
当i=1时候 程序没有问题;
当i=2时候 出现了上述的提示
Matlab :Error using ==> subsref Index exceeds matrix dimensions.Error in ==> sym.subsref at 17我在运行以下程序的时候:R0=0.03;S0=45;T=12;Sigmar=0.02;Sigmas=0.2;I=0.02;Cb=35;M=100;a=0.015;b=0.3;for i=1:11; syms x s u;x=linspace(1,T-1,T-1);
%%%% 这样改就好了
clear;clc
R0=0.03;
S0=45;
T=12;Sigmar=0.02;
Sigmas=0.2;
I=0.02;Cb=35;M=100;a=0.015;b=0.3;
syms x s u
eq=int(exp(-int(b,x,0,u))/exp(-int(b,x,0,s)),s,0,u);
X=linspace(1,T-1,T-1);
cl=[];
for i=1:11;
cl(i)=int(eq,u,X(i),T);
end
vpa(cl,6)