![]() |
如何计算带约束的非线性方程组
我先编写一个函数:
function f=myfxeq05(xvect) f = 0.1; EX = 34.9; theta = 56.13; w = 2*pi*f; E1 =897.8; peita1 = 55.545; E2 = xvect(1); peita2 = xvect(2); f(1)=1/E1^2+1/(peita1*w)^2+(1+2*(E2/E1+peita2/peita1))/(E2^2+(peita2*w)^2)-(1.0/EX)^2 f(2)=E1*(E2^2+peita2*(peita1+peita2)*w^2)/(peita1*w*(E2^2+E1*E2+(peita2*w)^2))-tan(theta) 再编写一个执行文件: clear all xguess=[2 0.267]'; % Repeat with a different set of options ------------------------------- options(2) = 1.e-6; %Tolerance for x options(3) = 1.e-6; %Tolerance for f options(5) = 1; %Levenberg-Marquardt Method xvect = fsolve('myfxeq05', xguess, options); %E1 = xvect(1); %peita1 = xvect(2); E2 = xvect(1); peita2 = xvect(2); xvect = fsolve('myfxeq05', xguess, options); E2 = xvect(1); peita2 = xvect(2); disp('The roots from "fsolve" with Levenberg-Marquardt are: ') disp([' E2 = ', num2str(E2) ]) disp([' peita2 = ', num2str(peita2) ]) E1 =38; peita1 = 1.9; theta =56.13; a = 2.012/1000; b = 1.865/1000; t = [0.2:0.2:100]; fh = 0.1; %1 2 5 10 20 25]; wh = 2*pi*fh; ft = a * (1/E1 + t/peita1 + (1 - exp(-E2/peita2*t))/E2)-b*E2/(E2^2 + (wh*peita2)^2)*exp(-E2/peita2*t); st = b * sqrt(1/E1^2+1/(peita1*wh)^2+(1+2*(E2/E1+peita2/peita1)/(E2^2+(peita2*wh)^2)))*sin(wh*t+theta); tolr =ft/st disp([' a = ', num2str(a) ]) disp([' b = ', num2str(b) ]) disp([' tolr = ', num2str(tolr) ]) 这文件。首先给E1,peita1一个初值,计算E2,peita2,必须保证E2和peita2大于0 同时要求ft/st小于0.01 我不管给E1和peita1什么样的值,E2和peita2不满足要求。群内高手指点一下。我的qq是[email protected] |
所有时间均为北京时间。现在的时间是 12:42。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.