Hello Mohamad,
To predict pipe attributes, roughness and diameter, using demand and pressure as inputs, follow these steps:
- Define the input data as illustrated in the code snippet below.
demands = [4 5 6; 5 5 8; 8 9 2; 8 9 6];
pressures = [0 1; 5 1; 7 2; 5 1];
inputData = [demands pressures];
- Define the target data as shown in the subsequent code snippet.
roughness = repmat([8 9 5 8 1], 4, 1);
diameter = repmat([7 7 7 0 4], 4, 1);
targetData = [roughness diameter];
- Set up and train a 'feedforwardnet' neural network with 10 hidden neurons.
net = feedforwardnet(10);
net = configure(net, inputData', targetData');
[net, tr] = train(net, inputData', targetData');
After training the model, the following code snippet can be used to predict the pipe attributes:
newDemands = [5 5 5];
newPressures = [1 2];
newInput = [newDemands newPressures];
predictedAttributes = net(newInput');
