3 views (last 30 days)

Show older comments

function main1

p=.153;

x0 = [-3000, -3000];

options = optimoptions('fsolve','display', 'iter');

[sol,fval,exitflag, output] = fsolve(@(x)fun(x,p),x0, options);

if exitflag <= 0

return

end

end

function xres = fun(x,p)

k0 = 2.536;

k1 = 1.354;

k2 = -4.775;

k3 = -2.772;

k4 = -0.235;

gsN = 10.567;

gzN = -0.467;

f_pi = 93.3;

d = 0.064;

X0 = 409.769;

f_k = 122.143;

m_pi = 139;

m_k = 498;

k = (3 * p* pi^2)^(1/3);

gsN = 10.567;

gzN = -0.467;

m1 = -(gsN*x(1) + gzN*x(2));

E = sqrt(k^2 +m1^2);

rho_s = (m1/pi^2)* (k*E- m1^2 * log((k+E)/m1));

F(1) = (k0*x(1)*X0^2)-(4*k1*x(1)*(x(1)^2 + x(2)^2))-(2*k2*x(1)^3)-(2*k3*X0*x(1)*x(2))-(2*d*X0^4/(3*x(1)))+(m_pi^2*f_pi) - (gsN*rho_s);

F(2) = (k0*x(2)*X0^2)-(4*k1*x(2)*(x(1)^2 + x(2)^2))-(2*k2*x(2)^3)-(k3*X0*x(1)^2)-(d*X0^4/(3*x(2)))+((sqrt(2)*m_k^2*f_k)-(f_pi*m_pi^2/sqrt(2))) - (gzN*rho_s);

xres = F;

end

* here i want to solve x(1) and x(2)

command window

No solution found.

fsolve stopped because the last step was ineffective. However, the vector of function

values is not near zero, as measured by the value of the function tolerance.

<stopping criteria details>

fsolve stopped because the sum of squared function values, r, changed by 9.991357e-14

relative to its initial value; this is less than max(options.FunctionTolerance^2,eps) = 1.000000e-12.

However, r = 2.189392e+13, exceeds sqrt(options.FunctionTolerance) = 1.000000e-03.

Alex Sha
on 3 Jul 2021

Hi, the result below should be one solution

x1: -52.5485799573576

x2: 12.1032014174617

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

Start Hunting!