-1
I never used the function ode45 of Matlab. Below the function and the program I developed, someone, please, can help me find the errors?
-Function
Function di=didt(t,i,flag,R,L,v,f,Rsec) I1=i(1); I2=i(2); A=L; D=L*R; w=2*pi*f;
di(1)=A(1,1)(vcos(w*t))+A(1,2)RsecI2+A(1,3)*((D(3,1)*I1+D(3,2)I2... -A(3,1)(vcos(wt))-A(3,2)RsecI2)/A(3,3))-D(1,1)*I1-D(1,2)I2; di(2)=A(2,1)(vcos(wt))+A(2,2)RsecI2+A(2,3)*((D(3,1)*I1+D(3,2)I2... -A(3,1)(vcos(wt))-A(3,2)Rseci2)/A(3,3))-D(2,1)*i1-D(2,2)*i2; di=[di(1) di(2)]';
end
-Program
% Definition of parameters 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;
% Simulation time t=[0 10e-3];
[t,i]=ode45('didt',t,[i10 i20],[],R,L,v,f,Rsec) figure(1) Plot(t,i(:,1), t,i(:,2))
Please specify what you want to do with your program.
– Fábio Perez
@Make sure to find I1 and I2 currents using Matlab’s ode45 function.
– Aline