text stringlengths 8 6.12M |
|---|
function [clusterNames,reorderClusters,clusterNamesSort,net7angle] = NAME_CLUSTERS_ANGLE(centroids)
%Provide names for clusters based on angular distance to binary Yeo
%System Vectors
%returns vector where 1 indicates a "+" state and 0 indicates a "-" state
%centroids = kClusterCentroids;
[nparc,numClusters] = size(c... |
% by MCR Laboratory, 20170319
% modified by Norika, then modified by Kevin
close all; clear all; tic;
dsr = 30;
INPUT_DATA = csvread('DOWN_Plot_and_Store_Combined.csv',0,0) ;
down_data = load_data(INPUT_DATA);
INPUT_DATA = csvread('UP_Plot_and_Store_Combined.csv',0,0) ;
up_data = load_data(INPUT_DATA);
INPUT_... |
clear global
clear all
clc
close all
addpath(genpath('../lti_toolbox'));
%% 1. Connecting an augmented plant
% Consider the system G for which we want to design a feedback controller
% K using a Hinf methodology. Two weights are being applied, MS (maximum
% sensitivity) and WT, a robustness weight.
% Now we can sta... |
cmax = 50;
kvect = -cmax:cmax;
N = length(kvect);
coef = zeros(N,1);
h2=figure;
for j=1:N
k = kvect(j);
if mod(k,2) == 1
coef(j) = (2*A) / (1i*pi*k);
end
end
stem(kvect, abs(coef)); |
clear;clc;
r = 1;
numOfSec = 1000;
t = 2*pi*linspace(0,numOfSec-1,numOfSec)/numOfSec;
x = r*cos(t);
y = r*sin(t);
l = sqrt(x.*x + y.*y);
t2 = extractTheta(x,y,l); |
function [Sg, Mg] = stiff_global_gauss(M, regions, order, bforder)
gaussdata;
if nargin < 4
bforder = 2;
end
if nargin < 3
order = 6;
end
G = GAUSS{order};
X = G(:, 1); Y = G(:, 2); W = G(:, 3);
% Number of gauss points
npoints = length(W);
nfun = 3 * bforder;
CSe = cell(M.num_triangles, 1);
CMe = cell(M.num_tr... |
%Prblem 11 Add GWN
clc;clear;close all;
%% 4ASK mapping
b=[0 0 0 1 1 1 1 0];%input
a=fourASK(b);
%% modulator
Ts=0.002;T0=Ts/10;
t=0:T0:Ts*(length(a)+1);
x=modu(a,Ts,t);
%% add GWN
varinoise=1;
y = x+sqrt(varinoise)*randn(size(x));
%% after receive filter
p = @(t) rect((t-Ts/2)/Ts);
tp = 0:T0:Ts;
h = p(T... |
function rangeOnce(addr, numChirps)
global TESTBED
global RANGE_ONCE
%LOOP INITIALIZE
if nargin>0
%parse parameters
if nargin<2 | isempty(numChirps) numChirps=4; end
%initialize state machine state
if strcmp(addr,'all')
state.addr= TESTBED.id;
else
state.addr=addr;
end
state.index=1;
... |
clc;
clear;
data = load('var.csv');
c = randperm(39644);
X = data(c(1:3000), :);
Y = X(:,end);
X = X(:,1:end-1);
% X = X';
% [U,S,V] = svd(X);
% a = sum(sum(U*S*V' - X));
% Xm = U(:,1:50)' * X;
m1 = mean(X);
X = X - m1;
m2 = max(X);
X = X ./ m2;
rankX = rank(X);
A = [X, ones(3000,1)];
rankA = rank(A);
% res = zeros(... |
% analyze_hVd.m
%
% Purpose: Return vowel confusion matrices for all noise conditions.
% Call with [C,cor] = analyze_hVd(subjname, subjnum, HAnum)
%
% Input: subjname (string), subjnum (string), HAnum (string)
%
% Output: C (cell), cor (double)
%
% Note: I have verified that this function works as it ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% The purspose of this code is to %%%
%%% (1) Read a .mat file containing normalized intensities from a
%%% multi-chan... |
function out = incoherent_PSF_Gaussian(sfIdx,sfCutoff,beamFWHM,k,z)
CTF = create_gaussian_circular_CTF(sfIdx,sfCutoff,beamFWHM,k,z);
CSF = ifft2(ifftshift2(CTF));
out = fftshift2(abs(CSF).^2); |
% Runs Pareto's Optimum and NE simulations
global par; % parameters
parameter_set; % setting the parameters
%% Pareto's optimum simulation
pareto_payoff_mean = zeros(par.pl,par.n_iterations_pareto);
for i=1:par.n_iterations_pareto
par.plTy = round(rng_from_pdf(par.typePDF,par.pl)); % assigning types
par.players... |
function Y = dstn(X,N)
% discrete sine transform along dimension N
% Y = dst(X,N)
% discrete sine transform along dimension N of X
n = size(X);
% permute dimensions N <-> 1
p = 1:length(n);
p(N)=1; p(1)=N;
Y = permute(X,p);
% pad dim 1 by zeros and collapse the others
m = size(Y);
mm = prod(m)/m(1);
Y = res... |
function rhs = hw2_shoot(xspan,x,y,dummy,eig)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
rhs = [y(2),; (x.^2-eig).*y(1)]
end
|
%% claculate small-worldness of averaged competitive/cooperational network
% clear all; close all;
% addpath('D:\work\eeg\2PersonPongGame\SmallWorldNess-master');
% load('data/useful/conn/conn_power','conn_power');
% load('data/useful/conn/conn_power_2','conn_power_2');
% load('data/useful/conn/power_all','power_all');... |
%function [snd,fs] = sound2_(filename)
filename = 'little_prince.wav';
[snd2,fs2] = audioread(filename);
sound(snd2,fs2);
clear sound
|
function ans = sig_mult3()
n0 = 3;
n1 = -3: 2: 17;
n2 = -9: 3: 19;
n = min(min(n1), min(n2)) : 2: max(max(n1), max(n2));
y1 = zeros(size(n));
y2 = zeros(size(n));
y1 = [ (n - n0) >= 0];
y2 = [ n > 0];
y = y1 + y2;
plot(n, y); |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This program is written to filter out the measurement errors.
% The errors are filtered out using Extended Kalman Filter.
% The program generate states with synthetic noise and then sensors readings are used to estimate these states back.
% Th... |
function obj = plot(obj,varargin)
Args = struct('LabelsOff',0,'GroupPlots',1,'GroupPlotIndex',1,'Color','b');
Args.flags = {'LabelsOff'};
[Args,varargin2] = getOptArgs(varargin,Args);
if(~isempty(Args.NumericArguments))
n = Args.NumericArguments{1};
% plot one data set at a time
hist(obj.data.psparse(:,n))
if(~A... |
function [ image ] = ReadTIFFStack( filename )
%READTIFFSTACK reads a .tif image stack in 3D matrix format
%Input:
% <filename> image stack (.tif)
%Output:
% <image> 3D matrix
%CL
% Get file information
imginfo = imfinfo(filename);
m = imginfo(1).Width;
n = imginfo(1).Height;
nimg = length(imginfo);
imag... |
function v = cellValues(c)
% Return all the cell values in one big numeric array
%
% Example:
% cellValues({1,2,3,{4,5,6,{7,8,9,{10,11,12}}},13,14,{15,16,{17,18,19}}})'
%ans =
% 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
if ~iscell(c),v ... |
clear all;
clc;
load net
voicePath='D:\OneDrive - agu.edu.tr\Documents\MATLAB\Bionluk\voice_recognizer\esra\voice2.m4a';
voicePath2='D:\OneDrive - agu.edu.tr\Documents\MATLAB\Bionluk\voice_recognizer\news\news1.mp3';
voices = zeros(1,1872);
[y,Fs] = audioread(voicePath);
d=fdesign.highpass('Fst,Fp,Ast,Ap',8700/16000... |
function [P] = calculate_CSR_cluster(spImage,j,lowestPresence,numSimulations,dist)
%find ions coordinates on an image
[x y ] = find(spImage(:,:,j)>0);
if (size(x,1)>lowestPresence)
coordinates = [x y];
%calculate... |
function [mean_z,mean_z2,upp_bound] = Algorithm3(T,s,Com_G,a_star,H,test_no,sigma,N,b)
%UNTITLED10 此处显示有关此函数的摘要
% 此处显示详细说明
[rho_m,h_M,alpha_1,alpha_2,s_m,alpha] = parameter_check1(H,Com_G,N, s);
mean_x = zeros(N,N,T);
mean_y = zeros(N,N,T);
mean_z = zeros(N,N,T);
mean_z2 = zeros(1,N,T);
%test_no = 1;
%... |
eventNameList = {'Lift','Grab','Sup','Atmouth','Chew','Sniff','Handopen','Botharm',...
'Tone','Table','Failure','Success', 'Trying','failure+1','success+1','nopellet', 'Lick', ...
'Regular', 'sucrose','Quinine', 'Sucrose S','Sucrose F' 'BackToPerch' ...
'Failure Perch' 'Success Perch' 'T-Failure','P-F... |
function out1 = hess_grf_ceq_heel2222(in1,toe_th,dmax,cmax,k,us,ud)
%HESS_GRF_CEQ_HEEL2222
% OUT1 = HESS_GRF_CEQ_HEEL2222(IN1,TOE_TH,DMAX,CMAX,K,US,UD)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 23-Jun-2020 09:33:59
out1 = 0.0;
|
function [minx,minf,x_t,f_t,S_k] = FW_crowd_swap(x_0, S_0, alpha_0, A, b,Aeq, Beq, opts)
% x_0 : variable initialization
% S_0 : active set initialization
% alpha_0 : weight initialization
% A : the matrix in the cost function of the QP
% b : is the vector of the linear cost functions
%max_step = 1;
it =... |
% Solve a Pattern Recognition Problem with a Neural Network
% Script generated by Neural Pattern Recognition app
% Created Fri Dec 11 15:12:46 EET 2015
%
% This script assumes these variables are defined:
%
% wineInputs - input data.
% wineTargets - target data.
clear all;
[x,t] = wine_dataset;
% x = wine... |
% ------------------ Georgios Etsias 17th March 2020 ----------------- %
% Script pre-processes experimental data to be used in NARX training
% Pre-processes the data from bus 2 (onl the data sets of drivr cycle 2)
% Input varibles: 3, Output variables: 1, Nmber of times-series: depending
% Final product is a train... |
close all;
clear all;
%Prameters
M_B_ratio=4;lambda_b=0.002;M_avg = 50;
B_avg=M_avg/M_B_ratio;lambda=lambda_b*M_B_ratio;
L=6;a=2;K=4;
SNRdB_rng=-30:10:60;noise_var_vec=10.^(-SNRdB_rng/10);
Num_of_runs = 1;Num_noise_var = length(noise_var_vec);
N=K*L;
%dbstop in ReceiverDesign
% All_SINR = zeros(Num_of_runs,M,N+1,Num_n... |
function xinit = get_xinit(track,yall)
% Copyright (c) 2003-2004 Songhwai Oh
global G
vtrack = find(track>0);
xinit = zeros(4,1);
if length(vtrack)>1
d = vtrack(2)-vtrack(1);
xdelta = [yall{vtrack(2)}(track(vtrack(2)),1)-yall{vtrack(1)}(track(vtrack(1)),1),...
yall{vtrack(2)}(track(v... |
%% ECE 311 class demonstration, magntidue spectrum, phase spectrum
% Chao Ma
%
clear all;
close all;
clc
fignum = 500;
%% load and dispaly an image
Im = imread('cameraman.tif');
figure(fignum);
imagesc(Im);
colormap(gray(256));
axis image off;
fignum = fignum + 1;
%% Calculate the fft of the image
s = fftshift(fft2... |
classdef PeakDecimalFractionFilter < PeakFilter
properties (Constant)
Name = 'Peak Decimal Fraction';
Description = '';
ParameterDefinitions = [ParameterDescription('Minimum', ParameterType.Double, 0.2), ...
ParameterDescription('Maximum', ParameterType.Double, 0.9)];
... |
mNew = [0 1 2 3];
f_init = [0:4000]./1000;
f1_m = fo + mNew.*fs;
G_f_init = sin(pi.*f_init.*Tsample)./(pi.*f_init.*Tsample);
Gf1_m = sin(pi.*f1_m.*Tsample)./(pi.*f1_m.*Tsample);
figure()
stem(f1_m,abs(Gf1_m),'filled');
hold on;
plot(f_init, abs(G_f_init), 'g', f_init,abs(Hpost(f_init)), 'k', f_init,abs(Hpost(f_init).... |
function [ output2d ] = flatten( input3d )
%flatten
% input 3d block, convert to 2d image
output2d = zeros(200, 320);
h = 40;w = 320;
flatten = input3d(:,:);
for i = 1:5
output2d(h*(i-1)+1:h*i, :) = flatten(:, w*(i-1)+1:w*i);
end
min_im = min(output2d(:));
max_im = max(output2d(:));
output2d = (output2d ... |
mov = VideoReader('videos/vid1.MKV');
vidFrames = read(mov);
for frame = 1 : size(vidFrames, 4)
outputBaseFileName = sprintf('%3.3d.png', frame);
outputFullFileName = fullfile(outputFolder, outputBaseFileName);
imwrite( vidFrames(:,:,:,frame), outputFullFileName, 'png');
end |
function y = oddball(stimuli, soamin, soamax, totalstim, probs, minstim, filename, codes, format)
% ODDBALL Produces a sequence file using the Oddball paradigm
%
% ODDBALL(stimuli, soamin, soamax, totalstim, probs, minstim, filename, codes, format)
%
% stimuli a cell containing the stimulus names
% ... |
function [ephys_trace, sensor_trigger_vec, sensor_reward_vec, reward_signal_vec, reset_signal_vec, tone_vec] = ...
labelAbfWavesEphys(trainingsettings, ABF, mouseID, sensor_th, tone_th)
% labelAbfWaves appropriately labels waves of the ABF file depending on the
% training protocol settings
ephys_trace = ABF(:,1);
... |
function x = exam_4
dt = [pi/5, pi/10, pi/20];
u0s = [1 0 -1 0];
%Explicit Euler:
g1=1;g2=2;
n = (20*pi)./dt;
x(:,1) = u0s';
hold all;
for i=1:3
for t=2:n(i)
div1 = (x(1,t-1) - x(2,t-1)).^2 + (x(3,t-1) - x(4,t-1)).^2;
div2 = (x(2,t-1) - x(1,t-1)).^2 + (x(4,t-1) - x(3,t-1)).^2;
x(1,t) = x... |
function sd = sd_fun(omega,Theta_Wold)
% Spectral density of moving average
% preparations
hor = size(Theta_Wold,1);
% derive Theta(omega)
Theta_aux = 0;
for l = 1:hor
Theta_aux = Theta_aux + squeeze(Theta_Wold(l,:,:)) * exp(-1i * omega * l);
end
% derive final result
sd = Theta_aux * ctranspose(Theta_aux);
en... |
function prettyprt(results)
% Now pretty print things
fprintf('\nBenchmark statistics:\n');
numbm = size(results,1);
fprintf(['\nbm mix max | mean(p) median(p) std(p) var(p) | '...
'mean(phat) median(phat) std(phat) var(phat)\n']);
for i = 1:numbm
h = figure;
bmname = re... |
% making a bunch of random modulations because this takes forever
clear
fs = 44100;
bp_mod_fo = 1/2 * 5 *fs;
n_mod_cuts = [2 10]
tlen = 1;
t = 0:1/fs:tlen-1/fs;
bp_filt_mod = fir1(bp_mod_fo, n_mod_cuts * 2/fs,'bandpass');
% for i = 1:300
% noise_mod_i = randn(1, 1.5*length(t)+bp_mod_fo+1);
% noise_mod_i = fil... |
clc
clear all
close all
a=imread('babyincradle.png');
%perform histogram equalization
b=histeq(a);
subplot(2,2,1),imshow(a),title('original image'),
subplot(2,2,2),imshow(b),title('After histogram equalization'),
subplot(2,2,3),imhist(a),title('original histogram')
subplot(2,2,4),imhist(b),title('After histogr... |
function [success] = saveNeurodataWithoutBorders(image_masks,roi_response_data,algorithm,outputFilePath,varargin)
% Takes cell extraction outputs and saves then in NWB format per format in https://github.com/schnitzer-lab/nwb_schnitzer_lab.
% Biafra Ahanonu
% started: 2020.04.03 [16:01:45]
% Based on mat2nwb in htt... |
% 离散傅里叶变换:输入 N_t采样点数,X_t采样值,Fs 采样信号
% N
% X(k) = sum x(n)*exp(-j*2*pi*(k-1)*(n-1)/N), 1 <= k <= N.
% n=1
function freq = my_DFT(X_t)
N_t = length(X_t);
% matlab的数组最小值从1开始,所以需要变化一下。
W = exp(-1j*2*pi/N_t);
X = zeros(1,N_t);
for k = 1:N_t
for n =... |
% cd \Users\lf.rosalesm\Desktop\matlab_codes
UsingZeroInvestment
%%%%%%%%%%%%%
% question 1:
%%%%%%%%%%%%%
% is it possible to do better than wt_vec? by selecting another mixture?
% Assume: Parameters Knwon
CONSTs = (1/GAMMA)*(MUg/SIGMA2g);
UTILs = calU(CONSTs*wg_vec+wh_vec, mu_vec, sigma_mat, GAMMA);
const_v... |
imagesc(reshape(PhiTTT(:,245),20,20))
%%
figure(2)
DM3=pdist(PhiFFF,'correlation');
DM1=pdist(ChiFFFAft,'correlation');
[~,IX]=sort(DM3,'ascend');
plot(DM3(IX))
hold on
plot(DM1(IX),'red')
hold off
%%
DensCa1Aft=zeros(400,1);
DensCa1Bef=zeros(400,1);
DensCa3=zeros(400,1);
Cut=0.5;
PhiTTTCut=PhiTTT;
PhiTTTCut(PhiTT... |
function [psi_new, theta] = optimisePsi(y, A, x, psi_init, theta, k, step_size, num_iters, N, Q)
psi_new = psi_init;
for p = 1:num_iters
psi_prime = psi_new;
psi_prime(:,[k (Q*N/2 + k)]) = psi_prime(:,[(Q*N/2 + k) k]); %% Need to be checked if the update equation gets changed
% Minor sa hi change hoga
... |
% Proj #3--------JL lemma
% theoretical lb= 426.3
% Xiang
d=10000;% data dimension
n=100;
X=randn(d,n);%% d*n each column correspnods to a point x
L=zeros(n,n);% original dist. matrix
L_1=zeros(n,n);% dist. after projection
for i=1:n-1
for j=i+1:n
L(i,j)=norm(X(:,i)-X(:,j))^2;
end
end
... |
function y = mag_phase(x)
y.mag = sqrt(power(x.real,2)+power(x.imag,2));
y.phase = atan2(x.imag,x.real);
end
|
function [ x , y, dgr, radius ] = findrandomxy(total )
dgr = zeros(1,total);
x = randi([200 18200],1,total); %generating random x-coordinate values
y = randi([200 580],1,total); %generating random y-coordinate values
% ddgr = randi([100 total], 1, total);
radius = zeros(1,total);
temp = randi([200 200],1,total... |
%% Load calibration from file
set_paths;
% intrinsic parameteres
KK = struct2array(load(calib_resuls_filename,'KK'));
kc = struct2array(load(calib_resuls_filename,'kc'));
n_ima = struct2array(load(calib_resuls_filename,'n_ima'));
Rc = cell(n_ima,1);
Tc = cell(n_ima,1);
iPt = cell(n_ima,1);
wPt = cell(n_ima,1);
for ... |
%% Josh Barrios 11/26/2018
% For each cell, pulls out all recorded traces, finds relevant stim or
% behavior triggers, and presents data. Requires "behaviorDataAll" and
% "fluoDataAll".
% 2p frame where the stimulus happens
stimFrame = 552;
% number of 2p frames per movie
frameNum = 586;
fishNums = str2double(fluoDa... |
clear all; home;
%% Load the data
%dataSetFolder = fullfile(fileparts(which(mfilename)), '..' , '..', 'data', 'set-2', 'roll-and-tilt-at-45-90');
%dataSetFolder = fullfile(fileparts(which(mfilename)), '..' , '..', 'data', 'set-2', 'unmoved-with-x-pointing-forward');
%dataSetFolder = fullfile(fileparts(which(mfilename)... |
% Student Name: Sarah Bland
% Program Name: SWAS_P_WY.m // PROGRAM #3
% Description: Opens and analyzes precipitation (P) data for 4 SWAS sites in the
% Shenandoah National Park by WATER YEAR.
%
% NOTE: Water year is defined for all SWAS sites as being from the final
% 1/4 of calendar year A through 3/4 of calendar y... |
classdef arbFcn < qes.waveform.waveform
% Arbitary fucntion waveform
%
% Copyright 2016 Yulin Wu, USTC
% mail4ywu@gmail.com/mail4ywu@icloud.com
properties (SetAccess = private, GetAccess = private)
timefcn
freqfcn
end
methods
function obj = arbFcn(ln,timefcn,freqfcn)
... |
function [ans] = modulus(a,b)
x = a;
while(x>=b)
x=x-b;
end
ans = x; |
% 2.12
clear all
clc
h = 10;
[~,~,~,rho] = atmosisa(h);
SingleRotorHelicopter = Helicopter();
%% private 属性设置
Prop = Propeller();
Prop.a_0 = 5.7;
Prop.b = 4;
Prop.c = 0.2042;
Prop.delta = 0.008;
Prop.h_R = 0;
Prop.rho = rho;
Prop.s = 0.2;
Prop.theta_t = deg2rad(... |
Ra=0; Xs = 9; Zs = Ra + j*Xs;
S = 40 + j*30; V = 30/sqrt(3);
Ia1 = conj(S)*1000/(3*conj(V));
Ia1M = abs(Ia1), Ia1ang=angle(Ia1)*180/pi
E1 = V + Zs*Ia1*0.001;
E1M = abs(E1), delta1 = angle(E1)*180/pi
disp('(b)')
P = 25;
delta2 = asin(P*Xs/(3*abs(E1)*V)); delta2d = delta2*180/pi
E2 = E1M*(cos(delta2) +j*sin(delt... |
function dh_params = define_dh_for_puma(theta)
dh_params = [
pi/2, 0, theta(1), 76;
0, 43.23, theta(2), -23.65;
pi/2, 0, theta(3), 0;
-pi/2, 0, theta(4), 43.18;
pi/2, 0, theta(5), 0;
0, 0, theta(6), 20
];
end |
clear all, close all
load('kernel_Maha_RBFslow_eye-init2')
plot(test_mAp)
figure
plot(train_mAp)
figure
plot(loss)
load('kernel_Maha_RBFslow_eye-init_param_')
figure
imagesc(squeeze(L_matrix(3, :, :)))
colorbar |
function [time, H, sensors, Rinv_DGCN]=F_sensor_DGCN(U,Un,Sn,p)
[n,r]=size(U);
tic
[sensors,Rinv_DGCN,~]= F_sensor_DGCN_r(U,Un,Sn,min(p,r));
if p>r
[sensors,Rinv_DGCN,~]= F_sensor_DGCN_p(U,Un,Sn,p,sensors,Rinv_DGCN);
end
time=toc;
[H] = F_calc_sensormatrix(p, n, sensors);
... |
%% Van der Pol equation - numerical solution
%
% y'' - mu (1 - y^2) y' + ws y = 0
%
prompt = {'Enter \mu value','Enter \omega_s value','Enter integration interval t_i:','Enter integration interval t_f:','Enter initial condition y(t_i):','Enter initial condition y \prime (t_i):'};
dlgtitle = 'Input';
dims = [1 5... |
function [ model, knnErr ] = FuncTrainKNN( U, Ltrain, K_range )
if nargin == 2; K_range = 1:20; end
% == Cross-validate KNN
cvErr = ones(length(K_range), 1); % cross-validation errors
for k = 1:length(K_range)
cvmodel = ClassificationKNN.fit(U',Ltrain,'NumNeighbors',K_range(k),'KFold',10);
cvErr(k) = kfoldLos... |
%% Fakrul Islam Tushar, MAIA-2018
%% Sort images from different directories and
%% compare the index value from the groundtruth and image folder
%% Move the common name images to the Desitination folder
%%
gdt_folder = 'G:\javaAgaintry\gdt_tn'; % Enter name of folder from which you want to upload pictures with full... |
function [ spread0, spTicks ] = pairSpread(ticks1, ticks2, type, timeType, commonTime)
%PAIRSPREAD 算两个ticks之间的配对spread,ticks1-ticks2
% [ spread0, spTicks ] = pairSpread(ticks1, ticks2, type, timeType, commonTime) 输入:
% type 1-限价单(默认,bid1,ask1); 2-市价单,last相减,要额外算slippage
% timeType 时间对齐的方式,
% ... |
function DS_ana_bar
animalid = '150120';
blocks = [3,6,9,12,17,20];
lcol = 'r';
onlymod = 0;
sfc = 0;
basepath = ['C:\Users\Julia\work\data\' animalid '\'];
supath = [basepath 'singleunits\'];
basename = [animalid '_block' int2str(blocks(1)) '_tet'];
files = dir([supath, basename, '*.mat']);
prestim = 300;
poststi... |
function [ii_ims] = LoadImDataDir(dirname, varargin)
imagefiles = dir([dirname, '/*.bmp']);
nfiles = length(imagefiles);
if (length(varargin) > 0)
nfiles = varargin{1};
end
ii_ims = [];
for i=1:nfiles
currentfilename = [dirname, '/', imagefiles(i).name];
[~, ii_im] = LoadImage(currentfilename);
ii_ims... |
%%Frequency with max P/N
%counting the rows where no P/N is given
count=1;
Empty_PeakNotch_row=[];
for i= 1:length(Mario4_GMM_Table.ChNum)
row=Mario4_GMM_Table.ChNum(i);
center_peak=round((Mario4_GMM_Table.startsegment(i)+Mario4_GMM_Table.endsegment(i))/2);
colstar=center_peak-208;
colend=center_peak+208;
L=leng... |
% Test push_recovery
% Information of holes is considered when 1D planning
%% run Initial.m first.
close all; clear all; clc;
load ts
global A B
%% Initial Condition (Push)
fig = figure(1);
gnd.visual_holes(fig);
hold on;
disp('Please select the initial value of x_1 & x_2 on the plot:')
title('Please Select Initial ... |
function y = fx(a,H,x)
y = (a')*x + 0.5*(x')*H*x ;
end |
function harmonies = create_harmonies(partials, cstart, cend, energy_thresh)
harmonies = [];
%figure
%hold on
%cluster
y_scale = 3;
[idx,C,k_clusters] = auto_kmeans([[partials.start_time].' [partials.end_time].'/y_scale], cellfun(@median, {partials.amps}).');
C(:,2) = C(:,2) * y_scale;
C = C + cstart;
ignore_ks = zero... |
function mu_all = calc_mu_all(mu_jk, K_all)
% mu_all is B by M by K1
[~,B] = size(mu_jk{1});
[K1,M] = size(K_all);
mu_all = zeros(B,M,K1);
for i = 1:K1
for j = 1:M
mu_all(:,j,i) = mu_jk{j}(K_all(i,j),:)';
end
end
end
|
function Theta = Leg_IK(xyz,L)
%Inverse kinematic model of leg, with angles theta(1;2;3)
% L0: horizontal distance between the second joint (up down on hip)
% and the end effector
% D: absolute distance between the second joint (up down on
% hip) and the end effector
% Alpha: i... |
function [errorCode,errorMsg,packet] = queryCombiFuture(self,marketNo,stockCode)
%QUERYCOMBIFUTURE 在CounterHSO32中重新包装函数QueryCombiAsset
% --------------------------
% 朱江,20160316
connection = self.connection;
token = self.token;
accountCode = self.accountCode;
combiNo = self.combiNo;
[errorCode,errorMsg,pa... |
function bin = dec_to_bin(x)
s = ' ';
if(x < 0)
s = '-';
x = -x;
end
xint = floor(x);
xdec = x - floor(x);
cbd = [];
cad = [];
while(xint > 0)
c0 = mod(xint,2);
xint = (xint-c0)/2;
cbd = [num2str(c0) cbd];
end
while(xde... |
function J = hessian(A, x)
% Hessian of the symbolic expression
assert(isvector(A), 'The symbolic expression must be a vector.');
assert(isa(x,'SymVariable'), 'The second argument must a list of symbolic variable.');
assert(isvector(x), 'The second argument must be a vector.');
%... |
if ~size(whos('args'),1)
construct_tract;
args.final_theta = final_theta;
args.shape = shape;
end
new
make_tract_normalised(args)
save_script('vocalys.mlys')
%playing_frequency(50,.7);
%reset_time();
send_message('noise-level',0.1);
send_message('midi-note-on',[1 48 35])
%send_message('gamma',1.5,1.5)
run(.... |
% A script that runs a semiimplicit and an implicit method on the Burgers
% equation.
h = 1/100;
T = 1;
k = 1/200;
c = 1;
x = transpose(0:h:2*pi);
f = sin(x);
g = cos(x);
% u = leapfrog(f, g, T, k, c);
u = newmark(f, g, T, k, c); |
%% The code used convert mat to avi for traning deep neural networks.(Now we have total 160 clips for 4 classes, maybe we need more for training)
%% QiangLI, Valencia, Spain
clear; clc;
for small_clip =1:160
%% clear video writing
Vedio_clear = VideoWriter(['/media/disk/databases/BBDD_video_image/statis... |
function xy = xymean1v2 (x, y, t)
%% xymean1 assumes delta t throughout t is constant
% Inputs: x, y, t - column vectors of dimensions n x 1
% Output: xy - scalar mean of xy
% Checks
if (length (x) ~= length (y));
error ('x and y do not have the same size')
end
if (length (x) ~= length (t));
error... |
%EXsparsity Example script, deblurring without and with sparsity
% Silvia Gazzola, University of Bath
% Per Christian Hansen, Technical University of Denmark
% James G. Nagy, Emory University
% April, 2018.
% clear workspace and window.
clear, clc
% Choose if you would like to see the results displayed in a single ... |
function [J] = Jcol(T)
% Return pos and orientation from Jacobean (solved by numarical approach)
% Arguments
% @T - (4x4) - Homogenious matrix
% Results
% J - (1x6)
% Examples
% J = Jcol([1 0 0 0; 0 1 0 0; 0 0 0 1; 0 0 0 1])
%% Validate input arguments
if sum(isnan(T)) == 0
validateattributes(T,{'double','sym'},{'... |
function y = grainSh(x,init,L)
% extract a short grain
% x input signal
% init first sample
% L grain length (in samples)
y=x(init:init+L-1).*hanning(L)'; |
function obj = getObj_ML_Ridge(X, Y, scoreObj, obj)
if nargin < 3 || (isa(scoreObj, 'double') && isnan(scoreObj))
scoreObj = struct();
end
if nargin < 4
obj = struct();
end
obj = reg.getObj(X, Y, obj);
obj.fitType = 'Ridge';
if ~isfield(obj, 'wML')
obj.wML = nan;
... |
clc;
clear all;
close all;
%% DATOS
mu = 398600; % km^3/s^2
J2 = 1.083e-3;
rE = 6378; % km
i = deg2rad(98.5); % rad
i = deg2rad(98.6); % rad
e = 0;
%% Apartado A
% Altura: despejando de desviacion RAAN
Omegap_Sol = 2*pi/( 365.2411984 * 24 * 3600 ); % rad/s
a = (-( 3*J2*rE^2*co... |
function dnaseq = protein2dnaOptimized(aaseq)
fid = fopen('codons.csv');
textscan(fid, '%s %s %f', 'delimiter', ',');
codondata = textscan(fid, '%s %s %f', 'delimiter', ',');
aaNames = codondata{1};
aaCodon = codondata{2};
codonFreq = codondata{3};
currentPosition = 1;
dnaseq = [];
%aaseq='ArgGlnLysArgTrpArgSe... |
function [ uv, geo_dists, options_cache ] = expmap( points, normals, vtx, options )
% [ uv, geo_dists, options_cache ] = expmap( points, normals, vtx, options)
% compute discrete exponential
% points, normals are lists of points and normals
% vtx is vertex you want expmap around (arbitrary points not supported)
% ... |
%CONSTANTS and initial values
M = 200; % number of vertical & horizontal intervals M=N
psi_initial = ones(M+1,M+1);
zeta_initial = ones(M+1,M+1);
zeta_initial(:,1)=0;zeta_initial(:,M+1)=0;zeta_initial(1,:)=0;zeta_initial(M+1,:)=0;
k = 1/M; % h=k
epsilon = 1e-4;
Re_start = 1;
Re_final = 13;
% boundary for psi = stre... |
function hex = dec2hex(dec)
% Convert decimal number ranging from 0-255 into a two digit hexadecimal
% number
% Converts one number at a time
HEXi = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'];
first_digit = floor(dec/16);
second_digit = rem(dec,16);
hex = [HEXi(first_digit+1), HEXi(second_dig... |
clear all
close all
clc
%system parameters
%damping of front wheel
c_f = 50;
%stiffness of front wheel
k_f = 70000;
%damping of rear wheel
c_r = 50;
%stiffness of rear wheel
k_r = 70000;
%mass
m = 1000;
%mass moment of intertia about COM
j = 1000;
%front wheel offset from COM [m]
l_f = 2.5;
%rear wh... |
function [l, u]=g_lower_and_upper_bins_xian(N)
if mod(N, 2) == 0
l = -N / 2;
u = N / 2 - 1;
else
l = -(N -1) / 2;
u = (N - 1) / 2;
end
end
% upper_bound = floor((N - 1) / 2)
% lower_bound = -floor(N / 2)
% return C/C++ index, startting from 0 |
function fsaverageLabelROIs(skeriNum,grayDir)
% converts V1 & MT ROIs from fsaverage to mrVista Gray using MNE morph maps
%
% usage: fsaverageLabelROIs(skeriNum,grayDir)
% e.g. fsaverageLabelROIs(119,'/raid/MRI/data/Wadelab/LGN/skeri0119_071910/Gray')
% if nargin == 0
% % skeriNum = 134;
% % grayDir = fullfi... |
function mpc = case2
mpc.version = '2';
mpc.baseMVA = 100;
%% bus data
% bus_i type Pd Qd Gs Bs area Vm Va baseKV zone Vmax Vmin
mpc.bus = [
1 3 0 0 0 0 1 .95 0 1 1 1.1 0.9;
2 1 350 -350 0 0 1 .975 -65 1 1 1.05 0.95;
];
%% generator data
% bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin Pc1 Pc2 Qc1mi... |
rand('seed',1)
ndata=30;
pos_known=rand(ndata,1)*10;
val_known=randn(ndata,1); %
val_var=zeros(ndata,1)+.1; %
V='1 Sph(.1)'; % Select variogram model
pos_est=[-2:.1:12]';
clear options;options.max=4;
[d_est_ok,d_var_ok]=krig(pos_known,[val_known val_var],pos_est,V,options);
options.mean=mean(val_known);... |
data1 = hdfread('MOD11A2.A2011193.h11v04.005.2011203192224.hdf','MODIS_Grid_8Day_1km_LST','Fields','LST_Day_1km');
data2 = hdfread('MOD11A2.A2011201.h11v04.005.2011210153236.hdf','MODIS_Grid_8Day_1km_LST','Fields','LST_Day_1km');
data_med = (data1+data2)* 0.01;
d_med = int16(data_med);
mat1 = ones(4);
mat1 = int... |
% code to estimate out of sample
clear all
clc
% we read the true mean vector and covariance matrix
load mu.mat
load Sigma.mat
%invSigmah=inv(Sigmah);
N=10;
T=150
onevec=ones(N,1);
evec=[1; zeros(N-2,1)];
% sharpe ratio tangent% number of observations
theta2=mu'*(Sigma\mu);
% sharpe ratio hedge
sigma2_g=((onevec'*(Sigm... |
function writeFourPole(a,l1,l2,l3,l4,w1,w2,w3,w4,w5,t,r1,r2,r3,r4,nt1,nt2)
% nt1 = 17;
% nt2 = 15;
thb = linspace(0, 2*pi*(nt1-1)/nt1, nt1);
ths = linspace(0, 2*pi*(nt2-1)/nt2, nt2);
polyID = fopen('fourPole.poly','w');
fprintf(polyID, '%d 2 1 1\n', 44+2*nt2+2*nt1);
d = -(2.5*t+l1+l2+l1+l2);
fprintf(polyID,... |
function add_matador_experiment_manager_to_search_path(rc_file)
manager_script = path_join(dirname(mfilename('fullpath')),'matador_experiment_manager.sh');
cmd = concat_cell_string_array({['echo "alias matador_experiment_manager=''' manager_script '''" >> ' rc_file]},' ',1);
[~, stdout] = system(cmd);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.