I have an implicit equation where x and y - variables. I want to make a graph, but ezplot function doesn't work. MATLAB writes: log(y/x)-STOI+(x/I_sat)*(y/x-1) cannot be plotted in the xy-plane. Also he offers to use fplot instead of ezplot, but it doesn't work correctly with fplot because, as far as I know, fplot doesn't work with implicit equations. So how can I solve this problem?
Also x should changes from 0 to 25. But I think it isn't a tough problem to solve.

댓글 수: 6

George Bashkatov
George Bashkatov 2020년 12월 25일
Maybe problems with other variables. Some of them are arrays. For example variable "STOI" is an array
Image Analyst
Image Analyst 2020년 12월 25일
We can't run an image -- you'll need to give us the code. In the meantime, try using plot() instead of fplot().
George Bashkatov
George Bashkatov 2020년 12월 25일
편집: Image Analyst 2020년 12월 25일
h_s=0.1; % step for integrals and graphs
n_0=1*10^19; %quantity of atoms
W=0.7; %wide (cm)
H=0.3; %height (cm)
L=0.78; %length (cm)
alpha=5; %absorption coefficient (1/cm)
I_0=0:h_s:25; %pump power (W)
I_s=3.5; %signal intensity (W)
I_in=5; %input power (W)
sigma_a=5*10^(-19); %absorption cross-section (cm^2)
sigma_e=1*10^(-18); %emission cross-section (cm^2)
h=6.62*10^(-27); %Plank's constant (cm^2*g/s)
tau=4*10^(-6); %lifetime of the exited state (s)
lambda_0=1.9*10^-4;%wavelength of the pump (sm)
c=3*10^10; %light velocity (sm/s)
w_s=80*1^-4; %spot radius (sm)
b=I_0*sigma_a*tau*lambda_0/(h*c); %W_p*tau, W_p - pump velocity
I_sat=h*c*tau/(lambda_0*(sigma_e+sigma_a));
STOI=(sigma_e/sigma_a)*(log(1+b)-log(1+b*exp(-alpha*L)));
syms x y;
ezplot('log(y/x)-STOI+(x/I_sat)*(y/x-1)');
Here is the code. When I try to use plot() MATLAB writes: "Invalid first data argument"
Image Analyst
Image Analyst 2020년 12월 25일
편집: Image Analyst 2020년 12월 25일
Sorry, I don't have the symbolic toolbox but it runs up until the syms line just fine. Do you plan on doing anything with any of those variables, like plotting them?
For the final two lines, can you tell us what range you expect x to cover, and what is the y value over that range of x values? How about this for x:
x = linspace(0, 25, length(STOI));
??? Now, what is y? You never define it anywhere.
The error is:
Error using ezplot (line 176)
log(y/x)-STOI+(x/I_sat)*(y/x-1) cannot be plotted in the xy-plane.
however using ezsurf also errors:
Error using ezgraph3>ezfixfun (line 682)
The expression log(y/x)-STOI+(x/I_sat)*(y/x-1) must only have 2 symbolic variables
Nopte that ‘STOI’ is a (1x251) double vector, and ‘I_sat’ is a scalar.
What do you want to do?
I only want to plot the last equation. Other variables are only auxiliary.
"y" here is like a y=f(x). This is an inplicit equation, so I can't make equation like y=f(x) and I have to make and equation like f(x,y)=0.
I think x should cover the same range as I_0, but when I tryed to change x to I_0 it didn't work. The range of I_0 is 0..25.
Now I recognized that x and I_0 are the same variables. I substituted STOI with expression for this variable. After that in this formula I substituted b with expression for variable "b". And in expression for b I substituted the I_0 with x. So I had an expression with only two variables x and y without any vectors. But it also gives the same error.
syms x y;
ezplot('log(y/x)-(sigma_e/sigma_a)*(log(1+x*sigma_a*tau*lambda_0/(h*c))-log(1+(x*sigma_a*tau*lambda_0/(h*c))*exp(-alpha*L)))+(x/I_sat)*(y/x-1)');

댓글을 달려면 로그인하십시오.

 채택된 답변

Mischa Kim
Mischa Kim 2020년 12월 26일

0 개 추천

Hi George, use fimplicit():
syms x y
f(x,y) = log(y/x)-(sigma_e/sigma_a)*(log(1+x*sigma_a*tau*lambda_0/(h*c))-log(1+(x*sigma_a*tau*lambda_0/(h*c))*exp(-alpha*L)))+(x/I_sat)*(y/x-1);
fimplicit(f)
Of course, you would have to assign values to the parameters.

추가 답변 (0개)

카테고리

제품

릴리스

R2020a

질문:

2020년 12월 25일

답변:

2020년 12월 26일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by