text stringlengths 8 6.12M |
|---|
addpath('../common');
n = 10;
s = 0.6;
threshold = 1.0e-9;
A = full(sprand(n,n,s));
while det(A) == 0
A = full(sprand(n,n,s));
end
B = rand(n,1);
X = A \ B;
[T2, B2, cols2] = GEPP(A, B);
X2_tmp = solve(T2,B2);
X2(cols2) = X2_tmp;
X2 = X2';
disp(all((X - X2) < threshold));
[T3, B3, cols3] = GECP(A, B);
X3_tm... |
% function to embed a graph in Euclidean space
% This is an implementation of the paper: Directed Graph Embedding
function affinity=embedwithclusteraffinity(adj,k,labels,dim)
jump = 0.95;
walklen = 30;
n = size(adj,1);
% the maximum value of dim can be n-1
if dim > n-1
error('Dimensions can not be more than or ... |
function [m,n,xmin,xmax,xold1_new,xold2_new,low_new,upp_new,a0,a,c_MMA,d,xval_new] = MMA_param_update(data_N_old,data_N,xold1,xold2,low,upp,xval,m)
% INITIALIZE MMA OPTIMIZER
% m = 1; % The number of general constraints.
n = data_N; % The number of design variables x_j.
xmin = ... |
function [results] = loadDirectory(directory, trim)
% Prepare the results
results = zeros(3, 46, 100);
index = 1;
% Make sure the directory name is valid
if ~endsWith(directory, "/")
directory = append(directory, "/");
end
% Load the data
files = dir(strcat(directory, '*.c... |
% Senjor Project: Software Defined Implementation of Digital Communication
% Student: Leul Wuletaw
% Professor: Dr. Ing.- Dereje Hailemariam
% Date: June, 2017
% ***************** FUNCTION: costas_carrier_recovery() ***************** %
% This function performs carrier recovery during signal reception.
function ... |
function update_foot_marker_figure(app, marker, xyz, pos_vel_acc, visible)
switch upper(marker)
case 'LTOE'
h_ax = findobj(app.h_foot_data_fig, 'Tag', 'axes_ltoe');
case 'LHEE'
case 'RTOE'
case 'RHEE'
end
switch lower(xyz)
case 'x'
xyz_str = '_X_';
case 'y'
xyz_str = '_Y_';
case 'z'
xyz_str = '_Z_';
en... |
z = tf('z')
Xz = 2 / (2*z-1)
Gz = 4*((z+0.7)*(z-0.5)*(z+0.1))/((z+0.5)*(z+0.3)*(z^2-0.8*z+0.32));
Yz = Xz * Gz ;
zero(Yz)
pole(Yz) |
function TSAT = h2o_tsat(P)
% H2O_TSAT Saturation temperature at a given pressure in °C
% H2O_TSAT(P) Returns the saturation temperature at a given
% pressure. Based on the correlation (K function) given in the
% ASME STEAM TABLES - SIXTH EDITION
% Pressure range from 0.6108kPa to 22120kPa
% Called function:... |
tic
clear all; close all;
%% This m script was written to read in the yearly netcdf files that Mike
%% Smith created at
%% /home/michaesm/codar/codar_means/yearly_means
%% -----------------------------------------------------------
%% Declare the time over which you want to process the data
%% now is local time of... |
% MCLCALC.M
% Script for calculation of roots
% of a Polynomial only
% Called by mclcm
% First clear any error messages****************
set(mcltxter,'String', ' ') ;
% Check for existance of needed polynomials ****
if exist('mpgb1') ~= 1 ;
set(mcltxter,'Color','red','String', ...
'Error: B1 pulse does not exis... |
function [bstrp_samples] = bootstrap_samples(N_bstrp,samples)
% inputs
% N_bstrp: # of desired bootstrap samples
% samples: matrix whose columns are original samples/observations
% ouput
% bstrp_samples: nxNxN_bstrp array where each nxN matrix is a bootstrap
% sample; Note that the bootstrapping was done using... |
% This gets two DESeq2 result fiiles and compares them within the context
% of some Genesets. It uses the logfoldchange stds, for evaluating the
% significance of the deviation in the two DEGs.
% Example:
% Pej_Explore_DEG_GeneSet(...
% '/Users/pmohammadi/Dropbox/HIV_MRJ_Edits/04_DEG_tests/02/DESeq_Results/DEG02.t... |
function win_predict(label_vector, instance_matrix, options, model_name)
libsvmwrite(model_name, label_vector, instance_matrix); |
function color_rgb = green_yellow
color_rgb = {'color', [0.67843, 1.0, 0.18431]};
end |
classdef OpticalFlow < SequentialFeature
%OpticalFlow Computes pixel difference of frames
properties (Constant)
NAME = 'optical_flow';
end
properties (Access = public)
% declared in super class SequentialFeature
% img
% imgPrev
% params;
% paramsLabel... |
clear
% declare the parameters
dplen = 160;
disp (dplen); % for convenience
L=[50,70];
tic
for j = 1:length(L)
disp('*')
disp('*')
disp('*')
disp('*')
disp('*')
disp('*')
disp('*')
disp('*')
disp('*')
disp('*')
disp('*')
disp('*')
disp('*')
disp([ 'Simulating @... |
% Version: Oct. 2004
% Author : Chen Yanover
% Overloading length function for the sparse_cell class
%
% Revised: March 2009
function k = length(sc)
k = length(sc.indMat); |
function C_eff(C11,C13,C33,C44,C55,C66)
for i = 1:size(Vp,1) - ((ls-1))
C11_e = C11(p(1)+i-1-h:p(1)+i-1+h);
C13_e = C13(p(1)+i-1-h:p(1)+i-1+h);
C33_e = C33(p(1)+i-1-h:p(1)+i-1+h);
C44_e = C44(p(1)+i-1-h:p(1)+i-1+h);
C55_e = C55(p(1)+i-1-h:p(1)+i-1+h);
C66_e = C66(p(... |
function simmatrix = gtom_line_similarity_matrix( images, anglesteps, linewidth )
simmatrix = cgtom_line_similarity_matrix(images, anglesteps, linewidth);
simmatrix = max(simmatrix, simmatrix');
end |
%% Create and shuffle a deck of cards structure
cardsDeck = struct();
Itemnums = [1 2 3 4];
Shapes = {'triangle','star','cross','circle'};
Colours = {'red','green','yellow','blue'};
ii = 1;
for aa = 1:4 %randperm(64)
for bb = 1:4
for cc = 1:4
cardsDeck(ii).itemnum = Itemnums(aa);
c... |
function [phase, modulus2] = airyphase(X)
% AIRYPHASE Phase function for the Airy function
%
% phase = AIRYPHASE(x) is the equal to arctan(Ai(x)/Bi(x)),
% where Ai and Bi are the Airy functions. The branch is
% determined by continuity and airyphase(0) = pi/6
%
% [phase, ... |
function y = logBase(x, b)
%LOGBASE General-base logarithm.
% Y = LOG(X,B) returns the base-B logarithm of X, Y=LOG(X)/LOG(B).
%
% See also: LOG.
y = log(x)/log(b);
end
|
function dvdt=delta_t_CP_PC_S(t,v_v)
dvdt=zeros(2,1);
q_p=v_v(1);% accumulated permeate
deltaS=v_v(2);%the accumulated RSF
parameter_initialization_CDCF;
fai=volume_ratio;
c_d=((1-fai)*c_d0-fai*deltaS/q_f0)/(1-fai*(1-q_p/q_f0));
c_f=(c_f0+deltaS/q_f0)/(1-q_p/q_f0);
%c_d=(1-volume_ratio).*c_d0*rejection./(1-volume_rat... |
% Script for testing of heat transfer by conduction
% with numerical and analytical methods for non-homogenous material.
%
clc;
clear all;
close all;
% space description:
% DI
% |<------------------------------>|
% + + + + + . . . + +
% 1 2 3 4 5 n-1 n
% ... |
%% NN parameters
input_layer_size = 1024; % 32*32 Input Images for CIFAR-10
hidden_layer1_size = 30;
hidden_layer2_size = 20;
hidden_layer3_size = 20;
hidden_layer4_size = 25;
nworkers = 50;
%% generate communication graph
W0 = binornd(1,.4,[50,50]); %adjacency matrix is a bernoulli random matrix with ... |
%18-bit, 16-bit fraction, 2's comp conversion
clear all
figure(1);clf;
clc
%For lowpass or highpass, set equal to normalized Freq (cutoff/(Fs/2))
%For bandpass, set equal to normalized Freq vector ([low high]/(Fs/2))
% freq = [0.03] ; LOW PASS
freq = [0.021 0.06]; % BAND PASS
%Filter order:
% use 2 lowpass
% ... |
clear all
clc
close all
%%
m1 = load('mask_1.mat');
m1_mex = load('mask_1_mex.mat');
m1 = m1.mask;
m1_mex = m1_mex.mask;
for i=1:length(m1)
data_m1 = m1{i}.data;
data_m1_mex = m1_mex{i}.data;
if data_m1 == data_m1_mex
disp("okay")
sum(data_m1(:))
sum(data_m1_mex(:))
else
... |
function s = loadSol(s,dir,name,number)
%modelo de documentacao a partir de:
%http://www.engin.umd.umich.edu/CIS/course.des/cis400/matlab/oop.html
%SIMULATOR simulator class constructor.
% s = Simulator(m) creates a simulatort object from the mesh object
%Name: loadSol
%Location: <path>/@Simulator
%Purpose: load so... |
clear; %%skrypt reprezentujacy dzialanie GPC i NPL
close all;
consts;
N_NO = 20;
Nu_NO = 2;
lambda_NO = 3;
N_GPC = 20;
Nu_GPC = 2;
lambda_GPC = 150;
N_NPL = 20;
Nu_NPL = 2;
lambda_NPL = 3;
i = 1;
shift = 200;
generator = rng(seed);
Yzad = zeros(1, n);
Yzad(1:n) = 0.15;
Yzad(201:n) = -0.8;
Yzad(401:n) = -0.05;
Yzad(... |
% Author: Grady B. Wright
function sa = ComputeTriSurfaceArea(tri,nodes)
% Local variables to make the code easier to read.
x = nodes(:,1);
y = nodes(:,2);
z = nodes(:,3);
%
% Local variables for the coordinate of each triangle.
%
xt = x(tri);
yt = y(tri);
zt = z(tri);
clear x y z;
%
% Calculate ... |
%%OM
%%
function get_from_ftp2(dTails,course_name)
temp_dir = fullfile(pwd,sprintf('\\hara'));
course_dir = fullfile(temp_dir,course_name);
if exist(course_dir, 'dir')
delete(sprintf('%s\\*.png',course_dir));
delete(sprintf('%s\\*.db',course_dir));
rmdir(course_dir, 's');
mkdir(course... |
function [] = Fiber_Analyzer_Run(Fiber_Analyzer_Results_Directory, wNIC_groups_file)
% Fiber_Analyzer_Results_Directory:
% The "FiberProfile" directory that
% results from a run of DTI Fiber Atlas Analyzer
% wNIC_groups_file: the csv groups file for each case.
% This file would have one column that contains IDs for e... |
%Determine the direction the car needs to steer.
%Assumes the driver will be turning the wheel at a rate of 2 rotations per
%second.
function turnRate = adjustSteer(deltaSteer,deltaTarget,L,steerRatio,deltaMax)
turnRate = 0;
if(deltaSteer == 0)
if(deltaTarget < 0)
turnRate = -2/... |
function buildInformation()
%CV.BUILDINFORMATION display OpenCV Toolbox build information
%
% Call CV.BUILDINFORMATION() to get a printout of diagonstic information
% pertaining to your particular build of the OpenCV Toolbox. If you ever
% run into issues with the Toolbox, it is useful to submit this
% informat... |
function [MFull, PSF, I, voxelSize] = runNeuron3D(neuron, optics, zSize)
% RUNNEURON3D
%
% Description:
% Run 3D system resolution comparison
%
% Syntax:
% [MFull, PSF, I, voxelSize] = runNeuron3D(neuron, optics)
%
% See also:
% RUNNEURON2D
%
% History
% 21Feb... |
% Part 1
close all; clear; clc;
dataD = load('dynamic4.mat');
dataS = load('static.mat');
N = size(dataD.subject.joint.angles.data,1);
N_analog = size(dataD.analog.emg.data,1);
%% stick figure
N_joints = length(dataD.subject.joint.angles.names);
N_seg = (N_joints-1)/2 + 1;
N_joint_side = (N_joints-1)/2;... |
function result = StartOptimization(initialCondition, finalCondition, purturbH, ...
convergenceThreshold, maxConvergenceCount, splineParam, ...
pathLengthStep, odeOptions)
%start optimization
isConverge = 0;
isMaxCount = 0;
itrCount = 1;
splineParamWithSf0 = [splineParam.kappa splineParam.sf]'... |
clear all
param; %¼ÓÔØ²ÎÊý
addpath('./models')
addpath('./control')
addpath('./plotting')
addpath('./math_utils')
global params;
if params.using_vr
addpath('./models');
world = vrworld('plotting/copter.wrl');
open(world);
fig = view(world, '-internal');
vrdrawnow;
get(world)
nodes(world)
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2012 Analog Devices, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http:/... |
function phi=bartlettse(y,M,L)
%
% The Bartlett method of spectra estimation.
%
% phi=bartlettse(y,M,L);
%
% y -> the data vector
% M -> the length of subsequences of y
% L -> the number of psd samples
%
% phi <- spectral estimates at L frequencies w=0, 2*pi/L, ..., 2*pi(L-1)/L
% Copyrigh... |
function e = hermite_four_1d(p)
%
% hermite_four_1d.m - Evaluate the inner product of 1d Hermite-chaos quadruples
%
% Syntax e = hermite_four_1d(p)
%
% Input: p = order of Hermite-chaos
%
% Output: e = (p+1)x(p+1)x(p+1)x(p+1) matrix containing the result
% as integers.
%
% By Dongbin Xiu 9... |
function teststr(str)
disp(str);
end |
function s = f_corrSign(x,y)
% - determine if a correlation b/n 2 vectors is positive or negative
%
% USAGE: [r,p] = f_corrSign(x,y);
%
% x,y = input vectors
% s = positive (= 1) or negative (-1) correlation
%
% SEE ALSO: f_corr
% -----Author(s):-----
% by David L. Jones, Jan-2009
%
% This file is part of the FATH... |
clear all; close all; clc;
% space
L=30; n=512;
x2=linspace(-L/2,L/2,n+1); x=x2(1:n);
k=(2*pi/L)*[0:n/2-1 -n/2:-1].';
% time
slices=40;
t=linspace(0,2*pi,slices+1); dt=t(2)-t(1);
nf=1;
slicesf=slices*nf;
tf=linspace(0,2*pi*nf,slicesf+1);
% initial conditions
N=2;
u=N*(sech(x)).';
ut=fft... |
%Yukai controller.
classdef StateEstimator_1 <matlab.System & matlab.system.mixin.Propagates & matlab.system.mixin.SampleTime %#codegen
% PROTECTED PROPERTIES ====================================================
properties
step_time;
end
properties(Constant)
Ks1 = 1500;
Ks2 = 12... |
clear
close all
Iext = [0; 700; 1]; % time on (ms); time off (ms); current (pA)
Gs = 0.1; % 0.1 nS (100 pS)
Gg = 0.1; % 0.1 nS (100 pS)
Gc = 0.01; % 0.01 nS (10 pS)
C = 100; % 100 fF (1 pF)
B = 0.125; % 0.125 mV^-1
arr = 1; % unitless rate const.
ad = 0.5; % unitless rate const.
Ec = -35; % -35 mV
Ej ... |
function processAllXMLwithExit(folder)
cd 'C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\ulabel\matlab toolbox'
%% For processing and outputing to text files for a group of XML labels in a folder
%% collection name (folder)
%change accordingly
%%folder = 'nus_engin';
%% root folders declarations
HO... |
ssh = ncread('/project/expeditions/eddies_project_data/ssh_data/data/h/dt_ref_global_merged_msla_h_qd_19930106_19930106_20100503.nc', 'Grid_0001');
lat = ncread('/project/expeditions/eddies_project_data/ssh_data/data/h/dt_ref_global_merged_msla_h_qd_19930106_19930106_20100503.nc', 'NbLatitudes');
lon = ncread('/project... |
origin = load('origin.txt');
pre = load('pre.txt');
plot(origin,'-b');
hold on;
plot(pre,'-r');
hold on;
count_1 = 0;
count_2 = 0;
count_5 = 0;
count_r = 0;
count_w = 0;
[count_x,count_y]=size(origin);
for i=1:(count_x)
error = (origin(i) - pre(i))/origin(i);
if (error > -0.01 && error < 0.01)
count_1... |
function h = g_colorline(x, y, c, cvec, cmap)
hold on
% Assign colormap indices to c2
c2 = zeros(size(c));
for i = 1:length(cvec)-1
xi = find(c>=cvec(i) & c<=cvec(i+1));
if isnumeric(xi)
c2(xi) = i;
end
end
xi = find(c2~=0);
nx = x(xi);
ny = y(xi);
nc2 = c2(xi);
dnc2 = diff(nc2);
[n... |
function [reliabilities] = computeSampleSizeReliability(eeg_data, labels, timepoint_idx, ...
num_trials_per_half, num_permutations, num_trial_permutations, rand_seed)
%---------------------------------------------------------------------------------------------
% [reliabilities] = computeSampleSizeReliability(eeg_... |
%--------------------------------------------------------------------------
% Author:
%
% Isaac J. Lee (isaacjlee@hotmail.com)
%
% Summary:
%
% This program creates a GUI (graphical user interface). It allows the
% user to visualize the definition of an induced matrix norm.
%
% Y... |
function [output1 output2] = fret_analysis(temptrace,fret_spec)
%(data,xtalk, recalculate_dlt_G, new_trace_length,dltG_method,threshold_point,...
% recalculate_signal_to_noise,noise_cutoff,intensit_threshold)
%the following section will recalculate the dltaG for each molecule by
%fitting the trace two a two sta... |
function w_DCMSort(DICOMCells, HierarchyValue1, HierarchyValue2, Prefix, IsAddDate, IsAddTime, FolderIndex, AnonyFlag, OutputDir)
% Format w_DCMSort(DICOMCells, HierarchyValue, AnonyFlag, OutputDir)
% Input:
% DICOMCells - The DICOM File from N subjects N by 1 Cells
% HierarchyValue1 - First layer ... |
% Axial velocity @ rotor outlet (midspan) initialized to the inlet value
V_2A_m = linspace(V_1A_high(1)*0.8,V_1A_high(1)*1.2,1000);
% Incidence calculation
beta_1_geo = [beta_1_geo_low(end:-1:1) beta_1_geo_high(2:end) ];
i_1m = beta_1_m_od - beta_1_m_geo;
% Mach number @ inlet
M_R1_m = W_1_m / sqrt(gamma*R_sta... |
function flow_out = mass_flow_converter(flow_in, unit_in, unit_out, fluid_name_or_molar_mass)
% mass_flow_converter Mass flow units converter
%
% Use:
% flow_out = mass_flow_converter(flow_in, unit_in, unit_out, fluid_name_or_molar_mass)
%
% The possible units (either for intput or output flow) are:
... |
% Matlab code sweeptest.m
%
% Written by William De Meo on Dec 17, 1997
% Last Modified, Dec 17, 1997
%
% Inputs:
% n number of rows
% p number of covariates
%
% The following ensures that sweep.c gets the same answers
% regardless of whether the lower triangle is filled.
%
% Generate s... |
function [phi] = createPilots(numUT,numSamples)
% Create pilot matrix
% Input: numUT - number of UTs (K)
% numSamples - number of samples
% Output: phi - pilot matrix (NxK)
% where N=number of samples and K=number of UTs.
%oneSine = sin(2*pi*(1:numSamples)/numSamples);
phi = eye(numUT,numSampl... |
%%%%%%%%%%% kirsch算子提取边缘 %%%%%%%
function kirsch(height,width,img)
A=zeros(width,height);
o1=zeros(width,height);
o2=zeros(width,height);
o3=zeros(width,height);
o4=zeros(width,height);
o5=zeros(width,height);
o6=zeros(width,height);
o7=zeros(width,height);
o8=zeros(width,height);
Max=zeros(width,height);
% 调用函数,分别对8... |
% Flux analysis now calculates the PCA components, and performs the
% flux analysis all in one go on the aggregated data that is in a matrix
% called aggregateData
%
% All data on server
%
% Data set 1
% /Danny/122311_5ulRED_2pt0uMact_phall_beads_nta_nochol_mc_1to300xlink_2/adding6pt2ulunspunskmuscmyo_5s/560/gaussSmoot... |
% Converts the parameters of a student's t distribution (degrees of freedom df
% and standard deviation sd) to the corresponding gamma distribution that
% produces it when used as a mixing distribution for a scale mixture of
% normals.
function [shape,scale] = t2gamma(sd,df)
shape = df./2;
scale = 1 ./ (df .* sd.^2... |
function phi = terminal_mgf(mod, opt, u)
% TERMINAL_MGF evaluates the mgf of the terminal of a Wiener process with drift.
%
% phi = TERMINAL_MGF(mod, opt, u) gives the mgf of the terminal value of
% a Wiener process with drift evaluated at u.
%
% The struct mod must contain the fields
% r : Risk-free i... |
function pl = main
% Problem setup
dt= 4E-5;
tspan = [0,3];
T = tspan(1):dt:tspan(end); % Physical time
S(1) = T(1); % Texture time
v0 = 1;
c0 = 340;
k=1;
% Compute object motion
[X,U,vl] = object_motion(T);
[g, SS, drag] = cal_g;
gl = zeros(1,3);
% Make sure the texture time is aligned with phy... |
function[Jd]=jacobderivadodinamica(v,q,params)
%Se definen los valores del vector velocidad y del vector de posición
%necesarios para el cálculo de la derivada del jacobiano respecto al tiempo
xx1=v(1);
yy1=v(2);
xx2=v(3);
omega=v(4);
%xxA=0;
%yyA=0;
%y2=0;
theta=q(4);
%Se define la matriz de la derivada del jacobiano... |
function [data, labels, time] = getDataLabels_Sess2(sub, EEG)
% getDataLabels_Sess2: converts the eeglab data structure EEG into a more
% workable format. Designed for CompEEG__KR.
%
% Inputs:
% EEG: the eeglab data structure to be converted
%
% Outputs:
% data: the data as a double array of size samples x channels... |
%Title: Face Batch Runner
%Author: Timothy Sheerman-Chase
%Date: 25 Jan 2001
%Description: This runs the routines to build a histogram and then attempt to detect
% facial regions. A nice GUI might replace this program one day.
%Dependencies: Most of the routines (sorry can't list all!)
%Arguments: None
fprin... |
reset_data_analysis_environment
close all
weight_transp_W=8e10
load('initial_MB_W_precession_stats_all.mat');
NB_PART_SIM_TRANSP_RATIO=1
%%
load('initial_MB_W_pre_collapse_all.mat');
%EKIN_INF=1*1e3
% PART_POP=find((alphas_Ekin>EKIN_INF).*(alphas_pos_z<0.2).*(alphas_pos_z>-0.2));
%PART_POP=find((alphas_Ekin>EK... |
% RemoveFrames.m
%
% SCRIPT for imlook4d
% Jan Axelsson
% INITIALIZE
% imlook4d_current_handles is updated whenever SCRIPTS menu in imlook4d is
% selected
disp('SCRIPTS/RemoveFrames.m entered');
% Export to workspace
imlook4d('exportToWorkspace_Callback', imlook4d_current_handle,... |
function [ xi, yi ] = findInterpsTop( ni,x,y )
pert = 0.000001;
y_temp = y;
x_temp = linspace(x,0-pert,ni*4);
xi = x_temp(2:end);
yi = y_temp;
end
|
function [tree] = plotTree(obj,tree, auxCounter)
auxCounter = auxCounter + 1;
if obj.class > 0
else
if size(obj.descendant,2) > 0
for i=1:size(obj.descendant,2)
tree = [tree, auxCounter];
% tree = [tree, plotTree(obj.descendant(i), tree, auxCounter)];
tree = plotTree(obj.descenda... |
r = 1;
h = 2;
c = 1;
syms x;
syms y;
syms z;
z_min = 1/c * (x^2 + y^2)^0.5;
y_min = (r^2 - x^2)^0.5;
x_min = 0.7 * r;
x_max = r;
I = int(int(int(1, z, z_min, h), y, y_min, r), x, x_min, x_max);
I1 = int((x^2*log((1 - x^2)^(1/2) + 1))/2 - (x^2*log((x^2 + 1)^(1/2) + 1))/2 - (3*(1 - x^2)^(1/2))/2 - (x^2 + 1)^(1/2)/2 + 2,... |
function [ output ] = decode( input )
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
[rows,cols,heights] = size(input);
r = input(:,:,1);
g = input(:,:,2);
b = input(:,:,3);
for i=1:8:rows
for j=1:8:cols
r(i:i+7,j:j+7) = idct2d(r(i:i+7,j:j+... |
%[best_H] = H_finder(image_file1,image_file2)
%
% This is function to find best homography matrix from image1 to image2
% Input parameters:
% im1: the matrix of image1.
% im2: the matrix of image2.
% Returned:
% best_H: the best homography matrix from image1 to image2
function [best_H,best_count] = H_f... |
function psth = dsp__choice_psth_contiguous( behav, n, align_on_outcome )
if ( nargin < 3 ), align_on_outcome = 'prosocial'; end;
objs = behav.enumerate( 'days' );
choice_psth = nan( 1e3, n );
stp = 1;
for i = 1:numel(objs)
current = objs{i};
trial_ids = current.trial_ids;
pro = current.where( align_on_outcome ... |
%E2
%creez un vector cu distributie gaussiana
R = randn(1,40);
%afisez elementele negative ale vectorului
R;
R(R<0); |
%sc_setup.m
%specify model components shared across solution procedures.
%%
% 1A. Specify the economic parameters
% -----------------------------------
p = 10; % price per kg
c = 7.5; % cost of harvest parameter
delta = 1/1.03; % discount factor
% Specify the pro... |
function varargout = fitTwoCircleShape(this, initval, f2c, optim_vals, st)
%% Error check
if nargin > 1 && ~ ( isempty(initval) || isa(initval,'shapes.twocircleshape') )
error('stack:fitTwoCircleShape:BadArgument',...
'Second argument, initial value, must be a shapes.twocircleshape obje... |
clear all;
warning off;
%--------------------------------------------------
dataPath = 'patterns\punktyChar\cara1_frontal1_faceCutOut.txt';
maskPath = 'patterns\punktyChar\cara1_frontal1_nose.png';
outPath = 'patterns\punktyChar\cara1_frontal1_faceCutOut_nose.txt';
[pts noseMask fpts] = loadAndStoreMarkedD... |
%Computes if a matching pair of features, p1 and p2, are consistent with
%our robot data set. For a further description of the function and the
%parameters see RunMe.m and ReadMe.txt.
%
% Henrik Aanęs
% DTU Informatics
% Technical University of Denmark
% haa@imm.dtu.dk
% Dec. 2011
%
%function [CorrectMatch,IsEst]=IsMat... |
function pointGrid = populate_grid(gridSize, bodies)
pointGrid = nan(gridSize);
for a = 1:length(bodies)
pointGrid = draw_circle(pointGrid, bodies(a));
end
end
|
function [Fx, Fy, Mz] = pacejka96(param, Fz, g, k, a)
% Pacejka 96 tyre model. Returns independently-calculated longitudinal and
% lateral forces, as well as self-aligning moment
% param: struct containing such fields as "a0", "b11", etc.
% Fz: vertical load in kN
% g: tyre IA in degrees
% k: longitudinal slip ratio in... |
function [Kp,tau_i,tau_d1,tau_d2] = get_design_parameters(p, K, coef_amort, beta, beta2)
Kp = (p^2*(2*beta+(1/coef_amort^2)))/(beta2^2*K);
tau_d1 = (beta2*(beta+2))/(p*(2*beta+(1/coef_amort^2)));
tau_i = ((beta2*coef_amort^2)*(2*beta+(1/coef_amort^2)))/(beta*p);
tau_d2 = (-p/(K*Kp));
... |
% HL_DLCUtil_WriteLabeledCSV(dest_fd, dest_cvs_fn, coor_data, png_fn, colnames_New, Line3, Line1)
% function to write data into labeled .csv file
%
% INPUT:
% OUTPUT:
%{
dest_fd = fullfile(new_labeled_data_fd, fds(i_f).name);
dest_cvs_fn = 'CollectedData_AS.csv';
coor_data = Data_New{i_f};
png_fn = file_names{i_f};
L... |
function [ bc ] = interface_get_bcSuperSet(refInfo)
stringToRun='';
stringToRun=strcat(stringToRun, refInfo.get_bcSuperSetFunction);
stringToRun=strcat(stringToRun, '(');
stringToRun=strcat(stringToRun,'refInfo');
stringToRun=strcat(stringToRun,')');
[bc]=eval(stringToRun);
end |
file = load('advent2_list');
%% Part A %%
a = file.advent2_list;
sum=0;
for i = 1:length(a(:,1))
a_max = max(a(i,:));
a_min = min(a(i,:));
diff = a_max - a_min;
sum = sum + diff;
end
sum
%% Part B %%
a = file.advent2_list;
sum=0;%\
for i = 1:length(a(:,1)) % \
for j = 1:length(a(i,:)) % \
... |
function g_ctd_data2_to_ascii(FileName,OutName)
% G_CTD_DATA2_TO_ASCII Convert 24Hz ctd data to ascii file for wLADCP
%
% g_ctd_data2_to_ascii(FILENAME) reads the .mat file with the structure
% data2 and writes out an ascii file that
% can be used wit... |
classdef OptoPorts < handle
%
properties (Access = private)
id_ % ID of the session.
end
methods
function this = OptoPorts(pType)
%DATABASE Create a new database.
this.id_ = OptoPorts_API('new', pType);
end
function delete(this)
%DELETE Destructor.
OptoPorts_API('delete', this.id_);
end
func... |
% simple function that produces the smoothing curve for a given K.
% K: the number of Fourier modes for positive frequencies
function smoothing = smoothing_curve(K)
cutoff_x = .4;
freqs = 1:K;
smoothing = exp(-.001*((2*.9/cutoff_x) * freqs/ K).^(13));
smoothing = round(smoothing, 10);
end |
function [KKexpected] = RunOneKKwik(KKfn, FILEno, nKKFeatures, minClusters, maxClusters, varargin)
%
% [status, KKexpected] = RunOneKKwik(KKfn, FILEno, nKKFeatures, minClusters, maxClusters, varargin)
%
% Parameters
% USECONDOR = false
% SubSetRate = 1 % for 1/10 use 0.1 % for 1/100 use 0.01
KKwikName = 'Klust... |
clear
%Symbolic definition
syms tau1 tau2 tau3 tau4 real
syms theta1 theta2 theta3 theta4 real
syms d_theta1 d_theta2 d_theta3 d_theta4 real
syms dd_theta1 dd_theta2 dd_theta3 dd_theta4 real
%Definition of the zero vector, unit-vector, z & and gravitational vector
h1 = [0; 0; 0];
z = [0; 0; 1];
g = [0; 0; -9... |
function measinit
% Initilize the measurement system
% Here it is quite simple.
global Ts t
t=-Ts;
|
function result3=rhs3(y)
result3=y;
end |
function ManipBump(X)
idDevServMainPS1='ans-c05/ei/l-hu640_PS1';
idDevServCHE='ans-c05/ei/l-hu640_Corr2';
idDevServCHS='ans-c05/ei/l-hu640_corr1';
idDevServCVE='ans-c05/ei/l-hu640_corr4';
idDevServCVS='ans-c05/ei/l-hu640_corr3';
devemit = 'ANS-C02/DG/PHC-EMIT';
fprintf('%s\n','BUMP[mm] Current[A] EpsZ[nm.... |
DefineBeamline
% bl.SetTrackingMethod('CParticleTracking')
f0 = MasterOscillator.GetFrequency();
MasterOscillator.SetFrequency(f0*0.9999);
[beta, tune, closedorbit] = ComputeMatchedTwiss(bl,beam);
[I1, I2, I3, I4, I5] = ComputeRadiationIntegrals(bl,beam);
% bl.SetTrackingMethod('default')
u0 = beam.species.Cgamma... |
function [pdfxCy,xv,yv] = conditionalprobability_condset3(ds,dimx,dimy,methodk,methodc,plotf)
%this function use kernel and copula to compute fx/y for y of size 3
%inputs
% ds: the dataset
% dimx: the dimension of x
% dimy: the three dimension of y
% methodk: string, kernel type (default normal)... |
% Function for calculating tortuosity of vessels based on its centerline in 2D. Initially implemented for
% retinal vessels but theoretically applicable to any 2D curvilinear shape.
% x & y represent coordinates of vessel centerline or any curvilinear shape.
% is_show equals 1 for graphical demonstration, othe... |
% %% Compare using RBF-FD interpolation
% load('data/h163842.mat') % l2 error 5e-4 compared to DWD
% xe = atme.pts.x; ye = atme.pts.y; ze = atme.pts.z;
% la = atme.pts.la; th = atme.pts.th;
% wghts = atme.pts.wghts;
% ne = length(xe);
% load('swtc6\p024.mat'); p = p024; % day one
% load('swtc6\p120.mat'); p ... |
function [ obj, grad ] = objective_fun( x )
global N D
%D - Delta
%x(1,:)=x1
%x(2,:)=x2
%x(3,:)=u
%objective function
obj=0;
for k=1:N
obj = obj + x(1,k)^2 + x(2,k)^2 + 0.005*x(3,k)^2;
end
obj=obj*D;
%gradient
if nargout > 1
grad = zeros(3,N);
for k=1:N
grad(1,k) = D*2*x(1,k);
grad(2,k) = D*... |
function res = ldg_evaluate_basis_derivative_local( lcoord, params, k, grid)
%LDG_EVALUATE_BASIS_DERIVATIVE_LOCAL: assembly of \phi:\phi where \phi is
%global basis function for velocity. \nabla \phi = JIT * \hat{\nabla \phi} where
%\hat{\phi} is local basis function for velocity
%Params needs fields: dimrange, pdeg, n... |
function [Srec51 Srec101 Srec201 Spr51 Spr101 Spr201] = Recall(ira)
kol=0;
for i=1:19000
if ira(i,2)~=111111
k=1;
recomm=0;
net=0;
user=ira(i,2);
if ira(i,1)>=4.6
pr=1;
end
if ira(i,1)<4.6
pr=1;
end
ira(i,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.