bloch_sph_plot.m

From Spinach Documentation Wiki
Jump to: navigation, search

Bloch sphere plot of a 3D trajectory with linear interpolation between points.

Syntax

    bloch_sph_plot(x,y,z,varargin)

Parameters

    x,y,z     - arrays of equal size containing trajectory data;
                each row is interpreted as one trajectory

    varargin  - additional plotting arguments passed directly
                to Matlab's plot3() function (colour, line style,
                marker style, etc.)

Outputs

    this function produces a figure

Examples

Plot one trajectory on the Bloch sphere:

    t=linspace(0,2*pi,200);
    x=0.8*cos(t); y=0.8*sin(t); z=0.5*cos(2*t);
    bloch_sph_plot(x,y,z,'LineWidth',2);

Plot multiple trajectories (one per row):

    t=linspace(0,2*pi,200);
    x=[cos(t); cos(t+pi/4)];
    y=[sin(t); sin(t+pi/4)];
    z=[0.3*ones(size(t)); -0.3*ones(size(t))];
    bloch_sph_plot(x,y,z,'LineWidth',1.5);

Notes

The function draws a semi-transparent unit sphere as reference and then overlays supplied trajectory/trajectories using plot3(). Figure defaults are reset for Matlab R2025a and later to keep classic figure behaviour.

See also

plot_3d.m, plot_2d.m, plot_1d.m, kgrid.m, axis_1d.m, bwr_cmap.m, crop_2d.m, cylgrid.m, fid2ascii.m, int_2d.m, molplot.m, mri_2d_plot.m, plot_uf.m, s2json.m, scale_figure.m, slice_2d.m, stack_2d.m, volplot.m, write_movie.m, zoom_3d.m, Import,_export,_and_visualisation

Version 2.11, authors: Ilya Kuprov