24小时热门版块排行榜    

查看: 887  |  回复: 5
【悬赏金币】回答本帖问题,作者summer_ziye将赠送您 5 个金币

summer_ziye

新虫 (小有名气)

[求助] 求各位大神帮忙 我的程序老是提示错误 如何修改已有2人参与

clc
clear

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%% Example 2
A11=[0 1; -44.75 -20]; A12=[0 1; -41.19 -20];
A21=[0 1; -42.55 -20]; A22=[0 1; -38.99 -20];
Atau11=[0 0; -1 -0.4]; Atau12=Atau11;
Atau21=[0 0; -1.2 -0.5]; Atau22=Atau21;
B12=[0 0; 0.8 0]; B21=[0 0; 1 0];
C11=[0; 0.5]; C12=C11; C21=[0; 0.4]; C22=C21;
D11=[1 0]; D12=D11; D21=D11; D22=D11;
Dtau11=[0.1 0]; Dtau12=Dtau11;
Dtau21=[0.08 0]; Dtau22=Dtau21;
G11=[0 1]; G12=G11; G21=G11; G22=G11; E11=0; E12=0; E21=0; E22=0;

%gamma=1;  %%%%% for simulation
%%%%%%%%%%%%%

Af11=[-2.4409    0.7508; -193.4481  -36.0634];Af12=[ -2.4704    0.7714; -196.6598  -36.5871];
Af21=[-1.1664    0.8471; -163.0604  -34.7050];Af22=[-1.1757    0.8727; -166.4750  -35.1970];
Bf11=[-1.8255; -137.2169];Bf12=[-1.8850; -145.3440];
Bf21=[-0.6479; -113.0800];Bf22=[-0.6873; -121.2615];
Gf11=[0.0788   -0.4708];Gf12=[0.0431   -0.4466];
Gf21=[0.0825   -0.4523];Gf22=[0.0454   -0.4286];
%%%%%%%%%%%%%

A111=[A11, zeros(2); Bf11*D11, Af11]; A112=[A11, zeros(2); Bf12*D11, Af12];
A121=[A12, zeros(2); Bf11*D12, Af11]; A122=[A12, zeros(2); Bf12*D12, Af12];
Atau111=[Atau11, zeros(2); Bf11*Dtau11, zeros(2)]; Atau112=[Atau11, zeros(2); Bf12*Dtau11, zeros(2)];
Atau121=[Atau12, zeros(2); Bf11*Dtau12, zeros(2)]; Atau122=[Atau12, zeros(2); Bf12*Dtau12, zeros(2)];
C111=[C11; Bf11*E11]; C112=[C11; Bf12*E11];
C121=[C12; Bf11*E12]; C122=[C12; Bf12*E12];
G111=[G11, -Gf11]; G112=[G11, -Gf12]; G121=[G12, -Gf11]; G122=[G12, -Gf12];
M21=[B21, zeros(2); zeros(2), zeros(2)];
   
A211=[A21, zeros(2); Bf21*D21, Af21]; A212=[A21, zeros(2); Bf22*D21, Af22];
A221=[A22, zeros(2); Bf21*D22, Af21]; A222=[A22, zeros(2); Bf22*D22, Af22];
Atau211=[Atau21, zeros(2); Bf21*Dtau21, zeros(2)]; Atau212=[Atau21, zeros(2); Bf22*Dtau21, zeros(2)];
Atau221=[Atau22, zeros(2); Bf21*Dtau22, zeros(2)]; Atau222=[Atau22, zeros(2); Bf22*Dtau22, zeros(2)];
C211=[C21; Bf21*E21]; C212=[C21; Bf22*E21];
C221=[C22; Bf21*E22]; C222=[C22; Bf22*E22];
G211=[G21, -Gf21]; G212=[G21, -Gf22]; G221=[G22, -Gf21]; G222=[G22, -Gf22];
M12=[B12, zeros(2); zeros(2), zeros(2)];



ee1=[1, 0, 0, 0]; ee2=[0, 1, 0, 0]; ee3=[0, 0, 1, 0]; ee4=[0, 0, 0, 1];

x101=0.3; x102=0; x103=0; x104=0; x10=[x101 x102 x103 x104]';  
phi1=x10;
x201=0.3; x202=0; x203=0; x204=0; x20=[x201 x202 x203 x204]';
phi2=x20;

