永发信息网

MATLAB带符号计算如何彻底计算

答案:2  悬赏:0  手机版
解决时间 2021-02-11 20:42
  • 提问者网友:欺烟
  • 2021-02-11 11:31
clear;clc;
syms muG muL muR;
G=muG;L=muL;R=muR;
a=1.2825/(0.288*muL);b=muL-0.577215/a;
cdfL=vpa(exp(-exp(-a*(L-b))));
pdfL=vpa(a*exp(-a*(L-b))*cdfL);
cdfL=subs(cdfL);
sigmaG=muG*0.07
sigmaL1=normpdf(norminv(cdfL))/pdfL
sigmaR1=vpa(R*(log(1+0.1^2))^0.5)
muG=muR/1.066;
muL=0.1*0.7*muG/1.06;
z=vpa(sqrt(sigmaG^2+sigmaL1^2+sigmaR1^2))
alphaG=(-sigmaG/z)
alphaL=sigmaL1/z
alphaR=sigmaR1/z

计算之后,alphaG、alphaL、alphR的结果都是含有变量的式子,但如果手算的话应该得到具体数值的,请问如何能得到?
最佳答案
  • 五星知识达人网友:酒安江南
  • 2021-02-11 12:39
直接令muG muL muR 都等于 1 就行了;
调用函数 subs(f, v, 1);

f 是带变量的函数,v 是待替换变量, 1 是替换的值,
一个一个替换一下,
f 的值就出来了,
具体可以参见 MATLAB help 文件
全部回答
  • 1楼网友:春色三分
  • 2021-02-11 13:25
syms s1 s2 t f p s1=solve('2*3^(1/2)*cos(t)*sin(f)-2+2*cos(t)*cos(f)-3^(1/2)*sin(p)*sin(t)*cos(f)+sin(p)*sin(t)*sin(f)=0','f'); s2=simplify(s1) s2 = 2*atan((3^(1/2)*tan(p/2)^2 - 3^(1/2)*tan(p/2)^2*tan(t/2)^2 + 2*tan(p/2)*tan(t/2) - 3^(1/2)*tan(t/2)^2 + 3^(1/2) + (3*tan(p/2)^4*tan(t/2)^4 - 10*tan(p/2)^4*tan(t/2)^2 + 3*tan(p/2)^4 + 6*tan(p/2)^2*tan(t/2)^4 - 4*tan(p/2)^2*tan(t/2)^2 + 6*tan(p/2)^2 + 3*tan(t/2)^4 - 10*tan(t/2)^2 + 3)^(1/2))/(2*tan(p/2)^2 - 2*3^(1/2)*tan(t/2)*tan(p/2) + 2)) 2*atan((3^(1/2)*tan(p/2)^2 - 3^(1/2)*tan(p/2)^2*tan(t/2)^2 + 2*tan(p/2)*tan(t/2) - 3^(1/2)*tan(t/2)^2 + 3^(1/2) - (3*tan(1/2*p)^4*tan(1/2*t)^4 - 10*tan(1/2*p)^4*tan(1/2*t)^2 + 3*tan(1/2*p)^4 + 6*tan(1/2*p)^2*tan(1/2*t)^4 - 4*tan(1/2*p)^2*tan(1/2*t)^2 + 6*tan(1/2*p)^2 + 3*tan(1/2*t)^4 - 10*tan(1/2*t)^2 + 3)^(1/2))/(2*tan(p/2)^2 - 2*3^(1/2)*tan(t/2)*tan(p/2) + 2)) >> s1 s1 = 2*atan((3^(1/2)*tan(p/2)^2 - 3^(1/2)*tan(p/2)^2*tan(t/2)^2 + 2*tan(p/2)*tan(t/2) - 3^(1/2)*tan(t/2)^2 + 3^(1/2) + (3*tan(p/2)^4*tan(t/2)^4 - 10*tan(p/2)^4*tan(t/2)^2 + 3*tan(p/2)^4 + 6*tan(p/2)^2*tan(t/2)^4 - 4*tan(p/2)^2*tan(t/2)^2 + 6*tan(p/2)^2 + 3*tan(t/2)^4 - 10*tan(t/2)^2 + 3)^(1/2))/(2*tan(p/2)^2 - 2*3^(1/2)*tan(t/2)*tan(p/2) + 2)) 2*atan((3^(1/2)*tan(p/2)^2 - 3^(1/2)*tan(p/2)^2*tan(t/2)^2 + 2*tan(p/2)*tan(t/2) - 3^(1/2)*tan(t/2)^2 + 3^(1/2) - (3*tan(1/2*p)^4*tan(1/2*t)^4 - 10*tan(1/2*p)^4*tan(1/2*t)^2 + 3*tan(1/2*p)^4 + 6*tan(1/2*p)^2*tan(1/2*t)^4 - 4*tan(1/2*p)^2*tan(1/2*t)^2 + 6*tan(1/2*p)^2 + 3*tan(1/2*t)^4 - 10*tan(1/2*t)^2 + 3)^(1/2))/(2*tan(p/2)^2 - 2*3^(1/2)*tan(t/2)*tan(p/2) + 2)) >> whos s1 name size bytes class attributes s1 2x1 176 sym >> whos s2 name size bytes class attributes s2 2x1 176 sym >> size(s2) ans = 2 1 是两行一列的啊!
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