螺杆转子刀具设计(2) matlab 解法
螺杆转子刀具设计 数学模型解如下方程:1679999.7*sin(x)-1679997.5*cos(y)*sin(x)-1499997.5*sin(y)*cos(x)-75000*sin(x)^3-179999.4000005*y*cos(y)*cos(x)+179999.4000005*y*sin(y)*sin(x)+75000*cos(y)*cos(x)*sin(x)=0
求当x=-1.361时y=?
>> syms x y
>> f=1679999.7*sin(x)-1679997.5*cos(y)*sin(x)-1499997.5*sin(y)*cos(x)-75000*sin(x)^3-179999.4000005*y*cos(y)*cos
(x)+179999.4000005*y*sin(y)*sin(x)+75000*cos(y)*cos(x)*sin(x)
f =
(7215543768789811*sin(x))/4294967296 - (2999995*cos(x)*sin(y))/2 - (3359995*cos(y)*sin(x))/2 - 75000*sin(x)^3 + 75000*cos(x)*cos(y)
*sin(x) - (6184732290414159*y*cos(x)*cos(y))/34359738368 + (6184732290414159*y*sin(x)*sin(y))/34359738368
>>subs(f, x, -1.361)
ans =
(3359995*sin(1361/1000)*cos(y))/2 - (2999995*cos(1361/1000)*sin(y))/2 - (7215543768789811*sin(1361/1000))/4294967296 + 75000*sin
(1361/1000)^3 - 75000*cos(1361/1000)*sin(1361/1000)*cos(y) - (6184732290414159*y*cos(1361/1000)*cos(y))/34359738368 -
(6184732290414159*y*sin(1361/1000)*sin(y))/34359738368
>>a=0; b=1;
eps1=1e-8;eps2=1e-8;
N=300;
f=@ (x) ((3359995*sin(1361/1000)*cos(x))/2 - (2999995*cos(1361/1000)*sin(x))/2 - (7215543768789811*sin(1361/1000))/4294967296 + 75000*sin(1361/1000)^3- 75000*cos(1361/1000)*sin(1361/1000)*cos(x) - (6184732290414159*x*cos(1361/1000)*cos(x))/34359738368 -(6184732290414159*x*sin(1361/1000)*sin(x))/34359738368);
Hfun=@Bisection;
= feval(Hfun, f,a,b,eps1,eps2,N);
运行结果
k ,a ,b ,x, f
1, 0.000000000, 1.000000000, 0.500000000,-352805.622314164,
2, 0.000000000, 0.500000000, 0.250000000,-92968.331400711,
3, 0.000000000, 0.250000000, 0.125000000,-4146.780462183,
4, 0.000000000, 0.125000000, 0.062500000,29178.936016433,
5, 0.062500000, 0.125000000, 0.093750000,13458.364371693,
6, 0.093750000, 0.125000000, 0.109375000,4890.124291139,
7, 0.109375000, 0.125000000, 0.117187500,430.092693351,
8, 0.117187500, 0.125000000, 0.121093750,-1843.759437944,
9, 0.117187500, 0.121093750, 0.119140625,-703.184646645,
10, 0.117187500, 0.119140625, 0.118164063,-135.633470273,
11, 0.117187500, 0.118164063, 0.117675781,147.457778641,
12, 0.117675781, 0.118164063, 0.117919922,5.969190901,
13, 0.117919922, 0.118164063, 0.118041992,-64.817881139,
14, 0.117919922, 0.118041992, 0.117980957,-29.420780403,
15, 0.117919922, 0.117980957, 0.117950439,-11.724903562,
16, 0.117919922, 0.117950439, 0.117935181,-2.877633532,
17, 0.117919922, 0.117935181, 0.117927551,1.545834384,
18, 0.117927551, 0.117935181, 0.117931366,-0.665885649,
19, 0.117927551, 0.117931366, 0.117929459,0.439977849,
20, 0.117929459, 0.117931366, 0.117930412,-0.112953030,
21, 0.117929459, 0.117930412, 0.117929935,0.163512627,
22, 0.117929935, 0.117930412, 0.117930174,0.025279853,
23, 0.117930174, 0.117930412, 0.117930293,-0.043836575,
24, 0.117930174, 0.117930293, 0.117930233,-0.009278357,
25, 0.117930174, 0.117930233, 0.117930204,0.008000749,
26, 0.117930204, 0.117930233, 0.117930219,-0.000638804,
27, 0.117930204, 0.117930219, 0.117930211,0.003680972,
>>
结论 当x=-1.361时y=0.117930219
按此方法 可依次得出150对x与y的值
西交大学生??问邢老师:lol 你这个是代数方程? 算法? cosxuan 发表于 2015-6-4 19:45 static/image/common/back.gif
算法?
二分法
还有一个程序
% Bisection.m
function=Bisection(f,a,b,eps1,eps2,N)
fprintf('k ,a ,b ,x, f\n')
for k=1:N
x=(a+b)/2;
f_value=f(x);
fprintf( '%3d, %10.9f, %10.9f, %10.9f,%10.9f,\n'...
,k ,a ,b ,x, f_value)
if abs(f_value)< eps1||0.5*(b-a)<eps2
return
else
if f(x)*f(a)<0
b=x;
else
a=x;
end
if k== N
warning ('算法超出最大迭代数!')
end
end
单车居士 发表于 2015-6-4 12:41 static/image/common/back.gif
西交大学生??问邢老师
这点问题 自己就可以解决
明月山河 发表于 2015-6-4 19:12 static/image/common/back.gif
你这个是代数方程?
是的呀 不过matlab写出来的方程括号很多不好看
明月山河 发表于 2015-6-4 19:12 static/image/common/back.gif
你这个是代数方程?
是超越方程 :D:D
页:
[1]