# MATLAB Codes for L1 Control Theoretic Smoothing Splines

## Introduction

This page gives a MATLAB code for our paper:
M. Nagahara and C. F. Martin,

L1 Control Theoretic Smoothing Splines,

submitted to *IEEE Signal Processing Letters*.

## MATLAB Codes

**Demo file that produces the figures in the paper:**

demo.m

**MATLAB function for L1 control theoretic splines**

L1cts_coef.m

**Gramian data file**

GHdata.mat

This file gives gramian matrix G and intial condition matrix H
for the optimization.

Since the computation of these matrix needs quite a lot of time,
so one can use this file to reduce computational time.
**
Note that to execute the codes, you need
Control System Toolbox
and
CVX.
**

We have made sure that the code run with no errors on MATLAB **version R2012b**.

On older versions of MATLAB, the code might have unexpected errors.

## Usage

**[theta,x,G,H] = L1cts_coef(P,Ds,lambda,W,p)**

or

**[theta,x,G,H] = L1cts_coef(P,Ds,lambda,W,p,initial_state,G,H,q)**

computes the optimal coefficients of the control theoretic smoothing
splines that minimizes L1-Lp cost function

Jp = lambda*||theta||_1 + ||W(G*theta-y)||_p^p

**Inputs**

**P**

:

dynamical system (SS or TF object).

**Ds**

:

data set; **Ds = [T,Y]**

where **T**

is a column vector of sampling
instants, and **Y**

is a column vector of observed data.

**lambda**

:

regularization parameter (>0)

**W**

:

wight matrix for empirical risk.

**p**

:

norm index for empirical risk (p = 1 or 2)

**initial_state**

:

if this value is not 0, then the initial state of P becomes also a design variable.
default = 0;

**G**

(optional):

Gramian matrix for computation. default = [];

**H**

(optional):

Initial state matrix for computation. default = [];

**q**

(optional):

if q = 2 then this function computes

min lambda*||theta||_2^2 + ||W(G*theta-y)||

that is, the L2 optimal control theoretic spline. default = 1;

**Outputs**

**theta**

:

the optimal coefficient vector

**x**

:

the optimal initial state

**G**

:

Gramian matrix

**H**

:

Initial state matrix