![]() |
[求助]分析M文件中的目标函数
最近在做毕业设计,想请问一下下面代码表示的是怎样的函数,请各位大侠帮帮忙啊!!!!!!!!!
function f = shufcn(y) for j =1:size(y,1) f(j) =0.0; x = y(j,:); temp1 = 0; temp2 = 0; x1 = x(1); x2 = x(2); for i =1:5 temp1 = temp1+i.*cos((i+1).*x1+i); temp2 = temp2+i.*cos((i+1).*x2+i); end f(j) =temp1.*temp2; end |
回复: [求助]分析M文件中的目标函数
我只是把你贴出来的程序精简了一下:
% from lanfans.com function f = shufcn(x) if size(x,2)<2 error('输入的矩阵至少含2列') end i =1:5; for j =1:size(x,1) temp1 = i.*cos((i+1)*x(j,1)+i); temp2 = i.*cos((i+1)*x(j,2)+i); f(j) =sum(temp1)*sum(temp2); end |
所有时间均为北京时间。现在的时间是 14:44。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.