| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 831 人关注过本帖
标题:请教C#调用BP网络工具箱函数实现问题
只看楼主 加入收藏
HDWOXF
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2010-4-11
结帖率:100%
收藏
 问题点数:0 回复次数:0 
请教C#调用BP网络工具箱函数实现问题
请教C#调用BP网络工具箱问题
我想请教下怎么在C#中实现调用MATLAB中的神经网络工具箱。
我用神经网络工具箱做了个预测,就是两个输入一个输出的问题,但是因为不是输入Y=(输入X1,输入X2)的函数形式,所以做成.DLL格式后,在C#中不能调用。
我的想法是怎么把神经网络工具箱做成输入Y=(输入X1,输入X2)的函数形式,编译为.dll后,作为.dll的一个方法,在C#中调用。
关键是不知道怎么把神经网络工具箱的预测模型写成输入Y=(输入X1,输入X2)的函数形式!
具体预测程序如下:
 P1 = [4400,3130,4600,5330,1845,7098,993,403,10700,18520,18500,18380,8880,8880,15330,13767,16050,15197,14644,9180,7230,3200,2150,2595,11110,11110,8640,8640,2200,710,15800,13500,18130,10000,4500,7850,7850,4500,4500,6210,12486,1275,15800,13500,10000,18130,12890,12890,14360,10412,11414,11160,15240,9500,9500,18250,18250,9500,9500,10700,10700,7500,7500,5500,5500,14580,18500,18500,1475,1475,1475,12486,12486,12486,18130,13118,1000,12100,1000,13118,8900,14635,1275,15465,15465,15465,15465,15465,15465,15465,15465,15465,17000,17000,15465,15465,17000,17000,15465,12356,12356,12356,12356,15465,15465,15465,15465,15465,15465,15465,15465,15465,15465,15465,17000,17000,15465,15465,17000,17000,15465,12356,12356,12356,12356];
 P2 = [6000,6000,6000,6000,6000,6000,3000,3000,6000,4700,1500,1900,6000,6000,4000,5000,1500,2000,800,3000,530,5000,5000,5000,6000,6000,6000,6000,5500,5500,4800,6000,2200,1000,6000,6000,6000,6000,6000,6000,4000,6000,4800,6000,1000,2200,1500,1500,1500,1500,3000,2000,2000,1800,1800,4500,4500,5000,5000,6000,6000,6000,6000,6000,6000,1200,1400,3500,6000,6000,6000,4000,4000,4000,2200,2500,6000,6000,6000,2500,6000,3000,6000,2800,2800,3100,3100,2800,3100,2800,3100,1400,3500,3500,1400,1400,3500,3500,1400,800,800,800,800,2800,2800,2800,3100,3100,2800,2800,3100,3100,2800,1400,3500,3500,1400,1400,3500,3500,1400,800,800,800,800];
 P=[P1;P2];
 T=[4397.342,1987.275,1903.583,4364.317,1805.125,5086.133,1389.5,522.425,8239.375,15682.36,15702.76,16806.28,9999.8,9971.175,8537.792,9519.55,9211.892,9372.417,5462.525,5532.308,6870.108,7578.85,1977.55,1785.708,9167.367,9015.642,2038.142,2018.1,1583.9,636.1083,14000.61,10652.69,10825.53,7268.283,1259.917,5582.942,5485.717,1225.358,6035.833,10645.02,9553.142,1311.95,14417.83,10844.77,7513.958,10833.45,3966.142,7037.273,8452.733,7653.925,6560.967,6869.492,10635.43,12772.17,12915.63,17021.56,16620.76,13419.53,13382.63,9994.458,10039.37,6133.125,5960.5,1190.733,1197.7133,11686.59,17087.02,15534.28,1202,1162.517,1187.275,9213.658,9042.092,9195.792,13868.75,7788.708,718.1667,11996.72,742.81667,8261.4417,7205.8917,11217,1293.4167,9946.3364,10241.342,9938.583,10340.642,10266.675,10448.025,9999.525,10234.708,9734.975,10307.736,10477.875,10001.233,9733.725,10406.442,10777.55,9781.2417,6272.4167,6268.2167,6351.6333,6233.075,9893.6583,9717.3917,10360.44167,10043.80833,10388.075,10112.35,10360.50833,10459.66667,10591.45,10505.80833,9995.525,10595.525,10674.05,9770.790909,9683.5,10320.5,10726.51667,9860.908333,6430,6437.525,6469.408333,6208.775];
%  T=[34.24417,31.5075,31.32417,34.19167,31.7475,35.55167,19.3825,17.38667,39.06833,44.47667,43.98167,45.87417,41.83667,41.88833,34.47,38.48167,32.12083,33.07,25.5925,27.5975,28.27583,36.26833,28.80417,28.435,41.19417,41.045,33.08167,33.015,30.51333,29.30583,42.96917,42.2775,34.84833,29.67,32.01667,37.3175,37.2525,32.24083,37.83917,42.95667,36.15917,32.33667,44.04083,42.9525,30.48583,35.21667,21.70333,28.24333,30.96333,29.24833,29.4875,28.68583,35.20667,38.6525,38.9675,47.14583,46.73167,43.49833,43.44083,42.34,42.33833,38.00583,37.81083,32.29583,32.34083,37.88917,46.72583,43.69417,29.89417,29.91583,30.02917,33.95167,33.83167,34.00417,38.5775,29.53833,30.21,42.8667,30.83583,30.7125,38.36833,36.38917,31.56167,33.85,34.30583,34.4275,35.06167,34.4175,35.22,34.0925,35.03417,33.2125,35.5,35.77833,33.93333,33.25417,35.735,36.25583,33.39,27.1725,27.16167,27.355,27.08583,33.5417,33.36583,34.6075,34.76667,35.26,34.42667,34.84417,35.55333,35.75167,35.10417,34.19,36.11333,36.25083,33.71833,33.32667,35.74083,36.3075,33.8825,27.67417,27.66583,27.76833,27.1275];
% 剔除异常数据
  e = ones(2,1);
  vale = mean(P);
  stanl = std(P);
  outli = abs(P - e*vale)>3*e*stanl;
  P(any(outli'),:) = [];
%对原始数据进行规范化处理
[pn,meanp,stdp,tn,meant,stdt]=prestd(P,T);
% 对PN主成分进行分析
 [ptrans,transMat] = prepca(pn,0.01);
%建立相应的BP网络
net = newff(minmax(pn),[7,1],{'tansig' 'purelin' },'traingdx');
%训练网络
net.trainParam.epochs = 1200;
net.trainParam.goal = 0.0005;
net = train(net,pn,tn);
%对训练后的网络进行仿真
an = sim(net,pn);
a = poststd(an,meant,stdt);
save Q.mat
那么怎么把他弄成输入Y=(输入X1,输入X2)的函数形式!的形式调用呢?
比如说我要给两个输入变量,得到一个输出Y!
搜索更多相关主题的帖子: 工具箱 网络 函数 
2010-04-13 20:56
快速回复:请教C#调用BP网络工具箱函数实现问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028179 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved