Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.776357e-15) at time t

조회 수: 16(최근 30일)
Bathala Teja
Bathala Teja 2021년 9월 13일
댓글: darova 2021년 9월 14일
My script consists of 4 ode eq's. Iam solving those using ode45 function.
syms theta
A = cos(theta).*[1 5 6 1 7; 5 0 2 9 3; 1 4 5 1 0; 0 0 0 1 0; 0 0 0 0 1];
B = tan(2*theta).*[8 5 1 7 5; 0 3 1 1 6; 3 1 2 4 7; 0 0 0 0 0; 0 0 0 0 0];
C = sin(2*theta).*[8 5 1; 0 1 6; 2 4 7];
myfun = @(t,y)scriptname(t,y,A,B,C);
% dummy values for tspan and y0
tspan = [0 1];
y0 = zeros(1, 5);
% ode solver
sol = ode45(myfun,tspan,y0);
h = figure;
% plot
for i = 1:3
subplot(3,1,i);
plot(sol.x,sol.y(i,:));
xlabel('time');
ylabel('Current');
title(['stator current # ',int2str(i)]);
end
g = figure;
for i=3
plot(sol.x,sol.y(i,:)*30/pi);
xlabel('time,s');
ylabel('Speed, rpm');
title('Mechanical Angular Speed');
end
function dydt = scriptname(t,y,A,B,C)
inertia = 0.05;
Wr = 2*pi*50;
p =2;
% evaluation of A and B (numerical) with theta = y(3)
Cn = double(subs(C,y(5)));
for i=1:3
I(i,1)=y(i);
end
Te = 1/2*p*I'*Cn*I
if t<0.75
Tl=0;
else
Tl=7.31;
end
V = [1.4142*400/sqrt(3)*cos(Wr*t);
1.4142*400/sqrt(3)*cos(Wr*t+2.*pi/3.);
1.4142*400/sqrt(3)*cos(Wr*t-2.*pi/3.);
(Te-Tl)/inertia;
y(4)]
% evaluation of A and B (numerical) with theta = y(3)
An = double(subs(A,y(5)));
Bn = double(subs(B,y(5)));
dydt = An\V-(Bn*y);
end
while running this code, it is giving below error
Warning: Failure at t=7.854990e-01. Unable to meet integration tolerances without reducing the step size below
the smallest value allowed (1.776357e-15) at time t.
And waveforms are coming like this
Can anyone tell me where did i went wrong.
  댓글 수: 3
darova
darova 2021년 9월 14일
Honetsly i don't know. Maybe @Walter Roberson will suggest you something
Maybe you have stiff ode: LINK

댓글을 달려면 로그인하십시오.

답변(0개)

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by