text stringlengths 8 6.12M |
|---|
function [GlobalFace] = Step2_GlobalFaceShapeReconstruction(DataSet,Width,Height,Factor,PCAK,Lamda)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
MeanFace=CalculateMeanFace(DataSet,Width*Factor,Height*Factor);
TargetFaceROW=DataSet(1,:);
TargetFaceImage=reshape(TargetFaceROW,[Width*Fa... |
% Top of stack: r1
% Global vars: r2
% Accumulator 1: r3
% Accumulator 2: r4
% Current Frame size: r10
% Parameter passing: r11
% helper: r13
% Return value: r14
% Return address: r15
%
% start
entry
addi r1,r0,st % Initialize top stack address
% FrSz, =, (c, 0)
addi r3,r0,0
lw r3,cs(r3)
add r10,r0,... |
[t,i] = sort(d.s.time,1,'ascend');
d.mode = d.mode(i,:) ;
d.vde = d.vde(i,:) ;
d.fuel_left = d.fuel_left(i,:);
d.flow_rate = d.flow_rate(i,:) ;
d.thrust = d.thrust(i,:) ;
d.ISP = d.ISP(i,:) ;
d.t_from_per = d.t_from_per(i) ;
d.warm_starts = d.warm_starts(i,:)... |
%% defaults
fdiary = 'Main_script.log'
diary(fdiary)
disp('%%');
disp(['%% ' datestr(datetime)]);
disp('%%');
cd('/om/user/jkinney/lotus-recon/Code');
% paths
rectParamPath = '../../';
o_PSFfilePath = '../PSFmatrix/';
LFMPath = '../Data/01_Raw/';
o_rectImgPath = '../Data/02_Rectified/';
o_reconPath = [... |
function [targetStack,targetMean,targetStd] = getTargetMean(data,target,variable)
data2 = data(2:end,:); %Remove header first for simplicity with mat2cell
%create index for current target
tmpIndex = cell2mat(data(2:end,1));
idx = (find(tmpIndex == target));
%Read data
targetStack = cell2mat(data2(idx,variable));
ta... |
function [x_seg, finalCenterLocs] = seg_mtd4(x, l_min, l_max, step, W, T)
% MTD4 - metodo com janela deslizante para deteccao de BEP e EEP de segmentos
% utilizando threshold
%
% Argumentos: (para mais detalhes, refira a des... |
function prnatx=sat2prnatx(satatx,y,m,d)
%
% Function sat2prnatx
% ===================
%
% This function creates a variable with information related to absolute
% antenna offset and variation for each prn, for the given date
%
% Sintaxe
% =======
%
% prnatx=sat2prnatx(satatx,y,m,d)
%
% Input
% =====
... |
disp('Ejercicio 2--------------------------------------')
disp(aurea(@f2, -3, 3))
disp('Ejercicio 4--------------------------------------')
disp(aurea(@f4, -4, 2))
disp('Ejercicio 6--------------------------------------')
disp(aurea(@f6, -4, 2)) |
%%%
% This function simulates the source generation, precoding, transmission
% and deciding at receiver end.
% Parameters:
% InfDAC_Flag = 1; The flag that denotes whether 1 bit DAC is used
% ErrCha_Flag = 1; The flag that denotes whether channel estimation error exists
% Rob_F... |
function model = infer_network_coherence_zone( model,pc)
% Infers network structure using coherence + imaginary coherency;
% Employs a bootstrap procedure to determine significance.
%
% INPUTS:
% model = structure with network inference parameters
%
% OUTPUTS:
% -- New fields added to 'model' structure: --
% phase ... |
% Evalute paramters for GMM
% **** E MAX ****
Dist_test_alphat = {};
Dist_train_alphat = {};
num_outlier_alphat = {};
num_K_emax_alphat = {};
var_target = 77;
e_max_vec = 0.1:0.1:0.2;
iter = 1;
for d = 1:1%length(Data)
d
var_explained = var_explained_F2{1,d};
num_prin = 1;
while sum(var_e... |
%% LOADING DATA
clear; clc; close all
addpath('D:\course_work\amath582\hw3\data\')
C_1(3) = struct('data', [], 'results', []);
for jj = 1:1:3
temp = load(strcat('cam', num2str(jj), '_1.mat'));
temp1 = fieldnames(temp);
C_1(jj).data = temp.(temp1{1});
end
clearvars temp
%% TRACKING THE PAINT ... |
function output = propagate_forward(current, next)
next.values = sigmf(current.weights * current.values + current.bias, [1 0]);
output = next;
end |
function [stocks] = zadatak11(years, totalStocks)
n = length(years);
total_years = sum(years);
unit_stock = totalStocks/total_years;
stocks = round(unit_stock.*years);
end |
load JAN1941sample
data= JAN1941sample
lon=data(:,1);
lat=data(:,2);
depth=data(:,3);
kh=data(:,5);
ri=data(:,4);
mask=(ri~=-1.e30);
riavg=sum(ri.*mask)/sum(mask)
khavg=sum(kh.*mask)/sum(mask)
|
function [unit_long,unit_lat,long,lat,time_now,mesh_size,ign_pnt,bound]=read_file_ignition(data,wrfout)
% Volodymyr Kondratenko April 3 2012
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Input: data : String - data, that contains the name of the Text file.
% ... |
function finalData = clmDataPreprocessing(data)
%% normalize: subtract local mean from x and y vectors separately
%[~, dataSize] = size(data);
%
% for n = 1:dataSize
% meanX = mean(data(n).difference(:,1));
% meanY = mean(data(n).difference(:,2));
% stdX = std(data(n).difference(:,1));
% stdY = std(dat... |
function [mx,my,good] = getMidlineExt(avi,frames, varargin)
% function [mx,my,good] = getMidlineExt(avi,frames, hx,hy,n, ...
% width,len, maxang, ...
% options)
% or
%
% function [mx,my,good] = getMidlineExt(avi,frames, hx,hy, tx,ty, n, ...
% ... |
syms x y z;
eqn=[3*x+2*y-z==10 -x+3*y+2*z==5 x-y-z==-1]
vars=[x,y,z]
[x_,y_,z_]=solve(eqn,vars) |
function deltaGrad = deconv_spat_grad_bp(kernelF, deltaDeblur, lambda)
%%%%% only update grad
%%%%% gradxF and gradyF are global parameters which are defined in 'train'
global gradxF;
global gradyF;
denom = 1 ./ (lambda*kernelF.*conj(kernelF) +...
gradxF.*conj(gradxF) +...
grady... |
function [TA, CA] = run_segmentation(...
type, ...
spec, ...
swap, ...
p, ...
q, ...
r, ...
lim, ...
k, ...
K, ...
filename, ...
truth...
)
addpath('./preprocessing')
addpath('./pde')
addpath('./file_exchange')
addpath('./testing')
addpath('./clustering')... |
clear
clc
% [p11, p21, p31, Qc1, Q1] = unknownDOC3(0.6,-20);
% [p12, p22, p32, Qc2, Q2] = controldeg2(0.0104, 0.0056, -20, 0, 0.6);
% eigQ1 = abs(eig(Q1))
% eigQ2 = abs(eig(Q2))
k_cp = 0:0.01:1;
[~,n] = size(k_cp);
for i = 1:n
[~, p1(i),~,~,~] = controldeg2(0.0104, 0.0056, -20, 0, k_cp(i));
end
figure(1)
plot(k_cp... |
addpath /Users/dannychait/Documents/MATLAB/Code/NMF-matlab-master/danny_NMFD/util
%Sound files to be decomposed
mixDirectory = ('/Users/dannychait/Documents/MATLAB/Code/NMF-matlab-master/danny_NMFD/audio/mixes/');
mixFileList = getFileNames(mixDirectory ,'wav');
%Directories of isolated snare sound files%
snareDirecto... |
function [resi_array0,tt0,resi0,ct0,resi_array05,tt05,resi05,ct05,resi_array1,tt1,resi1,ct1] = runirpn(dataset)
% Input the data
datapath = strcat('../Datasets/', dataset);
[class_label, feature_matrix] = libsvmread(datapath);
fprintf('Dataset has been successfully read.\n');
switch dataset
case 'colon-... |
clear;
%data preprocessing
traindata = importdata('traindata.txt');
K = int32(10);
[N,M] = size(traindata);
N = int32(N);
%matrix and vector construction
X_inp = traindata(:,1:8);
Y = traindata(:,9);
X_part1 = sqrt(X_inp(:,1:4));
X_part3 = sqrt(X_inp(:,6:8));
X_part2 = X_inp(:,5);
Z1= cat(2,X_part1,X_pa... |
function Y=Prepca(image,Size)
%Eliminating the background, Normalize the size of images,
%and Locate the plankton
X=edge(image,'sobel');%edge detecting
[x,y]=find(X==1);
xmin=min(x);
xmax=max(x);
ymin=min(y);
ymax=max(y);
xh=xmax-xmin;
yh=ymax-ymin;
if(xh>yh)%the image is thin and ... |
%% foreward kinematocs
theta1 = linspace( |
function dSIR = SIRModel(t,SIR,N,beta,f,alpha,kappa)
%in place of quarantine we lower R0 over time.
%preventative measures were taken after about 110-120 days
if (t>110 && t < 120)
R0 = .9; % Reproductive number
beta = R0*alpha;
elseif (t>120 && t< 140)
R0 = .8; ... |
function farbe = colmapfunction(x,z2,brightness)
% ReLU(x) = x*(x>0)
if nargin==1, z2=rgb2hsv([0,0,1]);brightness=1;end
if nargin==2, brightness=1;end
x = min(max(x,-1),1); % clip to [-1,1]
angl2=z2; % discrete angles from discrete color palette
absz2=x; % saturation prop to responsibility
farbe = hsv2rgb([angl2,absz... |
function [lvals] = GaussLogLikelihood(xs, mu, sig)
d = size(xs, 2);
function p = gloglikelihood(x)
p = -0.5 * d * log(2*pi) - 0.5 * log(det(sig)) - 0.5 * (x - mu) * inv(sig) * (x - mu)';
end
% can this be done with bsxfun or arrayfun instead?
lvals = zeros(size(xs, 1), 1);
for r=1:size(... |
%Test Jacobians WRT random frame
addpath('..\');
%Create Model and visualize
mdl = rlCModel('..\Models\Lower_Body_Rev.xml');
mdl.forwardPosition();
%Add Sensor to the knee
sens = SensorCore('knee_imu');
sens.addDecorator('yaw');
knee_frame = mdl.getFrameByName('rknee0');
asis_frame = mdl.getFrameByName('mid_asis');
... |
%load data
ptbCorgiData = uiGetPtbCorgiData();
%Let's fit the data in a special way.
%constraining the function to be 0.5 at 0
%Jointly fitting a lapse rate to both conditions
%Just allowing the slope/variance of the underlying normal to change
%between contrast groups.
analysis.function = @psychometricFitMultiple;
%... |
% P Chatelain
% Look-up for the behavior of the NACA16-509
%%% Initialization in the main matlab script:
%%% Code snipplet to load the airfoil data in main file:
% global alphas_naca16_509_m06 cls_naca16_509_m06 cds_naca16_509_m06
% load 'naca16-509-m06_clcd.mat'
function [cl,cd] = naca16_509_m06(a)
global alpha... |
function lam2=f_second_spectral_moment(rf_distribution,rf_correlation)
switch rf_correlation.type
case 'gaussian'
v=rf_distribution.variance; lc=rf_correlation.correlation_length;
lam2=2*v/lc^2;
otherwise
error('Distribution non implemented yet.')
end
|
function s = simpson3d( z, dx, dy, dz )
[nx ny nz] = size(z);
nx = nx-1;
ny = ny-1;
nz = nz-1;
s1 = ( z(1,1,1) + z(1,1,nz+1) + z(nx+1,1,1) + z(1,ny+1,1)+ z(nx+1,ny+1, nz+1)+ z(1,ny+1,nz+1) + z(nx+1,ny+1,1) + z(nx+1,1,nz+1));
ixo = 2:2:nx;
ixe = 3:2:nx-1;
iyo = 2:2:ny;
iye = 3:2:ny-1;
izo = 2:2:nz;
ize = 3:2:... |
% Code that adds wrapping geometries from .dsp file into TDSEM.osim model
% import opensim libraries
import org.opensim.modeling.*
% REM ELLIPSO surfacenr mx my mz ax ay az pp po
% REM mx, my, mz: coordinates of centre of ellipsoid
% REM ax, ay, az: lengths of the axes of the ellipsoid
% REM pp, po: position ... |
function [s_ghk] = sauvage_golov(conc_1,conc_2,Vnernsts,z_ca,z_an)
F = 96485.33289; % C mol-1
R = 8.3144598; % m2 kg s-2 K-1 mol-1
T = 298; % K
s_ghk = [];
cons = F/(R*T);
for i = 1:length(Vnernsts)
c_high = conc_2(i); %c_res max(conc_2(i),conc_1(i));
c_low = conc_1(i); %c_cap min(conc_2(i),conc_1(i));
... |
% author: Yuxiong Zou
% Much like SPHERE(), ELLIPSOID(), or SUPERQUAD(), this
% function calculates and returns the matrices required to
% plot a general superquadric particle using MESH() or SURF().
function [xo,yo,zo]=superquadric(varargin)
% [X Y Z]=SUPERELLIPSOID({AXES}, C, R, P, {N})
% (X-Cx)^n... |
% Starter Code for Simulation Assignment #2
% Created by Michael Hayes
% Note: Some values below will need to be filled in.
clear all;
close all;
%Constants
Na = [1E19, 5E17, 1E16, 5E15]; %p-side doping (in cm^-3)
Nd = [1E15, 1E16, 5E17, 1E18]; %n-side doping (in cm^-3)
A = 2*10^-4 * 3*10^-4... |
function obj = setup(obj)
% Biafra Ahanonu
% Started: 2021.03.25 [22:11:25] (branched from ciatah.m)
uiwait(ciapkg.overloaded.msgbox(['CIAtah setup will:' 10 '1 - check and download dependencies as needed,' 10 '2 - then ask for a list of folders to include for analysis,' 10 '3 - and finally name for movie files to ... |
% Simulate a known sequence of game.action
% Handle Java imports.
eval('javaaddpath ../target/qwop-controls-1.0-jar-with-dependencies.jar'); % Strange issues with trying to directly call these commands. Eval seems to fix it.
eval('javaaddpath ../jbox2d.jar');
eval('import game.qwop.StateQWOP game.state.StateVaria... |
function hout = Function_Matched_Filter(g, in, fs)
% MATCHED FILTER
% Input arguments :
% g ; basic pulse shape of the line code
% in : received signal which input to the matched filter
% fs : sampling rate
ts = 1/fs;
h = g(length(g):-1:1);
hout = conv(in, h)*ts;
hout = [hout, 0]; |
function HWK4_Diffusion()
clc,close all
% Step-1: Read images
% ~~~~~~~~~~~~~~~~~~~
% I0 = im2double(imread('cameraman.tif'));
I0 = im2double(rgb2gray(imread('coloredChips.png')));
% I0 = im2double(rgb2gray(imread('images/shapes_and_colors.png')));
% I0 = im2double(rgb2gray(imread('images/Photo -... |
function startOnlineTracking(nmcmc,winsize)
% startOnlineTracking(nmcmc,winsize)
% This function uses the hmttsn_testbed package to run an online tracking
% algorithm as the sensor network is gathering data with the MagMHopRpt
% application.
%
% Only data received AFTER running 'startOnlineTracking' will be used ... |
function steadyState_timepoint = findSteadyState(outputFiles_path, outputFiles_Id, outputFiles_prefix, nSides)
%% ---- steady state = timepoint (fileId) when the derivative first becomes < 1.
derivative_sum_all = zeros(1,numel(outputFiles_Id));
counter = 1;
for ii = outputFiles_Id
outputFile = [outputFiles_path ... |
load('MACHINE_HEMBRUG_030_ESSAI03.mat')
% X = DADOS DO ACELEROMETRO
% Ne = NUMERO DE DADOS DO ENSAIO
% Fe = frequencia de amostragem utilisada no ensaio
%dur = 500; % caso queira especificar uma duração especifica do ensaio em s
dur = double(Ne)/double(Fe); % duree de la fenetre d'analysis en secondes (analisa tu... |
function Infor_surface1 = getInfor_surface()
global Infor_surface
Infor_surface = Infor_surface1 ;
end |
% Installation file. Adds local folders to path.
fprintf('Adding sklearn-matlab folders to Matlab path... ')
% add lib/ with subfolders
addpath(genpath(fullfile(pwd,'lib')));
% add data/ folder
addpath(fullfile(pwd,'demo/data/'));
fprintf('done.\n')
disp('Type "savepath" if you wish to store the changes.')
% savepa... |
function nback_analysis
% Settings
SAMPLE = '';
% Housekeeping
[~,~,~,~,~,DATA_DIR] = wave_ghost();
NBACK_DIR = fullfile(DATA_DIR, 'nback');
RAW_TEMPLATE = 'all_nback.csv';
SLOPE_COLLAPSED_TEMPLATE = 'all_nback_slope_collapsed.csv';
SLOPE_COLLAPSED_COLLAPSED_TEMPLATE = 'all... |
function output = checkerboard(g)
output = zeros(256,256);
strip = zeros(16,256);
strip_ref = g*ones(16,256);
A = [255 255 0 0
255 255 0 0
0 0 255 255
0 0 255 255];
for i = 0:3
for j = 0:63
strip(4*i+1:4*(i+1),4*j+1:4*(j+1)) = A;
end
end
temp = [strip;strip_ref];
for i = 0:7
... |
%% Get DAC
s = daq.createSession('ni');
ch = addAnalogInputChannel(s, 'Dev1', 'ai0', 'Voltage');
%% Get Data
samplingfrequncy = 600;
s.Rate = samplingfrequncy;
s.DurationInSeconds = 10;
[data, time] = s.startForeground();
save('Lab16ECGSignal1.mat', 'time', 'data');
%% ParksMcClellan Filter
% Define param... |
function [power_original_b, power_sub_b, erp_b] = get_linear_regression_step( step_result, trials, condition_labels)
y = condition_labels';
power_original_b=squeeze(zeros(size(step_result.originals_power(1,:,:))));
power_sub_b=power_original_b;
erp_b = squeeze(zeros(size(trials(:,1,1))))';
for jj=1:size(power_original_... |
img_src=imread('autumn.tif');
ref_imread('autumn._spec.png');
imgr=img_src(:,:,1);
imgg=img_src(:,:,2); |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Program to step the individual data sites into a more representative
% plot
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all
clear all
STARTPOINT = 3;
filelist = dir;
STARTINGDS = 1;
ENDINGDS = 15;
TimeSpl... |
function [imFiltered, timeExec] = MIJ_wrapper(imageIn, command, arguments, options)
% Input check
% might work without this, debug later
if strcmp(command, 'PureDenoise ...')
windowToExport = 'Denoised-Import from Matlab';
elseif strcmp(command, 'MultiScale... |
%% Reset the window
clear all;
close all;
clc;
%% Import data and setup variables
load('ENB301TestData.mat');
a = [0.4 1 4 12 20];
KmArray = [1 5 15 35 50];
colours = ['y' 'm' 'g' 'c' 'b'];
%% Before doing any of the asked questions, find an ideal approximation for the response
BestA = 1;
BestKm = 0.1;
denominator = ... |
function [ mesh ] = makeUniformTriMesh( N, xlim, ylim, Mx, My, bcType )
checkInput(xlim, ylim, Mx, My, bcType);
tri = StdTri(N);
flag = 0;
% Parameters
Nx = Mx + 1; % number of nodes along x coordinate
Ny = My + 1;
K = Mx * My * 2;
Nv = Nx * Ny;
EToR = enumRegion.Normal * ones(K, 1, 'int8');
% Define vertex
% The ve... |
function pop= Pop_Override(opt, pop, varargin)
% Function: pop = Pop_Override(opt, pop, varargin)
% Description: Load population from exist variables. Does not reject based
% on number of constraints from previous results
popsize_new=opt.popsize;
variable=opt.initfun{2};
popsize_old=size(var... |
function [p,B,yHat] = plotDataAndLinearRegression(X, Y, varargin)
% X is a data matrix with observations as rows. A column of ones will be
% appended if not already there (to determine bias term), unless
% ZERO_OFFSET == true;
% Y is a column vector of outputs
%
% @ Matt Golub, 2018.
LINE_COLOR = 'k';
LINE_STYLE = [];... |
function [RMSE,w] = arma_yk(data,options)
initlen = options.initlen;
mk = options.mk;
list = [];
SE = 0;
AE= 0;
count = 0;
for i = initlen+1:1:size(data,2)
count = count + 1;
model = ar(data(1:i-1),mk,'yw');
y = model.a(2:mk+1)*data(i-1:-1:i-mk)';
diff = y - data(i);
SE = SE + diff^2;
... |
%--------------------------------------------------------------
function [msts,sten,ststp] = stasta_3d(temp,hur,nxg,psfc,press,zfull)
%---------------------------------------------------------------------
% compute the 2D dry and moist static energy; sten(x,p) and msts(x,p)
%
% also computes the static stability param... |
function absDist = distCalc(ptA, ptB)
% Given 2 points, determine the absolute distance between the two
% handles 1D, 2D and 3D data
arrayDim = size(ptA, 2);
switch arrayDim
case 1
absDist = sqrt( ptA .^ 2 + ptB .^ 2 );
case 2
X1 = ptA(:,1);... |
% This script handles counting the total number of storms that fall into
% each hurricane category for a phase of the MJO, based on results from
% prep.m.
% I am assuming that the variable "vnetmax" is indeed the one necessary to
% do this, based on comments in prep.m. I am also assuming the wind speeds
% are in knots... |
function printMagReportMsg_MagMHopRpt(address, message, connectionName)
% Because MagReportMsgs report very quickly, you may get a steady stream of
% reports if your threshold is set too low. MAGMHOPRPT.ReportMsgFlag is a
% flag to shut of message reports while you tune the report threshold
global APPS;
disp(mess... |
function plot_power_auditory_response(subj,block,condition,time_lock,ERP_fit,coupling,elecs_to_plot)
%condition = 0 or 1 or 2
%0: to plot the three stimuli
%1: to plot the three values that change over blocks
%2: to plot one subplot for each stimuli with lines for each instance of value
%time_lock = 0 or 1
%0: time-... |
function [A, k, lambda, A1] = foam(B, iter)
% Fast Optimal Attitude Matrix
% [A, signB, k, lambda, A1] = foam(B)
%
% Example1:
% for k=1:1000
% A=randn(3); [A0, k, lambda, A1] = foam(A); res(k,:) = [det(A), max(max(A0-A1))];
% end
% figure, subplot(211), plot(res(:,1)); subplot(212), plot(res(:,2)); ... |
% This is the repository for the Matlab codes of the numerical simulations
% of plasmid dynamics in complex communities. The scripts can be used to
% generate the data necessary to produce Figure 5c of the manuscript
% "Variability of plasmid fitness effects contributes to plasmid persistence in bacterial communities."... |
%Cristina Chu
%Part 5
img = imread('ps1-input1.jpg');
img = rgb2gray(img);
%% ----a.Smooth image-----%
kernel = fspecial('gaussian', 8,4);
smooth = imfilter(img, kernel);
imwrite(smooth, 'ps1_5_a_smooth.jpg');
%% ----b.Edge image----%
edgeSmooth = edge(img, 'canny', .2);
imwrite(edgeSmooth, 'ps1-5-b-edge.png');
... |
%% plot
G = [15,20:10:80];
% close all
figure
% load NMSE_SNR0_G15to80;
% plot(G,NMSE_dB,'-o','linewidth',1.6,'MarkerSize',10);
% set(gca,'fontsize',12);%'linewidth',4,'fontname','Times'
load NMSE_SNR10_G15to80;
plot(G,NMSE_dB,'-s','linewidth',1.6,'MarkerSize',8);
xlabel('\it G');ylabel('NMSE [dB]');
grid on;
hold o... |
function [ft, values] = getMetaFeatures(X, y, settings)
% ft = getMetaFeatures(X, y, settings) calculates all implemented
% metafeature groups on dataset [X, y], where X is NxM double matrix of
% datapoints in the input space and y is Nx1 double vector of objective
% values.
%
% [ft, values] = getMetaFeatures(...) ret... |
function gof=gof_spaceangle(tm,modfunc,oaz,oel,iaz,iel)
% gof=gof_spaceangle(tm,modfunc,oaz,oel,iaz,iel)
%
% Goodness of fit function used to compare online oaz,oel points to
% those derived from ideal iaz,iel using modfunc(tm,iaz,iel)
[maz,mel]=feval(modfunc,tm,iaz,iel);
sa=spaceangle(oaz,oel,maz,mel,'deg');
gof=su... |
%% function description
%{
The function is for equation 8 on the outline. It will compute the running
thrust loading.
b is wingspan?, r/R and c/R are already calculated, cl is already
calculated.
*********************************
underscores are representing a division in the code below
%}
function [dCT_dr_... |
classdef sigmaY < sqc.op.logical.operator
% sigma Y
methods
function obj = sigmaY()
obj = obj@sqc.op.logical.operator([0,-1j;1j,0]);
end
end
end |
function [var_name] = stack2pc()
%[var_name] = stack2pc(Fs)
%var_name: must name a time-domain real signal
%Fs: sampling frequency
%
while (S232('APactive')) pause(0); end
var_name = S232('pop16');
return |
classdef IPMedianBlur < SYObject
properties(Constant)
end
methods(Static)
function result = medianBlur(image,radius)
if radius < 1
disp('radius must be larger than 1.');
result = nan;
return;
end
array = image.bitmapImageArray(false);
jmage = SYImage;
for i = 1:array... |
function [a_i]=ai(X,h,i,x)
a_i=[int(phi_iminus(X,h,i,x)^2,x,X(i),X(i+1)), int(phi_iminus(X,h,i,x)*phi_iplus(X,h,i+1,x),x,X(i),X(i+1));
int(phi_iminus(X,h,i,x)*phi_iplus(X,h,i+1,x),x,X(i),X(i+1)),int(phi_iplus(X,h,i+1,x)^2,x,X(i),X(i+1))];
end |
[r c] = size(TOF_DISTANCE.onsetTOF);
if ishold
figure
end
lstyle = {'--.k','--+k','--*k','--ok','--xk','--.b','--+b','--*b','--ob','--xb','--.g','--+g','--*g','--og','--xg','--.r','--+r','--*r','--or','--xr','--.c','--+c','--*c','--oc','--xc','--.m','--+m','--*m','--om','--xm','--.y','--+y','--*y','--oy','--x... |
%TEST_LINEAR Compares numerical method to linear solution for a single
%mode.
% clear;
H1 = 0.5;
H2 = 0.6;
m2 = 0.5;
m3 = 2;
s1 = 1;
s2 = 1;
Q = 0.09;
tL = 1000;
xN = 2^8;
xL = 2*pi;
xS = xL/xN;
a = [0.001;0.0];
mode = 1;
[h,x,t]=compute_numerical_solution(H1,H2,m2,m3,s1,s2 ,Q,...
@(x) i_ei... |
function f=hamming_window_2D(dim)
% This function calculates the 2D Hamming window.
% dim=dimension: The dimension of the filter will be (dim x dim x dim), ex:
% 128x128.
x=0:dim-1;
y=x;
[X,Y]=meshgrid(x,y);
a=2*pi/dim;
f1=.54-.46*cos(a*X);
f2=.54-.46*cos(a*Y);
f=f1.*f2;
|
%%Import Excel Files
[fName,pName] = uigetfile('*.xlsx','Choose files to load:','MultiSelect','on');
if pName == 0, return; end
files_in_this_folder=dir;
nFiles=length(fName)
idx=1;
for idx =1:nFiles
filename=[fName,pName];
if strcmpi(filename(end-4:end),'.xlsx')
end
end
[num,txt,raw] = xls... |
function filter = create_gaussian_filter( f_width )
%UNTITLED5 Summary of this function goes here
% Detailed explanation goes here
% construct the filter
filter = ones(f_width,f_width,'single');
[rows,cols] = size(filter);
f_rad = floor(f_width / 2);
sigma = f_rad / 3.0;
for row = 1:rows
for col = 1:cols
... |
function [Phone, Marker_d, BS, idx] = getsensoralignedplot(EEG,indices)
% Plot phone data in onjunction with BS movement data
% Usage : [Phone, Transitions, BS, idx] = getsensoralignedplot(EEG,indices)
% Continous Phone Data
% Marker_d Breaks in EEG recorder
% BS data (filtered)
% Indices of phone data idx.
% ... |
function [t_sum,obj_sum,location] = solve_GPGD(M,N,F,Rb,Rm,Ym,P_F,R,P_Rb,P_Rm,P_Ym,G,P_tau0,inv_Omega,upper,max_dis,min_dis,XYZ,plt,K)
t_sum = [];
for i = 1:K
[x, beta, obj] = GPGD(M,N,P_F,R,P_Rb,P_Rm,P_Ym,G(1:M-1,:),eval("P_tau0(1:M-1,"+string(i)+")'"),inv_Omega,upper,max_dis,min_dis,XYZ,plt);
[A B C] = ABC(F,... |
%
% Calcualte the classifier score
% Assume: 1 --- positive, 0 --- negative,
%
function [Precision,Recall,Accuracy,F1,Mcc] = classifier_score(truth,prediction)
P = length(find(truth == 1));
N = length(find(truth == 0));
PP = length(find(prediction == 1));
PN = length(find(prediction == 0));
TP = sum(truth .* predi... |
% data_load_show = importdata('ysw.mat')
% AT=[];
% AH=[];
% AS=[];
% BT=[];
% BH=[];
% BS=[];
% CT=[];
% CH=[];
% CS=[];
% % AT:27.4H:35%S:015mg/L
% single_string_size=21;
% % data_load_show = mat2str(data_load_show);
% % disp(data_load_show)
% cut_size = 200;
% [r, c] = size(data_load_show);
% % 从尾部截取单字符串,判断是哪个传感... |
close all;
clear all;
% load and split data
data = load('airfoil_self_noise.dat');
preproc = 1;
[trnData, chkData, tstData] = split_scale(data, preproc);
Perf = zeros(4,4); % 4 models + 4 metrics
% Evaluation function
Rsq = @(ypred,y) 1-sum((ypred-y).^2)/sum((y-mean(y)).^2);
% FIS with grid partition... |
function [ f ] = cross2( x, y )
%CROSS2 2D cross-product
f = x(1)*y(2) - x(2)*y(1);
|
function [ Ydec fit] = lraSNTD( Y, opts )
%% Nonnegative Tucker Decomposition Incorporating Low-rank Approximation
% Usage [Ydec fit]=lraSNTD(Y,opts);
% opts.
% .NumOfComp: vector for the number of cols of each factor
% .maxiter .maxiniter: maximum of iteration number (internal max iter))
% .... |
function [array_pairwise_correlation] = compute_pairwise_fingerprint_correlation_sibling_pairs(sub_id_set,pair_id_set,mat_compact_fingerprint)
%%
% Summary:
% 1. MATLAB function to compute Pearson Correlation between
% pairs of compact fingerprints for a given twin/sibling type
%
%%
% Funct... |
function Location = LocationLogRead(originLat,originLong)
disp(strvcat({'Importing Site Location' ; '______' }))
[filename path] = uigetfile('C:\Users\Jordan\Documents\GitHub\Aerial-Algal-Bloom-Monitoring\Location Logs\*.txt','Choose Location Log');
Location = importdata([path filename]);
Location.Filename = Location.t... |
function x = BackRow(U,b)
% function x = BackRow(U,b)
% Back-Substitution (row-oriented version)
% U is nxn, upper triangular, and nonsingular.
% b is nx1 and x solves Ux = b.
% GVL4: Algorithm 3.1.2
n = length(b);
for i=n:-1:1
b(i) = (b(i) - U(i,i+1:n)*b(i+1:n))/U(i,i);
end
x = b; |
function [out] = BandPass(in, opt)
if ~strcmpi(opt.window, 'butterworth')
opt.N = opt.cutoff(1); % first higher freq cutoff
hi = FilterSeries(in, opt);
opt.N = opt.cutoff(2);
low = FilterSeries(in, opt);
out = hi - low;
else
opt.N = max(opt.cutoff); % only used ... |
function [Networks_Time,L]=Main_Process(N,beta, T_max)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Main_Process: Main Programm to compute 1 process
%Input variables:
% N: Number of initial Nodes
% Beta: Enviromental-Temperature factor
% T_Max: (Max. allowed steps)
% O... |
%[s_check_smapSizeInfo] show the adjustment of image size of SMAP before
%reconstruction.
%
% USAGE:
% s_check_smapSizeInfo
%
%
% Last modified
% 2010.08.06.
% 2010.09.01.
% 2010.09.02.
% Due to non-integral sense factor, this generates error. Take care of
% this as 'theoretical' and 'actual' and 'R... |
function g=grad3z(f,h,b)
% u=grad3z(f,h)
% compute gradient in 3d assuming zero boundary conditions
% u=grad3z(f,h,b)
% in 3rd coordinate use reflection at bottom instead of zero
% input:
% f 3d array
% h(1:3) stepsize
% b use zero boundary condition on output at the bottom
if ~exist('b','var')
... |
function [output_noise noise_x noise_p1 noise_p2 ] = AWGN_Channel(output);
global prt;
if prt.awgn == 1
noise_on_x = ...
[
+1.966099
-1.232363
+0.750745
+1.832447 % +2.832447
-1.262811
+0.205224
-0.569778
+0.257169
];
noise_on_p1 = ...
[... |
function A = test();
A = [];
A = eye(5);
end
|
%3.24
r1=randi(50,5)
r2=r1(2:4,2:4)
%save script_3 r2 -ascii
dlmwrite('script_3.dat',r2)
|
function [parentGene]=tournament_selection(pop,popSize,fitnessValue,tournamentSize)
tourPopFVal=zeros(tournamentSize,1);
tourIndex=zeros(tournamentSize,1);
for i=1:tournamentSize
tourIndex(i,1)=randi(popSize);
tourPopFVal(i,1) = fitnessValue(tourIndex(i,1),1);
end
% 选择最好的,... |
function isValid = validStartState(pose, ub, vb, vj, tol)
% validStartState tests if the inital configuration of the pendulum is valid.
% retuns true or false.
% pose is a 7x1 vector representing the:
% position: values 1:3 in pose in the format ex ey ez and
% orientation: values 4:7 in pose in a ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.