text stringlengths 8 6.12M |
|---|
function [obj_GADMM, loss_GADMM, Iter, gadmm_time]=group_ADMM_closedForm(XX,YY, rho, no_workers, num_feature, noSamples, num_iter, obj0, acc)
Iter= num_iter;
s1=num_feature;
s2=noSamples;
lambda = zeros(s1,no_workers);
out=zeros(s1,no_workers);
max_iter = num_iter;
gadmm_time(1)=0;
for i = 1:max_iter
... |
rho3 = zeros(10,1);
gamma = 3;
fz = @(z) (gamma*(z.^(gamma-1)))./((1+z.^gamma).^2);
eps1 = @(psi,lambda) 2*((cos(psi)).^2)./(pi*(lambda+4*((cos(psi)).^2)));
psimax = @(z) -acos(z/2);
psimin = @(z) acos(z/2);
eps2 = @(z,lambda) (acos(z/2).*(z.^2))./(pi*(lambda+z.^2));
%eps2 = @(z,lambda) (acos(z/2))./(pi*(lambda+1));... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This script provides a demo of the clustering algorithm using a generic
% minimax path-cost function.
% Author: Pizzagalli D.U.
% Date: 2019-01-30
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all;
clear a... |
function [data,sim] = sim_model(data,sim)
rng(sim.seed);
% Presynaptic Spike Times
if length(sim.pPreSpike)==1 % homogeneous Poisson
mean_isi = data.dt/sim.pPreSpike;
data.pre_spk_times = cumsum(exprnd(mean_isi,round(sim.T/mean_isi*5),1));
data.pre_spk_times = data.pre_spk_times(data.pre_spk_times<sim.T);... |
%% Spectral_entropy
for ii= 1:length(Mario4_GMM_Table.ChNum)%scroll through data
row=Mario4_GMM_Table.ChNum(ii);
center_peak=round((Mario4_GMM_Table.startsegment(ii)+Mario4_GMM_Table.endsegment(ii))/2);
colstar=center_peak-266; %window of 128ms each side, 266 data points
colend=center_peak+266;
L=length(colstar:c... |
%**********************************************************************************************
%**************************** CHAPTER 3: RIGID-BODY MOTIONS *********************************
%**********************************************************************************************
function [omghat,theta] = A... |
function [convexity ,rev] = getConvexity(BW)
convexity = 0;
rev = 0;
[row_ind, col_ind] = find(BW == 1);
[row_sort, row_sort_ind] = sort(row_ind,'ascend');
yLen = length(row_sort);
yLim = max( uint16((0.5*yLen -20)),0);
y0 = row_sort(1) + 60;
yUpper = y0 + yLim;
diff = 0;
... |
function [G, M] = trispectrum_4tensor_grad_from_harmonics_projs(a_lms, psi_curr,...
psi_curr_k0, curr_freqs, psi_lNs, q_list, D_mats, L, psi_freqs, a_sizes, L_cutoff)
% Function to compute a 4-tensor slice through the trispectrum from a
% number of projections.
%
% Inputs:
% * a_lms: cell array of volume expansi... |
% Lec 3.4 :Numerical Integration
% To calculate numerical integration using single application of
% Newton-Cotes
% f(x) = 2-x+ln(x)
%% Problem setup
a = 1;
h = 0.001;
b = a+h;
trueVal = (b-b^2/2+b*log(b))-(a-a^2/2+a*log(a));
%% Trapezoidal Rule (Single appliaction)
I_trap = h/2*(myFunInt(a)+myFunInt(b));
err_trap =... |
clear
clc
%% Variables:
n = [];
counter = [];
function_decimal_values = [];
function_hexadecimal_values = [];
for counter = 1:1:256
n(counter) = counter-1;
end
%%
filename = 'sinedata.inc';
file1 = fopen(filename,'w');
%fprintf(file1,'#include "p18f2431.inc" \r\n \r\n');
fprintf(file1,'SINE_SIG... |
%% This file demonstrates how to split your data into halves to evalute the obtained CCAs when regularization is added
% Date Programmers Description of change
% ==== ================= =====================
% 09/10/2016 Qiong Zhang Original code
%% Cit... |
function [mu] = get_mu_values(features, M)
[row_feat, col_feat] = size(features);
mu = zeros(M - 1, col_feat);
start_pt = 1;
end_pt = floor(row_feat/(M -1));
for i=1:(M -1)
mu(i, :) = mean(features(start_pt:end_pt, :), 1);
start_pt = end_pt + 1;
end_pt = end_pt + fl... |
clear all;
clc;
A=[1 1 5 15 39 50 75 100 100];
a=[0.99 1.01 5.01 14.98 29.99 49.85 75.45 99.99 99];
delta=[];
gamma=[];
N=length(A);
for n=1:N
[delta] = [delta abs(A(n)-a(n))];
[gamma] = [gamma abs(A(n)-a(n))/(abs(A(n)))];
end
figure;
plot(A,delta,A,gamma);
xlabel('A');
grid on;
hold on;
ylabel('błędy'); |
function g = estimate_g_multi_trials(Y,p,lags,fudge_factor)
if nargin < 4 || isempty(fudge_factor)
fudge_factor = 0.98;
end
if nargin < 3 || isempty(lags)
lags = 5;
end
if nargin < 2 || isempty(p)
p = 2;
end
lags = lags + p;
Nt = length(Y);
XC = zeros(Nt,2*lags+1);
for j = 1:Nt
XC(j,:) = xcov(Y{j},... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Load dataset and set as matrix with data and label vector:
% features selection
% select patients (optionally)
%
% Author: Mondejar Guerra, Victor M
% VARPA
% University of A Coruña
% 26 June 2017
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
classdef MHyProLocation < handle
properties (SetAccess = public, GetAccess = public)
ObjectHandle
SmartFlag = 0; % If 1 then use delete function for smart pointers
end
methods (Access = private)
% Destructor
function delete(obj)
if obj.SmartFlag... |
%% 把counter, qms_, book, 等等的生成都放到外面去,一天只用做一次
% 为了避免错按F5,每天运行一次后,注释掉
% demo3S_init_CTP
%% 生成策略实例,给strat挂上counter, book, quote, volsurf
stra = OptStraddleTradingCTP;
% 挂
stra.counter = c_opt;
stra.book = b1;
% stra.book = b_2016;
% 挂
stra.quote = qms_.optquotes_;
stra.m2tkCallQuote = qms_.cal... |
function bi = getLValue(i,tis,p,f)
[n,~] = size(tis);
bi = 0;
for m = 1:n
tri = tis(m,:);
[at,phit,~]=getLocalBase(p,tri);
tmploc = 1:3;
tmpi = tmploc(tri == i);
phi = phit{tmpi};
product = @(p) f(p)* phi(p);
a12 = (at(1,:)+at(2,:))./2;
a23 = (at(2,:)+... |
%%
clear all;% clc;
format short;
geo = [0 0 0; 1 0 0; 0 1 0; 0 0 1];
[xq,wq] = CalcSimplexQuad(2,3);
%[xq,wq] = CalcSimplexQuad(3,3);
% xq = [1 0 0; 0 1 0; 0 1 0; 1 1 0; 1 0 1;0 1 1]/2;
% wq = [1 1 1 1 1 1]/6;
% xq(:,2:3) = xq;
% xq(:,3) = zeros(size(xq,1),1);
idx = [4 2 1];
% idx = [6 5 4];
%idx = ... |
function correlationMats = do_subject_level_glm(correlationMats, Settings)
%DO_SUBJECT_LEVEL_GLM run subject level analysis
%
% M = ROInets.DO_SUBJECT_LEVEL_GLM(M, Settings) uses subject design
% matrix Settings.SubjectLevel.subjectDesign to perform a subject-level analysis, and append these results
% as a sub... |
% Recreates the plots in the paper for the Bansal and Yaron (2004) model.
% Figures 1a, 1b
% Parameters set to produce quick results. For higher quality, refine
% parameters param.aux.M, param.aux.T,
% param.aux.Tdrop, param.aux.ni, param.aux.nj
tic;
% benchmark model parameterization
param.GAMMA = 10;
pa... |
classdef KalmanFilterTest < matlab.unittest.TestCase
properties
simple % 1D state kalman filter
threeState % 3D state
end
methods(TestMethodSetup)
function initSimple(testCase)
F = [0.9];
B = [0.1];
H = [1];
testCase.simple = KalmanFil... |
function [ k ] = curvature_central( u )
% compute curvature
[ux,uy] = gradient(u);
normDu = sqrt(ux.^2+uy.^2+1e-10); % the norm of the gradient plus a small possitive number
% to avoid division by zero in th... |
% VariableTestingSim.m
% 01/26/14
% Callie J Miller
%
% The purpose of this code is to allow the user to quickly test various
% variables of the simulation of actomyosin in a hexagon.
% USES THE FOLLOWING FUNCTIONS: initialize.m, HexSimPoly.m (in the Simulation
% Codes folder)
% MODIFIED 03/02/14: Test if can get angu... |
function [yTr yTs K idxTsRm] = keep_first_label(xTr, xTs, flag_mexFile)
if(flag_mexFile)
[Ntr Kini] = size(xTr);
Nts = size(xTs,1);
[yTr yTs] = keep_first_label_c(xTr, xTs, Ntr, Nts, Kini);
K = length(unique(yTr));
idxTsRm = find(yTs<=0);
else
Ntr = size(xTr,1);
Nts = size(xTs,1);
yTr =... |
function [testset] = Gen_test_set(image,setting, EdgeTemplate, LayoutTemplate, PaletteDictionaty)
featureLength = 24; %%%24
N = length(setting.test_list);
testset = zeros(1,featureLength);
%image = imread(img);
%size(image)
%image=reshape(image,[1080,1080,3])
[h,w... |
% 2020-3-29
% This matlab code implements the ERG model for infrared target-background
% separation.
clc;
clear;
close all;
utilsPath = '../../../utils';
addpath(utilsPath);
addpath('../../../label');
addpath('../../../libs/PROPACK');
for setId = 1
setImgNumArr = [3 75 75 75 75 5 32 3 1 114 30];
setImgNum... |
function cell_sig = CellsortApplyFilter2(fn, ica_segments, subtractmean,title)
% cell_sig = CellsortApplyFilter(fn, ica_segments, flims, movm, subtractmean)
%
%CellsortApplyFilter
% Read in movie data and output signals corresponding to specified spatial
% filters
%
% Inputs:
% fn - file name of TIFF movie file
% ... |
function renameLayer(obj, oldName, newName, varargin)
%RENAMELAYER Rename a layer
% RENAMELAYER(OLDNAME, NEWNAME) changes the name of the layer
% OLDNAME into NEWNAME. NEWNAME should not be the name of an
% existing layer.
opts.quiet = false ;
opts = vl_argparse(opts, varargin) ;
% Find the layer to rename
v = ... |
import_eigenval();
%gebruik de read me om de eigenval file te readen
%sla voor elke spin op
eigenvalues=ans(:,:,1);
%zorg dat alles op Fermi niveau wordt geplaatst
eigenvalues=eigenvalues-ones(40,28)*5,79;
%plot verticale lijnen
fig=figure;
hax=axes;
hold on
plot(eigenvalues);
SP=10; %your point goes here
line([... |
function out1 = hess_grf_ceq_heel1212(in1,toe_th,dmax,cmax,k,us,ud)
%HESS_GRF_CEQ_HEEL1212
% OUT1 = HESS_GRF_CEQ_HEEL1212(IN1,TOE_TH,DMAX,CMAX,K,US,UD)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 23-Jun-2020 09:33:37
out1 = 0.0;
|
function [obj]=plotPhaseSyncronization(obj)
%check that input data is valid
if obj.nCh~=2
obj.hPlot=[];hText=[];
msgbox('Phase Sync used only for 2 channels');
return;
end
Fs = 1/(obj.T(2)-obj.T(1))*1000;
V1 = squeeze(obj.M(1,:,:))';
V2 = squeeze(obj.M(2,:,:))';
VF1=butterFilter(V1,Fs,obj.plotParams.lowcuto... |
function [d_s,better] = beam_gen_swirl_rapid(RX_measure_report, Beam_index_report,RX_full_measure)
%BEAM GROUP GENERATION SELECTING WEAKEST CLIENT FIRST
load global_params_incr.mat;
N_u = size(RX_measure_report,2);
%Initial Solution = Only Finest Beams
d_s_finest = 0;
for b=1:1:Ncode... |
function extreme_GHK_Fit_GO(saltName,varargin)
ORG = Matlab2OriginPlot();
ORG.cd_TopLevel();
dirName = ['GHK_response_' saltName] ;
ORG.mkdir(dirName);
ORG.cd(dirName);
% subDir = [saltName '_Anion'];
% ORG.mkdir(subDir);
ORG.Disconnect;
paramsTotal = [];
paramsAltTotal = [];
%extreme_GHK_Fit_GO('HfC... |
function B0 = householderTrid(matrix)
[n,m] = size(matrix);
I = eye(n);
v = [];
A = matrix;
for r=1:n-2
for j=1:n
if j==1 || j==r
v(j,r) = 0;
elseif j==r+1
S = calcS(A,j,r,n);
sgn = calcSgn(A,j,r);
v(j,r)... |
% 批量读取图片
function [] = readMultipleImages(AXES)
%% 定义全局变量
global imageGather
global maxIndex
global i
%% uigetdir函数浏览选择文件夹
directoryname = uigetdir('','请选择图片文件夹');
if isequal(directoryname,0)
disp('Users Selected Canceled');
else
addpath(directoryname);
imgstr = dir(directoryname); % imgstr是一个结构体数组,包含文件夹内... |
%Core Resource Examples: Steno3D Low-Level Resource Construction Examples
%
% %%%ref[Project](steno3d.examples.core.project) - Steno3D Project examples
%
% %%%ref[Point](steno3d.examples.core.point) - Steno3D Point resource construction examples
% %%%ref[Line](steno3d.examples.core.line) - Steno3D Line resou... |
function [ x_, y_, phi_ ] = odometry( x, y, phi, left_speed, right_speed )
%ODOMETRY returns the estimated curent x,y and phi value in reference to
%starting position
% implementation of odometry functions in IVR practical 5
% Optimise R to obtain more accurate results, get robot to turn 2pi radians
% several times a... |
classdef Screen_Properties < Session
properties
monitor = 0 % use the primary screen
width
height
framerate
end
methods
end
end |
%%
% 分段三次埃尔米特插值
x = -pi:pi; y = sin(x);
new_x = -pi:0.1:pi;
p = pchip(x,y,new_x);
figure(1); % 同一个脚本文件里想画多个图,需要编号,否则只显示最后一个图
plot(x, y, 'o', new_x, p, 'r-')
% plot函数用法:
% plot(x1,y1,x2,y2)
% 线方式: - 实线 :点线 -. 虚点线 - - 波折线
% 点方式: . 圆点 + 加号 * 星号 x x形 o 小圆 p 五角星号
% 颜色: y黄; r红; g绿; b蓝; w白; k黑; m紫; c青
... |
%Algoritmo que computa a fatoracao de Cholesky e resolve o sistema de
%equacoes normais. Como A (mxn) = (21x11), o fator de Cholesky R_a triang.
%sup. tem dimensao (nxn) = (11x11)
function [x_a, R_a] = questao_1_a(A,b)
%Aplicando a fatoracao de Cholesky no sistema normal, temos:
%A^t*A*x = A^t*b ; A^t*A = R_a^t*R_... |
function visualize(index, FsTest, timeDur, yTest, indexRefine, ySpIndex, thezr, TF, EZR, truth, EZRCurve)
labelFont = 8;
titleFont = 12;
ySpIndexReliable = repmat([index,0], FsTest/1000*timeDur, 1);
ySpIndexReliable = reshape(ySpIndexReliable, 1, []);
ySpIndexReliable = ySpIndexReliable(1:length(yTest));
yS... |
function [a] = lSquares(x, fX, order)
x = x';
fX = fX';
A = ones(length(x), min(order+1, length(x)));
for i = 1:order+1
A(:,i) = x.^(i-1);
end
a = (A'*A)\(A'*fX);
a = fliplr(a');
end |
function res = find_zero()
res = fzero(@ramp_func, 9);
end
function res = ramp_func(v)
% run the simulation until the ramp touches the ground
% and return the x coordinate of the rider relative to
% the end of the ramp
% ramp_height is the height of the ramp in meters
% ramp_dist is the horizo... |
function pah = plot_dot3(X,Y,Z,C,C_lim,dotsize,cmap,c_label,cborientation)
% plot_dot Plots colored dots based on Z value
%-------------------------------------------------------
% University of South Florida, Ocean Circulation Group
% Sage's Codar Processing Toolbox v1.0 + DG mods
%------------------------------... |
%extracting features from 2D images
clc;
clear;
% addpath fns/
warning off
t='E:\UÅÌ\ºÚÉ«ËØÁö\image_and_data\image-after-treatment_test';
listing=dir(t);
listing=struct2cell(listing);
[m,n]=size(listing);
t1='E:\UÅÌ\ºÚÉ«ËØÁö\image_and_data\mask-after-treatment_test';
label_listing=dir(t1);
label_listing=st... |
%%Optimitzador de parāmetres per a la detecciķ d'imatges.
%La funciķ optimizer prova diferents configuracions per a trobar el māxim
%en l'espai format per <buckets,T>.
function [] = optimizer()
b = 1;
Samples = 40;
buckets = 0.05:0.05:0.1;
threshold = 800:-25:600;
for bucket = buckets
matBuc... |
function ground_truth = find_groundtruth(cdata)
%%% just make sure sizes of feat1 n feat2 are same
%% read two images
img1 = cdata.view(1,1).img;
img2 = cdata.view(1,2).img;
% img1 = imread('chr1.jpg');
% img2 = imread('chr3.jpg');
% %% Find the features values of the GT points
% gt = cdata.GT;
% feat1 = cdata.view(1... |
function [t,x,beta,gamma] = regioni_prelock(data,K0,options)
% recupero i valori che servono
[Nass,Ibar,Rbar] = data.value;
[t_0,t_1,t_u,~,date] = data.time;
if isfield(data,'regione')
regione = data(1).regione;
end
if nargin == 2
ffig = 1;
ssave = 1;
else
if isfield(options,'ffig')
ffig = o... |
function [cost] = getQuadraticCost(x, up, down, left, right)
% Cost for the quadratic function
cost = abs(x-up).^2 + abs(x-down).^2 + abs(x-right).^2 +abs(x-left).^2;
cost = cost(:);
end |
function [p,h] = plotROCCurve(ROC,cmap)
for i = 1:size(ROC,2)
p(i) = plot(ROC(i).Xsvm,ROC(i).Ysvm,'Color',cmap(i,:),'LineWidth',1.5);
plist{i} = ['AUC = ' num2str(ROC(i).AUCsvm,2)]
hold on
end
[h,icons] = legend(p,plist,'Location','East','Box','off','FontSize',8)
xlabel('1-specificity: FPR'); ylabel('Sensitivi... |
function [edgeDist, deltaHeight, ppENU ] = ...
findPP( vent, rcvr, azel, plumeRad, plumeHeight, center)
%FINDPP Find Pierce Point
%Input: vent (Location)
% rcvr (VaprRcvr)
% azel ([deg deg]) GPS Azimuth
% plume_rad (m) Radius of plume
% center (Location)
%Output: ... |
clear; clc;
% close all;
%% main
load OptCurve;
load PIDTracking;
p = [0 trace_P];
p = smooth(p, 250, 'loess')';
v = [0 trace_V];
vv = v(1828:2289);
v_s = smooth(vv, 200, 'loess');
v(1828:2289) = v_s;
TMIN = 0; TMAX = Time+1;
VMIN = 0; VMAX = max(v)+5;
PMIN = 0; PMAX = p(end);
n_point = length(p);
t = 0:0.05:(n_point ... |
function gL = lande_g(S,L,J)
% lande g factor
gL = 3/2 + (S*(S+1) - L*(L+1))/(2*J*(J+1)); |
function result=Classifer_SVM()
end |
function NR = normrank(A,B,C,D,tol)
%NORMRANK Normal Rank of Proper System
%
% NR = normrank(A,B,C,D)
%
% returns the normal rank of a linear system characterized
% by (A,B,C,D).
%
% See also INVZ.
if nargin==4,
tol=1e-8;
end
dc=0;
[AA,BB,CC,DD,Gs,Go,Gi,dims,t,... |
classdef TrackAppScriptFile < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
TabGroup matlab.ui.container.TabGroup
TestGraphsTab matlab.ui.container.Tab
UIAxes ... |
%% 部品強調投影(Geodesic Dome)
% 部品ごとに投影を撮り、体積に基づいてラベル値を付与し直して、それぞれの部品を強調した投影を作成する
% Geodesic Dome ではなく球面直交座標で投影作成するようにProjectionEmphasizedModel()を改造したもの
%
% Output: ProjectionEmphasizedComponent{Label}(X,Y,theta,phi) / そのラベル値の部品が強調された投影集合
%
% ProjectionEachComponent = {
% Projection(X,Y,theta,phi),
% Projection(X,Y,th... |
% Load in Bscans
if(exist('imagedb.mat'))
imagedb = load('imagedb.mat');
BScans_stack = imagedb.BScans_stack;
end
%% Extract Bscans of interest
Bscans_UF = BScans_stack{6,1};
%% extract Image of interest and apply filtration scheme
% Raw Image
I = BScans_UF(:,:,41);
Iz = I;
%%
% remove any image outliers... |
function [ MAXSTRING ] = necuRucnoDaRacunaMAXSTRING(pocetak, kraj, preciznost )
x = pocetak: preciznost : kraj;
MAXINT = length(x);
MAXSTRING = log2(MAXINT + 1);
end
|
function Hd = handband1
%HANDBAND1 Returns a discrete-time filter object.
%
% M-File generated by MATLAB(R) 7.1 and the Signal Processing Toolbox 6.4.
%
% Generated on: 10-Jan-2007 18:46:42
%
% Equiripple Halfband lowpass filter designed using the FIRPM function.
% All frequency values are normalized to 1.
Fpass = ... |
cclear;
close all;
clc;
%% MLC Lab
%% Quanser Aero Helicopter control
quanser_aero_parameters;
quanser_aero_state_space;
s=tf('s');
Gunc=ss(A,B,C,D);
Gnom=tf(Gunc);
%% MIMO Poles and zeroes
eps=1e-6;
z=tzero(minreal(Gnom));
p=eig(minreal(Gnom));
fprintf('Poles of the nominal system are:\n');
disp(p);... |
function [y] = clasificador_SOM(datos, w, clases_w)
% clasificar los datos utilizando el mapa w, con clasificacion clases_w
tipo_distancia = 3;
y = [];
for k=1:size(datos,1)
min_dist=distancia( w(1,1,:), datos(k,:), tipo_distancia );
for i=1:size(w,1)
for j=1:size(w,2)
dist=dist... |
function mroots = dispersion_free_surface(alpha,N,h)
% mroots = dispersion_free_surface(alpha,N,h)
% calculates positive imaginary and N first positive real solutions of alpha = k*tanh(k h)
% Modified by Y. WANG @TUMSAT @June, 2016.
% Codes from https://www.math.auckland.ac.nz/~meylan/code/dispersion/dispersion_free_s... |
% The partial fraction expansion of F(s) using MATLAB program is given as follows:
num = [0 5 7 8 30];
den = [1 15 62 85 25];
[r, p, k] = residue(num, den);
disp('r:');
disp(r);
disp('p:');
disp(p);
disp('k:');
disp(k); |
clear;
Nimages = 5; % total number of images to use in the algorithm
Nreference = 13; % reference image number
Winsize = 5; % length of window used for NCC
th = 0.5; % NCC threshold
% image locations and formats
imloc = 'D:\Software\living_room_traj2_loop\scene_00_';
% imloc = 'D:\Software\of... |
% A Pythagorean triplet is a set of three natural numbers, a < b < c,
% for which,
%
% a^2 + b^2 = c^2
%
% For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
%
% There exists exactly one Pythagorean triplet for which a + b + c = 1000.
% Find the product abc.
U = [ 1 2 2; -2 -1 -2; 2 2 3];
A = [ 1 2 2; 2 1 2; 2... |
clc
A1=2;
A2=4;
fc=10;
fm=1;
Ec=8;
Em=0.715;
t=0:0.01:4;
pi2=6.283184;
x=A1*sin(pi2*fc*t)+A1*cos(pi2*fc*t);
P=Ec*cos(pi2*fc*t);
E1=-(Em/2)*cos(pi2*(fc+fm)*t);
E2=(Em/2)*cos(pi2*(fc-fm)*t);
xam=Ec*cos(pi2*fc*t)-(Em/2)*cos(pi2*(fc+fm)*t)+(Em/2)*cos(pi2*(fc-fm)*t);
figure
subplot(5,1,1);pl... |
function WriteBinaryData(path_name, data)
[n_row, n_column] = size(data);
fid = fopen(path_name, 'w');
magic = int8('magic');
fwrite(fid, magic, 'int8');
fwrite(fid, int32(n_row), 'int32');
fwrite(fid, int32(n_column), 'int32');
for ii = 1:n_row
fwrite(fid, single(data(ii, :)), 'float32');
end;
fclose(fid);
end |
%Takes the output from activityChanges.m and plotMeanValuesPopulation.m and
%compares them
%expmeans/ctlmeans is mean elevated/decreasing values of population
%exppcts/ctlpcts is for increasing/decreasing activity cells
activity = 'activityResults_MMDDYYYY_DayX.mat';
baseline = 'sigpopulation_MMDDYYYY_DayX.mat';
loa... |
function [sdata, rdata, hdata] = excelread2(filename)
% clear all;clc;filename='\Converted Data\Ibrahim(2003).xlsx';
% idea 1
sdata = struct('author',[],'title',[],'parameter',[],'time',[],'xylabel',[],...
'xdata',[],'ydata',[],'filename',[]);
sdata.filename=filename;
[~, ~, raw0] = xlsread(filename,'First');
raw ... |
function [ outArray ] = Untitled2( inArray )
% Create logical array where values are greater or equal to 0
gtzIndex = inArray >= 0;
% cube everything in inArray, cast to floats, and append logical array
outArray = (gtzIndex) .* inArray.^3;
end |
%run this script to load data, and normalize data
clear all
load('mnist35.mat')
%%normalize data
trainx=double(trainx)/255;
testx=double(testx)/255;
n_train=length(trainy);%total number of training samples
n_test=length(testy);%total number of test samples
m_data=size(trainx,2);%dimension of original feature vector... |
function [ trials file_num ] = load_trials(brainstorm_db,subject,condition,RhythmMode)
% [DESCRIPTION]
%
% [trials] = load_trials(brainstorm_db,subject,conditions)
%
%=============================================
% input:
% brainstorm_db - brainstorm database
% subject - subject name
% ... |
function hypothesis = generateHypothesisPredictions(hypothesisName,beforeLearning,afterLearning,expParams)
% This is just a helper function that points to other code to do the heavy
% lifting.
%
% @ Matt Golub, 2018.
hypothesis.name = hypothesisName;
simulateFcn = getSimulateFcn(hypothesisName);
[hypothesis.clouds, h... |
function dx_dt = spm_cts_stateEqn_three_states(x,u,param)
% returns dx_dt given the vector x and input u at any given time-step
% x(1) = q_pos, x(2) = q_neg, x(3) = cs_avg_neg
% u = load current (A). Positive implies discharge.
% Copyright (c) 2018 Gopalakrishnan, Krishnakumar <krishnak@vt.edu>
% Author: Gopalakrishna... |
function [ xOut ] = stpMinGradientDescent( fun, x0, iterNum, alpha, quiet)
%% the algorithm of gradient descent
%
%% input
% fun : such as [f, g] = fun(x)
% x0 : the initial x
% iterNum : the number of iteration
% alpha : the param for this algorithm
% quiet : if print the info about each iteration
%
%% output
% xOut :... |
function [simresult codeprint] = run_oalign4(input_params)
Nlines=15;
foldername0=pwd;
foldername1='I:\group\codes\Alignment_Codes\oalign3_linear\';
cd(foldername1);
string_towrite{1}=input_params.out_fname;
string_towrite{2}=input_params.outfull_fname;
string_towrite{3}=num2str(input_params.HCP_field,'%.5f'... |
numGc = [0.00021811, -0.00042528, 0.00020730];
denGc = [1.00000000, -1.75717052, 0.75717052];
GcDis = tf(numGc,denGc,1/5000);
%%
fn = 1000;
wn = fn * 2 * pi;
zeta = 0.7;
lp = tf(wn * wn, [1, 2 * zeta * wn, wn * wn]);
lpDis = c2d(lp,1/5000,'tustin');
figure;bodeplot(lpDis);
%% 设置伯德图绘制偏好
f_start = 1;
f_end = 2500;
Op=... |
function mat_deflate = matrix_deflation(mat,w)
%% function SCCA_matrix_deflation
% The aim of this script is to orthogonalise the data matrix 'mat' with
% respect to previous canonical correlates.
%
%% Inputs
% mat: This is the data matrix to orthogonalise. We orthogonalise this
% matrix with respect to previous canon... |
clear all; close all; clc;
% =========================================================== %
base_path = '../../data/vgg_cells';
zip_file_name = 'cells.zip';
in_path = 'cells';
train_path = 'train_split';
test_path = 'test_split';
% =========================================================== %
in_path = fullfile(base_p... |
function [curls, cav, div] = latticeDerivatives(centers,directions,supercell,cVect)
x=zeros(supercell);
y=zeros(supercell);
z=zeros(supercell);
u=zeros(supercell);
v=zeros(supercell);
w=zeros(supercell);
for k=1:size(centers,1)
[k1, k2, k3]=ind2sub(supercell,k);
x(k1,k2,k3)=centers(k,1);
y(k1,k2,k3)=cente... |
% TUHH :: ICS
% Control Lab CSTD1
% State space construction
% Last update: 10.11.2014
% AMG
function [sys]=CSTD1_StateSpaceConstruction(J1,J2,J3,d1,d2,d3,k1,k2)
%% Functionality: construct the state space model based on identified parameters.
% A matrix Nx-By-Nx: 6x6
A=[ 0 1 0 0 ... |
clear all;
close all;
init
lambda = 2*logspace(-1, -4, 30);
% lambda = 1e-1;
fname = 'georgios';
noise_type = 'patch';
dataset = 'yale';
algorithms = {@ten_rpca, @ten_rcpd, @ten_orpca, @ten_brpca};
names = {'ten_rpca', 'ten_rcpd', 'ten_orpca', 'ten_brpca'};
% Noise levels
levels = [50, 100, 160];
% Structure with ... |
classdef TMDubins < Node
% Traffic manager
% Checks safety of all vehicles
% Stores necessary reachable sets for safety
% Stores global constants in the air space
properties
% Map
domain;
% Speed Limit
speedLimit = 10;
% Min Speed
speedMin = 1;
% active agents
... |
%% Image Analysis Project
%
% Federico Badini & Stefano Bodini
% Politecnico di Milano
% 2014-2015
% Corso del Prof. V. Caglioti
%
% The following script tries to reveal the background of the scene
% Preliminary steps
close all
clear
clc
% Constants
SRC_IMGS_PATH = '../Output_pics/';
DEST_IMGS_PATH = '../Background/'... |
function [weight_CN1,theta,search_step_fin,search_step_ini] = Connectivity_Weight_FW (start_pt,end_pt,input_map,bound_map,comp_contour,cn_val)
% start_pt;
% end_pt;
% input_map=weight_EC;
% bound_map=map_img_rgb;
% comp_contour=nearset_contour;
% cn_val=1;
% figure (3)
% imshow(map_img_rgb);
% set(gca,'Ydir',... |
function out = check_inputs(Settings)
%CHECK_INPUTS Checks properties of Settings structure
%
% Settings = ROInets.check_inputs(Settings) checks inputs and establishes
% default settings
% Copyright 2014 OHBA
% This program is free software: you can redistribute it and/or modify
% it under the terms of th... |
function [FE, Fit, Obs, Dates_Test] = FC_VAR(Y, plag, StartOoS, WinSize, Dates, h)
% Forecast a VAR model.
t = StartOoS;
Window = t-WinSize-1:t-1;
Y_Train = Y(Window,:);
%Y_Test = Y(t-1+h,:);
%Dates_Test = Dates(t:t+h-1);
[VAR, VARopt] = VARmodel(Y_Train,plag,0);
Endo = [];
for i = 0:plag-1;
%Endo = [End... |
clear
clc
xp=-1:0.1:1.5;
yp=exp(xp).*sin(xp)-1;
plot(xp,yp,'-k','linewidth',3,[-1 +1.5],[0 0],'k','linewidth',1,[0 0],[-2 4],'k','linewidth',2)
grid on |
function [result,seq,point,l,state]=Get_Total_Rader_Dist2_with_state(camara,A1,A2,A8,A9,A3,sig)
o_point1=1;
i_point2=7;
o_point2=9;
i_point9=5;
o_point9=1;
i_point3=3;
o_point3=5;
seq=[];
list=1:size(A1,1);
list(:,o_point1)=[];
seq1=perms(list);
seq1=[seq1 ones(size(seq1,1),1)*o_point1];
min_result1=1e12;
min_point1=... |
%% reFine: function description
function [fined, nfined FDistance] = reFine(trainX, testX, resultM, HDistance, ntop)
% resultM = resultM(:, 1: ntop);
mTest = size(testX, 1);
fined = zeros(mTest, ntop);
nfined = zeros(mTest, ntop);
FDistance = zeros(mTest, ntop);
for i = 1: mTest
rowDistance = HDistance(i, :... |
%===================================================
% This routine is to run mixed MCMC and PT mcmc several times on the same data
% the purpose is to check if the average results are similar in mean and variance
% Yiming Hu, Sep, 2012
%==================================================
times = 100;
for i = 1:times
... |
function [theSortedData, theSortedIndices] = SortStruct(aUnsortedData, aFieldNames, aSortModes)
% PURPOSE: Sorts a dataset either ascending or descending.
% IN: - aUnsortedData (1x1 struct): The data to be sorted.
% - aFieldNames (Nx1 string, optional): The fieldnames on which to sort. If omitted 'time... |
classdef EvolvingUnit < Unit
% ======================= EVOLVING MODULE =======================
methods
function trainproc(obj, datapkg) % REWRITE
if datapkg.isunified
obj.learn(datapkg);
else
for i = 1 : numel(datapkg.ndata)
obj... |
function gm=getGMModel(MCMC_muKs, MCMC_rhos, max_muKs, max_rhos)
if nargin <3
max_muKs=10e-10;
max_rhos=12e8;
end
nMCMC_muKs=MCMC_muKs./max_muKs;
nMCMC_rhos=MCMC_rhos./max_rhos;
iok=intersect(find(MCMC_muKs<max_muKs) ,find(MCMC_rhos<max_rhos)) ;
X = [nMCMC_muKs(iok)' nMCMC_rhos(iok)'];
GMModel = fitgmdist(X... |
function Z = omitSections(source)
% OMITSECTIONS
%
% Description:
% Return sections to omit, by volume name
%
% Syntax:
% Z = omitSections(source)
%
% Input:
% source Volume name or abbreviation
%
% Output:
% Z Section number(s)
%
% Note:
% Z will be empty if the volume doesn't have an omitted sect... |
function out = currentProgram(X, arena)
%out = draw2T(X, 4, 12, 14, arena);
%out = drawBox(X, 6, 6, 14, arena);
%out = draw4T(X, 4, 12, 14, arena);
%out = drawVertGrate(X,8,16,arena);
out = drawBoxArray(X,6,6,14,48,arena); |
function out = cohPM(O, Bmstop, data, gamm)
inFT = fftNc(O);
% Following J Clarck
I_k = abs(inFt).^2;
gamm = gamm.*()
I_pc = convn(I_k,gamm);
Bufferdata = inFT(Bmstop==1);
inFT = abs(data).*inFT./(abs(inFT));
inFT(Bmstop==1) = Bufferdata;
out = ifftNc(inFT); % g'(k)
end |
function [cosinusRad, sinusRad, cosinusGrad, sinusGrad] = opdracht_10(hoekRad, hoekGrad)
cosinusRad = cos(hoekRad);
sinusRad = sin(hoekRad);
cosinusGrad= cosd(hoekGrad);
sinusGrad= sind(hoekGrad);
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.