MATLAB Scientific Academy
INTERMEDIATE · 20 min

Visualize scientific data

Turn numerical arrays into clear plots that communicate trends, compare conditions and reveal patterns in measurements.

What you will learn

  • Label axes with meaningful units.
  • Plot multiple data series and add a legend.
  • Distinguish measured data from model predictions.

The concept

A scientific figure should answer a question. Choose a plot type suited to the data, label axes with units, show relevant uncertainty when known, and avoid decorative effects that obscure the measurement.

MATLAB supports line plots, scatter plots, histograms, images, contour plots and 3D surfaces. Use hold on to add series to an axes and legend to explain them.

Scientific habit: Before running a program, predict what it will do. Then compare your prediction with the output and explain any difference.

Worked example

Plot a noisy measurement alongside the underlying model.

example.mMATLAB CODE
t = linspace(0, 1, 250);
truth = exp(-2*t).*sin(2*pi*8*t);
measurement = truth + 0.08*randn(size(t));
plot(t, measurement, '.', 'DisplayName', 'Measured');
hold on;
plot(t, truth, 'LineWidth', 2, 'DisplayName', 'Model');
xlabel('Time (s)'); ylabel('Amplitude (a.u.)');
legend('Location', 'best'); grid on;

The random noise makes each run slightly different. For repeatable demonstrations, set a random seed with rng(1).

Try it yourself

Consider what the viewer needs to interpret the plot.

Quick check

Why should a scientific graph label its axes with units?

Reveal hint and answer
Hint: A number without a unit may be physically ambiguous.
Answer: Units make measurements interpretable and help prevent incorrect comparisons.

Where this is used

Visualization is central to spectroscopy, time-series analysis, optical imaging, sensor validation and publication-quality figures.

Academy homeNext: Computational physics