Hi everyone
In the Simulink environment, I encountered a problem that I want to create a discrete viewer using the MATLAB function and I did this with the for-loop. The problem is that function inputs, which are discrete signals, are not arrays and will be 1 by 1. Someone can help me?
function wr = fcn(ia,ib,va,vb)
I=[1 0;0 1];
J=[0 -1;1 0];
i_a=1;
i_b=0;
psi_a=1;
psi_b=0;
wr0=0;
for i=1:length(ia)
wr=wr0+0.2*(i_a - ia(i))*psi_a;
[i_a;i_b;psi_a;psi_b] == [I+0.1 0.5*I+0.9*wr;J+1*I J*wr+0.2*I]*[i_a;i_b;psi_a;psi_b] ...
+[I*800;0*I]*[va(i);vb(i)] - [2*I-1*J;wr*I-0.2*J]*[ia(i);ib(i)];
wr0 = wr;
end