作业帮 > 综合 > 作业

matlab中如何求解一个变量和另一个变量的关系,例如f(x,y)=0,求y和x的关系

来源:学生作业帮 编辑:灵鹊做题网作业帮 分类:综合作业 时间:2024/05/14 12:15:06
matlab中如何求解一个变量和另一个变量的关系,例如f(x,y)=0,求y和x的关系
syms q0 w0 lamda l f L M1 M2 M3 M q w;
w0=0.015;
lamda=0.000006;
f=10;
M1=[1 l;0 1];
M2=[1 0;-1/f 1];
M3=[1 L;0 1];
M=(M3)*(M2)*(M1);
q0=(i*pi*w0^2)/lamda;
q=(M(1).*q0+M(2))/(M(3).*q0+M(4));
solve('real(1/q)=0','L');
Error using ==> solve
Error,(in fsolve) q is in the equation,and is not solved for
还不不行啊
matlab中如何求解一个变量和另一个变量的关系,例如f(x,y)=0,求y和x的关系
可以用solve函数,例如
solve('x^2+y^2-100=0','y')

ans =

(-x^2+100)^(1/2)
-(-x^2+100)^(1/2)
你这里不应该用引号,改为
solve(real(1/q),L)
不过这个方程没有解析解