Skip to content

Demos

Below you find demos of complete analysis workflows in MATLAB. The pages show the code, the console output it produced, and the figures it drew. The source code of these demos is in src/demos.

To run a demo, start MATLAB with src as the working directory and with perceptual_space_geometry on the path (see Installation), then type its name. Demos that ask questions at the console take the default when you press enter, and the answers used for the pages below appear in the captured output.

You can start with rs_read_coorddata_demo_cars to see what a dataset structure contains, then rs_disp_coordsets_demo to plot one.

Reading data

These demos build a dataset structure from coordinate files and show what the fields hold. There are two domains showcased: the "cars" domain, which has no stimulus coordinates, and the "opposites" domain, which has stimulus coordinates, making rays and rings available for display.

Demo What it shows
rs_read_coorddata_demo_cars Read one coordinate file in a domain without stimulus coordinates, and inspect the three parts of the result: coordinates, stimulus metadata, set metadata
rs_read_coorddata_demo_opposites Read three coordinate files in a domain with stimulus coordinates, one at a time or in a single call, and build a dataset from a quadratic form model

Displaying representational spaces

These demos plot one or more datasets and vary the display options. The two domain demos (cars, opposites) continue the reading demos above, and run them first if the data is not already in the workspace.

Demo What it shows
rs_disp_coordsets_demo Plot coordinate sets, with dataset labels from the subject ID, custom label interpreters, and dropped perpendiculars
rs_disp_coordsets_demo_cars Plot an unstructured domain, one figure per model dimension
rs_disp_coordsets_demo_opposites Plot a structured domain: three subjects superimposed, offset, and connected, with rays and rings, before and after alignment
rs_align_disp_coordsets_demo Align several datasets, compute a consensus by rotating each toward the others, and plot the raw data, the components and the consensus together
rs_align_disp_enh_coordsets_demo Enhanced plotting: several plots in one figure, custom subplot arrangements and axis labels, selective point labels, rays, rings and nearest-neighbor connections

Transforming and combining datasets

Demo What it shows
rs_xform_coordsets_demo Specify linear transformations and apply them, alongside the marker, color and symbol options of the display functions
rs_knit_coordsets_demo Knit datasets whose stimuli overlap only partly into one space, with and without a scale factor between datasets, and with shuffle statistics

Fitting geometric models

This family simulates datasets, fits geometric models to them, and displays the fits. Each scenario sets a parameter set, then runs two shared scripts: rs_toygeom_sim builds the simulations and fits the models, and rs_toygeom_disp displays the fits. Their code is shown on each scenario page, where the scenario runs it. Parameters pass through the base workspace, so run each scenario from a clear workspace: a scenario starts with clear for that reason.

Demo What it shows
rs_toygeom_scenarioA Procrustes, affine, projective and piecewise affine models without statistics: which models can be told apart, and which fit data generated by another model
rs_toygeom_scenarioB The same models with statistics for nested model comparisons
rs_toygeom_scenarioC An affine model, with statistics for nesting by output dimension
rs_toygeom_scenarioD An affine model, with statistics for nesting by input dimension