Solving numerically nonlinear equation using fzero or fsolve with integral function inside
Afficher commentaires plus anciens
Dear all,.. Guys, I want to solve a value which is "a" in this case, in a very complex function with integral function inside it. for simplicity the func is something like this, a*A + a*B = integral(f(a)) + integral(g(a))
I try this code but it wasn't work, please help me.
syms x a
t0 =0;
t1 =1;
beta_0 = -1.08258e-8;
beta_1 = 1.881944374742801e-13;
beta_2 = 1.354999949814817e-11;
beta_3 = 4.319072657166946e-15;
R = 1e-9;
alpha = -1.6e-6; %assuming low temp room
dT = 0; %assume constant temp @ room temp
V_dc = 60;
psi1 = 4.731119415901211;
psi2 = 9.611040163439666e+03;
psi3 = - 4.731118843460321;
C1_div = 0.015786826203739;
C1 = 1 ;
C2 = -0.015510886909126 /C1_div;
C3 = -0.015788256979393 /C1_div;
C4 = 0.015495280230272 /C1_div;
C5 = -0.706760502482255 /C1_div;
C6 = -0.706760502482188 /C1_div;
phi = C1*cosh(psi1*x)+C2*sinh(psi1*x)+C3*cos(psi3*x)+C4*sin(psi3*x)+C5*exp(-psi2*x)/(psi2^2)+C6*exp(psi2*x - psi2)/(psi2^2);
dif1_phi = diff(phi,x,1);
dif2_phi = diff(phi,x,2);
dif3_phi = diff(phi,x,3);
dif4_phi = diff(phi,x,4);
dif5_phi = diff(phi,x,5);
dif6_phi = diff(phi,x,6);
A_temp = beta_0 *dif6_phi * phi;
A_fun = matlabFunction(A_temp);
A = integral(A_fun,0,1);
B_temp = dif4_phi*phi;
B_fun = matlabFunction(B_temp);
B = integral(B_fun,0,1);
C_temp = dif1_phi^2;
C_fun = matlabFunction(C_temp);
C = integral(C_fun,0,1);
d = 500e-9;
b_0 = 100e-9;
w_0 = b_0/d *sin(pi*x);
dw_0 = diff(w_0,x);
d2w_0 = diff(w_0,x,2);
D_temp = 2*dif1_phi*dw_0;
D_fun = matlabFunction(D_temp);
D = integral(D_fun,0,1);
epsi_0 = 8.854187817e-12; %vacum permitivity
E_temp = (beta_2*alpha*dT + beta_1*(C*a^2-a*D))*(a*dif2_phi-d2w_0)*phi ;
E_fun = matlabFunction(E_temp);
F_temp = beta_3*V_dc^2 * phi /(sqrt((1-a*phi-w_0)*(1-a*phi-w_0+2*R))*(acosh(1/R + (1-a*phi-w_0)/R))^2);
F_fun = matlabFunction(F_temp);
solving_a = @(a) a*A + a*B - integral(E_fun,0,1) - integral(F_fun,0,1);
a = fzero(solving_a,0)
Réponses (0)
Catégories
En savoir plus sur Numeric Solvers dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!