matlab解方程,数值解或解析解

2024年11月29日 04:50
有1个网友回答
网友(1):

用solve()函数可以求得解析解。使用方法如下:
syms n0 n2 n1 R Phi

solve(R-((n0-n2)^2*(cos(Phi/2))^2+(n0*n2/n1-n1)^2*(sin(Phi/2))^2)/((n0+n2)^2*(cos(Phi/2))^2+(n0*n2/n1+n1)^2*(sin(Phi/2))^2),'n1')
ans =
1/(-2*tan(1/2*Phi)^2+2*R*tan(1/2*Phi)^2)*tan(1/2*Phi)*(-(-2+2*R)*(R*n0^2+R*n2^2+2*R*tan(1/2*Phi)^2*n0*n2+2*R*n0*n2-n0^2+2*n0*n2-n2^2+2*tan(1/2*Phi)^2*n0*n2-(6*n0^2*n2^2+6*R^2*n0^2*n2^2+8*tan(1/2*Phi)^2*n0^2*n2^2+16*R*tan(1/2*Phi)^2*n0^2*n2^2+R^2*n0^4-2*R*n0^4+R^2*n2^4-2*R*n2^4-4*n0^3*n2-4*n0*n2^3+4*R^2*n0^3*tan(1/2*Phi)^2*n2+4*R^2*n2^3*tan(1/2*Phi)^2*n0+8*R^2*tan(1/2*Phi)^2*n0^2*n2^2+16*R*tan(1/2*Phi)^4*n0^2*n2^2+4*R^2*n0^3*n2+4*R*n0^2*n2^2+4*R^2*n2^3*n0-4*n0^3*tan(1/2*Phi)^2*n2-4*n2^3*tan(1/2*Phi)^2*n0+n0^4+n2^4)^(1/2)))^(1/2)
-1/(-2*tan(1/2*Phi)^2+2*R*tan(1/2*Phi)^2)*tan(1/2*Phi)*(-(-2+2*R)*(R*n0^2+R*n2^2+2*R*tan(1/2*Phi)^2*n0*n2+2*R*n0*n2-n0^2+2*n0*n2-n2^2+2*tan(1/2*Phi)^2*n0*n2-(6*n0^2*n2^2+6*R^2*n0^2*n2^2+8*tan(1/2*Phi)^2*n0^2*n2^2+16*R*tan(1/2*Phi)^2*n0^2*n2^2+R^2*n0^4-2*R*n0^4+R^2*n2^4-2*R*n2^4-4*n0^3*n2-4*n0*n2^3+4*R^2*n0^3*tan(1/2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