필터 지우기
필터 지우기

How to code integral part in diff. eqn with 0 to inf limit ?

조회 수: 3 (최근 30일)
Rakesh
Rakesh 2022년 10월 15일
댓글: Torsten 2022년 10월 16일
I want to code the above differential equation in matlab. But the only problem I am facing is how to code the integral part. I tried a lot but didn't get success. Please see below my trial code. Many thanks in advance.
function unbounded
clear;
global theta
t0 = 0; t1 = 5;
options=ddeset('MaxStep',0.001,'RelTol',6,'AbsTol',7);
sol = ddesd(@qvnn, @delay, [-0.2 0.5 0.4 -0.4 0 0 0 0 0.5 0.5 0.5 0.5 0 0 0 0 0.1 0.9], [t0, t1], options);
% plot(sol.y(17,:),sol.y(18,:),'r');
plot(sol.y(17,:),'r');
%xlabel('$q_1(t)$','Interpreter','latex');
%ylabel('$q_2(t)$','Interpreter','latex');
% legend('q_1(t)','q_2(t)','Location','northeast')
% plot(sol.x,sol.y(5,:),'g',sol.x,sol.y(6,:),'c',sol.x,sol.y(7,:),'r',sol.x,sol.y(8,:),'b');
function d = delay(t,~)
d = [t-exp(t)./(exp(t)+1),5];
end
function dy = qvnn(t,y,Z)
ylag = Z(:,1);
ylag2 = Z(:,2);
dy = zeros(18,1);
%first system
dy(1)=y(3);
dy(3)=-8*y(3)-(1+1/(y(1).*y(1)+1))*(0.5*y(1)-0.125*tanh(y(1))-0.175*tanh(y(2))-0.1*tanh(ylag(1))-0.15*tanh(ylag(2)))+0.2*y(5)+0.4*y(6);
dy(2)=y(4);
dy(4)=-10.4*y(4)-(1+1/(y(2).*y(2)+1))*(0.5*y(2)+0.4*tanh(y(1))+0.2*tanh(y(1))+0.05*tanh(y(2))+0.0755*tanh(ylag(1))+0.05*tanh(ylag(2)))-0.3*y(7)+0.6*y(8);
% second system
dy(9)=y(10);
dy(10)=-8*y(10)-(1+1/(y(9).*y(9)+1))*(0.5*y(9)-0.125*tanh(y(9))-0.175*tanh(y(11))-0.1*tanh(ylag(9))-0.15*tanh(ylag(11)))+0.2*y(13)+0.4*y(14)-10*y(17);
dy(11)=y(12);
dy(12)=-10.4*y(12)-(1+1/(y(11).*y(11)+1))*(0.5*y(11)+0.4*tanh(y(9))+0.2*tanh(y(9))+0.05*tanh(y(11))+0.0755*tanh(ylag(9))+0.05*tanh(ylag(11)))-0.3*y(15)+0.6*y(16)-12*y(18);
%%%%%%%%%%%%%%%% integral part %%%%%%%
a = y(1);
b = y(2);
c = y(9);
d = y(11);
f1 = @(t, theta)sin(2*theta)./(1+theta^2).*tanh(a(t-theta));
f2 = @(t, theta)sin(2*theta)./(1+theta^2).*tanh(b(t-theta));
f3 = @(t, theta)sin(2*theta)./(1+theta^2).*tanh(c(t-theta));
f4 = @(t, theta)sin(2*theta)./(1+theta^2).*tanh(d(t-theta));
y(5) = integral(f1,0, inf);
y(6) = integral(f2,0, inf);
y(7) = integral(f1,0, inf);
y(8) = integral(f2,0, inf);
y(13) = integral(f3,0, inf);
y(14) = integral(f4,0, inf);
y(15) = integral(f3,0, inf);
y(16) = integral(f4,0, inf);
%%%%%%%%%% we don't know how to define the unbounded intgral part which is give below %%%%%%%%%%%%%%
% y(5)=integration_{0,Inf}*sin(2*theta)./(1+theta^2)*tanh(tdiff(1))*dtheta;
% y(6)= integration_{0,Inf}*sin(2*theta)/(1+theta^2)*tanh(y(2)(t-\theta))* d\theta;
% y(7)= integration_{0,Inf}*sin(2*theta)/(1+theta^2)*tanh(y(1)(t-\theta))* d\theta;
% y(8)= integration_{0,Inf}*sin(2*theta)/(1+theta^2)*tanh(y(2)(t-\theta))* d\theta;
% y(13)= integration_{0,Inf}*sin(2*theta)/(1+theta^2)*tanh(y(9)(t-\theta))* d\theta;
% y(14)= integration_{0,Inf}*sin(2*theta)/(1+theta^2)*tanh(y(11)(t-\theta))* d\theta;
% y(15)= integration_{0,Inf}*sin(2*theta)/(1+theta^2)*tanh(y(9)(t-\theta))* d\theta;
% y(16)= integration_{0,Inf}*sin(2*theta)/(1+theta^2)*tanh(y(11)(t-\theta))* d\theta;
%%%%%%%%%%%%%%%%%%%%%%%%%%% error= y(t)-x(t-\tau) %%%%%%%%%%%%%%%%%
dy(17)=dy(9)-dylag2(1);
dy(18)=dy(11)-dylag2(2);
end
end
  댓글 수: 9
Rakesh
Rakesh 2022년 10월 16일
@Torsten I am searching for such a solver in the File Exchange. Hoping to get the solution.
Torsten
Torsten 2022년 10월 16일
To be honest: I doubt you will find a suitable solver since - additionally to the integral - your equation contains delays for the w_i.
If it were only the integral part, IDSOLVER might have worked:

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by