How to solve integral equation using integral2 matlab function
3 ビュー (過去 30 日間)
古いコメントを表示
Dear all,
I would like to solve an integral equation using an iterative scheme which is described in the attached file.
I wrote the following matlab code (I also attach the m file of this code):
function Test3
clear all; close all; clc
R = 1;
alpha = 0.50;
x0 = 5;
y0 = 5;
vmin = @(u)-sqrt(R^2-u.^2);
vmax = @(u)sqrt(R^2-u.^2);
C = @(u,v)(R^2+1)./(u.^2+v.^2+1);
T1 = @(x,y,s)sqrt(-1)/(4*pi)*besselh(0,1,sqrt(-1)*sqrt(1+s^(2*alpha))*sqrt((x-x0).^2+(y-y0).^2));
phi = @(u,v,s)u+v+s;
q = [0.1:0.1:0.5;0.1:0.1:0.5];
iter = 10; % for example
history = zeros(size(q,2),iter); % to save the solution
for n=1:iter
n
val = @(u,v,x,y,s)(sqrt(-1)/(4*pi)^2)*besselh(0,1,sqrt(-1)*sqrt(1+s^(2*alpha)).* ...
sqrt((x-u).^2+(y-v).^2)).*(1-C(u,v)).*phi(u,v,s);
phi = @(x,y,s)T1(x,y,s) + integral2(@(u,v)val(u,v,x,y,s),-1,1,vmin,vmax);
phi_value = zeros(size(q,2),1);
for i=1:size(q,2)
phi_value(i,1) = phi(q(1,i),q(2,i),0.5);
end
history(:,n) = phi_value; % to save the solution at nth iteration evaluated on the vector q
end
end
%=============================================================
Then, I got the following error:
%===================================================
Matrix dimensions must agree.
Error in
Test3>@(u,v,x,y,s)sqrt(-1)/(4*pi)*besselh(0,1,sqrt(-1)*sqrt(1+s^(2*alpha)).*sqrt((x-u).^2+(y-v).^2)).*(1-C(u,v)).*phi(u,v,s)
(line 19)
sqrt((x-u).^2+(y-v).^2)).*(1-C(u,v)).*phi(u,v,s);
Error in Test3>@(u,v)val(u,v,x,y,s) (line 20)
phi = @(x,y,s)T1(x,y,s) + integral2(@(u,v)val(u,v,x,y,s),-1,1,vmin,vmax);
Error in integral2Calc>integral2t/tensor (line 237)
Z1 = FUN(X(VTSTIDX),Y(VTSTIDX)); NFE = NFE + 1;
Error in integral2Calc>integral2t (line 55)
[Qsub,esub] = tensor(thetaL,thetaR,phiB,phiT);
Error in integral2Calc (line 9)
[q,errbnd] = integral2t(fun,xmin,xmax,ymin,ymax,optionstruct);
Error in integral2 (line 106)
Q = integral2Calc(fun,xmin,xmax,yminfun,ymaxfun,opstruct);
Error in Test3>@(x,y,s)T1(x,y,s)+integral2(@(u,v)val(u,v,x,y,s),-1,1,vmin,vmax) (line 20)
phi = @(x,y,s)T1(x,y,s) + integral2(@(u,v)val(u,v,x,y,s),-1,1,vmin,vmax);
Error in
Test3>@(u,v,x,y,s)sqrt(-1)/(4*pi)*besselh(0,1,sqrt(-1)*sqrt(1+s^(2*alpha)).*sqrt((x-u).^2+(y-v).^2)).*(1-C(u,v)).*phi(u,v,s)
(line 19)
sqrt((x-u).^2+(y-v).^2)).*(1-C(u,v)).*phi(u,v,s);
Error in Test3>@(u,v)val(u,v,x,y,s) (line 20)
phi = @(x,y,s)T1(x,y,s) + integral2(@(u,v)val(u,v,x,y,s),-1,1,vmin,vmax);
Error in integral2Calc>integral2t/tensor (line 228)
Z = FUN(X,Y); NFE = NFE + 1;
Error in integral2Calc>integral2t (line 55)
[Qsub,esub] = tensor(thetaL,thetaR,phiB,phiT);
Error in integral2Calc (line 9)
[q,errbnd] = integral2t(fun,xmin,xmax,ymin,ymax,optionstruct);
Error in integral2 (line 106)
Q = integral2Calc(fun,xmin,xmax,yminfun,ymaxfun,opstruct);
Error in Test3>@(x,y,s)T1(x,y,s)+integral2(@(u,v)val(u,v,x,y,s),-1,1,vmin,vmax) (line 20)
phi = @(x,y,s)T1(x,y,s) + integral2(@(u,v)val(u,v,x,y,s),-1,1,vmin,vmax);
Error in Test3 (line 29)
phi_value(i,1) = phi(q(1,i),q(2,i),0.5);
%============================================
I appreciate any idea you might have.
Thanks in advance.
Moncef Mahjoub
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Quadratic Programming and Cone Programming についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!