Hi, I am trying to make a matrix using function. It works as a separate function but when I use it in Simulink Matlab Function block it gives error. Please help me to figure it out. Thanks in anticipation. Regards
function Induc = Lsrm(theta)nb=27;Nr=1;Ns=30;Lm=0.04;for x=1:3for y=1:nbif x==1 L(x,y)=cos(theta+(2*(y-1)*pi/nb));elseif x==2 L(x,y)=cos(theta+(4*pi/3)+(2*(y-1)*pi/nb));else L(x,y)=cos(theta+(2*pi/3)+(2*(y-1)*pi/nb));endendendInduc=((Nr/Ns)*Lm)*L;end
Best Answer