Matlab出错,求高手指点
发布网友
发布时间:2023-02-11 22:51
我来回答
共1个回答
热心网友
时间:2024-02-19 13:47
将[r,t,c1,c2]=solve()改成下列形式
s=solve('r+1=(c1+c2)*(1+z)','i*k0*(1-r)=(c1-c2)*(i*k+i*k0*z)','c1*(exp(i*k*N*d)+z*exp(i*k0*N*d))+c2*(exp(-i*k*N*d)+z*exp(-i*k0*N*d))=t*exp(i*k0*N*d)','c1*(i*k*exp(i*k*N*d)+z*i*k0*exp(i*k0*N*d))-c2*(i*k*exp(-i*k*N*d)+z*i*k0*exp(-i*k0*N*d))=t*i*k0*exp(i*k0*N*d)','r','t','c1','c2')
就可得到r,t,c1,c2
s =
c1: [1x1 sym]
c2: [1x1 sym]
r: [1x1 sym]
t: [1x1 sym]
>> s.c1
ans =
(2*k0^2*(1/exp(N*d*k*i)) + 2*k*k0*(1/exp(N*d*k*i)) + 4*k0^2*z*(1/exp(N*d*k0*i)))/(k^2*(1/exp(N*d*k*i)) - k^2*exp(N*d*k*i) + k0^2*(1/exp(N*d*k*i)) - k0^2*exp(N*d*k*i) + 2*k*k0*(1/exp(N*d*k*i)) + 2*k*k0*exp(N*d*k*i) + 2*k0^2*z*(1/exp(N*d*k*i)) + 2*k0^2*z*(1/exp(N*d*k0*i)) + 4*k0^2*z^2*(1/exp(N*d*k0*i)) + 2*k*k0*z*(1/exp(N*d*k*i)) + 2*k*k0*z*(1/exp(N*d*k0*i)))
>> s.c2
ans =
-(2*k0^2*exp(N*d*k*i) - 2*k*k0*exp(N*d*k*i))/(k^2*(1/exp(N*d*k*i)) - k^2*exp(N*d*k*i) + k0^2*(1/exp(N*d*k*i)) - k0^2*exp(N*d*k*i) + 2*k*k0*(1/exp(N*d*k*i)) + 2*k*k0*exp(N*d*k*i) + 2*k0^2*z*(1/exp(N*d*k*i)) + 2*k0^2*z*(1/exp(N*d*k0*i)) + 4*k0^2*z^2*(1/exp(N*d*k0*i)) + 2*k*k0*z*(1/exp(N*d*k*i)) + 2*k*k0*z*(1/exp(N*d*k0*i)))
>> s.r
ans =
-(k^2*(1/exp(N*d*k*i)) - k^2*exp(N*d*k*i) - k0^2*(1/exp(N*d*k*i)) + k0^2*exp(N*d*k*i) + 2*k0^2*z*exp(N*d*k*i) - 2*k0^2*z*(1/exp(N*d*k0*i)) - 2*k*k0*z*exp(N*d*k*i) + 2*k*k0*z*(1/exp(N*d*k0*i)))/(k^2*(1/exp(N*d*k*i)) - k^2*exp(N*d*k*i) + k0^2*(1/exp(N*d*k*i)) - k0^2*exp(N*d*k*i) + 2*k*k0*(1/exp(N*d*k*i)) + 2*k*k0*exp(N*d*k*i) + 2*k0^2*z*(1/exp(N*d*k*i)) + 2*k0^2*z*(1/exp(N*d*k0*i)) + 4*k0^2*z^2*(1/exp(N*d*k0*i)) + 2*k*k0*z*(1/exp(N*d*k*i)) + 2*k*k0*z*(1/exp(N*d*k0*i)))
>> s.t
ans =
(4*k0^2*z^2 + 4*k*k0 + 2*k0^2*z*(1/exp(N*d*k*i))*exp(N*d*k0*i) + 2*k0^2*z*exp(N*d*k*i)*(1/exp(N*d*k0*i)) + 2*k*k0*z*(1/exp(N*d*k*i))*exp(N*d*k0*i) + 2*k*k0*z*exp(N*d*k*i)*(1/exp(N*d*k0*i)))/(4*k0^2*z^2 + 2*k0^2*z + 2*k*k0*z + k^2*(1/exp(N*d*k*i))*exp(N*d*k0*i) - k^2*exp(N*d*k*i)*exp(N*d*k0*i) + k0^2*(1/exp(N*d*k*i))*exp(N*d*k0*i) - k0^2*exp(N*d*k*i)*exp(N*d*k0*i) + 2*k0^2*z*(1/exp(N*d*k*i))*exp(N*d*k0*i) + 2*k*k0*(1/exp(N*d*k*i))*exp(N*d*k0*i) + 2*k*k0*exp(N*d*k*i)*exp(N*d*k0*i) + 2*k*k0*z*(1/exp(N*d*k*i))*exp(N*d*k0*i))