text stringlengths 8 6.12M |
|---|
fprintf(file, "#\n");
fprintf(file, "## DEFINITION OF THE MBZIRC CHALLENGE ARENA\n");
fprintf(file, "#\n");
fprintf(file, " \n");
fprintf(file, "arena_id: \"%s\"\n", arena_id);
fprintf(file, " \n");
fprintf(file, "use_utm_origin: true\n");
fprintf(file, "utm_origin_units: 0 # 0 - UTM, 1 - Latitude Longitude\n");
fprint... |
%=========================================================================
%
% Finite sample properties of tests and autocorrelation
%
%=========================================================================
function unit_maicsim( )
clear all
clc
t = 200;
reps = 10000;
trend = 1;
... |
function tests = test_readMesh
% Test suite for the file readMesh.
%
% Test suite for the file readMesh
%
% Example
% test_readMesh
%
% See also
% readMesh
% ------
% Author: David Legland
% e-mail: david.legland@inrae.fr
% Created: 2021-01-25, using Matlab 9.8.0.1323502 (R2020a)
% Copyright 2021 INRAE ... |
function [phi, u, w] = StokesU(k, h, a, modeNo, theta, z)
g = 9.81;
omega0 = sqrt(g*k*tanh(k*h));
sigma = tanh(k*h);
alpha = cosh(2*k*h);
A11 = 1/sinh(k*h);
A22 = 3/(8*sinh(h*k)^4);
A33 = ((9-4*(sinh(h*k))^2))/(64*sinh(h*k)^7);
A44 = ((10*alpha^3 - 174*alpha^2 + 291*alpha + 278))... |
%addpath tools;
addpath export_fig;
addpath matconvnet;
addpath matconvnet/matlab;
addpath matconvnet/examples;
addpath matconvnet/examples/imagenet;
vl_setupnn;
addpath VOCdevkit/VOCcode;
VOCinit;
dbstop if error;
|
%% extract_timing_MVPA
% Loads and processes timing information.
% Input: subj
% CHANGELOG
% 09/01/17 File inception
% 09/06/17 Worked on timing and duration extraction
% 09/07/17 Added button press condition, accuracy regressor
% 09/08/17 Changed accuracy regressor to a condition, started function
% 09/15/17 Up... |
%MIT License
%Copyright (c) 2019 Sherman Lo
%CLASS: EXPERIMENT ALL NULL GAUSSIAN
%See superclass AllNull
%Experiment with the empirical null filter on a gaussian image
classdef AllNullGaussian < AllNull
methods (Access = public)
%CONSTRUCTOR
function this = AllNullGaussian()
this@AllNull();
... |
%Iterates through outbound traj files and compiles into one file. For ER1,
%use y values >40 and x values between 80 and 120. For JS15, use y values
%>30 and x values between 65 and 95
%to do: need to restrict positions to central stem
clear;
dir = '/Users/justinshin/Desktop/MIND18_data/ER1_direct/'
animalprefix = '... |
function [] = createTesting_sim(T, numSeq, Nobs, ...
Nhid_true, Dmax_true, Nhid_anom, Dmax_anom, ...
A0_true, D0_true, A_true, D_true, O_true, ...
A0_anom, D0_anom, A_anom, D_anom, O_anom, ID)
loc = strcat('../libdai/examp... |
function b_computed = find_burgers_vector_fast_2D(interval,xlims,ylims,beta)
% find_burgers_vector_fast
% finds the Burgers vector from the 4D displacement gradient array
% The Burgers circuit is as defined in the program's associated paper, with
% the exception of being reduced to a 2D circuit in the x-y plane.
% No... |
function det_pq = relax_p_q_sequencially(euler_angle)
dummy6 =1;
for p=-2:0.001:2
strain_external = [1 0 p;0 0 0;p 0 -1];
g_mat = Euler_to_gmat(euler_angle);
s_in= g_mat*strain_external*g_mat';
for counter1=1:1:56 % Calculating m using bishop-hill table and picking max m as taylor factor
... |
function [L_star]=ProxOperator(Tr,Content,Z,lambda_4,tau)
if lambda_4~=0
L_star=zeros(size(Z));
n_clusters=length(unique(Content.user_cidx));
[~,n_pois]=size(Tr.R_bool);
for g=1:n_clusters
g_idx=find(Content.user_cidx==g);
omega_g=sqrt(length(g_idx));
... |
%CIM_3_1:P Matrix Method
clear;
conc=load('CIM-3p-concentration.txt','conc');
absorb=load('CIM-3p-Absorbance.txt','absorb');
unknown=load('CIM-3p-unknown.txt','unknown');
Y=absorb(:,2:17)';
%--------------------P Matrix: n=16,m=3,p=10,ns=4------------------------%
X=conc';
P=(Y'*Y)\Y'*X;
Y_predict=unknown(:,2:5)';
X_pr... |
function out1 = fitnet(varargin)
%FITNET Function fitting neural network.
%
% For an introduction use the Neural Fitting App <a href="matlab: doc nftool">nftool</a>.
% Click <a href="matlab:nftool">here</a> to launch it.
%
% Two (or more) layer fitting networks can fit any finite input-output
% relationship arbitra... |
classdef DefectExampleLine < DefectExample
methods (Access = public)
function this = DefectExampleLine()
this@DefectExample();
end
end
methods (Access = protected)
%OVERRIDE: SETUP
function setup(this)
randStream = RandStream('mt19937ar','Seed',uint32(2816384857));... |
function y=formula(n,fx,time,T)
a0=0;
dt=T./100;
f=1./T;
for i=1:100
a0=a0+f.*fx(i).*dt;
end
y=a0;
for j=1:1:n
a=0;
b=0;
for k=1:100
a=a+2.*f.*fx(k).*dt.*cos(2.*j.*pi.*k.*dt);
b=b+2.*f.*fx(k).*dt.*sin(2.*j.*pi.*k.*dt);
end
y=y+a.*cos(2.*pi.*j.*time)+b.*sin(2.*pi.*j.*time);
end
end |
function [T,I,Y]=naivePerfusionResponseP2X4free(ton,toff,Ttot)
ode=modelODEP2X4free(ton,toff);
naive=getNaiveP2X4free();
setAuxiliaryP2X4free(naive);
[T,Y]=ode15s(ode,[0 Ttot],naive,odeset('NonNegative',1:21));
I=getTotalCurrentP2X4free(Y);
end |
function ret=TeleportErrorFree(state, code, er)
if (nargin!=3)
usage("TeleportErrorFree(state, code, er)");
endif
#encode state
en = Encode(state, code)
#teleport state
e1 = PTrace(en,[2,3])
e2 = PTrace(en,[1,3])
e3 = PTrace(en,[1,2])
#e1
#e1 = TeleportWError(e1,er,[2])
#e2 = TeleportWError(e2,Id,[2]);
#e3 = Telep... |
function Bez_Spline(filename,z,plotit)
data_hold = load(filename);
x = data_hold(:,1);
y = data_hold(:,2);
Nx = length(x);
% step_size = max(round(sqrt(Nx/100)),2);
holder = find_corners_special(x,y,Nx,z);
corners = holder(1,holder(1,:)~=0)+2;
bends = holder(2,(holder(2,:)~=0)&(holder(2,:)<Nx));
oo... |
% success kid
clear;
clc;
I = imread('success-Kid.jpg');
HSV = rgb2hsv(I);
H = HSV(:, :, 1);
S = HSV(:, :, 2);
V = HSV(:, :, 3);
s_h = 1; s_s = 0.5; s_v = 1;
J(:, :, 1) = s_h * H;
J(:, :, 2) = s_s * S;
J(:, :, 3) = s_v * V;
J = hsv2rgb(J);
figure; imshow(J); |
function str = biasName(i)
% Copyright 2012-2015 The MathWorks, Inc.
str = ['b' num2str(i)]; |
load('MS_Example.mat');
MS = MS(1:200,1:200,:);
pw = 2000/2160; ph = pw;
lsx = 0.37; lsy = lsx;
[MonList, Edges] = Lattice_Fill(MS,pw,ph,lsx,lsy);
figure
spy(MS(:,:,1))
figure
plot(MonList(:,1),MonList(:,2),'.b')
|
clear all
close all
clc
% [re pr fm] = [0.9348 0.9460 0.9404]
threshold_big = 0.5;
threshold_sma = 0.2;
threshold_range = 10;
% [re pr fm] = [0.9324 0.9494 0.9408]
threshold_big = 0.5;
threshold_sma = 0.2;
threshold_range = 8;
threshold_big = 0.85;
threshold_sma = 0.35;
threshold_range = 8;
threshold_big = 0.5;
t... |
%% Perform Barnes-Hut t-SNE on human gene data
clear variables
close all
addpath('../bh-tsne');
ids = {'9861','10021','12876','14380','15496','15697'};
nbrains = length(ids);
for bnr = 1:nbrains
%% Load data (currently for a single brain)
id = ids{bnr};
datadir = ['/home/mvandegiessen/data/tSNE_ABA/rawData_25Feb2014/... |
clc
x = [5.5 6.5 7.5 8.5 9.5 10.5 11.5 12.5 13.5 14.5];
y = [1 3 2 14 16 15 10 1 0 1];
Mean = sum(x.*y)/sum(y)
STD = sqrt(sum((y - Mean).^2)/sum(y))
Mean + STD
Me = (8/75)*100
% Mean Height = 5 ft 10 = 70 in +- 3
% My height = 6 ft 3 = 75 in (1.67 STDs above mean = 96%)
% Mean val = 9.7 +- 2.8
%... |
function [imgcbcr] = ycbcr_segment(img)
imgcbcr=img; %Image from the previous segmentation
ycbcr=rgb2ycbcr(imgcbcr);
cb=ycbcr(:,:,2);
cr=ycbcr(:,:,3);
[r c] = find(cb<=77 | cb >=131 | cr<=121 | cr>=160); %Threshold for... |
function [s1, s2] = segment(x, y)
t = 0:0.01:1;
s1 = x(1) + (y(1)-x(1))*t;
s2 = x(2) + (y(2)-x(2))*t;
endfunction |
clearvars
close all
% ---------------------- SELECT ALGORITHM FOR TESTING ---------------------
% m = 1; % LSPI
% m = 2; % FQI
% m = 3; % LSM
% ---------------------- SELECT ALGORITHM FOR TESTING ---------------------
% use either a random or given seed as entry point to random num generator
useSeeding = 1; % will kno... |
function [contrasts] = make_contrasts(runNum,outputDir,blockdur,TR,maketext)
% Creates a Nx3 matrix, with N number of runs, and 3 conditions per run.
% The duration of each block (sec) is defined by 'blockdur'.
%
% Usage:
% make_contrasts(runs,blockdur,maketext,outname)
%
% defaults:
% runNum = 1;
% blockdur... |
function [rho,llm,llp,ok] = multicoil_sense_mean_map(x, s, A, rho, msk, dir, prm, vs, llm, llp)
% Maximum a posteriori mean given a set of observed coil images,
% log-sensitivity profiles, a noise precision (= inverse covariance)
% matrix and a K-space sampling scheme.
%
% /!\ Warning: the 3rd dimension should *NEVER... |
%pkg install image-2.4.1.tar.gz
%CGF= Zr + Zi
function icgf_demo
pkg load image;
Img = imread('21_training.tif');
figure('name', 'origin'); imshow(Img);
red = Img(:,:,1);
figure('name', 'red'); imshow(red);
green = Img(:,:,2);
figure('name', 'green'); imshow(green);
[level, sep] = graythresh(green);%otsu
GBW = im2bw(gr... |
clear;
close all;
clc;
M=6;
te=0;
tplot=0;timpact=0;
ntouch=0;ptouch=0;
accel(1)=0;
simout.t=[];simout.stk=[];simout.h=[]; simout.swk=[]; simout.swf=[]; simout.head=[];
epsl=0.1;
tF=[0 1000];
Fext=[0 0]';
d = 0;
num_steps = 10;
P =[0.1313 0 0 0 0.0031 0 0 0
0 ... |
function sthlm3_computeFeaturePlot(featurefilenames,annotationfilenames,plottype,varargin)
% sthlm3_computeFeaturePlot - Compute PCA or t-SNE.
%
% sthlm3_computeFeaturePlot(featurefilenames,annotationfilenames,plottype, ...)
%
% Compute PCA or tSNE.
%
% Required parameters:
% 'featurefilenames' - Cell array of full pa... |
function y=ber_2_sender(SNR_avg,modulation_type);
%计算有两个等同发送方的理论ber
global signal;
switch signal.modulation_type
case 'BPSK'
mu = sqrt(SNR_avg ./ (1 / 2 + SNR_avg));
case 'QPSK'
mu = sqrt(SNR_avg ./ (1 + SNR_avg));
otherwise
error(['Modulation-type unknown: ', modulation_type])
end
... |
function test_suite = test_distanceLines3d
%TESTDISTANCELINES3D One-line description here, please.
%
% output = testDistanceLines3d(input)
%
% Example
% testDistanceLines3d
%
% See also
%
%
% ------
% Author: David Legland
% e-mail: david.legland@grignon.inra.fr
% Created: 2011-01-21, using Ma... |
function resetInitialStocks(stock_file,x)
%resets the stock file to the initial value x
asset_n=length(x);
f=fopen(stock_file,'w');
for i=1:asset_n
fprintf(f,strcat(num2str(x(i)),','));
end
fclose(f);
end
|
function rewrite
[P1 P2] = readin;
for i = 1 : 22
T1 = [];
T2 = [];
I = csvread(num2str(i, 'r%d.txt'));
for j = I
jj = fix((j+1)/2);
if(mod(j,2) == 1)
T1 = [T1 P1{jj}];
T2 = [P2{jj} T2];
else
... |
% function [h, j] = drawOval(centerX, centerY, R, lineStyle, markChar, markSize, displayOn, sigma)
%| function [h, j] = drawOval(centerX, centerY, R, lineStyle, markChar, markSize, displayOn, sigma)
%|
%| INPUTS:
%| (centerX, centerY) define the center of the oval.
%| R is a covariance matrix of which w... |
function [xzRay] = raytraceIW(xg, zg, N, f0, wvf, xz0, rayQuad, traceDx, botstruct)
% [xzr] = RAYTRACEIW(xg, zg, N, f0, wvf, xz0, rayQuad, traceDx, botstruct)
%
% inputs
% - xg: horizontal grid points.
% - zg: vertical grid points.
% - N: matrix of size (length(zg))x(length(xg)) with the buoyancy
% ... |
clc
clear all
close all
clc
%Input Parameters
Rb=1;
Tb=1/Rb;
f=0:0.05*Rb:2*Rb;
ax=f*Tb;
% PSD of Polar Signal
P=Tb*(sinc(ax).*sinc(ax));
% figure(1)
% plot(f,P,'r')
% grid on
% box on
% xlabel('f ---->')
% ylabel('Power Spectral Density ---->')
% title('PSD for Polar Signal')
% PSD of Unipo... |
function ys= ex1(x,y,xs)
plot(x,y,'o')
n=length(x);
n1=length(xs);
for i=1:n1
s=0;
for j=1:n
p=1;
for k=1:n
if k~=j
p=p*(xs(i)-x(k))/(x(j)-x(k));
end
end
s=s+p*y(j);
end
ys(i)=s;
end
plot(x,y,'x',xs,ys)
end
|
function varargout = datasetChooser(varargin)
% DATASETCHOOSER M-file for datasetChooser.fig
% DATASETCHOOSER, by itself, creates a new DATASETCHOOSER or raises the existing
% singleton*.
%
% H = DATASETCHOOSER returns the handle to a new DATASETCHOOSER or the handle to
% the existing singleton*.
%
... |
clear all; close all; clc;
impath = '.\AllDICOMs\';
roipath = '.\AllXML\';
detectbox = '.\detectannotmass.txt';
fid = fopen(detectbox, 'w');
files = dir([impath, '*.dcm']);
for i = 1 : length(files)
id = files(i).name(1:length('20586908'));
%if exist([impath, id, 'mask.jpeg'], 'file') == 2
% con... |
% AUTOR: Jonnathan Espinoza
% 2. Reduzca el sistema a su función de transferencia de lazo cerrado usando un script en MatLab.
clc, clear all;
% Definir H(s)
numh=[1]; denh=[1 1];
% Definir Gc(s)
numgc=[1]; dengc=[1 0];
% Definir Gp(s)
numgp=[1]; dengp=[1 2];
% Definir Gr(s)
numgr=[1]; dengr=[1 2];
% Funcion de Tras... |
clc
clear
startup;
load('../data/input/sec1.mat');
feats = x;
load('../data/output/itq_fc7.mat');
dims = size(feats);
h_img_size = dims(3);
w_img_size = dims(2);
project_mat = pca_mapping * itq_rot_mat;
tt = repmat(mean_fc7(1,:),[h_img_size 1]);
tt2 = repmat(tt,[w_img_size 1]);
tt2 = reshape(tt2,[w_img_size h_img_si... |
% Code taken from Pablo Alvarado's stoch_adam.m lines 217 to 250
%
% The following parameters are required:
%
% J: target function computing the loss (or error)
% gradJ: gradient of target function
% theta0: initial point for the iteration
% Xo: vector holding the original data (e.g. the house areas)
% Yo: vector holdi... |
function retval = face_vertices_m(IFSObj,varargin)
if isempty(varargin) || isempty(varargin{1})
f = 1:nof(IFSObj);
else
f = varargin{1};
end;
maxvf = max(face_size(IFSObj,f));
retval = zeros(length(f),maxvf);
for i=1:length(f)
retval(i,:) = [double(IFSObj.F{f(i)}) double(IFSObj.F{f(i)}(1))*on... |
classdef Galvo2pPlusLightcrafter_NoAmp < nih.squirrellab.shared.rigs.Galvo2p_NoAmp
% Galvo2pPlusStage - This rig description is identical to Galvo2P_NoAmp, but
% includes a lightcrafter projector object so that communication with Stage can
% take into account the LCR's unique properties.
%
% Note t... |
DefineBeamline
[beta tune closedorbit] = ComputeMatchedTwiss(bl,beam);
gridmax = 0.05;
gridstep = 0.001;
quadFmap = FieldMap;
quadFmap.length = quadF.length;
gradient = quadF.gradient;
quadFmap.gridX = -gridmax:gridstep:gridmax;
quadFmap.gridY = -gridmax:gridstep:gridmax;
quadFmap.gridZ = 0:(quadF.length/20):qu... |
function rot_mat = generate_rotation(u, v, w)
u1 = v/sqrt(u^2 + v^2 + w^2);
u2 = -u/sqrt(u^2 + v^2 + w^2);
ct = w/sqrt(u^2 + v^2 + w^2);
st = sqrt(u^2 + v^2)/sqrt(u^2 + v^2 + w^2);
R1 = ct + u1^2*(1-ct);
R2 = u1*u2*(1-ct);
R3 = u2*st;
R4 = u1*u2*(1-ct);
R5 = ct + u2^2*(1-ct);
R... |
%% Defines a few attributes for a clean plot
projection = 'miller';
a_no_save_mask=1;
a_cstep = 0.05; |
function bpminit(RFAttn, varargin)
%BPMINIT - This function initializes the new BPMs
NewTimingSystemFlag = 1;
if nargin < 1
RFAttn = 10;
end
Prefix = getfamilydata('BPM','BaseName');
try
fprintf(' Setting GTB BPM offsets.\n');
Offset = -1 * [
4.7723 -1.7139
-2.8160 2.2563
... |
function [zI, zQ] = timingRecoveryPLL(xI, xQ, M, dseta, Bn)
%function xs=timingRecoveryPLL(x),
%Timing synchronization for the ideal system
%
%Input parameters
% x: Matching filter output
% M: Oversampling factor or samples per Symbol
% dseta: PLL parameter. Damping factor
% Bn: PLL parameter. Noise BandWidth
%
%Outpu... |
function [ result ] = normalize( M )
%NORMALIZE Summary of this function goes here
% Detailed explanation goes here
[m, n] = size(M);
result = zeros(m, n);
for i=1:n
t = sum(M(:, i));
if t==0;
t=1;
end
for j=1:m
result(j, i) = M(j, i)/t;
end
end
end
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%本程序是用于将测试数据xls文件中的某一行读取出来%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%此处文件地址改为需要的文件夹路径,然后要注意斜杠可能要进行转义
path='D:\my_data\test data\IV data\20171129\';
Files = dir(strcat(path,'*... |
function plotisotherm(params,leginfo,type)
% tiny function to return a figure with the same # of isotherms as # of
% parent fields contained in the input structure params
if nargin <1
params = [];
end
if nargin < 2
leginfo =[];
end
if nargin < 3
type = 'sips_sips';
end
datasource = 'D:\Users\mhefti\Doc... |
function [] = print_blocks_names(blocks, names_map)
map_keys = keys(names_map);
map_values = values(names_map);
map_values = cell2mat(map_values);
for i = 1:length(blocks)
s = [num2str(i - 1), ':'];
for j = 1:length(blocks{i})
index = find(map_values == blocks{i}(j));
s = [s, ', ', map_keys{in... |
function out = newtsys2(fun,jac,x0,tol)
%NEWTSYS2
d = -feval(jac,x0)\feval(fun,x0);xnew=d+x0;
while norm(x0-xnew)>tol,
x0=xnew;
d=feval(jac,x0)\feval(fun,x0);
xnew=d+x0;
end
out=xnew; |
function touch_struct = CompileTStruct(data_directory, feature_list)
for b = 1:numel(feature_list)
fileName = ['touch_' feature_list{b}];
if exist([data_directory 'Touch\' fileName '.mat'], 'file')
% Load existing touch structure
disp(['Loading touch stucture for ' feature_list{b}])
... |
function [ H ] = get_precomputed_split_info( is_uv_mesh )
%GET_PRECOMPUTED_INFO Summary of this function goes here
% Detailed explanation goes here
global tri_num ver_num exam_mesh X_g_inv tri_areas F_dot K total_volume dirichlet x2u J_u J_ui JT_u JT_ui perimeter_norm Ks free_num order
ver = 0;
if is_uv_mesh == 1... |
Fs = 500;
t = 0:1/Fs:4*pi;
% a frequencia ť o dois ultimos digitos da matricula: 01
% y = cos(t).*(exp(j*(t+pi/2))- exp(-j*(t+pi/2)))/(2*j);
y = (cos(t)).^2;
hold on;
plot(t,y);
energia = sum(abs(y).^2);
pot = energia/(5*Fs);
fprintf('Energia: %g J\nPotÍncia: %g W\n', energia, pot); |
% Program to load Brain Vision files and extract EEG, EMG signals
% Created By: Nikunj Bhagat, Graduate Student, University of Houston
% Contact : nbhagat08[at]gmail.com
%%
eeglab;
for block_num = 1:4
% if block_num == 1
% EEG = pop_loadbv('C:\NRI_BMI_Mahi_Project_files\All_Subjects\Subject_BNBO\BNBO_Sess... |
function Z = project( obj, X0, Y0, Z0 )
% project data Z with coordinates X,Y onto the grid
assert(isrow(X0));
assert(isrow(Y0));
assert(isrow(Z0));
% inside grid?
assert( min(X0) >= obj.xgMin );
assert( max(X0) <= obj.xgMax );
assert( min(Y0) >= obj.ygMin );
assert( max(Y0) <= obj.ygMax );
sumZ0 = sum(Z0(:));
[I,J... |
function [pass,maxerr] = test(opt)
% Test that multiple confidence levels can be requested via options
rng(1)
t = linspace(0,8,300);
r = linspace(1,8,300);
parIn = [4.5,0.5];
P = dd_gauss(r,parIn);
K = dipolarkernel(t,r);
S = K*P + whitegaussnoise(t,0.05);
[~,~,parfit,cistruct] = selectmodel({@dd_gaus... |
function [ output ] = normalize( input)
%NORMALIZE Summary of this function goes here
% Detailed explanation goes here
in = imread(input);
ref = imread('reference.jpg');
red1 = in(1050:1400,650:1450,1);
green1 = in(1050:1400,650:1450,2);
blue1 = in(1050:1400,650:1450,3);
red2 = ref(1050:... |
function [boxprojMatrix, param, Sup_occurence_cell] = compute_Box_Proj_mat(descr, param)
no_files = numel(param.imFileList) ;
boxSupPixIm = cell(no_files*param.noBoxes,1);
param.supPixFileList = cell(no_files,1);
BoxsupPixIndices = cell(no_files*param.noBoxes,1);
printMessage('Open superpixels files...', 0 , mfilen... |
function p=logmvnpdf(x,mu,sig)
mu=mu(:);
N=length(mu);
if size(x,2)==N
x=x';
end
p=-1/2*log(det(2*pi*sig))...
-1/2*(x-mu)'/sig*(x-mu);
p=diag(p);
end |
function RieszVisualize2D(config, Q, grid)
%RIESZVISUALIZE2D display riesz-wavelet coefficients
%
% Display the Riesz-wavelet coefficients Q at each scale
%
% --------------------------------------------------------------------------
% Input arguments:
%
%
% CONFIG RieszConfig2D object that specifies the Riesz-wavelet
... |
function err_total = P_model_V2(varargin)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
switch nargin
case 0
type = 'y=sin(t)';
otherwise
type = varargin{1};
end
% NOTE: Need to load best model to test it
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
%画收敛图
clear
global pnum ggY iy ipn D C W
load('data.mat')
pnum = 1000; %人口数
ggY = [];
iy = inf;
ipn = 0;
daishu = 100;
D = d; C = c; W = w;
n = size(D,1) + size(C,1) - 1;
options = optimoptions('ga','PopulationSize',pnum,'MaxGenerations',daishu,'MaxStallGenerations',daishu);
[x,y] = ga(@f1,n,[],[],[],[],zeros(1,n),... |
rightGo(1).path = '/Volumes/flyplacememory/TJ/VR_Maze_Experiment_Data/temperaturePreference/2014-01-28/20142801164058_stimulusTest';
rightGo(2).path = '/Volumes/flyplacememory/TJ/VR_Maze_Experiment_Data/temperaturePreference/2014-01-29/20142901142426_stimulusTest';
rightGo(3).path = '/Volumes/flyplacememory/TJ/VR_Maze_... |
%运动学逆解求解
%%%坐标轴建立在移动平台上,三个主动臂水平时刻为默认的转角0°,此时移动平台z轴默认为0;
%%%输入单位是厘米(cm);输出单位度(°)
function [thetas] = IK(x,y,z)
p=[x;y;-z-462];
R=120; %静平台半径
r=60; %动平台半径
l1=265;
l2=565; %末端Z的起始坐标:(0 0 -462)
beta1=(1-1)*2*pi/3;
beta2=(2-1)*2*pi/3;
beta3=(3-1)*2*pi/3;
b1=R*[cos(beta1);sin(beta1);0];
b2=R*[cos(b... |
function demSixKpca(q)
% DEMSIXKPCA Plot Kernel PCA associated with the rotated six data.
% FORMAT
% DESC provides a color image of the distance matrix associated with the
% rotated six data. The file prepDemManifold must be fun first to
% generate the data set.
%
% DESC provides color images of the distance matrix as... |
ivmP2X4.getTotalCurrent=@ getTotalCurrentivmP2X4;
ivmP2X4.ode=@ modelODEivmP2X4;
ivmP2X4.pulseODE=@ modelPulseODEivmP2X4;
ivmP2X4.perfusionResponse=@ perfusionResponseivmP2X4;
ivmP2X4.naivePerfusionResponse=@ naivePerfusionResponseivmP2X4;
ivmP2X4.naivePerfusionSSE=@ naivePerfusionSSEivmP2X4;
ivmP2X4.naivePerfusionVarS... |
cellinfo
numCells = length(celldata);
prediction = struct('cellid',cell(numCells,1),'response',zeros(713,1));
%rfs = cell(numCells,3);
neuralResponse = cell(numCells,1);
for ii=1:numCells
load(celldata(ii).datafile,'resp');
neuralResponse{ii} = resp;
end
lastknot = 30;
c_pt_times_all = [-5 0 2 4 6 8 10 20 3... |
function shuffled_data = shuffle(data)
data = data';
length = size(data,2);
index = randperm(length);
shuffled_data = data(:,index);
shuffled_data = shuffled_data';
end
|
function [namechip,lines]=createtable(rmfile,chiptype)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
%change this to make if for a 3by4 or 4by5
rmfilename=char(strcat(rmfile,'/README.txt'));
lines=textread(rmfilename,'%s','delimiter','\n');
numlines=str2num(char(lines(1)));
x=1;
if c... |
function [Fp, Fi] = triangle_triangle_adjacency(F)
% TRIANGLE_TRIANGLE_ADJACENCY Build a face adjacency data structure for a
% **manifold** triangle mesh. From each face we can find where on its
% neighboring faces it's incident.
%
% [Fp, Fi] = triangle_triangle_adjacency(F)
%
% Input:
% F list of fa... |
classdef PacketFactory
%UNTITLED Summary of this class goes here
% Detailed explanation goes here
properties
end
methods(Static)
function r = createDataLabelProvider(data, labels)
r = pipeline.io.DataLabelProvider(data, labels);
end
end
end
|
function [ lim_os ] = limiter_ospre( neq,r )
%Function "limiter_ospre"
% Adapted for MATLAB from Joe Derlaga's "limiter_ospre.f90", 071213.
% Ospre limiter.
lim_os = zeros(neq,1);
for eq = 1:neq,
lim_os(eq) = 1.5*(r(eq).*r(eq) + r(eq)) ./ (r(eq).*r(eq)+ r(eq) + 1);
if (r(eq) < 0),
... |
% LOGISTIC REGRESSION - PLOTTING DATA
function plotData(X, y)
%PLOTDATA(x,y) plots the data points with + for the positive examples and o for the negative examples. X is assumed to be a Mx2 matrix.
% Create New Figure
figure;
hold on;
% Find Indices of Positive and Negative Examples
pos = find(y == 1);
neg = fi... |
function feaout=refinewitharmax(feain,hmax)
feaout=feain;
clear feain
[l1max,i1max]=max(feaout.el(:,5:7));
[lmax,i2max]=max(l1max);
[armax,iar]=max(feaout.el(:,8));
ln=length(feaout.xn);
while((lmax>hmax)|(armax>10))
ln=ln+1;
if(lmax>hmax)
if(i2max==1)
p1=feaout.el(i1max(i2max),1)... |
function [ecef_x, ecef_y, ecef_z] = lla_to_ecef(lat, lon, alt)
%% Convert coordinates in LLA to ECEF.
% :param lat: The latitude of the point (radians).
% :param lon: The Longitude of the point (radians).
% :param alt: The altitude of the point (meters).
% :return: The ECEF coordinates of the point (meters).
%
% Creat... |
function globalExtinctionProb = metapop(tau)
%METAPOP A metapopulation simulation model
% METAPOP(TAU) runs the metapopulation simulation described in the
% November 2003 MATLAB News&Notes article, "Monte-Carlo simulation in
% MATLAB using copulas".
% Copyright 2009 The MathWorks, Inc.
% Revision: 1.0... |
% Fig. 9.12 Feedback Control of Dynamic Systems, 6e
% Franklin, Powell, Emami
% script to generate Fig. 9.12
% using the general simulation nonlin
N=1;
a=2;
r=0;
num=[1 2 1];
den=[1 0 0 0];
rlocus(num,den)
axis([-6 2 -3 3])
title('Root locus for the system of Figure 9.12')
z=0:.1:.9;
wn= 1:6;... |
function [model] = model_v4(X)
%DEFPATCH1 The default model, ver 1.0
% [model] = model_v1(X)
%
% X:
% X(1) Ril
% X(2) nKs_i
% X(3) pNap
% X(4) tNap
% X(5) vNap
%
% default: [21 11 0 -84 2000]
% model:
% E GN GI A B X0
D = 14; %The defualt diameter of the nerve fiber
R = 8.3144;
F = ... |
function [surfplot,top] = waterwave_initgraphics(Y)
% INITGRAPHICS Initialize graphics for waterwave.
% [surfplot,top,start,stop] = initgraphics(n)
% returns handles to a surface plot, its title, and two uicontrol toggles.
% copied from waterwave_orig.m
[n,~,~,reps] = size(Y);
h_max = max(reshape(Y(:,:,1,:),n*n*... |
function [secure_index,time_taken,avg_precision]=scbir_scheme(dataset,query_set,num_cluster)
%% Clustering and Indexing
t_clustering=tic;
rng('shuffle');
[idx,cluster_centre]=kmeans(dataset,num_cluster); % Clusters all the image feature vectors
dim=size(dataset,2);
[M1,M2,S]=Genparam_aspe(dim); ... |
traindata = load('phishing-train.mat');
testdata = load('phishing-test.mat');
trainfeatures = double(traindata.features);
trainlabels = double(traindata.label');
trainfeatures = transformdata(trainfeatures);
testfeatures = double(testdata.features);
testlabels = double(testdata.label');
testfeatures = transformdata(t... |
function [y1, y2] = squareAndCube(x)
y1=x^2;
y2=x^3; |
function u=prbs(n,m)
%function u=prbs(n,m)
% n: length of sequence
% m: length of shiftregister
% Programmed by Niels K. Poulsen
% Department of Mathematical Modelling,
% Technical University of Denmark
u=zeros(n,1);
x=(osc(m)+1)/2;
x=fix(x);
xor=[0 1; 1 0];
for i=1:n,
y=xor(x(1)+1,x(2)+1);
x(1:m-1)=x(2:m);
x(m... |
%
% function [str msg]=NN_ini(A,source,orientation,channels,model,stdp,stdt)
% [str msg] = NN_ini(com,'head','elevation',[1 2 3 4 5 6],net,strdp,stdt)
% A = 232 class
% source = 'head' or 'eye'
% orientation = 'elvation' or 'azimuth'
% channels = used ADC inputs
% model = net
% stdp ... |
function flag = isRoiOnBound(BW)
% determines whether the given roi is on the boundary of image.
% SYNTAX:
% flag = isRoiOnBound(BW)
%
% INPUT:
% BW is a binary image with roi have value of 1 and other area have value
% of 0
%
% OUTPUT:
% flag whether the roi is on boundary
% by Weiguang (Gavin) Ding, J... |
function [loggamma, loglikelihood] = find_events(eventPatterns, eventVar, testingData)
% Given event patterns, find matching events in a new dataset
%
% eventPatterns: voxel x event matrix of event patterns
% This can come from eventModel.eventPatterns or another source
% To generate null fits, supply eventP... |
function [times,units]=readUnits2(packetLocations,samples,filename)
%function [times,units]=readUnits2(packetLocations,samples,filename)
%
% Updated readUnits using only native Matlab code
%
% For now this is just readWaveforms without returning the
% waveforms. Maybe could speed it up by reading differently
... |
%Returns the Note names for the pitches performed from the ProcTune
function noteNames=IndToNotes(PitchFreq, ProcTune,keySig,keyType)
%Inputs:
%PitchFreq>> The structure to pull information from
%ProcTune>> The processed song excerpt
%keySig>> The key signature of the tune (based on knowledge of the tonic)
%keyType>> ... |
% For computation define as function of 1 vector variable
F.f = @(x) (x(1) - 3*x(2)).^2 + x(1).^4;
F.df = @(x) [2*(x(1) - 3*x(2)) + 4*x(1).^3; -6*(x(1) - 3*x(2))];
F.d2f = @(x) [2 + 12*x(1).^2, -6; -6, 18];
% Parameters
maxIter = 200;
tol = 1e-10; % Stopping tolerance on relative step length betw... |
function category = kyu_BN_RP_CategorizeVariables(labels)
% categorize variables into 6 categories as specified below:
% 1: physical
% 2: biological-baseline + PTV volume
% 3: biological-post radiation
% 4: clincal factors
% 5: RP
nvar = numel(labels);
category = [];
list_phy = {'MLD','MHD','V5','V10','V20','V30','... |
%% testscript:
% I have implemented all this stuff, now I'm going to test is to see how it
% works and find any syntax errors or bugs...
clear, clc;
close all;
% configuration variables:
n = 100; % number of samples
d = 2; % dimension of samples
L = 1; % number of iterations in perceptron algori... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% Programa escrito por Jaime Díez González-Pardo para Octave. Práctica %%%%
%%%%% Cálculo del movimiento de un cohete. Versión 1.0.2 %%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.