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

📄 generadatos.m

📁 Diversos ejemplos sobre la aplicacion de algoritmos geneticos.
💻 M
字号:
function [orig,w]= generadatos(K2,m)% K2: number of data;% m; slope of the lineglobal K1 K2% se generan datos linealmente separablesclf[orig,slope]=datasepf(K2,m);   % slope is the slope of separating plane% that has the formula:  y = slope*x + 0.5*(1-slope)[Km,Kn]=size(orig);M=Kn-1;  % number of inputsK0=sum([orig(:,Kn)==-1]);  K1=Km-K0;  K2=K0+K1;% # of targets = 0 and 1 % slope is the slope of separating plane% that has the formula:  y = slope*x + 0.5*(1-slope)% g(x) = 0.5(1-m)+mx-y=w(1) + w(2)*x + w(3)*y w = [0.5*(1-slope) slope -1];figure(1)subplot(1,2,2),plot(orig(1:K1,1),orig(1:K1,2),'*',orig(K1+1:K2,1),orig(K1+1:K2,2),'o')axis('square');gridv=axis;[lx,ly]=sline(w,v);subplot(1,2,1),plot(orig(1:K1,1),orig(1:K1,2),'*',...    orig(K1+1:K2,1),orig(K1+1:K2,2),'o',lx,ly)axis('square');gridtitle('separating hyperplane')orig = orig';% w = [slope -1 0.5*(1-slope)]';w = w';

⌨️ 快捷键说明

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