# LogLog Plot is Blank

8 views (last 30 days)
John on 26 Feb 2023
Commented: Star Strider on 26 Feb 2023
I am unable to plot anything on a loglog plot with this code:
%Paschen Curve Plotting for H2
p = 1.2; %Torr
d = 20; %cm
GamSE = 1;
%Constants
A = 4.8;
B = 136;
dM = 20*0.01; %Convert units to m
%For Graphing
NumG = B.*x;
DenG = log(A.*x) - log(log(1 + 1/GamSE));
y = (B.*x)/((log(A.*x) - log(log(1 + 1/GamSE)))*dM);
x = logspace(-1,4,50);
loglog(x,y)
hold on
grid on
xlabel('p*d (Torr-cm)')
ylabel('Eb (V/m)')
hold off
It's just blank. I have tried modfiying the limit of the logspace call since the equation should exponetially grow for x < 1 and this still didn't fix it. What am doing incorrectly here?
Stephen23 on 26 Feb 2023

Star Strider on 26 Feb 2023
Use element-wise division:
y = (B.*x)/((log(A.*x) - log(log(1 + 1/GamSE)))*dM);
↑ ← HERE
and it works!
%Paschen Curve Plotting for H2
p = 1.2; %Torr
d = 20; %cm
GamSE = 1;
%Constants
A = 4.8;
B = 136;
dM = 20*0.01; %Convert units to m
x = logspace(-1,4,50);
%For Graphing
NumG = B.*x;
DenG = log(A.*x) - log(log(1 + 1/GamSE));
y = (B.*x)./((log(A.*x) - log(log(1 + 1/GamSE)))*dM);
loglog(x,y)
hold on
grid on
xlabel('p*d (Torr-cm)')
ylabel('Eb (V/m)')
hold off Warning: Negative data ignored
Wioth matrix division ratther than array division, ‘y’ is a scalar. Scalars only plot with markers, since a lline has to be defined by at least two (x,y) pairs.
Forgetting do to element-wise division is probably the most common problem I see here.
.
##### 2 CommentsShow 1 older commentHide 1 older comment
Star Strider on 26 Feb 2023
As always, my pleasure!

Alan Stevens on 26 Feb 2023
Like this? (I've assumed you want log base 10 everywhere):
%Paschen Curve Plotting for H2
p = 1.2; %Torr
d = 20; %cm
GamSE = 1;
%Constants
A = 4.8;
B = 136;
dM = 20*0.01; %Convert units to m
%For Graphing
x = logspace(-1,4,50);
NumG = B.*x;
DenG = log10(A.*x) - log10(log10(1 + 1/GamSE));
y = (B.*x)./((log10(A.*x) - log10(log10(1 + 1/GamSE)))*dM); % dot divide
loglog(x,y)
hold on
grid on
xlabel('p*d (Torr-cm)')
ylabel('Eb (V/m)')
hold off John on 26 Feb 2023
Thank you for the answer @Alan Stevens! Wish I could accept more than one answer.

### Categories

Find more on Surface and Mesh Plots in Help Center and File Exchange

R2020b

### Community Treasure Hunt

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

Start Hunting!