In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article "matlab neural network fitting nonlinear function how to use" most people do not understand, so the editor summarized the following content, detailed, clear steps, with a certain reference value, I hope you can get something after reading this article, let's take a look at this "matlab neural network fitting nonlinear function how to use" article.
%% construct fitting data
For iTunes 114000
Input (iPermine:) = 10*rand (1penny 2)-5
Output (I) = input (iMagne 1) ^ 2+input (iMagazine 2) ^ 2
End
Output=output'
Save data input output
% clear environment variables
Clc
Clear
Tic
%% training data prediction data extraction and normalization
Download input and output data
Load data input output
% randomly sorted from 1 to 2000
K=rand (1JI 4000)
[mmaine n] = sort (k)
% find training data and forecast data
Input_train=input (n (1 3900),:)'
Output_train=output (n (1 3900),:)'
Input_test=input (n (3901 4000),:)'
Output_test=output (n (3901 4000),:)'
% selected sample input and output data normalization
[inputn,inputps] = mapminmax (input_train)
[outputn,outputps] = mapminmax (output_train)
%% BP network training
Initialize network structure
Net=newff (inputn,outputn,5)
Net.trainParam.epochs=100
Net.trainParam.lr=0.1
Net.trainParam.goal=0.0000004
% Network training
Net=train (net,inputn,outputn)
% BP Network Forecast
% prediction data normalization
Inputn_test=mapminmax ('apply',input_test,inputps)
% network forecast output
An=sim (net,inputn_test)
% network output is de-normalized
BPoutput=mapminmax ('reverse',an,outputps)
%% result analysis
Figure (1)
Plot (BPoutput,':og')
Hold on
Plot (output_test,'-*')
Legend ({'predicted output', 'expected output'}, 'fontsize',12)
Title ('BP network prediction output', 'fontsize',12)
Xlabel ('sample', 'fontsize',12)
Ylabel ('output', 'fontsize',12)
Print-dtiff-r600 4-3
% prediction error
Error=BPoutput-output_test
Figure (2)
Plot (error,'-*')
Title ('neural network prediction error')
Figure (3)
Plot ((output_test-BPoutput). / BPoutput,'-*')
Title ('neural network prediction error percentage')
Errorsum=sum (abs (error))
Toc
Save data net inputps outputps
The above is about the content of this article "how to use matlab neural network to fit nonlinear function". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more related knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.