text stringlengths 8 6.12M |
|---|
X = linspace(-20,20,100);
Y = linspace(-20,20,100);
[ x, y ] = meshgrid(X,Y);
z1 = 1 - x - y;
z2 = 4/3 - 2/3 * x + 1/3 *y;
figure;
hold on;
mesh(x,y,z1);
mesh(x,y,z2); |
clear, clc
%% Setting constants
global g
% Set gravity acceleration value
g = -3.711; % gravity acceleration for Mars
%% Setting initial conditions and timespan for integration
% Set arbitrarily long timespan to integrate over
tspan=[0, 10000];
% Create initial condition array
r = [100, 100, 100]; % Initial positi... |
function [lm] = lipidMaps
%lipidMaps - parse the downloaded LipidMaps database
%
% The DB can be exported in text format using the following URL:
% http://www.lipidmaps.org/rest/compound/lm_id/LM/all/download
%
% Further information about using REST is available here:
% http://www.lipidmaps.org/data/lm_rest.php
%
% The... |
%%step1£º¶¨Òådufun
function du=dufun(t,u)
du=-30*u+0*t;
end |
% function dydt = vanderpol_ode(t,y)
%
% Differential equations for the van der Pol oscillator
function dydt=vanderpol_ode(t,y);
global epsilon;
dydt(1,1)=y(2);
dydt(2,1)=-y(1)-epsilon*(y(1)^2-1)*y(2); |
function [ features, param ] = gist_descriptor( img, n_scale, orientazioni)
%GIST_DESCRIPTOR
% Calcola la trasformata Gist con un filtraggio di Gabor
% INPUTS: img: immagine
% n_scale: numero di scale (opzionale, default=2)
% orientazioni: vettore di orientazioni per ogni scala (opzionale, default=[4 2... |
function [Q, T, C, O, ...
Abs, beta, CB6F, RUB, Rds, ...
Kf, Kd, Kp1, Kn1, Kp2, Ku2, ...
kq, nl, nc, kc, ko, Kc, Ko, ...
alpha_opt, solve_xcs, ...
theta1, eps1, eps2] = loadvars_fun(v)
% Rename default values of parameters passed in from 'v' structure
% Environmental ... |
clear all
close all
load temp_initguess
load acmod
ac.p_exp = 0.25;
N = (length(Z)-3)/6;
VR = Z(end-1);
tfin = Z(end);
Psi0 = Z(end-2);
t = ((tfin/N)*(1:N))';
fac = 2*pi/tfin;
x = Z(1:N);
y = Z(N+1:2*N);
z = Z(2*N+1:3*N);
Phi = Z(3*N+1:4*N);
Thet = Z(4*N+1:5*N);
Psi1 = Z(5*N+1:6*N);
Psi = Psi1 + Psi0*t;
xha... |
function [m]=standardize(m,varargin)
mu=nanmean(m,varargin{:});
sigma=nanstd(m,0,varargin{:});
if length(mu) == 1;
m = (m - mu)./sigma;
else
m=(m-repmat(mu,size(m)./size(mu)))./repmat(sigma,size(m)./size(sigma));
end |
%% Placement algorithm of ROSE algorithm packet
clear all
clc
close all
%% 确定是否已经生成基础参数
if exist('.\DataContainer\InputPara.mat','file')% Physical node number
eval('load .\DataContainer\InputPara.mat'); % Import substrate topology figures
else
Para_Gen_Fun;
eval('load .\DataContainer\InputPara.mat');
end
... |
function result=WiFinger(filename,trainortest,movementclass)
%手势识别,主要用KNN聚类,DWT计算距离
%LBJ 2018-9-19
%主要流程:读入CSI文件,离异点去除,低通滤波器(过滤高频噪音),Mutlipath去除(先IFFT,获取CIR后,筛去delay大于100ns的,再FFT变回CSI)
% 手势动作识别(signindicator,即什么时候开始有动作),动作切片,KNN+DTW作聚类后训练,最后分类。
addpath('toolScripts');
csi_trace = read_bf_file(filename);
len =... |
syms phi_max h_max h_min
h_ref = 0.12;
A = [ phi_max^7, phi_max^6, phi_max^5, phi_max^4, phi_max^3;
1, 1, 1, 1, 1;
7, 6, 5, 4, 3;
7*phi_max^6, 6*phi_max^5, 5*phi_max^4, 4*phi_max^3, 3*phi_max... |
function plot_start(rep,labelX,labelY)
% begins a generic plot
% shared variables
global global_rep;
global global_legcount;
global global_leg;
global global_style;
global global_fontsize;
global global_linewidth;
global global_fig;
% PLOT APPEARANCE - alter to taste
global_fontsize = 14;
global_linewid... |
function [w1 w2 b1 b2] = train_linear_cca(pixel_feat_1,pixel_feat_2,radii)
pixel_feat_1 = slice_data(pixel_feat_1,radii);
pixel_feat_2 = slice_data(pixel_feat_2,radii);
for i = 1:size(pixel_feat_1,1) %npatch.
for j = 1:8 %orientation.
[w1{i,j} w2{i,j} b1{i,j} b2{i,j}] = linear_cca(pixel_feat_1{i,j},pix... |
function result = anova_textresult(t)
if iscell(t)
df = t{2,3};
er = t{3,3};
fvalue = t{2,5};
pvalue = t{2,6};
elseif istable(t)
df = t.df('Groups');
er = t.df('Error');
fvalue = t.F('Groups');
pvalue = t.p('Groups');
end
str = 'F(%d,%d) = %.3f, %s';
pvs = print_pvalue(pvalue);
if pval... |
function w_pctmye(vars, fit_type)
%% load variables into the current workspace
varnames = fieldnames(vars);
varvals = struct2cell(vars);
for vi=1:length(varnames)
eval(sprintf('%s = varvals{vi};', varnames{vi}))
end;
human_brain_weight = get_human_brain_weight();
% Set up data... |
%path = '../pytorch_experiments/test_runs/unit_const_noise_pert_expt_fig13_reps1_reg__expt_type_SP_fig4_N_train_9_M_9_frac_norm_0.0_logging_freq_1_perturbation_freq_4000/fig4_expt_lambda_0_it_250000'
%path = '../pytorch_experiments/test_runs/const_noise_pert_expt_fig13_reps1_reg__expt_type_SP_fig4_N_train_9_M_9_frac_no... |
%% Expected improvement for global fit (EIGF)
% Lam, Chen Quin. "Sequential adaptive designs in computer experiments for response surface model fit."
% Diss. The Ohio State University, 2008.
function x_new = EIGF_function(obj,A, strategy)
% Details: Starting function for EIGF sampling.
%
% inputs:
% obj - Ordinary krig... |
%% Normalise-helping function to make code readability in Q2 better
% normalises the resulting image between 0 and maxValue
% the normalise functoin used in this example is specifically different
% from others. This function does contrast strecthing along with
% normalisation. In the question it is specifically asked ... |
%% dist_mean
% computes a symmetric matrix of mean distances given a symmetric matrix of distances
function mdist = dist_mean(dist, taxa)
% created 2021/07/10 by Bas Kooijman
%% Syntax
% mdist = <../dist_mean.m *dist_mean*> (dist, taxa)
%% Description
% computes a symmetric matrix of mean distances between selected... |
%%Modificar
%carga los valores de prueba_8 y prueba_9 que son cuando las compuertas se
%abren y se cierran. no hay mucho para comparar porq ambas no fueron
%abiertas ni cerradas al mismo tiempo
m=900; %muestras
vel1=6;
vel2=7.5;
%% cargar valores
[P3]=table2array(readtable('Prueba_8.csv'));
[P4]=table2array(readtable(... |
%copyfile Parallel_function_VTD_AbsDist_Modelv5_v1_01.m Parallel_function_AbsDist_Modelv9_v1_001.m
versionmodel = '5';
versionsubmodel = '1';
for numberfunc = 1:9
fid = fopen('Parallel_function_VTD_AbsDist_Modelv5_v1_01.m','r')
% Read txt into cell A
i = 1;
tline = fgetl(fid);
A{i} = tline;
while ischar(tline)
i ... |
clear variables
x = linspace(-5, 5, 100);
px_med = exp(x);
x = x.';
px_med = px_med.';
% calculo un polinomio
N = numel(px_med);
cant_terminos = 4;
A = ones(N, cant_terminos);
A(:, 2:end) = [x x.^2 x.^3];
coef_px = A\px_med;
polinomio = A*coef_px;
% OJO! polyval y polyder leen los coeficientes al re... |
function exectime = runnb(gpu)
addpath nb
trainfile = '/kunle/ppl/delite/data/ml/nb/MATRIX.TRAIN.50k';
if (gpu == 1)
exectime = nb_traingpu(trainfile);
elseif(gpu == 2)
exectime = nb_trainjacket(trainfile);
else
exectime = nb_train(trainfile);
end
|
function theta = gaussianEstimation(x)
theta.mu = sum(x,2) / length(x);
theta.C = ((x - theta.mu) * (x - theta.mu)') / length(x);
theta.type = 'Gauss';
end |
function A = unique_rows(A)
% unique_row - unique rows of a matrix
%
% A = unique(A, 'rows');
%
% For scilab/matlab compatibility
%
% Copyright (c) 2009 Gabriel Peyre
A = unique(A, 'rows'); |
classdef AppenderAttachableImpl < ether.log4m.AppenderAttachable
%APPENDERATTACHABLEIMPL Internal class to ether.log4m. Do not use.
properties(Access=private)
appenders;
appenderMap;
end
methods
%-------------------------------------------------------------------------
function this = AppenderAttachable... |
MNImask = imgload('MNImask');
L0 = EulerChar( MNImask, 0.5, 3 )
global jalaloc
int_mask = imgload([jalaloc, 'feat_stuff/runfeat/R2Block/Images/R2Block_intersection_mask.nii']);
L0 = EulerChar( int_mask, 0.5, 3 )
L0 = EulerChar( int_mask.*MNImask, 0.5, 3 )
subplot(2,1,1)
imagesc(int_mask(:,:,50))
subpl... |
function M = weight_ls(X,B,sigma)
M = ones(size(X));
return; |
function varargout = edit_profiles(varargin)
% EDIT_PROFILES Application M-file for Edit_Profiles.fig
% FIG = EDIT_PROFILES launch Edit_Profiles GUI.
% EDIT_PROFILES('callback_name', ...) invoke the named callback.
% Last Modified by GUIDE v2.5 06-Apr-2012 14:04:06
if nargin == 0 % LAUNCH GUI
fig = openfi... |
function rss = ssfun_mcmc(params,data)
% r = ssfun_mcmc(params,data)
% residual
r = resfun_dr(params(:),data.d,data.P,data.O,data.varargin);
% mcmc already has prior for the alpha parameters
r = r(1:end-sum(data.d));
rss = sum(r.^2);
|
function [lambdaList, resultList] = validateLambdaBergsma(fvA1, fvA2, labelA, fvB1, fvB2, labelB, translation)
% validate translation from A to B
wordA = unique(labelA); na = length(wordA);
wordB = unique(labelB); nb = length(wordB);
assert(length(translation)==na);
lambdaList = [];
resultL... |
r=0.5;
theta=pi/2;
b=[1,-2*cos(theta),1];
a=[1,-2*r*cos(theta),r^2];
figure;
subplot(2,2,1);
zplane(b,a);
r=0.75;
theta=pi;
b=[1,-2*cos(theta),1];
a=[1,-2*r*cos(theta),r^2];
subplot(2,2,2);
zplane(b,a);
r=0.25;
theta=pi/2;
b=[1,-2*cos(theta),1];
a=[1,-2*r*cos(theta),r^2];
subplot(2,2,3);
zplane(b,a);
r=0.4;
th... |
function u = jiedianxiangliang3(n,p,t,M)
%JIEDIANXIANGLIANG3 此处显示有关此函数的摘要
% 此处显示详细说明
u = zeros(1, n+p+2);
for j=1:n-p
a=(M+1)/(n-p+1);
i=floor(j*a);
u(j+p+1)=(1-(j*a-i))*t(i)+(j*a-i)*t(i+1);
end
u(n+2:n+2+p)=1;
end
|
% Laboratório 05
% Matheus Pereira dos Santos
% Filtro casado, Pulso cos levantado e Probabilidade de erro
%% Atividade 01
%%% - Plotando o pulso de raiz de cosseno levantado (RRC) com alpha = 0.333
[g,t,s] = BipolarRRC_CosLevantado(100, 10, 0.333);
figure
plot(t,g, '-r')
grid on
ylabel('Amplitude')
x... |
% Copyright (c) 2015 Reinaldo Astudillo
% Modified by Dr. Xian-Ming Gu, who is an assistant professor in School of Economic Mathematics, Southwestern
% University of Finance and Economics, Chengdu, Sichuan 611130, P.R. China.
% Date: 2019/3/18 19:33
% Permission is hereby granted, free of charge, to any person obt... |
function iqrange = iqrSM(data,isort)
% IQRSM, Inter Quartile Range
% Steve Marron's matlab function
% Inputs:
% data - column vector, or matrix of data
% isort - flag indicating need to sort:
% 0 ===> Don't need to sort
% !!! DATA ASSUMED TO BE IN INCREASING O... |
function [out, tform] = preprocess_board(image, points, location, cache, id)
% Disabilita la cache se non viene fornita dal chiamante.
if nargin < 4
cache = create_cache(false);
id = NaN;
end
% Costruisci la matrice di trasformazione prospettica.
tform = projective_tform(points)... |
function F = colasGG1(lambda1,lambda2,T)
t=0;
tsuc=0;
NLL=0;
Ns=0;
n=0;
tll=0;
ts=0;
LL=[];
S=[];
Serv=[];
X=extraerExponencial(lambda1);
if X>T
Tp=0;
tp_med_sistema=0;
t_med_cola=0;
F=[Tp; tp_med_sistema; t_med_cola];
return;
else
[Serv,ts,tl... |
function granger_paper4_with_stripes_dual(g,g_f,labelconditions,freqrange)
allscreen()
F= [1 2; 1 3; 2 3] ;
lab=cell(6,1);
lab{1}='HPC -> Parietal';
lab{2}='Parietal -> HPC';
lab{3}='HPC -> PFC';
lab{4}='PFC -> HPC';
lab{5}='Parietal -> PFC';
lab{6}='PFC -> Parietal';
%
% k=1; %Condition 1.
for j=1:3
... |
function printPacket(packetPort, packet)
%printPacket(packetPort, packet)
%
%This function is a generic packetListener.
%it takes a port and a packet as objects,
%and prints out the packet and the name
%of the port, if there is one.
% "Copyright (c) 2000 and The Regents of the University of California. All rights... |
%%%%%%%%%%%%%%%%%%% f(t) %%%%%%%%%%%%%%%%%%%%%%%%
t = -2:0.0001:2;
u1 = t>=-2;
u2 = t>-1;
f_cos = cos(2*pi*1/4*t);
u3 = t>1;
ft = -0.5*u1 + 0.5*u2 + u2.*f_cos - u3.*f_cos + 0.5*u3;
subplot(141)
plot(t, ft)
title("f(t)")
grid on
%%%%%%%%%%%%%%%%%%% fe(t) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
u1 = t<=2;
u2 = t<1;
f_cos_oe = ... |
function krCalibrateEyeCoil(handles)
distvar = 10;
axes(handles.TaskSpecificPlot); cla;
axis([-200 200 -200 200])
axis off
uic(1) = uicontrol('Style','pushbutton','String','Increment','Callback',@cb_Increment,'Position',[600 200 60 20]);
uic(2) = uicontrol('Style','pushbutton','String','Decrement','Callback',@cb_Decr... |
classdef EllipticProblemTest1d < SWEConventional1d
properties(Constant)
%> wet/dry depth threshold
hmin = 0.01
%> gravity acceleration
gra = 9.8
end
properties
StiffMatrix
RHS
ExactSolution
Simulate... |
function [out,f] = svmdecision(Xnew,svm_struct)
% This is a modification of the default SVM Matlab classification. The
% code has been changed in order to return the distance from the
% separating hyperplane alongside the class label.
%
% Edited by Markos Zampoglou, 2016, ITI-CERTH, Thessaloniki, Gr... |
%% compare difference between symmetric/asymmetric FIR
order = 10;
n = [0 1:order];
co = .5; # normalized cutoff frequency
p = round((order/2)*co) # number of coefficients in passband
q = order - 2*p # number of coefficients in stopband
## -------------- Symmetric LPF ----------------
## create LPF sequence: [1 1 .... |
clear, clc
E1 = sym('E1%d%d', [3 ,3]);
E2 = sym('E2%d%d', [3 ,3]);
E3 = sym('E3%d%d', [3 ,3]);
E4 = sym('E4%d%d', [3 ,3]);
E5 = sym('E5%d%d', [3 ,3]);
syms x y z w tau
E = x*E1 + y*E2 + z*E3 + w*E4 + E5;
eqs = sym(zeros(11, 1));
eqs(1) = det(E);
Et = transpose(E);
te = 2*(E*Et)*E - trace(E*Et)*E;
eqs(2:10) = te(:)... |
1;
source ./kernel.m
load ./data
samples_x = data(:,1);
samples_y = data(:,2);
x = [-3:0.05:3]';
y1 = optimized_regression(1, data, x);
y10 = optimized_regression(10, data, x);
y100 = optimized_regression(100, data, x);
y1000 = optimized_regression(1000, data, x);
hold off
subplot(2,2,1)
plot(x,y1,'b', samples_x,s... |
clear;clc;
load('prespeech.mat')
data_conv2 = data_conv;
data_noCh2 = data_noCh;
Nsub = length(data_conv2);
% trial no in both cond
a=[];b=[];
for i=1:Nsub
a = [a size(data_conv2{i,1}.trial,2)];
b = [b size(data_noCh2{i,1}.trial,2)];
end
sum(a)
sum(b)
cfg.method = 'distance';
neighbours = ft_p... |
function result = rightleft3(data, plane)
% function result = rightleft3(data, plane)
%
% Luis Hernandez
% Last Edit: 7-3-98
%
% This is like rightleft - No plotting anything, though.
% given a set of 3D points and the 3D coordinates of a plane
% returns how many are on the right (+x) and how many are on the
% left of ... |
function[X]=BFGSfunction(functname,X,ii)
e=1; %initialization:
i=0;
XTEMP(:,1)=X(:,ii);
h=functname;
A=eye(2);
while e>0.001
i=i+1; %counter
x1=XTEMP(1,i);
x2=XTEMP(2,i);
f(i)=h(XTEMP(:,i));
if (x1==0) && (x2~=0)
df_dx1 = (h([0.001;x2])-f(i))/(0.001); ... |
clc;clear;close all;
% Optimised for PDMS substrate for graphene.
%%% EXAMPLES OF GRAPHENE
[crop, top, bottom, left, right] = deal(1);
% ----------------- IMPORT DATA-------------------------
imgpath='./100x Images2/';
imgfiles = dir([imgpath '*.jpg']);
for index = 1:length(imgfiles)
% crop = 400; bo... |
function [ output_args ] = scalespace( input_args )
%SCALESPACE Summary of this function goes here
% Detailed explanation goes here
A = imread('Lena.tif');
% rgb2gray
A = 0.2989 * A(:,:,1) + 0.5870 * A(:,:,2) + 0.1140 * A(:,:,3);
subplot(221);
imagesc(A);
[X Y] = meshgrid(-2:2, -2:2);
K = gaussian(X, Y, 1);
A2 = co... |
function tokens = simpleTokenize(str, sep)
% tokens = simpleTokenize(str, sep)
%
% This function takes a string and a separator character, and returns a
% cell array of strings divided up by the separator. If a separator is
% found at the end of str, the last entry in tokens will be an empty
% string.
%
% E.g.,... |
% Class function
% Function: generatedLabel
% Generate axis labels for the DataCol types
function labl = generatedLabel(self, DataCol)
if (isempty(DataCol.unit))
labl = DataCol.vName;
else
labl = [DataCol.vName, ' [', DataCol.unit, ']'];
end
end |
%
% 2D model of the cubesat motion in the deployer
%
% Vadim Yudintsev yudintsev@classmech.ru
%
clc;
params = struct();
% Cubesat mass, kg
params.mass = 2.0;
% Moment of inertia, kgm2
params.J = params.mass*(0.340^2 + 0.1^2)/12;
% Center of mass position, m
params.yc = 0.05 -0.02;
params.zc = 0.340/2... |
% Plot the Motifs on the data
% Chin-Chia Michael Yeh
%
% plot_motif_on_data(data, sub_len, motif_idx, motif_dim)
%
% Input:
% data: input time series (matrix)
% sub_len: interested subsequence length (scalar)
% motif_idx: the index for the founded motifs (matrix)
% motif_dim: the dimensions spanned by ... |
% plot data
[~, uniqueInd] = unique(t_rmse);
[~, closeInd1] = findClosestValue(t_rmse(1), feature_full.t);
[~, closeInd2] = findClosestValue(t_rmse(end), feature_full.t);
h2_4 = figure;
ax = [];
q_toExamine = feature_full.q(1, closeInd1:closeInd2);
dq_toExamine = feature_full.dq(1, closeInd1:closeInd2);
q_lowerRange... |
function STABILITY
%
% Выбор метода:
method_type='SDIRC'; % Допустимые значения:
% 1) 'MidPoint' --- неявный метод средней точки
% (одношаговый, одностадийный, 2-ого порядка)
% 2) 'HH' --- метод Хаммера-Холлингсворта
... |
function makeFineData(K,h,pureNeum)
% [nx,ny] = size(K); Q.ind = [sub2ind(size(K),4,4) (sub2ind(size(K),nx-4,ny-4))];
Q.ind = [1 numel(K)];
if pureNeum
fprintf('Pure Neumann problem with source term\n');
Q.val = [1 -1];
[u,v,A,b] = BTPFA(K,Q,h);
else
fprintf('Pressure is 1 and 0 on left and rig... |
%-------------------------------------------------------------------------%
% antovid - Jeremy Turner
%
% Saves animation as .avi
%
% Input: fn - filename, e.g. 'animations/DAEp100.mat'
% : svnm (optional) - filename to save to, fn if unspecified
%
% Loads in all the fields of the saved simulation. Animation is t... |
function [data, label] = getQueryData(dataSetName, queryNo, feature, scale)
%--------------------------------------------------------------------------
% function [data, label] = getQueryData(queryNo, feature, scale)
% load the test query feature data.mat
% input:
% dataSetName--- the dataset name
% queryNo ... |
clc;
close all;
clear all;
%3.1 3.2 3.3 3.4
figure('Name','alfa = 1');
ezsurf('(1-x)^2+100*(y-x^2)^2'); %grafica de la funcion
hold on;
syms x y;
f = (1-x)^2+100*(y-x^2)^2;
g = gradient(f,[x,y]);
h = hessian(f,[x,y]);
x = 0;
y = 0;
epsilon = 0.001;
alfa = 1;
grad = subs(g);
ev = subs(f);
plot3(x,y,ev,'*r');
while no... |
% This program is used to verify the databse connection
%
% Author: Liming Gao
% Create Date: 2020-02-18
% =======update=======
% 1.add connection error type check (2020-04-22)
%======== to do list ============
% 1.
clear,clc
close all
format longg
%% ------------------------ CONNECT TO DATABASE ------------------... |
function StrOut = HillCrypt(str,A)
% StrOut = HillCrypt(str,A)
% Inputs: str = a string of lower case text (alphabet: a, b, ..., z)
% A = an invertible matrix mod 26
% Output: StrOut = a string of corresponding Upper-Case ciphertext (alphabet: A, B, ..., Z):
% resulting from encrypting str using the Hill cipher... |
function [rivName, years, lat, lon, ann_mean, ann_max] = GRDC_get_yearlyData(stationID,yearstart,yearend)
% GRDC_get_yearlyData
% Given a GRDC station identifier, the function will (assuming it's a valid
% station) return a cell array of yearly annual max and mean flows.
%
% INPUT: stationID - GRDC basin identifier us... |
function [] = carsonblock()
global nb firstcar nextcar ncb
for b = 1:nb
% check if there's a car on block b
c = firstcar(b);
if (c == 0)
ncb(b) = 0;
% if there is a car, get a count of all the cars on block b
else
count = 1;
nc = next... |
function R = get_susceptibility( R )
% Griffiths phase and long-range correlations in a biologically motivated
% visual cortex model
rho = R.reduced.num_spikes{1}/R.N(1);
susceptibility = R.N(1) * ( mean(rho.^2) - mean(rho)^2) / mean(rho);
% output resultss
R.susceptibility = susceptibility;
end
|
function Res = EqPic(OldPic,NewPic)
%The function equalizes the histogram of the picture and plots the
%equalized histogram and equalized picture
clc
[OrigPicHist,OrigPic]=HistM(OldPic);
L=size(OrigPicHist);
[m,n]=size(OrigPic);
NewPicCDF=zeros(1,L(2));
NewPicHIst=zeros(1,L(2));
Res=zeros(m,n);
for i=1:L(2)
for ... |
function output = synth_quilt(tindex,tile_vec,tilesize,overlap)
%
% synthesize an output image given a set of tile indices
% where the tiles overlap, stitch the images together
% by finding an optimal seam between them
%
% tindex : array containing the tile indices to use
% tile_vec : array containing the tiles
% ti... |
load optposes1.dat
for i=1:size(optposes1,1)
if (i==1)|| (i==size(optposes1,1))
P = optposes1(i,:);
else
P = (optposes1(i-1,:)+ optposes1(i,:)+optposes1(i+1,:))/3 ;
end
save movavgposes1.dat P -ASCII -append
end
|
function [JE,TC,Hmarg]=merging_stats_fast(data,col_order)
%
% [JE,TC,Hmarg]=merging_stats_fast(data,col_order)
%
% Calculates information theoretical statistics for a group of timeseries
% inputs: data - N by M matrix of discretized data (positive integers)
% the N rows are timesteps, the M columns a... |
function figs_adj_poster_ax(fh,fn,axpos)
% fh: figure handle
% fn: optional, figure name for saving as pdf
% ax: optional, position of the axes
% example call: figs_adj_poster_ax(gcf)
%%
lp = get(legend, 'position');
if ~exist('axpos','var')
axpos = [0.25 0.20 0.7000 0.7000];
end
fs = 18; % 12;
fontnam... |
% ADVISOR Data file: MC_AC59.m
%
% Data source:
% Marcus Menne, et al., "Energy-Efficiency Evaluation of Traction Drives
% for Electric Vehicles", Proceedings 15th Electric Vehicle Symposium,
% Brussels 1998.
% Drive tested by Institute for Power Electronics and Electrical Drives
% at Aachen University of Technolog... |
clear; clc; close all
%% Alice and Bob generate same Key using Quantum Key Distribution
% If Eavesdropper is present Alice and Bob can detect eaves presence with a
% probability of P(eave's presence) = 1 - (3/4)^n where n = no.of bits
key = QKD(50,0);
fprintf("Key = ");
disp(key)
%% Alice side
% Enc... |
function P=inference(model, testingSet, numDocs, vocSize, numTopics)
%model: final.beta (should be 'data/final.beta')
%testingSet: test_documents (should be found in 'data/test_documents')
% Read the model into V, each row is a topic, the entries are probabilities
% (not log probabilities)
V = load(model); %dim(numTop... |
%% 均匀半空间 水平电偶源在地表处的响应分析
clc;clear all;close all;
%% 参数设置
u0 = 4*pi*1e-7;
fs = 1e7;
dt =1./fs;
Ns = 2e4;
Tob = (1:Ns)./fs;
rou = 100;% 电阻率
I = 1;
ds = 1;
m = I.*ds;
xr = 100;
yr = 0;
zr = 0;
%%
[step_ex10,step_ey10,impulse_hx,impulse_hy,impulse_hz] = Horizontal_Electrical_Dipole_Response(u0,rou,m,xr,yr,... |
% The simulator to run a trajectories simulation analysis to find out the
% time range within the workspace
%
% Author : Paul Cheng
% Created : 2019
% Description :
% Workspace simulator generates the workspace over a defined trajectory.
classdef TrajectoryWorkspaceSimulator < SimulatorBase
pr... |
function [linsol,fval]=p2p(dem,Pg,alpha,beta,Sl,Su,eta_ch,eta_dis,Nt,res,BatteryPlace,S0,psip2p)
Nh=length(dem(1,:));
%% defining variables
aa=size(dem);
G=optimvar('G',aa(1),aa(2),'LowerBound',0);
D=optimvar('D',Nt,sum(BatteryPlace),'LowerBound',0,'UpperBound',beta);
C=optimvar('C',Nt,sum(BatteryPlace),'LowerBou... |
% XXXXXXXXXXXXXXXXXXXXXXXXXXXX htet_concat_denfis_recon_data_with_years XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
%
% Author : Htet
% Date : Sep 11, 2019
% Stars : *
% purpose : to populate corresponding years in reconstructed data
% XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 本函数用于画Equity右图1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function h = draw_right1_e(f,equity)
h=axes('parent',f,'position',[0.84,0.63,0.15,0.21]);
hold on;
bar(1,equity.win_day,0.5,'r');
bar(2,equity.lose_d... |
classdef TsMatrix < Matrix2DBase %<AbstractTsMatrix
%TSMATRIX is a Time*Assets matrix of a single value
%eg. close, $position, signal, selected, isCSI300member, .
% -------------
% 程刚
% 程刚,20150517,添加了父类Matrix2DBase,
% 很多properties应该删去了,但因为有代码依然用旧类写的,所以暂不删去,只是隐藏
properties (SetAccess = 'public', GetAccess = ... |
function [phi] = lldmPhiFunc(theta, bias, phiMean, thetaMean, biasMean, phiPrec, thetaPrec, biasPrec, phi0, options, data, dataN, numDoc, numWord, dim)
theta = reshape(theta, [dim, numDoc])';
phi = minFunc(@crossEntropyFunc,phi0, options);
%phi = fminunc(@crossEntropyFunc,phi0, options);
function [f... |
%% Initialization
%% ================ Part 1: Feature Normalization ================
%% Clear and Close Figures
clear ; close all; clc
fprintf('Loading data ...\n');
%% Load Data
data = csvread('save_train.csv',1,1);
X = data(:, 1:size(data,2)-1);
y = data(:, size(data,2));
m = length(y);
% Scale features and set ... |
% Cryptographie chaotique
% ***********************
% Traitement du signal en sortie pour le mélange
% ----------------------------------------------
function [z,dot_z] = sortieMelange(x,y,h)
if size(x) ~= size(y)
y = y';
end
z = x - y;
dot_z = zeros(size(z));
for t = 1:(length(... |
function [A,B] = FrancisQZStep(A0,B0)
% function [A,B] = FrancisQRStep(A0,B0)
% A0 is an unreduced upper Hessenberg matrix.
% B0 is a nonsingular upper triangular matrix.
% A is the upper Hessenberg matrix and B is an upper triangular matrix
% that results when one step of the QZ algorithm is applied.
% GVL4: ... |
function [ ] = zemax_phase_dat( path, opd , taille_max_x, taille_max_y)
%ZEMAX_phase_DAT Summary of this function goes here
% Exportation d'une surface de phase au format DAT pour utilisation comme
% plan de phase dans zemax
%Paramètre de la première ligne du fichier DAT
%indicate the units of the data: 0 for mm... |
close all; clear all; clc;
[ap.thisFile, nm.CurrFile] = fileparts(mfilename('fullpath'));
cd(ap.thisFile)
%% Copy data to testfolder
con = ConstantsClass;
con.BONUSASSNUMBER = 1;
%% find assignment theses
nmAss1 = [con.NMBONUSASSIGNMENTDIR num2str(1)];
apAss1 = fullfile(con.AP_ASSIGNMENTS,nmAss1);
bonusAss.raw = dir... |
classdef IsotopeGUI < handle
properties (Constant = true)
name = 'IRMS Toolbox';
url = '';
version = '0.0.1.20180222-dev';
platform = IsotopeGUI.getPlatform();
environment = IsotopeGUI.getEnvironment();
language = Isotop... |
% ct_baseflow 本脚本用于计算基本流及其他相关文件
% 2015-04-08 lmy
%% 清空
close all
clear
clc
%% 载入基本参数文件
load input
%% 写出参数文件供compressible_blasius程序和ctmain程序使用
fid=fopen('pra.txt','w');
fprintf(fid,'xl in yl jn bkn\r\n');
fprintf(fid,'%e %u %e %u %u\r\n',xl,in,yl,jn,bkn);
fprintf(fid,'re rmw pr gama te\r\n');
fprintf(fid,'%fd0 %fd0 %f... |
function [y] = generate_y(w,x,range,m)
%temp = zeros(numel(sort_x),1);
% for i=0:m
% temp = w(i+1)*sort_x.^i;
% end
%y = double(range);
p = poly2sym(flipud(w));
x = x(range);
y = eval(p);
%y = w(1) + w(2)*sort_x + w(3)*sort_x.^2;
% aMatrix = zeros(m+1);
% ... |
function r = plus(p,q,varargin)
%@events/plus Overloaded plus function for EVENTS objects.
% R = plus(P,Q) combines sparsity objects P and Q and returns the
% EVENTS object R.
% check for empty object
% combine objects
% get name of class
classname = mfilename('class');
% check if first input is the right kind of ... |
function dataStruct = dataStructInitialize(varargin)
%DATASTRUCTINITIALIZE Initialize the human data structure.
% This function constructs the human data structure using user-specified inputs. Primarily, these
% inputs are references to critical files and folders that will be needed for preprocessing.
% Inputs ca... |
img = imread('Images/photographer.jpg');
filter = [-1 -1 -1; -1 9 -1; -1 -1 -1];
img2 = imfilter(img, filter);
imshowpair(img, img2, 'montage'); |
%% Implementation of shallow neural network
%clear ; close all; clc
%% 1. Load & Visualize Data
images = loadMNISTImages('train-images.idx3-ubyte'); % [ 784 x 60000 ]
labels = loadMNISTLabels('train-labels.idx1-ubyte'); % [ 60000 x 1 ]
%display_network(images(:,1:100)); % Show the first 100 images
%disp(label... |
function symbLNA = symbolicLNA(inspecies, inreactants, inproducts, inrates)
%%% X ->{k1} 2X
%%% X + Y ->{k2} 2Y
%%% Y ->{k3}
%%% X ->{k1} c1*lambda1 (where c1 =0,1,2)
%%% lambda1 + lambda2 ->{k1} c2*Y
%%% lambda2 ->{k3}
species = [];
reactants = [];
products = [];
rates = [];
propensity = [];
species
for m = ... |
clear all;
load FileWav16kHz
% Load SvdClass.mat
load SvdMfcc1to3
MfccPath = 'Mfcc13N';
NSvdPick = 10;
% SvdMfcc(1, 2) : Male Speakers mapped to Female
% .U
% .S
% .V
% Class(1)
% .name
% .path
% .IsTrain
% .IsTest
% CIdx{1} : [i,... |
clear all;clc
% Testing extract_v2 with some simple data
t = (0:.09:3).';
x = t.^2;
t_initial = 1; t_final = 2;
[x_out1s, t_out1s, x_mean1s] = extract_v2(t_initial, t_final, t, x, 0.1,...
false, 10, 3, 'spline');
[x_out1l, t_out1l, x_mean1l] = extract_v2(t_initial, t_final, t, x, 0.1,...
false, 10, 3, ... |
function [out] = spectralSubtraction(in,frameSize,overlap,avgApF,sDApF,bias)
hop = frameSize/overlap;
N = length(in);
NFrame = ceil(N/frameSize);
% zero-pad input to always have complete frame at end
if (mod(N,frameSize) > 0)
pad = NFrame * frameSize - N; % amount of 0's we need to add
in = [in; zeros(pa... |
function eFlag = exists(obj, varargin)
% EXISTS Method to check if a container exists
% Check if a container exists using this method.
%
% % Connect to an Azure Cloud Storage Account
% az = azure.storage.CloudStorageAccount;
% az.loadConfigurationSettings();
% az.connect();
%
% % Create a client Obj... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.