资源简介
势函数的matlab实现
代码片段和文件信息
clc
clear all
start = [00;
01;
10;
11];
w = [1122];
Nc = 0;
r = [];
G = 0;
k = 1;
N = 4;
m = 1;
n = 0;
while(Nc < 4 )
r(1) = 0;
if ( w(m) == 1) %属于第一类
if (G > 0)
Nc = Nc + 1;
r(k+1) = 0;
end
if ( G <= 0)
r ( k+1 ) = 1;
Nc = 0;
end
end
if (w(m) == 2)
if (G < 0)
r(k+1) = 0;
Nc = Nc + 1;
end
if ( G >= 0)
r(k+1) = -1;
Nc = 0;
end
end
k = k+1;
m = mod(k-1N) + 1;
G = 0;
for i=1:k
n = mod(i-1N) + 1;
G = G + r(i)*KA( start(m 1)start(n1) start(m2)start(n2) );
end
end
X = input(‘please input X:‘)
G = 0;
k = k-1;
for i = 1:k
n = mod(i-1N) + 1;
G = G + r(i)*KA(X(1)start(n1)X(2)start(n2) );
end
if (G > 0)
fprintf(‘X is first kind\n‘);
else
fprintf(‘X is secont kind\n‘);
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1092 2016-03-23 22:45 势函数\demoka.m
文件 68 2016-03-23 22:35 势函数\KA.m
目录 0 2016-03-23 22:35 势函数
----------- --------- ---------- ----- ----
1160 3
评论
共有 条评论