solve nonlinear equations with integration where the upper limit is variable

14 views (last 30 days)
john zhang
john zhang on 15 Aug 2020
Commented: john zhang on 16 Aug 2020
Hi All,
I need to solve a group of nonlinear equations with integration where the upper limit is variable. The format is shown as below:
f(x,t) is a nonlinear equation without an explicit integraton form. f(x,t) is:
where a1-a6 is known. a6 is more than 800 so it makes f(x,t) have no explicit integraton form.
x(1), x(2), ...x(N) and Z(1), Z(2), ...Z(N) are known double values. The upper limit of the integration, d, is a non-negative variable vector and also the one I need to calculate from the equations. I need to find the smallest ||d|| which satisfies these equations, and || || means any norm of vection d. I plan to use fsolve to solve these equations but I encounter problems in writing the right form of these equations into matlab function handle. My idea is to build the single integration function by int and use for loop to get a N*N matrix M where the element is one single integration. Then I can sum the rows of this N*N matrix and add Z into it. By converting the final function to function handle (matlabFunction) and I can use fsolve. My current diffculty lies in writing the corrrect form of the single integration function. Can anyone give me a hint or tell me is there better idea to solve these equations?
Here is what i arrived
L=10;
interval=1;
x=[-L:interval:L-interval]; %make a x vector between 0 and 10 with 1 as interval
N=length(x);
Z=x.^2./10+0.5;
X=zeros(N);% xi-xj matrix
for i=1:N
for j=1:N
X(i,j)=x(i)-x(j);
end
end
fun=@(dw,xx) integral(@(t)-(a(1)+a(2).*exp(-t./a(3))).*(1-(xx).^2./(a(4)+a(5)*t).^2).^a(6),0, dw, 'ArrayValued',false);
d = sym('d',[1 N]);
D=repmat(d,N,1);% make int upper limit matrix
M = sym('M',[N N]);
for i=1:N
for j=1:N
M(i,j)=fun(D(i,j),X(i,j));
end
end
fun1=sum(M,2)+Z;
fun2=matlabFunction(fun1,'Vars',{[d(1),d(2),d(3),d(4),d(5),d(6),d(7),d(8),d(9),d(10),d(11),d(12),d(13),d(14),d(15),d(16),d(17),d(18),d(19),d(20)]});
d_0=zeros(N,1);
y=fsolve(fun2,d_0)
  6 Comments
john zhang
john zhang on 16 Aug 2020
Hi John, thanks for your attention and time. The x=[-L:interval:L-interval] is not that important but "X = x - x.'" does help my coding.
Now I can solve the equations by a most primative method, i.e. adding all the integral and write them in function handle and use fsolve. Though laboriou and time-consuming, I did get one reasonable solution.
Thank you again for your time and attention!

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!