text stringlengths 8 6.12M |
|---|
%function [X,Y,V]=extract_pointlist(Im,bdsz,emin)
%
% Extract list of coordinates of local peaks
% in corner image Im.
%
% BDSZ Border size. Points closer than BDSZ to
% border are neglected. (default 10)
% EMIN minimum energy required as fraction of
% highest energy in Im (default 0.05)
%
%Per-Erik... |
function dp = backprop(dz,w,p,z,param)
%DIST.BACKPROP Backpropagate weighted input derivative to input
% Copyright 2012-2015 The MathWorks, Inc.
[S,Q,N] = size(dz);
R = size(p,1);
if isa(dz,'gpuArray')
dp = iGPU(dz,w,p,z,R,S,Q,N);
else
dp = iCPU(dz,w,p,z,R,S,Q,N);
end
end
function dp = iCPU(dz,w,p,... |
function [aqi_per_cell]=firstguess_aggregated_scenario_mode(emiTMP, aggregationInfo, commonDataInfo, aqiIndex, seasonIndex)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%ANNS CONSIDERED
%NN=nnSuperSet(ii).nnSet(jj);
%save('C:\data\work\projects\riat\RiatPlus-v6.1b\datasave\sa_start_fix', 'emiTMP','NN');
p... |
function [Fac, c, F_est,loss] = AutoTen(X,Fmax,strategy)
%Vagelis Papalexakis - Carnegie Mellon University, School of Computer
%Science (2015-2016)
%strategy = 1--> choose the loss that gives maximum c, among the "best"
%points
%strategy = 2--> choose the loss that gives maximum F, among the "best"
%points
allF = 2:... |
function [W1,W2,emit] = backpropagate(target,data,W1,W2)
%[W1,W2,emit] = backpropagate(target,data,W1,W2) conducts the
%backpropagation of the neuro net.
%target is the desired output set for learning
%data must be after standarization.
%W1: (d+1) by h matrix, contains current weights from input to hidden
%W2 ... |
function Gooselab(path_in, path_out)
% Gooselab analyzes a video of human skin for the intensity of goosebumps. Type Gooselab to start the GUI.
% You can also use the command line functionality and analyze all videos located in one directory.
% A csv is exported for each analyzed video in the specified output fold... |
% STANDARDMIXTUREMODEL returns a structure for a two-component mixture model
function model = StandardMixtureModel_Kappa()
model.name = 'Standard mixture model (kappa)';
model.paramNames = {'g', 'K'};
model.lowerbound = [0 0]; % Lower bounds for the parameters
model.upperbound = [1 Inf]; % Upper bounds for the pa... |
% This function generates linear cut queries of a given size. The
% 'cut_size' argument specifies how large each subset from each half of the
% bipartite graph should be (they are the same in our setup).
% Input:
% num_queries: The number of queries to generate
% num_nodes: The number of nodes in one half of the b... |
function varargout = plotsparsemarkers(varargin)
%
% [h =] plotsparsemarkers(hp, hl, markerStyle[, numberOfMarkers = 6 [,staggered = true]])
%
% Adds only a limited number of markers to a set of lines given by
% the handle array hp. If hl is not [] it should be the handle of
% the legend corresponding to the... |
load kin8nm
data = kin8nm(:,1:8);
label_true = kin8nm(:,9);
clear kin8nm
|
function [correlation] = calculate_correlation(matrix, angle)
% Calculates the correlation between a matrix and the matrix rotated by a
% specified angle
% How much the matrix was expanded by (look at find_central_field line 18
% or calculate_spatial_periodicity line 14)
expand = 3;
% Rotates rate map. Also resolves ... |
function status = DAQmxCreateCICountEdgesChan(taskHandle,counter,nameToAssignToChannel,...
edge, initialCount, countDirection)
[status,a,b]=calllib('mynidaqmx','DAQmxCreateCICountEdgesChan',taskHandle,counter,...
nameToAssignToChannel,edge, initialCount, countDirection);
|
function [figsize,figborders]=getfigdim(figh)
% [figsize,figborders]=getfigdim(figh) GET FIGure DIMensions.
% Function creates a figure and then measures the appropriate values to
% obtain border widths and heights of the menu and tool bars and other
% parameters. This can then be used to size and place fig... |
function nsigma = covfixer2(sigma);
%COVFIXER2 - force matrix to be a valid covariance matrix
%
% covmatrix = COVFIXER2(matrix)
% Matrix is forced (complex conjugate) symmetric,
% positive definite and its diagonal real valued.
%
% V_0_1
% covfixer2.m,v 1.7 2004/02/25 13:21:56 paalanen Exp
% Copyright 2003, Pekka Pa... |
function [vals] = PixelWidth(myImg)
img = imread(myImg);
%img = dither(img);
img = double(img);
[r c] = size(img);
arr = zeros(1,r);
for i = 1:r
x1 = img(i,:);
matlabfourier;
arr(i) = max(X2);
% arr = zeros(1,50);
% for i = 150:200
% x1 = img(:,i);
% x1 = transpose(x1);
% matlabfourier;
% ar... |
function g=training()
i=0;
%g=zeros(1440,5);
while(i<50)
d=input('Enter number 0\n');
if(d==0)
i=i+1;
fprintf(' wait for 2 sec %d\n',i);
f=getit();
g(:,i)=f(:,1);
g(:,50+i)=f(:,2);
end
end
end |
function [output] = scale1(I, Width, Height)
img = imread(I);
[row,col] = size(img);
%确定缩放比例
ratioH = Height/row;
ratioW = Width/col;
output = zeros(Height,Width);
%拓宽矩阵,赋值,处理边界
temp = zeros(row+2,col+2);
%拷贝原矩阵
for x = 1:row
for y = 1:col
temp(x+1,y+1) = img(x,y);
end
end
%边界处理
for y = 1:col
temp(1... |
function [xs,ys,zs,data3d] = make_sure_positive(xs,ys,zs,data3d)
%
% [xs,ys,zs,data3d] = make_sure_positive(xs,ys,zs,data3d)
%
% Make sure the image and the voxel coordinate be positively increasing. If not, then flip it
% Deshan Yang, PhD
% Department of radiation oncology
% Washington University in Saint Lou... |
function [Ampl,Mu,Sigma,gof] = calibrateEvaluateBins( bins, nameOfTrials)
numOfTrials=length(bins);
numOfBins=size(bins{1},2)+4;
%nameOfTrials=-800:50:800;
xaxisFit=-950:100:950;
Ampl=zeros(numOfTrials,64);
Mu=zeros(numOfTrials,64);
Sigma=zeros(numOfTrials,64);
figure(2);
clf;
for trial=1:numOfTrials
bins2 = [zer... |
function playp(img)
%PLAYP Summary of this function goes here
% Detailed explanation goes here
figure(12);
[h, w, d, c] = size(img);
for i = 1:d
figure(12);
slice = squeeze(img(:, :, i, :));
slice = slice ./ max(slice(:));
imshow(slice); title(i);
pause();
end
end |
% This functions is being called from ReadNewScans.m or UpdateShortInfos.m
function Out=Infos2ShortInfos(Infos)
FNs=fieldnames(Infos);
ShortFields={'SeriesInstanceUID','Filename','FileModDate','StudyDate','SeriesDate','StudyTime','SeriesTime','SeriesDescription','PatientName','PatientAge'};
ShortFields=[ShortFields 'R... |
function [ fr,FC,RC ] = Fr( VarName1,VarName5,VarName6 )
%通过Fr算出每个地点的语义信息向量
%传入导数为VarName1,VarName5,VarName6
clc;
D=length(VarName1) %所有地点
R=cat(2,VarName5,VarName6 ); %连接VarName5,VarName6,大小为(length(VarName5),2)的矩阵
FC=zeros(length(VarName1),4);
num_k=zeros(1,4);
RC=zeros(length(VarName1),4);
z=[]; %储存粗细类别所出现的所有字眼
... |
function cleanmacpollution(loc)
%CLEANMACPOLLUTION deletes the annoying search trace files generated by MAC.
% CLEANMACPOLLUTION(WHERE) deletes the annoying search trace generated
% by MAC OS for all subdirectorys under WHERE.
%
% MAC OS has the bad habit of creating garbage finder data file in every
% di... |
function ZeroRates = par2zero(ParRates)
% =========================================================================
% Bootstraps from Par Rates to Zero Rates (Spot Rates)
% INPUT:
% ParRates - matrix of par rates (yield curve in rows) in decimal form
%
% OUTPUT:
% DiscountFactor - ... |
function main_lasso()
%% Load Data
% input and output directories
dataset_dir = 'att_faces';
result_dir = 'output';
if ~exist(result_dir, 'dir')
mkdir(result_dir);
end
% collect face data
traindata_file = fullfile(result_dir, 'traindata.mat');
im_shape = [112, 92];
if ~exist(traindata_file, 'file')
[train_data... |
function [fAnd,phi] = getAnd(formula, k)
global x Z;
% time horizon
h = size(x{1},2)-1;
if strcmp(formula.type, 'tp')
formula.args = {formula};
end
m = length(formula.args);
z = [];
fAnd = [];
for k = 1:h
[fLTL,zLTL] = getLTL(formula.args{1}, k);
z = [z;zLTL];
fAnd = [fAnd, fLTL];
end
if m > 1
... |
function [D,RD] = ML_tleGetMatrixOfDTW(X,tvwin,P)
% ML_tleGetMatrixOfDTW - calculates matrix of DTW distances
% Author : Michal Lewandowski
% Kingston University of London
% Digital Imaging Research Centre
% m.lewandowski@kingston.ac.uk
N=size(X,1);
D=zeros(N,N);
... |
%Leave-one-out cross validation is implied on TPGLDA
str = load(['.\1.miRNA-disease association\knowndiseasemirnainteraction.txt']);
[~,disease]=xlsread(['.\1.miRNA-disease association\disease name.xlsx']);
[~,miRNA]=xlsread(['.\1.miRNA-disease association\miRNA name.xlsx']);
% nd:the number of diseases
% nm:the numbe... |
% function [getRHS] = computeRHS_Pseudo(v, nu, Nx, Ny, Lx, Ly,x,y,t)
%
%
% This function computes the RHS of 2D Burger's equation in the case of
% pseudo-spectral Fourier-Galerkin method.
%
%
% Compute RHS: du = -uu_x-vu_y + nu (u_xx+u_yy) + MMS-term
%
%
%
% Author: Diako Darian
% Date: 11.07.2015
... |
clear
% kappa test calc
plot_name=['figure kappaCCN combinded'];
%
dots_size=20;
sets=3;
% set 1
load('DATA for figure kappaCCN mid O2C.mat', 'Dp_sim_nm', ...
'Molar_mass', 'O2C_value', 'Diameter_total', 'SatRatio', 'kappa', 'a_w', 'alternate',...
'index_phase_sep_starts', 'index_phase_sep_end','S... |
%CHECKJACOBIAN Check analytical Jacobian against finite difference approx.
% checkJacobian calculates the analytical Jacobian for a 2-D problem and
% estimates it using forward finite differences.
addpath('div_free');
%% Evaluate FD Jacobian?
fd = true;
while true
fd_str = input('Evaluate FD Jacobi... |
% % % % % SIDEBAR
function sB = sideBar(h)
parent = h.fig;
% h.iter = guidata(h.fig);
sB.buttonLoad = uicontrol(... % Load game state from file
'Parent', parent,...
'style','pushbutton',...
'Units','Normalized',...
'position', [.8 .9 .15 .05],...
'... |
function [bool]=verificacion(x,y)
[x1 y1 x2 y2 x3 y3]=cte;
bool=triangulo(x1,y1,x2,y2,x3,y3,x,y);
end
|
function [overall,accuracy,error,classifiedrate] = thirdgcnn(xtrain,ytrain,xtest,V,nclass,classes)
%xtrain and xtest are data, ytrain onehotencoded (0.1,0.9) labels
%classes class information to calculate fmeasure
%V calculated smoothing parameter
%nclasses #ofclasses
[m,n] = size(xtrain); %m #of features, n #of ele... |
% $URL$
% $Date$
% $Rev$
function graph_curves_aveiter(aves, axistitle)
% Declare the global variables.
global nsnrs axis_iter axis_snr_text;
% Plot the curves.
for s = 1:nsnrs
plot(axis_iter, aves(s,:));
if s < nsnrs
hold all;
end
end
% Make the labels and legend.
title(axistitle);
xlabel('Maximu... |
%Assigment Code for FEM
%by Hari Prasad Radhakrishnan - 61492
tic()
%_________________________________INPUT________________________________________
%selecting mode
%mode 1 = calculating elastic convergence
%mode 2 = calculating elastic + plastic strains
mode = 2; %Enter 'mode' value either 1 or 2 accordingly
%D... |
% pauseDisplay(obj)
% Temporarily stops the dynamic update of the plot (the generator function
% is not called while the dynamic plot is paused).
%
% Also see: resumeDisplay
%
function pauseDisplay(s)
s.checkValidity();
tobj = s.getTimerObject();
stop(tobj);
|
clear all
close all
clc
global path_img path_save format_img;
% the tools used in algorithms are configured in the config_tool.m
run('config/config_tool');
% the parameter of algorithms is configured in config_para
run('config/config_para');
format_img = 'jpg';
path_img = 'D:\dataset\dataset\dynamicBackground\c... |
% Representation of a sin wave. It is seen when there is alliasing. It is
% when the frequancy is smaller than the nyquist frequency: the sin
% corresponds to the one at another frequency because of sampling errors.
f=50; % "frequency" of square wave
time=100; % length of time
T... |
function mic_per_degree = MICRONS_PER_DEGREE(species_or_size)
% I am converting from Macaque to other species with a geometric
% argument based on the eye's diameter.
%
% Macaque diameter = 18mm, 200um per degree
% Salamander diameter = 4mm, -> 200*4/18 um per degree = 44um per degree? Bipolar cell... |
function [ vertices ] = multiplyVertsByMatrix( vertices, matrix )
%MULTIPLYVERTSBYMATRIX Summary of this function goes here
% Matrix should be homogeneous, vertices - not
%%apply rotaion matrix to all vertices
vertSize = size(vertices);
for i = 1 : vertSize(1, 1)
%%to homogeneous
newV = [vertices(i, :), 1];... |
%% Init
clc;
clear;
close all;
%% Import Data
Fixpunktkalibration = importfile('../Fixpunktkalibration.csv');
%% Fixpunktkalibration
x = Fixpunktkalibration.Scan; %D
y = Fixpunktkalibration.RefC;
M = mean(Fixpunktkalibration.RefC(300:421));
S = std(Fixpunktkalibration.RefC(300:421));
offset = M-0.01;
%% plot Data
fig... |
function [tkcurrentkeep y_predictedkeep SHIFT] = fixTime(TESTINGCYCLE_DATA,n,PREDICTION_INTERVAL,filtered,y,NUMBER_ENSEMBLE_MEMBERS)
%,ThermalSunrise,tHorizon)
NUMBER_ROW = size(TESTINGCYCLE_DATA,1);
NUMBER_COLUMN = size(TESTINGCYCLE_DATA,2);
SHIFT = []; %shift at start of each cycle
%SHIFT = zeros(NUMBER_ROW... |
% Assignment1 page20
clc;
clear all;
close all;
% Passband and Stopband edge frequencies
fp=2000;
fs=4000;
%Sampling frequency
Fs=20000;
% Normalising to half the sampling frequency
fn=Fs/2;
% cut off frequency (normalizes to fn)
fc=(fs+fp)/2/fn;
%normalized transition width
tw=abs(fs-fp)/Fs; % holds good for both LPF ... |
function X=forward_substitution(Ag)
[r,c]=size(Ag);
r=c-1;
X=zeros(1,c-1);
X(1)=Ag(1,c)/Ag(1,1);
k=1;
for i=2:r
temp=0;
for j=1:k
temp=temp+Ag(i,j)*X(j);
end
k=k+1;
X(k)=(Ag(i,c)-temp)/Ag(i,k);
end
end |
function out = im2col3(I_pad,sz_filt)
%IM2COL3 Summary of this function goes here
% Detailed explanation goes here
p_a=floor(sz_filt(1)/2);
p_b=floor(sz_filt(2)/2);
p_c=floor(sz_filt(3)/2);
sz_I_pad=size(I_pad);
A=sz_I_pad(1);
B=sz_I_pad(2);
C=sz_I_pad(3);
i_f=A-2*p_a;
j_f=B-2*p_b;
k_f=C-2*p_c;
col... |
% TRABAJO PRACTICO N2
%% EJERCICIO 1
tamanio_muestra = [10 100 1000 10000 100000];
sigma = 10;
mu = 2;
valores = zeros(100000, 5);
monte_carlo = 100000;
j = 1;
while j < monte_carlo
for n = 1:numel(tamanio_muestra)
D=randn(1,tamanio_muestra(n))*sigma + mu;
mu_estimado = sum(D)/tamanio_muestra(n);... |
function computePhaseMap(F, per, on)
%computePhaseMap is an alias function for phasemap per pixel / per neuron
switch on
case 'dff'
switch per
case 'neuron'
phaseMapNeuron_v2(F);
case 'pixel'
phaseMapPixel_PerPackage_v5(F);... |
function dydt = ASFModelSpainDEG(t, y, feeding, dw)
dydt = zeros(8,1);
%%% Spanish model for ASF but where the degradation rate of carcasses can
%%% be adapted. dw is a variable describing the length of time a carcass is
%%% in the environment in weeks. i.e. dw = 2 represents carcass degradation
%%% of 2 weeks.
... |
%--------------------------------------------------------------------------
% SCRIPT: dynamics.m
% AUTHOR: Adam Zufall & Hridu Jain
% DATE: April 23, 2019
% NOTES:
% Dynamics v2
%--------------------------------------------------------------------------
clc; clear all; close all;
%% Initialize
e_o = [0; 0; 0]; ... |
%% Generates efficiency heat maps for Figure 2. Daniel West 2020
close all; clear all; clc
% 1.5T actual parameter set.
T1x = [650 1000 6.5]*1e-3; T2x = [80e-3, 12.5e-6]; delta = 0.65;
k = 65; M0s_Varma = (7.3*(1/T1x(1)))/k; M0s = M0s_Varma/(1 + M0s_Varma);
M0f = 1-M0s; M0 = [M0f M0s*(1-delta) M0s*delta];
ihMT_Param... |
%in barnamei baraye NEGATIVE KARDANE RGB ast,BARAYE
%EJRAYE BARNAME HAME BARNAME RA ENTEKHAB KARDE(Ctrl+A & Ctrl+C)VA DAR Command
%Window MATLAB PASTE KONID.
clc
clear all;
close all;
Img_in =imread('2.tif');
Img_in=im2double(Img_in);
figure;imshow(Img_in);title('tasvire vorudi');
%estekhraje RGB
R = Img_in(:,:,1);
G ... |
% Test mjXX vs jXX
cfun = {...
'jam(x,k) / mjam(x,k^2)',...
'jcd(x,k) / mjcd(x,k^2)',...
'jcn(x,k) / mjcn(x,k^2)',...
'jcs(x,k) / mjcs(x,k^2)',...
'jdc(x,k) / mjdc(x,k^2)',...
'jdn(x,k) / mjdn(x,k^2)',...
'jds(x,k) / mjds(x,k^2)',...
'jnc(x,k) / mj... |
% myFavourite
% asks for my favourite TV show and displays it nicely
TVshow = input('What''s your favourite TV show?','s');
if (isempty(TVshow))
%no favourite TV show
disp('You don''t have one? I guess there is a lot to choose from!');
else
%displays favourite TV show
fprintf('%s is y... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Implementación del algoritmo de wang y Brady
%para la deteccion de esquinas en una imagen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Se carga la imagen a detectar las esquinas.
Iorig = imread('Imagenes/iglesia san geronimo.jpg');
%Se convierte en tipo de dato double pa... |
addpath(genpath('/media/thiago/EXTRALINUX/Upwork/code/pg_prediction/CV/'));
addpath(genpath('/media/thiago/EXTRALINUX/Upwork/code/pg_prediction/legacy/'));
addpath(genpath('/media/thiago/EXTRALINUX/Upwork/code/pg_prediction/mgPlsda'));
res = compiler.build.standaloneApplication('/media/thiago/EXTRALINUX/Upwork/code/pg... |
function [x, timing] = blendenpik(A, b, params)
% [x, timing] = blendenpik(A, b, params)
%
% Solve the equation x = arg min norm(A * x - b, 2)
% using Blendenpik.
%
% "params" - parameters governning the method.
% params.type - type of mixing transform. Optional values: 'DCT', 'DHT', 'WHT'.
% Defa... |
function [graph] = trPlot(spice, signal, sweep)
tam = size(spice.signals);
for i=1:tam(1,1)
str = spice.signals(i,1);
if strcmp(signal, str)
s = (i + 1);
break;
end
end
if nargin == 3
t = spice.v... |
%% Test methods in Flywheel.m
%% Setup
disp('Setup')
% Before running this script, ensure the following paths were added
% path to Flywheel.m to be tested
% path to JSONlab
% set SdkTestKey environment variable as user API key
% ex: setenv('SdkTestKey', APIKEY)
% Create string to be used in testdrive
testS... |
clr;
gitdir;
cd 'ImageJointUnderstanding/src'
[dp, cp] = get_project_paths('ImageJointUnderstanding');
%% Load the image collection.
image_folder = [dp 'Rubinstein_CVPR_13/Data/Airplane100/'];
images = load_images(image_folder, 'jpg');
gts_folder = [image_folder 'GroundTruth/'];
gts = load_images(gts_fo... |
function centroids = getCentroids( image_t, picks, nhood )
% Find weighted center of each peak for more accurate PSF overlap detection.
% imdilate+regionprops works for this, but tends to merge nearby peaks.
% FIXME: when operating on a flat (zero) signal, gives NaN values. This should
% instead just return the input, ... |
function [f, inliers,e1,e2] = ransacfund(x1,x2,t,feedback)
%x1 and x2 are 3byn homogenous 2d points.
%F - The 3x3 fundamental matrix such that x2'Fx1 = 0.
%inliers - An array of indices of the elements of x1, x2 that were the inliers for the best model.
if nargin == 3
feedback = 1;
end
[X1,T1] = nor... |
clear all; clc;
logger = handler(emptyLogger);
diaryFile = ['optimizeParameterGo_' strrep(datestr(now),':','-') '.out'];
diary(diaryFile)
disp('Optimization of parameters for GO started.');
% leave out one sixth as test, rest as train
for split = 1:6
splits = 1:6;
setNumTrain = dtuSplitSets(6,splits(splits ~= ... |
function varargout = Dilate_Surface_Label(varargin);
%
% Syntax :
% [dilLabels] = Dilate_Surface_Label(Surf, surfLabels, opts);
%
% This function dilates labels throughout a specified surface.
%
% Input Parameters:
% Surf : Surface variable (file, struct or cellarray).
% surf... |
function [ num1, num2 ] = myconvert( str )
% Function to convert the vector string to numbers
% By Kyriakos Tsourapas
% You may contact me through the Mathworks site
% University of Essex 2002
% CREATE THE NUMBERS FROM THE STRING
sign1 = str(1);
intpart1 = sprintf('%d%d', str(2:3));
decpart1 = sprintf('%d%d%d%d%d... |
cd C:\shared\greg_ssvep ; ls
ssveps = dir('*vhdr') ;
for s=1:length(ssveps)
g1 = pop_loadbv('.',ssveps(s).name) ;
g1 = pop_resample(g1,256) ;
if s>1 ; merged = pop_mergeset(g1,merged) ; else merged = g1 ; end
end
mergefilt = merged ;
mergefilt.data = eegfiltfft(merged.data,merged.srate,15,17) ;
ep = p... |
54 path=a20老化软件_20161102/QMain/2016/2/5/num.m
27 atime=1478064298.871178
|
% Gauss-Seidel
% Lucas Zanovello Tahara
% 19/03/2019
% Cálculo Numérico Computacional
% Referência: RUGGIERO, M.A.G., LOPES,V.L.R., Cálculo Numérico – Aspectos teóricos e Computacionais, 2a
%edição, MAKRON Books, 1996.
% Limpando tela e variáveis
% clear all; clc; close all;
% Inserindo as matrizes A, b, ... |
clc
close all
clear all
% Minimum frequency seperation between two sinusoidals
fs=100;
T=1;
ts=1/fs;
t=[0:ts:T];
% with random phase
f1=1;
f2=2;
phi = 2*pi*rand; % uniformly distributed from 0 tp 2pi
s1=cos(2*pi*f1*t+phi);
s2=cos(2*pi*f2*t);
sum_with_phi_random=sum(s1.*s2);
% with zero phase differ... |
classdef PduImpl < PowerEquipmentImpl
methods
function pdu = PduImpl(name, width, height, depth, positionX, positionZ, orientation, power)
pdu@PowerEquipmentImpl(name, width, height, depth, positionX, positionZ, orientation, power);
end
end
end |
function res = lik_CES(y,X,gamma,h)
%Verohodnostni funkce pro CES produkcni funkci
fx = gamma(1)*(gamma(2)*X(:,2).^gamma(4)+gamma(3)*X(:,3).^gamma(4)).^(1/gamma(4));
N = length(y);
log_res = -N/2*log(2*pi)+N/2*log(h)-h/2*(y-fx)'*(y-fx);
res = exp(log_res);
end
|
function [B] = inversa(A) % B = A ^ (-1)
[n n] = size(A);
if(n == 1) % inversa unei matrici de 1x1 e inversul unui nr
B = 1/A;
return ;
end
if(n == 2) %pentru matricile care nu contin zerouri nu e nevoie de cazul asta
B = (1 / (A(1, 1) * A(2, 2) - A(1, 2) * A(2, 1) ) ) * [A(2, 2) -A(1, 2); -A(2, 1) A(1,... |
function usQ=union_stableQ(cs)
% UNION_STABLEQ returns 1 whenever a coalition structure cs is
% union stable.
%
% Usage: usQ=union_stableQ(cs)
%
% Define variables:
% output:
% usQ -- Returns 1 (true) or 0 (false).
% input:
% cs -- A communication situation like [3 5 6]
% for {[1,2],[1 3],... |
function Decoder(infile, outfile)
import io.* motion.* quantize.* transform.*;
% Read compressed file header
[packetSize, blockSize, numBins, rCounts, mvCounts, bytesRead] = readHeader(infile);
% Various Dimension Calculations
height = packetSize(1);
width = packetSize(2);
frameSize = [ height width ];
residualsSiz... |
function status = XuGenAngleJsonc(ima_file_name, s_jsonc)
%status = XuGenAngleJsonc(ima_file_name, s_jsonc)
status=0;
recon_para = XuReadJsonc(s_jsonc);
raw_data_folder=recon_para.RawDataFolder;
%% read dicom header and get the angular info
if exist([raw_data_folder ima_file_name],'file')
dicom_header = dic... |
function SimWM_MakeMovie(inp_filestr, varargin),
%% Process optional inputs
opts.DownSample = 1; %whether to downsample in time
opts.SimNumToPlot = 1; %which simulation run to plot
%Process optional inputs
if mod(length(varargin), 2) ~= 0, error('Must pass key/value pairs for options.'); end
for i = 1:2:length(vararg... |
function obj = registersequence(obj, sequence)
% register sequence with device
if ~isa(sequence, 'alpsequence')
return;
end
% scan sequences array to avoid doubled entries
for si = 1:length(obj.sequences)
if isequal(obj.sequences(si), sequence)
return;
end
... |
function [ H, inlierIndices ] = homography( matchingPoints1, matchingPoints2 )
nIterations = 150;
subsetSize = 4;
inlierDistanceThreshold = 10;
minInlierRatio = .3;
[H, inlierIndices] = ransac(nIterations, subsetSize, inlierDistanceThreshold, minInlierRatio, matchingPoints1, matchingPoints2);
... |
function rgb = powder_blue
rgb = [0.69019, 0.87843, 0.90196];
end |
function [color_map] = make_colormap(colorstart, colormid, colorend)
for i=1:3
first_half(:,i) = linspace(colorstart(i),colormid(i),50);
second_half(:,i) = linspace(colormid(i),colorend(i),50);
end
color_map = [first_half;second_half];
end |
clc
close all
clear all
T = readtable("nlfit.csv");
T = table2array(T);
x = T(2:end, 1);
y = T(2:end, 2);
pf = polyfit(x, y, 1);
subplot(2, 1, 1);
plot(x, y, "o", x, polyval(pf, x));
title("Current vs Voltage");
xlabel("Voltage");
ylabel("Current");
fprintf("Linear Equation: I = %4.4fV + %4.4f\n\n", pf(1), pf(2));
... |
function [s,E,F] = doubledecode(d)
% given double or int64 vector
%
% s = logical
% E = exponent biased (zero becomes: -1023 and special is 1024)
% F = mantissa (52bit right aligned)
%
% Emanuele Ruffaldi 2019
if isfloat(d)
d = double(d);
else
d = int64(d);
end
d=typecast(d,'int64');
s = d < 0;
maskM_e_low = bi... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Author: Hamza Bourbouh <hamza.bourbouh@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 [labels_onehot] = onehot(labels, cls_id)
% labels: 1 x N
% cls_id: 1xC, class identifiers (int)
% labels_onehot: C x N
labels_onehot = zeros(length(cls_id), length(labels));
for i=1:length(cls_id)
inds = find(labels == cls_id(i));
labels_onehot(i, inds) = 1;
end
end
|
%% ------------------------------------------------------------------------
function inputs = getCOCOBatch(imdb,opts, batch)
% -------------------------------------------------------------------------
opts.imageSize = [256,256];
filenames=imdb.images.filenames(batch);
lb_filenames=imdb.images.label_filenames(batch)... |
function partition = equalFrecuencyPartition(numGroups, data)
partition = ceil(numGroups * tiedrank(data) / length(data));
end |
function Res=lickPlot(Datadir,preTrialStart,postTrialStart)
%Datadir='/home/miluky99/Downloads/ChenQian/MouseShank3B_Dlx56_G6f-A3_08-Jan-2019';
if nargin <2
preTrialStart=1000; %% number of samples before trial start
postTrialStart=2000; %% number of samples after trial start
end
cd(Datadir);
sessionInfo=dir('... |
clc; clear all; close all;
i=imread('pout.tif');
e=histeq(i);
subplot(2,2,1)
imshow(i)
title('Normal Image')
subplot(2,2,2)
imshow(e)
title('Contrast improved Image')
subplot(2,2,3)
imhist(i)
title('Histogram of Normal Image')
subplot(2,2,4)
imhist(e)
title('Histogram of contrast improved Image')
|
function [criticalPathNodes] = calculateCriticalPath(resultGraph)
%CALCULATECRITICALPATH Summary of this function goes here
% Detailed explanation goes here
criticalPathNodes = find(resultGraph(:,3) == 0);
end
|
function cspy(S,epsilon)
% cspy Visualize sparsity pattern. coloring positive and negative entries of S
% in red and blue respectively
%
% cspy(S)
% cspy(S,epsilon)
%
% Inputs:
% S m by n (sparse) matrix
% epsilon zero value {0}
%
% See also: spy
%
if nargin < 2
epsilon = 0;
end
... |
function [X_Y_Z_Value, L] = RGB_to_XYZ(bitDepth, R_G_B_Value, M)
% Convert R'G'B' to X''Y''Z''
% DCI-P3 gamut / D65 white point / PQ EOTF
% Input:
% bitDepth - e.g. 8/10/12
% R_G_B_Value - e.g. [4095,4095,4095]
maxValue = 2 ^ bitDepth - 1;
R_G_B_Value = R_G_B_Value';
RGB = PQ_EOTF(R_G_B_Value, bitDepth);
XYZ = M * ... |
function out=DECISION_MAKER_3(predictions,meanErrorTree)
% out=DECISION_MAKER_3(predictions,train_binary_targets)
% Function that makes decision about predictions of ambigious classification results.
% If an example is classified as positive in more than one tree(or none), it
% finally chooses the tree tha... |
% Description: run convergence study tests
eqntyp = 'const_lin_conv';
spd_a.x = 0.5; spd_a.y = spd_a.x;
form = 'weak';
tf = 0.5;
type = {'omega','omega','omega'}; M = length(type);
p = {1,2,3};
fol = 'data/';
n = (2:4)'; N = length(n);
h = 1./(4*n);
for j=1:M
err = zeros(N,1);
SBP.p = p{j}; SBP.type = type{j... |
pkg load image;
useful_functions; # NB this needs to be included if video_analysis hasn't just been run
#
run_number = {{38,11,150},
{39,11,145},
{51,12,150},
{42,11,170},
{37,11,145},
{43,20,170}};
#}
#run_number = {{37,11,150},{53,11,150},{54,11,150},... |
%% TABLE GENERATOR OF THERMODYNAMICAL PROPERTIES OF NH3 USING CoolProp
%
% Version 4
% Initialization script
%
% To install CoopProp for Matlab, follow these steps:
% http://www.coolprop.org/coolprop/wrappers/MATLAB/index.html#pre-compiled-binaries
% Franco N. Ferrucci
% ferruccifranco@gmail.com
% Sept 2018
... |
img = imread("pollen.jpg");
sz = size(img);
width = sz(1);
height = sz(2);
m = zeros(width, height, "uint8");
v = zeros(1, 256, "uint8");
r1 = 90;
s1 = 10;
r2 = 150;
s2 = 120;
m1 = (s1 - 0) / (r1 - 0);
m2 = (s2 - s1) / (r2 - r1);
m3 = (255 - s2) / (255 - r2);
for i = 1 : r1
v(i) = 0 + m1 *... |
Q = p3*y2 + p4*y3;
Qs = Q*exp(100*(Q - p16))/(1 + exp(100*(Q - p16))) + ...
p16/(1 + exp(100*(Q - p16)));
% define derivatives of Q and Qs wrt five y's and 2 Q's
simplify(diff(Q,'y1'))
simplify(diff(Qs,'y1'))
simplify(diff(Q,'y2'))
simplify(diff(Qs,'y2'))
simplify(diff(Q,'y3'))
simplify(diff(Qs,'y3'))
simpli... |
function [maxLoss, worstLabeling] = getMaxSetHammingLoss(gtImage, alphaWeight, setNodeIndex, setNodeWeight, setSum, setWeight, objSeed, bkgSeed )
%getMaxSetHammingLoss function computes the maximum possible value of the following loss (w.r.t. Y):
% \Delta( Y, Y_true ) = \alpha * \Delta_Set(Y, Y_true) + (1 - \alpha) ... |
function compile_mex
%compile_mex compiles all the MEX-functions included in this package
%
% Anton Osokin
rootDir = fileparts( mfilename( 'fullpath' ) );
% IBFS GraphCut
if exist( 'graphCutMex', 'file' ) ~= 3
cd( fullfile(rootDir, 'graphCutMex_IBFS') );
build_graphCutMex;
cd(rootDir);
end
% compile the... |
% LogMAP与MAXLogMAP的比较
% 交织器长度:4000
% 迭代次数:5
%
clear
% 参数设置
frame_size=4000; % 帧长=交织器长度
interation_number=5;
ispunctured=0; % 0 unpunctured, rate 1/3 ; 1 punctured, rate 1/2
decodermethod=1; % 1 logMAP ; 2 Max-log-MAP
g=[1 0 1 1;1 1 0 1]; % 生成器向量,用于UMTS和LTE
[~,K] = size(g);
m = K - 1;
L_info = frame_siz... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.