Skip to content

Instantly share code, notes, and snippets.

View wenhuizhang's full-sized avatar
🎯
Focusing

Wenhui Zhang wenhuizhang

🎯
Focusing
View GitHub Profile
@wenhuizhang
wenhuizhang / BP-Neural Network
Created October 19, 2012 02:10
BP-Neural Network
% BP 神经网络用于函数拟合 
clc
clear
[filename, pathname]= uigetfile('*.xls'); %寻找源文件
file=[pathname filename]; %赋名
x=xlsread(file); %格式转换为矩阵
% 产生训练样本与测试样本
P1 = x(1:100,1:14)'; % 训练样本,每一列为一个样本
@wenhuizhang
wenhuizhang / Queing Theory C
Created October 19, 2012 02:22
Queing Theory :C
1.typedef double real;
2.#define then
3.
4.#define A 16807L /* multiplier (7**5) for 'ranf' */
5.#define M 2147483647L /* modulus (2**31-1) for 'ranf' */
6.
7.static long In[16]= {0L, /* seeds for streams 1 thru 15 */
8. 1973272912L, 747177549L, 20464843L, 640830765L, 1098742207L,
9. 78126602L, 84743774L, 831312807L, 124667236L, 1172177002L,
10. 1124933064L, 1223960546L, 1878892440L, 1449793615L, 553303732L};
@wenhuizhang
wenhuizhang / HSI
Created October 16, 2013 19:15
Hyperspectra Image Analysis
clc
clear
int lines
int sample
int bands
lines=400;
sample=502;
bands=128;
@wenhuizhang
wenhuizhang / Analog
Created October 16, 2013 19:54
2 Photon System Control and Medical Image Analysis_Delphi_Updated till Aug. 2013 (a new version of MPScan)
unit analogu;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Menus, ToolWin, ComCtrls, ImgList, ExtCtrls, mpfileu, mpviewu;
type
@wenhuizhang
wenhuizhang / Traveling Sales Problem (TSP)_Genetic Algorithm
Created October 26, 2013 01:23
Traveling Sales Problem (TSP)_Genetic Algorithm
function [R,Rlength]=geneticTSP(D,n,C,m,alpha)
[N,NN]=size(D);
farm=zeros(n,N);
for i=1:n
farm(i,:)=randperm(N);
end
R=farm(1,:);
len=zeros(n,1);
@wenhuizhang
wenhuizhang / Particle swarm optimization (PSO)_Algorithm
Created October 26, 2013 01:36
Particle swarm optimization (PSO)_Algorithm_2D
%%http://en.wikipedia.org/wiki/Particle_swarm_optimization
function [pso F] = pso_2D()
% FUNCTION PSO --------USE Particle Swarm Optimization Algorithm
%global present;
% close all;
pop_size = 10; % pop_size
part_size = 2; % part_siz=n-D
gbest = zeros(1,part_size+1);
max_gen = 80;
@wenhuizhang
wenhuizhang / Find the shortest path_Dijkstra Algorithm
Created October 26, 2013 02:32
Find the shortest path_Dijkstra Algorithm
%http://en.wikipedia.org/wiki/Dijkstra's_algorithm
%W stands for the pic/path weight distibution
%n total number of spots
function [l,z]=Dijkstra(W)
n = size (W,1);
for i = 1 :n
l(i)=W(1,i);
z(i)=1;
@wenhuizhang
wenhuizhang / PCA_R_HSI
Created October 27, 2013 20:24
PCA_R_HSI_1
#Do an R-mode using prcomp(), for correlation and covariance among variables
#for Q-mode PCA :the data set should be transposed before procceeding
#Q-mode focuses on correlations and covariance among samples
mydata<-read.table(file="/Users/WenhuiZhang/Desktop/hypeScpec_R/R_hyperspectra/mydata.txt",header=TRUE,row.name=1,sep=",")
mydata.pca<-prcomp(mydata,retx=TRUE,center=TRUE,scale.=TRUE)
#variable means set to zero, and variance set to one sample scores stored in mydata.pca$x
@wenhuizhang
wenhuizhang / Latex Templete for Proposal
Created October 29, 2013 20:27
Latex Templete for Proposal
\documentclass[12pt]{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amscd}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{epsfig}
@wenhuizhang
wenhuizhang / PolyModel.cpp
Last active April 6, 2020 23:37
Lab1_Graphics_Perspective Vector Display System
/******************************************
Lab 1 Perspective Vector Display System
THE GEORGE WASHINGTON UNIVERSITY
Department of Computer Science
CS 6554 - Computer Graphics II - Spring 2014
Name: Wenhui Zhang
GWid: G35379915