h=0.002;
finaltime=15;
  
%%%%%%%%%%%%%%%%%%%%%%%% initial value of membership function h_i

h11(1:1,1)=abs(0.637*x101);
  h12(1:1,1)=1-h11(1:1,1);
  ttau1(1:1,1)=0.2*sin(0)-0.1;
  tau1(1:1,1)=(fix(ttau1(1:1,1)/h))*h;

h21(1:1,1)=abs(0.637*x201);
h22(1:1,1)=1-h21(1:1,1);
  ttau2(1:1,1)=0.2*sin(0)-0.1;
  tau2(1:1,1)=(fix(ttau2(1:1,1)/h))*h;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


dx10=(h11(1:1,1)*h11(1:1,1)*A111+h11(1:1,1)*h12(1:1,1)*A112+h12(1:1,1)*h11(1:1,1)*A121+h12(1:1,1)*h12(1:1,1)*A122)*x10+(h11(1:1,1)*h11(1:1,1)*Atau111+h11(1:1,1)*h12(1:1,1)*Atau112+h12(1:1,1)*h11(1:1,1)*Atau121+h12(1:1,1)*h12(1:1,1)*Atau122)*phi1+M21*phi2+(h11(1:1,1)*h11(1:1,1)*C111+h11(1:1,1)*h12(1:1,1)*C112+h12(1:1,1)*h11(1:1,1)*C121+h12(1:1,1)*h12(1:1,1)*C122)*0;
%dx10 is the derivative of x1 at time 0
x1(1:4,1)=dx10*h+x10;
%x1(i) is the value of x1 at step(i)
   
dx20=(h21(1:1,1)*h21(1:1,1)*A211+h21(1:1,1)*h22(1:1,1)*A212+h22(1:1,1)*h21(1:1,1)*A221+h22(1:1,1)*h22(1:1,1)*A222)*x20+(h21(1:1,1)*h21(1:1,1)*Atau211+h21(1:1,1)*h22(1:1,1)*Atau212+h22(1:1,1)*h21(1:1,1)*Atau221+h22(1:1,1)*h22(1:1,1)*Atau222)*phi2+M12*phi1+(h21(1:1,1)*h21(1:1,1)*C211+h21(1:1,1)*h22(1:1,1)*C212+h22(1:1,1)*h21(1:1,1)*C221+h22(1:1,1)*h22(1:1,1)*C222)*0;
%dx20 is the derivative of x2 at time 0
x2(1:4,1)=dx20*h+x20;
%x2(i) is the value of x2 at step(i)


v1(1:1,1)=0;
v2(1:1,1)=0;
e1(1:2,1)=(h11(1:1,1)*h11(1:1,1)*G111+h11(1:1,1)*h12(1:1,1)*G112+h12(1:1,1)*h11(1:1,1)*G121+h12(1:1,1)*h12(1:1,1)*G122)*x1(1:4,1);
e2(1:2,1)=(h21(1:1,1)*h21(1:1,1)*G211+h21(1:1,1)*h22(1:1,1)*G212+h22(1:1,1)*h21(1:1,1)*G221+h22(1:1,1)*h22(1:1,1)*G222)*x2(1:4,1);
vplus(1:1,1)=h*((v1(1:1,1))^2+(v2(1:1,1))^2);
eplus(1:1,1)=h*((e1(1:2,1))'*e1(1:2,1)+(e2(1:2,1))'*e2(1:2,1));
ev(1:1,1)=eplus(1:1,1)/vplus(1:1,1);

for count=1:finaltime/h
    t=count*h;
  
   h11(:,count)=abs(0.637*ee1*x1(:,count));
   h12(:,count)=1-h11(:,count);
   
   h21(:,count)=abs(0.637*ee1*x2(:,count));
   h22(:,count)=1-h21(:,count);
   

  v1(:,count)=(sin(4*pi*t))*exp(-0.5*t);      
  v2(:,count)=(sin(4*pi*t))*exp(-0.5*t);
   

  ttau1(:,count)=0.2*sin(t)-0.1;
%  tau1(:,count)=(fix(ttau1(:,count)/h)+1)*h;
   
  ttau2(:,count)=0.2*sin(t)-0.1;
