Help me with plotting, please.
Show older comments
Here is the code:
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_s=3.5; %signal intensity (W)
P_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 (cm)
c=3*10^10; %light velocity (cm/s)
w_s=80*1^-4; %spot radius (cm)
I_sat=h*c*tau/(lambda_0*(sigma_e+sigma_a));
syms x y
P1=log(y/P_in);
P2=(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)));
P3=(P_in*(pi/2)*w_s/I_sat)*(y/P_in-1);
f(x,y)=P1+P2+P3;
fimplicit(f)
My expression looks like a sum of three parts P1, P2 and P3. fimplicit always draws a straight line like y=P_in. I see, that Mathlab writes that x and y values are "1x1 sym". I think, there is a mistake. My x should changes from 0 to 20 with some step (step doesn't matter). I tryed to write "x=0:0.1:20;" before the expression for f(x,y), but Mathlab wrote: "Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and function body must be sym expression". Also I tryed to write in expression for fimplicit: fimplicit(f [0 20 0 10]) but it only caused a changing of axes, but the graph still looked like a line.
How can I fix this problem? The graph should be a curve, not a straight line
Accepted Answer
More Answers (0)
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!