Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 工程数学软件 > MATLAB论坛
MATLAB论坛 一切MATLAB相关问题在此讨论。
回复
 
主题工具 显示模式
旧 2014-04-23, 15:51   #1
ty9523101
初级会员
 
注册日期: 2014-04-18
帖子: 2
声望力: 0
ty9523101 正向着好的方向发展
默认 如何计算带约束的非线性方程组

我先编写一个函数:
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]
ty9523101 当前离线   回复时引用此帖
回复

主题工具
显示模式

发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码



所有时间均为北京时间。现在的时间是 14:43


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.