text stringlengths 8 6.12M |
|---|
function answer = fn_dialog_questandmem(question,identifier)
% function answer = fn_dialog_questandmem(question[,identifier])
%---
% This imitates Windows style confirmation window, with a choice between
% 'Yes' and 'Cancel', and additionally a possibility to mark a box 'Do not
% ask again'.
%
% Input:
% - question ... |
function varargout = wpdencmp(varargin)
%WPDENCMP De-noising or compression using wavelet packets.
% [XD,TREED,PERF0,PERFL2] =
% WPDENCMP(X,SORH,N,'wname',CRIT,PAR,KEEPAPP)
% returns a de-noised or compressed version XD of input
% signal X (1-D or 2-D) obtained by wavelet packet
% coefficients thresholding.
%... |
classdef oceanTS_old
% Class OCEANTS_OLD to deal with temperature/salinity data in the ocean.
%
% TO DO: Replace the data matrix by a table and use the
% relevant operations.
%
% Olavo Badaro Marques, 30/Jun/2017.
%% Properties of the object
properties
data
... |
% this will generate plots for clusters and cost in function of number of clusters
function graph(file_index)
% files
file_params = strcat("cls/cluster_", num2str(file_index), ".param");
file_points = strcat("cls/cluster_", num2str(file_index), ".points");
% call clustering algorithm to compute centroids
[point... |
function [coord] = decode(gps)
# decodes a Space Engineers GPS string and converts it to a coordinate
# input GPS string gps
# get out a coordinate, where columns represent x,y,z
# Example string: 'GPS:E - Earth Lake Lavon:-18368.01:19464:54731.27:'
# initialize coordinate variable
coord = zeros(1,3);
... |
function [payoff] = payoff_IF_sharkfin(S)
% S 是一个序列
% 震荡市沪深三百指数期权
% payoff 为二种情况:涨幅 < 0% 或涨幅 > 15% payoff = 0%;
% 涨幅为0% ~ 15%: payoff = 涨幅;
S0 = 1;
upper = 1.15 * S0;
ST = S(:, end);
payoff = ST - S0;
payoff(((ST < S0) | (ST > upper))) = 0;
end |
% September 2019 function copied verbatim from
% https://github.com/kbatseli/PNLA_MATLAB_OCTAVE
function fullBase = getMon(d,n,varargin)
% fullBase = getMon(d,n) or getMon(d,n,d0)
% ----------------------------------------------
%
% Returns a full canonical base of monomials of total degree d and in n
% variables. Eac... |
function r = wye(q)
% Extracts the Y component of a quaternion.
% Copyright © 2005 Stephen J. Sangwine and Nicolas Le Bihan.
% See the file : Copyright.m for further details.
% error(nargchk(1, 1, nargin)), error(nargoutchk(0, 1, nargout))
r = q.y;
% $Id: wye.m,v 1.2 2009/02/08 17:04:59 sangwine Exp $
|
%Generates pink noise and saves it as a .WAV file.
filename = 'PinkNoise.WAV';
duration = 8 * 60; %in seconds
sampleRate = 48000;
N = duration * sampleRate;
y = pinknoise(N);
maximum = max(y);
minimum = min(y);
y = y/max([abs(minimum) abs(maximum)]);
audiowrite(filename, y, sampleRate); |
classdef Vasculature < sbfsem.core.StructureGroup
properties (SetAccess = private)
vessels
IDs
end
methods
function obj = Vasculature(source)
obj@sbfsem.core.StructureGroup(source);
obj.typeID = 3;
obj.update();
end
function update(obj)
obj.pull();
end
function render(obj, ax, v... |
function posterior=BayesRule1(prior,likelihood,k)
prior=[0.5 0.5]
likelihood=[0.25 0.75; 0.75 0.25]
k=2
d=length(prior)
for index=1:d
numerator(index)=prior(index)*likelihood(index,k)
end
denominator=sum(numerator)
posterior=numerator/denominator
sum(posterior)
stem(posterior)
title('Belief about X')
xlabel('State ... |
function CA=agilent_load_complex(file_path,dims)
% agi_matlab complex reconed data is little endian 2 part,
% file_path.i and
% file_path.r.
disp('OBSOLTE');
end
if 0 %% dont run
fid= fopen([file_path '.r'],'r');
if fid==-1
error(['Could not open file ' file_path]);
end
re=reshape(fread(fid,inf,'single',0,'l'),di... |
%RUNARCVERSION This script runs the DRESDEN version of the cannon task.
%
% Documentation
% Unit test
% Contributors
%
% Last updated: 08/21
% ----------------------------
% Set relevant task parameters
% ----------------------------
% Indicate your computer
computer = 'Macbook';
% Set number of trials of main ta... |
function n = RBES_count_subobj()
global params
if isfield(params,'num_subobjectives')
n = params.num_subobjectives;
else
n = 0;
for p =1:params.npanels
for o = 1:params.num_objectives_per_panel(p)
for so = 1:length(params.subobjectives{p}{o})
n = n + 1;
end
... |
function spc_autoSave
global gui;
global spc;
global state;
try
name_start=findstr(spc.filename, '\');
name_start=name_start(end)+1;
if strfind(spc.filename, 'max')
baseName_end=length(spc.filename)-11;
elseif strfind(spc.filename, 'glu')
baseName_end=length(spc.filename)-11;
els... |
%% comparing the results of our model with the empirical results from
% Mitja in NEJM
% saving files to be read into R to make nice tables
% We need to show what percentage of people are still in the disease system
% after one round TCT at 82% coverage followed by one TTT at ~81% coverage
clear all
load('C:\Users\w... |
function poob=getpobs(hobs)
%
% Function getpobs
% ================
% Get position of observables in observation file, from header variable
%
% INPUT
% =====
% hobs -> structure containing header information
%
% OUTPUT
% ======
% poob -> structure containing observable positions
% poob.P1 -> P1 pse... |
function H = HKappa(E, EKappa, epsilonKappa)
H = heavisideLocal(E-EKappa, epsilonKappa);
|
function result = put_dat( bufferD, hdr )
% result = put_dat( bufferD )
if bufferD.running
try
hdr.buf = single( hdr.buf );
buffer( 'put_dat', hdr, bufferD.host, bufferD.port )
result = true;
catch
result = 0;
end
else
result = 0;
end |
function [output] = getSimpModelPenalty(control, derivative_t)
global GLB_INVP;
power = GLB_INVP.SimpPenalty;
control_at_dof = control( GLB_INVP.mesh.t');
average_control = zeros(GLB_INVP.numCells,1);
for cell=1:GLB_INVP.numCells
average_control(cell) = ...
sum(GLB_INVP.CellMassMatrices(:,:,cell)*control_... |
function [ complete_skeleton,number_of_samples,action_length ] = load_Florence3D_dataset( path,reload )
if reload==0
% load skeleton with all available data from a mat file
disp('Loading Dataset...');
cd('dataset')
load('Florence3D.mat','complete_skeleton','number_of_samples... |
% Definición de un pulso rectangular con los siguientes parámetros:
% t = Tiempo de escucha de la señal
% a = Tamaño del pulso medido en tiempo,
% Obligatorio que t >> a para que tenga sentido su estudio
function y = pulsoRectangular(t, a)
y = [];
for i = t
aux = (i < a) && (i > -a);
y = [y aux];
endfor
... |
function [ omegaq, eta ] = opperUnpack( theta )
%UNPACKOPPER unpack parameters
% Detailed explanation goes here
% we do: eta = exp(theta_eta)
Ltheta = length(theta);
M = Ltheta/2; % M parameters for the posterior parameters
% and M parameters for the "free" diagonal parameters for the covariance
omeg... |
DataDir ='C:\Users\daumail\Documents\LGN_data\single_units\s_potentials_analysis\data\ns6_selected_units\160609_I\';
ns6_filename = '160609_I_cinterocdrft013.ns6';
clear ext NS_header banks neural
% Read in NS Header
ext = 'ns6'; ... |
function theta = Brewster(n1,n2)
% calculates Brewster's angle
theta=atan(n2/n1);
end |
clf;clear all; close all;
% Generate qpsk signal
N = 1000;
sig = sign(randn(1,N))+j*sign(randn(1,N));
% for observation
sig_real = real(sig);
sig_imag = imag(sig);
load('./filter/IIR_filter');
fc = 0.25*10^6;
fs = 1*10^6;
f_DAC = 16;
f_DMA = 8;
group_delay = 23;
srrc_16 = srrc_pulse(16,5,0.3);
mod_sig_real = trans... |
function [object,Ct,inc] = newCurv(IMG,keep)
% newCurv.m
% This function applies the Fast Discrete Curvelet Transform (see http//curvelet.org for details and source) to an image, then extracts
% the curvelet coefficients at a given scale with magnitude above a given threshold. The orientation (angle, in degrees) and c... |
function CreateTriggerFileForOptimization(TemplateDirectory, RootDirectory, NumberOfProdLumpsPerWell, NumberOfInjLumpsPerWell, ValveType, PercentValveOpenVector)
NumberOfTotalLumps = sum(NumberOfProdLumpsPerWell) + sum(NumberOfInjLumpsPerWell);
templateName = '\Time_template.inc';
FileToRead = fo... |
function [A,x,p] = polyInterpOrApprox (t,b,deg,nPlot)
% error handling for if t and b are of different length
if length (t) ~= length (b)
error ('t and b are not the same length ')
end
m = length (t);
% error handling if m < deg + 1
if m < (deg + 1)
error ('not enough information to determine polynomial of deg... |
img = imread('aerial.bmp');
b = bitget(img,1);
subplot(2,4,1);imshow(logical(b));title('Bit Plane 1');
b = bitget(img,2);
subplot(2,4,2);imshow(logical(b));title('Bit Plane 2');
b = bitget(img,3);
subplot(2,4,3);imshow(logical(b));title('Bit Plane 3');
b = bitget(img,4);
subplot(2,4,4);imshow(logical(b));title('Bit Pla... |
% Name : Natural Polyharmonic Spline (NPS) interpolation
% Functionality: Create the NPS interpolation for input x and output y
% Properties : xi -> sites
% yi -> function values
% : w -> coefficients for residuals at each site
% : v -> linear coefficients
%
% ... |
if ~exist('recordingsIndoor', 'var')
disp('loading compressed recordings from file...')
load('recordingsIndoor.mat')
end
names = fieldnames(recordingsIndoor);
indoor = Collection('indoor');
for s = 1:numel(names)
name = names{s};
addprop(indoor, name);
subject = Subject(name, 0.88, indoor);
if s... |
%Capacitor.m
%Start
clc
close all
% Setting up Parameters:
a = 1; %Unit Radius of circular plate
d = 1; % Unit Distance between plates.
V = 50; % Voltage across plates.
% Setting up a grid for plotting:
x = -2:0.1:2;
y = -2:0.1:2;
[X, Y] = meshgrid(x, y);
figure
axis([-2 2 -2 2])
% Electric field p... |
function [ W, b ] = svmTrain( posTrain, negTrain, lambda, biasMult, oldW, oldB )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
train = [posTrain, negTrain];
X = cell2mat(cellfun(@(x) double(x(:)), train, 'UniformOutput', false));
y = [];
y(1:length(posTrain)) = 1;
... |
function compare_overburden
set(0,'defaultLineLineWidth',3)
set(0,'DefaultAxesFontSize',15);
maxz=16404; % 5 km deep
dz=0.5;
z=transpose(0:dz:maxz);
n=size(z,1);
vel0=sepread('/net/server2/homes/sep/huyle/dragon/velocities/velocity_SS187.H',1500,1);
z0=transpose(0:32.8084:32.8084*1499);
vel=interp1(z0,vel0,z);
data... |
function [ X ] = csa_rmin( y, M, Mt, OmegaL, lambda )
%rmin_1DFD Relaxed optimization for cosparse analysis
X = pinv(lambda*OmegaL'*OmegaL + Mt*M)*Mt*y;
end
% Using e^(-1/|OmegaL*x) may give better results... |
function [check, isterminal, direction] = terminal_velocity(~, ~, ~)
global Equal
check = double(Equal) ; % Doesn't accept bool
isterminal = 1 ; % stop integration when event occurs
direction = 0 ; % from both directions (positive and negative)
end
|
function [out_arg] = EvaluationGriewangk(x)
% This function gets a vector of points and
% calculates the fitness value (Griewangk test function).
% Input:
% x: A vector containing the values of the variables
%
% Output:
% out_arg: The fitness value of the input vector
%
% © ... |
function [x_t_rec, t_k, x_k] = rec_cadzow(s_m, K, iter)
%REC_CADZOW Reconstruct a Dirac stream from its noisy moments by Cadzow's.
% Cadzow's algorithm solution to the reconstruction procedure.
% If no 'iter' variable was provided, default it to 3.
if nargin < 3,
iter = 3;
end
% Find the annihilating filter by ... |
% Returns a DQ
function obj = DQCircleProduct2(aHat, bHat)
obj = Quaternion;
objReal = QuatDotProduct(aHat.realpart, bHat.realpart) + QuatDotProduct(aHat.dualpart, bHat.dualpart);
objDual = Quaternion(0, [0 0 0]);
obj = Dualquaternion(objReal, objDual);
%obj = Dualquaternion(QuatDot... |
wf = reshape(v.w, 25, 7);
figure;
for jj = 1:5
for ii = 1:7
plot.plotKernelSingle(d.Xxy, wf(:,ii));
pause(0.02)
end
% clf;
% pause(0.1)
end
%%
vtmp = vs;
vL = vtmp(strcmp({vtmp.type}, 'LIP'));
vrL = cell2mat(cellfun(@(x) var(x(:,1)), {vL.wfSvd_U}, 'uni', 0));
ixL = vrL >= 0.005;
vD =... |
%--------------------------------------------------------------------------
% Name: Tournament_Labels2.m
%
% Description: Returns the child node labels given the
% hierarchical tree structure and parent node.
%
%
% Inputs: Label - intput parent label
% ... |
function [L, D] = aero(A_root, A_tip, c_root, c_tip, lambda_1, lambda_2, J,...
theta_root, theta_kink, theta_tip, W_fuel_c, W_wing_c)
%% Aerodynamic solver setting
[KinkCST,Xt_r,Xl_r,Xt_k,Xl_k,Xt_t,Xl_t,Xt_85,Xl_85] = AFinterp(A_root,A_tip,J);
global kink;
kink.CST = KinkCST;
kink.x_root_upper=... |
function [x,res_final,iter] = primal_dual(x, mu, K, KS, ProxFS, ProxG, options)
% perform_primal_dual - primal-dual algorithm
%
% [x,R] = perform_admm(x, K, KS, ProxFS, ProxG, options);
%
% Solves`
% min_x F(K*x) + G(x)
% where F and G are convex proper functions with an easy to compute proximal operator,... |
function theta = AMIGO_scale_theta_back(scaled_theta, inputs)
% AMIGO_scale_theta scales the model parameters and parameter bounds.
scaled_model = false;
scaled_theta = scaled_theta(:);
% Preparing the logarithmic scaling of the global parameters
if ~isempty(inputs.PEsol.log_var)
scaled_model = true;
theta(... |
function[ o ] = ObjectiveFunction1(x)
g = x(1);
l = x(2);
o = (g^2.*l)/2;
%o = sum(abs(x)) + prod( abs(x));
end |
function [data,recordedValues] = TPA_ReadStimFile(data,stimFileLocation)
% Loads different stimulas files
%-----------------------------
% Ver Date Who Descr
%-----------------------------
% 21.21 15.12.15 UD Adopted from TwoPhotonTSeries_1604
% 10.01 29.06.13 UD data is local.
% 10.00 13.11.12 UD Adapted... |
function save_images(I, D, n)
%n must be less than number of frames
l = min(size(I,4),size(D,4));
if n > l
error('n must be less than the number of frames');
end;
picks = randperm(l);
picks = sort(picks(1:n));
Dsave = zeros(size(D,1),size(D,2),size(D,3),n, 'uint16');
for i = 1:length(picks)
imwrite(I(:,:,:,... |
function x = synth_sb_coeforder(signal,sbaheader,nAtom)
blockSize = sbaheader.blockSize
blockHop = sbaheader.blockHop
signalSize = sbaheader.signalSize
x = zeros(length(signal),ceil(signalSize/blockHop)*blockHop);
for k1 = 1:length(signal)
for k2 = 1: length(signal(k1).block)
sb = zeros(length(signal(... |
% The function calculate eventsMatrir without noizes (threshold is used for each pixel in each moment of time)
% Second version of main.m
function [eventsLiveMatrix, reversedEventsLiveMatrix] = main2(dataPath, baseLinePath, calculatePath, strict, timeIndex)
if nargin < 3
dataPath = "data";
bas... |
%{
acq.AodVolume (manual) # Aod volume recordings
-> acq.Sessions
aod_volume_start_time: bigint # start session timestamp
---
aod_volume_stop_time=null : bigint # end of session timestamp
aod_volume_filename : varchar(255) # path to the ephys data
x_coordinat... |
function I_out = confusion_impl2(I_gr,xsin,xlog)
size_image = size(I_gr);
I_out(:,:) = I_gr(:,:);
for i = 1:1:size_image(1)
for j = 1:1: size_image(2)
temp = I_out(i,j);
I_out(i,j) = I_out(xsin(i),xlog(j));
I_out(xsin(i),xlog(j)) = temp;
end
end
end
|
function output = packet_transmission_distance(varargin)
output = feval(varargin{:});
function output = init
global rsc
tablename = rsc.tablename;
transmission_bytes = statistic('byte_offset', 'numTrans');
retrans_bytes = statistic('byte_offset', 'numRetrans');
orig_bytes = statistic('byte_offset', 'realSour... |
function plot_MCMC(beta1_dist, beta2_dist, beta3_dist, err_dist,beta1,beta2,beta3,beta1_hat,beta2_hat,beta3_hat)
figure('Color','w')
subplot(2,4,1)
hist(beta1_dist,500);
h=hist(beta1_dist,500);
line([beta1_hat beta1_hat],[min(h),max(h)],'Color','r');
line([beta1 beta1],[min(h),max(h)],'Color','k');
title('$\be... |
function [IdVersione] = CreateVersion(baseCarico,login,data,Idsetting,IdRunner,conn)
setdbprefs('DataReturnFormat', 'numeric');
setdbprefs('NullNumberRead', 'NaN');
setdbprefs('NullStringRead', 'null');
p=strcat('{call Matlab.BIS.createVersionSacile(',num2str(baseCarico),',''',login,''',''',data,''',',num2str... |
classdef LSMScanInformation
%LSMSCANINFORMATION Class representation of ScanInformation in LSM files
% The field u32OffsetScanInformation of the "CZ-Private tag" contains the
% file offset to the start of a block with information of the device settings
% used during acquisition. Note that the image size, channe... |
function [bincenters,averages,errors]=binmedians(x,y,min,max,oversamplingratio,nbins,varargin)
% [bincenters,averages,errors]=bin(x,y,min,max,oversamplingratio,nbins,varargin)
% Return the median values for independent variable y binned as a funciton
% of independent variable x.
if nargin==6
binoverlap = 0;
elsei... |
% ct_a_m 本脚本用于比较Arnoldi法计算结果与muller法计算结果
% 2015-04-22 lmy
%% 清空显示
clc
close all
%% 设定归一化方法 绘图方式
%1-u,v,w,r,p,t最大者最大值比归一化 2-u,v,w,r,p,t最大者所有值比加权平均归一化
ammethod=1;
%是否按法向方向绘特征函数
fl=true;
%% 输入要验证的点号和模态类型
eigk=input('eigk=\n');
modetype=input('modetype? 1-离散 2-连续\n');
if modetype==1
modetype='d';
elseif modetype=... |
function varargout = parcorr_RMJ(varargin)
%PARCORR Sample partial autocorrelation
%
% Syntax:
%
% [pacf,lags,bounds] = parcorr(y)
% [pacf,lags,bounds] = parcorr(y,param,val,...)
% [pacf,lags,bounds,h] = parcorr(...)
% [pacf,lags,bounds,h] = parcorr(ax,...)
% parcorr(...)
%
% Description:
%
% Compute the sa... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%README:
%%This function is used to compute Ploss, the tap changes, the reactor
%%changes and the q accuracy for the last iteration. Furthermore, this
%%function computes the total cost i.e. the cost in euros of the different
%%objectives... |
function [proxy] = psm_ul(prxs,plat,plon,pNum,archv_tp,itr,...
mdl_prior,p_yrs,clb_prd,year,mnavg_p_o,mnavg_p_f,obs_dtp1,mdl_dtp)
%PSM_UL Univariate linear PSM
addpath('./regem-imputation')
% Create proxy data structure
proxy=struct([]);
% Throw out proxy data that doesn't overlap instrumental period
% with at ... |
function varagout = afc(varargin);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% AFC :: APNet FDTD Code %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% APNet 3rd generation FDTD code
%% (c) 2006-- Ondrej Franek, Mauro Pelosi
version = 'v3.4'; % 24-11-2011
%% default setting of variables
DefaultVars = struct('eps0' ,8.8... |
X = [];
images = dir('*.png');
%create the 42021x150 matrix
for j = 1:length(images)
image_name = images(j).name;
I = im2double(imread(image_name));
I = I(:); %scanning column by column
X = [X I];
end
%mean centering
X_mean = mean(X, 2);
X_mean_centered = X - X_mean;
%PCA
[U, S, V] = svd(X_mean_centered,... |
function [obj]=plotUnwrappedPhases(obj)
%check that input data is valid
if obj.nCh~=2
obj.hPlot=[];hText=[];
msgbox('Phase Sync used only for 2 channels');
return;
end
Fs = 1/(obj.T(2)-obj.T(1))*1000;
V1 = squeeze(obj.M(1,:,:))';
V2 = squeeze(obj.M(2,:,:))';
VF1=butterFilter(V1,Fs,obj.plotParams.lowcutoff,o... |
mimg=imread('lena.jpg');
[M,N]=size(mimg);
cnt=0;
for i=1:M-3
for j=1:N-3
cnt=cnt+1;
mpatch=mimg(i:i+2,j:j+2);
mpatch=mpatch(:);
npatch=nimg(i:i+2,j:j+2);
npatch=npatch(:);
patches(:,cnt)=npatch;
opatches(:,cnt)=mpatch;
end
end |
function [typ,h,inc,raan] = get_orbit_params(str)
tmp = regexp(str, '(?<type>\w*)-(?<h>\w*)-(?<inc>\w*)-(?<raan>\w*)', 'names');
typ = tmp.type;
h = tmp.h;
inc = tmp.inc;
raan = tmp.raan;
end |
function [ NUM ] = get_numerical_parameters( NUM,PAR )
% Computes the numerical parameters
NUM.NUMERICS.no_elems_global = NUM.NUMERICS.no_elems_x*NUM.NUMERICS.no_elems_z;
if ~isfield(NUM.NUMERICS,'Elementtype')
NUM.NUMERICS.Elementtype = 'quadratic';
end
switch NUM.NUMERICS.Elementtype
case 'linear'
N... |
function netprofit=calc_netprofit(tradeList)
% By Zehui Wu version 1.0 2013/7/3
% calculate netprofit
netprofit = sum(tradeList(:,1)); |
function modify_map_pg(cont,P_set,u)
set = cont.sets;
new_keys = uint32(setdiff(P_set,set));
for i=1:length(new_keys)
cont.subcontrollers(new_keys(i)) = u;
end
% modify the '.sets' in cont
cont.sets = P_set;
end |
function varargout = GraspTypes(varargin)
% GRASPTYPES MATLAB code for GraspTypes.fig
% GRASPTYPES, the last window that will be called on the annotation
% software used for annotating NU Human Grasping Database.
%
% This particular gui will allow users to select one of 35 grasp types
% liste... |
function power= kalman_filter(j,decV,p)
%Initialisation
A=[0.2 0;0 0.1];%System Matrix
C=[1 2]; %Measurement Matrix
eig(A);
mu0=0;%mean of the initial random state vector
mu1=[0;0];%mean of Proess noise W
mu2=0;%mean of measurment noise V
sig0=0;%standard deviation of the random initial state vector X
%sig1=... |
function class = classifyBayes(x, k)
lik = zeros(size(x,1),size(x,2));
for n = 1:length(k)
lik(n,:) = likelihood(x, k(n).theta);
lik(n,:) = lik(n,:) * k(n).prior;
end
class = lik(1,:) > lik(2,:);
end |
function [A, a,resi] = leastSquares(x,y,N)
%discrete least-squares
y = y';
N = N+1;
length = size(x, 2);
A = zeros(length, N);
for i = 1:length
for j = 1:N
A(i, j)=x(i)^(j-1);
end
end
[Q,R] = qrmgs(A);
a = R\Q'*y; %coefficients accord... |
% Calculates the error given by the Richardson's Exterpolation function.
% Instead of using delta_x as an input variable, N is used.
function errorh = RichardsonExtrap(NIntegral, twoNIntegral)
% NIntegral = Integral of function with N-subintervals
% twoNIntegral = Integral of function with 2N-subintervals
e... |
R1 = rotx(pi/2)
trplot(R1)
tranimate(R1) |
function [ hit, final, lasso, ridge, USED, fitStore ] = IterLasso( X, Y, CVBLOCKS, STOPPING_RULE )
%% Iterative Lasso
% This function preform iterative Lasso
% It needs the following inputs:
% % % X: The data set
% % % Y: The row labels
% % % CVBLOCKS: The cv indices
% % % STOPPING_RULE: Stop after n non-significant i... |
function [fitnessValue,detailedFval] = fitness(distances, pop, stateNum)
%%%%%%%%%%%%参数说明%%%%%%%%%%%%%
% distances:传感器与目标之间的距离,100*100
% pop:种群,包含所有序列,种群大小*(100*stateNum)
% stateNum:单位周期传感器状态数
% fitnessValue:各序列适应度值,越大越优,种群大小*1
% detailedFval:各序列分项适应度值,种群大小*3,3项包括:
% 周期内各状态目标成功检测率的平均值;
% ... |
function filenameList = getFilenameList( directory, varargin )
if(nargin >= 2)
stripExtension = varargin{1};
else
stripExtension = false;
end
if(nargin >= 3)
extensionSpecifier = ['*.' varargin{2}];
else
extensionSpecifier = '';
end
% Get the entire contents of the directory
dirContent... |
function iF = InverseFilter(T,F0,Ff)
% ...
% iF = InverseFilter(T,F0,Ff) :: Funcion que realiza un filtro inverso de tiempo T [segundos]
% Funcion con argumento de entrada:
% T[segundos] = tiempo de duracion.
% F0[Hz] = frecuencia inicial.
% ... |
%Lotanna Ezenwa, Problem Set 3, #2
%PS3_2.m
%% Due Wednesday, April 13th, 2016
clear
me = LotaEzenwa();
code = me.id;
N = 15;
A = diag([-3, -2*ones(1,N-2), -3]);
A = A + diag(ones(1,N-1),1);
A = A + diag(ones(1,N-1),-1);
[V,D] = eig(A);
E = diag(D);
sm = max(1./abs(E));
for n=1:length(E)
if sm == 1/abs(E(n))
... |
% Function to create rtp files for center track FOVs
%
% Written by Paul Schou (Nov 2010)
%
% Updated: 11 Mar 2011 added data to calnum
%
airs_paths
mdate = JOB(1);
rtplist = findfiles(['/asl/data/rtprod_airs/' datestr(mdate,'yyyy/mm/dd') '/AIRS_L1B_CTR_' datestr(mdate,'yyyymmdd') '*.rtp']);
%if length(rtplist) > ... |
function sLabel = bow_recognition_nearest(histogram,vBoWPos,vBoWNeg)
% Find the nearest neighbor in the positive and negative sets
% and decide based on this neighbor
% nearest distance
[DistPos, ~] = min(sqrt(sum((histogram - vBoWPos).^2, 2)));
[DistNeg, ~] = min(sqrt(sum((histogram - vBoWNeg).^2, 2)));
... |
clc
clear all
% x = [1 2 3 4]%input('Enter Sequence: ');
% Y = fft(x)
%
% ix = ifft(Y)
% clc
% clear all
% x = [1 2 3 4]
% N = length(x);
% n = [0:N-1];
% k = n;
% WN = exp(-i*2*pi/N);
% nk = n'*k;
% WNnk = WN.^nk;
% Xk = x*WNnk;
% Xk
fs = 256;
t = 0:1/fs:1;
N = length(t);
signal = 2*sin(2*pi*100*t) + 4*sin(2*pi*50... |
function utilities = RBES_compute_utilities4(results,variables,types,weights,res_str)
%% RBES_compute_utilities3.m
%
% Usage: = RBES_compute_utilities3(results,weights)
% global params
switch res_str
case 'cell'
results = RBES_change_results_struct(results);
narc = length(results.(variables{1}));
... |
% ASEN 2004 Aero Lab part 1
% 01/26/ 2020
% Ankrit Uprety
% Cole Macpherson
% Scott Mansfield
% Ryan Block
% Zach Lesan
%% Housekeeping
clear;
clc;
%% Read in Excel File
dataAirfoil = xlsread("Tempest UAS Airfoil and CFD Data for Lab 1.xlsx");
alphaAirfoil = dataAirfoil(:,1);
ClAirfoil = dataAirfoil(:,2)... |
function [intens_mat_norm] = data_normalizer(intens_mat)
%UNTITLED3 此处显示有关此函数的摘要
% 此处显示详细说明
% intens_mat = intens_mat/1e-4;
intens_mat_norm = zeros(size(intens_mat));
for i = 1:size(intens_mat,2)
intens_mat_norm(:,i) = 2e3*normalize(intens_mat(:,i),'norm',2);
end
intens_mat_norm = round(intens_mat_n... |
%% complex_number_plot.m
% plots a complex number on the complex plane
%
% INPUTS
% z: a complex number
% color: color character for plot
function [] = complex_number_plot(z,color)
scatter(real(z),imag(z),'kx'); hold on
plot([0 real(z)],[0 imag(z)],color)
xlabel('Re[z]')
ylabel('Im[z]')
axis square tight
grid on
axi... |
clear;
addpath(genpath('~/github/global_tool'));
bu4d = dir('BU-4DFE/*/*/*.wrl');
for i_b = 1:length(bu4d)
i_b
name = [bu4d(i_b).folder filesep bu4d(i_b).name];
name = name(1:end-4);
split_idx = strfind(name,filesep);
saved_name = name(split_idx(end-2) + 1: end);
name = name(split_idx(end-3) +... |
function [Res,Data] = HistM(Pic)
%A function that calculates the Histogram of a function for each of the
% intensity levels
% Input : Picture file
clc
close all;
PicInfo=imfinfo(Pic);
L=PicInfo.BitsPerSample;
Levels=2^L;
Res=zeros(1,Levels);
Data=imread(Pic);
[m,n]=size(Data);
for i=1:m
for j=1:n
t=Data... |
clc
clear all
close all
B = gaussian(0.1, 0.3, 200, 1000, 1);
[d, N] = size(B);
n = 4;
k = 4;
tol = 0.00001;
[D1, X, error] = K_SVD(B, n, k, tol, 20000);
save('D1','D1')
B = gaussian(0.2, 0.6, 200, 1000, 2);
[d, N] = size(B);
n = 4;
k = 4;
tol = 0.00001;
[D2, X, error] = K_SVD(B, n, k, tol, 20000);
... |
function [opts,opts2]=optndfts(args,varargin)
% optndfts Create option struct with default values for those not given
% 2015-09-07 Matlab Copyright (c) 2015, W J Whiten BSD License
%
% opts=optndfts(args,dflts)
% opts=optndfts(args,initial,dflts)
% args Typically varargin from calling function
% A ... |
function [bx,by,bz] = bezier2(Bx ,By ,Bz,u,v)
% Opis:
% bezier2 vrne točke na Bezierjevi ploskvi iz tenzorskega
% produkta
%
% Definicija:
% [bx,by,bz] = bezier2(Bx,By ,Bz,u,v)
%
% Vhodni podatki:
% Bx , By, Bz matrike velikosti n+1 x m+1, ki določajo
% koordinate kontrolnih točk ,
% u, v v... |
clear all;
filePath = 'C:\Users\User\Desktop\Final Project\Statistics\statistic.mat';
data = load(filePath);
statistic = data.statistic;
% x = number of optimise
% y = number of optimise
% z = number of features
[x, y, z] = size(statistic);
z = z - 3;
S = zeros(x, y, z);
V = zeros(x, z);
%% Build V vec... |
function [alfaHat, c]=forward(mc,pX)
%[alfaHat, c]=forward(mc,pX)
%calculates state and observation probabilities for one single data sequence,
%using the forward algorithm, for a given single MarkovChain object,
%to be used when the MarkovChain is included in a HMM object.
%
%Input:
%mc= single MarkovChain object
%pX=... |
% 提取尖锐特征重新参数化带约束连续V系统拟合
close
clear
plan=3;
switch plan
case 1
load bird200.mat
N=4;
rd=3;
case 2
load fire500.mat
N=4;
rd=2;
case 3
load yezi600.mat
N=4;
rd=1;
case 4
load shizi1500.mat
N=4;
rd=0.1;
case... |
function [hop] =find_hop(i,n,N,A)
%find the hops between agent i and m by findpath
p_s=[];
p_t=[];
s=0;t=0;
for j=1:N
for m=1:N
if A(j,m)==1
s=s+1;t=t+1;
p_s(s)=j;
p_t(t)=m;
end
end
end
G = digraph(p_s,p_t);
P = shortestpath(G,i,n); % find the shortest path b... |
function [T,M]=tzirc(CaO, Na2O, K2O, Al2O3, SiO2, TiO2, FeOT, MgO, MnO, P2O5, Zr, varargin)
% [T,M]=tzirc(CaO, Na2O, K2O, Al2O3, SiO2, TiO2, FeOT, MgO, MnO, P2O5, Zr, varargin)
% Calculate zircon saturation temperature in C
%Cation ratio
Na=Na2O/30.9895;
K=K2O/47.0827;
Ca=CaO/56.0774;
Al=Al2O3/50.9806;
Si=SiO2/60.0843... |
% Define a variable "rad1" and set its value to 10cm.
rad1 = 0.10;
% a) Calculate the area of a circle with its radius = rad1;
areaCircle = pi*(rad1^2);
% b) Calculate volume of a cube with all sides = rad1.
cubeVolume = rad1^3;
disp("rad1 = " + rad1);
disp("Area of Circle. A = pi*r^2");
disp("A = " + areaCircle)... |
%--------------------------------------------------------------------------
%------------ Metody Systemowe i Decyzyjne w Informatyce ----------------
%--------------------------------------------------------------------------
% Zadanie 3: Detekcja twarzy
% autorzy: A. Gonczarek, J.M. Tomczak, S. Zaręba, M. Zięba
% 20... |
function [row_sample, col_sample, N] = edge_detection_waiyuan(polarv,pupil_radius)
% 用直方图统计的方法去除误点
% 边缘检测
[ROI_row, ROI_col] = size(polarv);
% 去除睫毛 对边缘检测的影响
if 0
polarv1 = polarv;
for i = 1 : ROI_row
for j = 4 : ROI_col - 4
b = polarv(i, j - 3 : j + 3);
[d aa] = sort(b);
polarv1(i, j) = d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.