-1

お願いします、私のプログラムはエラー コードを生成し続け、あらゆる手段でデバッグしようとしましたが、すべて役に立ちませんでした。助けてください。以下はコードとエラーです。

function xdot= Inverter(k,x)

 xdot=zeros(4,1);

w= 376.991;
Lf= 800e-6;
Cf=75e-6;
t=0:1;
vd=4*sin(w*t);
vq=4*sin(w*t+ pi/2);

ild = 9.5*sin(w*t);
ilq= 9.5*sin(w*t+ pi/2);
% initial conditions

xdot(1) = vd/Lf + w*x(2)- x(3)/Lf;
xdot(2) = vq/Lf - w*x(1) + x(4)/Lf;
xdot(3) = x(1)/Cf + w*x(4)- ild/Cf;
xdot(4) = x(2)/Cf - w*x(3)- ilq/Cf;

xdot = [xdot(1); xdot(2); xdot(3); xdot(4)];

[k,x]=ode45(@Inverter,[0 0.5 ], [0 0 0 0]');
figure(1) ,plot(k,x(:,3))



Error is:

???  In an assignment  A(I) = B, the number of elements in B and
 I must be the same.

Error in ==> Inverter at 16
xdot(1) = vd/Lf + w*x(2)- x(3)/Lf;

Error in ==> odearguments at 110
f0 = feval(ode,t0,y0,args{:});   % ODE15I sets args{1} to yp0.

Error in ==> ode45 at 173
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...

Error in ==> inv2 at 1
[k,x]=ode45(@Inverter,[0 0.5 ], [0 0 0 0]');

これらは、プログラムを実行するたびに取得し続けるエラー コードです。誰でも助けて!ありがとう

4

1 に答える 1

1

kはあなたの時間tだと思うので、あなたは本当に必要です:

vd=4*sin(w*k);
vq=4*sin(w*k+ pi/2);

ild = 9.5*sin(w*k);
ilq= 9.5*sin(w*k+ pi/2);

行を取り除くことができますt=0:1;。ラインxdot = [xdot(1); xdot(2); xdot(3); xdot(4)];も余計です。

于 2013-10-08T08:16:56.987 に答える