# Project: Improving Optimal Control and Estimation Methods Adapted to the Noise Characteristics of the Sensorimotor System

#note: all of the code has been written using Julia v1.8.5

## Functions to Run the Scripts
All the functions needed to run the scripts are located in the folder "MyFunctions".

## Scripts to Generate the Data

### One-Dimensional Problem
The scripts to produce the data for the one-dimensional problem (Section 4.1) are located in the folder "1D_simulations":
- **1D_problem_optimal_solutions_changing_internal_noise.jl**: Produces the data used for Figs. 2, 3, 6, 8, 9.
- **1D_problem_fixing_L_and_K.jl**: Produces the data used for Fig. 5 (Appendix).
- **1D_problem_test_algorithms.jl**: Can be used to experiment with different algorithms.

### Multi-Dimensional Problem
The scripts to produce the data for the multi-dimensional problems (Sections 4.2 and A.5.6) are located in the folder "Multi_D_simulations":
- **Folder "sensory_motor_task"**: The script "sensory_motor_task.jl" produces the data for Fig. 4.
- **Folder "LQG_with_internal_noise"**: The script "LQG_internal_noise_Iterative_GD.jl" produces the data for Fig. 10 (Appendix).

## Scripts to Generate the Plots

### One-Dimensional Problem
The scripts to reproduce all the figures for the one-dimensional problem (Sections 4.1, A.5.2, and A.5.3) are located in the folder "1D_Plots":
- **plots_1D_problem.jl**: Produces all the subplots for Figs. 2, 3, 6, 8, 9.
- **plots_fixing_K_and_L.jl**: Produces Fig. 5.

### Multi-Dimensional Problem
The scripts to reproduce all the figures for the multi-dimensional problem (Sections 4.2 and A.5.6) are located in the folder "Multi_D_Plots":
- **plots_sensory_motor_task.jl**: Produces all the subplots for Fig. 4.
- **plots_LQG_with_internal_noise.jl**: Produces all the subplots for Fig. 10.

In each of the aforementioned folders, the figures can be found in the subfolders "Figures", "Figures_sensory_motor_task", and "Figures_LQG_with_internal_noise".

## Data
The data used to generate the plots can be found in the folder "Data":

### One-Dimensional Problem
- **1D_problem_changing_internal_noise**: Contains the data for Figs. 2, 3, 6, 8, 9 ("jld2" files).
- **1D_problem_fixing_L_and_K**: Contains the data for Fig. 4 ("jld" files).

### Multi-Dimensional Problem
- **Multi_D_problems**: 
  - **sensory_motor_task**: Contains the data for Fig. 4 ("jld" files).
  - **LQG_with_internal_noise**: Contains the data for Fig. 10 ("jld" files).

Note that the scripts in the folders "1D_simulations" and "Multi_D_simulations" do not overwrite the existing data; new data will be stored in subfolders called "New_Data".
