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吗?
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
泰科博思
2024-12-27 广告
2024-12-27 广告
CASTEP是一款基于第一性原理计算方法的材料模拟软件,其优势包括:1.高精度。CASTEP使用密度泛函理论(DFT)进行第一性原理计算。这种基于波函数的方法不依赖于实验数据,可以获得非常高的准确性。2.广泛适用性。CASTEP适用于多种材...
点击进入详情页
本回答由泰科博思提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询