> For the complete documentation index, see [llms.txt](https://applied-physics.gitbook.io/warp-factory/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://applied-physics.gitbook.io/warp-factory/examples/analysis/a2-metric-scalars.md).

# A2 - Metric Scalars

## Computing Metric Scalars

### Get Metric

{% code overflow="wrap" lineNumbers="true" %}

```matlab
%% Alcubierre
gridSize = [1 20 20 20];
worldCenter = (gridSize+1)./2;
velocity = 0.5;
R = 5;
sigma = 0.5;
Metric = metricGet_AlcubierreComoving(gridSize,worldCenter,velocity,R,sigma);
```

{% endcode %}

### Get Scalars

{% code lineNumbers="true" %}

```matlab
[expansionScalar, shearScalar, vorticityScalar] = getScalars(Metric);
```

{% endcode %}

### Plot Scalars

{% code overflow="wrap" lineNumbers="true" %}

```matlab
surfq(expansionScalar(1,:,:,10),'EdgeColor','none')
title('Expansion Scalar')

surfq(shearScalar(1,:,:,10),'EdgeColor','none')
title('Shear Scalar')

surfq(vorticityScalar(1,:,:,10),'EdgeColor','none')
title('Vorticity Scalar')
```

{% endcode %}

{% hint style="info" %}
When copying this code to your own script, add `figure()` in between each call to create new figures for each plot.
{% endhint %}
