matlab解方程,数值解或解析解
利用Solve函数求解,应该是一个相对简单的函数,为什么就出错了?其中n0n2Phi都是已知的,就只有n1是未知的,按理说应该能解出来啊。...
利用Solve函
数求解,应该是一个相对简单的函数,为什么就出错了?其中n0 n2 Phi 都是已知的,就只有n1是未知的,按理说应该能解出来啊。 展开
数求解,应该是一个相对简单的函数,为什么就出错了?其中n0 n2 Phi 都是已知的,就只有n1是未知的,按理说应该能解出来啊。 展开
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*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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*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)
追问
若果说Phi 也是n的函数,比如说Phi=2*pi*d1*n1/lamda, 其中lamda d1 pi=3.14,也能求n1吗?
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
TableDI
2024-07-18 广告
2024-07-18 广告
仅需3步!不写公式自动完成Excel vlookup表格匹配!Excel在线免,vlookup工具,点击16步自动完成表格匹配,无需手写公式,免费使用!...
点击进入详情页
本回答由TableDI提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询