text stringlengths 8 6.12M |
|---|
addpath('analysis', 'classification', 'core', 'imports', 'metrics', 'utils', 'classification/wisard');
% use configs structure to store configurations needed in the analysis
configs = getConfigs();
% load base models
load(sprintf('%s/base_models.mat', configs.RESULTSPATH));
base_models = models;
for SUBJE... |
function delta_t = calc_time_step_adaptive(eval_obj_fun, update_params, ...
params, options, delta_t, delta_t0)
% If the attempted delta_t is less than the lower limit, reset it to the
% lower limit.
if delta_t < delta_t0
delta_t = delta_t0;
end
val_ori = eval_obj_fun(params, options);
params_new = update_para... |
function [ PatchSet, Tangent_Spaces, Dim_TS ] = CalTS( DataSet, Patch_Split )
% Calculate Tangent Spaces
% [ PatchSet, Tangent_Spaces, Dim_TS ] = CalTS( DataSet, Patch_Split )
% Input :
% DataSet = d * n labeled data matrix.
% Patch_Split = partition results
%
% Output:
% PatchS... |
function[Incidence_mat, abs_Inc] = Adj_to_Incdnce_mat(Adj)
[~, n] = size(Adj);
%Remove double edges must be a single edge
m =nnz(Adj);
C = Adj - 0.3*Adj';
L = tril(C);
L(L<0.5) = 0;
L(L>0.9) = 0;
L(L>0.5) = 1;
Adj = Adj - L;
Adj(Adj < 1) = 0;
m =nnz(Adj);
Incidence_mat = sparse(n,m);
abs_Inc = sparse(n,m);
[row, col]... |
%------------------------------------------------------------------
%
% Program:
h=figure; hold on;
plot(cdf_w1_hi,cdf_w0_hi,'b',cdf_w1_lo,cdf_w0_lo,'r'); grid on;
title('ROC: p(d_M | w_0) versus p(d_M | w_1)');
xlabel('p(d_M | w_1)');
ylabel('p(d_M | w_0)');
legend('high resol... |
close all;
clear all;
clc;
load('all2007');
load('QoE2007');
TS=TS-mod(TS,1);
[value,xindex]=intersect(metricsTime,TS);
X=metrics(xindex,:);
[yvalue, yindex]=intersect(TS, value);
Y=responseTime(yindex);
QoE1=QoE1(yindex);
QoE2=QoE2(yindex);
N=length(Y);
figure;
plot(responseTime);
set(gca, 'FontName', 'Times New Rom... |
function serialize_dato( date )
fprintf(int2str(date.day),'.',int2str(date.month),'.',int2str(date.year));
end
|
function times = datetimerange(t0, t1, ts)
% ts: seconds
t0 = datenum(t0);
t1 = datenum(t1);
times = t0:ts/86400:t1;
end |
function vel=velFromRPT3d(velfile,mudfile,rptfile)
mud=textread(mudfile);
mud(:,1)=mud(:,1)/3.28084;
[nx,ox,dx]=get_par3(rptfile,'n1','o1','d1');
[ny,oy,dy]=get_par3(rptfile,'n2','o2','d2');
[nz,oz,dz]=get_par3(rptfile,'n3','o3','d3');
nrpt=get_par1(rptfile,'n4');
rpt=sepread(rptfile,nx*ny*n... |
function [f, idx] = packf(folder_name, ORI)
f = [];
idx = [];
flist = dir(folder_name);
flist = flist(3:end);
len = length(flist)
% code here is subjected to change if we decide not to use rot inv feature
if ORI == 0
len = len / 8;
end
% load feature
f = uint8(zeros(496, len));
cnt = 1;
for i = 1 : len... |
% Name: Zheng Wen
% USC ID: 7112807212
% USC Email: zwen1423@usc.edu
% Submission Date 3/19/2020
function energy_row_15 = energyRow_25_15(energy_row_25)
[~, n] = size(energy_row_25);
energy_row_15 = zeros(15, n);
energy_row_15(1, :) = energy_row_25(1, :);
energy_row_15(2, :) = (energy_row_25(2, :) + ene... |
%总状态数是(D*(L+1))^N*(D+2) 精确模型的csma
function [matrix]=input_state(N,D ,L,state)
matrix=zeros(N,3);
matrix(:,3)=floor((state-1)/(D*(L+1))^N);
k1=state-matrix(1,3)*(D*(L+1))^N;
kk1=0;
k=0;
for i=1:N
if i==1
matrix(i,2)=floor((k1-1)/(D^N*(L+1)^(N-i)));
kk1=k1-matrix(i,2)*(D^N)*(L+1);
els... |
% is_orth
% 0=true; 1=false
%
function is_orth=is_orth(stbc_index)
[a,b,t,n,k]=stbc_bank(stbc_index);
is_orth=1;
% -15 is ok too
eps=10^(-10);
for uu=1:k
% first property
aau=a(:,:,uu)*(a(:,:,uu)');
bbu=b(:,:,uu)*(b(:,:,uu)');
if isequal(aau,eye(t))==0 || isequal(bbu,eye(t))==0
%di... |
function cmm = CM(Alpha,EL)
% Pitching moment
a=[.205 .168 .186 .196 .213 .251 .245 .238 .252 .231 .198 .192
.081 .077 .107 .110 .110 .141 .127 .119 .133 .108 .081 .093
-.046 -.020 -.009 -.005 -.006 .010 .006 -.001 .014 .000 -.013 .032
-.174 -.145 -.121 -.127 -.129 -.102 -.097 -.113 -.087 -.084 -.069 -.006
-.259 ... |
x1 = linspace(-8, 8, 16).';
x2 = linspace(8, -8, 16).';
y = linspace(-8, 8, 16);
y = repmat(y, [16 1]);
y = y(:);
x = x1;
for i=2:16
if ~mod(i, 2)
x = cat(1, x, x2);
else
x = cat(1, x, x1);
end
end
plot(x,y, 'LineWidth', 2);
axis([-10 10 -10 10]);
|
clear
%close all
K = 5;
I = 15;
G = graph();
clear all_nodes
all_edges = [];
for k=0:K
if(k==0)
all_nodes{1,1} = node('1',[0,1]); % initial node
clear E
for i=2:I-K+1
E(i-1) = edge([0,1],[1,i-1],1);
end
all_edges = [all_edges E];
continue
end
... |
function path = dijkstra(song_set, A, start, ends)
idx_start = find(song_set(:,1) - start(1) == 0);
idx_end = find(song_set(:,1) - ends(1) == 0);
N = size(song_set, 1);
distance_from_start = ones(N, 1) * inf;
previous_node = zeros(N, 1); % 0 as undefined
unvisited_set = [1:1:N]; % every node are unvisited
% d(start,... |
function G = record_visit(G, node_id)
G.NodeVisitedCount(1,node_id) = G.NodeVisitedCount(1,node_id) + 1; |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Numerische Mathematik fuer Physik und Ingenieurwissenschaften 2020 %%%
%%% Programmierabgaben (Praktischer Teil des Uebungungsblattes) %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
... |
function [ alpha ] = Armijo_LS(f, df, p, x, alpha, rho, c)
% f: vector->scalar function -- the objective
% df: gradient function
% p: search direction; must satisfy that A) it is a descent direction at starting point x and B) norm(p)=1
% x: starting point
% alpha: initial (maximal) step length
% rho: step lenght multip... |
function res = opdracht_1_versie_1_CHECK(apStudentSol)
%%========== PLACE SOLUTION IN COMMENTS HERE
% % % % % % % %% Opdracht 1
% % % % % % % % Maak een matrix A aan: A = 2 56 3
% % % % % % % % 8 9 23
% % % % % % % % 81 7 67
% % % % % % % % Stop... |
function window = getWindow(image, row, col, windowSize)
% Returns a window of size windowSize around a give point.
% Zero pads if necessary
center = ceil(windowSize/2);
edgeBuffer = (windowSize - 1)/2;
window = zeros(windowSize);
pre_col = min(col - 1, edgeBuffer);
post_col ... |
% Inputs:
% im - [nR x nC] image
%
% Outputs: matches the output of the hough(...) function in MATLAB
% houghSpace - Hough Transform of image (accumulator matrix)
% theta - abscissa of Hough space (specified in degrees)
% rho - ordinate of Hough space (specified in pixel units)
%
function [houghSpace,t... |
classdef Quad_verifier < Quad_MixedIntegerConvexProgram
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&
% Trajectory verifier: %
% %
% Checks if a CoM trajectory satisfies the CWS stability %
% constraints for a give... |
function iline = EDB2fistr(longtextstring,iline,linestartvec,CRpositionvec,textstring)
% EDB2fistr - Reads a text file, line by line, until a given textstring is found.
% Reads line by line in a long textstring 'longtextstring'
% until the text in 'textstring' has been found.
%
% Input parameters:
% longtextstring The... |
clear all;
clc;
iter =100:4:100;
path = 'Z:\User\wuxiang\Result\DeepFace\DeepFace_set003\DeepFace0.3.13.x';
for niter = 1:size(iter, 2)
test_iter = iter(niter);
close_set_test;
open_set_test;
% result_batch(niter, :) = rank1;
result_batch(niter, :) = [rank1, DIR];
end |
clc;
clear;
close all;
drawnow;
rng default;
% 算法超参数
MINIBATCHSIZE = 100;
LR = 0.01;
WD = 0.0005;
MOM = 0.0;
% 程序参数
DISPLAY_LOSSES_ACCS_INTERVAL = round(1000/MINIBATCHSIZE);
DISPLAY_HIST_INTERVAL = 1e12;
SNAPSHOT_INTERVAL = round(1000/MINIBATCHSIZE);
RESUME_FROM_SNAPSHOT_ITER = 0;
MAX_ITER = 1e12;
... |
function [ ] = demo( )
%DEMO
% 干的事情是:
% 从excel中初始化当日所有期权信息( OptInfo )
% DEMO的框架是建立在Structure的optInfos上的
% 然后,建立一个structure,算payoff,画图
% ---------------------------
% 程刚,20160124
%% -------------------------------清空一下------------------------%%
clc
close all
format compact
format short g
%% -------------------------... |
%% KeyboardInput
%
% Tests what the ESC key is bound to using the kbhit function.
clear; close all;
%%
isLoop = true;
while isLoop
x = kbhit();
disp(x)
if x == 'x'
isLoop = false;
end
end
|
clear all;
%load data from AMPL Model
[x,bl,bu,v,cl,cu] = amplfunc('case300.nl');
% define inital point for SLP:
x_i = zeros(length(bl),1);
x_i(1:300)= ones(300,1);
% define inital size of trustregion
trust = 10;
%define lower and upper bounds for variables d
lbound = -min(trust, abs(bl-x_i));
ubound ... |
function [fig] = dpnDrawToolbar(fig)
% Let's add a new toolbar to it instead of the horrible push buttons
fig.tb.main = uitoolbar('Parent',fig.fig,...
'Tag','dpntb',...
'Visible','on');
% Need to get the icons for the buttons...
dirIcon = deSlash([pwd filesep '/desi/icons/']);
% Here a button for the loading... |
function [x,y] = symmetric(cp_x,cp_y, r_u )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
n=length(cp_x);
for i = 1:n
cp_xq(i) = cp_x(n-i+1);
cp_yq(i) = cp_y(n-i+1);
end
for i = 1:length(r_u)
[t_x, t_y] = de_casteljau(n-1, cp_xq, cp_yq, r_u(i));
x(i) = t_x;
... |
%In this case, we consider the link between GT to the user. It means the
%forward link takes into account the uplink and downliink part.
%%%%%
%INPUT PARAMETERS:
%r = distance between each satellite and the Earth center;
%t = time vector;
%lambda = central angle of the gs;
%lambda_us = central angle of the user ... |
function ptr=CreatGUI(obj)
%{
%%
addpath('DAC');
addpath('mainfile');
%
addpath('qos')
import qes.*
import sqc.wv.*
import qes.util.*
import qes.hwdriver.sync.*
import data_taking.public.xmon.*
import qes.hwdriver.*
%%
%dpo70404c = tcpip('10.0.0.100', 5025);
dpo70404c =visa('agilent','TCPIP0::C500014-70KC::inst0::INSTR... |
% This script will
% filter the P files to remove RF leakage spikes
% reconstruct a turbo set of ASL images
% perform the pairwise subtraction and averaging (aslsub)
% smooth those images in space
% produce signal as a function of TR plot
% show histogram of the different TRs
%
% execute this script from a directory th... |
function inv = inverse(g,f,Zpx)
%INVERSE IN A FIELD
[gcd,s,~] = euclid_extended(g,f,Zpx);
aux = Zpx.quo(Zpx,s,gcd);
inv = Zpx.rem(Zpx,aux,f);
end |
function [h0 ha px pxa] = driver_gentemann_dsst(h0,ha,p0,pa);
% function [h0 ha px pxa] = driver_gentemann_dsst(h0,ha,p0,pa);
% [px] = driver_gentemann_dsst(h0,ha,p0,pa);
%
%
% input
% h0,ha,p0,pa are the usual inputs from reading a rtp file
% output
% p0 --> px where only stemp field is chan... |
function [inp_matrix] = VD_gen_limited_input(numInputDims,p)
numRows = p.numRows;
% avail_features = [ .1 .1 .1; .1 .1 .9; ...
% .1 .9 .1; .1 .9 .9; ...
% .9 .1 .1; .9 .1 .9; ...
% .9 .9 .1; .9 .9 .9];
count=1;
avail_features = zeros(p.components, p.numInputDim... |
function aic = computeLocalAIC(obj,gp,index,k)
evalstr = tree2evalstr(obj.pareto_fstr{index},gp); % get decoded function string
ypredval = obj.predictData(evalstr,obj.x_val);
yval = obj.y_val; % output of validation (same for all modes and candidates)
weights = obj.getWeightsVal(k); % current mode
% local AIC score ... |
function [W, info]=lambertwmatrix(k, A)
% W=LAMBERTWMATRIX(k,A) computes the determination k of the Lambert W function of A
% k: branch of the Lambert W function
% A: matrix whose Lambert W is required
%
% The algorithm is based on the Newton iteration with a heuristic stategy for
% the initial value based dependi... |
function [Ycap]=call_bcdLrMr(X,opts)
%BCDLrMr_ALSLS Block Component Decomposition (BCD) in rank-(Lr,Mr,.) terms.
% [A,B,C]=bcdLrMr_alsls(X,L_vec,M_vec) computes the BCD-(Lr,Mr,.) of a third-order tensor.
% The alternating least squares (ALS) algorithm is used, possibly coupled
% with different choices of line sea... |
function [ angles] = getRandomMovewithBelief( currentPos, belief, limits )
angles = [];
while size(angles,1) < 1
dims = size(limits,1);
% vector = [];
% for i = 1:dims
% vector(end+1) = rand();
% end
% if( sqrt( sum(vector.^2) ) > 1)
% continue
% ... |
speech_vector = audioread('speech.au');
X = double(speech_vector);
subplot(4,1,1)
Y2 = Uquant(X,2^7);
E = Y2 - X;
hist(E,20)
title('E = Y - X, Y = Uquant(speechVec,2^7)')
xlabel('bins')
ylabel('frequency')
subplot(4,1,2)
Y2 = Uquant(X,2^4);
E = Y2 - X;
hist(E,20)
title('E = Y - X, Y = Uquant(speechVec,2^4)')
xlabel('b... |
%% input data
user17final = removevars(user17finalfile,{'VarName1'});
gt = user17final(:,{'groundtruth'});
array = table2array(gt);
gt_new = cellstr(array);
gt_class_labels = grp2idx(gt_new);
user17final = removevars(user17final,{'groundtruth'});
user17final = table2array(user17final);
user17final = transpose(user17fin... |
function musk = WinningTicket(PruneIters, PruneRate, SubTrainIters, ...
xtrain,xtest,ytrain,ytest,nTest,varEst,freq,var,K,options_ADMM);
% The function is to find the winning tickets before the actual training.
% By iterative pruning Pre-training before the
% Initial Musk Index 1:Q, here... |
function plotInitialChannel(obj)
%plotChannelElevations plots the channel elevations vs. the channel cells
IC = obj.initialChannelElevations;
cellLengths = obj.initialChannelCellLengths;
lenXX = length(IC);
%% build a vector where each entry is the distance from the origin
xx = zeros(1,lenXX);
for i = 2:lenXX... |
function Distances = Calc_Distancia(Rotula,Puntos_Moved_Red)
Fixed = Puntos_Moved_Red(:,:,2*Rotula-1); %
% Para cada agujero, calcula la posición de la placa móvil según h y los
% ángulos alpha1 y alpha2.
Moved = Puntos_Moved_Red(:,:,2*Rotula); %
% Cálculo de las distancias entre cada par de agujeros m... |
function thresh = thresholddlg(t,data, varargin)
% function thresh = thresholddlg(t,data, varargin)
% Shows a dialog to select a threshold on a 1D data set.
%
% Options:
% 'default', thresh - Default threshold value
% 'threshtype', ('abs','max', or 'min') - Type of threshold. 'abs'
% selects values with magni... |
%[status,result] = system('cd "C:\osmose_julia" && lua projects\pulp\water_frontend.lua');
%{
%%Reading
cd
files = textread('C:\osmose_julia\ET\test2.txt','%s','delimiter','\n'); % tested with matlabf
%D= [];
for i=1:length(files)
if contains(files(i), 'Hans') ==1
files(i) = {'Christa'};
... |
% author: Tyler Thompson
% date: 3/20/2019
% description: ECE4550 Matlab Assignment #2 Problem 1 Part A
clear;
close all;
% X(z) = (1 + z^-1)/(1 - z^-1 + 0.5z^-2)
b = [1 1];
a = [1 -1 0.5];
[r,p,k] = residue(b,a);
fprintf("\nPoles:\n");
for n = 1:length(p)
fprintf("%g%+gj\n", real(p(n)), imag(p(n)));
end
fprint... |
function [t,indexchannel]=MergeSortChannel(t1,ic1,t2,ic2);
% [t,indexchannel]=MergeSortChannel(t1,ic1,t2,ic2);
%
% Function purpose : takes two sort chanels and merges them into one each
% channel is taken from both recordings sorted and combined to the rest.
%
% Function recives : t1,2 - firing timings of input ti... |
function fig2jpg(hfig, fname)
% Write figure to JPEG graphics file.
%
% Prototype: fig2jpg(fig, fname)
% Inputs: hfig - figure, handle
% fname - file name to write
%
% See also matbinfile.
% Copyright(c) 2009-2020, by Gongmin Yan, All rights reserved.
% Northwestern Polytechnical University, Xi An, P.R.China
... |
clc;
clear all; close all;
%% Prob 2a. State-space Equation
disp('>> Prob 2a. State-space Equation');
M = 2.0;
m = 0.1;
l = 0.5;
g = 9.81;
A = [0 1 0 0; ...
(M+m)*g/M/l 0 0 0; ...
0 0 0 1; ...
-m*g/M 0 0 0]
B = [0; -1/M/l; 0; 1/M]
disp(repmat('=',1,80));
%% Prob 2b. Stability Analysis
disp('>> Prob 2b.... |
% MODULUS 4postFSPEC_t1
% regenerate frequency spectrum
% using peak
% if most of them contain only one peak
% the origin filtered frequency spectrum is kept
% if most of them contain more than one peak
% for g1 find one with largest amplitude
% for g2 peak farthest away from maxima is looked ... |
function [results] = mil_kNN( data, par )
%Citation-kNN adopted from MILL
%Input:
% data.train_bags
% data.test_bags
% each bag is a struct (5x1): name inst_name inst_label instance label
% par.bag_dis_type 'max' or 'min'
% par.inst_dist_type 'euclidean' or 'cosine'
% par.num_ref number of n... |
%% Code used to estimate a favar model
% IRFS and VDs are for Cholesky Ordered shocks in Factor Model
% Factors can be identified using restrictions on factor loadings
% HY US Corp Default Rate is Exogenous and is an observed factor
%TODO : supprimer les variables inutiles
clear all; % clear workspace
path = '/Users... |
function [data, auxData, metaData, txtData, weights] = mydata_Coptodon_rendalli
%% set metaData
metaData.phylum = 'Chordata';
metaData.class = 'Actinopterygii';
metaData.order = 'Cichliformes';
metaData.family = 'Cichlidae';
metaData.species = 'Coptodon_rendalli';
metaData.species_en ... |
function C = C_matrix(alpha, K, nv, eyeM)
%C_MATRIX CONTRUCTOR
% Class support:
% alpha: double;
% K: cell, Kernel collection;
% nv: double, noise;
% eyeM: double, indentity matrix of size n by n;
C = 0;
Q = numel(K);
for i = 1:Q
C = C + alpha(i)*K{i};
end
C = C + n... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% File: simulate_flight.m
%% By: Sarah Hummel
%% Date: July 2003
%%
%% This MATLAB program allows the simulation of a single frisbee flight
%% given initial conditions and a set of aerodynamic coefficients.
%% Calls subroutine discfltEOM.m, the equati... |
%% Pico VNA Golden DUT Data Collection Example
%
% This is an example of Golden DUT data aquisition using the PicoVNA. This
% makes a measurement of the Golden DUT and retrieves the S21 log magnitude
% data from the VNA ready for use in the
% <PicoVNA_DUT_PassFail_testing_Example.html |PicoVNA_DUT_PassFail_Testin... |
function ce30_PreAllocatedMemory(obj)
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% @Func ce30_PreAllocatedMemory;
% @Brief 提前分配数据空间;
% @Param NONE;
% @Retval NONE
% @Date 2019/11/21;
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%% 函数主体
obj.preAllocatedDataPack = zeros(81... |
% Phillip K Poon
% June 7th 2017
% This script demonstrates a naive denoise algorithm which simply takes the
% FFT of the signal then implements a simple low pass filter. This is done
% by setting a maximum frequency. Anything above that frequency is set to
% zero.
clc;
clearvars;
close all;
% Sampling Frequency In ... |
% Test MLE of parameters of joint and marginal density functions
% Xin Wang <xinw@salk.edu>
% Copyright 2014, CNL-S, The Salk Institute for Biological Studies
clear all; clc;
%% load example data
dataPath = '../data/parsed';
recordName = '080318F-XW053';
[t, lambda, n] = getDataFromRecord(fullfile(dataPath, [re... |
function [abs_RX1_amp_interp, abs_RX2_amp_interp, abs_RX3_amp_interp] = extract_amp_interp(TX_ant, data_file, values)
% data_file = 'occupancy_model_verification/data/perp_2_5m5t1_sh_5s_2.dat' ;
[amp_RX1_ant_sq, amp_RX2_ant_sq, amp_RX3_ant_sq] = extract_CSI_from_TX_antenna(TX_ant, data_file, values);
num_element... |
%% Constants
global R L m K g
R = 1;
L = 0.01;
m = 0.05;
K = 0.0001;
g = 9.81;
%% Script
% Finding equilibrium points
for i = [7]
fprintf("Equilibrium for u(t) = %f\n", i)
tmp = equilibrium_constant(i);
fprintf("x_1: %g + %gi\nx_2: %g + %gi\nx_3: %g + %gi\n", real(tmp(1)), imag(tmp(1)),real(tmp(2)), imag(t... |
function [good_grid, nb_iteration, grids, f] = LundyMees(...
initial_grid, beta_start, beta_end, max_comp_time, max_chain_length)
tic
n = max_chain_length;
delta = (1/beta_start - 1/beta_end) / (n * 1/beta_start * 1/beta_end);
beta = beta_start;
% generation d'une grille avec sous-carre et colonnes correctes
grid =... |
%public setting
% SimulationTime=100*10^6; %simulation duration
Task_arrival_period = 8*10^6; %单位:us 任务到达时间间隔
VehicleDensity = 60 ;% veh/km
kjam=250;%veh/km
vf=120;%km/h
Radius = 200; %meter RSU覆盖范围半径
d_r = 100; %meter RSU到路边距离
RoadLength=2*sqrt(Radius^2-(d_r)^2);%meter RSU覆盖小区长度
Noise = -100; % 噪声功率 单位... |
%%
clc;
clear all;
close all;
daq.getDevices
s=daq.createSession('ni');
s.DurationInSeconds=40;
s.Rate=2000;
ch1=s.addAnalogInputChannel('Dev1','ai0','voltage');
ch2=s.addAnalogInputChannel('Dev1','ai1','voltage');
s.Channels
%%
[data,time]=s.startForeground()
s.stop
%%
figure
plot(time,data(:,1))
... |
% ShieldingWrapperScript.m is a wrapper script for calculating topographic and slope
% shielding of cosmogenic nuclide production for the simplified catchment examples
% presented in DiBiase (2018)
%
% The wrapper script reproduces the model as described in the main text, and generates
% the model results for Figures... |
clc;
clear all;
close all;
S = imread('input5_source.jpeg');
T = imread('input5_target.jpg');
color_transfer_lalphabeta(S,T);
color_transfer_RGB(S,T);
color_transfer_CIECAM(S,T);
|
function scans_to_process = longDTI_DARTEL_registration_to_new(scans_to_process, templatepath)
%longDTI_DARTEL_registration_to_new SPM12b DARTEL register to new template
% Detailed explanation goes here
% Syntax: scans_to_process = longDTI_DARTEL_registration_to_new( scans_to_process)
%
% Inputs: scans_to_proce... |
function [ mag, theta ] = gradientMagnitude( im, sigma )
% im: RGB image
% sigma: std of Gaussian filter
im = im2double(im);
im_size = size(im);
assert(im_size(3) == 3);
gx = zeros(im_size);
gy = zeros(im_size);
h_len = ceil(6 * sigma);
if (mod(h_len, 2) == 0)
h_l... |
function C = RainbowColor(n,ofhowmany)
% function C = RainbowColor(n,ofhowmany)
%
% returns a unique color in RGB along the rainbow
h = n/ofhowmany;
C = hsv2rgb(h,1,1); |
function [y] = sigmoidal(x)
%%
%% NAME
%%
%% sigmoidal
%%
%% SYNOPSIS
%%
%% [y] = function sigmoidal(x)
%%
%% ARGS
%%
%% y out return value of function
%% x in dependent variable
%%
%% DESC
%%
%% This function is a simple test of sigmoidal bias weighting.
%%
%% HISTORY
... |
function [ Rs, ts ] = EstimateRt_linear( Hs, K )
% Linear parameter estimation of R and t
%
% K: a camera calibration matrix. 3 x 3 matrix.
%
% Hs: a homography from the world to images. 3 x 3 x N matrix, where N is
% the number of calibration images.
%
% Rs: rotation matrices. 3 x 3 x N matrix, where N is th... |
%% Introduction to Image and Video Processing
% coronaproject 4: video processing
%% Task 1
clear; clc; close all;
% read the running video
vrun0 = VideoReader('run1.mp4')
% gets 6 frames from this video
runframe1 = rgb2gray(read(vrun0,104));
runframe2 = rgb2gray(read(vrun0,107));
runframe3 = rgb2gray(read(vrun0,1... |
%% harris corner detection
I = double(imread('D:\Users\Lenovo\Desktop\pic\28.gif'));
[a,b] = size(I);
% step 1
X = conv2(I,[-1,-2,-3,-4,0,4,3,2,1],'same');
Y = conv2(I,[-1,-2,-3,-4,0,4,3,2,1]','same');
% step 2
u_mat = -15:15;
v_mat = -15:15;
sigma = 3;
w = zeros(31,31);
tic;
for u = 1:31
for... |
%script11_1.m
M=zeros(size(C));
C2=C;
for i=1:numel(M)
M(i)=round(mean(C{i}(:)));
C2{i}(:)=M(i);
end |
close all; clear all; clc;
% Create all the valid combos
% load in the motor data
motor_table = readtable('motors.csv');
num_motors = size(motor_table, 1);
motors = table2struct(motor_table);
gear_table = readtable('gears.csv');
gears = table2struct(gear_table);
combos = fileread('combos.txt');
combo_lin... |
function testSegmentationWrapper()
end |
function mockdata_plots
% Plot results of mockdata runs for state space IPM manuscript
% Fig 1a: Plot estimated values of F for 'baseline' runs
figure(1)
clf
set(gcf,'units','cent','position',[10,10,12.9 18])
% ------------------------------------------------------
% Loop over 3 'true' values then 10 runs in each ... |
function [x,n,error] = wurzel(a, tau)
%WURZEL x = wurzel(a) berechnet die Quadratwurzel von a
% mit dem Newtonverfahren
% error = differenz zwischen die Newton-Verfahren und wurzel von a
% n = nte-Iteration, wo das Konvergenzkriterium genug ist
x = 1; xalt = inf; n = 0;
... |
% Parameters:
% M_hat -- 2F x 3K, obtained from SVD.
% G -- 3K x 3 x K, corrective triple for each basis.
%
% Returns:
% G -- 3K x 3 x K
% rotations -- 2 x 3 x F
% coeff -- K x F
function [G, rotations, coeff] = align_corrective_triples(M_hat, G)
% M_hat is 2F x 3K.
F = size(M_hat, 1) / 2;
K = size(M_hat, 2) / 3... |
function Z = zigzag(n)
%initial matricea in care calculez este 0
A=zeros(n,n);
count = 0; % cu count trec prin fiecare numar ce trebuie adaugat
for s = 2: (2*n) %parcurg sumele indicilor de pe fiecare diagonala
%daca suma este para eu trebuie sa urc in sus
% ca sa adaug in matrice
if mod(s,2) == 0
%astfel caut i... |
function [] = CV_lr_driver(Xtrain,Ytrain)
Xtrain = full(Xtrain);
Ytrain = full(Ytrain);
s=size(Xtrain);
countTrainEg = s(1,1);
chunkSize = countTrainEg/10;
lambdas = [1 0.1 0.01 0.001 0.0001 10^(-5) 10^(-6) 10^(-7)];
alphas = [0.001 0.001 0.01 0.01 0.01 0.1 0.1 0.1];
for L... |
% main
%
% Example function showing how to use the Unfolding class
% to compose Cagdas's insect
%
% output: [Gcomb G1 G2] = Unfolding objects
% G1, G2 = unfoldings read in from files
% Gcomb = joined unfolding
%
% written by: Cynthia Sung
% last modified: 03/13/2013
%
function [Gcomb, G1, G2] =... |
function [ accMarkov ] = getAccMarkov( markov )
% Get the size of the input argument (should be a NxN matrix)
s = size(markov);
if s(1) == s(2)
% Pre-allocate the memory for the output accumulated matrix
accMarkov = zeros(s(1),s(2));
% Accumulate the probabilities and store... |
clear all; close all; clc;
syms s
%Lazos encontrados en el sistema
L1 = -3/s;
L2 = -2/s;
L3 = -1/s;
L4 = -1/s^3;
% Determinante del sistema. L1 y L3 son los unicos lazos disjuntos
den = simplify(1-L1-L2-L3-L4+L1*L3)
%Agregamos todos los caminos y los cofactores relacionados, dependiendo de
% si el camino toca el... |
% LAB7 Ex.1
clear all
close all
fs = 100;
y = @(t) cos(2*pi*2.5*t);
janela = {'Triangular';'Hanning';'Hamming';'Flat top'};
for i=1:3
t{i}=1/fs:1/fs:i;
sig{i} = y(t{i});
sigfft{i} = fftshift(fft(sig{i}));
n(i) = numel(sigfft{i});
freq{i} = linspace(-n(i)/2,n(i)/2,n(i)).*fs/n(i);
... |
%%%Initialize
clear
clc
close all
%%%Setup the IGRF Model
disp(['You must download the igrf model from MathWorks in order to' ...
' use this software'])
disp('https://www.mathworks.com/matlabcentral/fileexchange/34388-international-geomagnetic-reference-field-igrf-model')
addpath '../igrf/'
%%%Get Planet Parame... |
% XXXXXXXXXXXXXXXXXXXXXXXXXXX sus_scale_rate XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
%
% Author : Susanti
% Date : Aug 1 2014
% Function : Compute the Scale Rate
% Syntax : sus_scale_rate(a_dash, a_star)
%
% a_dash, a_star - Both have 3 points
%
% Algorithm -
%
% XXXXXXXXXXXXXXXXXXXXXXXXXXX... |
function D = sqeuclidean6(X, Y, I, C, W)
% SQEUCLIDEAN6 Calculate point to cluster centroid distances by squared
% Euclidean distance. (base 6)
% Copyright 2008 Wei Tang (wtang@cs.utexas.edu)
% $Id: sqeuclidean6.m,v 1.2 2008/04/19 01:20:47 wtang Exp $
if (size(W,1) ~= size(X,1)) || (size(W,2) ~= size(X,2)) ...
|| (... |
function [ error ] = qamerr( EbNo,dataMod,dataIn,char)
k=4;
numSamplesPerSymbol=1;
snr = EbNo + 10*log10(k) - 10*log10(numSamplesPerSymbol);
receivedSignal = awgn(dataMod,snr,'measured');
% QAM Demodulation
if strcmp(char,'Without_filter')
% (A) Without filtering
dataSymbolsOut = qamdemod(receive... |
function y = perform_radon_transform(x, tlist, direction, rotation)
% perform_radon_transform - Radon transform
%
% y = perform_radon_transform(x, tlist, direction, rotation);
%
% tlist is a vector of m angles.
% If direction==1, compute the Radon transform.
% x is of size (n,n) and y of size (n,m)
% If ... |
function [KG]=NonGeometryStiffnessPlateAVE(FEM,Laminate,Stru)
% average stress in each element at different layers
% Gometric stiffness obtained from calculated stress [sigma_xx,sigma_yy,tau_xy]
gDOF=FEM.GDof;
KG=zeros(gDOF,gDOF);
%-----Geometry Stiffness due to Tranverse deformation------
% Loop for each element, ele... |
echo off
%优化工具箱简明教程
%TUTDEMO Tutorial for Optimization Toolbox.
% Copyright (c) 1990-98 by The MathWorks, Inc.
% $Revision: 1.12 $ $Date: 1997/11/29 01:23:27 $
echo on; clc
%TUTDEMO Tutorial for Optimization Toolbox.
%##########################################################################
%
% Thi... |
%%%%%%
%
% Main processing script to create IASI RTP files from raw data
%
% Script to produce IASI FULL, FULL4CH, SUBSET data
%
% Input variables:
% JOB = [start_date end_date] (in matlab format)
% data_str='' (a string for data variation)
%
% To use execute the script using
% $ clustcmd mkday_####.m 200... |
%% FEATURE VECTOR EXTRACTION (LBP)
function [meanV, covV]=Mean_Cov_Bayes(faceM,EiganVec)
[~, ~, numSubjects]=size(faceM);
if nargin >1
[rows,~]=size(EiganVec);
else
testFace=faceM(:,:,1);
testFace=reshape(testFace, [],1);
[rows, ~]=size(testFace);
end
meanV=zeros(rows,1, numSubjects);
covV=zeros(rows, rows, num... |
function [struct] = extrai_gabor(img,mask,janela,struct)
parametros = [[0.05; 0.05; 0; 0] [0.05; 0.05; 45; 0] [0.05; 0.05; 90; 0] [0.05; 0.025; 0; 0] [0.05; 0.025; 45; 0] [0.05; 0.025; 90; 0]];
nCanais = size(parametros,2);
banco = [];
%monta banco de filtros
for c=1:nCanais
G = gaborfilter2(parametros(1,c),para... |
clc;
clear;
m=2105;
m_fuel=88;
a=0.53;
b=-1.43;
d=1;
J_22=1883;
F0=2450;
arefa=m*b-m*a;
beta=m*a;
gama=((1/m)-(d/b)*((1/m)+(1/m_fuel)));
omega=(b-(J_22/b)*((1/m)+(1/m_fuel))-a);
num_1=((a*F0)/(beta*omega-a*arefa));
num_2=-((F0*omega)/(omega*beta-arefa*arefa));
num_3=(a-beta*gama)/(beta*omega-a*arefa)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.