⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 err_fuz.m

📁 The neuro-fuzzy software for identification and data analysis has been implemented in the MATLAB lan
💻 M
字号:
function [errors,Jacobian]=err_fuz(inputs,centers,bases,par,bias,output)%ERR_FUZ%%  [errors,Jacobian]=err_fuz(inputs,centers,bases,par,bias,output)%%%	errors[no_data,1]   	%	Jacobian[no_data,2*no_rules*no_var]	Jacobian matrix of the %						derivatives of each error%						to each premise parameter%					%	inputs[no_data,no_var]%	centers[no_rules,no_var]    	centers of the membership functions%	bases[no_rules,no_var]	     	bases   of the membership functions%	par[no_rules,no_par]	     	parameters of the consequents%	bias[1,1]%	output[no_data,1]%                                                                                              %	The following global variable are required:                     %		memb_fun:	'gaussian'/'triangular'                % 		arch:		'weigthed'/'comb'                      %		format_out:	'linear'/'constant'                       %_______________________________________________________October 17 1996___global memb_fun;global arch;global format_out;[no_data,no_var]=size(inputs);[no_rules,no_var]=size(centers);[no_rules,no_par]=size(par);H_temp=zeros(2*no_rules*no_var,2*no_rules*no_var);grad_temp=zeros(2*no_rules*no_var,1);J_temp=0;errors=zeros(no_data,1);Jacobian=zeros(no_data,2*no_rules*no_var);%__________________________________________________________for n=1:no_data						if strcmp(format_out,'linear')		yi=par*[inputs(n,:),1]';		elseif strcmp(format_out,'constant')		yi=par;	end			if strcmp(memb_fun,'gaussian')		distances=ones(no_rules,1)*inputs(n,:)-centers;		wij=exp(-(distances.^2)./bases);		der_wij_centers=2*(distances./bases).*wij;		der_wij_bases=((distances./bases).^2).*wij;		elseif strcmp(memb_fun,'triangular')		distances=ones(no_rules,1)*inputs(n,:)-centers;		wij=max(0,ones(no_rules,no_var)-2*abs(distances./bases));			der_wij_centers=(2*sign(distances)./bases).*(wij>0);		der_wij_bases=(2*abs(distances)./(bases).^2).*(wij>0);	end	if (no_var>1)		wi = prod ( wij')';	else		wi=wij;	end				% wi [no_rules,1]		Sum_w_y= yi'*wi;		% yi [no_rules,1]	Sum_w= sum(wi);	if (Sum_w==0)			Sum_w=1;  	end		if strcmp(arch,'comb')		y=Sum_w_y;		der_y_wi=yi;		elseif strcmp(arch,'weigthed')		y=Sum_w_y / Sum_w;		der_y_wi=(yi*Sum_w - Sum_w_y) / (Sum_w ^2);	end				% der_y_wi[no_rules,1]				%is the derivative of the output				%wrt the degree of match of each rule		errors(n,1)=y+bias-output(n);	der_wi_wij=(wi*ones(1,no_var))./(wij+(wij==0));					% der_wi_wij[no_rules,no_var]	der_wi_centers= der_wi_wij .* der_wij_centers;	der_wi_bases= der_wi_wij .* der_wij_bases;	der_y_centers= (der_y_wi*ones(1,no_var)).* der_wi_centers;	der_y_bases= (der_y_wi *ones(1,no_var)).* der_wi_bases;	Jacobian(n,:)=[der_y_centers(:);der_y_bases(:)]';	end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -