text stringlengths 8 6.12M |
|---|
%GreedyRand Function takes VarMin and VarMax (Work for Binary
%Classification only)
%nVar (Total Features/Variables)
%nSel (Total Features/Variables need to be selected)
%function returns a 1XnVar Matrix Position conating VarMin and VarMax
function [Position]=GreedyRand(VarMin,VarMax,nVar,nSel)
index = ra... |
%%%%%%% RETINA EMULATION USING .AVI %%%%%%%
clear;clc;
inVid = '../../example_video/fil_cat.avi';
imHeight = 128;
imWidth = 96;
nFrames = 150;
%%%set model modes%%%
filtMode = 2; %LPF mode - 1: 4NN average, 3: 9NN average, 2: adjustable Gaussian
sh_mode = 1; %1: LPF, 2: HPF, 3: NF
enDiv = 1; %partiton filtering
d... |
classdef b_Splines_Class < handle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Properties %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
properties
% control parameters
num_Basis = 2; % number of basis functions
type = 'a-periodic'; % b-spline type, periodic, a-periodic, or a-periodic approx
order = 2; ... |
clear all; close all;
l = 0.25; % Length of the pendulum [m]
g = 9.8;
t = linspace(0,4,400);
q0 = pi/14; % The initial angle [rad]
v0 = 0; % The intial angular velocity [rad/s]
x0 = [q0 v0];
A = [0 1; -g/l 0] ;
for k = 1:length(t)
phi = expm(t(k).*A);
x(k,:) = phi*x0';
end
figure(1)
subplot(2,1,1)
pl... |
function [] = add(obj,obj2)
%用于合并两个统计
% 如果有的域是空的,则无法进行四则运算,会出错
obj.AvgHoldingPeriod = (obj.AvgHoldingPeriod*obj.TradeNum+obj2.AvgHoldingPeriod*obj2.TradeNum)...
/(obj.TradeNum+obj2.TradeNum);
obj.AvgLongHoldingPeriod = (obj.AvgLongHoldingPeriod*obj.LongNum+obj2.AvgLongHoldingPeriod*obj2.LongNum)...
/(obj.Lo... |
function [ chosen ] = random_from_vector( vector, number, seed )
%random_from_vector picks NUMBER of items from the VECTOR
% The seed can be set to ensure the same random selection is chosen
% random_from_vector(vector) will choose a single random element
% random_from_vector(vector, N), will choose N random elem... |
function writeChemicalConnectionHDF5(FID, type, i_pre, j_post, I, J, K, D)
% FID: file id for writing data
% type: type of chemical connection (1:AMPA, 2:GABA, 3:NMDA)
% i_pre: pre-synaptic population index
% j_post: post-synaptic population index
% I: pre-synaptic neuron index vector
% J: p... |
%Final Collaboration Code : Mechatronics Design Project 2
%Author Judy Afana, Temidire Oduyale, Frank Du & Mechatronics Team
%Design Project 2
%Mechatronics
clear all;
clc;
% % %
% % %initilize global variables
% global robot;
% global motorR;
% global motorL;
% global r... |
for timeIntervals = 1:length(dtSteps)
%% Loading data % Putting it over a loop
dt = dtSteps(timeIntervals)
eval(strcat("load('",deliverablesFolder,"/mints_DCCD_node_3_2_data_from_",string(startDate),"_to_",string(endDate),"_in_",...
strrep(string(dt)," ","_"),"_averaged_slices_for_Node_",nod... |
function h = oHeight2(T,R,GM)
if nargin < 2 % this looks like a default to Kerbin if only 1 argument is passed.
R = 6e5;
GM = 3531600000000;
end
h = (T.^2*GM/(4*pi^2)).^(1/3)-R;
return
end
|
function DESWindow
f = uifigure('Name', 'DES calculator');
hEncodebutton = uibutton( f, ...
'Text', 'Encode', ...
'Position', [100 10 60 25], ...
'ButtonPushedFcn', @(btn, event)encodebutton_Callback);
hDecodebutton = uibutton( f, ...
'Text', 'Decode', ...
'Position', [165 10 60 25], .... |
function [ c_x, c_y ] = center_circle( x, y )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
global drl_holes
x_arr = drl_holes(1,:);
d = x_arr - x;
b = abs(d);
[b p] = min(b);
y_arr = drl_holes(2,:);
d = y_arr - y;
b = abs(d);
[b q] = min(b);
... |
function compute_dual_supremizers(fieldIndex,basis,matricesDir,meshname,outDir, format)
normMatrix = spconvert(load([matricesDir,'/',meshname,'/norm',num2str(fieldIndex),'.m']));
suprdual = [];
count = 1;
while (exist([matricesDir,'/',meshname,'/dualConstraint',num2str(count),'.m'],'file'))
curConstraint = spconve... |
function angles = calculateRealNozzleAngles(allSlices, normalVectors, maximumOverhangAngle)
angles = cell(size(allSlices, 1), 1);
for sliceNumber = 1:size(allSlices, 1)
currentSlice = allSlices{sliceNumber, 1};
currentLayerAngles = cell(size(currentSlice, 1), size(currentSlice, 2));
for ... |
function img_out = RGBgaussian(R,G,img,thres)
% get the gaussian model
R = double(R); G = double(G);
imgR = double(img(:,:,1)); imgG = double(img(:,:,2)); imgB = double(img(:,:,3));
muR = mean(R(:)); muG = mean(G(:));
Sigma = cov(R(:),G(:));
num = numel(imgR(:));
for i = 1:num
c = [imgR(i) - muR;imgG(i) - muG];
... |
b=2;
c=1;
A=[0 c 1 0 0 0; c b 0 0 0 0; 1 0 0 1 0 0; 0 0 1 0 0 1; 0 0 0 0 b c; 0 0 0 1 c 0];
n = 1000;
L = linspace(-1.95,1.95,n);
for j=1:n
[r,t]=comput(6,A,L(j));
R(j)=r;
T(j)=t;
end
subplot(3,2,1)
plot(L,real(R),'.');
xlabel('eigenvalue')
ylabel('real(Det(M))')
subplot(3,2,2)
plot(L,imag(R),'.'... |
function [predict_condition] = predict_flies(testdata,lol_threshold,dirction,allocate,params)
%PREDICT_FLY Summary of this function goes here
% Detailed explanation goes here
%test_data= HCTSA_validation;
%% Predict Rihanon's data
num_channels= params.num_channel ;
% y is the threshold map
y= lol_threshold;
% bias... |
%------------- BEGIN CODE --------------
% ekran ve bellek on temizleme
close all ; clear all ; clc ;
xa = 1;
%xu = 3;
xu = 7;
tol = 0.0001;
xo = (xa + xu) / 2;
%fxo = (xo^2)-5;
%fxa = (xa^2)-5;
fxo = xo^3 + xo^2 - 12 * xo;
fxa = xa^3 + xa^2 - 12 * xa;
iter = 0;
while (abs(fxo) > tol)
if (fxa * fxo) < 0
... |
function [ rotMatrix ] = rotH( angle )
%Full rotation, represented as Homoginious matrix
% Arguments
% @angle - (3x1) in rad
% Results
% rotMatrix - (4x4)
% Examples
% rotMatrix = rotH( [0;0;0] )
%% Validate input arguments
if sum(isnan(angle)) == 0
validateattributes(angle,{'double','sym'},{'size',[3,1]});
else
... |
%% plot VPD, Gradient of CumulativeVD, CoreVD
%% All animals together
%Plot tumor volume
TP2Day = xlsread('TP2Days.xlsx');
%1:12, 2:15, 3:24, 4:33, 5:34, 6:35, 7:51, 8:52, 9:55
hold off;
figure(11); clf('reset'); set(gcf,'Position',[391 1 873 805]);
figure(12); clf('reset'); set(gcf,'Position',[391 1 873 805]);
fig... |
function varargout = FeatureAddPreprocessPara(varargin)
% FEATUREADDPREPROCESSPARA MATLAB code for FeatureAddPreprocessPara.fig
% FEATUREADDPREPROCESSPARA, by itself, creates a new FEATUREADDPREPROCESSPARA or raises the existing
% singleton*.
%
% H = FEATUREADDPREPROCESSPARA returns the handle to a new F... |
function [out,unId,mdate] = getAmihudIlliq(id, dt, prc, ret, vol, n)
% GETAMIHUDILLIQ Estimate the end-of-month (log) Amihud illiquidity measure
%
% Ranks from liquid (smaller values) to illiquid (bigger values)
%
% N specifies the number of months of data to use for the lookback
prc = double(prc);
ret = double... |
function Weights = FDCoefficients(Nderiv,Npoints,NaughtPoint)
error(nargchk(1,3,nargin));
if (nargin < 2)
Npoints = Nderiv + 1;
end
if ( (nargin < 3) && (mod(Npoints,2) ~= 0))
NaughtPoint = (Npoints + 1) / 2 ;
elseif ( nargin < 3 )
... |
%[s_reslice_map] reslices SMAP and FMAP to match slice positions of DWI
%scan.
%
%
% Last modified
% 2010.08.09
% This incorporates,
% getting corresponding slice positions of SMAP and FMAP to DWI
% reslicing of SMAP and FMAP to DWI
% 2010.08.18.
% Pack memory.
% 2010.09.22.
% Add ~isemp... |
clear
clc
[n1,d1,n2,d2]=Inputsys(1);
Gs1 = tf(n1,d1);
Ts=0.1;
Gd1 = c2d(Gs1,Ts,'zoh');
[num1,den1]=tfdata(Gd1,'v');
Gs2 = tf(n2,d2);
Gd2 = c2d(Gs2,Ts,'zoh');
[num2,den2]=tfdata(Gd2,'v');
sys_info = stepinfo(Gd1);
ts1 = sys_info.SettlingTime;
tr1=sys_info.RiseTime;
sys_info = stepinfo(Gd2);
ts2 = sys_in... |
function y = fn_ls(varargin)
% function y = fn_ls(pattern)
%---
% List files inside directory
% Thomas Deneux
% Copyright 2009-2012
y = dir(varargin{:});
y = {y.name}; |
function [residual, g1, g2, g3] = chen_replication_dynamic(y, x, params, steady_state, it_)
%
% Status : Computes dynamic model for Dynare
%
% Inputs :
% y [#dynamic variables by 1] double vector of endogenous variables in the order stored
% in M_.lead_lag_in... |
function [ arfs_data, images ] = arfsFx( images, parameters, wb )
%arfsFx is a callable version of ARFS used for analysis of its function
% This version is tailored to ARFS2Batch.m
try
%% Get user input parameters
if exist('arfs_data','var') % for debugging
clear arfs_data;
end
arfs_da... |
function monitorWaitEvent
global experiment
experiment.index = experiment.index + 1;
if experiment.index <= length(experiment.nodes)
monitorExpRun;
else
disp('Done Phase 1');
disp('Start Collecting Data');
experiment.index = 1;
experiment.reportChoice=1;
monitorRunCollectData;
end
|
function MainAndFollowCannon_CannonVisibleNoise(whichPractice, taskParam, subject)
%MAINANDFOLLOWCANNON_CANNONVISIBLENOISE This function runs the practice session in which particpants
% see cannon and suffer from noise in the environment
%
% Input
% whichPractice: indicates which practice session will be com... |
% Inverse of a Quaterion
% by Cristian Duguet
% Info: The input Q can be a quaternion in the form [x y z w] , i.e a row
% vector or an array of N quaternions in a Matrix of size Nx4
function Qinv =invquat(Q)
N = size(Q,1);
Qinv = zeros(N,4);
Qinv = [-Q(:,1:3) Q(:,4)];
return |
function [ DsStar ] = coral( Ds, Dt )
%CORAL Summary of this function goes here
% The Coral function aims at alining original (sources) and target
% dataset in order to obtain a better classification while changing the
% domain of application.
% Ds : Source data
% Dt : Target data
% DsStar : Source data in ... |
function cpmnew = sumProductVE( Cpm,elimvars,B )
%{
sum-product-variable-elimination
Input:
Cpm: |M| x 1 cell array of CPM
elimvar: scalar of random variable
Output:
cpmnew: a cpm
%}
import mbn.*
Cpmnew = Cpm;
for ii = 1:length(elimvars)
Cpmnew = sumProductElimVar( Cpmnew,elimvars(ii),B );
end
cpmne... |
function psnr = calcPSNR(im1, im2, scaling)
mse = calcMSE(im1, im2, scaling);
psnr = 10*log10((256-1)^2/mse);
end |
function [val, gL_curve, L] = compute_global_strain(dl,timing,ES)
drift_comp = 1; % flag for drift compensation
L = dl;
% L = L(end,:); % total length
gL_curve = 100 * (L - L(1)) ./ L(1);
% frame_ref = 50;
if drift_comp
gL_curve = drift_compensation(gL_curve);
end
switch timing
case 'ES'
val = g... |
function f_value = negloglik_NMG_Matern_all(beta_all, r, samples, h0_cell)
n = size(r, 1);
p = 2;
disp(['Current estimate of beta is ', mat2str(round(beta_all*1e6)/1e6)])
a1 = beta_all(1);
a2 = beta_all(2);
b1 = beta_all(3);
b2 = beta_all(4);
nu = beta_all(5);
a = beta_all(6);
sigma1 = beta_all(7);
sigma2 = beta_all... |
%creating table of individual feature classification accuracies
%and a graph of how the accuracy changes as you add features
%dir_input = 'C:\Users\saman\Documents\MATLAB\EMGdata\FeaturesSubj\'; %Sam's
%dir_input = 'C:\Users\dketchum\Google Drive\HAL\Projects\ArmEMG\Data\SEEDS\FeaturesSubj\'; %Declan's
dir_inpu... |
function [H_uplink, A_BS, A_MS, alpha, ele_MS, azi_MS, ele_BS, azi_BS] = mmWave_uplink_channel_FDLens(D_MS, D_BS, ele_max_MS, azi_max_MS, ele_max_BS, azi_max_BS, Lp, flag_pure)
if(flag_pure)
%% test AoA/AoD完全取自字典的格点
G = 20;
idx_temp = randperm(G);
ele_MS = asin(-sin(ele_max_MS/2)+1/G+(2*sin(ele_max_MS/2... |
function coeffs = parabola4p(pts)
% gives implicit equation of the parabola that passes through given 4 points ("minimal problem"), in 2D. In general 2 parabolas pass though 4 pts, so these two solutions are given.
% Does not return degenerate solutions (complex, straight lines etc)
%
% pts - 4x2 array of point co... |
cd('/Users/grayson/desktop/summerresearch'); %get into a good directory
FILE = fopen('jointventurenet.csv'); %pull in the network data
DATA = textscan(FILE,'%s %s %s','delimiter',',');
fclose(FILE); %close the loose file
firstcompany = DATA{1}; %break up the data into two seperate variables
secondcompany = DATA{2};
for... |
%% Opdracht 3
% Gebruik een while-lus om een gegeven getal (in de variabele 'getal') in
% elke herhaling te delen door 3 en er 2 bij op te tellen. Sla het
% resultaat van die bewerking op in diezelfde variabele (anders krijg je een
% eeuwige lus en dat is fout). Herhaal m.b.v. een while-lus zolang het
% getal groter i... |
% Vorbereitungsaufgaben 8
close all; clc, clear;
load('strom');
Bilder_abspeichern = 0;
S = haardeclevel_8_1_2(x,5);
fignum=801;
for lvl=1:5
%% errechnen der Approximation und Details des jeweiligen Levels
[u v] = getAppDet_8_1_3(S, lvl);
[ud vd] = Daubechies_Wavelets(x,lvl,'db3');
[ud1 vd1] ... |
%% MULTI-SCALE BRAIN VASCULATURE NETWORK - GLOBAL SCRIPT
global Q Bn P cns xns yns zns;
%% DEFINING THE VALUES OF KEY PARAMETERS
SF = 0.3; % Shrink factor of control volume around large arterial network
s = 5; % This is the subject number and will range from 1 to 61.
Stroke = 2; ... |
function saveTifDouble(imageToSave,outputDir,saveFileName)
%make file
tob = Tiff(fullfile(outputDir,saveFileName),'w');
%# you need to set Photometric before Compression
tob.setTag('Photometric',Tiff.Photometric.MinIsBlack)
tob.setTag('Compression',Tiff.Compression.LZW)
%# tell the program that channel 4 is alpha
to... |
function u=boundary(u,ja,jb,ib)
if ib==1 % flat BC
u(1:ja-1,:)=ones(ja-1,1)*u(ja,:);
u(jb+1:jb+ja-1,:)=ones(ja-1,1)*u(jb,:);
end
end |
function [u_g,v_g] = geocurrents(latG,SSH)
% This function takes the SSH field as input
% and returns Geostrophic currents. This implements safe
% equator-crossing calculations and safe f-plane calculations using a
% hybrid of the models of Pond and Pickard and Lagerloef et al.
%
% CALLING THE FUNCTION
% =============... |
function [newKs,Kt] = KCA(Xs,Xt,kpar,lrank)
% kernel correlation alignment
%
% Xs: d X ns
% Xt: d X nt
if kpar == 0 % linear kernel
kernel1 = {'linear',kpar};
kernel2 = {'linear',kpar};
else
kernel1 = {'gauss',kpar}; % kernel type and kernel parameter for data set 1
kernel2 = {'gauss',... |
function varargout = Alamouti(varargin)
if nargin == 0 % LAUNCH GUI
fig = openfig(mfilename,'reuse');
% Use system color scheme for figure:
set(fig,'Color',get(0,'defaultUicontrolBackgroundColor'));
% Generate a structure of handles to pass to callbacks, and store it.
handles = guihandles(fig);
guidata(fig,... |
function [p,out] = getPeaks(y, minH, window, lofrec, hifrec, peakdis)
Wp = [lofrec hifrec]/(44100/2);
Rp = 0.1;
Rs = 60;
n = 6;
[b, c] = ellip(n,Rp,Rs,Wp);
yband = filtfilt(b, c, y);
[ff, ~] = envelope(yband, window, 'rms'); %1000
out = ff/sqrt(sum(abs(ff .^2)) / length(ff));
out = downsample(out, 1000);
[~, p] = ... |
%==========================================================================
% MN_Model_Destexhe2001.m
% Author: Akira Nagamori
% Last update: 8/5/19
% Descriptions:
%==========================================================================
close all
clear all
clc
%%
g_c = 0.1; %coupling conductance (mS/cm^2)
p = 0.1... |
function displayeventspsth(cell_num,bin)
load jpdisplayevents %jpdisplaynormalmaxrand0
for x = 1:length(displayevents)
cell(x) = displayevents(x).cell_num;
end
cell_ind = find(cell == cell_num);
rez = [3,5:5:15];
rez_ind = find(rez == bin);
psth = displayevents(cell_ind).normalpsths{rez_... |
a = [2 -1 0 0 0 0; -1 2 -1 0 0 0; 0 -1 2 -1 0 0; 0 0 -1 2 -1 0; 0 0 0 -1 2 -1; 0 0 0 0 -1 2];
[v, d] = eig(a);
figure;
for i = 1:6
subplot(3,2,i)
stem(v(:,i))
v2 = interp1(1:6,v(:,i),1:.125:6,'spline');
hold on
plot(1:.125:6,v2)
title(sprintf('Nearest Neighbor \\omega^2 = %g', d(i,i)))
xlabe... |
function [rth] = higgs_check_likelihood_trend(llh0,llh_grid,rth_grid,ntry)
llh0 = repmat(llh0,length(rth_grid),1);
diff_llh = llh_grid - [llh0 llh_grid(:,1:(ntry-1))];
id_grow = zeros(length(rth_grid),ntry);
id_grow(diff_llh > 0) = 1;
for count_try = flip(1:ntry)
llh_test = llh_grid(:,1);... |
filename = '../../tmp.csv';
ResultsExplorer(filename)
%
results = readtable(filename, 'ReadRowNames', false, 'HeaderLines', 0);
%
% figure;
% a = scatter3(results.x_pos, results.y_pos, results.z_pos, 10, results.MotorCurrent, 'filled'); |
clear;
img_fn = 'img_17.png'
[fn, fn_name, fn_ext] = fileparts(img_fn);
[img_in,map,alpha] = imread(img_fn);
%figure,imshow(img_in)
img_p1 = (fix(img_in(:,:,1)/8)*8);
img_p2 = (fix(img_in(:,:,2)/4)*4);
img_p3 = (fix(img_in(:,:,3)/8)*8);
img_p656(:,:,1) = img_p1;
img_p656(:,:,2) = img_p2;
img_p656(:,:,3)... |
function [ dist2 ] = returndist2()
%UNTITLED10 Summary of this function goes here
% Detailed explanation goes here
load('arrhythmia.mat');
N = length(arrhythmia);
for i=1:N
if arrhythmia(i,275) == 1 % leave as '1' if it is already '1'
continue
else
arrhythmia(i,275) = 2; % make it '2' if it is ... |
function [nv, nf, tris, sibhes, v2he, vvs, evs] = merge_surf(heid, nv, nf, ...
tris, sibhes, v2he, vvs, evs) %#codegen
|
% ======================================================================%
% this program is MCM for multiple interferences case
% author: Xiangrong Wang%
% date: 21/06/2014 %
% ======================================================================%
function [z0,opt_scnr] = mcm(Vc,Vt,N,K)
z0 = ones(N,1);
z = ones(N,1);... |
function mObject3 = timeAlignedDirectSTRAIGHTmorphing(mObject1,mObject2,mRate,mixMethod);
% Morphing based on time-aligned mixing of STRAIGHT parameters
% mObject3 = timeAlignedDirectSTRAIGHTmorphing(mObject1,mObject2,mRate,mixMethod);
% Designed and coded by Hideki Kawahara
% 28/Feb./2005
% Copyright(c) 200... |
function dictionary = calculateDictionaryLP(dicSize, allSifts, imageSeparateRecord)
[m, n] = size(allSifts); %allSifts row vector,
dictionarySize = dicSize;
nimages = length(imageSeparateRecord);
disp(['image num : ', num2str(nimages)]);
niters = 20;
centres = zeros(dictionarySize, n);
data... |
function [ a,b ] = sindeg( deg)
[n,m]=size(deg);
x=pi/180.*deg;
a=sin(x);
b=sum(sum(a,1),2)/n/m;
end |
clc;clear all;close all;
b = xlsread('ErlangCTable.xls');
delay = 0.4;
n = 9;
linha = [];
coluna = [];
[l,c] = size(b);
for i = 1:c
if b(1,i) == delay
coluna = i;
for j = 2:l
if b(j,1) == n
linha = j;
break;
end
end
end
end
display(b(linha,coluna)... |
function [x,y,z] = getdata3d
x=get(get(gca,'Children'),'xdata');
y=get(get(gca,'Children'),'ydata');
z=get(get(gca,'Children'),'cdata');
end |
data_rep = '~/Desktop/soft_test/data_files';
data_name = 'raw_image_matrix_lin_h64_w64_seg_000001_000064';
data_type = 'ft_mag';
mat_dir = fullfile(data_rep, data_type, 'mat');
% Directory containing the compiled SOFT routines.
output_dir = fullfile(data_rep, data_type, 'mat');
% Bandwidth of the data
band_width =... |
function y = proc(img)
%Helpful function
paren = @(x, varargin) x(varargin{:});
%Get the useful part, the time numbers
xsize = paren(size(img),1)/20;
ysize = paren(size(img),2)/4;
box_nums = img(xsize:(xsize*4 + 15),ysize:(ysize*3),:);
%Processing of box for easier recognition
gray_box = rgb... |
steps = 0.1:0.01:1;
[~, sz] = size(steps);
fft_mean = zeros(sz,1);
dct_mean = zeros(sz,1);
a = load('lenna.mat');
lenna = a.x_le;
for i = 1:sz
lenna_fft = find_coeffs(lenna, steps(i));
fft_mean(i) = mean2(abs(lenna - lenna_fft));
end
for i = 1:sz
lenna_dct = find_coeffs_dct(lenna, steps... |
function imo = imdb_get_batch_bcnn(images, varargin)
% imdb_get_batch_bcnn Load, preprocess, and pack images for BCNN evaluation
% For asymmetric model, the function preprocesses the images twice for two networks
% separately.
% OUTPUT
% imo: a cell array where each element is a cell array of images.
% For symm... |
%% Animation Data
function AniOutput = Data(obj, ite, Dataset)
% Dataset
x_state = obj.xs{Dataset};
u_state = obj.us{Dataset};
%Declare variables
x = x_state(ite, 1);
y = x_state(ite, 2);
theta = x_state(ite, 3);
xp = x_state(ite, 4);
yp = x_state(ite, 5);
... |
%% Advanced Topics in Surgical Robotics - B Term 2019
% Homework 1 - Problem 3 - Forward Kinematics of the C-arm
clear, clc, close all
%% *** DO NOT TOUCH THE CODE IN THIS SECTION - SKIP TO LINE 24 ***
% Create and display the kinematic chain
a4 = 0.3;
a5 = 1;
robot = SerialLink([...
PrismaticMDH('a', 0, 'alpha... |
function mpc = case9
%CASE9 Power flow data for 9 bus, 3 generator case.
% Please see CASEFORMAT for details on the case file format.
%
% Based on data from Joe H. Chow's book, p. 70.
% MATPOWER
% $Id: case9.m,v 1.11 2010/03/10 18:08:14 ray Exp $
%% MATPOWER Case Format : Version 2
mpc.version = ... |
function [q, dq, ddq, dddq] = calc_joint_trajectory(spline_fit, x_traj)
% using splines, calculate the components needed for the
% x_traj_to_use = [x_traj-h; x_traj; x_traj+h];
% x_traj_to_use = x_traj_to_use(:, x_knot_ind); % remove the edge pieces to prevent extrapolation effects
x_traj_to_use = x_traj;
q = [];
dq ... |
close all;
clear;
clc;
xrange = 10:5:50;
eva = cell2mat(struct2cell(load('eva_delay_wifitraffic.mat')));
fig = figure('Position',[0 250 800 350]);
plot(xrange',eva(:,2),'-', 'Color','r','LineWidth',4);
hold on
plot(xrange',eva(:,3),'-.','Color','k','LineWidth',4);
hold on
plot(xrange',eva(:,4),':','Color','b','L... |
function mosaic = imalign_affine(im1, im2)
im1 = im2double(im1);
im2 = im2double(im2);
im1gray = rgb2gray(im1);
im2gray = rgb2gray(im2);
%% Detect corners
sigma = 0.5;
radius = 5;
num = 1000;
[im1dx, im1dy] = im_gradient(im1gray);
[im2dx, im2dy] = im_gradient(im2gray);
[~, row1, col1] = detect_corner(im1dx, im1dy, si... |
function [A] = load_Huntington_v1(cycle,delta,windowtype)
% this function built a specific artery object
A = class_artery(cycle,windowtype);
% this is first idea
% maybe we'll cut Huntington in two parts
% because of the different cycles
% cf script_runonce_Huntington_v1
% arguments of classe_intersection:
% name
%... |
% rf_delete(forest_ptr)
% Deletes a forest pointed to by forest_ptr. There is NO protection keeping you sensible,
% if you call this with a bad pointer it will toast your current instance of matlab. So, be
% careful. |
%% s_VernierAcuity
% Testing if people can see the difference between two cases:
% 1) A straight line
% 2) Two straight lines with 1 pixel apart
% Vernier Acuity shows the positional acuity is around 6 sec of arc
%
% (HJ) Jan, 2014
%% Init Parameters
ieInit;
ppi = 400; % points per inch
im... |
clear;clc;
data = csvread('train.csv');
length = size(data,1);
for i = 1: length
to_be_append = data(i,:);
to_be_append(5) = to_be_append(5)+200;
to_be_append(7) = to_be_append(7)-70;
data = [data;to_be_append];
end
csvwrite('generated_data.csv',data)
|
%% Michaelis-Menten Reaction - Gillespie Algorithm
%%% Ashwin Nayak, asnayak(at)ucsd.edu, 25-Feb-2017
%%% Written towards MATH276 HW3
%%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
%%% Solves the M-M Reactions,
% % % S + E <===> C ---> E + P
%%% using the Gillespie Algorithm.
%%%
... |
function stru_var = get_structural_variance( target_in_deg, deg_tol, in_file, config_file)
N = 63^2;
fw = sqrt(N);
hw = (fw-1)/2;
a_mean = zeros(fw,fw);
a_var = zeros(fw, fw);
k_mean = zeros(fw,fw);
k_var = zeros(fw, fw);
k_steps = ones(fw, fw);
a_steps = ones(fw, fw);
i_pre = 1;
j_post = 1;
if nargin == 2
in_f... |
% Copyright (c) 2018 Gopalakrishnan, Krishnakumar <krishnak@vt.edu>
% Author: Gopalakrishnan, Krishnakumar <krishnak@vt.edu>
clear;clc; format short g; format compact; close all;
fig_width_factor = 1; % scaling factor wrt to text width
golden_ratio = 1.618;
warning('off','Ident:dataprocess:idinput7');
soc_init_pct = ... |
function IsConsistent=VolumeCheck(Cell,Y)
Sides=[1 2;
2 3;
3 1];
IsConsistent=true;
for c=1:Cell.n
Tris=Cell.Tris{c};
Tris(Tris(:,3)>0,3)=Tris(Tris(:,3)>0,3)+Y.n;
Tris(Tris(:,3)<0,3)=abs(Tris(Tris(:,3)<0,3));
Id=1:size(Tris,1);
for t=1:size(Tris,1)
Side1=Tris(t,Si... |
close all;
global pets
pets = {'Procambarus_virginalis'};
check_my_pet(pets);
estim_options('default');
estim_options('max_step_number',5e2);
estim_options('max_fun_evals',5e3);
estim_options('pars_init_method', 2);
estim_options('results_output', 3);
estim_options('method','nm');
estim_pars;
|
function mu_bar = syst(xk, yk, thetak, vk, wk, Ts)
mu_bar = [xk + Ts*cos(thetak)*vk;
yk + Ts*sin(thetak)*vk;
thetak + Ts*wk];
end |
function fig = ghaldhtr(varargin);
% ghaldhtr(...)
% D Htr
ffig = ne_group(varargin,'D Htr','phaldhtrv','phaldhtrp','phaldhtrs');
if nargout > 0 fig = ffig; end
|
function valid=valid_date(year,month,day)
if ~isscalar(year) || ~isscalar(month) || ~isscalar(day)
valid=false;
return
end
if year < 1 || month < 1 || day < 1
valid=false;
return
end
if year ~= fix(year) || month ~= fix(month) || day ~= fix(day)
valid=false;
re... |
%even odd code
if do_sort && evenOdd
[Y1,I1]=sort(sort_values_image_matched(i,:));
I1_odd=I1(mod(I1,2)==1);
I1_even=I1(mod(I1,2)==0);
vidObj_even=VideoWriter([videofilename '_even'],'MPEG-4');
vidObj_odd=VideoWriter([videof... |
function Q9(f,g)
% Original header: x = friendly(f,g)
% The program prints the word "friendly" if f and g are friendly and
% "not friendly" otherwise. Vectors f and g have the same length and
% the length is greater than 2.
% Given two vectors of the same length, we say that the two vectors are
% "friendly" if each pai... |
function [ d ] = qam32( data )
d=zeros(1, length(data)/5);
k=1;
for i=1:5:length(data)-4
if data(i)==1&& data(i+1)==1 %first two bits 11
if data(i+2)==1 && data(i+3)==1 && data(i+4)==1
d(k) = (3-1i);%/sqrt(10);
end
if data(i+2)==0&& data(i+3)==1 && data(i+4)==1
... |
function [rm,bd,lo] = gtsfeature(mmusic0)
% 秒
t = 1;
%最後の方のデータは切り捨て
[L,A] = quorem(length(mmusic0),44100*t);
l = sym2poly(L);
rm = zeros(1,l)';
bd = zeros(1,l)';
lo = zeros(1,l)';
for i = 1:l
mmd = miraudio(mmusic0((i-1)*44100 + 1:i*44100));
rm(i) = mirgetdata(mirrms(mmd));
bd(i) = mirgetdata(mirbrightnes... |
function [S,Q] = SandQ(E1,E2,G,nu)
% syntax- [S,Q] = SandQ(E1,E2,G,nu)
% This function calculates the S and Q matrix in Generalized Hooke's Law.
% sigma = Q*epsilon and eplison = S*sigma
% Calculating S and Q Matrix
S = zeros(3);
S(1,1) = 1/E1;
S(1,2) = -nu/E1;
S(2,1) = -nu/E1;
S(2,2) = 1/E2;
S(3,3) = 1/G;
... |
function [firings,g] = simLNP_stdp_v2(alph,delta,lim,beta,X,S,stdp_params)
C = size(alph,1);
Ms = (size(alph,2)-1)/C;
if ~isfinite(Ms), Ms=0; end
if nargin<4, beta=[]; end
maxrows = ceil(lim/delta);
% Preallocate for speed
firings = zeros(maxrows,2);
fcount = zeros(C,1);
I = [1 zeros(1,C*Ms)]';
t = 1;
u = zeros(C,... |
function [accdiff1,accdiff2,accall,accSall] = decode_time_since_last_reward_by_thetaphase(thisdir,numshuff,indinds,indinds2)
load(thisdir,'PFCthetaspikes_binned');
Th = add_time_since_last_reward(thisdir);
% ThInd = ~isnan(Th(:,10));
% Th(ThInd,10) = Th(ThInd,10)>nanmedian(Th(ThInd,10));
binsize = .02;
window =... |
fid=fopen('D:\Thesis\datasets\j2\j2.txt');
s=textscan(fid,'%d %d');
fclose(fid);
x=s{1};
y=s{2};
%{Partition File}%
fid=fopen('D:\Thesis\datasets\j2\j2-pa.txt');
s=textscan(fid,'%d');
fclose(fid);
pa=s{1};
arrayx = zeros(numel(x),2);
paritionnumber = 1;
centroid = [5000,5000];
j = 1;
for i=1:numel(x... |
function [LBCstd,LBCPrice,LBCConfInt]=Flbc(T,S0,K,sigma,r,n,alpha)
% function of discretely monitored look-back barrier call
M=1E6; % number of AV Monte Carlo Simulation
b = r-sigma^2/2;
LBC = zeros(1,M);% pre-define vector of discounted payoff samples
dt=T/n;
LBCAnt = zeros(1,M);% pre-define vector of ANTITHETIC disc... |
function table_cell = MultiStruct2Cell(struct_array,table_form)
% table_cell = MultiStruct2Cell(struct_array,table_form)
% table_form: either long form (default) or short form
tmp = struct_array;%initiate first layer inspection
layer=1;%initiate first layer
array_leng = cell();
num_fields = cell();
field_list = cell();... |
function varargout = readimxvec(file)
% function [x,y,u,v,w?,units] = readimxvec(file)
A = readimx(file);
if (~isfield(A,'Frames') || (length(A.Frames) ~= 1))
error('Unrecognized IM7 file format');
end
A = A.Frames{1};
if ismember('W0',A.ComponentNames)
nvec = 3;
else
nvec = 2;
end
if any(~ismember({'U0'... |
function x = lastDigs(digits, base, pow)
phi = eulerphi(pow);
total = 1;
% reduce after every step until you've multiplied the base by itself
% phi times
for i = 0:phi
total = mod(base * total, 10^digits);
end
x = total;
end |
% Activity 16 - Incorporate a function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
close all
%% Figure Selection
text_list = {'Time Domain Signal', 'Time Domain + Noise', ...
'Frequency Domain 1', 'Frequency Domain 2', ...
'Frequency Domain 3', 'Frequ... |
function [misclassift_rate] = calculate_misclassify_rate(predict,test_label)
% 计算误判率
% 输入:
% predict = [N X 1]
% test_label = [N X 1]
% 统计错误率
misclassift_num = 0;
for i = 1:length(test_label)
if(predict(i, :) ~= test_label(i, :))
misclassift_num = misclassift_num + 1;
end
end
misclassift_rate = misclas... |
%{
# Movie repeats evaluation
-> obj.RepeatsOpt
-> fuse.ScanDone
---
-> stimulus.Sync
%}
classdef Repeats < dj.Computed
%#ok<*AGROW>
%#ok<*INUSL>
properties
keySource = fuse.ScanDone * (obj.RepeatsOpt & 'process = "yes"') ...
& (stimulus.Sync & (stimulus.Trial & (stimulus.Clip & (s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.