problem with integrand and quad2d

2 次查看(过去 30 天)
I had struggled with the double integral problem last month. Then I posted my question to mathworks and got very useful answer from Mr.Mike Hosea.
Up to now I have solved my problems with using integer inputs for "ne" and "me".
When I use decimal numbers (for example: 0.1 or 1.3) as an input for "ne", I get consistent outputs as well.
However, when I use decimal numbers as an input for "me", the output becomes complex, even though I use splitting integral.
Here is my code.
syms ne me epsilon eta zeta;
K1=76*10^9; K2=150*10^9; G1=26*10^9; G2=78*10^9;
Vs=(((zeta/2)+(1/2))^ne)*((eta/2)^me);
f1=(G1.*(9.*K1+8.*G1))/(6.*(K1+2*G1));
Gasil=G1+(Vs.*(G2-G1))./(1+(1-Vs).*((G2-G1)./(G1+f1)));
Kasil=K1+(Vs.*(K2-K1))./(1+(1-Vs).*((3.*(K2-K1))./(3.*K1+4.*G1)));
Easil=(9.*Kasil.*Gasil)./(3.*Kasil+Gasil);
f = matlabFunction(Easil)
ne = 3;
me = .2;
integrand = @(zeta,eta)f(eta,me,ne,zeta);
Q = quad2d(integrand,-1,0,-1,0) + ...
quad2d(integrand,-1,0,0,1) + ...
quad2d(integrand,0,1,-1,0) + ...
quad2d(integrand,0,1,0,1)
I would appreciate some help, idea, thought...
Ozan

采纳的回答

Mike Hosea
Mike Hosea 2012-5-2
Look at the definition of Vs. If you raise a negative quantity to a non-integer power, you get a complex number. The integrand function is complex, so of course the output is complex:
>> integrand(-0.5,-0.5)
ans =
7.068262980681484e+10 + 4.877789621753099e+08i

更多回答(1 个)

Ozan
Ozan 2012-5-3
You are right. I overlooked that.

Community Treasure Hunt

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

Start Hunting!

Translated by