text stringlengths 8 6.12M |
|---|
% Create and train an arbitrary architecture neural network
% where all transfer functions are sigmoidal except the output (linear).
% Structural assumptions:
% - input structure corresponds to input layer,
% - nodes in output layer have no connections between them
%
% input - TxN, where T is the number of training ca... |
% Ejemplo 1 del Método JPEG
clc; clear; close all
pkg load signal
%%%%%%%%%% Parte1: Compresion %%%%%%%%%%
% Matriz de tamano 8x8
A=[154 123 123 123 123 123 123 136;
192 180 136 154 154 154 136 110;
254 198 154 154 180 154 123 123;
239 180 136 180 180 166 123 123;
180 154 136 167 166 149 136 136;
... |
function [f, pi, E, M, loglik] = alg_3_3(n, n_class, K, y, approxF)
% a script performing Algorithm 3.3 of R&W
% by Mark Norrish, 2011
% f is of form [f1 ; f2 ; ... ; fn_class]
%
% initialise stuff
E = zeros(n, n, n_class); % I think a 3D matrix makes more sense than a block diagonal one
R = repmat(eye(n), n_class, 1... |
function [D2, t] = fourD2(M)
% Second derivative matrix with periodic boundary conditions.
dt=2*pi/M;
t=dt*(1:M);
D2=toeplitz([-pi^2/(3*dt^2)-1/6, 0.5*(-1).^(2:M)./sin(dt*(1:M-1)/2).^2]);
end |
tic;
%% Your code here
N = 201;
k1 = [0 1 0; 1 -4 1 ; 0 1 0];
filter_1_N = zeros(N);
filter_1_N( (N-1)/2:(N+3)/2 , (N-1)/2:(N+3)/2 ) = k1;
fim_1 = fftshift(fft2(filter_1_N));
log_mag_filter_1 = log(1+abs(fim_1));
figure;
subplot(1,2,2);
daspect([1 1 1]); axis tight;
imshow(log_mag_filter_1, [min(log_mag_filter_1(:)... |
function gradientDescentTest()
[theta, J_history] = gradientDescent([1 5; 1 2; 1 4; 1 5],[1 6 4 2]',[0 0]',0.1,1000); # start with alpha=0.1 and theta=[0 0]
theta # show the compuated theta with above alpha value
plot(J_history) # plot the cost function
end
|
fclose all;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%read user parameters for processing
FISH_ALGO_Define_param_forMatecho
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
addpath('./privat')
%addpath('..\Zscore\codes_diff_and_sum\Tool_HacGenericProcess\nansuite');
%dataP... |
function [pattern] = addIndexToPattern(messagepattern, index)
% adds the index before and after the pattern, then pattern
index = dec2bin(index, 4) - '0';
pattern = [index messagepattern invert(index) invert(messagepattern)];
end |
tic
N=2000;
[a,b]=ms_mex(N,4,0);
a=logical(a);
c.N=N;
c.m=0.001;
c.r=0.001;
c.s=0.01;
c.h=0.5;
c.g=200;
c.e=ceil(99999*rand);
[x,y]=mpop_mex(a,b,c);
fprintf('\nmpop -N %d -m %f -r %f -S -s %f -h %f -g %d -i msin -o msout -e %d\n\n',...
c.N,c.m,c.r,c.s,c.h,c.g,c.e);
toc
[geno,mark]=mpopout2genomark(x,y);
snp... |
function [ kernel ] = getKernel( kernelType, params )
%GETKERNEL The function will return a kernel function handle
% The function will return the kernel specified by the string 'kernelType'
% Parameters of the kernel are given by the verctor params.
% Input for the kernels have to be a column vectors.
%
... |
function [n m theol22 theol11 actl22 actl11 truncatedata emission excitation pledata levelpledata maxima chirality wavelength]=loadplemap(file,t,t2, radius);
%loads data into matlab, seperates emission and excitation wavelength and
%writes data table. Then plots data as 2d contour map truncated at the
%value defined i... |
function w_ = propagation_w_R( w,theta_dot,rotation_matrix)
w_ = w + rotation_matrix*[0;0;theta_dot];
end |
function [E_D, lnLambda, collTime] ...
= physical_parameters(n, Z0, T)
e = 1.60217662e-19; % C
eps0 = 8.8541878176e-12; % F/m
me = 9.10938356e-31; % kg
ne = dot(n, Z0);
lnLambda = 14.9 - 0.5 * log(ne/1e20) + log(T/1e3);
E_D = ne * e^3 * lnLambda / (4 * pi... |
function main_oasis_learn(hyper_params_idx)
close all force
if nargin <1
hyper_params_idx = 6666; % default is a debug run
end
idx = hyper_params_idx
[~, git_commit_hash] = system('git rev-parse HEAD');
init % add dirs to path and init parms
%%
% hyp_params{1}.split = 'easy10cat';
hyp_params{1}.split = '20cat_tr... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function doGenerateSemanticTestImages
% Generate test images to evaluate if our method actually captures
% statistics of natural images.
%
% Input parameters:
%
% Output parameters:
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function y = detectCusp( B, Rxx)
% The function analyzes the experimental data and guesses if there is a
% cusp in magneto-resistance
y = 0;
[positiveB, positiveRxx] = getPositiveData(B, Rxx);
noise = estimateNoise(positiveB, positiveRxx);
n = length(positiveB);
f = 1/4; % fraction of data-points to use... |
clear
clc
img=imread('baboon.jpg');
img=rgb2gray(img);
img=imresize(img,0.4);
img=imnoise(img,'gaussian',0,5);
mask=ones(3,3).*1/9;
[x,y]=size(img);
for i=2:x-1
for j=2:y-1
img1=double(img);
m=img1(i-1:i+1,j-1:j+1).*mask;
n(i,j)=sum(sum(m));
n=uint8(n);
... |
function f = sub2indm(siz,a)
%SUB2INDM Linear index from multiple subscripts in matrix form.
% SUB2INDM is used to determine the equivalent single index corresponding
% to a given set of subscript values.
%
% IND = SUB2INDM(SIZ,A) returns the linear index equivalent to the N
% subscripts in the arrays A(:... |
function [ X_d ] = outer_5( I_d, x_Id )
%outer_5 この関数の概要をここに記述
% 詳細説明をここに記述
for i = 1:numel(I_d)
X_d(i) = mean(x_Id(i,:));
end
end
|
A=randi(10,04); m=mean(A,2);
y=m(1:1);
d=det(A);
bigger=max(d,y);
|
%extracts data from NIRStar .evt, .wl1, and .wl2 files to save them in a
%single array called scmData, which that Matlab can analyze with an SVM.
%svmData has 25 columns. The first 12 columns are the wl1 channels. The
%next 12 channels are the wl2 channels. The final column is a flag which is
%1 for a target frame or... |
%rlAbstractValueRepresentation Defines the interface for value functions.
% Value functions can be V(o), Q(o,a) and Q(o)
% Copyright 2019 The MathWorks, Inc.
classdef rlAbstractValueRepresentation < rl.representation.rlAbstractRepresentation
methods
function this = rlAbstractValueRepresentation(Model... |
%The sub-question of giving the information of friction is 0.1N
k1=1; %spring constant
L01=10; %original length of spring
m1=0.1; %mass of block
Vo1=0; %initial velocity of block
X1=2; %extension of spring
Ep1=0.5*k1*X1.^2; %elastic potential energy
Ek1=0; %kinetic energy
dt1=0.002; %the fixe... |
%% piemers
syms a2 b2 c2 d2
A = [a b ; c d];
{Undefined function or variable 'a'.
}
syms a b c d
A = [a b ; c d];
B = [a2 b2 ; c2 d2];
A*B
ans =
[ a*a2 + b*c2, a*b2 + b*d2]
[ a2*c + c2*d, b2*c + d*d2]
A.*B
ans =
[ a*a2, b*b2]
[ c*c2, d*d2]
%% 1.simbolisko mainigo definesana
x = sym('x');
sqrt(x^2)
ans ... |
%% In-Class Exercises for Beamforming
% These problems are part of the beamforming lecture.
% You can complete each problem after the corresponding section in the
% class.
%
% For each problem, complete the sections labeled TODO.
%% Problem: Simulating RX combining on QPSK symbols
% To illustrate RX combining, we do... |
classdef Results < dynamicprops
%
% @author M.Moriche
% @brief Class to handle post-processing of results
% @date 18-05-2014 by M.Moriche \n
% Created
% @date 03-12-2014 by M.Moriche \n
% indx as output for the addItem
% @date 03-04-2016 by M.Moriche \n
% filelist as output for method save of any re... |
function sst_interp=fct_interp_sst(model,XP)
time_step_choose=5;
load('data/simu2008_30.mat','sst','dx','dy');
% load('data/simu2008_30.mat','sst','dx','dy');
sstref=sst(3:end,:,time_step_choose);
clear sst;
sstref=sstref-mean(mean(sstref));
sstref=sstref';
nsub=2^7;
[Mx,My]=size(sstref);
xref=dx*(-Mx:nsub:2*Mx-1)... |
clear
%% during hydrate formation
t=xlsread('Mass Balance.xlsx','A2:A2853');
T=xlsread('Mass Balance.xlsx','C2:C2853');
P=xlsread('Mass Balance.xlsx','F2:F2853');
P_up=xlsread('Mass Balance.xlsx','E2:E2853');
P_down=xlsread('Mass Balance.xlsx','F2:F2853');
Vpump=xlsread('Mass Balance.xlsx','D2:D2853');
save('HW... |
function eo = EveryOther(vec)
%this selects every other element of a vector
% and creates a new vector.
sz = size(vec,2);
y=vec;
for i = 1:sz
if mod(i,2) == 0
y(i) = [];
end
end
display(y);
end
|
%-------- Print eps plots -----
title0 = '';
changed_str = '';
switch changed
case 1
changed_str = 'ap';
title0 = '$a_p';
case 2
changed_str = 'am';
title0 = '$a_m';
case 3
changed_str = 'af';
title0 = '$a_f';
case 4
changed_str = 'gamma';
... |
function y = intraframe(video)
%obj=mmreader(video);
% video=obj.read();
%twoframes=video(:,:,1:2);
sze=size(video);
orig=0;
for i=1:sze(4)-1
A(i)=(entropy(video(:,:,:,i)-video(:,:,:,i+1)));
%figure;
%imshow(((video(:,:,:,i)-video(:,:,:,i+1))));
orig=orig+8;
end
figure;
plot(A)
disp(orig);
x=o... |
c = 2.99792e8;
total_beats = importdata('as135_main_nobg.txt');
lambda_1 = 750e-9; % Original beams.
lambda_2 = 665e-9;
lambda_3 = 575e-9;
f_1 = c/lambda_1;
f_2 = c/lambda_2;
f_3 = c/lambda_3;
delta_t = 2e-9/c;
t = 0:delta_t:(10000*delta_t); %% Making new t-axis as imported t axis is nonlinearish.
size_window = s... |
function [CFG, ERP, fig] = plot_ERP_scalplot(CFG, ERP)
latency = CFG.scalplot_latency;
amplitude_limit = CFG.amplitude_limit;
ERP = pop_scalplot(ERP, CFG.ERP_bins, latency, 'Blc', 'pre', 'Colorbar', 'on', 'Colormap', 'jet', 'Electrodes', 'ptslabels', 'FontName', 'Courier New',...
'FontSize', 10, 'Legend', 'bn-bd-m... |
function pValueMap = hotSpotMapPvalueGroup(lp, pTH, groupSize, plotFlag)
% calculate the p value between light and bg
% this function consider group of spots
if ~exist('pTH', 'var')
pTH = 0.05;
end
if ~exist('plotFlag', 'var')
plotFlag = 0;
end
if ~exist('groupSize', 'var')
groupSize = 0;
en... |
function f = fitFunction(a, x, eqType)
% Evaluate function
switch eqType
case 1
% 1: y = a1 * x + a2 linear
f = a(1) .* x + a(2);
case 2
% 2: y = a1 * x linear - proportional
f = a(1) .* x;
case 3
% 3: y = a1 * x^2 + a2 * x + a3 quadratic
f = a(1) * x... |
function bpms = load_bpm_noise()
% loads bpm background noise and returns the list of bpms
%
% Notes:
%
%
fpath=which('path_bpm_background_noise');
fpath = fpath(1:end-27);
load([fpath,'bpm_noise','.mat'],'bpms');
|
clear all; close all; clc;
result = dlmread('Black_Bi_Propeller_Test.txt');
pwm = result(:,1);
Voltage = result(:,4);
Thrust = result(:,3);
Torque = result(:,2);
meanVoltage = mean(Voltage);
stdVoltage = std(Voltage);
meanPwm = mean(pwm);
stdPwm = std(pwm);
Voltage = (Voltage - meanVoltage) / stdVoltage;
... |
function mask = dxmask()
%DXMASK Summary of this function goes here
% Detailed explanation goes here
mask = [0 0 0 0 0; 0 0 0 0 0; 0 -1/2 0 1/2 0; 0 0 0 0 0; 0 0 0 0 0];
end
|
function make_header(fid, width, height, cen, key)
% fid : file id
% width : width value (unit : %, recommend : 100)
% height : height value (unit : px, recommend : 850)
% cen : center pos, ([lat, lon])
% key : Daum api key ('85b32471aedcb298d750fe34655600a6', Jinwoo, 2017.05.24 기준)
fprintf(fid, '<!DOCTYPE html>\n');
... |
function perf = msesparse(net, varargin)
%MSESPARSE Mean squared error performance function with L2 and sparsity
%regularizers.
%
% <a href="matlab:doc mse">msesparse</a>(net,targets,outputs,errorWeights,...parameters...) calculates a
% network performance given targets, outputs, error weights and parameters
% as the m... |
function [Decoded,Decoder_Chip,Temp_Decoded,intgrl] = ...
CDMA_decode(OutSignal,Chipbit,User_to_Decode, ...
SamplesPerBit,SamplePerChip,TotalDataBit)
% ........................ CDMA Decoding Starts Here .....................
clipto = TotalDataBit*SamplesPerBit;
TotalChips = length(Chipbit(:,User_to_Deco... |
function [ stru ] = year2016( month )
month_days = [ 31 29 31 30 31 30 31 31 30 31 30 31 ];
month_name = [ 'January '; 'February '; 'March '; 'April '; 'May '; 'June '; ...
'July '; 'August '; 'September'; 'October '; 'November '; 'December ' ];
if ~isscalar(month) || month < ... |
function [Setpoint, Monitor, FileName] = getlattice_als(varargin)
%GETLATTICE_ALS - Get data from a StorageRingOpsData lattice file
% [ConfigSetpoint, ConfigMonitor, FileName] = getlattice_als(Field1, Field2, ...)
%
FileName = menu('Load which lattice?','Production lattice','Injection lattice','Load from file','Exit... |
function [T, U, Z]=parameterized_cartpole_traj(k_pk,kv, ka)
%state 1: x state2:x dot state 3 theta, state 4 theta dot
if abs(k_pk) > 5
k_pk = 5*sign(k_pk);
end
tf= 0.3;
tpk = 0.1;
t1 =linspace(0, tpk,101);
t2 =linspace(0, tf-tpk,101);
delv1=k_pk-kv-ka*tpk;
c31 =tpk;
dela1 = -ka;
% compute spline parameters
% [ax,... |
classdef AveragePooling2DGPUStrategy < nnet.internal.cnn.layer.util.ExecutionStrategy
% AveragePooling2DGPUStrategy Execution strategy for running the average pooling on the GPU
% Copyright 2016 The MathWorks, Inc.
methods
function [Z, memory] = forward(~, X, ...
poolHe... |
%The following code illustrates the use of woodward lawson method for
%antenna synthesis
%% Program written by: Sathvik N. Prasad
% Date : 25/06/2014
clc;
clear;
close all;
P=input('enter number of elements:');
la = 1;
ss = input('enter the spacing innterms of lambda:');
d=la*ss; %spacing btw ... |
%This script performs the same function as demo.m except on scale with
%1000 Monte-Carlo simulations
%Statistics are computed at the end
clc
clear
close all
%true utility as a multivariate Gaussian CDF
u = @(x) mvncdf([x(1), x(2)], [0.2, 0.4], diag([0.07, 0.05]));
%%
%points to sample from a grid
gridsize = 5;
[X1,... |
srfreq=48000;
%滤波器带宽
bandwith=30;
len=bandwith/30;
thetav=-len*0.2*pi:pi/(srfreq/(bandwith)):len*0.2*pi;
o=hanning(length(thetav));
o=o';
%搬移的频率
freq=400;
tsin=sin(0:2*pi/(srfreq/freq):180*pi);
tsin=tsin(1:length(thetav));
shiftv=1;
t1=sinc(thetav*shiftv);
%%三角形滤波器
%t1=t1.*t1;
%%汉宁加窗滤波器
t1=t1.*o;
t1=t1./sum(t1);
t1=... |
%@(#) shuffhelp.m 1.1 05/07/13 10:29:41
%
function shuffhelp
fprintf('\n\n\n');
fprintf('Shuffle7 är en program för att skapa laddsheman.');
fprintf('\n\n');
fprintf('BOC-FILE:\n');
fprintf('Ange nästkommande cykels bocfil.');
fprintf('\n\n');
fprintf('MAKE POOLFILE:\n');
fprintf('Ange motsvarande safeguard... |
% extract descriptor
%
% Input:
% keyPoints - detected keypoints in a 2 x n matrix holding the key
% point coordinates
% img - the gray scale image
%
% Output:
% descr - w x n matrix, stores for each keypoint a
% descriptor. m is the size of th... |
% run beta_sma 0 to 1.5 (by 0.1) against SMA activation
% beta_sma: SUPPLEMENTARY MOTOR AREA saturation threshold
clear; clc;
beta_sma = 0.5*(ones(1,6)); % 0.5
beta_str = 0.5*(ones(1,6)); % 0.4
beta_thal = 0.4*(ones(1,6)); % 0.5
alpha_str = 4; % 5
alpha_sma = 8;
alpha_thal = 4; % 6
beta_sma_var = -0.5:0.025:1.5... |
%This function initilizes the configuration for the 3Body simulation.
% config = 2 letter code for 1 of 7 possible initial configurations
% param = The governing parameter for the configuration (either Hbar^2 or Rnorm)
% param2 = Any secondary governing parameter (VRest angle)
% SI = 1 to use SI units, 0 to use... |
function [selIndex,regionEntropy]=getRegionScore(tol, devRegion, varRegion)
% Calculates the probability of a region being out of tolerance and finds
% the entropy (average information) obtained by measuring a given region
%
%
% The predicted deviations are assumed to be from a gaussian distribution
% with a mean at th... |
n1 = datenum(2015,04,01);
n2 = datenum(2015,04,01);
% [Dust_monthly{1:12}] = deal(zeros(1500));
%%%% 4 datasets every 15 minutes = 4 x 24 hours = 96......images by day
% [BTDref{1:96}] = deal(zeros(1500));
count3 = 0; % counter for the missing files of T07, T09, T10 ...
Missing_file = cell(5,1); % object to c... |
function [fig,p]=stan_nervecut_audio_plot(PLOT_FEATURES)
% takes collected stats, plots and performs hypothesis tests
%
%
%
save_name='nervecut_acoustic_features';
% get options
[options,dirs]=stan_preflight;
plot_features={'AM','FM','entropy','pitch_goodness'};
plot_labels={'AM','FM','Ent.','PG'};
alpha=[.001 .01 ... |
GMModels = {};
options = statset('MaxIter',500);
for k = 81:130
GMModels{k} = fitgmdist(temp,k,'Options',options,'CovarianceType','diagonal','Options',options, 'Regularize', 1e-5);
BIC(k)= GMModels{k}.BIC;
end
[minBIC,numComponents] = min(BIC);
numComponents
BIC_smooth=smooth(BIC');
figure;plot(BIC_smooth);
GM... |
loadprh('pw04_295b')
T=finddives(p,fs,400);
%ks=round(fs*T(1,1))+(210:550)';
%ks=round(fs*T(6,1))+(210:560)';
ks=round(fs*5012)+(0:408)';
%Ar=A*makeT([0 58 6.9]*pi/180);
Ar = A ;
Al=fir_nodelay(Ar,400,0.25/(fs/2)) ;
Ah=Ar-Al;
[V,D] = eig(Ah(ks,:)'*Ah(ks,:)) ;
[l,k] = min(diag(D)) ;
rr = sign(V(2,k))*asin(V(3,k)); ... |
%%% process and hand label UTE images.
clear all ; close all ;
cd c:/shared/lastute/ ;
mongs=dir('*') ; mongs(1:2) = [] ;
for m=1:length(mongs) ;
cd(['C:\shared\lastute\',mongs(m).name]) ; ls ;
disp('loading raw data...') ;
rute = load_untouch_nii('res_ute.nii.gz') ; ruteorig = double(rute.img) ; %r... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Author: Trinh, Khanh V <khanh.v.trinh@nasa.gov>
% Notices:
%
% Copyright @ 2020 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration. All
% Rights Reserved.
%
% Disclaimers
%
% No Warranty: ... |
function[]=nummay(a,b,c)
if a==b && b==c
fprintf('Los números tiene el mismo valor\n')
elseif a>=b && a>=c
fprintf('El número mayor es %d'),disp(vpa(a))
elseif b>=a && b>=c
fprintf('El número mayor es %d\n'),disp(vpa(b))
elseif c>=a && c>=b
fprintf('El número mayor es %d\n'),disp(vpa(c))
... |
function X = cores_2_tensor(cores)
%cores_2_tensor Convertes TR tensor given by cores to full dense tensor
%
%X = cores_2_tensor(cores) takes a cell array containing TR cores and
%outputs the corresponding full dense tensor. The input TR cores should be
%3-way standard Matlab arrays. The output will also be a standard ... |
%%
% Update function
%
% Given a Newton step, the state variables are updated. We cap the saturation variable.
%
function state = updateState(state, dx, system)
nComp = system.nComp;
dz = cell(nComp,1);
for ic = 1 : nComp
dz{ic} = dx{ic};
end
dp = dx{ic+1};
dF = dx{ic+2};
dsw = dx{ic+3};
... |
%BME463 Class 1/5/16
%autocorrelation
x = -3:0.01:3;
rng default
y = 2*x+randn(size(x));
figure(1)
plot(x,y)
figure(2)
plot(x,y)
coeffs = polyfit(x,y,1);
yfit = coeffs(2)+coeffs(1)*x;
hold on
plot(x,yfit,'linewidth',2)
residuals = y - yfit;
[xc,lags] = xcorr(residuals,50,'coeff');
conf99 = sqrt(2)*erfcinv(2*.01/2);... |
%% TX Side
% Change
adsb.type = 'ext' ; % 'ext' and 'short' are the only valid values
adsb.df = 17 ;
adsb.ca = 5 ;
adsb.address = '75804b';
% Only used in extended
adsb.message1.hex = '580FF2CF7E9BA6' ;
adsb.message2.hex = '580FF6B283EB7A' ;
adsb.message1.bin = [
int32(dec2bin(hex2dec(adsb.message1.hex(1:7)),28))-... |
%% Integral plume model-MJ Fridedl
% Authors: Kim Taewook
% Linkedin : https://www.linkedin.com/in/taewook-kim/
% GITHUB : github.com/Kimtaewookcode
% Email : kimtaewook87@gmail.com
% Based on
% http://www.sciencedirect.com/science/article/pii/S014111879900022X
clear
close all
clc
g = 9.81;%gravity[m/s2]
r... |
close
clear all
prev = 'low6f311';
new = 'low7';
mid1 = 'low6f3';
mid2 = 'low6f313';
mid3 = 'low9f308';
data = load(strcat('Data/',prev));
cd = data.cdswp;
alpha = data.alpha;
cl = data.clswp;
lovd = data.lovdswp;
data2 = load(strcat('Data/',new));
cd2 = data2.cdswp;
alpha2 = data2.alpha;
cl2 = data2.clswp;
lovd2 = ... |
function out=repmf(fis,varType,varIndex,MFLabel,MFType,MFIndex,MFParams)
% Synopsis
% a = repmf(a,varType,varIndex,mfName,mfType,MFIndex,mfParams)
numInputs=length(fis.input);
numOutputs=length(fis.output);
out=fis;
if ~isempty(fis.input)
if strcmp(varType,'input'),
MFindex=MFIndex;
out.... |
function W = randInitializeWeights(L_in, L_out)
W = zeros(L_out, 1 + L_in); % Return the following variables correctly
% Randomly initialize the weights to small values
epsilon_init = 0.12;
W = rand(L_out, 1 + L_in) * 2 * epsilon_init - epsilon_init;
end |
classdef latexGenerator < reportGenerator
methods
function obj = latexGenerator(varargin)
% latexGenerator ... constructor function
%
% params : 'settingFile', 'settingFileName.dat'
% Key-Value pair for choosing a settings file
... |
% In this file I hacked the code for the other settings. I made it so that
% for each day it summed together the results of four different simulations
% of a single class. Please see generate_spreadsheet.m for more detailed
% comments
clear
protocol_name{1}='I'; protocol_name{2}='II'; protocol_name{3}='III'; protoco... |
function CompLabel = getCompLabel(Models, idx)
CompLabel = [];
for i = 1:size(Models, 2)
if Models{i}.SearchIdx(idx)
CompLabel = [CompLabel, i];
end
end
if isempty(CompLabel)
error('The sample does not have a class...');
elseif numel(CompLabel) > 1
... |
% =====================================================================
% Code for conference paper:
% Qian Wang, Penghui Bu, Toby Breckon, Unifying Unsupervised Domain
% Adaptation and Zero-Shot Visual Recognition, IJCNN 2019
% By Qian Wang, qian.wang173@hotmail.com
% ==================================================... |
function [error, flag] = Linfty(v,w)
%Finfty determine the infinity norm btween two arrays
flag = true;
lenv = length(v);
lenw = length(w);
if lenv ~= lenw
error = 0;
flag = false;
return
end
error = 0;
for i=1:lenv
e = abs(v(i) - w(i));
if e > error
error = e;
end
end
end
|
clear
clc
a=[2 1 -2;1 -2 1;1 3 -2]
b=[0;5;-3]
for i=1:3
mi=a;
mi(:,i)=b
c=(a(i,i)*a(2,2)*a(3,3))-(a(,3)*a(2,2)*a(3,1))
end
mi(:,i)/c |
VERBOSE = 0;
PURGE = 0;
RESULTS_DIR = fullfile('test_suites', 'basic');
rmdir(RESULTS_DIR, 's');
mkdir(RESULTS_DIR);
circuits = {
{@load_rommes, 'r_network_int46k_ext8k_res67k_public'}, ...
{@load_rommes, 'r_network_int48k_ext8k_res75k_public'}, ...
{@load_rommes, 'r_network_int50k_ext4k_res94k_public'}, ... |
rdata = prnist([0:9],[1:100:1000]);
a = my_rep(rdata);
w = pcam([],0.85) * ldc;
w = a*w;
e = nist_eval('my_rep', w) |
clear all; clc
%%%%specify which initial condition, method,
%%%%and data set we're compating
IC_str = '_front';
num_meth = 1;
m = 16;
%load best-fit params, data, and initial condition
load(['advection_rates_autoreg' IC_str '_IC_all.mat'])
load(['advection_art_data' IC_str '_all.mat'])
phi = IC_spec(IC_str(2:end));
... |
function s = sigma(snr_db)
[~, w] = size(snr_db);
s = zeros(1,w);
for i=1:w
s(i) = 10^(-1/2*log10(2) - 1/20*snr_db(i));
end
end |
function docNode = create_bot_xml_node(docNode,bot_xml,bot_fmt_ver)
% input parser
p = inputParser;
addRequired(p,'docNode',@(docnode) isa(docNode,'org.apache.xerces.dom.DocumentImpl'));
addRequired(p,'bot_xml',@(x) isstruct(x));
parse(p,docNode,bot_xml);
% initialize bottom node element
bottom_node = docNode.createE... |
function [V,WW] = compute_W(V,b,umask)
ONE = ones(size(V,1),size(V,2));
ZERO = zeros(size(V,1),size(V,2));
MASK2 = repmat(umask(:,:,1),1,1,2)==1;
MASK4 = repmat(umask(:,:,1),1,1,4)==1;
B1 = b{1}.*ONE;
B2 = b{2}.*ONE;
W1 = cat(3,ONE,ZERO,ZERO,ONE);
WW = cat(3, B1.^2.*V(:,:,1).^2 + B2.^2.*V(:,:,2).^2,...
... |
function [x_min_m, f_min_m, f_vals, runtime] = WingsuitFlyingSearch(fun, n, bounds, N, M)
% --------------------------------------------------------------------------
% Wingsuit Flying Search algorithm
% Inputs:
% 'fun' - function needs to be minimized
% 'n' - dimensionality of the sear... |
function tf = containsRegexp(str, exp)
%containsRegexp True if string contains regular expression
% TF = containsRegexp(str, exp) returns true if the string str contains the
% regular expression exp. If str is a cell array of strings, then
% containsRegexp tests each string in the cell array, returning the r... |
function s = tcn_dls(p,t)
%TCN_DLS - Constant head and no-flow parallel boundaries
%
% Syntax: s = tcn_dls(p,t)
%
% p(1) = xd
% p(2) = yd
% p(3) = dd
%
% provides the dimensionless drawdown at reduced time t
%
% See also: tcn_drw, tcn_std
xd=p(1);
yd=p(2);
dd=p(3);
t=0.25./t;
rd2=1./(xd.^2+yd.^2);
s=expint(t)... |
function z=multipole(fname,L,PolynomA,PolynomB,method)
% MULTIPOLE('FAMILYNAME',Length [m],PolynomA,PolynomB,'METHOD')
% creates a new family in the FAMLIST - a structure with fields
% FamName family name
% Length length[m]
% ElemData.PolynomA= skew [dipole quad sext oct];
% ElemData.PolynomB= normal [dipole qua... |
function solution = solve_stokes(problem)
solution.problem = problem;
% set up right hand side
z = problem.domain.z;
nsrc = length(z);
rhs = [real(problem.boundary_conditions(z));...
imag(problem.boundary_conditions(z))];
if problem.periodic
% add pressure constraint
rhs = [rhs; problem.pressure_gr... |
%clc;
clear;
close all;
delete(instrfindall);
%a=arduino('com12','leonardo');
a=[];
comport=serial('COM11', 'Baudrate', 9600);
fopen(comport);
x=int16.empty(1000,0);
y=int16.empty(100,0);
z=int16.empty(100,0);
t=0;
for g=1:50
if(strcmp(fscanf(comport,'%s'),'BEGIN')==1)
break;
end
end
if (g==50)
d... |
function [thetaN, phiM] = EchantillonAngle(rangeVertical, rangeHorizontal, N, M, n, m)
thetaMin = rangeVertical(1);
thetaMax = rangeVertical(2);
phiMin = rangeHorizontal(1);
phiMax = rangeHorizontal(2);
thetaN = thetaMin + ( ( (thetaMax - thetaMin) / (2 * N) ) * (2 * n - 1) );
phiM = ph... |
function makesubsequence
[filename dir] = uigetfile('*.mat', 'Please select savefile');
load([dir filename]);
numstacks = length(savedata.state);
disp(['Which stacks do you want to include in the new savefile? (' int2str(numstacks) ' total)']);
choice = input(['Use array notation (e.g. [1,2,4,5] or [1:4]) >>']);
... |
N=2^16;
n=1:1:N;
y1=cos(2*pi*n/N+pi/4);
y2=0.5*cos(4*pi*n/N);
y3=0.25*cos(8*pi*n/N+pi/2);
y4=y1+y2+y3;
y1fft=2*fft(y1)/N;
y2fft=2*fft(y2)/N;
y3fft=2*fft(y3)/N;
y4fft=2*fft(y4)/N;
fz=angle(y4fft)/pi;
fz(2)
figure
subplot(2,2,1);
stem(angle(y1fft)/pi);
xlabel('Numer pasma czestotliwosciowego');
ylabel('Faza [pi x rad]');... |
function [x, n] = adapted_filter (S, Sref)
x = fxcorr (S, Sref);
[m, n] = max (x);
n = n - length (Sref);
|
% Invertable analysis
n=-5:1:5;
x1=[zeros(1,4) 1 zeros(1,6)]
y1=[zeros(1,11)]
x2=[zeros(1,2) 1 zeros(1,8)]
y2=[zeros(1,11)]
subplot(2,2,1);
stem(n,x1);
title('1.4(g3)-1');
xlabel('x_1[n]=δ[n+1]');
subplot(2,2,2);
stem(n,y1);
title('1.4(g3)-2');
xlabel('y_1[n]');
subplot(2,2,3);
stem(n,x2);
title('1.4(g3)-3');
xlabel... |
function trans = createRotation(varargin)
%CREATEROTATION Create the 3*3 matrix of a rotation.
%
% TRANS = createRotation(THETA);
% Returns the rotation corresponding to angle THETA (in radians)
% The returned matrix has the form :
% [cos(theta) -sin(theta) 0]
% [sin(theta) cos(theta) 0]
% [0 ... |
function [T,I,Y]=perfusionResponsepotent2P2X4rev(y0,ton,toff,Ttot)
ode=modelODEpotent2P2X4rev(ton,toff);
[T,Y]=ode15s(ode,[0 Ttot],y0,odeset('NonNegative',1:21));
I=getTotalCurrentpotent2P2X4rev(Y);
end |
%
% Classe pour traiter les erreurs rencontrées
%
classdef CQueEsEsteError
methods (Static)
%---------------------------------------------------
% On formatte les messages d'erreur pour l'affichage
%--------------------
function disp(erreur)
% On commence par décortiquer la variab... |
%% Saved variable
load('sparsePrior.mat');
load('inputImage_128.mat');
dataBaseDir = getpref('ISETImagePipeline', 'dataDir');
display = load(fullfile(dataBaseDir, 'CRT12BitDisplay.mat'));
%% Load display setup & constant
imageSize = [128, 128, 3];
thisImageSet = 'ILSVRC';
imageName = 'ILSVRC2017_test_00000021.JPE... |
classdef Until
properties
ST = SignalTransducer
p1
p2
q
end
methods
% Constructor
function obj = Until()
obj.p1 = 'p1';
obj.p2 = 'p2';
obj.q = 'q';
obj.ST.S = obj.set_states();
obj.ST.Lambda = obj.set_L... |
%% 12-23
% SVM for classify apnea for each subject
% brady deng
% Last editted by Brady deng in 2-28.
% Use 5-fold cross validation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc;
% clear;
% close all;
%% load data
% startmatlabpool(4);
%% Initial settings
N = 1;
P = 0.2;
tra... |
clear all
close all
%%%%%%
% Definition of Constants
%%%%%%
R=0.287; % Constant
PR = 20;
PR2 = 113;
%%%%%%%%%%%%%
% Calculations of the Vapor Dome for the Refridgeration Cycle
% Will be plotted as a T-s and P-h Diagram
% Two curves will be plotted for each graph, one for the Saturated Liquid and one for Saturdat... |
function MedianBackground=MedianFilter(x,y,order)
if mod(order,2) == 0
order=order+1; %force odd order
end
MedianBackground=zeros(length(x),1);
for i=1:1:length(x)
first=i-((order-1)/2.0);
first_append=[];
last_append=[];
if first<1
first_mea... |
function ret = gausswin(Nech, a)
% wheelmoves.gausswin()
% equivalent behaviour as the sigproc function
if nargin <=1, a=2.5; end
x = linspace(-1,1,Nech)';
ret = exp(-0.5 .* (a.* x).^2) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.