RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

RunMat™ is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

LicensePrivacy
/
See all docs
Builtin Reference
    • addpoints
    • ancestor
    • animatedline
    • area
    • axes
    • axis
    • bar
    • barh
    • box
    • caxis
    • cla
    • clf
    • clim
    • colorbar
    • colorcube
    • colormap
    • colororder
    • contour
    • contour3
    • contourf
    • copyobj
    • daspect
    • datacursormode
    • dataTipTextRow
    • errorbar
    • fcontour
    • figure
    • fill
    • fill3
    • findobj
    • fsurf
    • gca
    • gcf
    • get
    • gobjects
    • grid
    • groot
    • heatmap
    • hgload
    • hgsave
    • hidden
    • hist
    • histogram
    • histogram2
    • hold
    • image
    • imagesc
    • imshow
    • legend
    • line
    • linkaxes
    • loglog
    • mesh
    • meshc
    • openfig
    • opengl
    • pan
    • parula
    • patch
    • pie
    • plot
    • plot3
    • plotmatrix
    • plotyy
    • polarhistogram
    • polarplot
    • polarscatter
    • print
    • quiver
    • quiver3
    • ribbon
    • saveas
    • savefig
    • scatter
    • scatter3
    • semilogx
    • semilogy
    • set
    • sgtitle
    • shading
    • sphere
    • stackedplot
    • stairs
    • stem
    • subplot
    • subtitle
    • suptitle
    • surf
    • surfc
    • text
    • textscatter
    • textscatter3
    • title
    • triplot
    • view
    • waitbar
    • wordcloud
    • xlabel
    • xlim
    • xline
    • xscale
    • xtickangle
    • xtickformat
    • xticklabels
    • xticks
    • ylabel
    • ylim
    • yline
    • yscale
    • ytickangle
    • ytickformat
    • yticklabels
    • yticks
    • zlabel
    • zlim
    • zoom

semilogx — Plot data with a logarithmic x-axis using MATLAB-compatible semilogx call patterns.

semilogx creates line plots like plot and configures the active axes to logarithmic scaling on X. It follows MATLAB-compatible argument forms, axes targeting, and handle behavior.

Syntax

h = semilogx(Y)
h = semilogx(X, Y)
h = semilogx(args...)

Inputs

NameTypeRequiredDefaultDescription
YNumericArrayYes—Y data vector/matrix.
XNumericArrayYes—X data vector/matrix.
argsAnyVariadic—Plot-style inputs: optional axes handle, style tokens, and Name/Value pairs.

Returns

NameTypeDescription
hNumericScalarLine handle.

Errors

IdentifierWhenMessage
RunMat:semilogx:PlotFailedUnderlying plot rendering/parsing fails while building the semilog plot.semilogx: plot operation failed
RunMat:semilogx:LogAxisFailedApplying logarithmic X-axis mode fails.semilogx: failed to apply logarithmic axis mode

How semilogx works

  • The builtin returns the same kind of numeric line handle as plot.
  • Only the x-axis is switched to log scale; the y-axis remains linear.
  • Axes log-mode state is subplot-local, so semilogx on one subplot does not force every axes in the figure into log mode.
  • Positive x-values are the meaningful domain for a logarithmic axis, even though the plotted line object still preserves the original data handle semantics.

Examples

Plot a frequency response with a logarithmic x-axis

f = logspace(0, 4, 200);
mag = 1 ./ sqrt(1 + (f / 200).^2);
semilogx(f, mag);

Compare two responses on the same semilog x-axis

f = logspace(0, 4, 200);
h1 = semilogx(f, 1 ./ sqrt(1 + (f / 200).^2));
set(h1, 'DisplayName', 'low-pass');
hold on;
h2 = semilogx(f, (f / 200) ./ sqrt(1 + (f / 200).^2));
set(h2, 'DisplayName', 'high-pass');
legend;

Verify the x-axis scale through handle/property workflows

f = logspace(1, 3, 50);
semilogx(f, log10(f));
ax = gca;
get(ax, 'XScale')

Expected output:

ans =
    'log'

Rendered semilogx example

frequency = logspace(0, 5, 400);
cutoff = 750;
gain_db = 20*log10(1 ./ sqrt(1 + (frequency/cutoff).^4));

h = semilogx(frequency, gain_db);
set(h, 'LineWidth', 2);
title('Low-Pass Frequency Response');
xlabel('Frequency (Hz)');
ylabel('Gain (dB)');
grid on;
Expected output:
Low-pass frequency response rendered with a logarithmic MATLAB x-axis in RunMat

Compare this result with other chart types in the MATLAB Plot Gallery.

Using semilogx with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how semilogx changes the result.

Run a small semilogx example, explain the result, then change one input and compare the output.

FAQ

When should I use semilogx instead of plot?⌄

Use semilogx when your x-data spans several orders of magnitude and you care about relative differences across that range. Frequency response curves (Bode magnitude plots) are the classic example — frequencies from 1 Hz to 100 kHz are unreadable on a linear axis but spread evenly on a log scale.

How is semilogx different from calling plot and then switching the x-axis to log?⌄

Functionally identical. semilogx(x, y) is shorthand for plot(x, y) followed by set(gca, 'XScale', 'log'). The convenience form just does both in one call and makes intent clearer when reading code.

What happens if my x-data contains zero or negative values?⌄

Logarithmic axes only render positive values. Zero and negative x-values are silently excluded from the rendered line — the data handle still holds them, but they won't appear on the plot. Filter your data to the positive domain if you need a continuous curve.

Related Plotting functions

2D Charts

area · bar · errorbar · heatmap · hist · histogram · loglog · pie · plot · scatter · semilogy · stairs · stem

3D & Surface

contour · contour3 · contourf · mesh · meshc · plot3 · quiver · scatter3 · surf · surfc

Images

image · imagesc · imshow

Axes & Layout

axis · box · grid · sgtitle · subplot · title · view · zlabel

Appearance

colorbar · colormap · legend · shading

Handle Access

gca · gcf · get · set

Other

addpoints · ancestor · animatedline · axes · barh · caxis · cla · clf · clim · colorcube · colororder · copyobj · daspect · datacursormode · dataTipTextRow · fcontour · figure · fill · fill3 · findobj · fsurf · gobjects · groot · hgload · hgsave · hidden · histogram2 · hold · line · linkaxes · openfig · opengl · pan · parula · patch · plotmatrix · plotyy · polarhistogram · polarplot · polarscatter · print · quiver3 · ribbon · saveas · savefig · sphere · stackedplot · subtitle · suptitle · text · textscatter · textscatter3 · triplot · waitbar · wordcloud · xlabel · xlim · xline · xscale · xtickangle · xtickformat · xticklabels · xticks · ylabel · ylim · yline · yscale · ytickangle · ytickformat · yticklabels · yticks · zlim · zoom

More plotting resources

  • Choosing the right plot type
  • Styling plots and axes
  • Plot replay and export
  • Complete plotting guide

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how semilogx is executed, line by line, in Rust.

  • View the source for semilogx in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • How semilogx works
  • Examples
  • Plot a frequency response with a logarithmic x-axis
  • Compare two responses on the same semilog x-axis
  • Verify the x-axis scale through handle/property workflows
  • Rendered semilogx example
  • Using semilogx with coding agents
  • FAQ
  • Related Plotting functions
  • 2D Charts
  • 3D & Surface
  • Images
  • Axes & Layout
  • Appearance
  • Handle Access
  • Other
  • More plotting resources
  • Open-source implementation
  • About RunMat