%  tau2(:,count)=(fix(ttau2(:,count)/h)+1)*h;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


  if t<=ttau1(:,count)

    dx1(:,count)=(h11(:,count)*h11(:,count)*A111+h11(:,count)*h12(:,count)*A112+h12(:,count)*h11(:,count)*A121+h12(:,count)*h12(:,count)*A122)*x1(:,count)+(h11(:,count)*h11(:,count)*Atau111+h11(:,count)*h12(:,count)*Atau112+h12(:,count)*h11(:,count)*Atau121+h12(:,count)*h12(:,count)*Atau122)*phi1+M21*x2(:,count)+(h11(:,count)*h11(:,count)*C111+h11(:,count)*h12(:,count)*C112+h12(:,count)*h11(:,count)*C121+h12(:,count)*h12(:,count)*C122)*v1(:,count);
x1(:,count+1)=dx1(:,count)*h+x1(:,count);
   else
  
     
   dx1(:,count)=(h11(:,count)*h11(:,count)*A111+h11(:,count)*h12(:,count)*A112+h12(:,count)*h11(:,count)*A121+h12(:,count)*h12(:,count)*A122)*x1(:,count)+(h11(:,count)*h11(:,count)*Atau111+h11(:,count)*h12(:,count)*Atau112+h12(:,count)*h11(:,count)*Atau121+h12(:,count)*h12(:,count)*Atau122)*x1(:,count-fix(ttau1(:,count)/h))+M21*x2(:,count)+(h11(:,count)*h11(:,count)*C111+h11(:,count)*h12(:,count)*C112+h12(:,count)*h11(:,count)*C121+h12(:,count)*h12(:,count)*C122)*v1(:,count);
   x1(:,count+1)=dx1(:,count)*h+x1(:,count);
  end
  
  
  if t<=ttau2(:,count)

    dx2(:,count)=(h21(:,count)*h21(:,count)*A211+h21(:,count)*h22(:,count)*A212+h22(:,count)*h21(:,count)*A221+h22(:,count)*h22(:,count)*A222)*x2(:,count)+(h21(:,count)*h21(:,count)*Atau211+h21(:,count)*h22(:,count)*Atau212+h22(:,count)*h21(:,count)*Atau221+h22(:,count)*h22(:,count)*Atau222)*phi2+M12*x1(:,count)+(h21(:,count)*h21(:,count)*C211+h21(:,count)*h22(:,count)*C212+h22(:,count)*h21(:,count)*C221+h22(:,count)*h22(:,count)*C222)*v2(:,count);
x2(:,count+1)=dx2(:,count)*h+x2(:,count);
   else
  
     
   dx2(:,count)=(h21(:,count)*h21(:,count)*A211+h21(:,count)*h22(:,count)*A212+h22(:,count)*h21(:,count)*A221+h22(:,count)*h22(:,count)*A222)*x2(:,count)+(h21(:,count)*h21(:,count)*Atau211+h21(:,count)*h22(:,count)*Atau212+h22(:,count)*h21(:,count)*Atau221+h22(:,count)*h22(:,count)*Atau222)*x2(:,count-fix(ttau2(:,count)/h))+M12*x1(:,count)+(h21(:,count)*h21(:,count)*C211+h21(:,count)*h22(:,count)*C212+h22(:,count)*h21(:,count)*C221+h22(:,count)*h22(:,count)*C222)*v2(:,count);
   x2(:,count+1)=dx2(:,count)*h+x2(:,count);
  end
  
e1(:,count)=(h11(:,count)*h11(:,count)*G111+h11(:,count)*h12(:,count)*G112+h12(:,count)*h11(:,count)*G121+h12(:,count)*h12(:,count)*G122)*x1(:,count);
e2(:,count)=(h21(:,count)*h21(:,count)*G211+h21(:,count)*h22(:,count)*G212+h22(:,count)*h21(:,count)*G221+h22(:,count)*h22(:,count)*G222)*x2(:,count);
vplus(:,count+1)=h*((v1(:,count))^2+(v2(:,count))^2)+vplus(:,count);
eplus(:,count+1)=h*((e1(:,count))'*e1(:,count)+(e2(:,count))'*e2(:,count))+eplus(:,count);
ev(:,count+1)=eplus(:,count+1)/vplus(:,count+1);

end


%%%%%%%%%%%%%plot xi(1),xi(2), e1,e2, in the same fig

