text stringlengths 8 6.12M |
|---|
function result = JacobiCN( X, K )
%JACOBICN Jacobi's function cn.
% JACOBICN(X,K) is the Jacobi's function CN of the elements of X and
% modulus K. X and K must all be real and the same size or any of them
% can be scalar.
%
% See also MJACOBICN
% JACOBICN is a wrapper function which mimics the elemental be... |
function [shadow,Rext]=A_get_surface_optics(Dev,torb)
if strcmp(torb,'top')
shadow=Dev.bc.top.shadow;
Rext=Dev.bc.top.Rext;
elseif strcmp(torb,'bottom')
shadow=Dev.bc.bottom.shadow;
Rext=Dev.bc.bottom.Rext;
else
error('A_get_surface_optics: torb must be ''top'' ot ''bottom''')
end |
function parsed_all = detect_all( list, param, caffe_solver, scale, thres, display, cutedge )
num = length(list);
if nargin < 6
display = 0;
end
if ~exist('cutedge', 'var')
cutedge = 1;
end
test_time = ceil(num / length(param.gpu_id));
for i = 1 : test_time
if display... |
function fcn = caller(n)
%NNCALLINGFCN Returns the name of the calling function.
%
% NNCALLINGFCN returns the name of the function calling the function
% which called NNCALLINGFCN.
%
% NNCALLINGFCN(1) returns the same thing.
%
% NNCALLINGFCN(0) returns the same name returned by MFILENAME.
%
% NNCALLINGFCN(N) with ... |
function [i,j] = argmax2(x)
%ARGMAX2 Index of maximum element of matrix.
% [i,j] = ARGMAX2(x) returns indices (i,j) such that x(i,j) == max(x(:)).
%
% See also ARGMAX.
[colmax,i] = max(x);
[ignore,j] = max(colmax);
i = i(j);
|
function p = q_to_curve(q)
%% Converts a SRVF q to its coordinate function p
%% Input
% q = one two-dimensional SRVF
%% Outputs
% p = coordinate function of q
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Computes Euclidean norm of SRVF q as function of curve domain
[d,N] = size(q);
for i... |
function rand_var = RandVarianceExplained(K, num_seeds)
load('../data/Q1/100307/PPA.mat');
rand_var = zeros(num_seeds,1);
for i =1:num_seeds
init_z = labels;
init_z(labels>=9) = 0;
rand_z = GenerateRandomClustering(adj_list, K, init_z');
rand_var(i) = CalcVarianceExplained(D, rand_z');
end
end
|
%Plot Original 30 second sample
[song,Fs] = audioread (‘original.wav’);
%Plot Original in time domain (-1 to make the length same)
t=0:1/Fs:(length(song)-1)/Fs;
plot (t,song);
title('Time Plot Original')
xlabel('Time (seconds)')
ylabel('Amplitude')
%Plot Orinal in frequency domain
fourier=abs(fft(son... |
function [idx, rec_err_min] = idx_vqpca_for_sensitivity_analysis(X, n_eigs, k, cent_crit, scal_crit, pca_algorithm, idx_0)
% This function partitions the data into `k` clusters according to
% Vector Quantization Principal Component Analysis (VQPCA) algorithm.
%
% Input:
% ------------
% - X
% the raw data set. Cent... |
%% -----------------------------------------------------------------------------
addpath('code')
if ~exist('code/find_nearby_indices.mexw64', 'file')
mex code/find_nearby_indices.cpp -outdir code
end
%% -----------------------------------------------------------------------------
clear
clc
main_settings
%% ---... |
classdef waitBarCustomized < handle
%WAITBAR Summary of this class goes here
% Detailed explanation goes here
properties
messageText = 'Please wait';
maxSteps;
waitBarHandle;
startTime;
end
methods
function obj = waitBarCustomized(maxSteps)
... |
%in barnamei baraye COLOR SLICING ast,BARAYE
%EJRAYE BARNAME HAME BARNAME RA ENTEKHAB KARDE(Ctrl+A & Ctrl+C)VA DAR Command
%Window MATLAB PASTE KONID.
clc;
Img_in=imread('2.tif');
R=Img_in(:,:,1);
G=Img_in(:,:,2);
B=Img_in(:,:,3);
figure(1);
subplot(1,2,1);
imshow(Img_in);
title('tasvire ... |
function new_img = stitch_images(img1, img2)
% Return a new complete image that stitches the two input images together
% If the two images cannot be stitched together, return 0
rgbimg1 = img1;
rgbimg2 = img2;
img1 = rgb2gray(im2double(img1));
img2 = rgb2gray(im2double(img2));
%figure(1);
%imshow(img1);
%figur... |
% % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
% Earthquake cycles in 2D with both %
% on fault and off fault deformation %
% %
% DESCRIPTION: ... |
function y = nigpdf(x, alpha, beta, mu, delta)
%NIGPDF Probability density function (pdf) for Normal-Inverse-Gaussian distribution.
% Y = NIGPDF(X, ALPHA, BETA, MU, DELTA) returns the pdf of the
% Normal-Inverse-Gaussian distribution with the parameter BETA which
% determines the skewness, shape parameter A... |
%% Automated Source Reconstruction
% (modified by Ece K, inherited from Alex C who inherited from Rik H)
% There is a bug in SPM12 (11/2017), cannot coregister montaged E/MEG files.
% So you need to change the lines in the spm function to put ft_plot_sens in
% a try-catch loop. Also your grads should not be combined.... |
function m = expectedMedian(x, varargin)
if ((nargin > 1) && varargin{1} == 2)
% along dimension 2
x = x';
m = nan(size(x,2), 1);
else
% along dimension 1
m = nan(1, size(x,2));
end
% penalize the NaN's? Default is yes.
penalize = ~((nargin > 2) && ~varargin{2});
for i = 1:size(x,2)
... |
%% Fig 11
% please run Cal_GSWP3_2.m before running this code
Mask_N3090=nan(360,720);
Mask_N3090(1:120,:)=1;
Pre_GSWP3_ts_7920_lat(:,1)=squeeze(nansum(nansum(pre_GSWP3_rec_1.*Mask_land_05.*S1.*Mask_N3090)))/(nansum(nansum(S1.*Mask_land_05.*Mask_N3090)));
Pre_GSWP3_ts_7920_past_lat(:,1)=squeeze(nansum(nansum(p... |
% function [D1E] = Delta_fun3D(X)
%
% Epsilon = (max(X(:))-min(X(:)))*0.5; % the number is not fixed.
% %Epsilon = 0.1;
%
% N = size(X,1);
% M = size(X,2);
% O = size(X,3);
%
% D1E = zeros(N,M,O);
%
% for i = 1:N
%
% for j = 1:M
%
% for k = 1:O
% if (abs(X(i,j,k... |
%% MyMainScript
tic;
%% Log of Fourier Plot
imgdata = load('../data/image_low_frequency_noise.mat');
img = mat2gray(imgdata.Z);
[m,n] = size(img);
figure;
imshow(img);
img = padarray(img,[m/2,n/2],0);
fourier = fftshift(fft2(img));
fourier_log_mag = log(1+abs(fourier));
figure;
imshow(mat2gray(fourier_log_mag));
color... |
% MYCAMCALD Compute camera calibration from data points
%
% C = CAMCALD(D)
%
% Solve the camera calibration using the SVD technique. Input is
% a table of data points, D, with each row of the form [x y z iX iY]
% where (x,y,z) is the world coordinate, and (iX, iY) is the image
% plane coordinate.
%
% Output is a 3x... |
function dsv_setup()
% Setup the DSVERIFIER_HOME and model checkers visibility in a variable environment
%
% Function: DSV_SETUP()
%
% Author: Lennon Chaves
% Federal University of Amazonas
% October 2016
%
home = pwd;
user = userpath;
if strfind(user,'/Documents/MATLAB') %default folder installation
install_fol... |
% Velocimetry package
%
% This package contains classes for velocimetry data reduction
% LUNA - Optical backscatter reflectometer analysis
% PDV - Photonic Doppler Velocimetry analysis
%
% See also SMASH
%
|
function save_hkl(params,hkl,intensity,translated_points,refined_trans_points,outer_means)
% [file,path,~] = uiputfile('hkl.txt');
fileID = fopen([get_file_name(params),'\hkl_full.txt'],'w');
fprintf(fileID,'%6s %6s %6s %16s %16s %6s %6s %6s %6s %12s\n','h','k','l','int','mean','x_orig','y_orig','x_ref','y_ref','til... |
function [F]=extractFD(U) %Shift to Center
c=sum(U) ./ length(U);
T=U - c; %Sort by angle
aT=angle(T);
[aTT, aTI] = sort(aT);
for i = 1:length(aTI)
sT(i)=U(aTI(i));
end
%Fit the case, which Length of U is not sufficient
if mod(length(aTI),2) == 0
sT=[sT sT(1)];
end %Output the result
F=fft(sT);
... |
classdef SteeringType
%STEERINGTYPE Types of Riesz coefficients steering techniques
%
% --------------------------------------------------------------------------
%
% Part of the Generalized Riesz-wavelet toolbox
%
% Author: Nicolas Chenouard. Ecole Polytechnique Federale de Lausanne.
%
... |
global Data_______entries Data_______callbacks
global Signals____entries Signals____callbacks
global Settings___entries Settings___callbacks
global Actions____entries Actions____callbacks
global h_lenmenu h_ntymenu h_nlvmenu h_wavmenu h_thrmenu h_plotmenu
global HC PlotFig plotoption sigchoice
global n signal_name Wav... |
function img = getFrontieraMinimaStanga(imagine, bloc, dimSuprapunere)
img = zeros(size(bloc));
E = (double(imagine) - double(bloc(:, 1:dimSuprapunere, :))) .^ 2;
M = 0.2126 * E(:, :, 1) + 0.7152 * E(:, :, 2) + 0.0722 * E(:, :, 3);
R = zeros(size(M));
R(1, :) = M(1, :);
for i = 2:size(M, 1)
... |
function writeDAE(filename,varargin)
% WRITEDAE Write a mesh to a Collada .dae scene file.
%
% writeDAE(filename,V,F)
% writeDAE(filename,V1,F1,V2,F2, ...)
%
% Inputs:
% filename path to .dae file
% V #V by 3 list of vertex positions
% F #F by 3 list of triangle indices
%
function s = i... |
function obsTensor = estObsTensor(train, obsDim, stateDim, A1_true, A_true, D_true, O_true, flg)
%sequence length
[L, N] = size(train);
%compute linear indeces for efficient matrix access
m = 2;
P = ones(m,1);
for k = 2:m
P(k) = P(k-1)*obsDim;
end
scaled_tensor = zeros(obsDim,obsDim);
for i=1:N-1
tensr... |
%cd c:/shared/SWI_TOF_DIFF/DICOM; ls
clear all ; close all ;
cd('C:\shared\fMRI+stimulation sujet 2 2015-07-16') ; ls
%mri = load_untouch_nii('im_0010.nii.gz') ;
mri = load_untouch_nii('Test_Francis_2015-07-16_WIP_fMRI_stim2_SENSE_15_1.nii') ;
mri = double(mri.img) ;
brain = zeros(size(mri,1),size(mri,2),siz... |
%% searchlight_or_sr
% Does a binary classification using searchlight-based SVM (I think).
% Adapted from Yune's code on 12/14/2017
% Updated for SLAM_isss_multi_MVPA_batch on 6/13/18
% Made parallel on 6/22/18
% Split for noise/silence and lng/noi on 6/26
%
% MM/DD/YY -- CHANGELOG
% 02/14/20 -- Cloned for YA_FST. Mad... |
function [] = plot_pair_distribution( simfit, marked_network, varargin )
% the marked_network is required!
nummarks = simfit.configvars.N_cases;
assert( nummarks == marked_network.nummarks );
net = simfit.model.network;
% parse options
argi = 1;
while argi <= numel(varargin)
switch varargin{argi}
case 'model_re... |
% 1D Gaussian filter.
%
% Equivalent to (but faster then):
% f = fspecial('Gaussian',[2*r+1,1],sigma);
% f = filter_gauss_nD( 2*r+1, r+1, sigma^2 );
%
% USAGE
% f = filter_gauss_1D( r, sigma, [show] )
%
% INPUTS
% r - filter size=2r+1, if r=[] -> r=ceil(2.25*sigma)
% sigma - standard deviation of filter
% ... |
function leaflet = generate_opposite_leaflet(leaflet_current)
%
% Generates a leaflet which is opposite the current leaflet
% and shares a free edge
%
% Free edge points are set to be NOT internal
%
% Copyright (c) 2019, Alexander D. Kaiser
% All rights reserved.
%
% Redistribution and use in source and binary ... |
% population is the size of the population that is to be modeled
% errorValues is the error with which a child inherits a strategy from its parent
% generations is the number of generations that are to be modeled
function [ps,qs]=model1(population,errorValues,generations)
% each row represents a player with a strat... |
close all
clear all
clc
import casadi.*
addpath('../OPTCON')
%% system setting
A=[-1 1;
0 1];
B=[1,3]';
% define the state and input variable
x=SX.sym('x',2);
u=SX.sym('u',1);
% define the dynamics
f=A*x+B*u;
dyn = Function('dyn', {x, u}, {f}, {'X','U'}, {'f'});
dfxFun = Function('dfx',{x,u},{jacobian(f,x)});
dfuFu... |
function [DLDW, DLDB] = ComputeGradients(X, S, W, Z, M, A, HK, D)
N = size(X{1}, 1);
K = size(W, 2);
T = cell(1, K + 1);
for t = 2:K
if t == 0
T{t} = 1.42 * abs(S{t}).^0.42;
else
T{t} = ones(size(X{t})); %identity
end
end
T{K + 1} = ones(size(X{K ... |
function arplot_ig(monthStr, days, year1, month2Str, days2, year2)
% arplot_ig(Month1 String, Days1, Year1, Month2 String, Days2, Year2)
%
% Plots Beam Current, Lifetime, and all SR IG data.
%
% Example: arplot_ig('January',22:24, 1998);
% plots data from 1/22, 1/23, and 1/24 in 1998
% Inputs
if nargin < ... |
% defining an electron temperature on axis
% this is arbitrary and should be tuned according to experimental value
% Te0=(4.4*1e3)
FILENAME=strcat(FINESSE_FOLDER,'finesse_tokamak_parameters.mat');
load(FILENAME)
% alpha_finesse=alpha;
aspect_ratio=1/epsilon;
R0=aspect_ratio*a
psi0_input=(B0*a^2)/alpha_finesse
Baxis=... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Save data to the rawdata directory
function [pathname, name] = FindName(filename)
% function [pathname, name] = FindName(filename,filesuffix);
% filename starting file name from a list of files that need to be read
% filesuffix the filefuffix to be saved
% DataMtr ... |
dataPath = getDataPath();
simAxisPath = fullfile(dataPath,'模拟数据','单罐轴向进出闭口-逆M序列进口边界','simulationDataStruct.mat');
simDiameterPath = fullfile(dataPath,'模拟数据','单罐轴向进径向出闭口-逆M序列进口边界','simulationDataStruct.mat');
simAxisDataCell = loadSimDataStructCell(simAxisPath);
simDiameterDataCell = loadSimDataStructCell(simDiameterPat... |
% =========================================================================
% -- Part of "Data Detection in Massive MU-MIMO" Simulator
% -------------------------------------------------------------------------
% -- (c) 2020 Christoph Studer and Oscar Castañeda
% -- e-mail: studer@ethz.ch and caoscar@ethz.ch
% ========... |
function R = LiveTrackHID2struct(reports)
% LiveTrackHID2struct transforms report packets with raw data into a
% structure array. S1 is the first sample and S2 is the second.
if isempty(reports)
fprintf('No reports found\n');
R = [];
return
end
S1FieldNames = {'S1PupilW','S1PupilH','S1PupilX','S1PupilY',... |
function [out] = rampfunction(slope,lateness,N)
%check and add missing condition
if nargin < 1
slope = 1;
lateness=0;
N = 20;
else if nargin < 2
lateness=0;
N = 20;
else if nargin < 3
N = 20;
end
end
end
if N > 20 %c... |
function dsp__apply_limits( h, kind, lims )
axes = findobj( h, 'type', 'axes' );
assert( numel(axes) > 0, 'No axes found.' );
set( axes, kind, lims );
end |
clc; clear all; close all
[PX,PY,PZ]=textread('world coordinate.txt','', 'delimiter', ',');
[px,py]=textread('image_coordinate.txt','', 'delimiter', ',');
% Input pixel coordinates by mouse
load img_checker.mat
% %Checkerboard=imread('checkerboard.jpg');
img_checker=ycbcr2rgb(img_checker);
% img_checkergray=rgb2... |
function z=quadrupole(fname,L,K,method,varargin)
%QUADRUPOLE Creates a quadrupole element in old AT version (Obsolete)
%quadrupole('familyname',length [m],k,'method')
% INPUTS
% 1. FAMNAME - Family name
% 2. LENGTH - Length [m]
% 3. K - Strength [m-2]
% 4. PASSMETHOD - Tracking function, def... |
%%
%This code demonstrates the implementation of schelkenoff's, which is based
%on the information about the null possition on the final radiation pattern.
% Program written by: Sathvik N. Prasad
% Date : 23/06/2014
close all;
clc;
clear all;
%%
fprintf('Determination of linear array a... |
function adataObj = get_topic(self,msgType,msgName)
if msgType=="Control_PidState"
adataObj=PIDData();
adataObj.topicName=msgName;
adataObj.readFromControl_PidState(self);
end
if msgType=="Geom_Twist12"
adataObj=AData();
adataObj.topicName=msgName;
adataObj.an... |
%% probability given execution failing number
clearvars -global; clearvars; close all; clc;
pe = linspace(0.0001, 0.9999, 10000);
pr = linspace(0.8000, 0.9999, 10000);
for pr_index = 1:length(pr)
for pe_index = 1:length(pe)
fe_prpe(pr_index, pe_index) = log(1 - pr(pr_index))/log(pe(pe_index));
... |
function color_rgb = medium_orchid
color_rgb = {'color', [0.72941, 0.33333, 0.82745]};
end |
%% Specifications
minspec=70;
maxspec=200;
%% Find
found= data(:)>minspec & data(:)<maxspec;
Percent=sum(found)/length(found) |
function dfdxval = Lorenz_dfdx(t,x,p,more)
% x-derivative of right side function for Lorenz equation
% x(1) = x, x(2) = y, x(3) = z
% p(1) = sigma, p(2) = r, p(3) = b
p = exp(p);
r = zeros(length(t),3,3);
r(:,1,1) = -p(3);
r(:,1,2) = p2 + p(3);
r(:,1,2) = x(:,2);
r(:,2,1) = p(3);
r(:,2,2) = -1;
r(:,2,... |
% function convert_T_LIDAR_from_txt_to_mat()
% converts the lidar time to a mat file. This function is only run once
% before running MAIN
% open and read the text file
%fileID= fopen('ouster_frames_timestamps.txt','r');
filename= 'ouster_frames_timestamps.txt';
file= csvimport(filename);
T_LIDAR= cell2mat(file(2:end... |
function area = physicalBorderArea(p)
%PHXSICALBORDERAREA Calculate the physical border area for all borders.
% INPUT p: struct
% Segmentation parameter struct.
% OUTPUT area: [Nx1] double
% Border area in um^2. The voxel scale is taken from
% p.raw.voxelSize.
%
% see also Seg.Local.physic... |
classdef nncaffepool < nntest
properties
x
end
properties (TestParameter)
type = {'avg', 'max'}
poolx = {1 2 3}
pooly = {1 2}
pool = {1 2 3}
pad = {0 1 2}
stride = {1 2 3 4}
stridex = {1 2 3}
stridey = {1 2}
padLeft = {0 1 2}
padRight = {0 1 2}
padTop = {0 1 2}
... |
function [ x,y ] = Euler(f, x0, xn, y0, h)
%向前欧拉方法
%输入 f=函数f(x,y),
% x0=左端点,
% xn=右端点, x0<= x <= xn
% y0=初值y0=y(x0),
% h=步长,
%输出 向量x的元素是自变量x的取值,
% 向量y的元素是利用向前欧拉方法公式求出初值问题在向量x的元素处的数值解
x(1)=x0;y(1)=y0;
n=(xn-x0)/h;
for i=1:n
x(i+1)=x(i)+h;
y(i+1)=y(i)+h*f(x(i),y(i));
end
|
close all;
clear;
clc;
load pengamatan_stego
load pengamatan_cover
all_cover = [cover_red; cover_green; cover_blue];
all_stego = [stego_red; stego_green; stego_blue];
all_data = [all_cover zeros(size(all_cover,1),1); all_stego ones(size(all_stego,1),1)];
figure;
labeldata = unique(all_data(:,6));
X = princompal(all_d... |
function dz_dw = forwardstart(w,p,z,param)
%VGAMPROD.FORWARDSTART Propagate derivative from weight to weighted input
% Copyright 2012-2015 The MathWorks, Inc.
[S,Q] = size(z);
R = size(p,1);
TruncateS = min(R-1,S);
dz_dw = zeros(S,Q,S,1,'like',w); % SxQxSx1
for i=1:TruncateS
dz_dw(i,:,i,1) = p(i,:) - p... |
function ll = constraintLogLikelihoodLDAPos(model,X);
% CONSTRAINTLOGLIKELIHOODLDAPOS Returns loglikelihood for LDAPos constraint
% FORMAT
% DESC Returns loglikelihood for LDAPos constraint
% ARG model : fgplvm model
% ARG X : Latent locations
% RETURN ll : Returns loglikelihood
%
% SEEALSO : constraintLogLikelihood
%... |
function error = calError_entropy(A,y)
%d = size(A,1);
%deter = abs(det(A));
%scal = nthroot(1/deter,d);
%A = scal*A;
d = size(y,1);
yhat = A\y;
co = HShannon_spacing_VKDE_initialization(1);
error = 0;
for i = 1:d
error = error + HShannon_spacing_VKDE_estimation(yhat(i,:),co);
end
error = error + log(abs(det(A))... |
%% load & process TD file
pathname = '~/LimbLab/Projects/S1-gamma/data';
filename = 'Duncan_20191111_OOR_10ms.mat';
load([pathname filesep filename]);
% Smooth spikes, get split TD, get movement onsets, get rid of unsorted units
%Smooth spikes
smoothParams.signals = {'S1_spikes'};
smoothParams.width = 0.03;
smooth... |
serial_port_for_Agilent_Power = 'com7';
serial_port_for_Oven_Controller1 = 'com10';
serial_port_for_Oven_controller2 = 'com11';
serial_port_for_Oven_controller3 = 'com9';
serial_port_for_Oven_controller4 = 'com8';
%PID setting for base temperature control
pid4base_windup_guard = 30;
pid4base_proportional_gain ... |
function [R,N,T,THOP,L,Lq] = match_query_byname(F,TSKIP,TDUR,DENS,OSAMP,MINCOUNT,MINPROP,MAXRET,USERAWCOUNTS,MAXTOFILTER,MATCHWIDTH,MATCHALIGN,ALIGNOUTDIR,DEFAULTOUTEXT,WARPMAX,WARPSTEP,THOPI,TARGETSR,QUIET)
% [R,N,T,THOP,L,Lq] = match_query_byname(F,TSKIP,TDUR,DENS,OSAMP,MINCOUNT,MINPROP,MAXRET,USERAWCOUNTS,MAXTOFILTE... |
% tree -> 0, burn -> 1, empty -> 2, t.b.c.-> 3
function yrgb=render(x)
green = [112 161 101];
land=[199 156 89];
fire = [255 43 32];
r = x;
g = x;
b = x;
r(x==0) = green(1);
g(x==0) = green(2);
b(x==0) = green(3);
r(x==1) = fire(1);
g(x==1) = fire(2);
b(x=... |
x = audioread('pitch_shift_test.wav');
x_up = audioread('pitch_shift_3.wav');
x_down = audioread('pitch_shift_-3.wav');
x = mean(x,2);
x_up = mean(x_up,2);
x_down = mean(x_down,2);
X = spectrogram(x, 2048,1536);
X_up = spectrogram(x_up, 2048, 1536);
X_down = spectrogram(x_down, 2048, 1536);
pitch_shift = 3;
k = 12; ... |
function phihat = phase_estimation(r, b_train)
% phihat = phase_estimation(r, b_train)
%
% Phase estimator using the training sequence. The phase estimate is
% obtained by minimizing the norm of the difference between the known
% transmitted QPSK-modulated training sequence and the received training
% part. NB! There a... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% INM431 Machine Learning Coursework %%
%% Daniel Sikar - PT2 %%
%% Random Forests %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FOURTH RUN
% 1. Original data type schem
% 3rd run TP = 78, TN = 3, FP = 23, FN = 0, worst so far
% 4th run TP =... |
cd c:/shared/mnirefs2 ; ls
corrsubs = dir('corr_*') ;
for cs = 1:length(corrsubs) ;
nii = load_nii(corrsubs(cs).name) ;
cimgs(cs,:,:,:) = nii.img ;
end
anii = load_nii('c:/shared/ATLASES/MNI152_T1_1mm.nii.gz') ;
anat = anii.img ;
meancorrs = squeeze(mean(cimgs,1)) ;
plotoverla... |
function res = fixCombineDataAndDataStructCellsWithSigmaPlusValue( folderPath )
%此函数用于修正数据后,把人工读取的脉动值设置到dataStructCells和combineDataStruct
% 此处显示详细说明
dataStructCells = loadExpDataStructCellFromFolderPath(folderPath);
sigmaPlusValue = loadSigmaPlusValueStructFromFolderPath(folderPath);
plV = sigmaPlusValue... |
function [ centers, targets, coefs, division_coef, nb_iteration ] = iterativeSearch( source, target, varargin )
%ITERATIVESEARCH Searches for the parameters of the transformation
%With explicit end matching
[dim, lX] = size(source);
%Default options
nb_iteration = 150;
maxCoef = 50;
conv_crit = 1e-6;
doPlot = 0;
regu... |
function [sequence_db]=compute_task(color_space,sequence_db,groundtruth_path,groundtruth_name,input_path,input_name,task,P_param)
fields = fieldnames(sequence_db);
for i=1:numel(fields)
sequence_db.(fields{i}).TP=0;
sequence_db.(fields{i}).TN=0;
sequence_db.(fields{i}).FP=0;
... |
clc;
clear;
sepdata;
epochs = 20;
n = 0.001;
%disp(targets);
[insize, ndata] = size(patterns);
%disp(insize);
%disp(ndata);
[outsize, ndata] = size(targets);
%disp(outsize);
%disp(ndata);
Xtra = ones(1, ndata);
X = [Xtra; patterns];
[Xsize, ndata] = size(X);
%disp(Xsize);
%disp(ndata);
%disp(X);
W = randn(1, insize+1)... |
function dataout=modeDRAEC_BSS(nummics, numrefs, datain)
%
% Perform dr and aec together, then bss.
% nummics: no. of mic channels
% numrefs: no. of reference channels
% datain: input data
% dataout: output data
%
%% perform stft
addpath('stft2');
% fft s... |
function compile_process(image_name, model_name, output_path)
%Takes in a model path and image path, and evaluates the features.
load image_name;
im = imread(model_name);
bbox = process(im, model, -0.5);
save(output_path,'bbox');
end
|
function inhVsDistancePerNeuronAll = inhVsDistance(lpall, mouseType, minStimuliSize, MAX_HOTSPOT)
%% compre fr as a function of distance a cross all neurons
inhVsDistancePerNeuronAll=[];
for i=1:length(lpall)
%if ismember(i, [23 25 27 44 46]) continue; end
inhVsDistancePerNeuron=[];
if s... |
function [d,CF] = solve_linear_system_mixed(H,mu,A,b,c,tau,kappa,r1,r2,r3,r4,r5,pars)
%Constructs the KKT matrix in matlab and solves
%the 2by2 subsystem in C
%Debug flag
print_t = false;
print_c = true;
%Get the size of the problem
[m,n] = size(A);
[slv_aug,h_free] = c_factor();
... |
function [O_Pframes,O_Rframes,O_Pseconds,O_Rseconds] = reach_times (data)
clear O_Pframes O_Rframes O_Pseconds O_Rseconds
O_Pframes = [];
O_Rframes = [];
O_Pseconds = [];
O_Rseconds = [];
for i=1:length(data)
clear framestr framenum f_onset f_pellet f_retract
framestr = data{i,2};
framenum ... |
function integration_result = myRadonTrans()
% In the output integration_result is a matrix of size 37*36, since t takes
% 37 values and theta takes 36. the value of integration_result in i'th row
% and j'th column corresponds to the value of radon transform with t = i'th
% value from the sequence of -90:5:90 and theta... |
% check_jacobian_taylor_series
%
% checks jacobian is actually an approximation to the derivative
% to the expected order using a Taylor series
%
% Copyright (c) 2019, Alexander D. Kaiser
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted pro... |
% This method evaluates the debye object to obtain the Gruneisen
% coefficient as a function of density and the debye temperature
%
% >> [gamma,theta] = calculateDebyeTemp(object);
%
% If a parameter set p is given, the object's gamma coefficients are
% overwritten
%
% created January 15, 2014 by Justin Brown (Sand... |
%Compute continous pixels
function Next = cont(Mag,Ang)
%image size
[rows,columns]=size(Mag);
%Next connected pixels
Next=-1*ones(rows,columns,2); % two continuos pixels
for x=2:columns-1
for y=2:rows-1
if Mag(y,x)>0
t=Ang(y,x);
if t<.57 && t>-.57
... |
function [tempos resultadoPelaBiseccao resultadoPorNewton resultadoPelaSecante] = SegundaQuestao(expressao, tolerancia)
syms x
tic
resultadoPelaBiseccao = MetodoDaBiseccao(expressao, 2.9, 3.555, tolerancia)
tempoBisseccao = toc
tic
resultadoPorNewton = MetodoDeNewton( expressao, 100, tolerancia ... |
function plot_cdcondition_age_combined(p30,p40,jill)
%
%
%
%
%
%
%
plot_cdcondition_age_combined_cumhist(p30,p40,jill); |
clc;
clear all;
data = importdata('winequality-red.csv',';',1); data = data.data;
[m,n] = size(data);
training = int16(0.7*m); testing = m - training;
%% take data for training and predict top k variables in xout
y = data(1:training,n); A = data(1:training,1:n-1); k=3;
xout = OMP(y,A,k);
%% take data for t... |
function [r]=rvalue(u,estab)
% r variable calculation for TVD limiter
%
% [r]=rvalue(u)
%
% r: r field
% u: given field
% estab: estabilization factor for quotients
% Memory allocation
r=u.internal*0;
% Internal
r(2:end-1)=(u.internal(2:end-1)-u.internal(1:end-2))./... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This function plots the curves beta_str and beta_ctx against all the dependent variables
% Usage example:
% plotBetaSmaCtx(parameterSTR,parameterCTX,{'TE','PE','SL','NPE'},dependent_vars.TE,dependent_vars.PE,dependent_vars.SL... |
%% Generate a colormap from a image including the colorbar (e.g., from a
%% paper) for AFNI visualization.
function [cmap_out, cmap] = LFCD_mkcolormap(fIMAGE, nseg)
% fIMAGE - A colorbar image from published papers or other softwares.
% nseg - number of color segments (default 0)
% Three steps to go:
% 1). dlmwrite('... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function dbFnComputeAverageObjectColor
%
% Output parameters:
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function r=dbFnComputeAverageObjectColor(outputBasePath, annotation, varargin) %#ok
%%%%%%%%%%%%%%%... |
close all;
% Subscribe to point cloud topic
pc_sub = rossubscriber('/pointcloud_merger/pointcloud_out')
pos_pub = rospublisher('visualization_marker','visualization_msgs/Marker')
xdet = 0.0;
ydet = 0.0;
zdet = 0.0;
minx = 0.5;
miny = 0.5;
maxx = 9.5;
maxy = 9.5;
minz = 0.1;
maxz = 3.5;
dc = 0.04;
rounds = 1500;
... |
function f = cal_mi(I1,I2)
% A function with the simplest form to
% compute Mutual Information of two images
% written by HU Xiubing
% Wuhan University,China
% huxb@whu.edu.cn
size1 = size(I1);
size2 = size(I2);
if ne(size1,size2)
error('Please enter the same size images ! ');
end
I1 = I1(:);
I2 = I... |
% --- 计算 Xcorr ---
% 读取数据
%wavname1 = 'VoiceData/a_1.wav';
%wavname2 = 'VoiceData/i_1.wav';
%wavname3 = 'VoiceData/ka_1.wav';
wavname1 = 'record/lichuan.wav';
wavname2 = 'record/li.wav';
wavname3 = 'record/wangxiang.wav';
wavname4 = 'record/autman.wav';
wavname5 = 'record/zhusongkai.wav';
[data1,Fs1] = wavread(wavna... |
%
clear all;
close all;
%%%
% 1. Modulation numerique
%%%
%%Generation de bits
%Nb est pair
Nb = 2*6;
%On genere Nb bits
bits = rand(1, Nb)>0.5;
%%Modulation BPSK
%On transforme cette suite de bits en suite de -1 pour 0 et 1 pour 1
bpsk = bits*2-1;
%On calcule la moyenne m des symboles
m = mean(bpsk);
%Puis la ... |
function rgb = snow
rgb = [1.0, 0.98039, 0.98039];
end |
function H = Combine_joint_seq_H(seqs)
N = length(seqs);
H = [];
for i = 1:N
h{i} = se3tolie_algebra(path_to_h_se3(seqs{i}));
H = [H;h{i}];
end |
%%Function to create 3D tensors from signal power info in data files. Use
%%with any function/script that creates figures
function data_out=extract_condition_response(data,info,cond,stim,correct_response,large_file,combined_elecs)
%% Eliminate Fixation trials
trial_type=info.word_type;
pos_right=find(strcm... |
% Get the screen numbers
screens = Screen('Screens');
% Draw to the external screen if avaliable
screenNumber = max(screens);
% Get size of screen
[s_width, s_height]=Screen('WindowSize', screenNumber); %also found in windowRect below
% Get value of color black & white, set other RGB color values for later:
black... |
function [MC,p] = f_moran(Y,W,iter)
% - Moran's coefficient of spatial autocorrelation
%
% USAGE: [MC,p] = f_moran(Y,W,iter)
%
% Y = response variable
% W = spatial weighting matrix created by f_eigenMaps
% iter = # iterations for permutation test
%
% MC = Moran's coefficient
% p = permutation-based significan... |
syms k
syms Zs;
syms RL;
syms RL1;
a= (k^2-1)*RL^2-Zs^2;
b=2*RL*Zs^2;
c=(k^2-1)*RL^2*Zs^2;
ans=solve(a*RL1^2+ b*RL1+ c,RL1)
kx=[];
%%
fo=150e3;
wo=2*pi*150e3;
Ls=68e-6;
Cs= 1/(wo^2*Ls);
RL= 16;
M=17e-6;
k=0.20
% 0.95 0.90 0.80 0.4 0
% kx=[kx ((1-k)/(2))]
% M1=M*(1+a1);
% M2=M*(1-a1);
R... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.