text stringlengths 8 6.12M |
|---|
function [weights, bias] = createNetwork(layers)
%createNetwork produces a fully connected a neural net
%
%USAGE
% layers = [784, 300, 150, 50, 10];
% [weights, biases] = createNetwork(layers);
%
%PARAMETERS
% layers - number of nodes in each separate layer
%
% OUTPUT
% weights : the weights connecting the... |
addpath('.');
clearvars;
addpath('/usr/local/class/object/matconvnet');
addpath('/usr/local/class/object/matconvnet/matlab');
load('img_list.mat','list');
load('random.mat','random');
list2 = [list random];
tic;
vl_setupnn;
net = load('imagenet-vgg-verydeep-16.mat') ;
dc = [];
for i = 1:size(list2,2)
im = imre... |
%% Machine Learning Online Class
% Exercise 8 | Anomaly Detection and Collaborative Filtering
%
% Instructions
% ------------
%
% This file contains code that helps you get started on the
% exercise. You will need to complete the following functions:
%
% estimateGaussian.m
% selectThreshold.m
% cofiCos... |
classdef TrackDataAppTest < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
PlotMenu matlab.ui.container.Menu
PlotAllLapsMenu matlab.ui.container.Menu
FreezePlotsMe... |
function pxk = lagrange(a, f, xk)
tic
%Uses the Lagrange interpolating polynomial to estimate a value at a given
%x
% input a
% row vector containing known values of the function
% input f
% either:
% a function handle representing the function or,
% a row vector containing the value... |
% XXXXXXXXXXXXXXXXXXXXXXXXXXX htet_cal_nan_percent XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
%
% Author : Htet
% Date : Sep 11, 2019
% Function : to calculate percentage of missing data in one feature(column)
% Syntax : htet_cal_nan_percent(input, len, total)
% Stars : *
% XXXXXXXXXXXXXXXXXXXXXXXXXX... |
for k=1:2880
Agg5HHDay1(k) = Agg5HHFull(k);
Agg5HHDay2(k) = Agg5HHFull(k+2880);
Agg5HHDay3(k) = Agg5HHFull(k+5760);
Agg5HHDay4(k) = Agg5HHFull(k+8640);
Agg5HHDay5(k) = Agg5HHFull(k+11520);
Agg5HHDay6(k) = Agg5HHFull(k+14400);
Agg5HHDay7(k) = Agg5HHFull(k+17279);
Agg10HHDay1(k) = Agg10HHF... |
% function rotate surface
%
% M = rotMatrix(angles)
%
% where: M is the rotation matrix
% angles is a 1x3 rotation angles vector in degrees for [x y z] axis
%
% see: https://en.wikipedia.org/wiki/Rotation_matrix
%
% original Source: Taylor, Camillo J.; Kriegman, David J. (1994).
% "Minimiz... |
function setOldPath
% Use old psychtoolbox with the eyelink
rmpath(genpath('/Users/Shared/Psychtoolbox/'));
addpath(genpath('/Applications/Psychtoolbox/'));
addpath(genpath('/Users/lisandro/Exps/Psychophysics/')); |
function varargout = spectroscopy1_zdc(varargin)
% spectroscopy1, bias, drive, readout all on one qubit
%
% <_o_> = spectroscopy1_zdc('qubit',_c|o_,...
% 'biasAmp',<[_f_]>,'driveFreq',<[_f_]>,'dataTyp',<_c_>,...
% 'notes',<_c_>,'gui',<_b_>,'save',<_b_>)
% _f_: float
% _i_: integer
% _c_: char or char strin... |
function error = CalculateError(approximatedValues, trueValues)
numberOfValues = length(approximatedValues);
error = sqrt((1./numberOfValues)*sum((approximatedValues - trueValues).^2));
end |
close all;
clear;clc;
exp.AAA = {'prespeech','prelisten','postlisten_24','postlisten_32'};
for condition=1:length(exp.AAA)
close all;
clearvars -except exp condition
exp.cond=exp.AAA{condition};
load('C:\Users\SMukherjee\Desktop\projects\dual_eeg_eng\data\dual_eng\mat\coherence\idx... |
ths = [1 2 3 4 5 6 7 8 9 10];
ser = 42.8745;
spd = [ser/42.8745 ser/33.9665 ser/25.2741 ser/20.6863 ser/21.4943 ...
ser/20.1796 ser/17.9640 ser/16.1068 ser/15.4174 ser/16.1545];
ser1 = 96.795;
spd1 = [ser1/96.795 ser1/75.7442 ser1/55.6050 ser1/49.3350 ser1/49.3607...
ser1/49.3650 ser1/45.342 ser1/43.2... |
clc
disp('Trials, in order of creation:')
disp('==================================================================');
for inx = 1:size(exp.trials,2)
trial = exp.trials(inx);
if inx < 10
%trial(inx) is two characters shorter, align
string = [' Trial(' num2str(inx) ') '];
elseif inx < ... |
function A=bit2num(B)
A=0;
S=size(B);
for i=1:S(2)
A=A+double(B(S(2)-i+1)*(2^(i-1)));
end
|
%%% This code tests how large information matrix should be to get the
%%% correct answer
% matlabpool open;
load('..\basedata.mat');
addpath('..\..\Research\Code\Tools\liblinear\matlab');
rng(1);
c = Xf(:,26:30)*price'-cv; %price - cost
s = 1e4;
inq = 100;
W0 = mvnrnd(zeros(1,d),eye(length(w)),s);
XID = 1:3... |
function updownload(gNo, setNoV, upDownStr)
% Upload or download sets to kure
%{
Processes all experiments for all sets
%}
%% Input check
validateattributes(gNo, {'numeric'}, {'finite', 'nonnan', 'nonempty', 'integer', '>=', 1})
validateattributes(setNoV, {'numeric'}, {'finite', 'nonnan', 'nonempty', 'integer', '>='... |
function [biopac_files, behav_files] = match_files(biopac_files, behav_files)
% returns the intersection of the files in the two input cell arrays of
% file names
%% Find the Intersection
% extract the round IDs from the filenames of the two file types
biopac_rounds = find_round_ids(biopac_files);
multicond_rounds... |
function [ classifier ] = trainBinaryClassifier(trainer)
%Reed Gurchiek, 2018
% trains binary classifier based on user specifications determined in
% initializeBinaryClassifier
%
%----------------------------------INPUTS----------------------------------
%
% trainer:
% trainer struct from intializeBinaryCla... |
function [Model]=KFoldValidationTrain()
%this is neuralNetwork train
feature= zeros(5000,496);
label= zeros(5000,1);
load('small_data_batch_1.mat');
feature(1:1000,:)= GenerateHOGForImg( data );
label(1:1000)= labels;
load('small_data_batch_2.mat');
feature(1001:2000,:)= GenerateHOGForImg( data );
label(1001:2000)= ... |
% ====================================================================================================================
% Semi-Truck's
% State Space
% =============================================================... |
function L = minquad_kcontinuo(A) % funzionale da minimizzare
%
% L = minquad_kcontinuo(A)
%
% Definisco il funzionale L da minimizzare.
%
% INPUTS:
% A : incognita della forma A = [A(1),A(2),A(3)]
%
% OUTPUTS:
% L : funzione minimi quadrati
%
global days k_c
%K = @(t) A(1)*exp(A(2)*t).*(... |
%DI_RTrapezios Calculo Integração Numérica através da Regra dos Trapézios
% t = DI_RTrapezios(f,a,b,n)
% t = h*(f(a)+f(b)+t)/2;
%
%INPUT:
% f - função real de variável real x
% [a, b] - extremos do intervalo da variável independente x
% n - número de subintervalos ou iterações da regra
%OUTPUT:
% ... |
function [V,Pol,err] = VI_CVaR(MDP,Y_set_all,index_opt,index_fast,tol,maxIter,V0,dis)
% Interpolation based CVaR VI
% Instead of solving many small problem, solve a concatenated linear problem
% for all actions and confidence parameters at each iteration
Ns = MDP.getNumStates;
Ny = size(Y_set_all,2);
Na = MDP.getNumAc... |
function g = NBS_CMS(x,y,A,lambda,k_opt,l_opt)
gx = sinc(A/lambda*(k_opt-sin(x)));
gy = sinc(A/lambda*(l_opt-cos(x).*sin(y)));
g = gx.*gy;
end |
%% Loads simulation files and writes subset (only bus voltages) to data/sim*.mat
function gendata(numcontigs)
for i = 1:numcontigs
filename = ['data/sim14_' num2str(i) '.mat'];
load(filename);
rangebus = (DAE.n + Bus.n + 1):(DAE.n + Bus.n + Bus.n);
data = Varout.vars(:,rangebus);
filename... |
function plot1vMany(x,Y)
figure;
plot(repmat(x,size(Y,1),1)',Y');
end |
%% Prepare input
% Last 2.4 second, dt = 50ms
w_len = 48;
% Or last 41 bins (after all choice points) for TC
% w_len = 41;
for q_i = 1:19
[p_xor, p_same_mu] = get_rand_discrete_probs();
% Number of neurons
n_units = randi([60, 120]);
Q{q_i}.left = zeros(n_units, w_len);
Q{q_i}.right = zeros(n_units... |
n=100000;
x=0;
y=0;
pix=zeros(n,2);
neighbour=[-1 -1;-1 0;-1 1;0 -1;0 0;0 1;1 -1;1 0;1 1];
for i =1:n
r=floor(1+9*rand());
y=y+neighbour(r,1);
x=x+neighbour(r,2);
pix(i,:)=[y x];
end
miny=min(pix(:,1));
minx=min(pix(:,2));
pix(:,1)=pix(:,1)-miny+1;
pix(:,2)=pix(:,2)-minx+1;
maxy=max... |
function msg = obs2msg(obs, Params)
% input: observation for a single car;
% output: state-struct correspondes to observation (3 cars: v, d && lane_id)
% NYX modified 12/01/2017 17:08;
%% obs->message transform Description
% d: near-->1, midium--> 2, far-->3;
% v: closer-->1, miduium-->2, away-->3;
% lane_id: y==0 (r... |
classdef bead < handle
properties % Dynamic Properties
x = [0,0,0]; % store current step info
v = [0,0,0];
id = -1;
x_eq = 1; % Bead radius
x_prime = [0,0,0]; % store 1 step ahead info
v_prime = [0,0,0];
time_since_birth = 0;
time_last_divide =... |
function result = rectangle_sum(integral, rectangle, row, col)
% function result = rectangle_sum(integral, rectangle)
%
% integral: integral image of some image A
% rectangle: [top bottom left right]
% row: an offset that is used to adjust top and bottom
% col: an offset that is used to adjust left and right.
... |
% Project 3 Part 2
% Transfer Function evaluation code
% Cole Lewis, Macky McWhirter, Breydon Westmoreland
close all;
clear all;
clc;
[y, fs] = audioread('TestSignalTest.wav');
x = audioread('TestSignal.wav');
corrlen = 10000;
%p=1000;
%coeff = aryule(y,p);
%figure
%freqz(1,coeff)
ac = xcorr(y,... |
%% Setup energy intervals
E_max=0.6*eV;
E_min=0*eV;
n_E=100; %number of energy points to be considered
EE=linspace(E_min,E_max,n_E); |
function process_2d_linear_polar_plot(filename)
% This code is used to plot tuning direction on 4 different axis of linear
% movement, input file name: '2d_linear_EPSC_2d_accel_ZL*.mat'
S=load(filename);
% X Y are orthogonal, 0 and 90. XpYp is 45, XpYn is -45 degrees
num_rec=S.num_rec;
fNames={'X','Y','XpYp','XpYn'};
f... |
function y=quadeg4low(x)
%微积分例4下上界函数
%dblquad2使用
y=-sqrt(1-x.^2);
|
function newTracklet = interpolateTracklet( tracklet, gpParams, tracklets )
% Uses Gaussian process propagation to fill in gaps in tracklet.
trackletVelocities = getTrackletVelocities(tracklets);
trackletData = [tracklets trackletVelocities];
newTracklet = tracklet;
inds = find(newTracklet(:,1));
diffs = diff(ind... |
%% Example: Define and use a simple infinite-duration HMM
mc = MarkovChain([0.5; 0.5], [0.9 0.1; 0.05 0.95]); %State generator
g1 = GaussD('Mean', 0, 'StDev', 1); %Distribution for state=1
g2 = GaussD('Mean', 2, 'StDev', 3); %Distribution for state=2
h = HMM(mc, [g1;g2]); %The HMM
x = rand(h, 100); %Generate an output... |
function s = thecannon_now_string(sep)
% Written by: Bo Zhang (NAOC, bozhang@nao.cas.cn)
% Last modified: 21-Mar-2016
%
% Aim:
% - generate string of current moment
% Example:
% - s = now_string();
% - now_string
% INPUT:
% - sep: the speration character (default is '-')
% OUTPUT:
% - s: string o... |
load('SVMdata2.mat');
visualizeData(X, y);
Z=zeros(size(y,1),1);
pos1=find(y==1)
Z(pos1)=X(pos1,1).^2+X(pos1,2).^2+50;
plot3(X(pos1,1), X(pos1,2),Z(pos1),'g.','MarkerSize',10);
hold on
pos0=find(y==0);
Z(pos0)=X(pos0,1)/2+X(pos0,2)/2-10;
plot3(X(pos0,1), X(pos0,2),Z(pos0),'m.','MarkerSize',10);
%"m.","g."
%... |
function data = loadBinF(filename);
% load stored matrix as a float datatype
% matrix data(N,M) has to be stored in folowing format:
% __int32 N
% __int32 M
% float data (whole data block - stored consecutive rows)
fid = fopen(filename, 'rb');
if fid < 0
error(['Cannot open file ' filename]);
end
N = fre... |
% clear, clc
% % AERE311 HW 3
% % Question 1 ---------------------------------------------------------
y=1.4; m1=1;
% validation : m1=1; m2=1.435; p2p1=0.566;
theta1=asin(1/m1);
m2=1:0.01:3;
% find turning angle
c=-theta1-((sqrt((y+1)/(y-1)))*(atan((sqrt((y-1)/(y+1)))*(sqrt((m1^2)-1)))));
delta=c+asin(1./m2)+... |
function [ result, status ] = mdsvalue( expression, varargin )
% MDSVALUE evaluate an expression
% [ result, status ] = mdsvalue( expression, varargin )
info = mdsInfo();
n = nargin - 1;
if info.usePython
args = cell(n, 1);
else
if info.isConnected
extra = 0;
else
extra = 1;
end
ar... |
clear;clc;clf
ezplot('x^2*sin(x^2)/exp(x)',[0,10,-1.0,1.0])
%ezplot又比fplot更方便了
ezplot('x^3+4*x^2-3*x+1-y^2')
func_1='cos(2*t)';func_2='sin(6*t)';
ezplot(func_1,func_2,[0,pi]),... %參數繪圖
axis([-1.5,1.5,-1.2,1.2])
%屬性編輯區 |
function [ tpd ] = get_tpd3compTest( xp,XF,NC,T,P,Comp )
[DG_RT_XF, fug_f] = getDeltaG_RT( T,P,XF,NC,Comp,@solveGHC ) ;
[DG_RT_XP, ~] = getDeltaG_RT( T,P,xp,NC,Comp,@solveGHC ) ;
tpd = (DG_RT_XP - DG_RT_XF - sum((log(fug_f)).*(xp - XF)));
end
|
function [h]=m_pcolorKM(x,y,z,varargin);
% original m_pcolor function slightly modified by Karen McKinnon to center gridboxes on
% lat/lon points
% M_PCOLOR Makes a pcolor image on a map.
% M_PCOLOR(LONG,LAT,DATA,...) is a pseudocolor plot of matrix DATA.
% The values of the elements of DATA specify the color... |
clear all;
close all;
S = load('noisy_sound.mat');
s = S.noisy_sound;
fs = S.fs;
fi = 500;
N = length(s);
%sound(s);
figure;
plot(s);
k = fi * N/fs;
y = fft(s);
yy = y;
signal = 0;
for i = 1 : N
if(i> 250 && i < N - 249)
yy(i) = 0;
end
end
for i = 1 : N
signal = signal + (yy(i)... |
function flex_search_160525(dict, parms, raw, msk, priors)
% function flex_search_160525(dict, parms, raw, msk, priors)
%
% this function searches over a dictionary.
% inputs
% dict = dictionary to use in the search
% parms = corresponding parms to each dictionary entry
% raw = input data (image time ... |
% This script converts behavioral data to python-readable .mat files.
%% Load data
SD = load('/Users/lixiangci/Documents/MATLAB/ProAntiData/pa_sesstab.mat');
CD = load('/Users/lixiangci/Documents/MATLAB/ProAntiData/pa_celltab.mat');
SD = SD.sesstab;
CD = CD.celltab;
%% Collect pro anti and other data from original spi... |
function [predictedCov] = calcPredictedCov(COMFORTparams)
% Based on paper:
% COMFORT: A common market factor non-Gaussian returns model
% Paolella, Polak (2015)
% Journal of Econometrics
lambda = COMFORTparams.GIGparNext(1);
chi = COMFORTparams.GIGparNext(2);
psi = COMFORTpara... |
function [assigns,centroids,clusterval]=googkmeans(data, initWeights, num)
%randomly pick num centroids
M=size(data,2);
cids=randperm(M);
cids=cids(1:num);
centroids=data(cids);
%repeat until no change
flag=1;
oldassigns=ones(1,M).*(num+1);
while flag==1
%assign poi... |
% clear;
close all;
% clc;
%% 测试颜色迁移的代码
func = {'stpReinhard'; 'stpCorrelated'};
strs = {'Reinhard算法'; 'RGB颜色相关性算法'};
nMothods = length(func);
for i = 1 : nMothods;
[ srgb1, trgb1, outImg1] = feval(func{i}, 'data\\2.jpg', 'data\\10.jpg');
[ srgb2, trgb2, outImg2] = feval(func{i}, 'data\\4.jpg', 'data\\3.... |
%x是需要滤波的图像,n是模板大小(即n×n)
function d=avg_filter(x,n)
a(1:n,1:n)=1; %a即n×n模板,元素全是1
[hight, width]=size(x); %输入图像是hightxwidth的,且hight>n,width>n
x1=double(x);
x2=x1;
for i=1:hight-n+1
for j=1:width-n+1
c=x1(i:i+(n-1),j:j+(n-1)).*a; %取出x1中从(i,j)开始的n行n列元素... |
function plot_vf(vf, M, options)
% plot_vf - plot a vector field with
% an optional image in the background.
%
% plot_vf(vf, M, options);
%
% WORKS ONLY FOR 2D VECTOR FIELDS
%
% set options.display_streamlines=1 to display streamlines.
%
% See also: plot_tensor_field.
%
% Copyright (c) 2004 ... |
clc
clear
close all
I1=imread('Nautilus.pgm');
figure, imshow(I1,[0,255])
sd=2;
k_size=ceil(6*sd+1);
if rem(k_size,2)==0
k_size=k_size+1;
end
kernel = zeros(k_size,k_size);
mid=floor(k_size/2);
kernel=kernelfunc(sd);
s=sum(sum(kernel));
kernel=kernel./s;
I_blur = zeros(size(I1,1),size(I1,2));
for i=1:siz... |
function niu=GetKvisc(T)
%T-temperature
%calculate kinematic viscosity
niu=(1.785-0.0584*T+0.00116*T^2.0-0.0000102*T^3.0)*10^-6;
end |
% Base for Dimple parameterized message objects.
%
% These objects are used to represent distributions for use as
% variable priors and posterior beliefs.
%
% See also VariableBase.Prior
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2012-2015 Analog Devices, Inc.
%
% ... |
if ~exist('mcigncn1','var')
load mcigncn1
end
if ~exist('igncn1','var')
load igncn1
end
agemin = 0;
agemax = 3900;
nbins = 39;
plotmin = 0;
plotmax = 4000;
Elems={'K2O','Na2O','TiO2','P2O5','Al2O3','FeOT','MnO','MgO','Ni'};
yrange = struct;
% yrange.FeOT = [2,14];
% yrange.Ni = [0,350];
% yrange.P2O5 = [0.0... |
function end_fr = abi_atten2(initialrs, dbatten, spont_rate);
% ABI_ATTEN2 attenutate signal based on average loudness
% takes an input response surface (e.g. space test)
% and a set of attenutations for each point (same size
% matrix as response surface. For each point in the res... |
function SCOEFF=pls(h,p,W,P,R)
%PLS 求偏最小二乘法回归方程系数
%h 用于建模的主成分个数
%p 自变量个数
%W 模型效应权重矩阵
%P 模型效应载荷量矩阵
%R 因变量载荷量矩阵
%SCOEFF 偏最小二乘法回归方程的系数矩阵
for i=1:h
if i==1
WX(:,i)=W(:,i);
SCOEFF=WX(:,i)*R(:,i)';
else
I=eye(p);
ww=eye(p);
for j=1:i-1
ww=ww*(1-W(:,j)*p(:,j)');
... |
function [control_vals, drug_vals, rs_pval] = unity_plot( unity_struct, drug, current, unity_type, position_type )
control_vals = unity_struct.bestdir_ctrl_vals;
drug_vals = unity_struct.bestdir_drug_vals;
animal = unity_struct.animal;
signif_visfix = unity_struct.signif_visfix;
signif_attend =... |
function [index,a] = findCommonWords_pre_duet_post(sub,D,W)
%%
pre_index = find(D(:,1)== sub & D(:,2) == 1);
pre_word = W(pre_index,1);
post_index = find(D(:,1)== sub & D(:,2) == 6);
post_word = W(post_index,1);
duet_index = [];
for session = 2:5
temp = find(D(:,1)== sub & D(:,2) == session);
duet_index =... |
function d = LBCN_smooth_data(files,win_length, time_win, evtfile, twfield)
% Function to smooth the data using a Gaussian window.
% Inputs:
% - files : name of the .mat files to smooth
% - win_length : length of window to smooth on (in ms)
% - time_win : time window of signal to consider (avoid edges effects f... |
function w = computeWeightsPwls( sino, r , v)
% compute the weights for pwls algorithm
%
% Meng Wu at Stanford University
% 2013
w = single( ( sino - r ).^2 ./ (sino + v )) ;
w( sino <= r) = 0;
end |
function out = preprocess_flashlog(filename, ind0, batch_size)
% loads the flashlog given as an mat file and stores the data into blobs
% The data is resampled with a constant sampling time 20ms by using ZOH
%
% filename : mat file containing all the onboard data
% ind0 : ind0+1 is the index of the first outpu... |
% Example of Kalman filter
clearvars
% close all
% process simulation
% y = func_generateU(1000); % wrong
y = load('tar2.dat');
a = load('thx.dat');
N = length(y);
% State space equation definition
A = [1 0; 0 1];
Re = [10e-4 0; 0 0]; % Hiden state noise covariance matrix
Rw = 1.25; % Observation variance
% usually... |
function [ stack ] = rbm_twolayer( traindata , hiddendim )
%rbm_two layer RBM training for two layers given the training set
stack = [];
totalsamples = size(traindata,1);
minibatchsize = 100;
numepochs = 100;
numSGDsteps = 500;
cdsteps = 1;
epsilon = 0.1;
momentum = 0.5;
lambda = 0.00002;
numbatches = floor(... |
function seed_list = best_seeds_fast(c1,c2,b,num_seeds)
% Input: plane curves c1 and c2, metric parameter b, number of best seeds
% to take
% Output: list containing best seeds (of length num_seeds) without any
% reparameterization---just L2 dist in the transform space
[~,n] = size(c1);
% The first step perturbs th... |
cat1 = load('lab3_3_cat1.mat');
cat1 = cat1.x_w1;
cat2 = load('lab3_3_cat2.mat');
cat2 = cat2.x_w2;
cat3 = load('lab3_3_cat3.mat');
cat3 = cat3.x_w3;
h=2;
GivenX = [0.5 1.0 0; 0.31 1.51 -0.50; -1.7 -1.7 -1.7];
for datapoint=1:3
Prop = phiFunc2(GivenX(datapoint, 1:end), cat1,h);
fprintf('Data poi... |
function [velsig,rawsig,dx,dy] = PWvel_extract(data)
% Use imcrop to find region dimensions that will be used to crop image
% regions
figure(10);
[temp.imX,temp.imY,temp.imI,temp.imrect] =...
imcrop(data.PWDopp.images(:,:,:,1));
% Extract data set using imcrop dimensions
temp.PWDopp.PWsig = double(squeeze(mean(dat... |
function [thp,Tvp,rp] = fLRpar4(Te,pe,RH,col,hbl,z,dz)
%% BL height
tmp = abs(z-hbl);
bl2 = find(tmp==min(tmp));
%% Shift surface to top of bl if cp collision
if col==0
i0 = 1;
T0 = Te(i0);
RH0 = RH(i0);
p0 = pe(i0);
elseif col==1
i0 = bl2+1;
T0 = Te(... |
clear; close all; clc;
RootDir = '../../../Data/';
SubNames = {'DataSet1/' , 'DataSet2/'};
% MethodNames = {'CA', 'COV', 'DSR', 'FES', 'GR', 'ICVS', 'MC', 'PCA', 'RBD', 'SEG', 'SeR', 'SIM', 'SR', 'SUN', 'SWD'};
% You can chose these methods to produce SaliencyMap as follow.
MethodNames = {'PCA','SWD'};
RunDatasets(S... |
%% Gilad Hecht & Ronen Rahamim
% 29th June 2018
% Training the fully connected network that is the last stage of our
% classifier.
clear; clc;
warning('off', 'MATLAB:MKDIR:DirectoryExists');
%% Pick directories:
trainDir = uigetdir([], 'choose FCTrainTables directory');
validDir = uigetdir([], 'choose FCValid... |
tic;
format short g;
format compact;
%%
mpc = 'case118.m';
subset = 1:186;
%mpc = 'case9.m';
%subset = 1:9;
%%
clear m;
m.mpc = mpc;
m.subset = subset;
%m.gamma_max = 2.5;
%m.gamma_max = 8;
m.gamma_max = 5;
m.K = 3;
m.Lnorm = 1;
m.obj_type = 'angle';
m.opf_obj_mult = 0;
mpc = loadcase3(m.mpc);
n = length(m.subset);
... |
screen3 = ...
['While you make your choices, your zoo will grow. However, as manager of the zoo ',...
'you care primarily about the revenue it generates, rather than about the number ',...
'of animals you have. You know that visitors expect a good mix of animals, so ',...
'having only lions or only elephants will n... |
function rv = estimateRVcomponents(freq, useon)
if nargin < 1 || isempty(freq), freq = 5; end
if nargin < 2 || isempty(useon), useon = true; end
WRITETO = '.\results\';
FUNNAME = 'rvcomponents';
PATH2DATA = 'data\TAQ\sampled\5min\nobad_vw';
try
fname = matname(FUNNAME,freq, useon);
rv ... |
function [psdx] = sound_analysis(filename)
Fs=4000;
% Read data from text file in float format
fileID = fopen(filename,'r');
formatSpec = '%f';
x = fscanf(fileID,formatSpec);
% Filter the sound
%[b,a] = butter(3,([100/Fs,1999/Fs]));
%noise=filter(b,a,x);
%x=x-noise;
%Apply Four... |
%PSNR
function S=PSNR(Im_original,Im_modified)
if (size(Im_original)~=size(Im_modified))
error ('error:image sizes do not agree')
end
[m,n]=size(Im_original);
A=double(Im_original);
B=double(Im_modified);
sumaDif=0;
maxI=m*n*max(max(A.^2));
for u=1:m
for v=1:n
sumaDif=sumaDif+(A(u,v)-B(u,v))^2;
e... |
function X_norm = feature_normalize(X)
X_norm = X;
mu = mean(X);
sigma = std(X);
for i=1:size(X, 2)
X_norm(:, i) = X_norm(:, i) - mu(i);
X_norm(:, i) = X_norm(:, i) / sigma(i);
end;
|
function out = Passive_Calibration()
close all;
ET = tic;
rng('shuffle');
%% define experimental parameters
prompt={'Subject ID:',...
'Session ID:',...
'Group:',...
'Gender ("male" or "female")'};
name='Subject Information';
numlines=1;
defaultanswer={'APYC','Pitch_JND_Passive','Control','female'};
answer=... |
% The prime factors of 13195 are 5, 7, 13 and 29.
%
% What is the largest prime factor of the number 600851475143 ?
%
% A: 6857
function prob_003
big = 600851475143;
bigStore = big;
[pFacs, inds] = primeFactors(big);
sym(prod(pFacs .^ inds))
sym(big)
pList = primeList(1 + sqrt(big));
isPrime(big)
return
|
% This function reads the exported waveforms from LTSpice
% Written by Yutian Lei
% Output is a structure array that has three field, info, time and value
% Currently only works for a waveform file with a single waveform
% Currently only works for waveform file with multiple simulation steps
function y=read_ltspice_w... |
function [z1,z2,z3]=trimr(alpha_min, alpha_max, d_min, d_max,I_min,I_max, sampleupdate_alpha, sampleupdate_d, sampleupdate_I)
[row,col]=size(sampleupdate_alpha);
for i=1:col
sampleupdate_alpha(sampleupdate_alpha(:,i)<alpha_min,i)=alpha_min;
sampleupdate_alpha(sampleupdate_alpha(:,i)>alpha_max,i)... |
%% Geschw_Rand
function [u_EinAus,v_EinAus] = Num_1_Wirbelstroemung_GUI_Geschw_EinAus(U_EA,Nx,Ny)
u_EinAus = zeros(Ny,Nx);
v_EinAus = zeros(Ny,Nx);
for m = 1:1:Ny
for n = 1:1:Nx
if n == 1 % links
u_EinAus(m,n) = U_EA(1,1);
elseif n == Nx % rechts
u_EinAu... |
function [v_dw, mask_iris] = iris_detect_show(v_dw, z_top, z_bottom, nx, ny, nr, wx, wy, wr)
% 显示最终的检查结果
[ROI_row, ROI_col] = size(v_dw);
mask_iris = true(ROI_row, ROI_col); % 直角坐标系下的掩膜 0表示无效点,1为有效点
for ii = 1:ROI_col
if (round(z_top(ii)) <= 0) || (round(z_top(ii)) > ROI_row)
continue;
end
v_dw(... |
% Dispersion Relation for 2DEG STO
clear all;close all;clf
%
%
% Properties of Graphene Sample taken from:
% Palik,
% Far Infrared Dielectric Dispersion in BaTioģ SrTioģ and. Tio2
% W. G. Srix'zER, RoBERT C. MILLER) D. A. KLEINMAN) AND L. E. HowARTH
% Define frequency sweep
w = linspace(1e11,1e14, 2e3);
% w = 2*pi*li... |
function [decks] = importdecks(fileToRead1)
%IMPORTFILE(FILETOREAD1)
% Imports data from the specified file
% FILETOREAD1: file to read
% Auto-generated by MATLAB on 15-Jan-2016 07:55:40
% Import the file
tempData = importdata(fileToRead1);
for col=1:length(tempData.colheaders)
decks.(tempData.colheaders{col}... |
% Fucntion: Storage the transformation matrix of the needle-tip to ER frame
% Input: needle_dis_num, the distance number of the needle forward movement
% Output: rotm_ER2Ntip,the transformation matrix of the needle-tip to ER
% frame in different distance of the needle forward movement.
function rotm_ER2Ntip = get_r... |
function R = ang2mat(ang, order)
% Convert Euler angles to a rotation matrix.
%
% Input
% ang - angle vector that contains x y z components (in degree), 3 x 1
% order - rotating order (optional), {'zyx'}
%
% Output
% R - rotation matrix, 3 x 3
%
% History
% create - Feng Zhou (zhfe99@gmail.com)... |
%[r_delay, r_gain] = pdp_resample_reduce(delay, gain, T_0, T_i=10e-9, M=50)
%
% Computes a simplified channel model based on a method
% described in [1].
%
% [1] Ch. Mehlfuhrer and M. Rupp, "Approximation and resampling
% of tapped delay line channel models with guaranteed
% channel properties," IEEE Int. Co... |
function [ Num ] = CreateFVFromFolder(WPSeqFolder, OutputFVFolder,FeatureType )
%CREATEFVFROMFOLDER Summary of this function goes here
% Feature types:
% 1 - Angular
% 2 - Shape COntext
%Make sure the target folders exist or create them
res = exist(OutputFVFolder,'dir');
if (res==0)
mkdir(OutputFV... |
paths= localPaths();
rmpath('/home/rachine/VisualPlaceRecognition/urban_release/lib/LLC/Liblinear/matlab/');
run( fullfile(paths.libMatConvNet, 'matlab', 'vl_setupnn.m') );
addpath('/home/rachine/VisualPlaceRecognition/urban_release/lib/LLC/Liblinear/matlab/');
addpath( genpath(paths.libReljaMatlab) );
addpath( genp... |
% Driver script to show codegen, SWIG, and Python
cfg = coder.config('dll');
cfg.PostCodeGenCommand = 'pythonhook';
% For Python SWIG this must be named _<module> so _timestwo
codegen timestwo -args coder.typeof(1,[Inf,Inf]) -config cfg -o _timestwo.so
% Copy module library to Python folder so that code can find it
c... |
function [x_min,x_max,probabilite] = calcul_proba(E_nouveau_repere,p)
x_min=min(E_nouveau_repere(:,1));
x_max=max(E_nouveau_repere(:,1));
y_min=min(E_nouveau_repere(:,2));
y_max=max(E_nouveau_repere(:,2));
N=(x_max-x_min)*(y_max-y_min)
probabilite=1-binocdf(length(E_nouveau_repere),floor(N),p);
end
|
load('phoneticsLabels3.mat');
fileIDP = fopen('mapP.txt','w');
fileIDV = fopen('mapV.txt','w');
timePointer=2;
%%
for fileI = 1:size(fileNamesNew,1)
if(exist(fileNamesNew(fileI)))
videoLength=VideoSize(fileI);
load(fileNamesNew(fileI));
mouthLength=size(ROIs{1,1},2);
offset=videoLength... |
function h = fn_tensordisplay(varargin)
% function h = fn_tensordisplay([X,Y,]Txx,Txy,Tyy[,'sigma',sigma][,'sub',sub][,color][,patch options...]])
% function h = fn_tensordisplay([X,Y,]e[,'sigma',sigma][,'sub',sub][,color][,patch options...]])
% sigma1=temporal sigma, sigma2=spatial sigma
% sub1 and sub2: time and spac... |
function [ Pics,Lands,idx_sampled,Cluster_Data,neig_out] = Pic_ext( Data,t,landmark_id, samples, neighborsout )
%This function performs Pics clustering for the given dataset
%on the base of t (descriptors the same time are considered to belong to
%the same pic.
%indx creation
res = [diff(t') 1]; %one at the end for e... |
function segManCorrect(ActDataDescriptors, guiMode)
% segManCorrect GUI window for manually correcting the retinal layer
% positions.
%
% For a description of the functionality, please refer to the manual. The
% GUI is rather simple, so it itself may guide you through the code. Only
% thing a little bit more complicat... |
function ShowInvSubCondSym()
% Sensitivity of an Invariant Subspace of a Symmetric Matrix
% GVL4: Section 8.1.3
clc
fprintf('Sensitivity of an Invariant Subspace of a Symmetric Matrix\n\n')
n = 100; r = floor(n/2);
fprintf(' dist(ran(Q1),ran(tildeQ1))\n')
fprintf(' sep(D1,D2)... |
% ina.m
% Sodium channel
%
% modeled after Mahon and WB96 (with offset 7mV)
% using m,h and \infty formulation
% returns also steady-state values
%
% $Revision:$
%
function [I_Na, dm, dh, m_inf, h_inf,tau_m, tau_h] = ina_WB96(V_m, m, h)
E_na = 55; % mV
g_na = 35; % mS/cm^2
al_m = mylinexp(V_m, 0.1, -35+7, -10... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.