5 麦片

050

1主题 0最佳答案

 要达到目的：r*a=L，r*sin（a/2)=I/2,r*(1-cos(a/2))=u/2,a是角度，已知L和I，想求r，a，u三个值的自定义函数。 我写的函数表达式： function u = LPM(L,I) syms r a F F=2*L/I; a=solve('(a*pi/180)/sin(a*pi/360)==F','a'); r=L/(a*pi/180); u=2*r*(1-cos(a*pi/360)); end 报错显示： 警告: Support of character vectors that are not valid variable names or define a number will be removed in a future release. To create symbolic expressions, first create symbolic variables and then use operations on them. > In sym>convertExpression (line 1586)   In sym>convertChar (line 1491)   In sym>tomupad (line 1243)   In sym (line 199)   In solve>getEqns (line 406)   In solve (line 226)   In LPM (line 7) 警告: Do not specify equations and variables as character vectors. Instead, create symbolic variables with syms. > In solve>getEqns (line 446)   In solve (line 226)   In LPM (line 7) 警告: Unable to find explicit solution. For options, see help. > In solve (line 317)   In LPM (line 7) 警告: The system is inconsistent. Solution does not exist. > In symengine   In sym/privBinaryOp (line 973)   In  /  (line 353)   In LPM (line 8) ans = 0 我是代入L=50.02，I=50求的，想问问各位大神该怎么改。 PS：我之后要代入一系列的L和I的值，求一系列的r，a，u，矩阵要怎么弄呢？

2979 麦片

20003000

2主题 668最佳答案
• 关注者： 137

 L=50.02;I=50; syms r a u S=solve(r*a-L,r*sin(a/2)-I/2,r*(1-cos(a/2))-u/2); 循环计算得到不同L、I对应的
 您需要登录后才可以回帖 登录 | 注册 本版积分规则 回帖后跳转到最后一页