text stringlengths 8 6.12M |
|---|
clc;
% include pathes
addpath('./Testing/');
addpath('./Shared/');
addpath('./vlfeat/');
addpath('./vlfeat/toolbox');
addpath('./RidgeFilter/');
addpath('./Sauvola/');
% run vlfeat setup
vl_setup
|
function showTestGraph03(varargin)
%SHOWTESTGRAPH03 One-line description here, please.
%
% output = showTestGraph03(input)
%
% Example
% showTestGraph03
%
% See also
%
%
% ------
% Author: David Legland
% e-mail: david.legland@grignon.inra.fr
% Created: 2011-05-23, using Matlab 7.9.0.529 (R200... |
function result = softmatting(image, t, lambda)
[m, n, ~] = size(image);
L = get_laplacian(image);
A = L + lambda * speye(size(L));
b = lambda * t(:);
x = A \ b;
result = reshape(x, m, n);
end
|
function output = diracn(n)
if n ==0
output = 1;
else
output = 0;
end
end
|
function [data params spectro fourier] = spectroexploreChronux64_30s(data,params)
params.flags.plot_online=1;
if params.flags.plot_online==1
plotYN=1;
else
plotYN=0;
end
%% Calculate spectrogram on a swep-by-sweep basis for strongest channel
spectro=[];
spectro.analysis_window=[params.search_win(1),40;params.sear... |
%% Main file for image preprocessing Project SYS800
clc;
clear;
% Load data
data = readtable('data.csv');
%%
% Create list of img ids
ids = data.('ImgID'); % use {} to access strings
%extra_ids = {};
%%
% Test open each image to find descrepancies
% for i = 1:length(ids)
% name = ids{i};
% name = strcat('imag... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
% Discrete Fourier Transform properties
% linearity
x1= [1 2 3 4 5];
x2= [1 3 5 2 1];
a=3;
b=4;
Left=dft(a*x1+b*x2)
X1=dft(x1);
X2=dft(x2);
Right=a*X1+b*X2
|
% Javier Salazar 1001144647 Problem 3
clc
%-------inputs---------------------------------
lengthString = 5000; % how many random samples
%----------bayesian analysis-----------------------
rng('shuffle') % fixes random generation so only one set of data observed in likelihood function
% random seed will change each tim... |
function traj = gillespie(s0, R, T)
% Sample trajectories from a rate matrix R, untile time T
%
% Arguments:
% s0 - System state at t=0, a column vector with an entry per trajectory
% R - In the finite homogeneous case:
% A matrix (sparse/full) mapping transition rates
% In the infinite/inhomogeneou... |
% function runscript
close all; clear all;
load myfitgroupAllPftol;
Pfs=[0.0005, 0.0006, 0.0007, 0.0008, 0.0009,...
0.001, 0.002, 0.003, 0.004, 0.005, 0.006, 0.007, 0.008, 0.009, 0.01];
Pfslen=length(Pfs);
nsttl=66;
fitfuncs= cell( nsttl, Pfslen );
% MyexperimentalFitsOrigPow(Pf, mu,31);
rmses=nan(66,4);
Test... |
clc % 清屏
clear % 清理内存
Image=imread('d:\matlab\test.png'); % 读取图像
%Image=rgb2groy(Image);将图像变为灰度图像
Image=imresize(Image,[128,128]); % 将图像转变为128*128像素大小
figure(1) %创建窗口一
imshow(Image),title('原图像');
P=[]; %输入矩阵
for i=1:32
for j=1:32
Element_Image=Image((i-1)*4+1:i*4,(j-1)*4+1:j*4);
Vecto... |
%remove from X classes that are not in the following cateogires:
%airplanes, birds, ships,horses and cars
%removes unwanted classes from train.mat and test.mat and saves the result to disk
function remove_classes()
load('stl10_matlab/train.mat')
%remove from X and y rows that are not in classes [1,2,3,7,9]
... |
function qc(filename,n_vol)
[this_dir,this_file,this_ext] = fileparts(filename);
close all
q = niftiread(filename);
dms = size(q);
M2d = reshape(q, [(dms(1))*(dms(2))*(dms(3)),(dms(4))]);
figure
subplot(2,2,[1,2]);
imagesc(M2d(:,1:32));
subplot(2,2,[3,4])
plot(mean(M2d))
savedir = this_dir;
%Plot carpet plot and save
... |
function dydt = ncr_damper_v1(t,y)
kon1 = 1;
koff1 = 1;
kon2 = 0.1;
koff2 = 0.1;
kc = 0.01;
%%%%%%%% Define system of ODEs
% reactant key:
% species 1: QI (caged quencher)
% species 2: Q (free quencher)
% species 3: QA (quenched activator)
% species 4: AI (cage... |
function gwplotallarrows(Q)
% Plot all arrows using gwplotarrow and the Q matrix.
global GWXSIZE;
global GWYSIZE;
global GWTERM;
% Arrow directions
% Change this to select arrow directions from the Q matrix.
A = ones(GWYSIZE, GWXSIZE);
for x = 1:GWXSIZE
for y = 1:GWYSIZE
if ~GWTERM(x,y)
... |
% MATLAB R2017a function
% S. M. Farzaneh, farzaneh@nyu.edu
% Created: November 12, 2017
% Title: Calculate carrier density for a given voltage
function [n] = gate_carrier(v, tox, eox)
% n: carrier density [1/m^2]
% v: top gate voltage [V]
% tox: oxide thickness [m]
% eox: oxide relative permittivity [unitless]
... |
function [ funciones ] = fun_array()
%FUN_ARRAY Funcion que devuelve n muestras de un proceso aleatorio
funciones = {};
f1 = @(t)[6];
funciones{1} = f1;
f2 = @(t)[3*sin(t)];
funciones{2} = f2;
f3 = @(t)[-3*sin(t)];
funciones{3} = f3;
f4 = @(t) [3*cos(t)];
funciones{4} = f4;
f5 = @(t)[-3*cos(t)];
funciones{5} = f5;... |
%% Moving window DFT to get frequencies
%---------------------------------------------
%% Analysis settings
% Which input files
% which_dataset = 'mortar_fnames';
which_dataset = 'localized_fnames';
% which_dataset = 'distributed_fnames';
num_files = 10;
% Intermediate results
intermediate_fname = 'test.mat';
% Clas... |
function result = JacobiTheta( X, K )
%JACOBIETA Jacobi's Theta function.
% JACOBITHETA(X,K) is the Jacobi's Eta function of the elements of X and
% modulus K. X and K must all be real and the same size or any of them
% can be scalar.
%
% JACOBTHETA is a wrapper function which mimics the elemental behaviour
% ... |
%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%
%&% %&%
%&% Εργασία Δημητριάδη Σωκράτη Α.Μ.:359 %&%
%&% %&%
%&% Τ.08 - ΘΕΜΑΤΑ ΨΗΦΙΑΚΗΣ ΕΠΕΞΕΡΓΑΣΙΑΣ ΕΙΚΟΝΑΣ %&%
%&% ΣΥΜΠΙΕΣΗ ΚΑΙ... |
function vol = V1(m)
% Compute the first intrinsic volume of the Euclidean (2m+1) dimensional
% ball using the Kubota formula.
vol = ((2*m+1)*sqrt(pi)*gamma(m+1))/(gamma(m+(3/2)));
end
|
%% Problem 1
clear all
close all
clc
cd('~/Dropbox/School/Spring/ENERGY 294/ENERGY_294/HW4/Code')
%% Read Data
load('../Data/HW4_Data.mat')
discharge1_fit = clean_data(discharge1);
%% Calculate Battery Capacity
Qnom = trapz(discharge1_fit(:,1), discharge1_fit(:,2)) / 3600;
%% Parameter Identification
% Set uppe... |
function mean_dis = computeMeanDis(v,m,d)
a = -m;
b = 1;
c = -d;
dis = abs(a.*v(1,:)' + b.*v(2,:)'+c)./sqrt((a.^2 + b.^2));
mean_dis = mean(dis);
end |
function hashBit = hashEncode(inputBit)
%HASHENCODE MD5-HASH编码,输出128bit
assert(all(ismember(inputBit(:), [0;1])), ...
'inputBit不是比特数据');
% bit图片转换为基于ASCII的字符串
charImg = char(sum(reshape(inputBit, 8, []) .* 2.^(7:-1:0)'));
% HASH输出16进制
hashStr = mlreportgen.utils.hash(charImg);
% 进制转换
c = sprintf('%s', dec2bin(hex2... |
function [ parsedVars ] = GParse( command, str )
%GPARSE Reads a G0 or G1 command and parses the specified position
% Reads everything after 'G1 ' and outputs a position vector of the
% specified target and a scalar for the velocity if specified.
%
% Usage:
% [parsedVars] = GParse(command, str);
%
% command is the stri... |
function sdat = mpxchan2speakernum(dachan, mpxchan)
% sdat = mpxchan2speakernum(dachan, mpxchan)
%
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% Sharad J. Shanbhag
% sshanbha@aecom.yu.edu
%----------------------... |
%% Creating stimulus containing signal and masker
% This script creates a psychophysical experiment by which the test person
% is given a 2AFC for a sound containing only signals or a sound containing
% signals and maskers.
% the maskers are arranged by a 'synchronous multiple burst different' order.
%% Important... |
function [L,S] = pcp_ad(M,u,lambda,itemax,tol)
% PCP by AM algorithm
% initialize S0 and Y0 and L0
[m,n] = size(M) ;
S = zeros(m,n) ;
Y = S ;
L = S ;
% the observed matrix can contain non number
unobserved = isnan(M);
M(unobserved) = 0;
if nargin < 2
lambda = 1 / sqrt(max(m,n));
end
if nargin < 3... |
function I_edge = compute_edge_pyramid(img,detector,h_down,ratio)
if(~exist('detector','var') || isempty(detector))
detector=1;
else
if(strcmp(detector,'pb'))
detector=1;
else
detector=2;
end
end
if(exist('ratio','var') && isempty(ratio))
ratio = 1/1.2;
end
if(ratio>1)
error(... |
function Dist = lme_mass_RgDist(Surf,maskvtx,vtxInd,Dtype)
% Dist = lme_mass_RgDist(Surf,maskvtx,vtxInd,Dtype)
%
% This function computes the distances among all vertices inside a region.
%
% Input
% Surf: Triangular surface. It is a structure with Surf.tri = t x 3 matrix
% of triangle indices, 1-based, t=#triangles... |
function X=plotFig2
%Function to plot the means and standard deviations of the polarization and
%scaled size over a 100 simulations for each c from 0.04 to 2 in the
%Asynchronous update case and the Synchronous update case.
load AsynchPolar
load AsynchSize
load SynchPolar
load SynchSize
c=0.04:0.02:2; ... |
% DEMSTICKMOG1 Demonstrate mixture of Gaussians on stick man.
% DIMRED
% Fix seeds
randn('seed', 1e5);
rand('seed', 1e5);
dataSetName = 'stick';
experimentNo = 1;
% load data
[Y, lbls] = lvmLoadData(dataSetName);
% Set up model
options = mogOptions(20);
latentDim = 1;
d = size(Y, 2);
% Optimise the model.
iters =... |
function n = libnargout( libname,FunctionName )
%LIBNARGOUT Given a library and function name, returns number of output args
FunctionProto = libfunctions(libname,'-full');
% Find the line with the right function
b = cellfun(@(a)~isempty(findstr(FunctionName,a)),FunctionProto,'uniformoutput',0); %#ok<FSTR>
FunctionSign... |
close all
clear all
d=10;
x=-d:.1:d;
[xx,yy]=meshgrid(x,x);
f1=xx.^2+3*yy.^2;
f2=exp(-(xx.^2/20+.3*yy.^2))-2*exp(-((xx+1).^2/8+3*(yy+5).^2/10))-exp(-((xx-2).^2/20+3*(yy-4).^2/30))-xx/50+sin(yy)/8+cos(xx)/10;
h(1)=figure;
hs=surf(xx,yy,f1);
view([45,45])
set(hs,'edgecolor','none')
set(gca,'fontsize',14)
set(gca,'x... |
figure;
imm = 1;
icc = 2;
vname = 'spdt' % prect:prect, dcq:spdq for CAM and CRM are the same
meanmedian = {'mean','median'};
camcrm = {'CAM','CRM'};
eval(sprintf('load mcs_stats_meanmedian_%s_%s.mat;',camcrm{icc},vname));
subrows = 3; % subplot rows
minnt = 2;
maxnt = 22;
truncm = 1;
for nt=m... |
function acf = testDetachNode(s, l, i, varargin)
%testRandomSeed test with different random seeds.
% Test a small graph that exhibits a coarsening problem only for certain
% random RV starts.
%g = Graphs.testInstance('uf/Pajek/GD97_b');
%g = Graphs.testInstance('ml/GD97_b/level-2');
%g = Graphs.testInstance('ml/ilya/w... |
% process the movie from the Nodal-Lefty imaging
% no dapistain, only membrane producing cells stain
% todo:
% 1. load the movie images and the ilasitk prob mask
% 2. make the masks for receiving and producing cell areas
% 3. quantify Nodal in Lefty cells and in Nodal cells in time
% try to remove 300 pxls overl... |
function [rho,flag]=Rho(data,dist,dc,xx,threshold)
%返回该点的密度,以及他是否属于离群点,flag为1代表其属于离群点
rho=1;
kNNdist=0;
ND=max(max(xx(:,1:2)));
N=size(xx,1); %距离的总个数
rho=zeros(1,ND);
flag=zeros(1,ND);
%局部密度计算传统方法
% for i=1:ND-1
% for j=i+1:ND
% rho(i)=rho(i)+exp(-(d... |
%2D Darcy flow------------------------------------------------------------
%-\nabla \cdot (K \nabla h) = 0-------------------------------------------
%pde toolbox: https://www.mathworks.com/help/pde/ug/equations-you-can-solve.html
clear all
close all
global per;
load K_field;
K_field = K_field';
N = 100;
... |
function organize_MI(path,outpth,type,classes_list)
if ~exist(outpth,'dir')
mkdir(outpth);
end
for jj = 1: length(type)
MI_path = [path '\' type{jj}];
list = dir(fullfile(MI_path,'*.xml'));
if ~exist(fullfile(outpth,classes_list{jj}),'dir')
mkdir(fullfile(outpth,classes_list{jj}));
end
... |
%% identification_chirp.m
%% 学生に共有
% date: 2021.9.29
% author: shirato, miyoshi
% 位置で取ると不安定なので,トルク指令値から速度までのシステム同定
% 時間,角速度,トルク指令値を測定。指令値から速度までをシステム同定。
% その後ctrldesign_PID.mで設計
% はじめの1周期のデータは捨て,続く3周期のデータを同定に使うため,4周期以上のチャープデータが必要。
% 0.1-50Hz(30s), 51Hz-100 Hz(10s), 101 Hz-500 Hz(1s)に分けてシステム同定すると精度が良く同定できた。
% 対数チャープを使うと1... |
function ItemFileFix
%This function fixes naming anomalies in the item JSON file. It also proves
%that no items are utilizing a change in stats provided per level, so this
%value can be constant for each item.
load item_original.mat itemdat
%% Fixing a nomenclature issue
items = fieldnames(itemdat);
str = fieldnames(it... |
function [ images, test_ims ] = read_images( folderpath )
D = dir(folderpath);
images = zeros(64,2400*30);
test_ims = zeros(64,2400*10);
for i = 3:32
impath = sprintf('%s/%s',folderpath,D(i).name);
im = imread(impath);
im = double(rgb2gray(im));
[M,N] = size(im);
numpatches = floor(M/8)*floor... |
function [TPR, FPR] = CalROC(smapImg, gtImg, targetIsFg, targetIsHigh)
% Code Author: Wangjiang Zhu
% Email: wangjiang88119@gmail.com
% Date: 3/24/2014
smapImg = smapImg(:,:,1);
if ~islogical(gtImg)
gtImg = gtImg(:,:,1) > 128;
end
if any(size(smapImg) ~= size(gtImg))
error('saliency map and ground truth mask ha... |
%clear all;
%close all;
psi_star_2D_transition=psi_star_2D;
%alpha=atan(2);
disp('----------------');
clear S3 S3_filt;
pos_rmix=xPsih_zero;
pos_psi_rx=xPsih_zero;
rmix=rPsih_zero;
rx=rPsih_zero;
ksi0=-rx;
sign_ksi0=sign(ksi0);
for (r=1:NR)
for (omega=1:Nomega)
psi_region3(r,omega)=Psih_fina... |
% function [Percentage]= miraclassifier(tr,label_tr,te,label_te)
% ---------------------------------------------------------------------- %
% OCR: Perceptron
% Author: Atul Dhingra
% dhingra[dot]atul92[at]gmail.com
% ---------------------------------------------------------------------- %
clear all;
close all;
... |
function [L, stored_at] = quadtree_laplacian(C,W,CH,D,A)
% QUADTREE_LAPLACIAN
% Builds a finite difference Laplacian on a quadtree following the scheme
% suggested by Bickel et al. "Adaptative Simulation of Electrical
% Discharges". This code is *purposefully* not optimized beyond
% asymptotics for simplicity in unders... |
%
% WHITEGAUSSNOISE Generate gaussian-distributed noise with uniform power
% spectrum distribution
%
% x = WHITEGAUSSNOISE(N,level)
% Generates a N-point vector (x) of Gaussian distributed random noise. The
% standard deviation of the noise is determined by (level).
%
% x = WHITEGAUSSNOISE(t,lev... |
function [H1E] = regular_Heiviside_fun3D(X)
epsilon = 1; % the number is not fixed.
%Epsilon = 1.5;
%%%%%%%%%%%% Create the first type of regulation of Heivide function %%%%%%%%%%%%
H1E = 0.5*(1+(2/pi)*atan(X./epsilon));
end
|
function varargout = Motor_Designer(varargin)
% MOTOR_DESIGNER MATLAB code for Motor_Designer.fig
% MOTOR_DESIGNER, by itself, creates a new MOTOR_DESIGNER or raises the existing
% singleton*.
%
% H = MOTOR_DESIGNER returns the handle to a new MOTOR_DESIGNER or the handle to
% the existing singleton... |
v = readtable('..\Data\final_label.csv');
v = table2array(v(:,2:9));
class1 = find(v(:,1)==1);
class2 = find(v(:,2)==1);
class3 = find(v(:,3)==1);
class4 = find(v(:,4)==1);
class5 = find(v(:,5)==1);
class6 = find(v(:,6)==1);
class7 = find(v(:,7)==1);
class8 = find(v(:,8)==1);
|
% Look at BF total power in each beam
close all;
clearvars;
addpath ../kernel/
scan_table; % Found in kernel directory
% Project directory
proj_str = 'TMP';
save_dir = sprintf('%s/%s/BF', data_root, proj_str);
scan_nums = 1;
for i = 1:length(scan_nums)
tstamp = '2017_08_05_17:36:04';
fits_filename = sprintf(... |
%clear;
%load('04_28_csi_dataset.mat');
%参数配置
inputSize = size(csi_train{1,1},1);
numHiddenUnits = 200;
numClasses = size(categories(csi_label),1);
networkType = 'SingleBiLSTM';
maxEpochs = 150;
miniBatchSize = 32;
%划分训练集和测试集
[x_train, y_train, x_test, y_test] = split_train_test(csi_train, csi_label, numClasses, 0.7... |
function testDiscreteSamplers()
debugPrint = false;
repeatable = true;
dtrace(debugPrint, '++testDiscreteSamplers');
if (repeatable)
seed = 2;
rs=RandStream('mt19937ar');
RandStream.setGlobalStream(rs);
reset(rs,seed);
end
test1(debugPrint, repeatable);
dtrace(debugPrint, '--testDiscreteSamplers')... |
function MemToolbox2DSimNTrials(nIter)
% MemToolbox2DSimNTrials(nIter)
% simulation to see how number of trials affects parameter recovery, in 1D and 2D models
%
% requires the following functions from matlib:
% makeSubplotScalesEqual(), nancat(), conditionalPlot(), sq(),
%
% nIter is the number of iterations a... |
function [uh] = pde1d_subsample_solver_loc(A,f,N,sizeH,sizeh,over_samp)
%--------------------------------------------------------------------------
% fine grid size, coarse grid size, dim of coarse grid, num of coarse grid
d=1; dimH=sizeH^d; num=(N/sizeH)^d;
%----------------------------------------------------... |
% Collaborative filtering class
classdef cofi_c < handle
properties
ymu;
x_l;
theta_l;
end
methods
function learn(obj,y,r,max_iter,lambda,x,theta)
% This function finds the optimal theta for a training set using fminunc
% Supply x and thet... |
% MIT License
%
% Copyright (c) 2017 JM Joseph
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
% in the Software without restriction, including without limitation the rights
% to use, copy, modify, merge, ... |
%% Loading the dataset
Toy = load('toy1');
Toy = Toy.X;
%% 5 clusters
Cluster_kmeans = kmeans(Toy, 5);
Cluster_normalized = normalized_spec(Toy, 5);
Cluster_unnormalized = unnormalized_spec(Toy, 5);
figure('Name', 'Kmeans clustering (5 clusters)');
plot(Toy(Cluster_kmeans==1,1),Toy(Cluster_kmeans==1,2),'r*');
ho... |
%% SYS800 - Reconnaissance de formes et inspection
% M'Hand Kedjar - December 2016
% Course Project on Age and Gender Classification
function predicted_hog = hogsvm_predict(model_hog, target)
predicted_hog = predict(model_hog, target);
end |
function [strlist, list1, list2,str1] = compare_pipe(filestr,cmpval,cmpstr,mnrval)
num1=1;str1=cell(32,1);
num2=1;str2=cell(32,1);
list1=zeros(32,1);
list2=zeros(32,1);
val=1;
for i =2:6
if (i~=cmpval)
list(val) = i;
val=val+1;
end
end
a=list(1);b=list(2);c=list(3);d=list(4);
cstr=filestr{1,cm... |
clc;
clear all;
month = 'November';
year = '2013';
date_n = [month,' ',year]; % nice date
date_u = [month,'_',year]; % ugly date
%% Forecasted
file_f = ['Generation_Forecast_Historical_Cipu_',month,'_2013_wind.csv'];
fid = fopen(file_f); %open file
headers = fgetl(fid); %get first line
headers = textscan(headers... |
function [gamma_cof w_cof]=gamma_generator(Type,edges,w_dictonary)
cut_off=sort(edges);
index=1;
switch lower(Type)
case {'lowpass'}
if length(cut_off)~=2
disp('Lowpass filter needs exactly two edges')
gamma_cof=[];
return
en... |
function b = memberof(list, item, func)
% BOOL = MEMBEROF(ARRAY, ITEM)
% BOOL = MEMBEROF(ARRAY, ITEM, FUNC)
% Returns true if ITEM is an element of ARRAY. Equality is tested using
% FUNC. If FUNC isn't provided, it defaults to @(i, j) = (i == j).
%
if isempty(item)
b = 0;
return;
end
if nargin < ... |
clc;
clear;
% imagefiles= dir('C:\Users\hadi\Desktop\washngton images\*.jpg');
% for i=1:length(imagefiles)
%
% cd('C:\Users\hadi\Desktop\washngton images'); %going to dataset folder for read images
% currentfilename = imagefiles(i).name;
% image = imread(currentfilename);
% cd('C:\Use... |
% This funnction takes the audio files in a directory and turns them into a
% polar pattern plot.
function [avgAmplitude, avgAmplitudeScaled, avgHAmplitude] = plotPolarPattern(folderPath, numOfOctaveBands, plotAll)
% INPUT:
% -folderPath: string containing path to folder containing audio files.
% -numOfOctaveBands: in ... |
% Senjor Project: Software Defined Implementation of Digital Communication
% Student: Leul Wuletaw
% Professor: Dr. Ing.- Dereje Hailemariam
% Date: June, 2017
% ***************** FUNCTION: input_audio() ***************** %
% This function reads and stores audio from external file.
function [ audio_data ] = in... |
function [ optSet ] = interface_get_aqi_nnOptSet(refInfo,index)
stringToRun='';
stringToRun=strcat(stringToRun, refInfo.get_aqi_nnOptSetFunction);
stringToRun=strcat(stringToRun, '(');
stringToRun=strcat(stringToRun,'refInfo,');
stringToRun=strcat(stringToRun,'index');
stringToRun=strcat(stringToRun,')');
[optSet]=eva... |
function [word_label,output_matrix] ...
= bipartite_clustering_word_initial(tf_matrix,k_word)
% -------------------------------------------------------------------------
% tf_matrix is the given matrix; k_word, k_doc are the number of clusters
% first step, find word clusters, and aggregate, return... |
%Jonathan Braaten
%GM Project: Cobalt Cation Exchange of Nafion 117
%6/1/2017-Final Modifications
%cation_exchange_117_final.m
clear;
clc;
%Nafion N117 Properties
EW=1100; %gram/mol equivalent weight of N117 Nafion
BW=360; %gram/m^2 basic weight of N117 Nafion at 23 C and 50% RH
percH2O=5; %percentage of m... |
function [keyXs, keyYs] = getKeypoints(im, tau)
% this function returns the X,Y coordinates of the selected keypoints
% fwu11
alpha = 0.05;
% smooth the image before taking the derivatives
G1 = fspecial('gaussian',[7 7],2); % Gaussian filter with size of 7 by 7 and sigma of 2.
smoothed = imfil... |
function varargout= mcorr(varargin)
%MCORR Multi-plot of all correlations between columns of a matrix
% MCORR (X) plots correlations between all possible combinations of the
% columns of array X, in a single figure. If the first argument is the
% name of a file present in the current directory, mcorr reads
% it ... |
%
% [At,b,c,K]=readsdpa(fname)
%
% Reads in a problem in SDPA sparse format, and returns it in SeDuMi
% format.
%
% 7/20/07 Modified to handle comments and other cruft in the SDPA
% file. In particular,
%
% 1. Initial comment lines beginning with " or * are ignored.
% 2. In the first three lines, any extraneou... |
%% clear
clear all;
clc;
%% Problem 1:
% Part 1:
load HW6.mat
% Part 2:
avgRacingInfo = mean(RacingInfo, 2); % Calc avg column
concatenatedRacingInfo = [RacingInfo avgRacingInfo]; % concatenate to last column
fprintf('Problem 1 Part 2:\n');
disp(concatenatedRacingInfo); % Display the concatenated matrix.
% Part 3:
so... |
function tmp_audiogyral2
%% Initialization
clc
close all hidden;
clear all hidden;
k =0;
v =0;
beta0 = [k v];
%% Load
load('DataForMarc');
figure(666)
getdat(DataForMarc,beta0)
% %%
% figure
% bar(B')
%%
function getdat(DataForMarc,beta0)
%% Analysis
Y = [];
X = [];
E = [];
for ii = 1:2... |
function pout=mcminbnd(F,lbound,ubound)
global MAXTIME
% user set parameters
if exist('MAXTIME')==0,
MAXTIME=30;
end
pin=(lbound+ubound)/2;
%if length(abs(ubound-lbound)<minbndsz)>0,
% bdidx=find(abs(ubound-lbound)<minbndsz);
% ubound(bdidx)=ubound(bdidx)+minbndsz;
% lbound(bdidx)=lbound(bdidx)-minbndsz;
%end... |
function ydt = payneD44CaDiff(t,y)
global Friv Fhyd Fpw driv dhyd dpw epsc kcarb MCa0 Friv0 Fcarbv kt Frivv...
Moc ksp omgCv flag epscv kcarb2 drivv;
MCa=y(1);
dsw = y(2);
co3 = y(3);
TC = y(4);
TA = y(5);
omgC = (co3 * MCa/Moc)/ksp; % MCa/Moc converting from total moles Ca to moles/kg
tStart =1e6;
tEnd= tStart+... |
close all; clear all; clc;
PC_IP = '192.168.7.1';
BEAGLEBONE_IP = 'http://192.168.7.2';
% Initialise ROS on remote master
setenv('ROS_MASTER_URI', strcat(BEAGLEBONE_IP, ':11311'))
setenv('ROS_IP', PC_IP)
rosinit
sub = rossubscriber('/hovercraft/fix', rostype.sensor_msgs_NavSatFix);
while 1
msg = receive(sub);
... |
function ZZ=runmeanmean(Y, WinLen, EndPts)
%
% USE: [ZZ]=runmeanmean(Y, WinLen, EndPt)
%
% Calculate running mean in both directions (zero phase shift). After
% performing one running mean, runmean flips the vector, performs another
% running mean, and then flips the vector again. NaNs are ignored when
% averaging. Re... |
% k1 = 12, k2 = 11, k3 = 21, k4 = 22
% 0 substituido por 9
m1 = [1 2 1 1 5 4 8 1 9];
m2 = [1 2 2 1 8 1 6 7 9];
n = 0:17; % Vetor de indice de tempo
x = floor(rand(1, 18)*10).-5; % sequencia de amostras na entrada
k1 = [m1 m2]; % Chave publica k1
k2 = [m1 m1]; % Chave publica k2
k3 = [m2 m1]; % Chave publica k3
k4 = ... |
function data_out = pp_two_power_v3fit(s, pp_in)
%
a0 = pp_in(1);
a1 = pp_in(2);
a2 = pp_in(3);
a3 = pp_in(4);
data_out = a0 + a1 * (1 - s.^a2).^a3;
|
function [mapping] = precisionMod(trn_label, trn_binary, tst_label, tst_binary, top_k, mode, fileTest, fileTrain)
K = top_k;
QueryTimes = size(tst_binary,2);
QueryTimes=5;
K=5;
mapping=repmat({''},QueryTimes,K+1);
for i = 1:QueryTimes
mapping{i,1}={fileTest{i}};
fprintf('query %d\n',i);
query_binary = ... |
function dy = rr3(t, y)
dy = zeros(2,1);
R=10;
L=0.1;
C=1e-5;
dy(1) = y(2);
dy(2) = (-R*C*y(2) - y(1) +1)/(L*C);
end
|
for i=16:16
% Import the eye image
file=sprintf('iris%d.bmp',i);
img = imread(file);
% Set the parameters for pupil and iris.
yPosPupil = 80;
xPosPupil = 80;
rPupil = 60;
yPosIris = 100;
xPosIris = yPosIris;
rIris = 10;
%Passing it to function..
image = Rubber_Sheet( img, xPosPupil, yPosPupil, rPupil , xPosIris , yPosI... |
function [x1,x2] = eqSegGrau(a,b,c)
delta = b^2-4*a*c;
sqrt_delta = sqrt(delta);
x1 = (-b + sqrt(delta))/(2*a);
x2 = (-b - sqrt(delta))/(2*a);
end |
classdef cHarmonicTarget
properties %(////Access = protected)
phi_d %Bearing angle
r %Radial distance
f_0 %Target frequency (narrow band signal)
amplitude %Amplitude
end
properties (Constant)
c=3e8
end
methods
%Constructor
fu... |
adapt_speed_Ekin_G;
v_phi_next=v_phi_next+PPHI_CORR_FACTOR*(v_phi_step_recalc-v_phi_step);
% %
adapt_speed_Ekin_G;
v_phi_next=v_phi_next+PPHI_CORR_FACTOR*(v_phi_step_recalc-v_phi_step);
%
adapt_speed_Ekin_G;
v_phi_next=v_phi_next+PPHI_CORR_FACTOR*(v_phi_step_recalc-v_phi_step);
% TAE growth rate from powe... |
function [ Blade ] = Make_Blade(x,y,rR,R,psi,theta,beta,zeta )
%MAKE_BLADE Summary of this function goes here
% Detailed explanation goes here
%######################################################### Creating the Blade #########################################################
[Blade(1) Blade(2) Blade(3)]=Extrude(x,... |
function [ analysis ] = dominant_in_window(xid,game,width,trace,env,summary,varargin)
% predicts the gamma of the subject from the choice of action
% looks at visits to state 1 at times t(1),t(2),...,t(k)
% uses the dominant action on visits i to (i+w-1) for window w.
kwargs = utils.dict(varargin{:});
if narg... |
function [result,overallInfected_nv,overallFatality,data]=computeFinalSize(vacDistParm,adultAges,IFR,w,R0,C,N,r,v,infected0_v,infected0_nv,betaVac,effVac,overallInfected_nv_uniform,overallFatality_uniform)
vacDist=0*r;vacDist(adultAges)=vacDistParm;
infected=infected0_nv+infected0_v;
s=1-r-infected-v-vacDist;
A=R0*C*d... |
function [ draws, acc_rate, log_posteriors, statedraws, add_matrices] = sampling_MH_MC( setup )
%main function for the MH algorithm
data=load(setup.data);
data=data.data;
data=data(:,end-setup.sample_size+1:end);
warning off;
options = optimset('Display','iter','TolFun',1e-4,'TolX',1e-4,'MaxIter',1000, 'M... |
function SummaryImages(VAResults)
NearInd = find(VAResults(:,2,1)==40);
RERegNear = VAResults(NearInd, 3, 1:2); BadRERegNear= find(RERegNear>0.2);
REVanNear = VAResults(NearInd, 4, 1:2); BadREVanNear= find(REVanNear>0.2);
LERegNear = VAResults(NearInd, 5, 1:2); BadLERegNear= f... |
%% 20180421_002556
file = [20180421, 002556]; % after spectra
data = DataScanSeq(file);
%%
titles = {'DDS = 0.3, 3.9mW ', 'DDS = 0.25, 2.1mW', 'DDS = 0.2, 0.9mW', 'DDS = 0.18, 0.6mW', 'DDS = 0.15, 0.3mW'};
bFit = 1;
gammalistCs = [];
gammalistNa = [];
gammalistNaErr = [];
gammalistCsErr = [];
figure(4); clf; set(gcf,'... |
function acqResults = GPS_L1_CA_acq(file_path, sample_offset, N)
% GPS信号捕获,32颗卫星全搜索,连续搜索2段数据,结果存在变量acqResults中
% sample_offset:抛弃前多少个采样点处开始处理
% N:FFT点数
%%
Ns = N; %采样点数
fs = 4e6; %采样频率,Hz
fc = 1.023e6; %码频率,Hz
carrFreq = -6e3:(fs/Ns/2):6e3; %频率搜索范围
M = length(carrFreq);
acqThreshold = 1.4; %搜索阈值,最大峰比第二大峰大多少倍
%%
% 取... |
%% collectPartiicpantInfo
%function used to collect participant information and save it to a file
%INPUT
%ppCode - participant code, input at the start of the function
% Joshua Calder-Travis, j.calder.travis@gmail.com
%utilised by Sarah Ashcroft-Jones, sarah.ashcroft-jones@psy.ox.ac.uk
%%
function colle... |
%Karol Wadolowski, Project: GSM PHY Layer Simulation
%This code uses TCH /F9.6 to send a message over various SNR values
clear; clc; close all;
warning('off') %For a clearer output. Turned on at the end
SNRdB = -6:1:-2; %Signal to noise ratios to test
%Prepare message
message = ['\tType your message h... |
function h = errorshade(x,y,l,varargin)
%ERRORSHADE Error bar plot in which the error is represented as the shaded
%area around the line plot
% ERRORSHADE(X,Y,L,U) plots the graph of vector X vs. vector Y with error
% bars specified by the vectors L and U. L and U contain the lower and
% upper error ranges for e... |
clear all;clc;
load fisheriris;
num_of_classes = 3;
num_of_features = size(meas, 2);
labels = [1*ones(50,1); 2*ones(50,1); 3*ones(50,1)];
c = cov(meas);
eigVec = pca(meas);
%For 3d. Pick the first 3 eigenvectors and transform data;
modData3d = ((eigVec(:,1:3)')*meas')';
modData2d = ((eigVec(:,1:2)')*meas')';
modData1d... |
function [ premph ] = preemphasis( y )
x = y(1:end);
a = [1 0.9];
premph = filter(1,a,x);
end |
function [obj] = objectiveFunctionPDM2(...
P, PET, Q, S_min, a, LG, LR, calParameters)
%OBJECTIVEFUNCTIONPDM2 Calculates objective function to be minimised for
% calibration. Calibrates two parameters (LR, LG).
%
% INPUT
% data and parameters (see calcStreamflow)
%
% OUTPUT
% evaluated objective function ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.