Hi,
I have developed the backstepping sliding mode controller for the asynchronous machine in Matlab function and I have encountered the following error (Error in default port dimensions function of S-function 'untitled/Subsystem1/MATLAB Function'. This function does not fully set the dimensions of output port 3). please is there anyone here who can help me solve this problem?
function [Vds,Vqs,Z2,Z4,ws] = fcn(fd,fr,wm,wd,Cr,ids,iqs,u1,u2,dwd,ddwd,dCr,dfd,ddfd)
Lm=0.258;Lr=0.274;Ls=0.274;Rs=4.85;Rr=3.805;fc=0.00114;J=0.031;p=2;
sig=1-Lm^2/(Ls*Lr);b=1/(sig*Ls);a1=-b*(Rs+(Lm/Lr)^2*Rr);
a2=(Lm*Rr)/(sig*Ls*Lr^2);a3=-b*(Lm/Lr);a4=(Lm*Rr)/Lr;a5=-Rr/Lr;a6=(p^2*Lm)/(J*Lr);
a7=fc/J;a8=p/J;
ws=(isq/fr)*((Lm*Rr)/Lr)+wm;
%wdold=0;
Z1=wm-wd;
%dwd=wd-wdold;
%ddwd=dwd-wdold;
Q1=-a7*wm-a8*Cr+c1*Z1+dwd;
Z2=Q1-a6*fr*iqs;
B1=ddwd+c1*dwd-a8*dCr+(-c1-a7)*(a6*fr*isq+a7*wm+a8*Cr)-a6*(fr*(a1*isq-ws*isd+a3*fr*wm)+isq*(a4*isd+a5*fr));
B2=-a6*b*fr;
Vqs=(-B1-u1-q2*Z2)/B2;
Z3=fd-fr;
%fdold=0;
%dfd=fd-fdold;
Q3=-a5*fr+c3*Z3+dfd;
Z4=Q3-a4*ids;
B3=ddfd+c3*dfd-(a5+c3)*(a4*ids+a5*fr)-a4*(a1*ids+ws*iqs+a2*fr);
B4=-a4*b;
Vds=(-B3-u2-q4*Z4)/B4;