hold on
plot([0:h:finaltime],x1(2,)
plot([0:h:finaltime],x1(2,-e1(,'--')
%plot([0:h:finaltime],x2(2,)
%plot([0:h:finaltime],x2(2,-e2(,'--')
%plot([0:h:finaltime],e1()
%plot([0:h:finaltime],e2(,'--')
hold off
%legend('z_1(t)','z_{f1}(t)'))
%legend('z_2(t)','z_{f2}(t)'))
%legend('e_1(t)','e_2(t)'))

%hold on
%plot([0:h:finaltime],ev()
%hold off
%legend('u(t)')
xlabel('Time t')

??? Index exceeds matrix dimensions.
本人是初学者,实在不会,求各位大神帮帮忙
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

yangter92

金虫 (小有名气)

【答案】应助回帖

感谢参与,应助指数 +1
你把前面有百分号的先去掉,太多了看着都晕

[ 发自小木虫客户端 ]
justdomyself
2楼2014-06-01 17:28:50
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

summer_ziye

新虫 (小有名气)

引用回帖:
2楼: Originally posted by yangter92 at 2014-06-01 17:28:50
你把前面有百分号的先去掉,太多了看着都晕

好的
3楼2014-06-02 19:14:13
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

summer_ziye

新虫 (小有名气)

clc
clear
A11=[0 1; -44.75 -20]; A12=[0 1; -41.19 -20];
A21=[0 1; -42.55 -20]; A22=[0 1; -38.99 -20];
Atau11=[0 0; -1 -0.4]; Atau12=Atau11;
Atau21=[0 0; -1.2 -0.5]; Atau22=Atau21;
B12=[0 0; 0.8 0]; B21=[0 0; 1 0];
C11=[0; 0.5]; C12=C11; C21=[0; 0.4]; C22=C21;
D11=[1 0]; D12=D11; D21=D11; D22=D11;
Dtau11=[0.1 0]; Dtau12=Dtau11;
Dtau21=[0.08 0]; Dtau22=Dtau21;
G11=[0 1]; G12=G11; G21=G11; G22=G11; E11=0; E12=0; E21=0; E22=0;

Af11=[-2.4409    0.7508; -193.4481  -36.0634];Af12=[ -2.4704    0.7714; -196.6598  -36.5871];
Af21=[-1.1664    0.8471; -163.0604  -34.7050];Af22=[-1.1757    0.8727; -166.4750  -35.1970];
Bf11=[-1.8255; -137.2169];Bf12=[-1.8850; -145.3440];
Bf21=[-0.6479; -113.0800];Bf22=[-0.6873; -121.2615];
Gf11=[0.0788   -0.4708];Gf12=[0.0431   -0.4466];
Gf21=[0.0825   -0.4523];Gf22=[0.0454   -0.4286];

A111=[A11, zeros(2); Bf11*D11, Af11]; A112=[A11, zeros(2); Bf12*D11, Af12];
A121=[A12, zeros(2); Bf11*D12, Af11]; A122=[A12, zeros(2); Bf12*D12, Af12];
Atau111=[Atau11, zeros(2); Bf11*Dtau11, zeros(2)]; Atau112=[Atau11, zeros(2); Bf12*Dtau11, zeros(2)];
Atau121=[Atau12, zeros(2); Bf11*Dtau12, zeros(2)]; Atau122=[Atau12, zeros(2); Bf12*Dtau12, zeros(2)];
C111=[C11; Bf11*E11]; C112=[C11; Bf12*E11];
C121=[C12; Bf11*E12]; C122=[C12; Bf12*E12];
G111=[G11, -Gf11]; G112=[G11, -Gf12]; G121=[G12, -Gf11]; G122=[G12, -Gf12];
M21=[B21, zeros(2); zeros(2), zeros(2)];
   
A211=[A21, zeros(2); Bf21*D21, Af21]; A212=[A21, zeros(2); Bf22*D21, Af22];
A221=[A22, zeros(2); Bf21*D22, Af21]; A222=[A22, zeros(2); Bf22*D22, Af22];
Atau211=[Atau21, zeros(2); Bf21*Dtau21, zeros(2)]; Atau212=[Atau21, zeros(2); Bf22*Dtau21, zeros(2)];
Atau221=[Atau22, zeros(2); Bf21*Dtau22, zeros(2)]; Atau222=[Atau22, zeros(2); Bf22*Dtau22, zeros(2)];
C211=[C21; Bf21*E21]; C212=[C21; Bf22*E21];
C221=[C22; Bf21*E22]; C222=[C22; Bf22*E22];
G211=[G21, -Gf21]; G212=[G21, -Gf22]; G221=[G22, -Gf21]; G222=[G22, -Gf22];
M12=[B12, zeros(2); zeros(2), zeros(2)];

ee1=[1, 0, 0, 0]; ee2=[0, 1, 0, 0]; ee3=[0, 0, 1, 0]; ee4=[0, 0, 0, 1];

x101=0.3; x102=0; x103=0; x104=0; x10=[x101 x102 x103 x104]';  
phi1=x10;
x201=0.3; x202=0; x203=0; x204=0; x20=[x201 x202 x203 x204]';
phi2=x20;

h=0.002;
finaltime=15;
  
h11(1:1,1)=abs(0.637*x101);
  h12(1:1,1)=1-h11(1:1,1);
  ttau1(1:1,1)=0.2*sin(0)-0.1;
  tau1(1:1,1)=(fix(ttau1(1:1,1)/h))*h;

h21(1:1,1)=abs(0.637*x201);
h22(1:1,1)=1-h21(1:1,1);
  ttau2(1:1,1)=0.2*sin(0)-0.1;
  tau2(1:1,1)=(fix(ttau2(1:1,1)/h))*h;


dx10=(h11(1:1,1)*h11(1:1,1)*A111+h11(1:1,1)*h12(1:1,1)*A112+h12(1:1,1)*h11(1:1,1)*A121+h12(1:1,1)*h12(1:1,1)*A122)*x10+(h11(1:1,1)*h11(1:1,1)*Atau111+h11(1:1,1)*h12(1:1,1)*Atau112+h12(1:1,1)*h11(1:1,1)*Atau121+h12(1:1,1)*h12(1:1,1)*Atau122)*phi1+M21*phi2+(h11(1:1,1)*h11(1:1,1)*C111+h11(1:1,1)*h12(1:1,1)*C112+h12(1:1,1)*h11(1:1,1)*C121+h12(1:1,1)*h12(1:1,1)*C122)*0;

x1(1:4,1)=dx10*h+x10;
   
dx20=(h21(1:1,1)*h21(1:1,1)*A211+h21(1:1,1)*h22(1:1,1)*A212+h22(1:1,1)*h21(1:1,1)*A221+h22(1:1,1)*h22(1:1,1)*A222)*x20+(h21(1:1,1)*h21(1:1,1)*Atau211+h21(1:1,1)*h22(1:1,1)*Atau212+h22(1:1,1)*h21(1:1,1)*Atau221+h22(1:1,1)*h22(1:1,1)*Atau222)*phi2+M12*phi1+(h21(1:1,1)*h21(1:1,1)*C211+h21(1:1,1)*h22(1:1,1)*C212+h22(1:1,1)*h21(1:1,1)*C221+h22(1:1,1)*h22(1:1,1)*C222)*0;

x2(1:4,1)=dx20*h+x20;

v1(1:1,1)=0;
v2(1:1,1)=0;
e1(1:2,1)=(h11(1:1,1)*h11(1:1,1)*G111+h11(1:1,1)*h12(1:1,1)*G112+h12(1:1,1)*h11(1:1,1)*G121+h12(1:1,1)*h12(1:1,1)*G122)*x1(1:4,1);
e2(1:2,1)=(h21(1:1,1)*h21(1:1,1)*G211+h21(1:1,1)*h22(1:1,1)*G212+h22(1:1,1)*h21(1:1,1)*G221+h22(1:1,1)*h22(1:1,1)*G222)*x2(1:4,1);
vplus(1:1,1)=h*((v1(1:1,1))^2+(v2(1:1,1))^2);
eplus(1:1,1)=h*((e1(1:2,1))'*e1(1:2,1)+(e2(1:2,1))'*e2(1:2,1));
ev(1:1,1)=eplus(1:1,1)/vplus(1:1,1);

for count=1:finaltime/h
    t=count*h;
  
   h11(:,count)=abs(0.637*ee1*x1(:,count));
   h12(:,count)=1-h11(:,count);
   
   h21(:,count)=abs(0.637*ee1*x2(:,count));
   h22(:,count)=1-h21(:,count);
   

  v1(:,count)=(sin(4*pi*t))*exp(-0.5*t);      
  v2(:,count)=(sin(4*pi*t))*exp(-0.5*t);
   

  ttau1(:,count)=0.2*sin(t)-0.1;
   
  ttau2(:,count)=0.2*sin(t)-0.1;


  if t<=ttau1(:,count)

    dx1(:,count)=(h11(:,count)*h11(:,count)*A111+h11(:,count)*h12(:,count)*A112+h12(:,count)*h11(:,count)*A121+h12(:,count)*h12(:,count)*A122)*x1(:,count)+(h11(:,count)*h11(:,count)*Atau111+h11(:,count)*h12(:,count)*Atau112+h12(:,count)*h11(:,count)*Atau121+h12(:,count)*h12(:,count)*Atau122)*phi1+M21*x2(:,count)+(h11(:,count)*h11(:,count)*C111+h11(:,count)*h12(:,count)*C112+h12(:,count)*h11(:,count)*C121+h12(:,count)*h12(:,count)*C122)*v1(:,count);
x1(:,count+1)=dx1(:,count)*h+x1(:,count);
   else
  
     
   dx1(:,count)=(h11(:,count)*h11(:,count)*A111+h11(:,count)*h12(:,count)*A112+h12(:,count)*h11(:,count)*A121+h12(:,count)*h12(:,count)*A122)*x1(:,count)+(h11(:,count)*h11(:,count)*Atau111+h11(:,count)*h12(:,count)*Atau112+h12(:,count)*h11(:,count)*Atau121+h12(:,count)*h12(:,count)*Atau122)*x1(:,count-fix(ttau1(:,count)/h))+M21*x2(:,count)+(h11(:,count)*h11(:,count)*C111+h11(:,count)*h12(:,count)*C112+h12(:,count)*h11(:,count)*C121+h12(:,count)*h12(:,count)*C122)*v1(:,count);
   x1(:,count+1)=dx1(:,count)*h+x1(:,count);
  end
  
  
  if t<=ttau2(:,count)

    dx2(:,count)=(h21(:,count)*h21(:,count)*A211+h21(:,count)*h22(:,count)*A212+h22(:,count)*h21(:,count)*A221+h22(:,count)*h22(:,count)*A222)*x2(:,count)+(h21(:,count)*h21(:,count)*Atau211+h21(:,count)*h22(:,count)*Atau212+h22(:,count)*h21(:,count)*Atau221+h22(:,count)*h22(:,count)*Atau222)*phi2+M12*x1(:,count)+(h21(:,count)*h21(:,count)*C211+h21(:,count)*h22(:,count)*C212+h22(:,count)*h21(:,count)*C221+h22(:,count)*h22(:,count)*C222)*v2(:,count);
x2(:,count+1)=dx2(:,count)*h+x2(:,count);
   else
  
     
   dx2(:,count)=(h21(:,count)*h21(:,count)*A211+h21(:,count)*h22(:,count)*A212+h22(:,count)*h21(:,count)*A221+h22(:,count)*h22(:,count)*A222)*x2(:,count)+(h21(:,count)*h21(:,count)*Atau211+h21(:,count)*h22(:,count)*Atau212+h22(:,count)*h21(:,count)*Atau221+h22(:,count)*h22(:,count)*Atau222)*x2(:,count-fix(ttau2(:,count)/h))+M12*x1(:,count)+(h21(:,count)*h21(:,count)*C211+h21(:,count)*h22(:,count)*C212+h22(:,count)*h21(:,count)*C221+h22(:,count)*h22(:,count)*C222)*v2(:,count);
   x2(:,count+1)=dx2(:,count)*h+x2(:,count);
  end
  
e1(:,count)=(h11(:,count)*h11(:,count)*G111+h11(:,count)*h12(:,count)*G112+h12(:,count)*h11(:,count)*G121+h12(:,count)*h12(:,count)*G122)*x1(:,count);
e2(:,count)=(h21(:,count)*h21(:,count)*G211+h21(:,count)*h22(:,count)*G212+h22(:,count)*h21(:,count)*G221+h22(:,count)*h22(:,count)*G222)*x2(:,count);
vplus(:,count+1)=h*((v1(:,count))^2+(v2(:,count))^2)+vplus(:,count);
eplus(:,count+1)=h*((e1(:,count))'*e1(:,count)+(e2(:,count))'*e2(:,count))+eplus(:,count);
ev(:,count+1)=eplus(:,count+1)/vplus(:,count+1);

end


hold on
plot([0:h:finaltime],x1(2,)
plot([0:h:finaltime],x1(2,-e1(,'--')
hold off

xlabel('Time t')

??? Index exceeds matrix dimensions.
本人是初学者,实在不会,求各位大神帮帮忙
4楼2014-06-02 19:16:45
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

lianxiao33

金虫 (小有名气)

【答案】应助回帖

并不是所有地方都运行出错吧?为什么不标注清楚,等着别人慢慢地打开matlab给你运行么?
而且出错的结果是什么呢?matlab的workspace给出的结果。
这个性签名挺个性的
5楼2014-06-10 11:16:46
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

summer_ziye

新虫 (小有名气)

谢谢 我的问题已经解决了,请斑竹封贴
6楼2014-06-11 13:28:25
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 summer_ziye 的主题更新
不应助 确定回帖应助 (注意:应助才可能被奖励,但不允许灌水,必须填写15个字符以上)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[论文投稿] 好运来! +3 jibeidaxue 2024-10-15 3/150 2024-10-18 07:46 by lizhengke06
[有机交流] 产物呈油状怎么处理呀 5+3 许嵩YYDS 2024-10-15 3/150 2024-10-18 06:14 by xiaomei1031
[硕博家园] 博士“读”后感。 +10 麻辣烫。 2024-10-11 17/850 2024-10-17 23:57 by 麻辣烫。
[考博] 申博 +4 零差价 2024-10-16 6/300 2024-10-17 18:53 by 郑大志
[找工作] 两篇SCI一区-硕士-2025年应届生-材料与化工 +3 求导师要我 2024-10-15 4/200 2024-10-17 18:49 by mofang1233
[硕博家园] 工作不适应 +7 青萍之沫 2024-10-17 10/500 2024-10-17 17:34 by zeolitess
[论文投稿] 老师压着论文不让投咋办? +12 nvizqxuf 2024-10-16 20/1000 2024-10-17 16:49 by jurkat.1640
[论文投稿] 中文核心期刊后台审核系统能看到一稿多投吗 10+8 putiji 2024-10-16 13/650 2024-10-17 12:27 by sjlnts
[硕博家园] 研究生避雷川大低碳/建环刘某某 +11 Allllice 2024-10-12 15/750 2024-10-17 09:38 by Allllice
[论文投稿] 跪求各位虫友提供投稿帮助❥(^_-) 4+5 张秋慈 2024-10-11 5/250 2024-10-16 22:20 by 2008202066
[论文投稿] 中文信息学报投稿请求帮助 20+4 shuoyes 2024-10-16 5/250 2024-10-16 18:50 by TopEdit
[论文投稿] 投AEM的文章被拒,编辑建议转投 15+3 程木冉@ 2024-10-14 6/300 2024-10-16 14:23 by 北京莱茵润色
[基金申请] 中国青年女科学家奖得主,优青,青拔,西北大学刘建妮被基金委查处 +10 babu2015 2024-10-14 13/650 2024-10-16 11:06 by gwjxiaolang
[论文投稿] 论文来源期刊证明 5+6 Tonightfc 2024-10-12 10/500 2024-10-15 17:44 by Tonightfc
[电化学] 微型电化学传感器 +4 528104109 2024-10-14 8/400 2024-10-15 16:42 by 528104109
[论文投稿] 2024.10.12 TIMC reject +4 香瓜木香 2024-10-14 6/300 2024-10-15 16:18 by yuanjijoy
[论文投稿] sci同时投elsevier和springer能被发现一稿多投吗 10+4 tq980219 2024-10-11 13/650 2024-10-14 21:31 by edge099
[论文投稿] Applied Microbiology and Biotechnology 现在要收费了吗?记得以前不收啊 4+3 jizhihong 2024-10-13 5/250 2024-10-14 19:41 by jizhihong
[教师之家] 。。。。。。。。。 (金币-5) +19 lice_1987 2024-10-14 33/1650 2024-10-14 17:54 by lice_1987
[材料综合] 研究主题没有确定,求助 +4 gangla 2024-10-12 4/200 2024-10-13 06:19 by dianda502
信息提示
请填处理意见