I have the following notebook (trying to caclulate the pull-in voltage of a structure):
phi1 = b1 Cos[1.03855 x1] - b1 Cosh[1.03855 x1] + a1 Sin[1.03855 x1] -
a1 Sinh[1.03855 x1]
phi2 = b2 Cos[1.84683 x2] + d2 Cosh[1.84683 x2]
param = {b1 -> -0.255808, b2 -> 0.0340514, d2 -> 0.00305984, a1 -> 1,
c1 -> -1}
(*Numeric Constants*)
h = 2*10^-6;
wa = 10*10^-6;
la = 60*10^-6;
w = 100*10^-6;
l = 100*10^-6;
g = 1*10^-6;
e = 160*10^9;
epsilon0 = 8.85*10^-12;
sig0 = 0
i1 = wa*h^3/12;
i2 = w*h^3/12;
Area1 = h*wa;
Area2 = h*w;
θ = (Area2/Area1)^(1/4);
α = (i2/i1)^(1/4);
u = la/(l + la);
y = l/(l + la);
numericPhi1[x1_] = phi1 /. param
numericPhi2[x2_] = phi2 /. param
ph[x_] = Piecewise[{{numericPhi1[x],
0 <= x <= u}, {numericPhi2[1 - x], u < x <= 1}}];
ϕ[x_] :=
Piecewise[{{ph[x], 0 <= x <= 1}, {ph[2 - x], 1 < x <= 2}}];
b[x_?NumericQ] :=
Piecewise[{{wa, 0 <= x <= u}, {w, u < x <= 1}, {w,
1 < x <= 1 + (1 - u)}, {wa, 1 + (1 - u) < x <= 2}}]
i[x_?NumericQ] :=
Piecewise[{{i1, 0 <= x <= u}, {i2, u < x <= 1}, {i2,
1 < x <= 1 + (1 - u)}, {i1, 1 + (1 - u) < x <= 2}}]
nom[n_?NumericQ] :=
NIntegrate[(b[x] ϕ[x])/(g - n ϕ[x])^2, {x, 0, 2}]
denom[n_?NumericQ] :=
NIntegrate[(2 b[x] ϕ[x]^2)/(g - n ϕ[x])^3, {x, 0, 2}]
Now I try something simple:
nom[1.5]
If I do that I get the following warning:
NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in x near {x} = {0.00164274}. NIntegrate obtained 1.0191585739576856
*^7 and 9.39610858946137
*^6 for the integral and error estimates.
As you can see the error estimate is catastrophically huge 9.39610858946137*10^6
, hence I do not trust the result.
As pointed out in the comments by @AccidentalFourierTransform, it might be due to my numeric constants, since they vary over large magnitudes. However, I cannot change those constants as they are fixed by the physics of the problem.
Any help would be very much appreciated !
ph[x], phi[x], ...
depend on a parameter u, which isn't defined! Perhaps that's the reason why the second errormessage occurs? $\endgroup$nom[n], denom[n]
are complex valued, is this intended? $\endgroup$p=...
cannot be evaluated?? $\endgroup$Piecewise
, what the hell is the{x, 0, 2}
? $\endgroup$Piecewise
carefully. $\endgroup$