text stringlengths 8 6.12M |
|---|
function [nu,E] = KeplerSolver_Elosegui_Marcus(nu0,t0,t,a,e,mu)
E0 = 2*atan2(sqrt(1-e)*sin(nu0/2),sqrt(1+e)*cos(nu0/2));
tp = t0 - sqrt(a^3/mu)*(E0-e*sin(E0));
tau = 2*pi*sqrt(a^3/mu);
k = floor((t-tp)/tau);
C = sqrt(mu/a^3)*(t-t0)- 2*pi*k+(E0-e*sin(E0));
M0 = E0-e*sin(E0);
E_ki = M0;
for i = 1:100
... |
function theory_checkrun(handles)
global rough_par gsettings funcselection compareexp
if (isempty(funcselection) == 1)
funcselection = 1;
end %if
if (isempty(rough_par) == 1)
rough_par.betap = .02;
rough_par.Deltac = 1;
rough_par.Nbump = 20;
% rough_par.n_b = 2;
rough_par.Rb_Dp = .1;
rough_p... |
function polenhan()
% track = '2ch';
% clear all variable for debugging
clear;
% default track
track = '6ch';
addpath ../../utils;
% addpath ../utils/ArrayToolbox;
% audio input path / segmented utterances
% change data to remote directory to safe the space add "../CHiME4/CHiME3/"
% upath=['../../data/audio/16kHz/iso... |
fa=20;
npulses=1;
%T1=1660;
%T2=140;
T1=1e6;
T2=1e6;
dt=2e-3; %dt in ms
%endtime = 1.84-2*.45; % ms
endtime = 1.84;
time = [0:dt:endtime-dt]'; % ms
gambar = 42570; % gamma/2pi in kHz/T
gam=gambar*2*pi;
%pw_rf1=0.05; %ms
pw_rf1 =0.5; %ms
mpgb1 =hanning(round(pw_rf1/dt));
a_rf90 ... |
function lower_bound = lower_bound_makespan(a)
%Provides a lower bound for the makespan instance
num_progs = length(a) - 1;
num_machines = a(length(a));
max_prog = max(a(1:num_progs));
divided_cost = sum(a(1:num_progs))/num_machines;
lower_bound = max([max_prog, divided_cost]);
end
|
syms Vx s Cf Cr Jz lf lr m k
%%
A = [ -(Cf+Cr)/(m*Vx) ((Cr*lr-Cf*lf)/(m*Vx))-Vx 0 0
(Cr*lr - Cf*lf)/(Jz*Vx) -(Cf*lf^2 + Cr*lr^2)/(Jz*Vx) 0 0
0 1 0 0
1 0 Vx 0];
B = [ Cf/m 0
Cf*lf/Jz 0
0 -Vx
0 0];
C = [ 0 0 Vx/k 1];
D = 0;
%%
modelTF = C*inv(s*... |
cables = im2double(imread('images/Spaghetti.jpg'));
brain = im2double(imread('images/brain empty.png'));
brain_gray = im2double(rgb2gray(brain));
brain_bw = im2bw(brain);
brain_gray = imresize(brain_gray,[size(cables,1), size(cables,2)] );
brain_bw = imresize(brain_bw,[size(cables,1), size(cables,2)]);
cc = bwconnco... |
N = 5;
A = DFTmatrix(N);
B = IDFTmatrix(N)
C = B*A |
function c = my_dwt(obs_vec, Lo, Hi)
atom = [Lo; Hi];
W = zeros(8);
W(1:2, 1:4) = atom;
W(3:4, 3:6) = atom;
W(5:6, 5:8) = atom;
W(7:8, [7, 8, 1, 2]) = atom;
c1 = W * obs_vec';
% apprxomation, detail, approximation, detail, ...
cA1 = c1(1:2:8);
cD1 = c1(2:2:8);
W2 = [atom; circshift(atom, 2, 2)];
c2 = W2... |
function orthospm7(roi, threshold, onsets, window ,spm_file, anat_file, tseries_fpath, func_root )
% function result = orthospm7(
% roi_size,
% threshold ,
% onsets,
% window
% [,spm_file ,
% ... |
%FR_gui.M
%
function FR_gui()
%
%close all;
FR_gui=figure;
%
set(FR_gui,'Visible','off',...
'Position',[100 150 700 500]);
set(FR_gui,'NumberTitle','off');
set(FR_gui,'MenuBar','none');
%Farbe der GUI festlegen
set(FR_gui,'Color',[0.1 0.9 0.1]);
%Titel der GUI festlegen
set(FR_gui,'Name','endliche Four... |
function obj = fix_block_number( obj )
% FIX_BLOCK_NUMBER -- Make each block number a unique block number
% within a recording day.
%
% I.e., if there are multiple sessions within a day, make block number
% increment over sessions, rather than reset to 1 for each session.
%
% IN:
% - `obj` (Con... |
clear all; close all; clc;
absdatadir='C:\robot';
s=dir([absdatadir]); s=s(3:end);
dc=1;
for i=1:length(s),
cdir=s(i).name;
s2=dir([absdatadir '\' cdir '\std_cam\*jpg']);
for j=1:length(s2),
I=imread([absdatadir '\' cdir '\std_cam\rgb_' num2str(j) '.jpg']);
M(:,:,j)=rgb2gray(I);... |
function [D, A] = ArcieroModel(Params, CPP, ATP)
D0 = Params(1);
options = optimset('TolX', 1e-9);
for i = 1:length(CPP)
F0 = @(x, T_total)Equilibrium(x, CPP(i), ATP(i), Params);
[D(i), fx, ~] = bisection(F0,D0*0.2,D0*1.0,0,optimset('TolX',1e-9));
T_total(i) = CPP(i)/D(i);
C_pass... |
function [] = remove_piece(ang1,dist1)
global bot;
movein = 0;
% move arm in
if movein
bot.step_out(0);
end
% rotate arm to position
bot.arm_pos(ang1);
% wait to stop moving
bot.stepper_done;
bot.arm_done;
% move arm out to position
bot.step_out(round(dist1));
bot.stepper_done;
% pick up piece
bot.claw(opened);... |
% SVD
for i = 0:4
V = load(['BatchPC\BatchPCi', num2str(i)]);
SvdPCNative(V.IdxSet, :) = V.APC(V.IdxSet, :);
end
for i = 5:14
V = load(['BatchPC\BatchPCi', num2str(i)]);
SvdPCGender(V.IdxSet, :) = V.APC(V.IdxSet, :);
end
figure(1);
SvdPCGender(301:397, :) = [];
plot(SvdPCGender); hold on; plot(.52*... |
%Hertz para semitons
function [semi] = TCCHz2Semi(hZ)
f0 = 21.83;
% hZ = f0 * a ^ semi;
semi = log2(hZ/f0) * 12;
endfunction |
function pre_process_tjcs(save_dir,tjc,do_denoise,do_med_flt,med_width,do_resample,do_plot,do_det_odd,ds)
if ~exist(save_dir,'file')
mkdir(save_dir);
end
if save_dir(end)~='\' && save_dir(end)~='/'
save_dir = [save_dir '/'];
end
if do_denoise
tjc_den = denoise_tjcs(save_dir,tjc,do_med_flt,med_width,do_plot)... |
function fig = DataCompareFig()
% This is the machine-generated representation of a Handle Graphics object
% and its children. Note that handle values may change when these objects
% are re-created. This may cause problems with any callbacks written to
% depend on the value of the handle at the time the object was sav... |
% Aquest codi ha estat realitzat per:
% -Alexis Leon Delgado
% -David Morante Torra
% -Ferran Rubio Vallhonrat
% -Juan Garrido Moreno
% En base al set preliminar de valors de la tasca 1, aquest programa troba
% el set que fa màxim l'impuls específic d'acord a l'interval especificat
% per a cada variable a la t... |
function [y,n] = sigscaling(a,x)
% implements y(n) = a{x(n)}
%-------------------------------
% [y,n] = (a,x)
%
n = [1:length(x)]; y = a*x;
Hs = stem(n,y,'b','filled'); % Stem-plot with handle Hs
set(Hs,'markersize',4); % Change circle size
xlabel('n'); ylabel('y(n)'); % Label axis
title('Scaling Sequence'); % Title p... |
function mo = initialise_model_MF_S0fixed_sgm0fixed_nolapse_max(settings)
%% set up model structure
mo = [];
%% set up parameters
mo.params.Q0 = nan(settings.task.N_games,1);
%% set up matrices
mo.mat.Q(1:settings.task.N_hor,1:settings.task.Ngames_per_hor) = {nan(settings.task.N_trees,6)}; % Q... |
%% Investigate the "green stripe" ~ medium parasitic load at T=300
%% Create Histogram of average degree
close all %For now. Delete Later.
clc
currentParasiteData = load('./msriParasites/Dynamic_Degree_1_2_2_nodeParasites.txt');
startValue = 250;
ToPlot = currentParasiteData(startValue:end,2:end); % t= 150 is where ... |
function out = ls_ica ( obj, varargin )
opts = struct( ...
'classes' , [] , ...
'blocks_in' , 'all' , ...
'channels' , 'all' , ...
'time' , 'all' , ...
'dim' , 3 , ...
'trials' , 'all' , ...
'method' , 'runica' ) ;
[ opts ] = parseOpts( opts , varargin ) ;
opts2var
[time channels]=convert... |
function [ obj ] = pushstr( obj, str)
% 向struct里填充l2数据,使用xml的默认顺序,逗号隔离
% 程刚,20151112
% 长度38, 37位是字符串,其他是数字
data = regexp(str,',','split');
for i = 1:36
d(i) = str2double(data{i});
end
%
% 取latest
t = obj.latest;
if isnan(t) %|| t == 0
t = 1;
end
t = t+1;
obj.latest = t;
try
obj.quoteTime(t) = d(1);% ... |
%------------------------
% Kalman filter for Lorenz 96 model
% by PYWu, 2020.09.09
%------------------------
clear; close all
%---model---
global F
F=8; % force of model
nvar=40; % number of variables
xint=ones(nvar,1)*F; % initial number
xint(20)=xint(20)+0.1; % ini... |
addpath('results','alloy_mat','function_code','utils')
fname=sprintf('sandstone_alloy_w6_b24_rot_nrot1_pb0.3_pl10_iter_2000');
load(sprintf('%s.mat',fname));
% addpath('../structure/');
load('sandstone.mat')
params.optgpu = 0;
spacing = 1;
ws=params.ws;
rs=params.rs;
kcd=params.kcd;
txtype = params.txtype;
grid = param... |
%load('weights.mat')
% Clear all non-weights
% (pure zeros vector generate as a results of memory allocation)
indZero=zeros(size(weights,2),1);
c=0;
for iw=1:size(weights,2)
if sum(weights(:,iw))==0
c=c+1;
indZero(c)=iw;
end
end
indZero(indZero==0)=[];
weights(:,indZero)=[];
% Extract a stamp for each weigh... |
function fishereqOLD
% p=zeros(m,n);
% %Dirichlet boundary conditions:
% p(:,1)=1;
% p(:,n)=0;
% p(1,1:ceil(n/4))=1;
% p(1,(ceil(n/4)+1):n)=0;
%explicit Euler
% for i=2:(n-1)
% for j=2:m
% p(i,j) = p(i,j-1) + dt*D*((p(i-1,j-1)+p(i+1,j-1)-2*p(i,j-1))./(dx^2) + k*p(i,j-1)*(1-p(i,j-1)));
% end
% end
|
%Written by Patrick Strassmann
function [signVal] = meanDiffSign(exp,orig)
exp = noNans(exp);
orig = noNans(orig);
signVal = sign(mean(exp)-mean(orig));
end
|
function smth=smooth(in,n)
smth=filtfilt(ones(n,1)./n,1,in);
end |
alpha = 10^-4; beta = 0.1;
m = 10; % number of previous gradients that are used to calculate the inverse Hessian
s_k = zeros(n,m);
y_k = zeros(n,m);
sy = zeros(1,m); syInv = zeros(1,m);
tmp = zeros(size(b));
for t = logspace(0,2,3)
%fprintf('t: %d\n',t);
Abt = Ab*t;
for j = 1:numWindows
tmp(idx_b_Windowed{j}) = t*... |
%3次元顔形状データにおける特徴点座標の計算
%特徴点座標を読み込み,全点の直交座標から特徴点座標(x,y,z)を取得
%初期化
clear all
clc;
tic;
% %input & output
% inName1 = 'Landmark2D/omland%d.txt';
% inName2 = 'cartData/omcart%d.xls';
% outName = 'Landmark3D/omland_cart%d.xls';
inName1 = 'Landmark2D/hmland%d.txt';
inName2 = 'cartData/hmcart%d.xls';
outName = 'Landmark3D... |
for i=1:100
p=squeeze(DataMatrix2(900+5*i,:,:));
pcolor(p)
shading interp
f(i)=getframe
end |
function [obs_slice] = convert_volume_to_slice_obs(obs_volume)
% CONVERT_VOLUME_TO_SLICE_OBS - converts a volume type observation struct into
% a slice type observation struct
%
% [obs_slice] = convert_volume_to_slice_obs(obs_volume)
%
% Input: obs_volume - the volume type observations
% O... |
whole_list = 1/31*ones(max(size(range_label)),max(size(range_rate_label)),max(size(v_label)),max(size(a_label)));
for i = 1:max(size(range_label))
for j = 1:max(size(range_rate_label))
for k = 1:max(size(v_label))
tmp_list = get_NDD_possi_list(v_label(k));
for w = 1:max(size(a_lab... |
function rhs = blassius_rhs(x,Y)
Pr=1;
rhs = [ Y(2); Y(3); -Y(1)*Y(3)*Pr/2]; |
%% The aim of this example is to demonstrate a setup of this software.
% This will be an incremental step example.
% First, will be a simple mediation analysis where the effect of age group
% on a behavioral performance measure is mediated by a voxel-wise measure
% of grey matter density.
% To begin, start by l... |
function [ alldata,dataum ] = reshapeStrainData( raw_data )
%PROCESS_DATA Summary of this function goes here
% Detailed explanation goes here
x = raw_data(:,1);
y = raw_data(:,2);
Exx = raw_data(:,3);
Eyy = raw_data(:,4);
Exy = raw_data(:,5);
xVec = unique(x);
yVec = unique(y);
% nDataPoints = length(x);
% i... |
function idoc(varargin)
% idoc Display IRIS help in Web browser/Matlab documentation window.
%
% Syntax
% =======
%
% idoc
% idoc object_name
% idoc package_name
% idoc object_name/function_name
% idoc package_name/function_name
%
%
% Example
% ========
%
% idoc model
% ... |
K = 10;
X = load('../digit/digit.txt');
Y = load('../digit/labels.txt');
max_iterations = 20;
total_SS_plot = zeros(10, 1);
pairs = zeros(10, 3);
for n=1:10
for K=1:10
centroids = initCentroids_random(X, K); %replace by initCentroids_first if required
for i=1:max_iterations
prev_centroids = centroids... |
function [ acceleration ] = Gravity( )
% tankLevel is percent of tank left filled from 0.0 to 1.0
% mass is current mass in t
% earthGravity = 9.81; % m/s*s
marsGravity = 3.69; % m/s*s
acceleration = marsGravity;
end |
function [ new_peak, LDC ] = get_LDC_RE(load_file, re_file, penetration, type)
%GET_LDC Summary of this function goes here
% Detailed explanation goes here
data = xlsread(load_file);
load = data(:);
load = load./max(load);
re_power = xlsread(re_file);
re_power = re_power./max(re_power);
%% Small tweak o... |
% FUNCTION THAT RETURNS A BOOLEAN TRUE OR FALSE VALUE DEPENDING ON WHETHER
% OR NOT THE CAR WAS WON WHEN THE PLAYER DECIDED TO SWITCH DOORS. IF true
% IS RETURNED, THE CAR WAS WON. IF false WAS RETURNED, A GOAT WAS WON.
function gotCar = DoesSwitch()
% INITIALIZE VARIABLES AND DECIDE WHICH DOOR HOLDS THE CAR
... |
% set_start function
n_start=node;
x_start=x;
y_start=y;
set(q_start,'xdata',x_start,'ydata',y_start); |
function [ px ] = dxT( p )
px = zeros(size(p));
px(2:end-1,:) = p(2:end-1,:)-p(1:end-2,:);
px(1,:)=p(1,:);
px(end,:) = -p(end-1,:);
end
|
% Plot
% subplot(2,2,1);
subplot(1,2,1);
plot(time,stran(3,:),'-b','LineWidth',4);
xlabel('Time [s]');
ylabel('Strain component 33 [-]');
title('Strain vs. Time');
set (gcf,'windowstyle','normal'); %gcf-figure gca-axis
set (gcf,'Position',[500,300,400,260]); %left bottom weight height
set(gca,'FontName','Times New ... |
function x_thresh = find_x_thresh(line_profile_axis, line_profile, figure_handle)
% prompts the user to click the local minimum and maximum around a
% soft-hard tissue interface, and automatically generates the
% +/-6dB line to assist manual measurement
plot(figure_handle, line_profile_axis, line... |
function res = test_HOG(I)
img = imread('index.jpeg');
img = rgb2gray(img);
[featureVector,hogVisualization] = extractHOGFeatures(img);
figure;
imshow(img);
hold on;
plot(hogVisualization); |
function tign=perimeter_in_jm(long,lat,fire_area,wrfout,time,interval,time_step,num_wrf, input_type)
% Volodymyr Kondratenko July 19 2013
% Rebuilt Jan Mandel May 2016
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Input:
% long,lat longtitude and latitude conver... |
function slopes = varVsPM_computeSlopes(Ydata,Xdata)
% Individual experiment regressions
%
% Ydata and Xdata are matrices with data points from individual experiments
% as rows.
%
% @ Matt Golub, 2018.
nExps = size(Ydata,1);
slopes = nan(nExps,1);
for expIdx = 1:nExps
% Solve for Y = X*B, i.e., regress(Y,X)
nF... |
function control = generateTrueNodalParameters(struc)
% function control = generateTrueNodalParameters(usr_par)
%
% Sets up material properties on the mesh.
%
%%%%%%%%%%% get the material properties
choice = struc.pdata;
mtol = 1e-8;
%%%%%%%%%%% get the material properties
switch choice
case 'egg' % (extr... |
function [PGM] = imageTodata(image,ps,ss)
[H, W, B] = size(image);
i_x = (1+ps):ss:(H-ps);
if i_x(end) ~= (H-ps)
i_x(length(i_x)+1) = (H-ps);
end
j_y = (1+ps):ss:(W-ps);
if j_y(end) ~= (W-ps)
j_y(length(j_y)+1) = (W-ps);
end
k = 1;
for i = 1:length(i_x)
for j = 1:length(j_y)
i_x_d = i_x... |
function []= spaceaxisX2CB;
%spaceaxisX2CB: button-down callback function for VAR space axis
%in spaceConsole
global GUI;
spaceaxes = gcbo;
point1 = get(gca,'CurrentPoint'); %drag-select point
finalRect = rbbox;
point2 = get(gca,'CurrentPoint');
point1 = point1(1,1:2); ... |
%%LECTURA DE LOS AUDIOS
audiox=audioread('C4_P2_G1.wav'); % aqui va el audio que se va comparar
audio1=audioread('C1_P1_G1.wav'); % Comando 1
audio2=audioread('C2_P1_G1.wav'); % Comando 2
audio3=audioread('C3_P1_G1.wav'); % Comando 3
audio4=audioread('C4_P1_G1.wav'); % Comando 4
Fs=44100; %Muestras de cada audio
%% CAL... |
clc;
clear all;
close all;
a=[1,-1,1;3,-3,1;1,1,0]
b=[2,-1,3]
ab=[a,b'];
ab
ab(2,:)=ab(2,:)-3*ab(1,:);
ab(3,:)=ab(1,:)-ab(3,:);
temp=ab(3,:);
ab(3,:)=ab(2,:);
ab(2,:)=temp;
ab
%soluzione
x(3)=ab(3,4)/ab(3,3);
x(2)=(ab(2,4)-ab(2,3)*x(3))/ab(2,2);
x(1)=(ab(1,4)-ab(1,3)*x(3)-ab(1,2)*x(2))/ab(1,1)... |
%{
Jacob Leonard
ITP 168 - Fall 2015
jaleonar@usc.edu
Revision History
Date Changes Programmer
-------------------------------------------------
11/11/2015 Original Jacob Leonard
%}
%read in the altitude values
M = transpose(dlmread('traj.txt'));
%develop the time vector that co... |
clear all, clc, close all
% load a .wav file
[x, fs] = audioread('carrier33.wav'); % get the samples of the .wav file
x = amplify(x);
x = x(:, 1); % get the first channel
xmax = max(abs(x)); % find the maximum abs value
x = x/xmax; % scalling the si... |
function [f, rsquared] = fit_or2dgauss(rf, degperGridPos, rfok)
%function [f] = autoGaussianSurfML(xi,yi,zi)
%
%Fit a surface zi = a*exp(-((xi-x0).^2/2/sigmax^2 + ...
% (yi-y0).^2/2/sigmay^2)) + b
%
%On the assumption of Gaussian noise through maximum likelihood
%(l... |
function createfigure(xvector1, yvector1)
%CREATEFIGURE(xvector1, yvector1)
% XVECTOR1: bar xvector
% YVECTOR1: bar yvector
% Auto-generated by MATLAB on 20-May-2018 13:17:45
% Create figure
figure1 = figure('Color',...
[0.972549021244049 0.972549021244049 0.972549021244049]);
colormap(hot);
% Create axes
a... |
[ndresp,sgisi] = ProcessDirs(ndresp,'nptDirCmd','a1 = readSurrogateBin(''framesg1.bin''); sgn = length(a1); repn = length(a1{1}); repsd = zeros(repn,1); for repi = 1:repn, repd = zeros(sgn,1); for sgi = 1:sgn, repd(sgi) = ~isempty(find(diff(a1{sgi}{repi})==0)); end; repsd(repi) = sum(repd); end; isireps = find(repsd); ... |
function [obj,avgWF,stdWF,ch,mergedNeurons]=spikeMergingClusters(obj)
%Merge waveforms belonging to the same neurons which were either not clustered correctly or were associated with different channels
avgWF=cell(1,obj.nCh);
stdWF=cell(1,obj.nCh);
ch=cell(1,obj.nCh);
isNoise=cell(1,obj.nCh);
if isempty(obj.sortingDir)
... |
%% A multistage deep neural network model for blood pressure estimation using photoplethysmogram signals
% This program trains and uses two seperate Long Short-Term Networks (LSTMs) to estimate Diastolic & systolic Blood Pressures.
% Trained LSTM Models: SystolicNet_Stage2_64Units_crp & DiastolicNet_Stage2_64Unit... |
% look at CF trends
clear all
Analyze_dates = [{'09.16.18'},{'09.20.18'},{'09.21.18'},{'10.01.18'},{'10.12.18'}];
%Analyze_dates = [{'09.20.18'},{'09.21.18'},{'10.01.18'},{'10.12.18'}];
fig_loc = '/media/ravinderjit/Data_Drive/Data/Figures/DynBin/Nerve';
addpath('../../Neuron Analysis Functions')
addpath('/media/ravi... |
function H = GHPF(I, rH, rL, c, D0)
%GHPF Gaussian high-pass filter.
%
% Inputs:
% - I: 2 dimensional array, typically an image in the spatial domain
% - rH: high values
% - rL: low values
% - c: affects the exponential in H. It is like a tug of war between
% D0 and c, ... |
% This is a (heavily) modified variant of Toby Breckon's original
% implementation (original header included below). Returns value of
% 1.0537e-08 for equal histograms, with more similarity tending towards 0,
% and less similarity tending towards 1. Correspondence by eye = 0.3, 0.5
% Taken from:
% https://code.google.... |
function ser = ser_lin_ostbc(channel_spec,const_index,stbc_index,r,ml,prec_spec)
% precision specification
N_BLOCKS=prec_spec(1);
BLOCK_SIZE=prec_spec(2);
N_SAMPLES=prec_spec(3);
% N_SAMPLES must be equal to N_BLOCKS*BLOCK_SIZE.
% load the channel
rk=channel_spec(1);
SNR=channe... |
function Good=SaberCheck
global vinf
% Check if any versions are "saber"
if (isfield(vinf,'energy_storage') & isfield(vinf.energy_storage,'ver') & strcmp(vinf.energy_storage.ver,'saber')) |...
(isfield(vinf,'energy_storage2') & isfield(vinf.energy_storage2,'ver') & strcmp(vinf.energy_storage2.ver,'saber')) ... |
function C = cmat2(A, alpha) % A is the original adjacency matrix
N = size(A,1); % A is square; 1 means "the number of rows"
outdeg=sum(A); % compute vector of out-degrees
C = zeros(N,N); % C has the same dimensions as A
% this nested loop goes through all elements of C
% i.e. it looks at every... |
tic
%%
file.folder = "C:\Users\panayimc\Box\NIDA_Expts\Papers\AAB_Analysis_2020\Summary";
file.subfolder = "GluA1KO";
file.name = 'GluA1AAB_Data.mat';
%
% List of DLC labels in order [from RawData.bodyparts]
nose = 1;
head1 = 2;
head2 = 3;
lear = 4;
rear = 5;
mid1 = 6;
mid2 = 7;
tail = 8;
innertopleft = 9;
innertopri... |
function output=normalization(X)
%将X进行归一化到0到1,一行一个样本,一列对应一个维度
[instanceNum,dim]=size(X);
output=X;
for k=1:dim
%找出每一维的最大值和最小值,通过一个线性映射将最大值映射到1,将最小值映射到0
minNum=min(X(:,k));
maxNum=max(X(:,k));
if(minNum==maxNum)
output(:,k)=zeros(instanceNum,1);
else
output(:,k)=(X(:,k)-minNum)/(maxNu... |
% Turk Lirasi Hesabi
img = imread('pictures\image3.png');
th = graythresh(img);
bw = imcomplement(im2bw(img,th)); %gri seviyeli resimlerde negatiflik alir
bw = bwareaopen(bw,30); % 30pixelden kucuk olanlar kaldiriliyor.
bw = imfill(bw,'holes');
SE =strel('disk', 50); % birlesik madeni... |
close all
clear
clc
t = -2:0.001:2;
y = pulsa(u(t+2)-u(t-2));
figure
plot(t,y)
axis([-2 2 -3.5 3.5])
grid on |
%% Auto exercice 2
clear all
clc
%%
% folder = "Data_Muscle\HAM\SANS DIST";
% folder = "Data_Muscle\TA\SANS DIST";
folder = "Data_Muscle\HF\SANS DIST";
%% Catch files
dirInfo = dir(folder);
files = [];
for index = 1:length(dirInfo)
files = [files; string(dirInfo(index).name)];
end
... |
function tests = generateFeaturesTest
tests = functiontests(localfunctions);
end
function testConstant(testCase)
X = [2 3 5; 7 11 13];
XP = generateFeatures(X, 'constant', false);
verifyEqual(testCase, XP, ...
[]);
XP = generateFeatures(X, 'constant', true);
verifyEqual(testCase, XP, ...
[1; 1]);
... |
classdef Ticks < handle
% TICKS 核心类。存放tick数据。
% last T*1;bid,ask采取矩阵,如T*5
% 20131220,和群;创建
% 20131223,程刚;放入qtool\framework\
% 商榷:按日的数据是否应保留?
% 20140503, chenggang, 加入plotind
% 20140606, chenggang, 加入properties: code2,date,date2
% 20140618, chenggang, 把一些properties放入hidden = true
% 20140715;程刚;加入toExcel方法
% 2014072... |
function GCplotSpike_onegrid(Result_cell)
% record the video of membrane potential dynamics
disp('GCplotSpike...');
Result_num = length(Result_cell);
for r_num = 1:Result_num
R = Result_cell{r_num};
Num_neu = R.N;
% Num_pop = R.Num_pop;
spike_hist = R.Analysis.spike_hist_combined;
file_name = R.sta... |
% function para=T1_fit(x,y,beta0)
% modelfun=@(a,x)(a(1)*exp(-x/a(2))*sin(2*pi/a(3)*x+a(4))+a(5));
%
% para=nlinfit(x,y,modelfun,beta0);
%
% figure;
% scatter(x,y);
% hold on;
% plot(x,para(1)*exp(-x/para(2))*sin(2*pi/a(3)*x+a(4))+a(5));
% title(['t2:',num2str(para(2)/2000),'us'])
% end
function [fitresult, gof] = T... |
function Li = calculate_Li(signal,fs,verbose)
% Feature from
% "An Algorithm Used for Ventricular Fibrillation
% Detection Without Interrupting Chest Compression", Li et al.
%
% INPUT:
% - signal: filtered ecg [mV]
% - fs: sampling frequency [sample/s]
% - verbose: flag variable, for debugging purposes
%
% OUTPUT:
% -... |
classdef mar3 < handle
properties
%prior = struct('coef_prec_gamma',[]);
prior = struct('coef_normal',[],'prec_gamma',[],'coef_mask',[]);
posterior = struct('coef_normal',[], 'prec_gamma',[]);
parsampl = struct('coef',[], 'prec',[]);
expectation
eelog ... |
function a1=ocupanciagraph(seq,tit)
x0=100;
y0=50;
dx=200;
dy=200;
if ~isstruct(seq)
%f=figure;
%f.Position=[x0 y0 x0+dx y0+dy];
nstates=length(unique(seq));
[a1 b11]=hist(seq,1:nstates);
b=bar(b11,a1/length(seq)*100);
x1=xlabel('BS','FontSize',10);
y1=yl... |
hold on
stairs(nine.time,nine.signals(2).values)
stairs(nine.time,nine.signals(1).values)
stairs(nine.time,nine.signals(3).values)
title('Test dla punktu linearyzacji = -0.5')
legend('dyskretny zlinearyzowany bez czlonu stalego','wartosc wzmocnienia','skok')
xlabel('t')
ylabel('y(t)')
hold off |
classdef OptMemberSlave < OptObjectSlave
properties
optNodeA
optNodeB
forceVariable
end
methods
function obj = OptMemberSlave()
end
function [matrix, obj] = initialize(self, matrix)
self.forceVariable = matrix.addVariable(-inf,inf... |
function f=frame(signal,fs,N)
%Shift percentage is 40%to cancel the background effect
%and Convert the signal to row vector
s=signal(.4*length(signal):end)';
Number_of_frames=240; %Number of frames
window_length=round(fs/Number_of_frames);%size of the frame
Frame_No=zeros(Number_of_frames);%The frame number
Frame_No(... |
function [R,Q,S,Sum_QRS] = Detection_QRS( ECGDER,signal,leads,Deteciton_rule_ECGDER)
%Funkce Detection_QRS má za úkol detekovat kmity Q, R a S.
%Vstupy funkcí jsou: ECGDER - derivovaný signál
% signal - přefiltrovný původní signál
% leads – počet svodů
% QR... |
%%Encoding
n=input('Enter codeword length:');
k=input('Enter message length:');
m=input('Enter the message:');
g=cyclpoly(n,k,'max');
m_flip=fliplr(m);
reg=zeros(1,n-k);
for i=1:k;
if(xor(reg(n-k),m_flip(i)))
for j=0:(n-k)-2;
reg(((n-k)-j))=xor(reg(((n-k)-j)-1),g(((n-k)-j)));
end
... |
% Hierarchical ALS algorithms for nonnegative matrix
% written according to the paper: A. Cichocki, R. Zdunek, and S. I. Amari.
% Hierarchical ALS algorithms for nonnegative matrix and 3d tensor factorization.
%
% [W,H,rel_err,t,iter] = hals(V,W,H,maxiter,timelimit,early_stopping,tol)
%
% Input.
% V : (... |
function t1=sfire_simple_mat(rr,t0,mask,ncycles)
% in:
% rr structure with 2d fields r11...r33
% t0 starting tign
% mask if not 0, update
% out:
% t1 updated ignition times
%
persistent r11 r12 r13 r21 r23 r31 r32 r33
if ncycles<=0,
r11=rr.r11;
r12=rr.r12;
r13=r... |
% -------------------------------------------------------------------------------------------------------------------------
function [responseMaps] = tracker_eval_tfeat(net_x, t_feat, x_crops, p)
%TRACKER_STEP
% runs a forward pass of the search-region branch of the pre-trained Fully-Convolutional Siamese,
% reusi... |
function obj = linearRegressionScoreFcns(llstr)
if strcmp(llstr, 'poiss')
obj.llFcn0 = @(x, y, w, hyper) -tools.neglogli_poissGLM(w, ...
tools.ifNecessaryAddDC(x, w), y, @tools.expfun);
obj.llSatFcn = @(trials) -tools.neglogli_poissGLM(1, ...
trials.y_test, trials.y_test, @(x... |
% Paths to be need to be added to run main correctly
addpath utilities/
addpath data/
addpath Track/
addpath Optimization/
addpath Car/
% Warning settings
warning('off', 'MATLAB:load:variableNotFound')
|
function [fint,sigma_new,eps_new,hvar_new,aux_var,sigma_nodo] = elem_int_force_bbar_hexahedral(...
coord_n,u,hvar_old,Eprop,ce,e_VG)
%global_var
struhyp = e_VG.struhyp;
conshyp = e_VG.conshyp;
npe = e_VG.npe;
dofpe = e_VG.dofpe;
npg = e_VG.npg;
xg = e_VG.xg;
wg = e_VG.wg;
ntens = e_VG.ntens;
sihv... |
function [dr, ds, dt] = derivative_orthogonal_func( obj, N1, N2, td, r, s, t)
td1 = mod( td-1, obj.Nph ) + 1;
td2 = ceil( td / obj.Nph );
[ dr, ds ] = tri_derivative_orthogonal_func( N1, td1, r, s);
[ ft ] = line_orthogonal_func( td2, t );
% multiply the vertical polynomial
dr = dr .* ft;
... |
% ********************* RUN THIS FILE ***********************
clear
clc
close all
lab2params %load params
load('work_map.mat')% get map
load('events_final.mat') % x_event y_event, eventpoints
%% generate trajectory
% initially in origin
%[xx, yy] = supervisor_create_trajectory(0,0,0,x_c,y_c,x_cp,y_cp,G);
[xx, yy]... |
close all
clear all
clc
addpath([pwd,'\MakeMeshSubfunctions'])
voxelsize=[0.0625,0.0625,0.0625]; %element pixelsize in the x, y, and z direction
if(numel(voxelsize)==1)
voxelsize(1:3)=voxelsize;
end
%[faces,vertices] = readSTL('Rotated Irregular Pressure Vessel.STL','inches');
[faces,vertice... |
classdef qubit < sqc.qobj.qobject
properties
channels
f01
end
end |
files=glob('/Volumes/ice2/ben/GreenlandSimGF/*v4*/*sigparm*.h5');
fid=fopen('ATL06_queue.txt','w');
for k=1:length(files);
disp(files{k})
[out_file, filename]=proc_one_GL_sim_file(files{k}, true);
if ~exist(out_file,'file');
fprintf(fid,'proc_one_GL_sim_file(''%s'');\n', files{k});
end
end
|
function [sse] = SQRLCV(x, y, grp, lambda, ertol)
N = length(y);
sse = 0;
indices = crossvalind('Kfold',N,10);
for i = 1:10
xtrain = x(indices~=i,:);
ytrain = y(indices~=i);
xCV = x(indices==i,:);
yCV = y(indices==i);
if max(grp)==1
[betaEst] = Lasso_cvx(xtrain, ytrain, grp, lambda, e... |
function coeff_compression_avant_decorrelation = coeff_compression_image(histogramme,dico)
%COEFF_COMPRESSION_IMAGE Summary of this function goes here
% Detailed explanation goes here
nb_bits_image_avant_compression=8*sum(histogramme);
nb_bits_image_avec_compression=0;
for i=[1:length(histogramme)]
nb_bits_image... |
close all;
clear all;
solveProblem;
alpha = [0 0.5 1];
% raw_data = {};
%
% clear G opts;
% opts = plannerSolve('defaults');
% opts.Display = 'off';
% opts.MaxIter = 200;
% opts.TimeStep = 1/25;
%
% allLengths = {};
% allEffectiveness = {};
% allEfficiencies = {};
% supLength = -inf;
% supEffectiveness = -inf;
% ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.