## Hans on IoTThingSpeak, MATLAB, and the Internet of Things

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# Create and Train a Feedforward Neural Network

Posted by Hans Scharler,

We have published an example in the ThingSpeak documentation that shows you how to train a feedforward neural network to predict temperature. The feedforward neural network is one of the simplest types of artificial networks but has broad applications in IoT. We are collecting data in a ThingSpeak channel and will use the integrated MATLAB analytics.

ThingSpeak channel 12397 contains data from the MathWorks weather station, located in Natick, Massachusetts.

The data is collected once every minute. Fields 2, 3, 4, and 6 contain wind speed (mph), relative humidity, temperature (F), and atmospheric pressure (hg) data respectively. If you want to read the data from the weather station within MATLAB, use the thingSpeakRead function.

data = thingSpeakRead(12397,'Fields',[2 3 4 6],'DateRange',[datetime('Sep 7, 2016'),datetime('Sep 9, 2016')],...
'outputFormat','table');


To predict the temperature, this example makes use of the Neural Network Toolbox along with the data collected in a ThingSpeak channel. This example can be adapted to other IoT applications. Check out the ThingSpeak documentation for the code and explanation.