text stringlengths 8 6.12M |
|---|
%% DemoSimuAndRecon.m
%
% This script defines a parallel MRI experiment setting, with analytically
% defined phantoms. Simulation can be performed in two different ways and
% the resulting data is corrupted by noise. This synthetic scanner data is
% prepared for reconstruction. Finally, several reconstruction methods a... |
[ GMD, GMRL, GMRC] = gmd;
L=0.2*log(GMD/GMRL) % mH/km Eq. (4.58)
C = 0.0556/log(GMD/GMRC) % micro F/km Eq. (4.92)
diary off
|
function [ lambdau,xu,Pu,r_update,x_update,p_update ] = ...
recycling_v2( w_update,r_update,x_update,p_update,lambdau,xu,Pu,threshold )
% Recycling using variational approximation
len = length(w_update);
r_recycle = cell(len,1);
x_recycle = cell(len,1);
p_recycle = cell(len,1);
M = zeros(len,1);
for i = 1:len
... |
function [xxP,yyP]=TgetRP(nx,ny,ax,ay,x0)
# x0: sredisce plosce pri -ax/2-dPT
n2=nx*ny;
for i=1:n2
[ix,iy]=TgetixyP(i,nx,ny);
[xxP(i),yyP(i)]=TgetxyP(ix,iy,nx,ny,ax,ay,x0);
endfor
endfunction
|
function CheckMappingTransform1(data_set_label,image_label,traj_numbers)
% This function takes a data_set_label such as 'ATPase-GFP TIRF FRAP' or 'cybD-mCherry &ATPase-GFp',
% an image_ label such as '513', '490', etc... which corresponds to a certain .sif number of image sequence,
% and certain trajectory numbers, t... |
function [FrameData] = createFrameData()
%Creates the frameData - an image dataframe with the middle frames in it.
frameDir = getFrameDir();
cd(frameDir);
FrameDatasetPath = fullfile(cd);
FrameData = imageDatastore(FrameDatasetPath,...
'IncludeSubfolders',true,'LabelSource','foldernames');
end
|
% debug ports
clc; close all
totEdges = importdata('totEdges')+1;
totNodes = importdata('totNodes');
porti1 = importdata('EigVecDoFWavePort1.dat')+1;
porti2 = importdata('EigVecDoFWavePort2.dat')+1;
portS = importdata('portAWavePort1.dat');
portT = importdata('portBWavePort1.dat');
edges = importdata(... |
% Figure_ASECurveComparison.m
%
% Plot a figure (for ISMRM 2019 abstract) showing a comparison of different ASE
% curves, from in vivo data, the SDR qBOLD model, and the Sharan distribution
clear;
% close all;
setFigureDefaults;
% load in and slightly curate some data
load('../../Data/vesselsim_data/vs_arrays/TE84_v... |
%%
% Function which extracts planes
% Author: Edward Stevinson
%%
function [plane_list, points_matrix] = extract_planes(point_cloud, colours)
[num_points_in_cloud, ~] = size(point_cloud);
% patch_id?
%patch_id = zeros(num_points_in_cloud,1);
% Store plane parameters
plane_list = zeros(9,4);
points_matrix = cell(1,9);... |
function [di,dv,pd] = parsecrtdigitalinanalog(stream,pp,ht,lt)
%PARSECRTDIGITALINANALOG Get digital photodiode flips on a CRT display
% Detailed explanation goes here
[ph,pi]=findpeaks(single(stream),'MinPeakProminence',pp);
[di,dv]=NeuroAnalysis.Base.parsedigitalinanalog(ph,length(ph),ht,lt);
di=pi(di);pd=mean(diff... |
function [fsoft, fbone, pho] = materialSegmentationFree( img, muSoft, muBone )
% Material segmentation with continoust transitision between softtissue and
% bone
% Input:
% img - image to segment
% muSoft - attenuation of soft tissue
% muBone - attenuation of bone
% Output:
% ... |
%Number 6 in Review
%Calculate the Root Mean Square Error
function [e] = RMSE(a,b)
%The square root of the mean of the squared error
e = sqrt(mean((a-b).^2));
end |
function [similarity,R] = get_similarity(im1,im2)
if numel(im1) > numel(im2)
tmp1 = im1;
[m,n,~] = size(im1);
tmp2 = imresize(im2,[m,n]);
elseif numel(im1) < numel(im2)
tmp2 = im2;
[m,n,~] = size(im2);
tmp1 = imresize(im1,[m,n]);
else
tmp1 = im1;
tmp2 = im2;
end
% tmp1 = gpuArray(tmp1);
... |
classdef MvnConjDist < MvnDist & BayesModel
% Multivariate Normal Conjugate Distribution
% Operations mean , mode , var , cov , entropy , logPdf , sample , plotPdf,
% etc are w.r.t. the predictive distribution. If this model hasn't been fit
% to data, they are w.r.t. to the prior predictive. You must specify a
% pr... |
Neem aan dat het code commentaar in het onderstaande
voorbeeld de gewenste handeling beschrijft.
De code hieronder bevat een programmeerfout:
======= Code =======
varA = 1;
varB = 2;
% Aftrekken van de variabelen
som = VarB - VarA
======= Code ======= |
function d = distPointLine( point, line )
% d = distPointLine( point, line )
% point: inhomogeneous 3d point (3-vector)
% line: 2d homogeneous line equation (3-vector)
point = point / point(3,:);
d = abs(sum(point .* line));
d = d / sqrt(line(1)^2 + line(2)^2);
end
|
%% Runs question 2 and generates the output
% normalise
%%
%image=load('../images/barbara.mat');
%[imageOut,rmsd]=PatchFilter(image.imageOrig);
%for debugging
addpath('../../export_fig-master/');
clear
ourimage=load('../images/barbara.mat');
imageRaw=ourimage.imageOrig;
%rng(25);
imageIn=CorruptImage(imageRaw/100,0.... |
function EEG = eeg_icartifact_hem(EEG, stat, crit);
% EEG = eeg_icartifact_hem(EEG, stat, crit);
% NOTE: this function is deprecated, see its replacement >>help proc_subcomp
%make sure ICA done!
if isempty(EEG.icaweights)||isempty(EEG.icasphere)
disp(['No ICA computed for ' EEG.filename '! Returning EEG variable w... |
% Activity 12: Scripting best practices
% This file does NOT represent best practices... we have hard coded values,
% poor variable labeling, and long lines of code.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
close all
% Set Parameters
t = 0:0.01:2;
temp1 = 0.5;
temp2 = 1.5;... |
%Donne le nombre d'éléments de a et b qui ont la même valeur à la même position
function [ result ] = common( a, b )
result = 0;
for i = 1 : length(a)
if (a(i) == b(i))
result = result +1;
end
end
end
|
function PSA = responsespectrum(T,s,zi,dt)
na = length(T);
nb = length(s);
SD = zeros(na,1);
for j = 1 : na
om = 2*pi/T(j);
ub = duhamel(om,zi,1,dt,nb,0,0,-s);
SD(j) = max(abs(ub));
end
PSA = (2*pi./T').^2 .* SD;
|
%% Lattice manipulation
%
%%
% <matlab:doc('isatlattice') isatlattice> - Tests if an input argument is a valid AT lattice
%
%% Access elements
%
%%
% <matlab:doc('atindex') atindex> - Extracts the information about element families and
%
% <matlab:doc('atgetcells') atgetcells> - Performs a search on MATLAB cell array... |
function y = Psi4f(f,Theta)
% Psi4f returns the fiber stress of a deformed fiber "f" given the model
% parameters "Theta(3)" and "Theta(4)" corresponding to the exponential
% Holzapfel-Ogden model
I4 = norm(f).^2;
y= Theta(3)*(I4-1).*exp(Theta(4)*(I4-1)^2);
|
function mat = Matern_pars(r, sigma1, sigma2, rho12, nu1, nu2, a)
%MATERN_PARS Evaluates the parsimonious bivariate Matern cross-
%covariance function.
%
% MAT = MATERN_PARS(R, SIGMA1, SIGMA2, RHO12, NU1, NU2, A);
%
% Inputs:
% R - the Euclidean distance between two locations
% SIGMA1, SIGMA2 - the standard dev... |
classdef testMDP < MDP
properties
action_features=3;
end
methods
function mdp=testMDP(nr_actions,gamma)
mdp.nr_actions=nr_actions;
mdp.actions = 1:nr_actions;
mdp.gamma=gamma;
mdp.actions=1:mdp.nr_actions;
mdp.action_featu... |
%ssget('Newman/karate')
%load('Newman/karate.mat')
%load('two_clique_Newman.mat')
%ssget('HB/lap_25')%
%load('HB/lap_25')
%load('HB/saylr1')
%load('grid10x10.mat')
%load('twitter.mat')
%load('star_path_star2.mat')
%load('HB/1138_bus')
%A = Problem.A;
%G = graph(A);
%A = G.adjacency;
%plot(G)
A(A > 0) = 1;
[~, n] = size... |
%model parameters
M = 1;
m = 3/4;
b = 0.1;
k = 0.15;
g = 9.81;
L = 0.9; %uncertain parameter range [0.9-1.9]
%% Initial values
x_0=0;
x_dot0=0;
x_dotdot0=0;
theta_0=pi/2;
theta_dot0=0;
theta_dotdot0=0;
MODEL; |
## SPRING MASS DAMPER SYSTEM WITH GRAVITY
clear all
close all
clc
pkg load control
m = 0.5;
g = 9.81;
k = 1.0;
b = 2.0;
w_n = sqrt(k/m);
a = [1+m*g];
b = [m, b, k];
sys = tf(a,b);
figure(1)
bode(sys)
|
function train_id_net_minist(varargin)
% -------------------------------------------------------------------------
% Part 4.1: prepare the data
% -------------------------------------------------------------------------
% Load character dataset
imdb = load('./data/mnist/imdb.mat') ;
set = imdb.images.set;
imdb.images.... |
function [Y, Cb, Cr] = stats_predErr_ord3_min_H_dec(img_Y,img_Cb,img_Cr, Y_pred, CbCr_pred)
%STATS_COND Summary of this function goes here
% Detailed explanation goes here
[ ORIGINAL_height ORIGINAL_width ORIGINAL_dimensions ] = size(img_Y); % size of the original image
matrix_predErr_ord3_Y = zeros(ORIGINAL_heig... |
function G_f = calibrate_measurement_45( channels,probe,reading,spectrum_z1_a, spectrum_z0_a, spectrum_z1_c,...
spectrum_z0_c,fsteps, gain_matrix_g, s0)
%Function : calibrate_measurement_45. It is used to compute the calibrate
%constants
%
%Output : 1)G_f
%
% Input : 1) channels
% 2) probe
% 3) ... |
function rawData = fDAQAcquire(NIDAQ, DAQType, tVector)
global sessionData
timeDelay=.001;
if strcmpi(DAQType, 'legacy')
isrunning(NIDAQ); %checks if the DAQ is responding
%if the DAQ runs into memory trouble, we stop and start the acquisition and reset everything
if isrunning(NIDAQ) == 0;
stop(N... |
function varargout = fhpkg_cns_type_li1(method, varargin)
% Defines the "li1" cell type. These cells, together with "li2" cells, implement the lateral inhibition described in
% section 2.3 of [Mutch & Lowe 2006] (under heading "inhibit S1/C1 outputs"). "li1" cells look at all the cells in
% a single (y, x) position ... |
%Виртуальный полигон баллистических ракет
%Выбираешь ракету, соответствующий закон изменения угола тангажа,
clear
%Папка для функций
cd function
%Константы
R_E=6.37111e6; %--радиус Земли, м
M_E=5.972e24; %масса земли
Grav_post = 6.674e-11;
global R_E M_E Grav_post S_rocket t t_0 windage_function St_fall ... |
clear;clc;
tic
%%
fold_path='Y:\Andrea_EPH_cluster\Data\';
in_thresh.Area=500;
in_thresh.MajorAxisLength=5;
in_thresh.MinorAxisLength=5;
in_thresh.MeanIntensity=0.1;
% in_thresh.Perimeter=15;
% in_thresh.EquivDiameter=3.5;
% in_thresh.Eccentricity=0.45;
% in_thresh.Solidity=0.55;
% in_thresh.Roundness=0.2;
%Adjust l... |
img_LR = imread('\data\img_LR.png');
input = im2double(img_LR);
output3b(250*4,250*4,3) = 0;
for(i = 5:1000)
for(j = 5:1000)
for(k = 1:3)
a = ceil(i/4);
b = ceil(j/4);
%weighted sum of the neighbor
output3b(i,j,k) = (a-i/4)*(b-j/4)*input(a-1,b-1,k) + (a-i/4)*(... |
function [X,Zf] = moving_average(N,X,Zi,dim)
% Like filter() for the special case of moving-average kernels.
% [Y,Zf] = moving_average(N,X,Zi,Dim)
%
% This is an overall very fast implementation whose running time does now grow with N (beyond
% N=500). The algorithm does not run into numerical problems for large data s... |
function [PAT_ref_PATnavCor_kspace] = ghost_correct_pat_ref_v1_STD_bb(prot, PAT_ref,PAT_nav, AccY)
%% ________________________________________________________________________
%% Ghost correction for FLEET Ref Data
%% ________________________________________________________________________
%%
%% _______________________... |
function plot_quest_results(op,int_spdX)
for whPos = 1:8
for whTrj = 1:2
for whIll = 1:2
field_nm = sprintf('Stim%d%d%d',whPos,whTrj,whIll);
spd(whPos,whTrj,whIll) = op.(field_nm).avg;
end
end
end
%%
close all
figure(1);
ax = gca;
for whPos = 1:8
subplot(1,8,whPos);
... |
function S=s_star(A,B,C,D,tol)
%S_STAR Strongly Controllable Geometric Subspace
%
% S = s_star(A,B,C,D)
%
% computes a matrix whose columns span the geometric subspace
% S^{*} for a system characterized by (A,B,C,D).
%
% Note that this function is applicable for both continuous-
... |
% Simulation of massive Kuramoto model/HMF model
tic
clear all ;close all; clc;
N=80; %No of coupled pendulum
T=500;% Total time
tau=0.01;% Timestep
combination=10;
%% Defining the coupling constant K
Klow = 0; Kup = 3.5; Kstep = 0.01;
totsteps = round((Kup-Klow)/Kstep);
Ktot=zeros(totsteps,1);
Ktot(1) = Klow;
f... |
function ShowTransforms()
% function ShowTransforms()
% Shows the transform matrices behind the DCT, DST, and FHT.
% GVL4: Section 1.4
n = 8;
I = eye(n,n);
for k=1:n
ek = I(:,k);
C(:,k) = DCT(ek);
S(:,k) = DST(ek);
H(:,k) = FHT(ek);
end
clc
disp('DCT Matrix =')
fprintfM(' %7.3f',C)
disp('DS... |
%%%Localization and Circumnavigation of a Slowly Moving Target Using Bearing Measurements
%%%仅按照改文章进行仿真
clear all;
close all;
clc;
targetRealPos(:,1)=[2;4];
targetRealVel(:,1)=[0.1;0];
targetEstPos(:,1)=[4;3];
targetEstVel(:,1)=[0;0];
obsPos(:,1)=[15;15];
obsVel(:,1)=[0;0];
constantVel=5;
trackingR=2;... |
clear all;
%% Code dir
FEATURES_DIR = '/data/giulia/REPOS/objrecpipe_mat';
addpath(genpath(FEATURES_DIR));
%% VL FEAT
vl_feat_setup();
%% GURLS
gurls_setup();
%% MATLAB CAFFE
%caffe_dir = '/usr/local/src/robot/caffe';
caffe_dir = '/data/giulia/REPOS/caffe';
addpath(genpath(fullfile(caffe_dir, 'matlab')));
%% Globa... |
function [elems_buf,elems_offsets,reg_sibhfs,visited]=...
fliphybnxm(n,m,ntets,elems_buf,elems_offsets,reg_sibhfs,isort,...
common1,common2,mtet,tempsort,itemp,visited) %#codegen
%
% This routine performs the n-to-m flip
%
% INPUT ARGUMENTS -
%
% ntets - the n tets in the old cycle
% mtet - the connectivity of ... |
% Compare algorithms on a simple mass spring example
load lqrsp/examples/neData;
W = B1*B1';
B = B2;
K0 = -lqr(A,B,Q,R);
lambda = 0.1;
% ADMM
clear params;
params.max_iters = 300;
params.rho = 100;
[K1,h1] = lqrsp_admm(A,B1,B,Q,R,-K0,lambda,params);
% FISTA
clear params;
params.max_iters = 300;
params.step = 1e-2;
... |
function e = extract(E)
e = mod(ceil(E/20),2);
end |
function compareBoxFunctions()
% This file compares the performance of the box functions for mhypro and
% cora.
mh_box1 = MHyProBox('intervals', [0 1; 1 12; -1 10; -10 5; 20 34]);
cora_box1 = interval([0;1;-1;-10;20], [1;12;10;5;34]);
mh_box2 = MHyProBox('intervals', [-10 1; 7 12; -5 11; -6 3; 0 3]);
cora_box2 = int... |
function ballbeam(action)
if nargin < 1
action = 'initialize';
end
persistent ballradius beamlength beamwidth
persistent xmin xmax umin umax g dt
persistent t x v u done
persistent Kp Td N xsp xlast dterm Ad Bd
persistent ballHndl xball yball
persistent beamHndl xb... |
% not rewritten yet
close all
A=1e-4;
m=importdata('../orbit_results/poink.plt',' ',2);
poink=m.data;
p=poink(:,1);
t=poink(:,2);
x=poink(:,3);
z=poink(:,4);
time=poink(:,5);
e=poink(:,6);
pz=poink(:,7);
subplot(1,3,1)
plot(x,z,'.','MarkerSize',8)
xlabel('X')
ylabel('Z')
title(['A=',num2str(A)])
subplot(1,3,2)
plot(pz,... |
clear; clc; setup; config_re_waveform;
%% ! WIT/WPT waveform with and without IRS vs number of subbands
reIrsSample = cell(nChannels, length(Variable.nSubbands));
reNoIrsSample = cell(nChannels, length(Variable.nSubbands));
reIrsSolution = cell(nChannels, length(Variable.nSubbands));
reNoIrsSolution = cell(nChannels,... |
function data_cube_slice(labels, available, type)
%DATA_CUBE_SLICE 此处显示有关此函数的摘要
% 此处显示详细说明
if strcmp('original', type)
data_path = '../Data/Bbox/';
save_path = 'Bbox/';
elseif strcmp('resize', type)
data_path = '../Data/Resize/';
save_path = 'Resize/';
elseif strcmp('core', type)
data_path = '../D... |
function obj=stat_bin2d(obj,varargin)
% stat_bin2d() Makes 2D bins of X and Y data and displays count
%
% Parameters as 'name',value pairs:
% - 'nbins': Array in the form of [nxbins nybins] to set the
% number of bins in each dimension
% - 'edges': Cell in the form of {[x__edges] [y_edges]} to set
% custom bin edges fo... |
function sdp=sdpooled(s1,s2,n1,n2,doaspaired)
% returns the pooled standard deviation
% usage: sdp=sdpooled(s1,s2,n1,n2)
% OR sdp=sdpooled(dat) where dat is 2 columns
if nargin<5, doaspaired=0;
if nargin<2
dat=s1;
s1=std(dat(:,1)); s2=std(dat(:,2)); n1=size(dat,1); n2=size(dat,1);
sdp=sdpooled(s1,... |
function res = optimal_exploration_noise(ops)
% given:
% - nominal model
% - initial parameter uncertainty
% - user-defined budget
% - nominal controller
% this function computes:
% - optimal exploration noise Se
% - the worst case cost
%%
% nominal model
Ab = ops.A;
Bb = ops.B;
% nominal controller
K0 = ops.K;
[Nx,... |
function testSet = loadTestSet(ID, varargin)
% Loads test sets
% -------------------------------------------------------------------------
% trainSet = loadTrainingSet(SetName, varargin)
% -------------------------------------------------------------------------
% INPUT
% REQUIRED
% SetName
% OPTIONAL... |
function n = Brep_nrm( obj )
for i = size(obj.tri,2):-1:1
p = obj.p( 1:3, obj.tri(:,i) );
n(:,i) = cross( p(:,2)-p(:,1), p(:,3)-p(:,1) );
n(:,i)= n(:,i) ./ norm(n(:,i));
end
|
function [] = FR_to_calcium(results_folder)
global scripts_folder
load('Calcium_Traces.mat');
files = dir('*.xlsx');
if ismember('CalibrationCurve.xlsx',{files.name})
[param_calib_curve]= (xlsread('CalibrationCurve.xlsx'));
f = @(fr) (-param_calib_curve(1) + param_calib_curve(2) *f... |
% anal_deriv_print2f.m
%anal_deriv_print2f(filename,fx,fxp,fy,fyp,f,ETASHOCK, fypyp,fypy,fypxp,fypx,fyyp,fyy,fyxp,fyx,fxpyp,fxpy,fxpxp,fxpx,fxyp,fxy,fxxp,fxx);
% Writes symbolic derivatives of the equilibrium conditions of a DSGE model to an m-file for numeric evaluation.
% inputs:
% filename: ' ...' name of ... |
function [mv] = blocksearch8x8(curr_block,prev_frm,loc)
%BLOCKSEARCH8X8 Summary of this function goes here
% Detailed explanation goes here
h = loc(1); %loc of first pixel of current block
w = loc(2);
mv = [0 0];
SSE_Loc = [0 0];
SSE_Loc_End = 0;
SSE = 0;
[H, W, ~] = size(prev_frm);
curr_block_1 = curr_block(:,:);
... |
function Write_CASTEP(Ind_No)
% created by Zamaan Raza
global POP_STRUC
global ORG_STRUC
atomType = ORG_STRUC.atomType;
Step = POP_STRUC.POPULATION(Ind_No).Step;
numIons = POP_STRUC.POPULATION(Ind_No).numIons;
COORDINATES = POP_STRUC.POPULATION(Ind_No).COORDINATES;
LATTICE = POP_STRUC.POPULATION(Ind... |
%{
mov3d.DecodeTime (computed) # calcium trace
-> preprocess.Sync
-> mov3d.DecodeOpt
-> preprocess.SpikeMethod
-> preprocess.Method
---
obj_cis : longblob # classification performance for trials that follow same object
obj_trans : longblob ... |
function process_2d_accel_fit(fname)
f_mat=dir([fname '*']);
for i=1:length(f_mat)
S=load(f_mat(i).name);
poi = cell(1,length(S.poi));
for j = 1:length(S.poi)
poi_start = S.poi{j}(1)*1e6/S.si;
poi_end = S.poi{j}(end)*1e6/S.si;
poi{j} = poi_start+1:poi_end;
end
if_plot=0;
... |
function [ WSN_PCAWavelet_Predicted_Matrix, WSN_PCAWavelet_Predicted_OriginalSignal_Matrix, FaultDscription_Vector, QValue_Vector, QValue_Contribution_Matrix ] = WSN_PCAWavelet_Prediction( WSN_PCAWavelet_Predict_Normalized_DataCell,WSN_PCAWavelet_TargetOriginal_DataCell, ReducedOrder_PCAWavelet_Matrix, ReducedOrder_PC... |
function [top_left, top_right, bottom_right, bottom_left] = Quadrants(G)
%QUADRANTS Takes a matrix and divides it into 4 submatrices
% Takes a matrix and divides it into 4 submatrices numbered q1-q4. The
% submatrices are arranged clockwise staring from top-left, q1.
[rows, columns] = size(G);
half_rows = rows / 2... |
function [ M2V, V2P, s, rms ] = ...
optimizeCameraAndScale( featureImage, featureVertex )
% Tao Du
% taodu@stanford.edu
% Mar 16, 2015
%
% Given featureImage and featureVertex, estimate the camera matrix K, R, t
% and the scaling factor s. The algorithm alternates between [M2V, V2P] and
% s, until they converge.
%
% ... |
function obj = mapjoints(obj,joints)
% I_parts containing only one solid will be converted to Components, so
% in this case the mapping must be run for this component only
% todo: in subasm suchen und kombination aus occ & body finden
if isa(obj,"Assembly")
for j = 1:length(joints)
... |
function AutoAssociator_Detect()
% This function to detect by trained auto-associator.
addpath ../MNIST
% Load Images & Labels
% Training samples
% images=loadMNISTImages('../MNIST/train-images.idx3-ubyte');
% labels=loadMNISTLabels('../MNIST/train-labels.idx1-ubyte');
% Test samples
images=loadMNISTImages('.... |
function data = getFeatures(config, data, setting, step)
if length(data.mode)<size(data.features, 1)
data.features(end, :) = []; % TODO fix this
end
if length(data.mode)<length(data.file)
data.file(end) = []; % TODO fix this
end
switch setting.split
case 'none'
idx = 1:length(data.file);
case 'oc... |
function [ XKal, YKal, CovKalman ] = EstimateFromExtKalman ( InitState, X_m, Y_m, V, t, initCov, sigmaAcc)
%state kalman is [x y dot{x} dot{y}]
%initCov must be a 4 element column vector
%InitState must be a 4 element column vector
%initial state and covariance
StateKalman(1:4,1) = InitState; %try [X_m(1); Y_m(1); DX(1... |
clc;clear all;close all
markers = ["lef","lbd","lelb","lelb1","lie","ref","rbd","relb","relb1","rie"];
addpath('F:\github\wearable-jacket\matlab\dataanalysis_codes')
Ndef = 30;Ndbd = 30;Ndelb = 40;Ndie = 25;Ndelb1 = 30;smoovar = 2;
subjectID = [312,2064,2463,2990,3154,3162,3380,3409,3581,3689,5837,6219,6339,6525,7612,... |
% function [Roll,Pitch] = FindAngle(rawData,alpha)
% inputs: rawData - raw Data from sensors in a table
% alpha - alpha for MA on roll and pitch
% outputs: Roll
% Pitch
function [Roll,Pitch] = FindAngle(rawData,alpha)
rawGyroX = rawData.gyro_x; rawGyroY = rawData.gyro_y;
rawAccX = rawData.gr... |
function test_orthonormal
% Test code for the orthogonal and orthonormal_basis functions.
% Copyright © 2010 Stephen J. Sangwine and Nicolas Le Bihan.
% See the file : Copyright.m for further details.
disp('Testing orthogonal and orthonormal_basis functions ...')
T = 1e-12;
% The first set of tests depend on the ch... |
clear;
clc;
clf;
% data
days = [1 32 60 91 121 152 182 213 244 274 305 335]';
h = [6.2 8.1 10.6 12.9 15.5 18.1 18.5 16.3 14.0 11.5 8.6 6.6]';
% quadratic interpolation
A = [days.^0 days.^1 days.^2];
% days.^3;
% Linjär algebra o som i slidesen kräver tre givna punkter - andragrads. transponat efter matrisdiv. till s... |
function [ x, Atri ] = f_gaussian( A,b )
% Filler code - replace with your code
x = zeros(size(A,1),1);
Atri = zeros(size(A));
% Create upper triangle matrix
for i = 1:(size(A,1)-1)
elim_var = A(i, i);
mult_factor = A((i+1):end, i)./elim_var;
mult_factor = repmat(mult_factor, 1, size(A, 2));
A((i+1):end, :)... |
% MIT License
% Copyright (c) 2019 Salma Dhifallah and Islem Rekik.
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
% in the Software without restriction, including without limitation the rights
% to ... |
clear all
close all
L1=0.405;
L2=0.433;
L3=1.075;
L4=1.762;
L5=0.165;
L6=0.25;
L8=0.75;
t10=[0,0]*pi/180;
t21=[58,-58]*pi/180;
t31=[25,-35]*pi/180;
t43=[0,0]*pi/180;
t51=[-90,90]*pi/180;
x=L1+L3*cos(t21)+L4*cos(t31)-L5*sin(t31)+L6*cos(t31)+L8*cos(t51)
y=L2+L3*sin(t21)+L4*sin(t31)+L5*cos(t31)+L6*sin(t31)+L8*sin(t51)
y... |
function ShowMessage(msg, screenNum, speak);
% Show a simple text message to the user, prompting them to press the
% button to continue.
%
% ShowMessage(msg, [screenNum=max( Screen('Screens') )], [speak=1]);
%
% This code was created for the purpose of prompting a subject in the
% middle of a series of runs as to wh... |
%{
olf.OlfResponses (computed) #
-> preprocess.SpikesRateTrace
-> olf.RespOpt
---
resp_on : mediumblob # on response matrix [stimuli trials]
resp_off : mediumblob # off response matrix [stimuli trials]
stimuli : mediumblob ... |
% Este programa retorna a resposta do exercício 20 da lista 1.
disp('20)Calcule o número de dentes da engrenagem A, sabendo-se que nA/nB = 1/3.')
i=1/3 % redução total do sistema.
ZB=24 % números de dentes da engrenagem movida 1.
ZC=50 % números de dentes da engrenagem movida 2.
ZD=40 % números de dentes da engren... |
function [all_feats,timestamps]=getWindowedFeats(raw_data, fs, window_length, window_overlap)
% getWindowedFeats.m
%
% Description: Same as getWindowedFeats but trying to parallelize the
% whole thing
%
% Inputs: raw_data: The raw data for all patients
% fs: ... |
function [fx,fy]=grad_HW2fun2Df(x,y)
fx=2*x
fy=3.*y.^2-3.*x;
end %function |
function processed = preprocess_lfp(matfile, binsize, band, fn_out)
%Preprocess LFP from matfile for spontaneous activity
%
%Will do the following:
% - bandpass filter at a specified band
% - rectify signal
% - smooth signal and downsample to binsize
%
%Usage:
% processed = preprocess_lfp(matfile, binsize, ba... |
function a = fixAngle(x,inc)
% fixAngle.m
% This function minimizes the standard deviation between the angles of grouped curvelets, making a more accurate mean angle
%
% Carolyn Pehlke, Laboratory for Optical and Computational Instrumentation, July 2010
bins = min(x):inc:max(x);
temp = x;
angs = x;
stdev = zeros(1,l... |
%function [TrainingTime, TrainingAccuracy, TestingTime, TestingAccuracy] = test_examples_CNN(TrainingData, TestingData)
%{
clear all; close all; clc;
addpath('../data');
addpath('../util');
load mnist_uint8;
%}
%{
train_x = double(reshape(train_x', 28, 28, 60000)) / 255;
test_x = double(reshape(test_x' , 28, 28, 1000... |
% Author : Mathieu Bresciani
% More details on "Robust exact differentiation" :
% http://www.tau.ac.il/~levant/mathappl/dfr_inst.pdf
clear all
close all
clc
Ts = 0.001;
t = 0:Ts:10;
nEpochs = length(t);
f = 0.5*sin(0.5*t)+0.5*cos(t);
f1 = 0.25*cos(0.5*t)-0.5*sin(t);
L = 1;
z0 = 0;
z1 = 0;
z0_mem = zeros(1,nEpochs... |
clc;
close all;
clear all;
A=imread('IA.bmp');
hA=imhist(A); % hA will be a vector which will contain total number of pixels at 256 instensities
hA(101) % this will display the no of pixels having 100 intensity (101-1)
sum(hA(101:151)) % To display the sum of pixels having intensity between 100 to 150 for the image
%... |
%% »ΝΌ
hold on;
plot([x(i),x(j)],[y(i),y(j)]);j=1;i=2
plot(x(j),y(j),'o','MarkerSize',4,'MarkerFaceColor',[0,0,0])
plot(x(1),y(1),'o','MarkerSize',10,'MarkerFaceColor',[1,0,0]);
plot(x(j),y(j),'o','MarkerSize',2,'MarkerFaceColor',[0.5,0.5,1])
r=611:-1:101;
t=r;
x=r.*cos(t);
y=r.*sin(t);
n=5;
plot_name={'BABAI,LASZLO'... |
numeric = csvread('numeric.csv');
disp('loaded!');
r = spconvert(numeric);
disp(size(r));
|
% Test QR algorithms
clear all; clc;
A = rand(5,5);
% MATLAB's default
[Q,R,P] = qr(A, 'vector');
% Businger and Golub approach
[R2,P2] = qr_BusingerGolub_pivoting(A);
|
clear all;
close all;
X = (-3:0.01:3)';
Y = sinc(X) + 0.1.*randn(length(X),1);
%%
Xtrain = X(1:2:end);
Ytrain = Y(1:2:end);
Xtest = X(2:2:end);
Ytest = Y(2:2:end);
%%
% gam = 1e6;
% sig2 = 1;
% type = 'function estimation';
% [alpha,b] = trainlssvm({Xtrain,Ytrain,type,gam,sig2,'RBF_kernel'});
%%
%
% Yt = simlssvm({... |
function [stat_hw_01_output,mask_hw_01_output,mask_non_hw_01_output]=HW(Tem_mean, nrow,ncol,stationsDimLen,yrNum_Analysis, daysPerYr,T1,T2,method)
N = yrNum_Analysis*daysPerYr;
stat_hw_01 = nan(yrNum_Analysis, 10, stationsDimLen);
mask_hw_temp = nan(N,stationsDimLen);
mask_non_hw_temp ... |
function [lambda] = free_path( T, D, M)
% FREE_PATH Laskee vapaan matkan molekyylille
% [lambda] = free_path( D, M, T ) laskee lämpötilassa T (K) vapaan matkan
% molekyylille, jonka diffuusiokerroin on D (m^2/s), moolimassa on M (kg/mol)
%
% INPUT
% T - lämpötila (K)
% D - diffuusiokerroin (m^2/s)
% M - moolima... |
function [ analysis ] = process_sti_result_by_stiID_by_amplitudes_for_some_electrodes( paraname, result, sti_id, stipro, list, isSort, sort_by_n )
%PROCESS_STI_RESULT_BY_STIID_BY_AMPLITUDES_FOR_SOME_ELECTRODES 工具函数:提取部分通道的响应参数
% 提取刺激参数中,某个电极各个不同电压刺激下,指定通道的统计结果
%(可按照第sort_by_n个电压时,各个响应的从小到大输出,顺序在analysis的电极列表序)
% ... |
function [rundWert] = runden(wert, stellen)
% rundet wert auf angegebene Anzahl stellen hinter dem Komma
rundWert = round((wert)*(10^stellen))/(10^stellen);
end
|
% percent.hits = sum(cell2mat(data.hitALL.rt) > 0)/totalSTUDIED;
% percent.hits_place = sum(cell2mat(data.hitPLA.rt) > 0)/totalPLA;
% percent.hits_object = sum(cell2mat(data.hitOBJ.rt) > 0)/totalOBJ;
% percent.hits_old = sum(cell2mat(data.hitOLD.rt) > 0)/totalSTUDIED;
%
% percent.corrRej = sum(cell2mat(data.corrRej.rt... |
function [] = CondAdLIF_STDP_Mean_Testing_UniformWeight(index)
%% Add the approprate folders to the path
%Path of the SOSpikingModel repository
repopath = '/scratch/jmg1030/FIcurve/SOSpikingModel';
addpath(genpath(repopath))
%%
names = ["largePopWeight01.mat","largePopWeight03.mat","largePopWeight1.mat","largePopWe... |
classdef (ConstructOnLoad=true) DATA_CONTAINER < handle
%DATA_CONTAINER holds both raw and calculated data
% raw data can be FLIM trace or images
% calculated data can be images or traces depending on user_op return
% user_op must specify parameters structure for calculation
properties (C... |
% Matt McDade
% System Simulation
% Homework 11A
R1 = 500
R2 = 1E3;
R3 = 1E3;
C1 = 4.7E-6;
C2 = C1;
C3 = C1;
L = 2;
A = [-1/(R2*C1) 1/(R2*C1) 0 1/C1;
1/(R2*C2) -(1/(R2*C2) + 1/(R3*C2)) 1/(R3*C2) 0;
0 1/(R3*C3) -1/(R3*C3) 0;
-1/L 0 0 -R1/L];
eigA = eig(A) |
function lap = LaplacianCenter(w,dx,dy)
% Computes the Laplacian of a cell centered quantity using second order
% finite differences.
% Inputs:
% w : cell centered scalar valued function.
% dx : grid spacing in x-direciton.
% dy : grid spacing in y-direction.
gcw = 2;
w = fillBoundariesCenter(w,gcw);
lap = (w(gc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.