怎么用MATLAB求解隐性函数方程
有一个很简单的方程我用MATLAB解不出,如下:q=0;s=('70*cos(q)+130*(1-(90*sin(p)-70*sin(q))/130)^0.5-90*co...
有一个很简单的方程我用MATLAB解不出,如下:
q=0;
s=('70*cos(q)+130*(1-(90*sin(p)-70*sin(q))/130)^0.5-90*cos(p)=150');
p=solve('s')
我想解是"P"值,最后得出的系空值,是不是最后一步的问题?
q=0;
s=('70*cos(q)+130*(1-(90*sin(p)-70*sin(q))/130)^0.5-90*cos(p)=150');
>> p=solve(s)
Quit:
??? Error using ==> maple
at offset 7, `]` unexpected
Error in ==> D:\应用程序\MATLAB1\toolbox\symbolic\@sym\findsym.m
On line 53 ==> v = maple(['sort(',v,',lexorder)']);
Error in ==> D:\应用程序\MATLAB1\toolbox\symbolic\solve.m
On line 97 ==> vars = ['[' findsym(sym(eqns),neqns) ']'];
按你们俩个说的再试了一遍,出现以上两种错误,还是不行,高手快出现啊~~~~~~~~~~~~~~~~ 展开
q=0;
s=('70*cos(q)+130*(1-(90*sin(p)-70*sin(q))/130)^0.5-90*cos(p)=150');
p=solve('s')
我想解是"P"值,最后得出的系空值,是不是最后一步的问题?
q=0;
s=('70*cos(q)+130*(1-(90*sin(p)-70*sin(q))/130)^0.5-90*cos(p)=150');
>> p=solve(s)
Quit:
??? Error using ==> maple
at offset 7, `]` unexpected
Error in ==> D:\应用程序\MATLAB1\toolbox\symbolic\@sym\findsym.m
On line 53 ==> v = maple(['sort(',v,',lexorder)']);
Error in ==> D:\应用程序\MATLAB1\toolbox\symbolic\solve.m
On line 97 ==> vars = ['[' findsym(sym(eqns),neqns) ']'];
按你们俩个说的再试了一遍,出现以上两种错误,还是不行,高手快出现啊~~~~~~~~~~~~~~~~ 展开
3个回答
展开全部
solve是解解析解的,如果没有解析解,就返回空值。
没有解析解,可用fsolve解数值解。
另外用solve时,定义全要符号变量:
syms p q s
s=70*cos(q)+130*(1-(90*sin(p)-70*sin(q))/130)^0.5-90*cos(p)=150
subs(s,q,0) % 把q换成0
ans =
130*(1 - (9*sin(p))/13)^(1/2) - 90*cos(p) - 80
>> solve(ans)
ans =
2*atan(39/112 - ((7439*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2))/784 - 9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2))/1568 - (99333*6^(1/2)*((351*2^(1/2)*3^(1/2)*649357^(1/2))/5488 + 175451/1568)^(1/2))/175616)^(1/2)/(6*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/6)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/4)) - (9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2)/(6*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/6)))
2*atan(((7439*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2))/784 - 9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2))/1568 - (99333*6^(1/2)*((351*2^(1/2)*3^(1/2)*649357^(1/2))/5488 + 175451/1568)^(1/2))/175616)^(1/2)/(6*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/6)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/4)) - (9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2)/(6*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/6)) + 39/112)
2*atan((9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2)/(6*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/6)) - ((7439*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2))/784 - 9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2))/1568 + (99333*6^(1/2)*((351*2^(1/2)*3^(1/2)*649357^(1/2))/5488 + 175451/1568)^(1/2))/175616)^(1/2)/(6*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/6)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/4)) + 39/112)
2*atan((9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2)/(6*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/6)) + ((7439*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2))/784 - 9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2))/1568 + (99333*6^(1/2)*((351*2^(1/2)*3^(1/2)*649357^(1/2))/5488 + 175451/1568)^(1/2))/175616)^(1/2)/(6*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/6)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/4)) + 39/112)
看来有解析解,算了二十秒~~~
转化成数值解:
double(ans)~~~~又用了二十秒
ans =
2.6198 - 1.5555i
2.6198 + 1.5555i
-0.6117
1.6553
一共有四个解
你上面的问题,s已经先定义为字符串了,为什么solve时还要加''.
没有解析解,可用fsolve解数值解。
另外用solve时,定义全要符号变量:
syms p q s
s=70*cos(q)+130*(1-(90*sin(p)-70*sin(q))/130)^0.5-90*cos(p)=150
subs(s,q,0) % 把q换成0
ans =
130*(1 - (9*sin(p))/13)^(1/2) - 90*cos(p) - 80
>> solve(ans)
ans =
2*atan(39/112 - ((7439*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2))/784 - 9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2))/1568 - (99333*6^(1/2)*((351*2^(1/2)*3^(1/2)*649357^(1/2))/5488 + 175451/1568)^(1/2))/175616)^(1/2)/(6*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/6)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/4)) - (9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2)/(6*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/6)))
2*atan(((7439*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2))/784 - 9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2))/1568 - (99333*6^(1/2)*((351*2^(1/2)*3^(1/2)*649357^(1/2))/5488 + 175451/1568)^(1/2))/175616)^(1/2)/(6*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/6)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/4)) - (9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2)/(6*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/6)) + 39/112)
2*atan((9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2)/(6*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/6)) - ((7439*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2))/784 - 9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2))/1568 + (99333*6^(1/2)*((351*2^(1/2)*3^(1/2)*649357^(1/2))/5488 + 175451/1568)^(1/2))/175616)^(1/2)/(6*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/6)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/4)) + 39/112)
2*atan((9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2)/(6*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/6)) + ((7439*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2))/784 - 9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/2))/1568 + (99333*6^(1/2)*((351*2^(1/2)*3^(1/2)*649357^(1/2))/5488 + 175451/1568)^(1/2))/175616)^(1/2)/(6*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/6)*(9*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(2/3) - (27975*((13*2^(1/2)*3^(1/2)*649357^(1/2))/10976 + 175451/84672)^(1/3))/3136 - 7439/784)^(1/4)) + 39/112)
看来有解析解,算了二十秒~~~
转化成数值解:
double(ans)~~~~又用了二十秒
ans =
2.6198 - 1.5555i
2.6198 + 1.5555i
-0.6117
1.6553
一共有四个解
你上面的问题,s已经先定义为字符串了,为什么solve时还要加''.
富港检测技术(东莞)有限公司_
2024-04-02 广告
2024-04-02 广告
正弦振动多用于找出产品设计或包装设计的脆弱点。看在哪一个具体频率点响应最大(共振点);正弦振动在任一瞬间只包含一种频率的振动,而随机振动在任一瞬间包含频谱范围内的各种频率的振动。由于随机振动包含频谱内所有的频率,所以样品上的共振点会同时激发...
点击进入详情页
本回答由富港检测技术(东莞)有限公司_提供
展开全部
q=0;
s=sym('70*cos(q)+130*(1-(90*sin(p)-70*sin(q))/130)^0.5-90*cos(p)=150');
p=solve(s,'q')
s=sym('70*cos(q)+130*(1-(90*sin(p)-70*sin(q))/130)^0.5-90*cos(p)=150');
p=solve(s,'q')
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
很easy啊,你把最后一句改成p=solve(s),保证ok!!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询