text stringlengths 8 6.12M |
|---|
function value = enlarge_rectangle_pixel(x,y,w,h,pixels)
% function [x,y,width,height] = enlarge_rectangle_pixel(x,y,w,h,pixels)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
x = x - pixels;
y = y - pixels;
width = w + 2*pixels;
height = h + 2*pixels;
value = [x y width height];
en... |
function solveTruss(filename)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%this function will solve trusses
%Based on rewrite of code written by Robert Greenlee
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Open Data File
fid = fopen(filename, 'r');
%% Read Node Data
numberNodes=fscanf(fid,'%d', 1); %Number of nodes
for i=1:numberNodes
no... |
function [ o1,o2,o3,o4,o5 ] = neuraltptn( teams,input,label,iteration,tp)
[m,n]=size(teams);
tp=tp/100;
selection=zeros(1,n-3);
i=1;
for j=1:n-3
flag=1;
for k=1:j-1
if teams(i,k)==teams(i,j)
flag=0;
break;
end
end
... |
close all;
MatrixName= 'nos3.mtx';
method ='bicgstab';
%method ='gmres';
el = 2;
% GMRES parameter
restart = 3;
tol = 1.0e-13;
maxit = 150;
DirName = 'figs';
FontSize = 14;
A = mmread(MatrixName);
[req,pot,add,F] = precol(MatrixName);
add2 = mmread('add_mat2.mtx');
add2 = spones(add2);
F2 = mmread('F2.mtx');
F2 = sp... |
function obj = compile(obj, export_path, varargin)
% export the symbolic expressions of the system dynamics matrices and
% vectors and compile as MEX files.
%
% Parameters:
% export_path: the path to export the file @type char
% varargin: variable input parameters @type varargin
% StackV... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Generalised function to create Gillespie %
% simulation file from input file %
% ... |
function torque = calc_torque(g, filename)
if(nargin<2)
filename = 'FEMM Temp\test.fem';
end
mi_saveas(filename);
mi_analyze(1);
mi_loadsolution;
%mo_selectblock(mean([g.s.p5; g.s.p6; g.s.p7; g.s.p8])'); %stator
% mo_groupselectblock(2);
% torque = (2*g.r.ppairs/n_p)*mo_blockintegral(22)
% mo_clearblock;
mo_groups... |
function [kernel] = kernel_load(X,y, opt)
% kernel_load(opt)
% Loads the kernel matrix from disk.
% INPUTS:
% -OPT: struct with the following options:
% - trainkernel : name of the file where the kernel matrix is saved.
%
% OUTPUT: struct with the following fields:
% -type: 'load'
% -K: kernel matrix
kerne... |
function setPlayerStatus(handles, todoText)
if strcmp(todoText, 'toStart')
todoCode = 1;
elseif strcmp(todoText, 'toContinue') || strcmp(todoText, 'Paused')
todoCode = 2;
set(handles.play, 'CData', ...
handles.paramsButton.img_play_sel);
elseif strcmp(todoText, 'toPause')... |
% -------------------- Program to Produce Echo effect ------------------ %
% Echo means => delayed version of original signal
% if one signal come directly to your ear and another which same signal but
% with some delay is come to your ear then you will feel that's echo
% Consider system with input signal x(n) pass... |
clear all; close all; clc;
pkg('load', 'image');
% create option parser
addpath('optionParser');
p = optionParser('', 'Desc', 'A simple content-based image retrieval system');
p = addOption(p, 'bins', '-k', 'Default', 40, ...
'Desc', 'The number of orientation histogram bins (for PHOG)');
p = addOption(... |
function [constraintData, flag] = ...
optimiseConstraint(start, fin, DelKE, sigma, deg, grid_num, reg)
% optimiseConstraint Produces the optimal constraint given the target
% change in post-impact kinetic energy from the previous post-impact KE
% subject to the start and end conditions.
%
% Optimality is considered... |
function [results, results_all] = analyze_collins14(data)
% Construct reward-complexity curve for Collins et al. (2014) data.
if nargin < 1
data = load_data;
end
beta = linspace(0.1,15,50);
% run Blahut-Arimoto
for s = 1:length(data)
B = unique(data(s).learnin... |
function [Phi_Grad,fii_new,n_tensor] = node_selection_quad_q1_SDA2...
(coord_n,npe, n_tensor,Phi_Grad,dN_MACRO,...
ind_state_MACRO_new,fii_old, EF_sidesCutCPF)
%******************************************************************
%* PARA ELEMENTOS CUADRILATEROS *
%* Se... |
function h = evalFunc(grid, initial_grid)
% grid: a 9x9 matrix representing a complete grid
% initial_grid: a grid where all non zero elements are the initially fixed
% digits
% returns the number f+g
% f is the number of digits appearing twice in the lines of the grid
% if a digit appears three times in a same line,... |
function [avp, xkpk, zkrk, sk, ins, kf] = sinsgps(imu, gps, ins, davp, imuerr, lever, dT, rk, Pmin, Rmin, fbstr)
% 19-state SINS/GPS integrated navigation Kalman filter.
% The 19-state includes:
% phi(3), dvn(3), dpos(3), eb(3), db(3), lever(3), dT(1)
%
% Example 1:
% [avp1, xkpk, zkrk, sk, ins1, kf1] = sinsgps(i... |
### Skript zum Testen der zusammengesetzten Quadratur ###
### Funktion ###
f = @(x) 1 ./ (1 .+ 25 * x.**2);
### Intervall ###
x = -1:0.01:1;
a = min(x);
b = max(x);
# Anzahlt der Teilintervalle
N = 2;
h = (b - a) / N;
### Trapez-Regel ###
# Stützstellen
p_trapez = 0:1:1;
# Gewichte
w_trapez = h * [1 / 2, 1... |
function learnedModel = learnOriHist_table(allfiltered,nF,h,backgroundIm,ax,ay)
% nF: number of features to select
% we do not use dataWeight for now (to modify!!)
% CONSTANTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nimage = size(allfiltered,1);
norient = size(allfiltered,2);
Upperbound = 6;
sx... |
%PseDNC.mat is the pseDNC feature with optimized parameters
%Triplet.mat is the triplet feature of benchmark dataset calculated from http://bioinformatics.hitsz.edu.cn/Pse-in-One2.0/
%num5mer,num6mer,num8mer are the seleted feature number of 5mer,6mer and 8mer after IFS.py.
%take 3 kinds of feature combinations(tp5,tp... |
%% Program to find Date of the Year
clear; clc;
Day=(input("Enter Day, e.g. 15 :"));%%to take the value from the user
if (Day>=1 && Day <=365)
if Day>0 && Day<=31
"January "+(Day-0);
elseif Day>31 && Day<=59
"February "+(Day-31) ; %#ok<*VUNUS> %% Subrtracting 31 Days, as there are 31 Days in the previous ... |
%
% Video Super Resolution
clearvars;
%% Data properties
datasetName = 'city';
startFrame = 1;
numFrames = 3;
cslice = ceil(numFrames/2);
factor = 4; % magnification factor
%% Load Video and code
dataFolder = 'data/video_scenes/';
[imageSequenceSmall,imageSequenceLarge] = LoadImSequence([... |
function [ S,W ] = PSRec( R, F, alpha, beta, k, miter )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
n = size(R,2);
%[m, n] = size(R);
%d = size(F,2);
RR = R'*R;
H = RR + beta*eye(n);
FW = F;
X = alpha * square_diff(F);
P = X - RR;
S = update_S(H, P);
L = laplace_mat(S);
fprintf('it... |
function [G,GU] = fgrad(m,cost,u1,u2,la,rho,tau)
%FGRAD Wasserstein-BLASSO gradient for FFW (1D)
% Detailed explanation goes here
debug = 0;
% scaling
f0 = 4*la / (norm(u1,'fro')^2 + norm(u2,'fro')^2);
% helpers
N = 1./Dnumel2(m);
I1 = zeros(2*m-1); I1(:,1) = 1;
I2 = zeros(2*m-1); I2(1,:) = 1;
I = I1 + I2;
%
Y = ... |
function [fh, ph, ebh] = plotEachPointMean( dMat, varargin )
%plotEachPoint Summary of this function goes here
% dMat, columns are groups; rows are samples
% TO prepare data into dMat, use combineGroups, if a cell instead..
yLab='arbitrary units of something';
groupLabels={};
interbarFraction=.2; % 20% of w... |
function [signals, time_info] = get_signals(varargin)
% GET_SIGNALS -- Obtain a Structure of objects whose data are Trials x
% Samples matrices, according to the options defined in
% dsp2.config.create.
%
% IN:
% - `varargin` ('name', value)
% OUT:
% - `signals` (Structure) -- Structure ... |
clc
clear all
addpath('../ROUTINES/')
addpath('../ROUTINES/FEM/')
setid = 5;
fil = {'1_AROUNDSET', '2_ABOVESET', '3_SINGELEMABOVESET', '4_INTSET', '5_INTSETNPS'};
Ngens = [26, 26, 26, 26, 19];
fname = sprintf('../MATRIX_EXTRACTION/RUNS/%s/BRB_WOPRES_MAT.mat', fil{setid});
load(fname, 'M', 'K', 'R', 'Fv');
K = 0.5*(K+K... |
o=instrfindall;
delete(o);
%---------------------------------------------------
%----------Serial port Initialization---------------
serialPort = 'COM2';
s = serial(serialPort);
initserial(s)
serwrite(s,2,6)
s_close(s)
|
function vecs = rotateToPoses(vec,poses)
vecs = vec;
for i=1:size(poses,1)
vecs(i,:) = rotateToPose(vec,poses(i,:));
end
end |
% Makes the directed graph of Pokémon type relationships.
edges = readtable('type_chart.txt', 'ReadVariableNames', true);
type_matchups = digraph(edges.AttackType, edges.DefendType, edges.Multiplier);
% Type colors
type_colors = {[168, 168, 120] % Normal
[240, 128, 48], % Fire
[104, 144, 240],... |
% Input : m x m nonsingular matrix block Di.
% Output : Matrix block Di overwritten by its inverse
p = zeros(1, m);
for k = 1 : m
% implicit spivoting
abs_elems = abs(Di(:, k));
abs_elems(p > 0) = -1; % exclude already pivoted rows
[abs_ipiv, ipiv] = max(abs_elems);
p(ipiv) = k;
... |
function derivatives = FuncCnCDepressurization(~, state_vars, params, isotherm_params)
%#codegen
%CnC_Depressurization: Calculate the change in state variables for CnC depres step
% When coupled with MATLAB ode solvers, (ode15s), solve the system of PDEs
% for the PSA step. The system of PDEs is solved by using... |
function [ nearestBaseStation ] = MinDisCalcTtoS(dupCoordinatesTxRxPlain_BS,coordinatesTransmiterInDupMat)
nearestBS=1;
for i=1:length(coordinatesTransmiterInDupMat)
minDis=(sqrt(norm(coordinatesTransmiterInDupMat(i)-dupCoordinatesTxRxPlain_BS(1))));
for j=1:length(dupCoordinatesTxRxPlain_BS) ... |
function flag = isValid(obj, varargin)
% ISVALID Method to check if a given object is properly initialized
% This method tests if the object has been created correctly.
% True is returned if valid otherwise false.
%
% az = azure.storage.CloudStorageAccount;
% az.loadConfigurationSettings();
% az.connect();
%
% ... |
n=0;
x0=0;
p0=[];
p1=[];
t= [];
a0=1;
b0=-2;
a1=-0.5;
b1=1.95;
new_round = @(x, n=0) round (x * 10^n) * 10^(-n)
while n<=500
p0(length(p0)+1)= x0;
x1= ((a1 - a0) + (b1 .* x0))/b0;
p1(length(p1)+1)= x1;
t(length(t)+1)=n;
if new_round(x0, 2)== new_round(x1, 2)
break
end
x0=x1;
n= n... |
function [ theta ] = BTangle_extremum( branch_data, Vrange, Vfixed )
%returns lower and upper bounds on theta_ij for a given edge of ViVj box
%compute value of V for which slope is zero at the given edge
if (Vfixed.type)
V=sqrt((branch_data(1)*Vfixed.val^2-branch_data(5))/branch_data(2));
else
V=sq... |
%Global robustness
count=0;
x=ones(834,1);
stdtrials=0:1:50;
matrix_trials2=zeros(length(stdtrials), 500);
matrix_trialsAAA=zeros(length(stdtrials), 500);
for k=1:length(stdtrials)
for j=1:500
load('iCdiff834.mat')
for i=1:length(fbamodel.rxns)
R1=normrnd(0,stdtrials(k));
R2=normrnd(... |
function [f] = cp_func(Z,A,Znormsqr,weight)
%TT_CP_FG Computes function of the CP function.
% Parts are taken from the MATLAB CMTF Toolbox, 2013.
% References:
% - (CMTF) E. Acar, T. G. Kolda, and D. M. Dunlavy, All-at-once Optimization for Coupled
% Matrix and Tensor Factorizations, KDD Workshop on Mining an... |
function ~ = crossTheBridge()
% Creates a symbolic math object
syms u
% Establishes the distance between the wheels
d = 0.235; %meters
% Creates functions for parametric movement in the x and y directions
rx = 4*(0.3960*cos(2.65*(0.2*u+1.4)));
ry = 4*(-0.99*sin(0.2*u+1.4));
% Creates a vector function
r = [rx ry ... |
for i=1:size(testScores,1)
score(i)=find(testScores(i,:)==max(testScores(i,:)));
end
put=labeltoletter(score);
figure;
for i=1:size(finalone,2)
subplot(4,5,i); imshow(finalone{i});
end |
x1 = xlsread('Point.xlsx','A1:A1000');
y1 = xlsread('Point.xlsx','B1:B1000');
y2 = zeros(1,1000);
x2 = zeros(1,1000);
a = 10 / 1000;
for i = 1 : 1000
x2(i) = a * i;
end
x = 0;
for i = 1 : 1000
x = x2(i);
y2(i) = 2.5*(0.7+sin(x-2.711767314084740))*sin(x);
y2(i) = 2.0187994018*sin(x) + 1.4767... |
%%%Script for 2c and d homework set 1 Due 2/11/19
%%%by Dean Geisel
%%%for Dr. Mohamed Sulman
%%%in MTH 7260
%-------------------------------------------------------------------------
%%%The purpose of this script is to caclulate L1 and L2 Norm errors in the
%%%numerical solution for problem 2 of HW set 1. Th... |
close all; clc, clear; % clear classes;
%--- Create rays on sphere (d==0)
% ray_o = uniform_sample_sphere( 100 );
% ray_d = -ray_o;
%--- Create full random rays
ray_o = randn( 100, 3 );
ray_d = randn( 100, 3 );
den = ray_d(:,1).^2+ray_d(:,2).^2+ray_d(:,3).^2;
ray_d(:,1) = ray_d(:,1)./den;
ray_d(:,2) = ray_d(:,2)./d... |
%---------------------------------------------------------------------------%
% 子程序 “Intde.m”作用量测量契合度计算
% 入口参数:量测参数矩阵mdata,有功量测矢量Za,
% 无功量测矢量Zr,有功量测函数矢量ha,
% 无功量测函数矢量hr
% 返回参数:契合度ksi
%---------... |
% Check the roots of AR process (confirm that AR is stable)
function la = ARroots(A, b_show_plot)
[p, mp] = size(A);
B = zeros(mp, mp);
B(1:p, :) = -A;
B(p+1:mp+1:mp*(mp-p)) = 1;
la = eig(B);
if exist('b_show_plot','var') && b_show_plot
if isreal(la)
la = complex(la);
end
%compass(la);
plot(la,'*');
hol... |
function [G, SNR] = getweights(Fvv, k, d, Gmin, method)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% get dual-mic coherence-based weight
% example Usage:
% Y = getweights(Fvv,16,0.032,0.1)
%
% Inputs:
% Fvv coherence function at k frequency bin
% k ... |
function [bin,qcoef]=en_residue(sub,n,delta0)
delta=1.1*delta0; %<==================
T=0.5*delta %%%%%%%%%%%%%%%%%%%%
[qcf,ctr1]=quanTHD(sub,T,delta); ctr=0.5-ctr1 %%%%%%%%%%%%
clear sub
qcf=int16(qcf);
qcoef=single(rstTHDctr1(qcf,T,delta,ctr*delta,0.16*delta));
len=numel(qcf); cf0=int16(zeros(1,len)); sn=uint8(zero... |
%After get_MDPpseudorewards, meta_semi_gradient_SARSA
mdp = metaMDP(2,1);
val_guess = zeros(465,2);
for i=1:465
for a=1:2
f = feature_extractor(S(i,:)',a,mdp);
val_guess(i,a) = dot(w,f); % can replace w with w1 or w2
end
end
[m,pol] = max(val_guess',[],1);
mse = 1/465*sum((m'-values(1:465,1)).^... |
function nii_fslflirt (P, Ref, Shadow, OutDir, Prefix);
%Normalize P->Ref using FLIRT
% P: image[s] to normalize
% Ref: [optional] target of normalization
% Shadow: image[s] to be resliced using P->Ref transform
% OutDir: if provided, output folder
%
%Linear transform, mutual information cost function
%
%Note... |
function x=istft_multi(X,nsampl)
% ISTFT_MULTI Multichannel inverse short-time Fourier transform (ISTFT)
% using half-overlapping sine windows.
%
% x=istft_multi(X,nsampl)
%
% Inputs:
% X: nbin x nfram x nsrc matrix containing STFT coefficients for nsrc
% sources with nbin frequency bins and nfram time frames or nbin ... |
function [controls] = simplified_list_control_laws(Regions, tol)
%[controls] = list_control_laws(Regions, set_ineq, tol)
%List all the control laws in the Regions without comparing do inequations
%Inputs:
% Regions - cell array with all the regions from the explicit
% controller
%
% tol - toler... |
Als je programma is gestopt m.b.v. een breakpoint dan
kan je de variabelen in de Workspace bekijken. |
basedir='/archive/Levi.Silvers/awg/verona/'
expname='c96L32_am4g10r8_2000climo/ts_all/';
expname2='c96L32_am4g10r8_2000climo_p2K/ts_all/';
expname3='c96L32_am4g10r8_hadsstp1pctco2_climo/ts_all/';
base1=strcat(basedir,expname);
base2=strcat(basedir,expname2);
base3=strcat(basedir,expname3);
var1='atmos.000201-001112.t_... |
function posterios = func_compute_posteriors(PI,S,control_plot)
posterios = {};
for l = S:-1:1
for k = 1:2^l
if l==S
posterios{l}{k} = PI(k);
else
posterios{l}{k} = posterios{l+1}{2*k-1}+posterios{l+1}{2*k};
end
end
end
if control_plot==1
nodes... |
function [FdaSNR,BhatFdaSNR,GammahatFdaSNR,sigma2hatFdaSNR] = spmJr_cplx2 (root, X, C)
% [FdaSNR,BhatFdaSNR,GammahatFdaSNR,sigma2hatFdaSNR] = spmJr_cplx2 (file_root, Desmat, contrast_vector)
%
% Created by Daniel Rowe so includeme please!
% Large SNR approximation Mag and Phase Act of
% Rowe, D.B.: Modeling both the m... |
function [] = dataExport(tableVar)
%write table to distance_results.xlsx
writetable(tableVar,'distance_results.xlsx')
|
%% Calculate contact self-energy matrix
Sigma=zeros(nT,nT);
Sigma_1=zeros(nT,nT);
Sigma_2=zeros(nT,nT);
t0=hbar^2/2/me/dx^2;
for i=(ny-nl_1)/2+1:(ny-nl_1)/2+nl_1
for j=(ny-nl_1)/2+1:(ny-nl_1)/2+nl_1
for m=1:nl_1
ii=i-(ny-nl_1)/2;
jj=j-(ny-nl_1)/2;
ka_1=acos(-(1-(EE(i_E)... |
function [X] = mixed_radix_fft(x, N)
%Function to compute mixed radix FFT for any composite length N
%according to algorithm given in 'Self-sorting mixed radix fast Fourier
%transforms' - C Temperton, published in Journal of Computational Physics
%X - DFT of x
%x - Input vector of length(N), can be real or complex
C ... |
function [ X_white, W, mu_X ] = zcaWhitening( X, epsilon )
%ZCA Whitening
% Performs prewhitening of the dataset X. Prewhitening concentrates the main
% variance in the data in a relatively small number of dimensions, and
% removes all first-order structure from the data. In other words, after
% the prewhitening, the ... |
function result = searchBest_bf(adj_mat,sum_prob)
% brute force search the best path
len = length(adj_mat);
i = 0;
prob = zeros(2^(len),1);
% time = cell(2^(len),1);
tic;
while ( i < 2^(len) )
% tic;
index = dec2bin(i,len);
disp(['----- now calculate ',index,' -----']);
valid = 1;
prob... |
close all
clear all
clc
% ------------------------------------------------
% datos
% ancho de la placa
Lx=2;
% alto de la placa
Ly=1;
% paso x de la malla
dx=0.5;
% paso y de la malla
dy=0.25;
% duracion
Lt=1;
% delta de tiempo
dt=0.01;
% corre las animaciones para los diferentes metodos
%... |
function gncs = compute_minNSNC(gncs)
N = length(gncs);
for i = 1:N
gncs(i).minNSNC = min([gncs(i).NS gncs(i).NC]);
end
end
|
function genprobmaps(mapfile, fibdir, dendir, fundir, outdir)
% GENPROBMAPS generates concatenated image sets of both density and
% probabilistic DTI tracking results, which requires running GENMHA
% command to generate probabilistic DTI tracking results and store
% them under MNI_BNatlas/MNI_DTI/den.
%
% See Also:
% ... |
%% Evaporation model
function [m0,r0,RhoO2,RhoN2,RhoFuel]=evapModel(Jma,m0,d0,r0,rho0,RhoO2,RhoN2,RhoFuel,det,B,Rho,Dx,Re,Sc,Mu)
dA = 4*pi*((r0*0.001)^2); %[m2]
kc = (0.6*Re^0.5+Sc^0.333+2)*(Mu/(Rho*Sc))/(2*r0*0.001);
mevap = kc*Rho*log(1+B); %[kg/(s*m2)]
% Recalculating droplet properties a... |
% Sample Error: Calculates specified error measure for supplied observations
% by Will Dwinnell
%
% Last modified: Apr-17-2008
%
% Error = SampleError(Predicted,Actual,ErrorType)
%
% Error = Calculated error measure
% Predicted = Predicted values (column vector)
% Actual = Target values (column vecto... |
function [A_shading,b_shading] = get_shading(observer,rect)
% observer : 1x2 / rects : 2x4 pnts matrix
% the shading region representing the shading region
pnt1 = rect(:,1); pnt2 = rect(:,2); pnt3 = rect(:,3); pnt4 = rect(:,4);
box_center = (pnt1 + pnt2 + pnt3 + pnt4)/4;
bearing_vec2_box = [box_ce... |
function save_complex(vol,path,normal_mode)
% function save_complex(vol,path),
% saves an interleaved 32-bit float complex file
% need to repair the save_complex function to save a sallyish rp complex file
%
% have to test alternate ways to construct the savable portion
%
% make small test_array
% cast as 8bit and save... |
function [] = NewExpert(clipno,subject)
% Uses a pre-trained GMM for Experts to generate exp to simulate an
% Expert watching the video specified by clipno. This randomly samples
% from each of the components of the model to create a convincing
% sequence.
% This should not be used on Video Clips as it does n... |
function [C,D] = icpMatchingSimple(Freg,moving,fixed)
%param
% Freg [3,3]: current guess of Freg
% moving [2,N,]: moving points
% fixed [2,N_]: fixed points
%output
% C [2,N]: closest points in fixed point set to moving
% D [2,N]: distance between C and moving
for i = 1:size(moving,... |
%% Script interface to dsp2.plot.lines()
conf = dsp2.config.load();
% conf.PATHS.database = 'H:\SIGNALS\database';
% conf.DATABASES.h5_file = 'high_res_measures.h5';
date = dsp2.process.format.get_date_dir();
% date = [ date, 'high_res' ];
kinds = { 'nanmedian_2' };
sfuncs = { @nanmean };
measures = { 'coherence' }... |
function [ optconf ] = get_optconf_varlinear()
%GET_OPTCONF_VARLINEAR Summary of this function goes here
% Detailed explanation goes here
optconf = optimset('GradObj','off', 'DerivativeCheck', 'off', ...
'LargeScale', 'off' ,'Display', 'iter');
optconf.MaxIter = 100;
optconf.... |
function imgFiltered = residuefilter(img, Parameter)
% to perform continuous and low-pass filtering in the projection or image
% domain using the SG filter.
% Pengwei Wu
% Uploaded to Github at 10/04/2015
if (Parameter.method == 0)
imgFiltered = img;
imgFiltered = imgFiltered .* (imgFiltered > 0);
end
if ... |
% RSMA CoMP JT partial CSIT channel disparity
% Implemented algorithm in the programme is adopted from the paper:
% Rate-splitting multiple access for downlink communication
% systems: bridging, generalizing, and outperforming SDMA and NOMA.
% Equations can be found in the above paper using the indicated number.
... |
%%
hold on
plot(myTradingRobot.DeltaPositionBef(100:end),'-','Color','black','LineWidth',2)
plot(myTradingRobot.DeltaPositionAft(100:end),'-','Color','red','LineWidth',2)
hold off
xlabel('Time','FontSize',15)
ylabel('Delta position','FontSize',15)
set(gca,'FontSize',13)
%%
hold on
plot(myTradingRobot.StartDeltas(10... |
function [fig] = desiDrawToolbar(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 '/toolboxes/icons/']);
% Here a button for the l... |
function output = waitMidi(receive,target1,target2)
while 1
receivedMessages = midireceive(receive);
if isempty(receivedMessages) == 1
continue
end
[m, n] = size(receivedMessages);
if m ~= 1
error('Midi receive error; ... |
# # options = optimset('GradObj', 'on', 'MaxIter', 400);
# options = optimset('MaxIter', 400);
# [C, sigma, exit_flag] = ...
# fminunc(@(t)(costFunctionReg(t, X, y, lambda)), initial_theta, options);
similarity = 1;
for c = [.01 .03 .1 .3 1 3 10 30]
for s = [.01 .03 .1 .3 1 3 10 30]
model = svmTrain(X, y, c,... |
% date numerice
m = 4.81;
l = 1.73;
zeta = 5.33;
g = 9.81;
params.m = m;
params.l = l;
params.zeta = zeta;
params.g = g;
Tmax = 100; % timp simulare
t = linspace(0, Tmax, 1e3).';
f = @(t, k) k.* double(t >= 0); % intrare treapta: k * 1(t)
% incarcare model
load_system('model3');
set_param('model3', 'StopTime', nu... |
function [bs,bs1]=an_bpspl(g,t,x)
% Calcola i valori delle funzioni base B-spline (non nulle) e delle loro
% derivate prima in un punto x;
% se x e' un vettore torna due matrici; nella riga i-esima di bs ci sono
% i valori delle funzioni B-spline valutate in x(i); nella riga i-esima
% di bs1 ci sono i valori delle der... |
function channelOrder=getChannelOrder()
freq = [-2 -0.5 0.5 2.1];
fftLen = 64;
fftOversample = 2;
b = bitrevorder(0:fftLen/fftOversample - 1);
subChan = 4;
remap128 = reshape([b, b+32, b+64, b+96], fftLen/fftOversample, subChan)';
% 128,384,0,256 -> ... |
testTimes = [];
for i = 1 : numCols
tic
testClass = net(x(:,i));
testTimes = [testTimes toc];
end
mean(testTimes) * 1000 |
function [speed_d_allMice, wheelRev_d_allMice, td_allMice, nPreMin_wheelRev_allMice_ds] = downsampWheelRev(wheelRev_aligned_allMice, time_aligned_wheelRev_allMice, nPreMin_wheelRev_allMice, downSampBin, binLength, mice)
%% Set speed (units: mm/sec) of mouse running on the wheel ... compute it in 100ms bins (ie every 10... |
function CrseData = CourseDataSet()
CrseData = xlsread('2018LincolnEndurance.xlsx'); %Read Course Data as set of X,Y Coordinates from excel
CrseData = CrseData.*0.3;
n = 5000;
bn = 0.005*n;
t = 1:length(CrseData(:,1));
xy = [transpose(CrseData(:,1));transpose(CrseData(:,2))];
... |
function mats = run_correlation_analysis(nodeData, envData, Regularize)
%RUN_CORRELATION_ANALYSIS runs various correlations on node data
% MATS = RUN_CORRELATION_ANALYSIS(NODEDATA, ENVDATA)
% produces matrices in structure MATS which give the correlation of the
% raw node timecourses, NODEDATA, and the margina... |
function[Pred, objective_list] =Q1(Noisy,alpha,gamma,model)
% Z = load("/home/adminpc/Documents/Sem8/MIC/Assignments/assignmentImageDenoising/data/assignmentImageDenoisingPhantom.mat");
% Noisy = Z.imageNoisy;
Pred = Noisy;
update = 10;
% model = 2;
count = 0 ;
% alpha = 0.91;
lr = .1;
% gamma = 0.007;
prev_obj = 1e... |
function output = testing_classifier(features,labels,classifier)
%% only the period for training
%% Normalization
% normalize features together
features = normalize_feature(features,classifier.paramZscore.mu,classifier.paramZscore.sigma);
%% PCA
if classifier.applyPCA
features = features * classifier.coeff;
end
... |
% 97年中国大学生数学建模竞赛A题计算
%参考:《数学的实践与认识》1998,1
% 非线性约束优化求标定值
% 遍历容差等级
% 全程变量:COST(成本矩阵),VARI(容差等级向量)
% 相关M文件:jm97a, jm97afun
clear;
global COST VARI;
big=10000;
COST=[big,25,big;20 50,big;20,50,200;50,100,500;50,big,big;10,25,100;big,25,100];
vlb=[0.075,0.225,0.075,0.075,1.125,12,0.5625];
vub=[0.125,0.375,0.125... |
function [Data_16qam]=qam16_mod(Data_bit)
Data_I_1 = Data_bit(1:4:end,:);
Data_I_2 = Data_bit(2:4:end,:);
Data_Q_1 = Data_bit(3:4:end,:);
Data_Q_2 = Data_bit(4:4:end,:);%·ÖΪIQÁ½Â·
Data_16qam = (2*Data_I_1-1).*(2*Data_I_2+1)+...
1i*((2*Data_Q_1-1).*(2*Data_Q_2+1));
%%0000->-1-1i,0001->
end |
node=9;
n_frame=1000;
exact_R=zeros(60*length(node),1);
size_L_write=zeros(60*length(node ),1) ;
d_write=zeros(60*length(node ),1);
node_write=zeros(60*length(node ),1);
sum_d=0;
for node_index=1:length(node)
for L=1:6
for D=L:L*node(node_index)+2
if D>=L
sum_d=sum_d+1... |
%% optional untuk membantu mencari q
% fprintf('Mencari nilai q, tekan ctrl+c untuk stop pencarian')
% for z=1:p-1
% if mod(sym(p-1), sym(z)) == 0
% disp(z);
% end
% end
%% optional untuk membantu mencari h
% for z=1:20
% if mod(sym(z^((p-1)/q)),sym(p)) > 1
% h = z;
% disp(h)
% e... |
function [CENTER,weight] = Collocation_method_sparse_grids( start,order,lw,hb, wb,radius,number_atom )
% INPUTS:
% order= order of polynomial expansion
% start: starting coordinate of the FET
% lw: length of the channel (x-axes)
% hb: height of the channel (y-axes)
% wb: width of the channel (z-zxes)
% r... |
function fn = chi2(df)
% chi2 Create function proportional to log of Chi-Squared distribution.
%
% Syntax
% =======
%
% fn = logdist.chi2(df)
%
%
% Input arguments
% ================
%
% * `df` [ integer ] - Degrees of freedom of Chi-squared distribution.
%
%
% Output arguments
% =================
... |
function cr = determine_cropping_region(truth, buffer)
% DETERMINE_CROPPING_REGION - takes in a volume and a buffer and returns an
% array that indicates the cropping region for
% the provided volume
%
% cr = determine_cropping_region(truth, buffer)
%
% Input: tru... |
function [output1,output2] = exampleFxn(input1,input2,varargin)
% [output1,output2] = EXAMPLEFXN(input1,input2,varargin)
%
% DESCRIPTION.
%
% Biafra Ahanonu
% started: INSERT_DATE
%
% Inputs
% input1
% input2
%
% Outputs
% output1
% output2
%
% Options (input as Name-Value with Name = options.(... |
figure
subplot(2,1,1);
scatter(projections,angle_gradients,'+')
xlabel('Projections')
ylabel('Allen key angle/degrees')
title('\theta Resolution = 0.25')
axis([0 3052 0 120])
subplot(2,1,2)
scatter(projections,angle_gradients_50,'+')
xlabel('Projections')
ylabel('Allen key angle/degrees')
title('\theta Resolution = 0.5... |
function [fp,D] = ChebDiff(f,n)
xs = - cos(linspace(0,pi,n+1));
fs = f(xs);
D = zeros(n+1);
d_j = 0;
d_k = 0;
% extradiagonal terms
for j=1:n+1
for k=1:n+1
if j~=k
%% INPUT CODE HERE
if j == 1 || j == n+1
d_j = 2;
else
... |
function [ svmstruct ] = mysvmtrain( data, groups, varargin )
%MYSVMTRAIN Summary of this function goes here
% Detailed explanation goes here
if numel(varargin)==0
Nk = 1;
vecSigma = 1;
varC = 1;
else
lvarargin = numel(varargin);
method = varargin{1};
switch method
case 'mkifarsvm'
... |
%test histeq
I = imread('color.jpg');
[J] = Histogram_equalization(I);
%figure, imhist(J,25);%输出均衡化后的图像,其中灰度图是均匀分布的直方图均衡化,彩图是RGB转HSI对I通道进行直方图均衡化
figure, imshow(J)
[K]=histeq(I);%matlab的histeq函数进行均衡化,作为对比
%figure, imhist(K,25);
figure, imshow(I)
%figure, imhist(I);%输出原图像
figure, imshow(K)
%% |
function feature_hslice = return_h_slice(param, ii_h, ii_knot, ii_dofs)
if isempty(ii_h)
ii_h = 1:size(param.q_h_array, 3);
end
feature_hslice.q = param.q_h_array (:, :, ii_h, ii_knot, ii_dofs);
feature_hslice.dq = param.dq_h_array (:, :, ii_h, ii_knot, ii_dofs);
feature_hs... |
function [ class,type ] = DRSCAN(x,threshold,Eps,Eta,Matrix)
% run ReCon-DBSCAN based on a dissmilarity matrix
% Input : X : data set (m,n); m-objects, n-variables
% threshold : density-ratio threshold for DBSCAN
% Eps : Eps neigbourhood for ReCon-DBSCAN
% Eta : Eta neigbourhood... |
% ## Copyright (C) 2001 Paul Kienzle <pkienzle@users.sf.net>
% ##
% ## This program is free software; you can redistribute it and/or modify it under
% ## the terms of the GNU General Public License as published by the Free Software
% ## Foundation; either version 3 of the License, or (at your option) any later
% ## ver... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.