# num – numerisk analys

> Statistisk analys på en numerisk kanal — min/max/medel/standardavvikelse och histogram över många sampel.

_Källa: E-Sharp (esharp.se) · Accordion Shell (CLI)_


## Description

The `num` command performs statistical analysis on numeric channels, capturing multiple samples and computing metrics like mean, min, max, and standard deviation. It can also generate histograms for data visualization.

## Syntax

```bash
num [options]
```

## Optional Options

| Option | Short | Description | Default |
| --- | --- | --- | --- |
| `--channel` | `-c` | The numeric result channel to use | (first available) |
| `--target` | `-t` | The target analog channel to analyze | (required) |
| `--samples` | `-s` | Number of samples to capture | `10` |
| `--bins` | `-b` | Number of histogram bins | `10` |
| `--histogram` | `-h` | Display histogram | `false` |
| `--full` | `-f` | Display full statistical results | `false` |

## Examples

```bash
num --target "VOLTAGE_SENSOR"
num -t "ADC_CH0" -s 10000
num -t "TEMPERATURE" -s 1000 -h -b 20
num -t "CURRENT_SENSE" -s 5000 -f
```

## Output Format

### Basic

```
Samples                        10
Min                            3.2891
Max                            3.3112
Mean                           3.3001
Acquisition Time               45 ms
Acquisition Speed              222 sps
```

### Full Statistics (--full)

Adds Median, Mode, StdDev, Variance, RMS and PeakToPeak.

### Histogram (--histogram)

```
05.2% (3.2891-3.2950) [##                                                ]
45.8% (3.3000-3.3050) [#######################                           ]
28.3% (3.3050-3.3100) [##############                                    ]
```

The histogram divides the data range into equally sized bins; a 50-character bar represents 100 %.

## Performance

| Samples | Typical Time | Speed |
| --- | --- | --- |
| 10 | < 1 ms | 10k+ sps |
| 1,000 | 45–50 ms | 20k sps |
| 10,000 | 450 ms | 22k sps |
| 100,000 | 4.5 s | 22k sps |

Speeds vary by hardware and network latency.

## Notes

- Requires an active connection (use `init` first) and numeric-result-channel support in hardware.
- Start with a small sample count and scale up; use the histogram to visualise noisy signals.

## Error Handling

- **No numeric result channel**: hardware doesn't support this feature
- **Target channel not found / invalid target**: verify the target channel name
- **Timeout**: large sample counts may time out
