数学建模社区-数学中国

标题: 四杆机构优化设计 [打印本页]

作者: changfeng1937    时间: 2012-2-25 19:02
标题: 四杆机构优化设计
本人菜鸟一个,论文要用到优化设计,写了一个程序。运行错误提示:??? Error using ==> svd& G" V/ Z8 a9 `0 j
Input to SVD must not contain NaN or Inf.求大神们帮帮忙。很着急!!" b3 ^, d; E# R7 b: F. |
clc;1 C' ]! F. f2 Y# d. A+ A8 k
clear all;3 z- O: ^( K! q( n9 ^+ c: R
global L1 L59 c# x5 o# m; g
L1=3000;
( r! r1 K; U0 }7 i) T, K( V" b) LL5=1800;
9 _5 @  ^0 ~4 N: o. _x0=[780;2000;800;800;pi/12];( x/ Q& ^) j- _. q
options=optimset('largeScale','off','TolFun',1e-12);
3 ?% Z/ j! M5 ^) W- p# m0 c[x,fval,exitflag,output]=fmincon(@link_objfun1,x0,[],[],[],[],[],[],@link_confun1,options);
0 J- @8 L! X7 K. b
& `0 s: I( R/ r, b7 g
3 E9 n9 d9 Z9 _+ o' z%目标函数
6 }+ Y- h+ a1 L1 o7 ufunction f=link_objfun1(x)) @$ O% f6 C; B( J- [( e
global L1 L5" E9 j( P  m$ x7 P/ {$ U
f=0;% S2 f4 }8 u5 m) m7 k
snti0=0;
% H$ g. {+ E7 X' Xfor i=0:10: N8 _7 u' W, O; a# `
snti=snti0+pi/6*i/10;    4 O& x4 A( a. j2 ^
bati=acos((L1-x(1)*sin(snti+x(5)))/(L1^2+x(1)^2-2*L1*x(1)*sin(snti+x(5)))^1/2)...
7 u5 J" k6 K/ z4 q3 t7 B' F1 x% H    +acos((L1^2+x(1)^2+x(3)^2-x(2)^2-2*L1*x(1)*sin(snti+x(5)))/2*x(3)*(L1^2+x(1)^2-2*L1*x(1)*sin(snti+x(5)))^1/2)...
. g% u* L( t7 ~* ^    +acos(x(4)/x(3));
) y: S: O. B3 g1 @5 d1 Jf=f+(L1*cossnti+L5*cos(snti+bati)-L1)^2;
6 ?9 `2 W& s, v5 [- v% R3 B. uend4 F8 q  ?0 K6 `) [+ }8 l- J

1 y" \& P3 \# y: u, S0 y1 N1 V%约束函数. C+ Y& E$ v/ K
function [c ceq]=link_confun1(x)
8 O& q# e, G9 U3 o: o5 O3 I0 C4 aglobal L12 `' ]9 r8 U% f5 `
snti0=0;7 b+ N" P7 b) M0 ~* s% u
bati0=acos((L1-x(1)*sin(snti0+x(5)))/(L1^2+x(1)^2-2*L1*x(1)*sin(snti0+x(5)))^1/2)...
  A4 u2 o7 ?2 j4 k    +acos((L1^2+x(1)^2+x(3)^2-x(2)^2-2*L1*x(1)*sin(snti0+x(5)))/2*x(3)*(L1^2+x(1)^2-2*L1*x(1)*sin(snti0+x(5)))^1/2)...$ c! H$ l/ u1 q+ B/ H
    +acos(x(4)/x(3));
# j# l# S- a( F3 Wc=[-x(1)0 x& ~& t! a5 m; T( Y
    -x(2), }2 H# F$ t& q: Z
    -x(3)& C; W$ B( d3 Z
    -x(4)
4 M* r7 m' L8 X- U( N    x(1)-L1
3 q. R; Q9 }1 y. G2 Z' ]' S9 x( F    x(1)-x(2)* n* {( t$ c: g
    x(1)-x(3)2 K+ a! v1 O, @  k* Q: N# W' A5 e7 J
    x(1)+x(2)-x(3)-L1
8 H* @3 F% \- @& p( g+ m! t: n    L1-x(2)-x(3)-x(1)
- p) s1 u  l  L; x$ p    x(3)-x(1)-x(2)-L1];- R0 c& z7 o' [/ g
ceq=bati0-pi/2;




欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) Powered by Discuz! X2.5