complex integral problem
6 次查看(过去 30 天)
显示 更早的评论
Hi all,
I have to solve following complex integral with 4 variables (s1x,s1y,s2x,s2y) numerically in Matlab GUI. But i i have error and couldn’t find the error till now. And codes are as follows too.
Could anyone show me the error?
Thanks in advance.
??? Error using ==> quadgk at 140
Parameters must be a character.
Error in ==> TransCalc>ApproveBut_Callback at 784
TransCoeff{m}=quadgk(y{m},handles.S1xMinVal,handles.S1xMaxVal,handles.S1yMinVal,handles.S1yMaxVal,handles.S2xMinVal,handles.S2xMaxVal,handles.S2yMinVal,handles.S2yMaxVal)
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> TransCalc at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)TransCalc('ApproveBut_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
for d=floor(10000/handles.WaveUp):1:ceil(10000/handles.WaveLow)
a(m)=d;
k(m)=2*pi/((10000*(1e-6)/d));
lamda(m)=10000*(1e-6)/d;
n_alfa(m)=0.5*gamma(handles.AlfaPowLaw)*((2*pi)^(-11/6+(handles.AlfaPowLaw)/2)).*((lamda(m).*(handles.DistLow))^(11/6-(handles.AlfaPowLaw)/2));
d_alfa=gamma(1-handles.AlfaPowLaw/2)*((gamma(handles.AlfaPowLaw/2))^2)*gamma(handles.AlfaPowLaw-1)*cos(pi*handles.AlfaPowLaw/2)*sin(pi*handles.AlfaPowLaw/4);
cn2tilda(m)=(n_alfa(m)/d_alfa)*handles.StrConst;
set(handles.StrucConstNonKolmNum,'String',num2str(d_alfa));
ro_0(m)=(((-2)^(1-handles.AlfaPowLaw))*gamma((2-handles.AlfaPowLaw)/2)*gamma(handles.AlfaPowLaw-1)*cos(0.5*pi*handles.AlfaPowLaw)*((k(m))^2)*handles.DistLow*((cn2tilda(m))^2)/gamma(handles.AlfaPowLaw/2))^(-1/(handles.AlfaPowLaw-2));
f1=exp((-1/((handles.BeamRad)^2))*(((s1x)^2)+((s1y)^2)+((s2x)^2)+((s2y)^2)));
f2{m}=exp((1i*(k(m)/(2*handles.DistLow)))*((((s1x)^2)-(2*s1x*handles.PxAxisValue))+(((s1y)^2)-(2*s1y*handles.PyAxisValue))+((2*s2x*handles.PxAxisValue)-((s2x)^2))+((2*s2y*handles.PyAxisValue)-((s2y)^2))))
f3{m}=exp((-1/((ro_0(m))^(handles.AlfaPowLaw-2)))*((((s1x-s2x)^2)+((s1y-s2y)^2))^((handles.AlfaPowLaw-2)/2)));
f4(m)=((handles.DistLow*handles.DistLow+k(m)*k(m)*((handles.BeamRad)^4)))/((4*pi*pi*handles.DistLow*handles.DistLow*((handles.BeamRad)^4))*((handles.PxAxisValue*handles.PxAxisValue+handles.PyAxisValue*handles.PyAxisValue)*((-k(m)*k(m)*(handles.BeamRad)*(handles.BeamRad))/(handles.DistLow*handles.DistLow+k(m)*k(m)*((handles.BeamRad)^4)))));
y{m} = @(s1x,s1y,s2x,s2y) (f1.*f2{m}.*f3{m})
TransCoeff{m}=quadgk(y{m},handles.S1xMinVal,handles.S1xMaxVal,handles.S1yMinVal,handles.S1yMaxVal,handles.S2xMinVal,handles.S2xMaxVal,handles.S2yMinVal,handles.S2yMaxVal)
m=m+1;
end
0 个评论
采纳的回答
Walter Roberson
2012-4-16
You cannot pass variables to quadgk that way. See instead http://www.mathworks.com/help/techdoc/math/bsgprpq-5.html
1 个评论
Walter Roberson
2012-4-16
quadgk is *not* a routine for integrating over 4 variables: the "quad" refers to adaptive quadrature.
There are techniques for doing multiple integrals, starting from the lower-dimensional routines such as triplequad . I do not recall the method at the moment. If I recall correctly, Mike Hosa has shown a general method, but I do not find it right now.
更多回答(1 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!