Skip to main content

Online MATLAB Editor

Browser workspace

More than an editor

Run matrix scripts and charts locally in your browser. Nothing is uploaded.

  • Execute locally Matrix ops, loops, printed output, and linear solves
  • Live plotting plot, subplot, hold on, legend, histogram, polar & more
  • Built-in examples Linear algebra, signals, stats, ODEs — load from the toolbar
  • Figures & output Zoom bar, Shift+drag pan, download PNG, copy stdout and errors

MATLAB-style editor, not MathWorks MATLAB. Many homework-style scripts work; toolboxes, Simulink, and full desktop compatibility are not supported.

  • Runs on your device
  • Not MathWorks MATLAB
  • plot · subplot · hold on
  • Built-in examples
  • No upload

Completions: Ctrl+Space. Find: Ctrl+F. Format: Ctrl+Shift+B.

Choose editor font size in pixels

Limited in-browser runtime: basic matrices, loops, fprintf/disp, and chart preview. Not MathWorks MATLAB and not full GNU Octave with toolboxes.

figure

Charts from plot(), surf, step(), and similar preview commands appear here. Rendering is an in-browser preview, not desktop MATLAB graphics.

stdout
 

Matrix output and disp() appear here

errors
 

No errors — messages appear here when something fails

Related technologies: Matrix operations, plot/subplot/hold, meshgrid & surf, Statistics & signal plots, Local browser runtime — see also R Editor, Julia Editor, Fortran Editor.

Sketching MATLAB calculations, plots, or matrix notes before running them locally.

Use MATLAB drafts for small experiments: name variables, set a seed when randomness matters, and plot intermediate results before long runs.

Document units in comments. Prefer vectorized steps you can explain over opaque one-liners when sharing with classmates or teammates.

Save figures and numeric outputs with the script version that produced them so results stay reproducible later.

Run heavy jobs locally. This page is for drafting and (on MATLAB mode) limited in-browser trials—not a full desktop toolbox replacement.

Stable link for this mode: /code-editor/matlab

Open this MATLAB editor, paste or type in the Ace buffer, use find/replace and theme/font controls, then download when ready. Theme choices may stick in local storage on this device—it is not a cloud project.

Editing stays in your browser for normal use (no account required). Do not paste production secrets; save important work to your own repo or encrypted store.

Copy a starter into the editor, rename symbols to match your project, then download. These are teaching/review snippets—not a full app scaffold.

Starter snippet

% MATLAB
x = linspace(0, 2*pi, 100);
plot(x, sin(x), 'r-', x, cos(x), 'b--');
legend('sin', 'cos');
grid on;

Matrix ops

% MATLAB
A = [1 2; 3 4];
B = A' * A;
detA = det(A);

Plot

x = linspace(0, 2*pi, 200);
y = sin(x);
plot(x, y); grid on; title('sin');

Common MATLAB patterns for variables, control flow, and comments. Adjust style to your team’s formatter before you commit.

Variables

x = 42; A = zeros(3,3); [X,Y] = meshgrid(-2:0.2:2);

Loops

for k = 1:n ... end  while cond ... end

Comments

% line comment  %{ block comment %}

Vectors & matrices

v = 1:10;
M = rand(3,3);
I = eye(3);

Indexing

sub = M(1:2, 2:3);
M(:,1) = 0;

Functions

function y = sq(x)
  y = x.^2;
end

Line styles

plot(x, y, 'r--');  % red dashed
plot(x, y, 'bo');   % blue circles
hold on; plot(x, z, 'k:');

Subplots

subplot(2,2,1); plot(x, sin(x));
subplot(2,2,2); plot(x, cos(x));
subplot(2,2,3); histogram(rand(1,100));

Surface & heatmap

[X,Y] = meshgrid(-2:0.15:2);
Z = peaks(X,Y);
surf(X,Y,Z); colormap(jet); colorbar;

Transpose & multiply

A = [1 2; 3 4];
B = A' * A;
detA = det(A);

meshgrid

[X, Y] = meshgrid(1:5, 1:3);
Z = X + Y;
disp(Z);

Element-wise ops

x = -2:0.25:2;
y = x.^2 .* exp(-x);

Use the toolbar Examples menu to load runnable scripts, then press Run or Ctrl+Enter (Cmd+Enter on Mac). Everything executes locally in your browser.

Supported areas include linear algebra, statistics (histogram, bar, pie), signal plots (stem, semilogx), matrix visualization (imagesc, contour, surf), and introductory numerical demos (optimization scans, decay models, gradient descent paths).

Frequency response sketch

f = logspace(0, 3, 80);
H = 1 ./ sqrt(1 + (f/200).^2);
semilogx(f, H); grid on;
title('Magnitude');

Polar antenna pattern

theta = linspace(0, 2*pi, 180);
rho = abs(cos(2*theta));
polar(theta, rho); title('Pattern');

Heatmap inspection

Z = peaks(32);
imagesc(Z); colormap(jet); colorbar;
title('Field snapshot');

Vectorized pipeline

% MATLAB: normalize columns
X = rand(100, 3);
mu = mean(X, 1);
sigma = std(X, 0, 1);
Z = (X - mu) ./ sigma;
disp(['mean', mean(Z,1); 'std', std(Z,0,1)]);

Is this the same as desktop MATLAB?
No. This is a free MATLAB-style editor that runs scripts locally in your browser. It works well for basic matrices, loops, printed output, and chart previews. It is not MathWorks MATLAB, does not include toolboxes or Simulink, and will not run every script from a full desktop install.
Why does it say getting ready when I run?
The first time you press Run, the page finishes setting up on your device. That only happens once; the next runs usually start much faster.
Will my script work here?
Many classroom scripts run fine: matrix math, A \ b, for/while/if, fprintf, and common plots. Specialized toolboxes (Control System, Signal Processing, and others), file I/O, and large production scripts may not. If something fails, try a simpler version or use desktop MATLAB/Octave for full compatibility.
What is the chart preview?
When your script uses plot commands, an in-browser preview draws figures in the workspace. These charts are for learning and quick checks—they are not identical to MathWorks or Octave graphics output.
Does tf / step work like the Control System Toolbox?
Only in a simplified preview for basic demos. It is not the MATLAB Control System Toolbox and results may differ from desktop MATLAB.