Proficient VC and MATLAB Joint programming < 10 >--Synthesis example Two

Source: Internet
Author: User

Tools used in this article: vc6.0+matlab6.5

In this chapter is achieved in the VC call Matlab Neural Network Toolbox, the article used in the program is a master's thesis part, so did not provide source program, the purpose is through this example to introduce how to use the VC COM components to achieve VC and MATLAB data exchange. First in the MATLAB to complete two neural network functions, one to test, one to predict.

1. Check function:

function [w1,b1,w2,b2,ET,a2]=SJHSJY(P,T,me,eg,lr,P2,T2,S1)
[Pn,meanp,stdp,Tn,meant,stdt]=prestd(P,T);  %预处理
[w1,b1,w2,b2]=initff(Pn,S1,''tansig'',Tn,''purelin''); %数据初始化
df=10;
tp=[df me eg lr];
[w1,b1,w2,b2,tp,tr]=trainbpx(w1,b1,''tansig''); %样本训练
P2n=trastd(P2,meanp,stdp);
......后处理  %必须为非负

This function is the test error of BP neural network, the P,T,ME,EG,LR,P2,T2,S1 is the input parameter; W1,B1,W2,B2,ET,A2 is the output parameter.

2. Predictive function:

function [a2]=SJHSYC(P,T,P2,me,eg,lr,S1)
[Pn,meanp,stdp,Tn,meant,stdt]=prestd(P,T);
[w1,b1,w2,b2]=initff(Pn,S1,''tansig'',Tn,''purelin'');
........
参数输出

P,T,ME,EG,LR,P2,T2,S1 for the input parameter A2 as an output parameter, which is the desired result

3, in the MATLAB in the two functions into COM components, specific methods can refer to VC and MATLAB joint programming < three >.

4, the new VC based on the Dialogue box project, the introduction of COM components in VC, specific methods can be referred to VC and MATLAB joint programming < Three, after the completion of the ClassView can see more than two new classes Isjhsjy and ISJHSYC, as shown in Figure 1, They implement functions sjhsjy.m and SJHSYC.M respectively.

Figure 1

Look closely at the parameters of the class Isjhsjy, as shown in Figure 2

Figure 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.