There are several problems typing your function definition and to make sure the answer would be required to show the original template you are trying to simulate. Trying to make a correction without this information, a program that works is as follows:
System definition:
function di=didt(t,i,R,L,v,f,Rsec)
i1=i(1); i2=i(2); A=L; D=L*R; w=2*pi*f;
di(1,1)=A(1,1)*(v*cos(w*t))+A(1,2)*Rsec*i2+A(1,3)*((D(3,1)*i1+D(3,2)*i2...
-A(3,1)*(v*cos(w*t))-A(3,2)*Rsec*i2)/A(3,3))-D(1,1)*i1-D(1,2)*i2;
di(2,1)=A(2,1)*(v*cos(w*t))+A(2,2)*Rsec*i2+A(2,3)*((D(3,1)*i1+D(3,2)*i2...
-A(3,1)*(v*cos(w*t))-A(3,2)*Rsec*i2)/A(3,3))-D(2,1)*i1-D(2,2)*i2;
end
Simulation program:
% Definição dos parâmetros
R=[2.1581 0 0; 0 0.0114 0; 0 0 0.0556];
L=[8.7492 -8.7828 0.0336; -8.7828 12.3082 -3.5254; 0.0336 -3.5254 3.4918];
f=1e3; v=10e3; Rsec=100; i10=0; i20=0;
% Tempo de simulação
ts=[0 10e-3];
[t,i]=ode45(@(t,y) didt(t,y,R,L,v,f,Rsec),ts ,[i10 i20])
figure(1)
plot(t,i(:,1), t,i(:,2))
Note that there was the parameter flag
not used and that to call the function ode45
with auxiliary parameters for the function it is necessary to define an anonymous function as done there @(t,y) didt(t,y,R,L,v,f,Rsec)
.