text stringlengths 8 6.12M |
|---|
%%%%% ADVISOR data file: MC_PM8
%
% Data source:
% Unique Mobility specification sheet dated 10/1/94
%
% Data confirmation:
%
% Caveats:
% Efficiency/loss data appropriate to a 100-V system.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FILE ID INFO
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
mc_version=2003;
mc_description='U... |
function ErrorRate = ApplyRDTWMeasureAcrossData(Train, Test, PathHalfConstraintPercent, RegionHalfWidthPercent)
TrainClassLabels = Train(:,1);
Train(:,1) = [];
TestClassLabels = Test(:,1);
Test(:,1) = [];
NumCorrect = 0;
for i = 1 : length(TestClassLabels)
TestTimeSeries = Test(i,:);
TestClass= TestClassLabels... |
% set keys-parameter for JCMsuite
keys = struct;
% unit of length: nm
keys.uol = 1.0e-9;
% vacuum wavelength of QD [uol]
keys.lambda_0 = 930.0;
%%%%%%%%%%%%%
% MATERIALS %
%%%%%%%%%%%%%
n_air = 1.0;
n_GaAs = 3.5579;
n_AlGaAs = 3.0355; %Al_90 Ga_10 As
n_Au = 0.225 + i*6.249;
%%%%%%%%%%%%
% GEOMETRY %
%%%%%%%%%%%%
% ... |
function newState = createHadamardGateArray_t(n)
qc = qregister(n);
hgate = standardGates.H;
gateArray = singleGateUtil.generateGateArray(hgate,hgate,hgate);
qc = singleQubitGateArray(qc,gateArray);
newState = qc.getState();
end
|
function res = dexpinvSE3N(sigma, input)
N = floor(length(sigma)/6);
res = zeros(6*N,1);
for i = 1:N
res(6*i-5:6*i)= dexpinvSE3(sigma(6*i-5:6*i),input(6*i-5:6*i));
end
end |
clear
clc
x1=0:0.1:+3;
for i=1:length(x1)
y1(i)=2.*(x1(i).-1).*(x1(i).-2).+0.5.*sign(unifrnd(-x1(i),x1(i)))*rand;
end
x=0:0.01:+3;
y=2.*(x.-1).*(x.-2);;
plot(x1,y1,'k*','markersize',10,x,y,'-k','linewidth',2)
%legend ('dados com ruido','tendencia g(x)','location','north')
%grid on |
function PROTEINS_STRUC = backbone_int()
% $Rev: 1120 $
% $Author: mrakitin $
% $Date: 2015-08-20 21:51:42 +0400 (Thu, 20 Aug 2015) $
% This function gets information about protein backbone from input.make file.
global ORG_STRUC
PROTEINS_STRUC = struct(...
'residue_rows' , '', ...
... |
function bw = thresh3D(image)
bw = zeros(size(image));
% find indices that are a priori foreground
indices = image + gradmag(image) < 0.5;
bw(indices) = image(indices);
end |
% agent_runner
basedir = 'data';
animal = 'bb6';
dates1 = {'190629','190630','190701','190702','190703','190704'};
dates2 = {'190630','190701','190702','190703','190704','190705'};
agentFolder = 'softmax_Test';
agentOpts = struct('actionSelectionMethod','softmax',...
'updateMethod','q-learning',...
... |
function mat = map_transl(binary_mat,r)
mat = zeros(binary_mat)
end |
function genCoreTensor(hObject,eventdata,handles)
global Y NumOfComp NumOfMode tdalabStatus;
global ScreenWidth ScreenHeight XSpread YSpread lFontSize defaultFontName backGroundColor;
% hObject=findobj('tag','pmG');
Gmode=get(hObject,'value');
if isempty(tdalabStatus.inputType)
errordlg('No tensor/ktensor/ttensor f... |
function [ output_args ] = mtspPCAcompare(res,dpn)
%mtspPCAcompare - two plots for PCA...
dpn
% Extract annotated regions for this file
[grp,histID,~] = desiAnnotationExtract(dpn,false);
mask = grp > 0;
% Normalise the data somehow
doLog = true;
[sp1,flag1] = prepare([],dpn.mtspOLD,doLog);
[sp2,flag2] = prepare([],... |
classdef (Abstract) GSM_Complex_Cent < GSM
%GSM_Complex_Cent Summary of this class goes here
% Detailed explanation goes here
properties
sim_pca = PCA_Cent();
pca = PCA_Cent();
end
methods
function obj = GSM_Complex_Cent(ann)
obj@GSM(ann);
end
end
end
|
function [output] = my_canny(input_image)
%MY_CANNY Canny边缘检测算法
% 此处显示详细说明
imgsrc = im2uint8(input_image);
sigma = 3;
N = 3;
N_row = 2*N+1;
gausFilter = fspecial('gaussian', [N_row,N_row], sigma);
img= imfilter(imgsrc, gausFilter, 'replicate');
[m,n] = size(img);
img = double(img);
M = zeros(m, n);
alph... |
function [ input ] = InputTerrainTest(filename, Testnum, TerrainWid, TerrainLen, ShowImg)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
A = imread(filename);
B = im2double(A); % change data type
[c1, c2, c3] = size(B);
% reshape the terrain height map into a 100 by 100 matrix
idx_ro... |
function desired_heading=f_traj(V_in2)
global par
x = V_in2(1);
y = V_in2(2);
phi = V_in2(3);
par.psi = V_in2(4);
u = V_in2(5);
v = V_in2(6);
p = V_in2(7);
r = V_in2(8);
lastLocation = [x;y];
% desired_heading = 0;
[l, c] = size(par.waypoints);
if(c ~= 0)
if (par.distanciaAlvo < 10)
if ... |
function ITAE = FormationEval(numRobots, safe_dist, detectorRange, weights, sampleTime, evalTime)
env = MultiRobotEnv(numRobots);
env.robotRadius = 0.15;
env.showTrajectory = true;
env.showRobotIds = false;
env.plotSensorLines = false;
%% Create robot detectors for all robots
detectors = cell(1,numRobots);
%% Create r... |
clc; clear all; close all;
disp('Bisection FP...');
tic;
Out = BFPSolver(-5,5);
disp(['Root = ' num2str(Out)])
a=toc;
disp(['Elapsed time ' num2str(a)])
%%
disp('Bisection FP MEX...');
tic;
Out = BFPSolver_mex(-5,5);
disp(['Root = ' num2str(Out)])
b=toc;
disp(['Elapsed time ' num2str(b)])
disp(['MEX is... |
function [dt dID] = plot_dt(DATA)
dt = diff(DATA(:,1));
dID = diff(DATA(:,2));
T = length(dt);
Z = size(DATA,1);
figure
hold on
for t=1:T
if dID(t)~=0
stem(t,dt(t),'b');
else
stem(t,dt(t),'r');
end
end
hold off
end |
% $Header: svn://.../trunk/AMIGO2R2016/Postprocessor/Post_Plot/AMIGO_post_plot_SO.m 770 2013-08-06 09:41:45Z attila $
function AMIGO_post_plot_SO(inputs,results,privstruct)
% AMIGO_post_plot_SO: plotting results for SObs
%
%******************************************************************************
% AMIGO2: dynam... |
function a = a_try(x,y)
if nargin > 1
a = x+y;
else
a = x;
end
end |
%% Compute data-only R-squareds for every clock cycle and summarise:
% Load data in the following form:
% reducedtraces: Matrix of N trace measurements, 1 per clock cycle.
% input: 3x1 cell array, each containing an Nx2 matrix representing the
% first and second input to the first, second and third instruction in
%... |
%------------ FreeSurfer FAST ------------------------%
fsfasthome = getenv('FSFAST_HOME');
fsfasttoolbox = sprintf('%s/toolbox',fsfasthome);
path(path,fsfasttoolbox);
clear fsfasthome fsfasttoolbox;
%-----------------------------------------------------%
|
function evarun(runtype, i0, i1)
% evarun starts the simulation and will plot the results in the folder
% 'plots' (this has to be created beforehand)
% runtype: String ['evaluation-fixed/short/medium/verylong']
% i0: row number of first patient
% i1: row number of second patient
%[data, data_pao2] = EVA2DAT... |
function hz = bark2hz(bark)
% function hz = bark2hz(bark)
%
% BARK2HZ changes frequency value from the nonlinear 'bark' - scale to the
% linear frequency scale in 'Hz'.
% The formular is taken from: Sottek R. (1993); Modelle zur Signal-
% verarbeitung im menschlichen Gehör; Disse... |
classdef GetIQ_VNA < GetIQ
%
% Copyright 2015 Yulin Wu, Institute of Physics, Chinese Academy of Sciences
% mail4ywu@gmail.com/mail4ywu@icloud.com
properties
n = 1
freq
end
methods
function obj = GetIQ_VNA(InstrumentObject)
if ~isa(InstrumentObject,'SParamMeter')... |
function [mainlobe,mainlobe_ang_freq] = mainlobe_detector(Xn,w)
% [mainlobe,mainlobe_ang_freq] = mainlobe_detector(Xn,w)
% Inputs:
% Xn = function wanting to find mainlobe
% w = freq/angular_freq array
% Outputs:
% mainlobe = detected mainlobe
% mainlobe_ang_freq = mainlobes angular frequency
% Info:
% By... |
function [xi,yi] = ComputerPutBuckle(DifficultLevel,Nodes,xyHuman,xyCompt,ValidMatrix,TrialControlNum)
switch DifficultLevel
case 0
xy= floor(rand(1,2)*Nodes+1);
xi = xy(1);
yi = xy(2);
return;
case 1
if isempty(xyCompt)&&isempty(xyHuman)
xy= floor(rand(1,2)*N... |
function [correct, ratio] = countCorrect(hypotheses, y_test)
[maxs, maxi] = max(hypotheses');
correct = sum(maxi' == y_test);
ratio = correct / rows(y_test);
end % countCorrect
|
function [classifier] = Classifier(train,name)
% Classifier will generate a classifier
% train: is the dataset
% name: is the name of the dataset
switch name
case 'J48'
classifier = weka.classifiers.trees.J48();
% option = '-U -B -M 2 -A';
% classifier.setOption... |
% Gilles Charvin - 01/2014
% Extract parameters from microfludics RLS data in order to compare with
% Ryan's simulation
% Principles : first load a project position
%TO DO :
%0) Mean cell size as a function of time DONE
%1) average density as a function of time DONE
%2) cell mean squared displacement as a function o... |
function C=C_fun_num(Left_p,Right_U_q,Right_D_q)
% This function is different from the function C_fun, which is for symbol
% computation;
t=(Right_D_q-Right_U_q)/2;
C=0;
parfor s=0:t
C=C+E_fun(t,Right_U_q,s)*(Right_U_q+2*t+1)/(Left_p+Right_U_q+s+1);
end
end |
function kernelparams = lowpasskernels()
kernelparams.lowpasskernel1 = fspecial('gaussian',[5,5],2); % LOW PASS FILTER 1
kernelparams.lowpasskernel2 = fspecial('gaussian',[10,10],9); % LOW PASS FILTER 2
end |
%GH_EXP implements a membership and barrier function oracle for the
% exponential cone
% K_{exp} := cl { x \in R_+^2 x R | x1 > x2*exp(x3/x2) }
%
% It requires no parameters and it is always three-dimensional.
% --------------------------------------------------------------------------
%
% Copyright (C) 2018-2020 Da... |
function [kSpace,para] = prepare_kSpace(kSpace_all,theta_all,para)
% [kSpace,phase_mod,para] = prepare_kSpace(kSpace_all,theta_all,para)
t1 = tic;
[sx,nor,nof,no_comp,ns] = size(kSpace_all);
ifNUFFT = para.ifNUFFT;
kCenter = para.kSpace_center;
interp_method = para.interp_method;
para.R... |
function rel = he3ppd_rel(Omega, Fork)
% PPD relaxation as a function of Omega and Fork1 width
% see /rota/Analysis/PS/osc2011/Relax/relax_temp
rel = (0.0244244 + 0.114521 * Omega) + (0.000859956 + 0.000683031 * Omega) * Fork;
end |
%%-----------------------------------------------------------------------%%
% This script performs a comparison of the performance figures obtained in
% the Monte-Carlo optimization of the GPR of the DELs in the up-wind and
% wake-affected wind turbines at different components of the wind turbine.
%
% Created by: David... |
%----------------------------------------------------------------------
% simple test for model order reduction in 2D
% Pavel Kůs
% 2014
%----------------------------------------------------------------------
function test_assemble
n_blocks = 4;
n_per_block = 60;
coef_mat = ones... |
clc
clear all
%% part a)
mu = [0 0 0;0 0 5;0 5 0;1 5 5];
sigma=repmat(1*eye(3),[1,1,4])
r = zeros(125,3,4); %initializing matrix for data gereration
for i = 1:4
r(:,:,i) = mvnrnd(mu(i,:),sigma(:,:,i),125);
end
%% part b)
figure()
hold all
scatter3(r(:,1,1),r(:,2,1),r(:,3,1),'r') %plotting data
scat... |
d = [4 5 10 15 20];
numNodes = 988;
numEdges = 2454;
losses_all = zeros(4,11,5);
stresses_all = zeros(4,11,5);
for i = 1:size(d,2)
prefix = ['GRG' num2str(d(i)) 'd-' num2str(numNodes) 'v-' ];
prefix = [prefix num2str(numEdges) 'e-'];
[embeds, losses, stresses] = evalGRGset(prefix,'yeastHC.mat');
losses... |
function [ Mat ] = Matriz_DH(theta, d, a, alfa)
%Matriz_DH
% Recibe como parámetros theta d a y alfa de la tabla de DH para crear
% una de las matrices. Esta función debe llamarse una por cada matriz
sym_theta=isa(theta, 'sym');
sym_alfa=isa(alfa, 'sym');
if ~sym_theta
cosenotheta=cosd(th... |
function LTEconfig_add=lteparset2
LTEconfig_add.SubFrame.Number=50;%%系统仿真子帧数
LTEconfig_add.System.Bandwidth=5e6;%%系统总带宽(Hz)
LTEconfig_add.bandwidth=180e3;%%系统物理资源块的带宽(Hz)
LTEconfig_add.PRB.deta_bandwidth=15e3;%%系统物理资源块的间隔带宽(Hz)
LTEconfig_add.PRB.Number=25;%%%系统物理资源块数
LTEconfig_add.Subcarrier.bandwidth=15e3;%系统子载波... |
function I = draw(I,X,Y,W,H)
%% Draws image and rectanges that contain the tracked objects
%
% Leroy
% ------ INPUT ------
% I : frame of image
% X,Y : column vectors containing coordinates of rectangles' top left
% corner
% Width,Height : column vectors with widths and heights of rectangles
%
%
% for i = 1 : length(X... |
function [EBC,BC,mark] = tebc(M,mask,type)
%% Calculate the node and edges betweenness centrality for targeted inter-node communications.
%---------------------------------------------------------------------------------------------------------------------------------------------------%
% - Z.K.X. 2021/07/03
%----... |
function pop=m_InitPop(numpop,irange_l,irange_r)
%% 初始化种群
% 输入:numpop--种群大小;
% [irange_l,irange_r]--初始种群所在的区间
pop=zeros(1,numpop);
for i=1:numpop
pop(i)=irange_l+(irange_r-irange_l)*rand;
end
end
|
function S_enhance(inPic,outPic);
in=imread(inPic);
hsv_in=rgb2hsv(double(in)./255);
hsv_in(:,:,2)=hsv_in(:,:,2).*1.5;
hsv_in(:,:,3)=hsv_in(:,:,3).*1.1;
rgb_in=hsv2rgb(hsv_in);
out=uint8(rgb_in.*255);
imwrite(out,outPic);
|
% DISTORTION MAPPING FOR FORRESTAL CAMERAS
%
% In this program we take a single input image and, using the intrinsic
% camera properties from one set of checkerboard callibration, compute the
% transformation between distorted and real pixel locations
%
% INPUTS: image (used for size and mapping check) and intrinsic ca... |
function MUA_RFseparation
% SOM Halo population
animalids = {'150825', '150831', '150902', '150909', '150915', '151022', '151023', '151027', '151109', '151110'};
blocks_c = [3, 3, 1, 1, 8, 2, 4, 6, 6, 5];
blocks_s = [4, 2, 2, ... |
% kb_macCreateMesh.m
%
% Kelly Byrne | Silver Lab | UC Berkeley | 2015-09-28
% modified from code written by the VISTA lab and available at: http://web.stanford.edu/group/vista/cgi-bin/wiki/index.php/Mesh#Creating_a_mesh
%
% builds and saves a smoothed and inflated mesh for each hemispheres
%
% required input: ... |
% Test read Namelist
clear all
indata=read_namelist('fibers.in','input'); |
clear all;
clc;
%% Variables
A = randi(8,8)
B = randi(8,8)
%% Operations
Sum = A + B
Diff = A - B
Mul = A * B
|
%clear all %Centrl spike trains+ Findburst data+ Trajectory
cd 'C:\Users\rmukhe03\Documents\EMG_Dataanalysis\Good'
m1=matfile('Insect24_Test1good.mat');
m2=matfile('Insect24_Test3good.mat');
m3=matfile('Insect24_Test4good.mat');
m4=matfile('Insect24_Test5good.mat');
m5=matfile('Insect24_Test6good.mat');
m6=matfile('In... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% read noraxon data file
% Marie Moltubakk 18.5.2013
% Read noraxon data file, set first frame as time = zero, EMG+torque data treatment, resample
% Produce a new noraxon data array
% version 21.1.2015, adapted to use individually calculated norm conversion factors
% used by create_... |
%See http://www.cse.msu.edu/prip/Files/DubuissonJain.pdf
%to see notations and dKth distance
%with k in [0, 1]
function dist = hDKth(A, B, k)
[la, ca] = size(A);
[lb, cb] = size(B);
dist = 0;
distances = [];
for i=1:ca
a = [A(1, i), A(2, i)];
min = inf;
for j = 1:cb
... |
function [response]=force_response(K_glo_mat_shaft_bend,K_glo_mat_skew,G,M,K_seal_speed,C_seal_speed,M_seal_speed,N,force_array,nv,nh,hyd_force_array,bearing_node,tot_node,rho_fluid)
w=2*pi*N/60;
b0=zeros(length(M),1);
hyd_force=zeros(length(M),1);
vane_pass_force=zeros(length(M),1);
% bend_force=zeros(length(M),1);
... |
function [ipnest] = ang2pix_nest(nside, theta, phi)
%ang2pix_nest(nside, theta, phi)
%Find the pixel index of a given latitude and longitude in the nest scheme
%
%Inputs:
%nside: Pixel resolution, power of 2 less than 30
%theta, phi: Angular coordinates of a point on a sphere
%
%Outputs:
%ipnest: Pixel index
npix = ns... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Description: The s-function to detect triple blink in real time
%--------------------------------------------------------------------------------------------------------------------------------
% Used in: P300_directions.slx
%--------------------------... |
clear,figure(1),clf,colormap(jet)
% Physics
Lx = 1;
Ly = 1;
Dx = 1;%1e-1; % diffusion coefficient
Dy = 1e-1*Dx;
% Numerics
nx = 2^8; % number of cells
ny = nx;
dx = Lx/nx
dy = Ly/ny
%preprocessing
[x y] = ndgrid(dx/2:dx:Lx-dx/2, dy/2:dy:Ly-dy/2);
[x_v y_v] = ndgrid(0 :dx:Lx, dy/2:d... |
function OnMdConnect(sender,arg)
% 交易连接回报
% 行情状态到E_logined就表示登录成功
if arg.result == QuantBox.CSharp2CTP.ConnectionStatus.E_logined
global md;
% 订阅行情,支持","和";"分隔
md.Subscribe('IF1401;IF1403,IF1409;IF1312');
else
disp(arg.result);
end
end
|
string = 'some string';
sha256hasher = System.Security.Cryptography.SHA256Managed;
sha256 = uint8(sha256hasher.ComputeHash(uint8(string))); %consider the string as 8-bit characters
%display as hex:
abc = dec2hex(sha256)
sha1hasher = System.Security.Cryptography.SHA1Managed;
sha1= uint8(sha1hasher.ComputeHash(uint8(st... |
function tests = MHyProTransitionTest
tests = functiontests(localfunctions);
end
function testTransition(testCase)
tran = MHyProTransition();
copied_tran = MHyProTransition(tran);
loc1 = MHyProLocation([1 0; 2 1]);
loc2 = MHyProLocation([1 0; 0 1]);
tran_1_2 = MHyProTransition(loc1, loc2);
guard = MHyProConditi... |
function [m,N9,indexes] = GNC_archs_with_minNSNC(gncs,n)
N = length(gncs);
m = zeros(N,1);
N9 = zeros(N,1);
indexes = zeros(N,1);
i = 1;
for j = 1:N
if gncs(j).minNSNC == n
m(i) = gncs(j).m;
N9(i) = gncs(j).N9;
indexes(i) = j;
i ... |
%*******************************************************************************
% DISCLAIMER OF LIABILITY
%
% This text/file contains proprietary, confidential
% information of Xilinx, Inc., is distributed under license
% from Xilinx, Inc., and may be used, copied and/or
% disclosed only pursuant to the terms of a val... |
function out1 = hess_grf_ceq_heel413(in1,toe_th,dmax,cmax,k,us,ud)
%HESS_GRF_CEQ_HEEL413
% OUT1 = HESS_GRF_CEQ_HEEL413(IN1,TOE_TH,DMAX,CMAX,K,US,UD)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 23-Jun-2020 09:44:42
out1 = 0.0;
|
%% Spike and slab no interaction
clear
rng('shuffle')
% cd('/Users/Marina/Desktop/typhoid-burden/02-spikeslab')
data = readtable('../00-data/data_long.txt', 'Delimiter', '\t', 'TreatAsEmpty', 'NA');
run ../subroutines/prep_data_long.m
% Designate a random effects group.
data.region = data.location; % data.sel;
... |
% ----------------------------------------
% Demo the input speaker audio samples
% ----------------------------------------
close all
clear all
clc
Fs = 44100;
bits = 16;
numChan = 1;
audioInfo = audiodevinfo; % your machines info
inputID = audioInfo.input.ID; % ID of your input
recorder = audiorecorder(Fs, bits... |
function d=makedeci(a)
[row col] = size(a);
d=0;
p=0;
for x=col:-1:1
d = d + a(x)*2^(p);
p = p + 1;
end |
c=Circuit();
c.AddVSource(12,1,8,'V3');
c.AddResistor(100,2,1,'R20');
c.AddResistor(300,4,2,'R4');
c.AddResistor(100,5,4,'R5');
c.AddResistor(200,3,2,'R6');
c.AddCSource(3,5,3,'C2');
c.AddResistor(400,6,5,'R7');
c.AddResistor(350,7,6,'R8');
c.AddCSource(2,7,6,'C5');
c.AddResistor(150,8,7,'R9');
c.AddResistor(200,4,2,'R... |
function [A,dA] = mnllsqr(F,J,X,Y,A,DY)
% f is function handle to eval (x,a)
% j is funtion handle to eval jacobian (x,a)
% x is independent data in nxm matrix where these are teh values for
% x1,x2,x3 etc
% y is dependent data (nx1)
% a are initial guesses, for a1,a2,a3,a4 respecively.
% Initialize Jacobian, damping... |
function surfacedata = heartsurface_J
surfacedata = struct('phi',@phi,'gradient', @gradient, 'unitoutnormal',...
@unitoutnormal, 'project', @project, 'Hessian', @Hessian, ...
'tanproperator', @tanproperator, 'initmesh',@initmesh, 'meancurvature', @meancurvature);
%{
function [node,elem] = initmesh
M = load('h... |
%% AQUIRC
mats_dir = '/scratch_net/biwidl13/valeryv/data/corpsus/mats_aquirc/';
atlases = 1:70;
imgs = 1:70;
flds = 0:4;
im_ns = zeros( numel(atlases), numel(imgs), 5 );
im_st = zeros( numel(atlases), numel(imgs), 5 );
im_ns_bn = zeros(numel(atlases), numel(imgs));
im_ns_pr = zeros(numel(atlases), numel(imgs));
im_ns... |
% compress all the variables needed for plotting into savevar
saveVar.run_mode = run_mode;
saveVar.indToUse_window = indToUse_window;
saveVar.feature_full = feature_full;
saveVar.ccost_full = ccost_full;
saveVar.output_inverse = output_inverse;
saveVar.t_recon_plot_array = t_recon_plot_array;
saveVar.elapsedTime = ela... |
function [P, L, U] = zplu(A)
% pivoted LU decompositon P*A = L*U
[m, n] = size(A);
if m ~= n
error('zplu:test', 'current time only support square matrix');
end
P = eye(n);
L = zeros(n, n);
for k = 1:n-1
%find the largest element in k column of A from row k to n
[max_value, max_index] = max(A(k:end, k))... |
%%This function uses a 6dof fixed timestep RK4 integrator to
%propagate the state forward. The only thing the user must do is
%to include the script to add in forces and moments given to the
%body
%%The states are standard AE format x = [x y z phi theta psi u v w
%p q r];
%The form of the forces and moment function is ... |
% This type of attachment is with a kingpin which rotates the cable outlet
% according to the direction of next attachment. For details please refers
% to explaination on https://github.com/darwinlau/CASPR/issues/4
%
% Author : Darwin LAU
% Created : 2016
% Description :
classdef BaseRotatingPulleyAttachme... |
function [h,mu,sigma]= MIL_BOOST(K,M,pos_features,neg_features,mu,sigma)
% mu = zeros(size(pos_features,1),2);
% sigma = ones(size(pos_features,1),2);
gamma = 0.85;
[h_pos,h_neg,mu, sigma] = generate_weak_classifier(pos_features,neg_features,mu,sigma,gamma);
H_pos = zeros(M,size(pos_features,2));
H_neg = zeros(... |
function [k] = element(x,v)
% Syntax: [k] = element(x,v)
%
% Purpose: Test if x is an element of the vector v
%
% Input: x - integer
% v - a vector of integers
%
% Output: k - 0 if x is not an element of v
% 1 otherwise.
%
% See Also:
% Algorithm:
%
% Calls:
%
% Call By: ex_group
% (c) Copyright ... |
function runme(filename)
file_dir='./data/';
Train=load(strcat(file_dir,filename,'/',filename,'_TRAIN'));
Test=load(strcat(file_dir,filename,'/',filename,'_TEST'));
label_train=Train(:,1);
Train=Train(:,2:size(Train,2));
label_test=Test(:,1);
Test=Test(:,2:size(Test,2));
X={};
n=size(Train,1);
for i=1:n
X{i}=Train(... |
% We consider the situation when y follows multivariate normal distribution
% with zero mean and variance-covariance matrix, V, having the form of the
% weighted sum of symmetric positive-semidefinite matrices A_1,...,A_k and
% positive-semidefinite matrix W.
%%%----------------------------------------------------... |
x = [0, pi/8, pi/4, 3*pi/8, pi/2];
y = sin(x);
plot(x, y, 'r-');
|
function final_data=noise_remove(y11,fs)
global y1
% [y11,fs]=wavread('s1.wav');
y1=[];
s=length(y11);
i=0:1.2500e-04:8;
i=i(1:s);
y1=[i' y11(:,1)];
sim('noise11');
final_data=outSig;
|
function exercise1(I, size)
kernelx = zeros(size);
kerneld1 = zeros(size);
kernelx(ceil(size./2), 1:size) = 1;
kernely = rot90(kernelx);
for i=1:1:size
for j=1:1:size
if i==j
kerneld1(i, j) = 1;
end
end
end
kerneld2 = rot90(kerneld... |
%entropy of a vector of transition probability estimates
function e = entropy(p)
e = -sum(p.*log2(p));
end |
function [pdf,val] = genPDF(imSize,p,pctg,distType,radius,disp)
%[pdf,val] = genPDF(imSize,p,pctg [,distType,radius,disp])
%
% generates a pdf for a 1d or 2d random sampling pattern
% with polynomial variable density sampling
%
% Input:
% imSize - size of matrix or vector
% p - power of polynomial
% pctg ... |
%[2017]-"Weighted Superposition Attraction (WSA): A swarm
%intelligence algorithm for optimization problems – Part 1:
%Unconstrained optimization"
% (8/12/2020)
function WSA = jWeightedSuperpositionAttraction(feat,label,opts)
% Parameters
lb = 0;
ub = 1;
thres = 0.5;
tau = 0.8; % consta... |
% Este programa retorna a resposta do exercício 18 da lista 1.
disp('18)Uma engrenagem motora tem 20 dentes e a movida tem 30 dentes. Qual é a rotação da engrenagem maior, sabendo-se que a menor gira a 150 rpm?')
Zmotora=20 % números de dentes.
Zmovida=30 % números de dentes.
Nmotora=150 %rotação em rpm.
disp('... |
function rhs = SteadyConvectionRHS(mesh, u)
% right hands of equation
%
us = zeros( size(u(mesh.vmapM)) );
us(1, :) = u(mesh.vmapP(1, :));
us(2, :) = u(mesh.vmapM(2, :));
us = us.*mesh.nx;
rhs = (mesh.Shape.Mes * us) - mesh.J.*( mesh.rx .*( mesh.Shape.Dr'*(mesh.Shape.M*u) ));
end% func |
function batchMI(grandMetrics, grandIX)
for metricN1 = 1:size(grandMetrics,2)
aRow = {grandMetrics, grandIX, 1, metricN1};
allArgs{metricN1} = aRow;
end
batchSubmit(@parMeasureMI, allArgs);
|
function [x] = normalizer(x,d)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
%Normalization
mur = mean(x);
for i=1:d
y = x(:,i+1) - mur(i+1);
varx = var( x(:,i+1));
x(:,i+1) = y/sqrt(varx);
end
end
|
clear
clc
global radar1
global radar2
global R % 这个好像是每个rader的半径
% radar1 = [350 105 305 105 175 245 415 480 40 470];
% baili = size(radar1,2);
% radar2 = [200 0 -150 110 110 110 0 110 100 -50];
% R = [140 70 150 30 25 25 25 90 40 30];
% 破案了!rader1是横坐标,2是纵坐标
% 我是铁憨憨
radar1 = [100 200 300 400 150 25... |
%Copyright (c) 2020, Denielle Ricciardi
%All rights reserved.
function log_posterior = log_posterior(S,N,D,block_index,log_like,curr_theta,curr_t2,curr_R,curr_delta,curr_Delta,log_det_Gamma,inv_Gamma,a_delta,b_delta,R_not,r_not,a_t,b_t)
%Hyperparameters for theta (Gamma & Normal)
hyp1 = [.98,.... |
function [model] = EMGM_soft(X,W,init)
% Perform soft EM algorithm for fitting the Gaussian mixture model.
% X: d x N data matrix (dimensions x Number of samples)
% W: N x 1 vector of sample weights
% init: struct with fields - type: DBSCAN or RAND
% - centers, if type = DBSCAN: nGM... |
%CLEANFCCLOGVARS A helper snippet to clean the FCC log results.
%
% Yaguang Zhang, Purdue, 11/15/2021
osVersions(flagsEleToRemove) = [];
carriers(flagsEleToRemove) = [];
downSpeedsBps(flagsEleToRemove) = [];
upSpeedsBps(flagsEleToRemove) = [];
downEndLatLons(flagsEleToRemove, :) = [];
upEndLatLons(flagsEleToRemove, :)... |
%KMAT Material stiffness matrix.
% Kmat (EI,L) computes the material stiffness matrix for a beam
% bending element of length L, bending stiffness EI. The beam has 4
% degrees of freedom, given by:
% i,j=1: displacement at first node;
% i,j=2: rotation at first node;
% i,j=3: displacement at second ... |
function show_rotation(strPfile,strDir,sliceToShow,strFileOut)
% show_rotation.m - version of delay_calc_summary to show a given spiral
% direction (in or out) instead of assuming the pfile has both in/out
% components
%
% INPUTS
% strPfile - name of the pfile
% strDir - 'in' or 'out' to show spiral in or out rotations... |
close all
clear all
clc
k = 12; % llargada del senyal
t=0:0.0001:2*k/89;
n=0:(k*54)-1;
% exercici
y1=2*sin(pi*100*t)+0.8*cos(pi*178*t);
fs= max([50 89])*27 % 27 es el nombre de mostres per periode de la
% maxima frequencia (segons enunciat)
y2=2*sin(2.0*pi*50*n/fs)+0.8*co... |
function my_string = gr_per_dev_local_txt(tm)
% returns string format of gr_per_dev_local()
[grDiff, when, t_index] = gr_per_dev_local(tm);
my_string = [' Greatest percent difference is ', num2str(grDiff*100), '% at ', num2str(when), ' seconds, (array index ', num2str(t_index),')']; |
clear all;
clc;
delete(instrfind({'Port'},{'COM4'}));
s = serial('COM4', 'BaudRate', 115200);
fopen(s);
tots = 1995;
data1 = zeros(tots,1);
% track the current voltage index
voltageIdx = 0;
% communicate with Arduino
while voltageIdx < tots
% get the voltage data
voltValue = fscanf(s,'%f');... |
% ELM364 - Digital Signal Processing
% Homework 1 - Section 1
% Mete Can GAZ?
% 141024020
clc;clear;close all
syms t t0 t1;
f1(t) = cos(2*pi/5*t); %Function 1;
f2(t) = sin(2*pi/5*t); %Function 2;
T = 2*pi/(2*pi/5); %F... |
function width = getWidth(joint, slength)
syms aux;
length = norm(joint.ori(2,:) - joint.ori(1,:));
olength = norm(joint.obv(2,:) - joint.obv(1,:));
angle = acos(slength/length);
num1 = ((olength / 2) * cos(angle));
den1 = length / 2;
num2 = ((olength / 2) * sin(angle));
res = solve(num1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.