text stringlengths 8 6.12M |
|---|
function [ flashes, viewtime, groups ] = lis_hdf_read( filename )
%LIS_HDF_READ imports LIS hdf files and extracts flash data
%
% Written By: Michael Hutchins
%% Flashes
flash = hdfread(filename,'flash');
time = double(flash{1}');
duration = double(flash{2}');
viewtime = double(flash{3}');
location = double... |
function percolationThreshold()
% House A
houseA__day_1_60__day_0_1_1_tp = [11732.0];
houseA__day_1_60__day_0_1_1_tn = [140465.0];
houseA__day_1_60__day_0_1_1_fp = [3618.0];
houseA__day_1_60__day_0_1_1_fn = [2945.0];
houseA_1_tpp = houseA__day_1_60__day_0_1_1_tp / (houseA__day_1_60__day_0_1_1_tp + houseA__day_1_60__da... |
function varargout = simple_tab(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @simple_tab_OpeningFcn, ...
'gui_OutputFcn', @simpl... |
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR
% Autores: Gonzalo Pajares y Jesús Manuel de la Cruz
% Copyright RA-MA, 2007
% Ejercicio 7.4: Extracción de bordes, regiones y puntos de interés
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 7.7.4 Bordes: operador de Roberts
%%%%%%%... |
clear;
clc;
[train_label,train_data] = libsvmread('F:\IE downloads\yeast_train.svm\yeast_train.svm')
model = svmtrain(train_label,train_data,'-t 2 -c 100 -g .05 -b 0')
% SPECTF = csvread('SPECTF.train'); % read a csv file
% labels = SPECTF(:, 1); % labels from the 1st column
% features = SPECTF(:, 2:end);
% featur... |
function Dd = D_conju_new(dr,dc) %2-D
% con_distance(1:N)=1; % 控制点间距
% 按矩阵方式存储。。。只有其相邻点不为0,即+1/delta or -1/delta;
% 所以delta 会是L*L维
% forward difference :delta_i(dj[l]) in 2-D
% Dd=zeros(N*N,numel(f_m));
% k=1;
% for j=1:N
% % displacement in j-th dimension :d(:,j);
% dis... |
% Generated through Matlab
% Author: Christian Haffner
% E-Mail: christian.haffner1986@gmail.com
% Organization: ETHZ ITET IEF/NIST
% Date 2020/02/14
function initPaths(modelpath)
%initPaths - loads the path of the base model, functions, class and material data
global library_path;
li... |
function [] = pascalKpsMulticlassTrainValCreate()
% PASCALKPSMULTICLASSTRAINVALCREATE Generates the text file that is output
% to the data layer of the keypoint network.
% Declare global variables
globals;
% We're interested only in the 'car' class, as of now.
classInds = params.classInds;
% Index at which keypoin... |
%% Read in the Rosbag file
bag = rosbag('/Users/zhenhu/Documents/Second_semester/CIS/Calibration/1AThird.bag');
bagselect = select(bag, 'Topic', '/imu_1A/imu');
msgStructs = readMessages(bagselect,'DataFormat','struct');
ts = timeseries(bagselect, 'Orientation.W', 'Orientation.X','Orientation.Y','Orientation.Z');
... |
function varargout = fAEROZ(varargin)
func = varargin{1};
switch func
case 'readline'
varargout{1} = readline(varargin{2},varargin{3},varargin{4});
case 'minRows'
varargout{1} = 2;
case 'maxRows'
varargout{1} = 2;
otherwise
error('invalid inp... |
function r = rs(img)
Fig=img;
[x,y] = size(Fig);
Type1 = 2; % BlockSize
Type2 = 1; % 1:Row first 2:Col first 3:ZigZag
%进行处理
[Rm,Sm,Um,R1m,S1m,U1m] = RSU(Fig,x*y,Type1,Type2);
ComFig = bitxor(double(Fig),ones(x,y));% 进行一次翻转
[CRm,CSm,CUm,CR1m,CS1m,CU1m] = RSU(ComFig,x*y,Type1,Type2);
d0 = Rm - Sm;
d1 = CRm - CSm;
d10 = R... |
function [time, sideToCollide] = getTimeAndSideForCollide(timeMatrix, box)
%disp('timeMatrix');
time = Inf;
[rows, colunms] = size(box.sideMatrix);
for i = 1:1:colunms
timeTmp = timeMatrix(1, i);
if isnan(timeTmp) || timeTmp == Inf || timeTmp == -Inf
continue
end
if timeT... |
%Drawing a single line between to points
%Naive approach
sx = 1;
sy = 2;
ex = 4;
ey = 6;
stepx = ;
stepy = ;
x = sx:stepx:ex;
y = sy:stepy:ey;
plot(x,y);
%Correct Solution
x = [sx ex];
y = [sy ey];
plot(x,y);
%Using a DrawLine Function
DrawLine(sx,sy,ex,ey);
%Drawing a rectangle
|
%Name: Matlab: Signals and Systems Lab 7th
%Auther: Changgang Zheng
%Student Number UESTC:2016200302027
%Student Number UoG:2289258z
%Institution: Glasgow College UESCT
%Question: 7.1 (a)(b)(c)(d)
function problem_1st
%% Problem a
Ou=2000*pi;
T=1/8192;
N=8192;
n=[0:8191];
t=n*T;
x_n=sin(Ou... |
clear
v1='a'
v2=whos('v1')
ind_2=v2.size
space_v2=v2.bytes
v3=double(v1)
char(97:105)
char(65:75)
v4='MEI'
v5=double(v4) %Åã¥Üv4ªºASCII½X
size(v5)
v6=v5(2)+v5(3)
v7=char(v5) |
w =(1/9)*[1 1 1 , 1 1 1 , 1 1 1];%avarage mask
f = imread('JPCLN018.bmp');
imshow('JPCLN018.bmp');
%Applay Imadjust to image (Stretching gray level)
j = imadjust(f,[],[1; 0]);%//get the negative%%%%%%%%%%%%%%%%5
%%%Convert Image to Double then resize it to
%512*512 (This reduce the processing time)
ggg=im2double(j... |
function Power(nlp, sys)
domains = sys.Gamma.Nodes.Domain;
for i=1:numel(domains)
domain = domains{i};
u = domain.Inputs.Control.u;
dq = domain.States.dx;
B = domain.Gmap.Control.u;
P = tovector(norm(dq.*(B*u)).^2);
power_fun = Sym... |
%% sound: function description
function [outputs] = note2wave01(semi, duration, fs)
freq = (2.^((semi - 69) ./ 12))*440;
y = [];
for i = 1:length(freq)
t = (0:(duration(i)*fs))/fs;
y = [y sin(2*pi*freq(i)*t)];
end
outputs = y;
|
% MODULUS
% this script contains the full process of a run for IR
clc;
clear all;
% init
idc_mix = 0;
% this is an indicator for the number of grains involved
% for prcFS, it is initiated with 0 and will be altered in mod4postFSPEC
% 1 for 1 grain type
% 2 for 2 grain types
mod1CONSTANTS_... |
function [ a_seawater, b_seawater, c_seawater, ...
n_SeaWater, excessScattPercent, h2o_density_kgm3, ...
a_seawater_std, b_seawater_std, c_seawater_std] ...
= SeaWaterIOPs( Wavelength_nm, varargin )
%SeaWaterIOPs Computes the scattering, absorption, and att... |
function plotshadows(Q, B)
% b is the outer big box, s are the boxes of the covering (for the shadows)
d = 3;
[az, el] = view
% back
xQ = [Q(:,1)-Q(:,1+d) Q(:,1)+Q(:,1+d) Q(:,1)+Q(:,1+d) Q(:,1)-Q(:,1+d)];
yQ = [Q(:,2)-Q(:,2+d) Q(:,2)-Q(:,2+d) Q(:,2)-Q(:,2+d) Q(:,2)-Q(:,2+d)];
zQ = [Q(:,3)-Q(:,3+d) Q(:,3)-Q(:,3+d) Q(... |
function v=huge_add(v1,v2)
if ~ischar(v1) || ~ischar(v2) || ~isempty(regexp(v1,'\D')) || ~isempty(regexp(v2,'\D'))
v=-1;
return
end
t1 = v2;
t2 = v1;
pamtim = 0;
v='';
if length(v1)>length(v2)
t1 = v1;
t2 = v2;
end
for i=t1(end:-1:1)
a = str2num(i);
c = -1;
if ~isempty(... |
clear
clc
PA = [0 1 1]
PB = [1 1 0]
P = [2 1 1]
M = [4 0 1]
% find the resultant of PA and PB
PC = PA + PB
% find the unit vector in the direction of PC
mag = sqrt(sum(PC.^2))
unit_vector = PC/mag
% find the moment of the force PC about M
% this is the cross product of MP and PC
MP = P - M
moment = cross( MP, PC )
|
function [results] = repref_phase3(subjectNumber,subjectName,startBlock,screen,scannerID,fMRI,cbfaces,cbscenes,skipPrac)
%-----------------------------------------------------------------------%
% [results] = repref_phase3( ... )
%
% SUBJNUM : unique # based on date string (e.g., '101220')
% SUBJNAME : u... |
function [Lx,Ly] = detectLaser2(inputImage,mascara)
% Dada una imagen a color inputImage detecta los píxeles del láser
% y devuelve sus coordenadas en los vectores [Lx,Ly]
% Opcionalmente, puede tomar una imagen binaria mask que indica
% la región de búsqueda
%%% Segun el curso los pa... |
function [SR] = SRFunc(MachAltSweep,Weight,Sref,AR,engType)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
MachAltSweep(2) = MachAltSweep(2)*55000;
WoverS = Weight/Sref;
[rho,SoundSpeed] = stdatmo(MachAltSweep(2),0,'US'); %slug/ft^3 / ft/s
V = MachAltSweep(1)*SoundSpeed; %ft/s
[~, TSFC... |
function [ret,x0,str,ts,xts]=simexa23(t,x,u,flag);
%SIMEXA23 is the M-file description of the SIMULINK system named SIMEXA23.
% The block-diagram can be displayed by typing: SIMEXA23.
%
% SYS=SIMEXA23(T,X,U,FLAG) returns depending on FLAG certain
% system values given time point, T, current state vector, X... |
function [] = summary_overall_plot(filestr, fields, nRuns, plotopt)
% Currently can't call it from gurls.
% This opt is different from main opt.
for i = 1:numel(filestr)
res{i} = summarize(filestr{i}, fields, nRuns{i});
end
for f = 1:numel(fields)
figure;
meanSideBySide = [];
stdSideBySide = [];
for i = 1:numel(... |
function[w_pocket,errorvector] = perceptron_modified2(X,Y,w_hand,update)
%Pocket Algorithm with output of the Weight in pocket and the error vector
%containing all the error against No.Update
pocketerror = Inf; %set the initial pocket error to infinity,
errorvector = zeros (1,... |
function [ln_mvt_gamma]=mvt_gamma_ln(n, alpha)
% returns the log of multivariate gamma(n, alpha) value.
% necessary for avoiding underflow/overflow problems
% alpha > (n-1)/2
% from Muirhead pp 61-62.
%sum_terms=0;
%for i=1:n
% term_i=gammaln(alpha-.5*(i-1));
% sum_terms=sum_terms+term_i;
%end
ln_mvt_gamma=... |
testData1=[];testData2=[];testData3=[];
outpath='.\newData\cstWalkOutSeg\';
for i=1:5
load([outpath,'walk - ¸±±¾ (',num2str(i),')_1190k.mat']);
testData1=[testData1;gccData(1:2,:)];
testData2=[testData2;gccData(3:4,:)];
testData3=[testData3;gccData(5:6,:)];
end
for i=1:size(testData1,1)
name=[outpa... |
%% Image Analysis Project
%
% Federico Badini & Stefano Bodini
% Politecnico di Milano
% 2014-2015
% Corso del Prof. V. Caglioti
%
% The following script eliminate the background from each image of the set
% Preliminary steps
close all
clear
clc
% Constants
BCKGRND_IMG_PATH = '../background_imm3/median_imm3.jpg';
SRC... |
function [q,y] = adm_nonlinear(A,q_init,lambda,MaxIter,tol)
q = q_init;
for k = 1:MaxIter
q_old = q;
y = soft_thresholding(A*q,lambda);
q = A'*y/norm(A'*y,2);
res_q = norm(q_old-q,2);
if (res_q<=tol)
return;
end
% if(mod(k,10)==0)
% fprintf('Running the %d-th iteration... |
classdef EllipticMixedParticalDerivativeTest3d < SWEBarotropic3d
%> For term $\frac{\partial }{\partial x}\left ( \frac{\partial p}{\partial y}\right )\right ) = f$
properties
ChLength = 2
ChWidth = 1
end
properties
ExactSolution
ExactRHS
... |
function dat = FreeResp(file_name, fullscreen)
% dat = FreeResp(file_name, fullscreen)
% strong assumptions made (5 choice only!)
%
% Example:
% data = FreeResp();
% tgt file force transducers fullscreen
try
%% Setup
SetupRt;
info_txt.Draw();
win.... |
function w = groupLinfProj(w,groups)
p = length(groups);
alpha = w(p+1:end);
w = w(1:p);
u = unique(groups(groups>0));
for i = 1:length(u)
[w(groups==u(i)) alpha(i)] = projectAux(w(groups==u(i)),alpha(i));
end
w = [w;alpha];
end
%% Function to solve the projection for a single group
function [w,alpha] = projectA... |
function n = nPhases(self)
% NPHASES - number of phases
%
n = mixturemethods(19, mix_hndl(self));
|
clear all;
close all;
clc;
cd('/Users/baptiste/Documents/MATLAB/pomdp/pomdp_onebutton/pomdp_onebutton_matrix_v01/');
fileList = {
'pomdp_onebutton_matrix_test_16-7-2017_18-38-21'
};
nSub = length(fileList);
rtmax = 20;
for su=1:nSub
load(sprintf('%s/data/%s',cd,fileList{su}));
currCond ... |
function status = V3DGeneratePipeline(path,folder,varargin)
% V3DGeneratePipeline(path,folder)
% This function demonstrates how to generate and
% save a Visual3D pipeline script to a user specified directory. This
% particular example will:
% 1. Create a new workspace (File|New).
% 2. Create a hybr... |
% Example of calculation of force in a LG03 beam trap.
%
% Approximate of Figure 2 in Nieminen et al., Optical tweezers computational
% toolbox, Journal of Optics A 9, S196-S203 (2007)
%
% How long should this take?
% The problem scales with the square of particle size. Excluding that the
% calculation goes out to main... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Since MatPIV is giving some problems with the Mask. Hence, I am imposing
%the mask after obtaining the filtered vector field. This is done in the
%follwing way:
%
%I draw a the ROI region over a speckle image and the points within
%the ROI are set to... |
clear all
close all
clc
%% Cleanup 2
load data_final2.mat
data = data_final;
%% Rerun behavioral data to order it nicely for analysis
% This section is a little bit complicated. There are two ways that a
% participant could have went through a trial... they could have Left at any time or
% Continue... |
function summarizekinematics(gp,vel,varargin)
opt.varnames = [];
sz1 = size(varargin{1});
i = 1;
opt1 = 1;
while (i <= length(varargin)),
if (isnumeric(varargin{i}) && (ndims(varargin{i}) == length(sz1)) && ...
all(size(varargin{i}) == sz1)),
opt1 = i+1;
i = i+1;
elseif (ischar(vararg... |
%%------------ GRADIENT PROJECTION ---------------------%%
% ----- KARTHIK MOHAN (karna@uw.edu)---------%
%------------ LAST UPDATE 8/28/2012 -------------------%
function[Xnew,err,terr,k] = grad_proj(B,L,Xprev,V,D1,m,n,alpt,betat,kmax)
%% PARAMETERS
%Initialize
step = 1;
Xnew = Xprev;
tol = 1e-4; %TOLERANCE
k... |
function makeClassTree(location)
% Use viewClassTree to generate a class UML diagram for PMTK and save it
% to a file.
filename = 'classDiagram';
if(nargin == 0)
location = 'C:\kmurphy\pmtkLocal\doc\';
end
cd(PMTKroot());
h = viewClassTree();
%print('-dpng',fullfile(locat... |
function [detJS] = C3D8_El_Jacobian_Surf(NES,xi,xyS,DNshapeS)
dxdxi = 0;
dydxi = 0;
dzdxi = 0;
for i=1:NES
dxdxi = dxdxi + DNshapeS(i)*xyS(i,1);
dydxi = dydxi + DNshapeS(i)*xyS(i,2);
dzdxi = dzdxi + DNshapeS(i)*xyS(i,3);
end
detJS = sqrt( dxdxi*dxdxi + dydxi*dydxi + dzdxi*dzdxi); |
a=imread('original.pgm');
[row, col] = size(a);
%kernel=[1 2 3; 6 2 3; 9 2 4];
%kernel=[1 4 1;4 -20 4; 1 4 1];
kernel=[0 -1 0; -1 8 -1; 0 -1 0];
k_sum=sum(sum(kernel));
for i=2:row+1
for j=2:col+1
b(i,j) = a(i-1,j-1);
end
end
for i=2:row+1
b(i, 1) = a(i-1, 1)... |
function vX = E2D_rankmanifold(gam,QU,QV)
% Implements adaption of Algorithm 6 (E2D_X^{M_p}) of
% W. Huang, P.-A. Absil, K.A. Gullivan, "Intrinsic representation of
% tangent vectors and vector transports on matrix manifolds", Numerische
% Mathematik 136.2 (2017): 523-543.
% =========================================... |
%get the gradient of fw
function gradient_f = grad_f(x,w)
%Since φ(x) = e^x-e^-x/e^x+e^-x = tanh(x)
gradient_f = zeros(1,16);
gradient_f(1,1) = tanh(dot(w(1,2:4),x)+w(1,5));
gradient_f(1,2)= x(1,1)*w(1,1)*sech(dot(w(1,2:4),x)+w(1,5)).^2;
gradient_f(1,3)= x(1,2)*w(1,1)*sech(dot(w(1,2:4),x)+w(1,5)).^2;
gradient_f(... |
%%%%%%geiselhw2_2Explfindif
%%%%%%by Dean Geisel
%%%%%%for Dr. Mohamed Sulman
%%%%%%in MTH 7170
%--------------------------------------------------------------------------
%%%%%%This script is written to approximate the IBVP given in problem 2 of
%%%%%%homework 2 at time level 150 using explicit finite difference... |
function [rms, mu, sigma2] = nanrms(x,dim)
%NANRMS Root Mean Squared value, ignoring NaNs.
if nargin == 1 % let mean figure out which dimension to work along
mu = nanmean(x);
sigma2 = nanvar(x);
rms = sqrt(mu.*conj(mu) + sigma2);
else
mu = nanmean(x,dim);
sigma2 = nanvar(x,0,dim);
rms = sqrt(mu.*conj(mu) + sigma2);
end |
function create_headct_jnii
if(~exist('nii2jnii','file') || ~exist('zmat','file') )
error('you must install JNIfTI toolbox https://github.com/NeuroJSON/jnifti and ZMat toolbox:https://github.com/fangq/zmat');
end
dat=nii2jnii('headct.nii.gz');
dat.NIFTIHeader
zipmethod={'','zlib','gzip',... |
function [m1,m2]=match(Iorign,Iorign2)
image(Iorign);
I=single(rgb2gray(Iorign));
image(Iorign2);
I2=single(rgb2gray(Iorign2));
[F1,D1]=vl_sift(I);
[F2,D2]=vl_sift(I2);
% figure;
% subplot(1,2,1);
% imshow(I/256);
% hold on;
% perm = randperm(size(F1,2));
% sel=perm(1:100);
% h1=vl_plotframe(F1(:,sel));
% h2=vl_plotfra... |
Het is niet mogelijk om binnen een functie een andere
functie aan te roepen. |
start0 = tic();
load ../data/rand_matrix.mat
load_time = toc(start0);
times = zeros(N_orders,N_trials);
op = 'det';
for order = 1:N_orders
for i = 1:N_trials
start0 = tic();
D = det(trials{order,i}); % matrix operation of interest
times(order,i) = toc(start0);
end
end
save(['matlab_matrix_result_' op]... |
% Ex4
% c)
N = 10;
P = 100000;
alfa = 0.1;
lambda = [1500,1600,1700,1800,1900,2000];
C = 10;
f = 10^7;
b = 10^(-5);
% Simulator 2 Run
Sim2_PL = zeros(1,length(lambda));
Sim2_termPL = zeros(1,length(lambda));
Sim2_APD = zeros(1,length(lambda));
Sim2_termAPD = zeros(1,length(lambda));
Sim2_MPD = zeros(1,length(lambda)... |
function plotTao( tao,minSpread )
% version 1.0, luhuaibao
% 2014.5.29
% 输出并plot tao,即time-after-order
% inputs:
% tao:
% time-after-order, 下单后潜在等待时间;
% tao.labels, 数据矩阵标签
% tao.values, 数据矩阵
% tao为给定下单方式下,后验看,成交需等待时间
% minSpread
% 条件分布时,进场条件
if ~exist('minSpread','var')
minSpread = 0 ;
... |
x =0:0.01:2*pi;
plot(x,cos(x)); |
function myTimerFcn(~,~,params)
% Copy all of the data logs
md = params.myMyoMex.myoData;
timeIMU = md.timeIMU_log;
timeEMG = md.timeEMG_log;
quat = md.quat_log;
emg = md.emg_log;
% Compute logical indexes for the desired data
timeMax = max([timeIMU(end),timeEMG(end)]);
idxIMU = timeIMU > timeMax-params.duration;
idxE... |
function a = bisection(f,xl,xu,max_iter,max_rel_err)
if f(xl)*f(xu) > 0
fprintf('Invalid Input');
return
end
xr=(xl+xu)/2;
x=xr;
fx=f(xr);
N=2;
iter=2;
error=[];
x1=xr;
if(f(xr)*f(xl) > 0)
xl=xr;
else
xu=xr;
end
if(f(xr)~= 0)
while(1)
xr=(xl+xu)/2;
x=[x xr];
... |
clear all; clc;
fclose('all');
% Load key energies
load fe_key_energies.mat
load cu_key_energies.mat
load ni_key_energies.mat
load ir_key_energies.mat
%load only_mon_key_ener/gies.mat
% Load gamma line half-lives and intensities
load fe_glines.mat
load cu_glines.mat
load ni_glines.mat
load ir_glines.mat
%load only_mo... |
# remaps a cartesian line w.r.t a transformation x
# cl: the cartesian rep of the line [p0x p0y p0z dir_x dir_y dir_z]
# X: the 4x4 isometry of the transformation
# tcl: the cartesian rep of the line [p0x p0y p0z dir_x dir_y dir_z]
function tpl = plane_remapCartesian(X, pl)
# normalize the direction to the unit vect... |
function [theta] = updateParam(theta,grad, trainParams)
lr = trainParams.lr;
if trainParams.GPU == true
theta = gpuArray(theta);
end
theta = theta - (lr*grad);
if trainParams.GPU == true
theta = gather(theta);
end
end |
function ptlist = rr_get_edgepts(edge,rr)
% function ptlist = rr_get_edgepts(edge,rr)
%
% Return list of points in edge in the
% reference refinement. Note that edge
% is a pair of indexes into rr.p for the
% reference triangle.
ptlist = [];
npts = rr.npts;
cnpts = cumsum(rr.npts);
for k = 1:size(rr.flist,1)
f = ... |
function [xk, k, error] = newton_raphson_nl(F, x0, vars, tol, iterMax)
%Esta función se encarga de resolver un sistema de ecuaciones no lineales
%
%Sintaxis: newton_raphson_nl(F, x0, vars, tol, iterMax)
%
%Parámetros Iniciales:
% F = es un vector de celdas que contiene strings de funciones
% ... |
function varargout = czRBFidelityVsPhase(varargin)
% <_o_> = czRBFidelityVsPhase('controlQ',_c&o_,'targetQ',_c&o_,...
% 'phase_c',[_f_],'phase_t',[_f_],...
% 'numGates',_i_,'numReps',_i_,...
% 'notes',<_c_>,'gui',<_b_>,'save',<_b_>)
% _f_: float
% _i_: integer
% _c_: char or char string
% _b_: boolean... |
% this function sets the gmm model parameters
% INPUT
% means means of the GMM. 3xk matrix
% covariances diagonal covariance matrix 3xk matrix
% priors prior of each GMM kx1 vector
% k number of mixtures
% OUTPUT
% model the GMM model fitted. model.mu contains the means of the
% com... |
function [V_upg,K] = metricUpgrade( V )
% [V_upg,K] = metricUpgrade( V )
% Compute matrix K such that V*K is closest to the primal feasible domain.
%
% Note: For convenience V is treated as a column block-vector with
% (3 x k) blocks, so we store the nullspace basis V as a blkmat object.
%
% See also blkmat
% Assert... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% get fea_movingAve fea_LDS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% english fea_movingAve fea_LDS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
clear
clear
imgRoot = '../dataset/newdata/';
imgOrigin = '../dataset/graynewdata/';
imnames=dir([imgRoot '*' '.bmp']);
for ii = 1:length(imnames)
disp(ii);
imname=[imgRoot imnames(ii).name];
imgcolor = imread(imname);
oriimg = [imgOrigin imnames(ii).name(1:end-4) 'r.bmp'];
imwrite(imgcolor,oriimg);... |
%% RBES_search_with_workers.m
RBES_Init_Params_EOS;
[r,params] = RBES_Init_WithRules(params);
matlabpool 2
MAXSAT = 5;
NARCH = 10;
NINSTR = 16;
x = randi(MAXSAT,[NARCH NINSTR]);
sciences = zeros(NARCH,1);
costs = zeros(NARCH,1);
tic;
parfor i = 1:size(x,1)
fprintf('Arch %d of %d...\n',i,size(x,1));
arch = PA... |
function WF6 = WFLeg6()
% Leg 6: Descent
% This value is taken from Roskam
WF6 = 0.99;
end
|
% This simulates a trivariate var with stochastic volatility.
% This version warms up the svol with 1000 draws from the distribution
% for h,B,sv given dy. Ie, it shuts down the VAR parameters until
% the svol gets going.
% Version 3a had convergence problems
NG = 5000; % number of draws from Gibbs s... |
function coll_prem_young_old_show(saveFigures, gNo)
cS = const_data_so1(gNo);
varS = param_so1.var_numbers;
tgS = output_so1.var_load(varS.vCalTargets, cS);
fh = output_so1.plot_by_year(tgS.collPrem_YoungOldYearM, cS.wageYearV, 'College premium', ...
{'Young', 'Middle', 'Old'}, saveFigures, cS);
output_so1.fig_s... |
global MPI_COMM_WORLD;
load 'MatMPI/MPI_COMM_WORLD.mat';
MPI_COMM_WORLD.rank = 83;
Alluxio_Row_mv_version3;
|
function E = GetElectric( phi, L )
% Calculate electric field from potential
J = length(phi);
dx = L/J;
% E(j) = (phi(j-1) - phi(j+1)) / (2*dx)
E = (circshift(phi,1)-circshift(phi,-1))/(2*dx);
end |
% Program 6.2 Vector version of Euler method
% Inputs: interval [a,b], initial vector y0, step size h
% Output: time steps t, solution y
% Example usage: y=euler2([0 1],[0 1],0.1);
function [t,y]=euler2(int,y0,h)
t(1)=int(1); y(1,:)=y0;
n=round((int(2)-int(1))/h);
for i=1:n
t(i+1)=t(i)+h;
y(i+1,:)=eulerstep(t(i),y... |
function im1 = enc_edgy_rev(im)
[row,col]=size(im);
im1 = zeros(size(im));
for i = 1:1:row
for j = 1:1:col
temp = im((i),(j));
im1((i),(j)) = pix_mod_rev(temp);
end
end
end |
function [score,Func_vec] = func_getScoreForOneNetwork(Net, data_all_new)
% Net should be a connectivity matrix
% signalType=0: no signal; 1: ICM->PE
global num_gene;
global Kmax;
global num_celltype;
nM = 100; %number of multiplications on STG; original is 100
% data = data_all(num_cel... |
function [Xp,Yp,Zp,Cp,Xs,Ys,Zs] = pumpkinFunction(w,h)
% Pumpkin
bumps = 10; bdepth = 0.1; bdepth2 = 0.02; dimple = 0.5;
width_r = w; height_r = h;
[Xs, Ys, Zs] = sphere(199);
Rxy = (0-(1-mod(linspace(0,bumps*2,200),2)).^2)*bdepth + (0-(1-mod(linspace(0,bumps*4,200),2)).^2)*bdepth2;
Rz = (0-linspace(1,-1,200)'.^4)*dim... |
function [Kernel] = MatchFilterAndGaussDerKernel(sigma,YLength,theta,type)
%
% MF and FDOG construction
%
% Inputs:
% sigma - scale value
% YLength - length of neighborhood along y-axis
% theta - orientation
% ... |
% Ntot NQLL Unc_NQLL
%
% sin equation:
%
% Ntotlist_theory = np.linspace(0,1)
%
% Nbar = 1.00
% Nstar = 0.1
% Nstar = .9/(2*np.pi)
% NQLLlist_theory = -np.sin(2*np.pi*(Ntotlist_theory))*Nstar + Nbar
%
%
%
%0 1.0375 0
data = [...
0.8 1.108333333 0.070833333
0.2 0.933333333 0.045833333
0.5 1.079166667 0.054... |
% Digital Communication Lab 7 SIMO
% VUB BRUFACE
% Yu Liu, Bohan Zhang, Xianjun Mao
% %% Parameters
%% setting of the basic parameters
clear all
addpath('functions/');
addpath('misc/');
% [Basic Settings]
flags.Nbits = 1024*60; % number of total bits ready to send
flags.f_c = 2.35e9; % carrier frequency = 2.35Gh... |
%ILDAloneFileDiagBox
%Dialog Box to ask user for ildalone file
[FN.ildalone_eq, FN.ILA_path] = uigetfile([FN.ILA_path '*.*'],'Select VAS Filter File');
if(FN.ildalone ~= 0)
set(H.ildalonefile,'String',FN.ildalone_eq);
eval(['save ' FN.current_path 'XStimParams_current XStimParams;'])
end
|
% FEATURE EXTRACTION (Load and no-Load) → USE FILTERED DATA
% Run after |dataPreprocessing.m|
tic
clearvars
load folderPaths.mat
%% Load Preprocessed Filtered and Filtered Data
load accUnfilteredDataset.mat
load accFilteredDataset.mat
load accTimetableNames.mat
%% Dataset Selection
accelerations = [accUnfilteredDa... |
%Load the results for the 10D optimizations
if ~exist('sav10d', 'var')
load('sav10d.mat');
end
%Load the results for the 30D optimizations
if ~exist('sav30d', 'var')
load('sav30d.mat');
end
if ~exist('tab4', 'var')
load('exerc4sav.mat');
end
if ~exist('tab3', 'var')
tab3 = readtable('results/... |
% x값의 데이터를 입력합니다
x = [0 8 16 24 32 40];
% fx값의 데이터를 입력합니다
fx = [14.621 11.843 9.870 8.418 7.305 6.413];
% xx값을 이용해 (0,40) 구간을 400등분합니다
xx = linspace(0,40,400);
% sp1에 자연끝단조건 3차 스플라인의 값을 입력합니다
sp1 = interp1(x,fx,xx,'spline');
% sp2에 Hermite 3차 스플라인의 값을 입력합니다
sp2 = interp1(x,fx,xx,'pchip');
% sp1은 빨간선, sp... |
%3.利用高通滤波器滤波测试图像test3,4:包括unsharp masking, Sobel edge detector, and Laplace edge detection;Canny algorithm.分析各自优缺点;
I3=imread('test3_corrupt.pgm');
figure,subplot(1,2,1),imshow(I3);title('test3 origin');
I4=imread('test4 copy.bmp');
subplot(1,2,2),imshow(I4);title('test4 origin');
saveas(gcf,['task3_','origin','.j... |
% Name: Zheng Wen
% USC ID: 7112807212
% USC Email: zwen1423@usc.edu
% Submission Date 3/19/2020
function y = k_means(X, k)
[m,n] = size(X);
rand_index = randperm(n);
center = X(:, rand_index(1: k));
y = zeros(n, 1);
MAX_ITER = 50;
for iter=1: MAX_ITER
for i=1:n
min_dis = Inf;
for j=1... |
function u = a02e05HeatEq(t,x)
% Assignment 02, Exercise 05
%
% computes the exact solution of the heat equation for given t \in (0,\infty), x \in R.
% Solution by separation of variables
u = 0.5+0.5*exp(-4*t).*cos(2*x); |
function visulizeRemainingSchedules(APs)
globalVarDec;
figure;
for i = 1:size(APs,2)
text(0,i-1,APs{i}{API_NM}, 'HorizontalAlignment', 'right', 'VerticalAlignment', 'bottom', 'Interpreter', 'none');
for j = 1:size(APs{i}{API_MP},2)
taskName = APs{i}{API_MP}{j}{1};
taskTime = APs{i}{AP... |
A = padarray(A, size(C)-size(A), ...
'circular', 'post');
figure(2)
imshow(A)
alpha = 0.9; % this can be dynamically adjusted by a slider
O1 = C + A*alpha; % overlay
figure(3)
imshow(O1)
O2 = C*(1-alpha) + A*alpha; % blend
figure(4)
imshow(O2) |
function PrepFinalize(boldData)
%% CHANGELOG
% Written by Josh Grooms on 20140930
%% Initialize
params = mergestructs(...
boldData.Preprocessing.SegmentThreshold,...
boldData.Preprocessing.SignalCropping);
%% Finalize the Segmented Anatomical Data
% Normalize the mean functional image values to betwe... |
% Rechnerunterstützte Mechanik I
% Wintersemester 2017/18
%
% Übung 4: Zusatzaufgabe
% Differentialoperatoren
% Anwendung auf gewöhnliche Differentialgleichungen
%
clc; % Konsole löschen
close all; % Alle Figures löschen & schließen
clear; % Speicher leeren
disp('Hausaufgabe 1 zur 4. Übung im Fach Rechnerun... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This script plots all results of the GSR analysis, including:
% - raw data
% - mean trialwise responses to different variables
% - correlation of HGF based PE trace with
% ...
%
% Jannis Born, May 2018
resp_onset = 1; % 1000ms afte... |
function [edge_weights] = shortest_path_betweenness(g)
% Calculate shortest path betweenness according to Newman (2004)
% This function is the implementation of shortest path betweenness
% on undirected graph as described in the paper titled "Finding and
% evaluating community structure in networks" by M. E. J ... |
function [] = Engage_Space2()
global H
global XStimParams
global TDT
global FN
global C_
global M_
global GUI
% Engage_Space2
%*******************************************************************************
% The Space Test operation 3/15/07
% eliminated double buffering
% does not write to files
% max... |
function obsjava = create_java_obs(obs)
% CREATE_JAVA_OBS - create the java observation object
%
% obsjava = create_java_obs(obs)
%
% Input: obs - the observation struct
% Output: obsjava - the java obsevation object associated with that struct
% first check the type of observations
if strcmp(obs.type, 'slice')
... |
function [CDo] = ParaDragFuse(h,V,lCab,lNose,lTail,d,DynVisc,S)%Alt(ft), velocity(kts), CharLength(ft), Dia(ft), Dynamic Visc(Slug/ft-s), Reference Area(ft^2)
PerLamFlow = 0.01;
Q = 1.01;
c = lNose + lTail + lCab;
FinenessRatio = c/d;
[TempRat, PresRat, DensRat, SpeedSound] = ISA(h);
M = V*1.688/SpeedSound;
AirD... |
% PolygonLighting - This allows for the toggling the light on the polygons.
% Viewer.PolygonLighting(lightOn)
% LightOn - This is a double, (0,1) where a zero means no light and a one means there is a directional light.
function PolygonLighting(lightOn)
D3d.Viewer.Mex('PolygonLighting',lightOn);
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.