Problems with ode45
이전 댓글 표시
Hello!need some help with my code(see it at the end).It takes too long time to run and nothing is displayed...matlab displays this warning: Warning: Failure at t=4.726456e+00. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.421085e-14) at time t. > In ode45 (line 360) In duffing1 (line 19) Warning: Failure at t=6.632906e-04. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.734723e-18) at time t. > In ode45 (line 360) In duffing1 (line 19) Warning: Failure at t=8.248260e-12. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (2.584939e-26) at time t.
if true
%close all
clear all;
global w w0 alpha c1
gamma1=0.5;
alpha=0.937; T=3000;ib=2.8;m=0.02;c1=T*ib*m;
w0=30;
np=200;
ww=linspace(.1,2.5,np);
ww1=linspace(2.5,.1,np);
yy=[];
yy1=[];
Y0=[0.1 0.1];
options = odeset('RelTol',1e-4,'AbsTol',[1e-4 1e-4 1e-5]);
% Rp=size()
for i=1:1:length(ww)
w=ww(i);
[T,Y] = ode45(@rigid,[0 200],Y0);
nn=length(Y(:,1));
ymax=max(Y(nn-round(nn/4):nn,1));
ymax1=max(Y(nn-round(nn/4):nn,2));
Y0=[ymax ymax1];
yy=[yy;ymax];
subplot(3,1,1);
plot(T,Y(:,1));
subplot(3,1,2);
plot(Y(:,1),Y(:,2));
end
subplot(3,1,3);
plot(ww,yy,'r');
hold on;%Backsweeping
ymax1=max(Y(nn-round(nn/4):nn,1));
ymax2=max(Y(nn-round(nn/4):nn,2));
for j=1:1:length(ww1)
w=ww1(j);
[T,Y1] = ode45(@rigid,[0 1000],[ymax1 ymax2]);
nn1=length(Y1(:,1));
ymax1=max(Y1(nn1-round(nn1/4):nn1,1));
ymax2=max(Y1(nn1-round(nn1/4):nn1,2));
yy1=[yy1;ymax1];
subplot(3,1,1);
plot(T,Y1(:,1));
subplot(3,1,2);
plot(Y(:,1),Y(:,2));
end
subplot(3,1,3);
plot(ww1,yy1, 'b');
end;
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!