- 积分
- 48
- 回帖
- 0
- 西莫币
-
- 贡献
-
- 威望
-
- 存款
-
- 阅读权限
- 5
- 最后登录
- 1970-1-1
该用户从未签到
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
x
我用s函数编了个异步电机定子磁链u-I模型,出现系统错误:Index exceeds matrix dimensions.
Error in ==> d:\MATLAB6p5\work\sflux.m
On line 10 ==> sys=mdlOutputs(t,x,u);
不知如何解决,希望各位帮忙,谢谢
function [sys,x0,str,ts] = sflux(t,x,u,flag)
switch flag,
case 0,
[sys,x0,str,ts]=mdlInitializeSizes;
case 1,
sys=mdlDerivatives(t,x,u);
case 3,
sys=mdlOutputs(t,x,u);
case {2,4,9}
sys=[];
otherwise
error(['Unhandled flag = ',num2str(flag)]);
end
% end sfuntmpl
function [sys,x0,str,ts]=mdlInitializeSizes
sizes = simsizes;
sizes.NumContStates = 0;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 2;
sizes.NumInputs = 4;
sizes.DirFeedthrough = 1;
sizes.NumSampleTimes = 1; % at least one sample time is needed
sys = simsizes(sizes);
x0 = [];
str = [];
ts = [0 0];
% end mdlInitializeSizes
% mdlDerivatives
% Return the derivatives for the continuous states.
%=======================================
%输入:u(1)=Uαs,u(2)=Uβs,u(3)=Iαs,u(4)=Iβs
%输出:sys(1)=vαs,sys(2)ψβ
%状态变量:x(1)=ψαs,x(2)=ψβs
% 电机参数:Rs,Pn
function sys=mdlDerivatives(t,x,u)
Rs=0.1165;
sys(1)=u(1)-Rs*u(3);
sys(2)=u(2)-Rs*u(4);
% end mdlDerivatives
%=============================
% mdlOutputs
% Return the block outputs.
%=============================
function sys=mdlOutputs(t,x,u)
sys(1)=x(1);
sys(2)=x(2);
% end mdlOutputs |
|