Clear Filters
Clear Filters

problem in simlulink 'Initial conditions solve failed to converge'

1 view (last 30 days)
I am trying to simulate a simple circuit with simulink, but it occurs error 'Initial conditions solve failed to converge' persistingly. Please refer to files I attached and help me solve this problem. The goal of this simulation is to obtain 3 figures as 'simulink result'.
I tried this simulation in MATLAB code and it was successful, but I still have a problem in simulink simulation
MAIN code
function Test clear all L1=0.1; L2=0.2; L3=0.1; R1=1; R2=2; R3=1; C=1e-6; V=10; R=[-R1 0 0;0 -(R2+R3) -1;0 1 0]; D=[1;0;0]; L=[(L1+L3) -L3 0;-L3 (L2+L3) 0;0 0 C]; A=inv(L)*R; B=inv(L)*D; X=[0;0;0]; U=V; T=0.00005;
for n=1:20000 n1(n)=n; X1=X; term1=A*X1+B*U; X2=X1+T*(A*X1+B*U); term2=A*X2+B*U; X=X+(T/2)*(term1+term2); i1(n)=X(1); i2(n)=X(2); Vc(n)=X(3); end
time=n1*T;
Plot_1;
Plot_1 code
figure(1)
subplot(3,1,1)
plot(time,i1)
grid
xlabel('Time')
ylabel('i_1[A]')
subplot(3,1,2)
plot(time,i2)
grid
axis([0 1 -0.01 0.01])
xlabel('Time')
ylabel('i_2[A]')
subplot(3,1,3)
plot(time,Vc)
grid
axis([0 1 -5 10])
xlabel('Time')
ylabel('V_c[V]')
set(gcf,'color',[1 1 1]);

Answers (0)

Categories

Find more on View and Analyze Simulation Results in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!