function varargout = caishuzi(varargin) %CAISHUZI M-file for caishuzi.fig % CAISHUZI, by itself, creates a new CAISHUZI or raises the existing % singleton*. % % H = CAISHUZI returns the handle to a new CAISHUZI or the handle to % the existing single
基于神经网络技术 function main % This is a FNN trained by PSO and BP. After trained by PSO, the NN is trained by BP clc; clear all; MaxRunningTime=10; MaxHiddenLayerNode=10; %根据目标函数获得样本输入输出 rand('state',sum(100*clock));
huffman压缩编码 function CODE =huffman(p) error(nargchk(1,1,nargin)); if (ndims(p)~=2) ||(min(size(p))>1)||~isreal(p)||~isnumeric(p) error('P must be a real numeric vector.'); end global CODE CODE=cell(length(p),1); if length(p)>1 p=p/sum(p); s=re
1、编写两段简短的代码,演示MATLAB脚本和函数的不同。 (1) x = 8; (2) function a=f(s) x=s^2; 2、编写程序演示循环(for、while)、分支(if-else-end、switch-case)和异常处理(try-catch)控制结构的用法,并尽量体现各种关系运算符(==、~=、、=)的用法。 (1) for循环 sum = 0; for i = 1:50 sum = sum + i;