x = 1:0.01:2; y = sin(10*pi*x) ./ x; figure plot(x, y) title('绘制目标函数曲线图—Jason niu'); hold on c1 = 1.49445; c2 = 1.49445; maxgen = 50; sizepop = 10; Vmax = 0.5; Vmin = -0.5; popmax = 2; popmin = 1; ws = 0.9; we = 0.4; for i = 1:sizepop pop(i,:) = (ran…
x = 1:0.01:2; y = sin(10*pi*x) ./ x; figure plot(x, y) title('绘制目标函数曲线图—Jason niu'); hold on c1 = 1.49445; c2 = 1.49445; maxgen = 50; sizepop = 10; Vmax = 0.5; Vmin = -0.5; popmax = 2; popmin = 1; for i = 1:sizepop pop(i,:) = (rands(1) + 1) / 2 + 1;…
figure [x,y] = meshgrid(-5:0.1:5,-5:0.1:5); z = x.^2 + y.^2 - 10*cos(2*pi*x) - 10*cos(2*pi*y) + 20; mesh(x,y,z) hold on c1 = 1.49445; c2 = 1.49445; maxgen = 1000; sizepop = 100; Vmax = 1; Vmin = -1; popmax = 5; popmin = -5; for i = 1:sizepop pop(i,:)…
import tensorflow as tf import numpy as np W = tf.Variable(np.arange(6).reshape((2, 3)), dtype=tf.float32, name="weights") b = tf.Variable(np.arange(3).reshape((1, 3)), dtype=tf.float32, name="biases") saver = tf.train.Saver() with tf.…
x = 0:0.01:10; y = x + 10*sin(5*x)+7*cos(4*x); figure plot(x, y) xlabel('independent variable') ylabel('dependent variable') title('GA:y = x + 10*sin(5*x) + 7*cos(4*x)利用算法求解最优解—Jason niu') initPop = initializega(50,[0 10],'fitness'); [x endPop bpop t…
$$\bex \sin(x+y)=\sin x\cos y+\cos x\sin y. \eex$$ Ref. [Proof Without Words: Sine Sum Identity, The College Mathematics Journal].…
该曲线在x趋近于零时振荡很剧烈,在远离零点时振荡越来越平缓. 图线: 代码: <!DOCTYPE html> <html lang="utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <head> <title>绘制曲线y=Sin(1/x)</title> </hea…
鸟枪换炮,利用python3对球员做大数据降维(因子分析得分),为C罗找到合格僚机 原文转载自「刘悦的技术博客」https://v3u.cn/a_id_176 众所周知,尤文图斯需要一座欧冠奖杯,C罗也还想再拿一座欧冠奖杯,为自己的荣誉簙上锦上添花.意甲霸主在意甲虽然风生水起,予取予求,但是在今年欧冠1/8决赛赛场上,被法甲球队里昂所淘汰,痛定思痛,球队解雇了主教练萨里,签约名宿皮尔洛,但是要想在欧冠赛场上夺冠,这还不够,球队还需要什么?没错,需要一名强力中锋,在正印中锋伊瓜因难堪大用的情况下,…
load spectra; temp = randperm(size(NIR, 1)); P_train = NIR(temp(1:50),:); T_train = octane(temp(1:50),:); P_test = NIR(temp(51:end),:); T_test = octane(temp(51:end),:); k = 2; [Xloadings,Yloadings,Xscores,Yscores,betaPLS,PLSPctVar,MSE,stats] = plsreg…
load spectra; temp = randperm(size(NIR, 1)); P_train = NIR(temp(1:50),:); T_train = octane(temp(1:50),:); P_test = NIR(temp(51:end),:); T_test = octane(temp(51:end),:); [PCALoadings,PCAScores,PCAVar] = princomp(NIR); figure percent_explained = 100 *…