runmat-runtime 0.4.5

Core runtime for RunMat with builtins, BLAS/LAPACK integration, and execution APIs
Documentation
{
  "title": "semilogx",
  "category": "plotting",
  "keywords": [
    "semilogx",
    "logarithmic x-axis",
    "semilog plot",
    "matlab semilogx",
    "response curve"
  ],
  "summary": "Plot data with a logarithmic x-axis for response curves, scaling analysis, and MATLAB `semilogx` workflows.",
  "gpu_support": {
    "elementwise": false,
    "reduction": false,
    "precisions": [
      "single",
      "double"
    ],
    "broadcasting": "none",
    "notes": "`semilogx` uses the shared `plot` rendering path and then marks the active axes as logarithmic on X."
  },
  "fusion": {
    "elementwise": false,
    "reduction": false,
    "max_inputs": 2,
    "constants": "inline"
  },
  "requires_feature": null,
  "tested": {
    "unit": "builtins::plotting::semilogx::tests"
  },
  "description": "`semilogx` creates the same line objects as `plot`, but configures the current axes to use a logarithmic x-axis. That makes it useful for response curves, magnitude plots, and data that spans orders of magnitude along X while still using familiar MATLAB `semilogx` call forms.",
  "behaviors": [
    "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": [
    {
      "description": "Plot a frequency response with a logarithmic x-axis",
      "input": "f = logspace(0, 4, 200);\nmag = 1 ./ sqrt(1 + (f / 200).^2);\nsemilogx(f, mag);"
    },
    {
      "description": "Compare two responses on the same semilog x-axis",
      "input": "f = logspace(0, 4, 200);\nh1 = semilogx(f, 1 ./ sqrt(1 + (f / 200).^2));\nset(h1, 'DisplayName', 'low-pass');\nhold on;\nh2 = semilogx(f, (f / 200) ./ sqrt(1 + (f / 200).^2));\nset(h2, 'DisplayName', 'high-pass');\nlegend;"
    },
    {
      "description": "Verify the x-axis scale through handle/property workflows",
      "input": "f = logspace(1, 3, 50);\nsemilogx(f, log10(f));\nax = gca;\nget(ax, 'XScale')",
      "output": "ans =\n    'log'"
    }
  ],
  "faqs": [
    {
      "question": "When should I use semilogx instead of plot?",
      "answer": "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."
    },
    {
      "question": "How is semilogx different from calling plot and then switching the x-axis to log?",
      "answer": "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."
    },
    {
      "question": "What happens if my x-data contains zero or negative values?",
      "answer": "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."
    }
  ],
  "links": [
    {
      "label": "plot",
      "url": "./plot"
    },
    {
      "label": "semilogy",
      "url": "./semilogy"
    },
    {
      "label": "loglog",
      "url": "./loglog"
    },
    {
      "label": "axis",
      "url": "./axis"
    },
    {
      "label": "Choosing the right plot type",
      "url": "/docs/plotting/choosing-the-right-plot-type"
    },
    {
      "label": "Styling plots and axes",
      "url": "/docs/plotting/styling-plots-and-axes"
    },
    {
      "label": "Plot replay and export",
      "url": "/docs/plotting/plot-replay-and-export"
    },
    {
      "label": "Complete plotting guide",
      "url": "/blog/matlab-plotting-guide"
    }
  ],
  "source": {
    "label": "`crates/runmat-runtime/src/builtins/plotting/ops/semilogx.rs`",
    "url": "https://github.com/runmat-org/runmat/blob/main/crates/runmat-runtime/src/builtins/plotting/ops/semilogx.rs"
  }
}