How do I use the solve function to solve the following equation
1 次查看(过去 30 天)
显示 更早的评论
Here is my code. My aim is to solve for value beta using the following equations. I have used the solve function. But I get the following error The probem is that the equation fir beta is not being solved
Error using plot
Conversion to double from sym is not possible.
Error in proj (line 23)
plot(neff, lambda);
clc;
clear all;
close all;
lambda=1500;
nm=1e-9;
lambda=lambda*nm;
c=3e8;
w=c./lambda;
width=20: 20:100;
width=width.*nm
ev=1240*nm;
einf=3.7;
wp=9.7*ev;
gamma=.018*ev;
emw=einf-(wp.*wp)./(w.*(w+gamma.*i))
nd=1.46;
ed=nd*nd;
k0=2*pi./lambda;
syms beta
solve(emw.*sqrt(beta*beta-ed.*k0.*k0).*tanh(width.*sqrt(beta*beta-ed.*k0.*k0)./2)+ed.*sqrt(beta*beta-emw.*k0.*k0)==0)
neff = beta./ k0;
plot(w, real(neff));
I cant really figure out what I'm doing wrong. Thank you for the help.
0 个评论
回答(1 个)
Walter Roberson
2013-3-18
You solve() but you do not assign the result to anything. Try
Beta = solve(emw.*sqrt(beta*beta-ed.*k0.*k0).*tanh(w.*sqrt(beta*beta-ed.*k0.*k0)./2)+ed.*sqrt(beta*beta-emw.*k0.*k0)==0, beta);
neff = Beta ./ k0;
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!