Simulate Calorie Burn Using Neural Network in Simulink - MATLAB & Simulink (original) (raw)

This example shows how to include a simple fully connected neural network in a Simulink® model that predicts calorie burn when given five time steps of sensor readings from a smart watch.

Many neural networks treat time series data differently from other types of data. For example, long short-term memory (LSTM) networks iterate over the time dimension and update a recurrent state, and 1-D convolutional neural networks convolve over the time dimension. Instead, this example uses a simple fully connected neural network that treats the elements in the time dimension as independent features.

This example uses a fully connected neural network that uses flattened time series data. The model takes sequence data represented by (numTimeSteps*numChannels+1)-by-1 vectors, where numTimeSteps is the number of time steps, numChannels is the number of channels, and the +1 corresponds to the additional input channel that takes the weight of the participant.

calorieNetWorkflow.png

This type of neural network is small and well suited for Simulink models and deployment to target hardware.

Load Pretrained Network

Load the pretrained neural network in the MAT file CalorieNet.mat.

View the neural network architecture using the analyzeNetwork function.

calorieNetAnalysis.png

Open the Simulink model.

The model has these data sources:

The model has these components:

open_system("CalorieNet.slx");

Run Simulation

Run the simulation using the sim function.

The Scope block shows the calorie burn rate over time. To experiment with the Simulink model, adjust the weight and sensor sources and run the simulation again.

See Also

trainnet | trainingOptions | dlnetwork

Topics