text stringlengths 8 6.12M |
|---|
function [ rssi ] = rssi_value( rad )
%RSSI_VALUE Summary of this function goes here
% Detailed explanation goes here
rssi = -(20*log10(rad)-36);%-rand()*0.1);
end
|
function Y = FWD_LPCA( im, PCA_idx, PCA_D, par )
b = par.win;
st = par.step;
[h w] = size(im);
Y = zeros(b*b, floor(h*w/st));
cnt = 1;
for row = 1:st:h
if (row+b-1) > h
row = h-b+1;
end
for col = 1:st:w
if (col+b-1) > w
... |
function f= fermi(sz,radius,width)
% usage ... fermi(sz,radius,width)
% sz - matrix size, radius - radius of window, width - transition width
% negative width will give "standard width" = 20*radius/128
%
% [x,y]= meshdom(-64:1:63, 63:-1:-64);
% f= 1 ./ (1 + exp((sqrt(x.^2 + y.^2) - radius) ./ (10*steepness/256)))... |
figure
% construct polygons
line([.3 .7 .6 .3],[.1 .6 .8 .1],'color',[0 0 0])
line([.2 .7 .4 .2],[.4 .2 .7 .4],'color',[0 0 0])
% create grid
[x y] = meshgrid([0:0.001:1],[0:0.001:1]);
% find all point inside the polygon
in = inpolygon(x,y,[.3 .7 .6],[.1 .6 .8]);
h = plot([.3 .7 .6 .3],[.1 .6 .8 .1],x(in),y(in... |
k=1;
members=sort(properties(GRID));
timein=1:150;
t=timein./250;
tf=(0:75)/150*250;
txlim=[0 0.6];
fxlim=[0 125];
%for j=1:100
for j=1:numel(members)
S=GRID.(members{j}).copy;
tmp1=S.default.trial_amp('classes',{0},'blocks_in',1,'channels',1:10,'vis','off','badrem','yes');
tmp3=S.default.... |
PL=0.2;
A = [-5 0 -100; 2 -2 0; 0 0.1 -0.08];
B = [0; 0; -0.1]; BPL=PL*B;
C = [0 0 1];
D = 0;
Q = [20 0 0; 0 10 0; 0 0 5];
R = .15;
[K, P] = lqr2(A, B, Q, R)
Af = A - B*K
t=0:0.02:1;
[y, x] = step(Af, BPL, C, D, 1, t);
plot(t, y), grid
xlabel('t, sec'), ylabel('pu')
disp('(b) Open sim12xx1.md... |
clear
close all
clc
addpath('./MIMOMU_plot');
addpath('../function2use');
SNR=-10:2:30;
EPOCH=10000;
SNR_Len=length(SNR);
[C_mf_rand,C_zf_rand,C_mmse_rand,C_k_mf_rand,C_k_zf_rand,C_k_mmse_rand]=MIMORandom_plot(EPOCH,SNR);
[C_mf_sus,C_zf_sus,C_mmse_sus,C_k_mf_sus,C_k_zf_sus,C_k_mmse_sus]=MIMOSus_plot(EPOCH,SNR);
C_... |
function calcSigyVarEp
color = [[0.90 0.10 0.10];[0.10 0.90 0.10];[0.10 0.10 0.90];...
[0.75 0.25 1.00];[1.00 0.75 0.25];[0.15 0.30 0.70];...
[0.10 0.80 0.30];[0.25 0.75 1.00];[0.66 0.60 0.00];...
[0.60 0.20 0.00];[0.60 0.72 0.00];[0.30 0.55 0.60]];
fid = fopen('ProcData/AlDataEp0... |
function h=carpettext(x1, x2, y, offset, x1p, x2p, str, xoff, yoff, varargin)
%CARPETTEXT Prints text on carpet plot axes.
% h = carpettext(x1, x2, y, offset, x1p, x2p, str) Prints text
% on a carpet plot grid. The carpet plot coordinates are defined by
% (x1, x2, y, offset) as described in CARPET. x1p, x2p sp... |
mask = [-ones(32,16) ones(32,16)];
I= zeros(128);
I(64,64)=1;
subplot(2,2,1);
imagesc(I);colormap gray;colorbar;
Icorr = filter2(mask,I,'same');
Iconv = conv2(I,mask,'same');
subplot(2,2,2);
imagesc(mask);colorbar;
subplot(2,2,3);
imagesc(Icorr);colorbar;
subplot(2,2,4);
imagesc(Iconv);colorbar;
%%
clear;
close all;
... |
% MSWDEN 1 次元複数信号のウェーブレットを使ったノイズ除去
%
% MSWDEN は、スレッシュホールドを計算し、選択したオプションに従って
% ウェーブレットを使って 1-D 信号のノイズ除去を行ないます。
% OUTPUTS = MSWDEN(OPTION,INPUTS) は、一般的なシンタックスで、OPTION に
% 対する有効な値はつぎの通りです。
% 'den' , 'densig' , 'dendec' , 'thr'
%
% [XD,DECDEN,THRESH] = MSWDEN('den',DEC,METH) または
% [XD,DECDEN,THRESH]... |
function [expDes]=designConfig(const)
% ----------------------------------------------------------------------
% [expDes]=designConfig(const)
% ----------------------------------------------------------------------
% Goal of the function :
% Compute an experimental randomised matrix containing all variable data
% used ... |
function [ flt ] = desiRawFilterBatch(mz,sp)
%desiRawFilterBatch
res = [10000:5000:50000];
numR = numel(res);
flt = zeros(numR,numel(sp));
for n = 1:numR
flt(n,:) = desiRawFilter(mz,sp,res(n));
end
flt = bsxfun(@minus,flt,[10000:10000:90000]');
figure;
h = plot(mz,flt);
legend(h,int2str(res'))
end
... |
function imspec(in,offset)
%
% imspec(in,offset)
%
% Displays the Discrete-Space Fourier Transform (DSFT) of an image.
% Uses fft2( ) to compute samples of the DSFT.
% The log of the values of the magnitude spectrum are mapped
% to grayscale values and diaplyed as an image. The
% phase values are linearly mapped to ... |
%% Estimating R from known targets
% Input target positions in form x_measured and y_measured
% Input measured x and y of centre target centre (1x2 matrix)
% (Also input R for comparison)
% Load avgF variable into Workspace (camera estimated focal length)
%% Automated sorting Arduino script
ARD = serialpo... |
function [ output ] = h(x, invsigma, mu, constant )
%H Computes our gaussian.
% Detailed explanation goes here
output = constant * exp(-.5 * ((x-mu).' * invsigma * (x-mu)));
end
|
%
% irpInitData is used to define the data needed for extrinsic calibration.
% Defined are:
% f: camera focal length
% s: pixel ratio
% cc: camera principal point
% kc: camera distortion parameters
% calib_dist: distance of the calibration points on the calibration planes
f = 849.25423;
s = [1; 853.76693/849... |
function fig = copyCurrentAxes(view)
%copyCurrentAxes
% Copy into new figure
copyobj(gca,figure);
% Get the axes handle
g = findobj('Parent',gcf,'Type','axes');
if nargin == 0
view = 'full';
end
% Set the new position
switch view
case 'full'
set(g,'Position',[0 0 1 1]);
case 'normal'
... |
% pitchDetectionZCR.m
% Dan Hirlinger
% 11/6/2020
clear;clc;
% initialize variables
[x,Fs] = audioread('testSignal.wav');
Ts = 1/Fs;
bufferSize = 512;
overlapPct = 0.5; % 50%
overlap = bufferSize * overlapPct;
N = length(x);
% determine number of buffer segments based on signal length, buffer size,
% and the overlap
n... |
video_path = 'road_traffic.mp4';
v = VideoReader(video_path);
h = v.Height
w = v.Width
%%
vidObj = VideoReader('road_traffic.mp4'); % video file
%% Read the video frame by frame
numFrames = 0;
iwant = cell([],1) ;
total = int16(fix(vidObj.FrameRate*vidObj.Duration));
A= zeros(total,w*h);
for i=1:to... |
%% This function is p part of orginal matlab function named "nsdcalc.m"
% written by Cooper and Cowan (2008). This part of the code used as per
% the instruction provided at http://software.seg.org/disclaimer.txt
%% ******************************************************
% Copyright (c) 2008 by the Society of Explora... |
function [tout,yout] = rk4(odefun,tspan,y0,options)
%
% [tout,yout] = rk4(odefun,tspan,y0,options)
%
% Metodo di Eulero modificato (esplicito) (Runge-Kutta a 2 stadi)
%
% Risolve l'ODE y'(t) = odefun(t,y(t))
%
% INPUTS:
% odefun : campo vettoriale associato
% tspan : vettore di tempi [t0,t0+tstar]
% y... |
function varargout = maxicalc(varargin)
% MAXICALC MATLAB code for maxicalc.fig
% MAXICALC, by itself, creates a new MAXICALC or raises the existing
% singleton*.
%
% H = MAXICALC returns the handle to a new MAXICALC or the handle to
% the existing singleton*.
%
% MAXICALC('CALLBACK',hObject,ev... |
function [fas_estoc_gamma] = gamma_mod (fas_estoc,H_mod)
fas_estoc_gamma = fas_estoc;
% gamma_mod = gamma_orig*(1-modulacao);
gamma_mod = - 2*H_mod;
amp_mod = 1+(H_mod./2);
% amp_mod = 1+(H_mod./1.5);
for k=1:length(fas_estoc)
if fas_estoc(k).gamma(1) + gamma_mod < 0
fas_estoc_gamma(k).gamma(1) = fa... |
function [yP,W,esp] = counterflow(xF,alpha,phi,theta)
log_xR = fzero(@minfunc,[0,xF]);
options = optimset('Display','off','TolFun',1e-12);
%log_xR = fsolve(@minfunc,xF,options)
%log_xR = fmincon(@minfunc,(log10(xF))/15,[],[],[],[],-4,log10(xF),[],options);
xR = log_xR;
esp = (minfunc(log_xR));
yP = (xF - (1-thet... |
%% Proposed ALGORITHM: Gauss Mapped Variable Neighbourhood Particle Swarm Optimization (GM_VNPSO)
%% Developers:
% Kartik S. Pandya, Professor, Dept. of Electrical Engineering, CSPIT,
% CHARUSAT, Gujarat, INDIA
% Jigar Sarda, Asst. Professor, Dept. of Electrical Engineering, CSPIT,
% CHARUSAT, Gujarat, INDIA
% Margi S... |
%%
% "Amerikaner" This Dummie is split in half between the Grey Values 1 and 0
% the geometric arrangement and algebraic characteristics are designed to
% create a minimal entropy over the ROI (hyp.: entropy = 0)
% Amerikaner is created as a default confirmation of 'entropy' in respecitve toolboxes
dummy_prae = ... |
classdef testADLStoreOptions < matlab.unittest.TestCase
% TESTDLSTORECLIENT This is a test stub for a unit testing
% The assertions that you can use in your test cases:
%
% assertTrue
% assertFalse
% assertEqual
% assertFilesEqual
% assertElementsAlmostEqual
% asser... |
function [ surrogate_network ] = gen_surrogate_data( model)
% Shuffles channels in time to generates one surrogate network.
data = model.data;
window_size = model.window_size * model.sampling_frequency; % window size (samples)
n = size(data,1); % size of network
T = size(data,2); % length of network
% shuffle i... |
classdef PF_Fc_DtS_DwS < PF_Fc & iU_Compositional
%PF_Fc_DtS_DwS Summary of this class goes here
% Detailed explanation goes here
methods
function obj = PF_Fc_DtS_DwS(f)
obj = obj@PF_Fc(f);
end
end
end
|
function cp(source, destination)
% FUNCTION cp(source, destination)
% Copies files from source to destination
copyfile(source, destination) |
%Exit_LRsounds
if(S232('getAPlockstatus') & S232('getXBlockstatus'))
S232('PA4mute',1);
S232('PA4mute',2);
S232('PD1stop',1);
S232('PD1clear',1);
S232('trash');
S232('dropall');
S232('S2close') % close application and release AP2 and XBUS locks
end
m110dx( C_.STOP);
if(exist1('H.rast... |
clear
H1 = dlmread('hybrid.txt', ',', 0, 0);
HR1 = dlmread('hybrid_repo.txt', ',', 0, 1);
HRP1 = dlmread('hybrid_pro_repo.txt', ',', 0, 1);
HRR1 = dlmread('hybrid_re_repo.txt', ',', 0, 1);
HRS1 = dlmread('hybrid_spec_repo.txt', ',', 0, 1);
% RG1 = dlmread('gen_r_replicas.txt', ',', 0, 0);
% RP1 = dlmread('pr... |
%% --------------------------- Missile Parameters ------------------------- %
clc; clear all; close all; set(0,'defaultfigurecolor',[1 1 1]);
global rho_v rho_v_max tF M_d T_m rho_w Vc tau N K K_dth dt tout resolution
% ---------------------- Initialize Simulation --------------------- %
MP = 1; NMP = -1; Dyn_sgn... |
% copyright (c) by Yangyang Xu, Oct. 2012
% yangyang.xu@rice.edu
%
% Paper:
% M.-J. Lai, Y. Xu, W. Yin.
% Improved iteratively reweighted least squares for unconstrained smoothed lq
% minimization, SIAM Journal on Numerical Analysis, 5(2), 927-957, 2013.
clear; close all;
%% sparse vector recovery
m = 64; % samp... |
% the probability density function of noncentral chi-squared distribution
function p = chi2_pdf(x,k,c)
if ~exist('c','var') || c==0
p = chi2pdf(x, k);
return
end
p = 0.5*exp(-0.5*(x+c)) .* (x./c).^(k/4-1/2) .* besseli(k/2-1, sqrt(c*x));
end
|
function z = cost(x,y)
z = vecnorm(x-y,1,2);
end |
function hw2_q1()
function L = l(x,y)
L = x.^2+y.^2+3
end
function FS = fs(x,y)
FS = 1./(1+x.^2+y.^2);
end
function res = double(x,y)
res = l(x,y).*fs(x,y).*fs(x,y);
end
h = @double
res = quad2d(h, -3,3,-2,2)
end
|
% this function constructs signal for bps transmission
function [sign_out] = construct_signal_bpsk(sign_inf, sign_sync_b1, sign_sync_b2, delay, freq_burst)
% input:
% sign_inf - information signal
% sign_sync - sync signal B1
% delay - time delay in a beginning of transmission (unit is bit)
% output:
% sign_out... |
function out = gibsonlanni(varargin)
fprintf('Calculating PSF... ')
% Input parser
ip = inputParser;
addOptional(ip, 'n', [128,128,129]);
addOptional(ip, 'res', [50,50,100]);
addOptional(ip, 'zp', 0, @(x)isnumeric(x));
addOptional(ip, 'NA', 1.4, @(x)isnumeric(x));
addOptional(ip, 'ni', 1.5, @(x)isnumeric(x));
addO... |
close all
% conditional probability
duration=200;
TR=1;
SECONDS=1;
noise = 0.1;
hrf_var = 0.1;
nevents = 10;
extra_events = 5;
threshold = 0.3;
binsize = 2;
NITER = 10000;
doPlots =1;
FWHM = 2;
co = 0.95;
eventsa = [];
eventsb = [];
for iter=1:NITER
fprintf('\riteration: %d',iter);
a = zeros(duration,1);
b... |
function plot(basisobj, nx)
% Plot a basis object.
% last modified 6 January 2003
if nargin < 2, nx = 101; end
rangex = getbasisrange(basisobj);
x = linspace(rangex(1),rangex(2),nx)';
basismat = full(eval_basis(basisobj, x));
plot (x, basismat, '-');
axis([x(1), x(nx), min(min(basismat)), max(max(basism... |
function [dx, dy, dz] = gradf(u, mask, vsz)
%GRADF First order forward difference gradient.
% Boundary condition: u^{k+1} - 2u^{k} + u^{k-1} = 0.
%
% [dx, dy, dz] = GRADF(u, [mask], [vsz]);
%
% See also GRADB, GRADC, GRADFADJ
narginchk(1, 3);
if nargin < 3, vsz = [1, 1, 1]; end
if nargin < 2 || ise... |
rngeMHz=333;
NGRD=128;
omarr=2*pi*linspace(-rngeMHz,rngeMHz,NGRD);
for B0=[34050,3300,12540,6100]
for Rpll = 5 %6?
strng=strcat(num2str(B0),'_',num2str(Rpll));
for angle2="90.0" %["0.000001","45.0","90.0"]
for cA = 0.5 %[0.1,0.5,0.9]
for ksym = 1 %[0,0.1,1]
... |
function transform = imuTrans(name, frame, T_f_raw_svdAvg, T_f_0_svdAvg, T_f_imu_svdAvg)
%Transformation From IMU frame into World Frame
switch nargin
case 2
transform.name = name;
transform.frame = frame.name;
transform.T_f_imu = [];
transform.T_f_0 = [];... |
function caldrawdown(myfts, zetas, minzeta)
%set(0,'DefaultFigureVisible','on')
index = fts2mat(myfts.series1);
LEN = length(index);
[pks, locs] = findpeaks(zetas, (1:LEN)');
%figure;
subplot(2,1,1);
plot(myfts.dates,index);
datetick('x','dd/mm/yyyy');
hold on
cnt = 0;
correct = 0;
for i = 1:length(locs)
d = loc... |
%{
# sample
-> tutorial.Session
sample_id : tinyint # id of the sample
---
sample_notes = null : char(128) #
sample_ts = CURRENT_TIMESTAMP : timestamp #
%}
classdef Sample < dj.Manual
end
|
function [] = signoise_subplot(sigvec,ncsvec,m,b,name)
plot(sigvec, ncsvec, 'o'); hold on
plot([-1,1], [-m+b, m+b], '--k')
grid on
title(name)
xlabel('Signal Corr.')
ylabel('Noise Corr.')
ylim([-0.5,1])
legend({'Data', 'Fit line'}, 'Location', 'SouthEast')
end |
%Q6
function ShowImageWithLabels (n)
allTrainImages = loadMNISTImages('./train-images.idx3-ubyte');
allTrainLabels = loadMNISTLabels('./train-labels.idx1-ubyte');
mdl = fitcknn(allTrainImages', allTrainLabels);
allTestImages = loadMNISTImages('./t10k-images.idx3-ubyte');
allTestLabels = lo... |
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR
% Autores: Gonzalo Pajares y Jesús Manuel de la Cruz
% Copyright RA-MA, 2007
% Ejercicio 12.2: Formas a partir de la intensidad
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 12.7.1 Ecuación de reflectancia
%%%%%%%%%%%%%%%%%%%%%%%%%... |
clear all;tic
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This code trains an ELM in just four lines of matlab code. It can achieve the following performance:
%-if M = 1600, an error rate on MNIST of 94.5% correct on test data in about 14 seconds (on a f... |
function STATS=mwwtest(x1,x2)
%Mann-Whitney-Wilcoxon non parametric test for two unpaired groups.
%This file execute the non parametric Mann-Whitney-Wilcoxon test to evaluate the
%difference between unpaired samples. If the number of combinations is less than
%20000, the algorithm calculates the exact ranks distributio... |
clc
close all
clear all
% default plotting style
fs = 16; % font size
ms = 10; % marker size
lw = 2; % line width
% Load data from CSV file
[datafile,pathname] = uigetfile('*.xls','Pick data file');
if isequal(datafile,0)
return
end
cd(pathname)
if exist('datafile','var') && ~isempty(datafile)
disp... |
% TPA_ShowEventsRois
% Script to show how to use ROI and Event data structures.
% Select analysis directory that contains TPA_*.mat and BDA_*.mat files, load them and display.
% Inputs:
% directory to be analysed
% Outputs:
% view of the data
% Event structure description:
% strEvent.Type = 1; ... |
% [y, fs] = audioread('uraman.mp3');
%% mySine: function description
function [outputs] = mySine(duration, freq)
fs = 16000;
time = (0:duration*fs-1);
if freq(1) <= freq(2)
mfreq = (freq(1)+time*(freq(2)-freq(1))/(duration*fs-1));
y = sin((mfreq*2*pi).*(time/fs));
else
mfreq = (freq(2)+time*(freq(1)-freq(2))/... |
main_dir = '/mnt/40086D4C086D41D0/Reverb_data/Sorted';
animal_list = dir(main_dir);
animal_list = animal_list(~ismember({animal_list.name},{'.','..'}));
for animal = 1:numel(animal_list)
fprintf('== Processing animal %s ==\n',animal_list(animal).name);
pen_dir = dir([fullfile(animal_list(animal).folder,animal... |
function [V1,V2,VET1,VET2,RC,RCH,RCD,Phase,RatioPfMd]=Vaccination_over_Time(UpTake,nVEI,nVES, nVEH, nVED, Rollout, SLOWER, DATE)
%%
%
%%
Separation=11*7;
Delay=14;
Inf_to_Symp=5;
load Surrogate_Vacc_Data.mat
Vacc1(:,DATE:end,:)=[];
Vacc2(:,DATE:end,:)=[];
load Other_Data.mat
Vacc1=Vacc1*SLOWER;
Vacc2=Vacc2*SLOWER... |
%
% Nov. 3, 2018, He Zhang, hzhang8@vcu.edu
%
% plot the trajectories of result in comp_d6 folder
%
addpath('../');
addpath('.');
tr1 = load('./comp/vins_d6.log');
tr2 = load('./comp/vins_rs_d6.log');
tr3 = load('./comp/dvio_tra_d6.log');
tr4 = load('./comp/dvio_sam_d6.log');
plot_xyz(tr1(:,2), tr1(:,3), tr... |
%Answer to Question 4
clc
clear all%clearing all previous outputs and variables
syms a d cos(theta) sin(theta) cos(alpha) sin(alpha) %Defining all the variables through syms
r_z_theta=[cos(theta) -sin(theta) 0 0;sin(theta) cos(theta) 0 0;0 0 1 0;0 0 0 1];%defining rotation through theta around the z axis
trform... |
function [ t ] = T_xy( x, y )
%Analitical solution for the bounfry value problem of worksheet 4 (1)(2)
t = sin(pi.* x') * sin ( pi.* y);
end
|
function [Qfp, x_stencil, y_stencil] = ENO_Interpolation(NV, Order, dx, dy, x, y, Q, dPdx,...
Xp, Yp, i1, j1, Left, Right, Bottom, Top, cx, cy)
if Xp < 0
i0 = Right(i1,j1)-Order+1;
else
i0 = Left(i1,j1);
end
if Yp <= 0
j0 = Top (i1,j1)-Order+1;
else
j0 = Bottom(i1,j1);
end
xa = x(i... |
%% calculate the MI for model
function I = MutualInfo(model)
pi = model.pi;
theta_jc = model.theta; % individual theta
[~, J] = size(theta_jc);
I = zeros(1, J); % store the value for I_j
for i = 1:J
theta_temp = theta_jc(:, i);
theta_j = sum(pi .* theta_temp); % marginal theta
I(i) = sum(theta_temp .* pi ... |
clc; clear; close all;
origin=imread('F:\pic\ls\gz3.jpg');
origin=rgb2gray(origin);
place=imread('F:\pic\ls\L2sreskk.jpg');
%place=rgb2gray(place);
res=origin;
[y,x]=size(place);
for ctr=1:y
for itr=1:x
if origin(ctr, itr) == 255 && place(ctr, itr) == 1
res(ctr, itr) = 255;
else
... |
function [ gyroMea, RMea, RTrue, biasTrue ] = genTrig( t, sf, parameters )
% generate a reference rotational motion with noisy angular velocity and
% attitude measurement. The rotational motion is that the three body-fixed
% 3-2-1 Euler angles follow sinusoid functions with frequency at 0.35Hz and
% amplitude at pi, pi... |
function [phones,startstops] = getPhnData(fname)
% GETPHNDATA get a file list of phn and wav files for a speaker.
% directory is the directory speaker folders are located in.
% speakerName is the id names of the speaker
% phnFiles and wavFiles are arrays of directory structures.
currentRecPhnFID = fopen(fname);
p... |
% AdaBoost 弱假设对一组样本进行分类,获得AdaBoost弱假设对所有样本的预测输出
% AdaBoost 弱假设为二值分类器
% AdaBoostWeakLearnerClassfy
% 输入:
% Samples 待分类的样本, cntSamples x cntFeatures 矩阵
% cntSamples 待分类的样本的数量
% cntFeatures 特征空间维数
% weakLearner 给定的弱分类器,此处采用的是二值分类器
% 输出:
% predictOutput AdaBoost弱分类器对每个样本的预测输出,其值为0或者1
%... |
% LSINFO リフティングスキームについての情報
%
% リフティングスキーム (LS) は、N x 3 のセル配列です。配列の N-1 の
% 最初の行は、"基本的なリフティングステップ" (ELS) です。
% 最後の行は、LS の正規化されたものが与えられます。
%
% 各 ELS はつぎの形式です:
% {type , coefficients , max_degree}
% ここで:
% - "type" は、'p' (primal) または 'd' (dual) になります。
% - "coefficients" は、以下に記述されるLaurent多項式 P の実数で
% ... |
%Ali Alper Yüksel, 2036390
%Ulaþcan Deniz Genç, 2099034
clear;
clc;
I1 = imread('C1.png');
c1_s = dir('C1.png');
compression(I1,1,c1_s);
I2 = imread('C2.png');
I2_gray = rgb2gray(I2);
c2_s = dir('C1.png');
compression(I2_gray,2,c2_s);
I3 = imread('C3.png');
c3_s = dir('C1.png');
compression(... |
function U = poisson_fft2(F,h,power)
% U = poisson_fft2(F,h,power)
% multiply grid function on a rectangle by power of Laplacian
% with zero boundary conditions, using the sine Fourier series
% input:
% F matrix, values of the function on rectangle
% h mesh spacing
% power the desired p... |
% Runs simulation once and plots displacement
% Solve for displacments
FrameData = FrontSuspGeometryAndLoading_2019Frame;
[~,V,~] = DirectStiffnessSolver(FrameData);
Weight = GetWeight(FrameData);
DamperY = V(2,12);
DamperZ = V(3,12);
DamperTotal = sqrt((DamperY)^2+(DamperZ)^2);
RockerY = V(2,9);
RockerZ = V(3,9);
... |
function plot_exp(x, ymat)
% DATE: 2/12/2014
% DESCRIPTION: Plots EVSI for all 3 species under experimental approach
% AUTHORS: MATLAB, Payal Bal
% INPUTs
% x: vector of x data
% ymat: matrix of y data
% OUTPTS
% plots
% Create multiple lines using matrix input to plot
plot1 = plot(x,ymat,'Marker','o');
set(pl... |
clear all
dd = '';
fd = '';
fs = 14; fs2 = 12; fs3 = 10; lw = 2; lw2 = 2/2; ms = 20/2; ms2 = 9/2;
load([dd 'pi2_inflection_full.mat']);
load([dd 'pi2_dkl_full.mat']);
% to convert to dimensionful alpha_k
% native
Gammak = 100;
deltak = .001;
% synex
kk = 10;
lambda = 1e-4;
% deterministic values
ak1_native = .00072... |
function J = dopustnaResitev(c,A,b,maxstep,opcija)
%poisce dopustno resitev za linearni program ce ta obstaja. Izvedemo 1.fazo
%dvofazne simpleksne metode.
%Vhod:
% c nx1 matrika kriterijske funkcije
% A mxn matrika
% b mx1 matika
% maxstep najvecje stevilo korakov simpleksne metode, ce ga ne podamo
% izvedemo najvec... |
function musicAwards(file,categoryToChange,substitute)
% Write a function that will read through a text file to find the given category
% (2nd input), and change the winner to the one specified (3rd input).
% Then write the results to a new file, titled <originalFileName>_updated.txt.
% Example:
% results.txt:
... |
% column 1: time, column 2: pressure
clear; close all;
% data0 = xlsread('Data\22217-1.xls');
% data1 = xlsread('Data\22217-2.xls');
% data2 = xlsread('Data\22217-3.xls');
% data3 = xlsread('Data\22217-4.xls');
% data4 = xlsread('Data\22217-5.xls');
% data5 = xlsread('Data\22217-6.xls');
% data1(:,1) = data1(:,1) + d... |
function [pixels_cluster_ID,N_clusters,Clusters_size] = find_connected_clusters(pixel_indices)
% Function to find the connected clusters of a set of pixel indices.
% Input
% pixel_indices = N x N_d array consisting of the indices of N pixels in
% N_d dimensions.
% Output
% pixels_cluster_ID = N x 1 array giving the c... |
% Code that add ligament elements from .dsp file to TDSEM.osim
%% Coraco-clavicular ligaments
% Conoid
% P1= Rg2c*([11.84 1.40 7.13]/100-Oc)' %(clavicle)
% P2= Rg2s*([11.80 0.22 7.14]/100-Os)' %(scapula)
% Trapezoid
% P1= Rg2c*([13.23 1.40 6.64]/100-Oc)' %(clavicle)
% P2= Rg2s*([12.3... |
function [E] = isingEnergy(lambdakMat)
%Compute the ising energy of the conductivity field lambda as a feature function
[nr, nc] = size(lambdakMat);
%not efficient but no bottleneck
E = 0;
for c = 1:nc
for r = 1:nr
if(r > 1)
if(lambdakMat(r, c) == lambdakMat(r - 1, c))
E = E + ... |
delta = 10.^[-2;-1;0;1;2;3];
xout = newtonLikeMethod(@cute_wrap, ones(100,1), 1, 1e-9, 1000);
for i = 1:6
[x, Cl, Cf] = TrustRegion(1, 0.1, 1e-9, 1000, ones(100,1), @cute_wrap, delta(i));
err = norm(x-xout);
display([err, Cl, Cf]);
end
|
function [newnodes,newtris,label]=make_sub_mesh_tri(comp_tris,xs,closed,...
dogears) %#codegen
% PURPOSE: THIS FUNCTION MAKES A MESH FROM A SUBSET OF TRIANGLES
% LISTED IN COMP_LIST. THESE TRIANGLES ARE TYPICALLY A SPECIFIC
% COMPONENT OF A LARGER MESH. XS IS THE FULL LIST OF VERTICES.
% IN ESSENCE MAKE_SUB_MESH_T... |
function[x] = gauss_seidel(A,b,x0,iters)
n = length(A);
x = x0;
for (k = 1:iters)
for i = 1:n
x(i) = 1/A(i,i) * (b(i)-A(i,1:n)*x + A(i,i)*x(i)) ;
end
end
end
|
% Tao Du
% taodu@stanford.edu
% Feb 16, 2015
% Test selectFeaturePoints.
% Clear.
clear all; clc;
% Read V and F from .obj files.
[V, F] = readObj('data/chair.obj');
V = alignObj(V);
% Define the image size.
imageSize = [640 480]';
% Define the camera parameters.
cameraPos = [0.2 0 -0.7]';
cameraLookAt = [0 0 0]';... |
clear all
file='Z:\Ross\Experiments\3.5mW_Saline_VPL\M160_L6Stim+Mech_Saline'
[FILEPATH,NAME,EXT] = fileparts(file);
cd(FILEPATH)
spikefile=[NAME '_all_channels.mat'];
load(spikefile);
load([NAME 'analysis.mat'],'Conditions','Triggers')
load([NAME '_sampling_frequency.mat'])
%% light driven units in cortex CFA??? C... |
function correct_choice = determine_correct_choice(offered,choice,correct_bool)
%outputs the stim ID of the correct sound
for iTrial = 1:length(correct_bool)
if correct_bool(iTrial)
correct_choice(iTrial,1) = offered(iTrial,choice(iTrial));
else
correct_choice(iTrial... |
function [A, b] = generate_probabilities_system(rows)
A = zeros (rows * (rows + 1) / 2); #initialising matrix A with 0
## crossing through the matrix
for i = 1 : rows * (rows + 1) / 2
for j = 1 : rows * (rows + 1) / 2
## for the element at the top of the trinagle
if (i == 1)
if (j == i)
... |
function createfigure1(X1, Y1, S1, C1, X2, YMatrix1, X3, Y2, C2, X4, Y3, X5, Y4)
%CREATEFIGURE1(X1, Y1, S1, C1, X2, YMATRIX1, X3, Y2, C2, X4, Y3, X5, Y4)
% X1: scatter x
% Y1: scatter y
% S1: scatter s
% C1: scatter c
% X2: vector of x data
% YMATRIX1: matrix of y data
% X3: scatter x
% Y2: scatter y
% ... |
%% Load data
movO = tiffRead('C:\Users\Matthias\Local\Storage\labdata\imaging\MMe001\MMe001_140330\preProcessFunctionTestActivityAcq\processed\MMe001_140330_920spontAct_001_001_slice1_ch1.tif');
% movO = tiffRead('C:\Users\Matthias\Local\Storage\labdata\laurasData\LD093_130813_view1_005\processed\LD093_130813_view1_00... |
%% Non-Photorealistic Rendering demo
% This tutorial demonstrates how to use OpenCV Non-Photorealistic Rendering
% Module:
%
% * Edge Preserve Smoothing
% - Using Normalized convolution Filter
% - Using Recursive Filter
% * Detail Enhancement
% * Pencil sketch/Color Pencil Drawing
% * Stylization
%
% <https://git... |
function [x, xm, xs] = standardize(x, scale)
%STANDARDIZE Centers and normalizes data.
%
% [XC, XM, XS] = STANDARDIZE(X) centers and normalizes the data in X to
% XC by subtracting the mean XM of each column and dividing each
% column by its standard deviation XS. If X contains missing
% values, indicated... |
% Calculate rectangularity given a polygon and a bounding box
function ratio = rectangularity(obj)
box = obj.box;
polygon = obj.contour;
X = polygon(1,:);
Y = polygon(2,:);
% Calculate area of polygon
area1 = polyarea(X,Y);
% Calculate are of bounding box
area2 = abs(box(1,1)-box(1,2))*abs(box(2,1)-b... |
function [H, S, I] = rgb2hsi(R, G, B, scale)
% This function converts RGB color space to HSI space
% RGB specifies each channel
% scale specifies the scale of the return values. 0: h[0,2pi] s[0,1] i[0,1]
R = double(R); G = double(G); B = double(B);
sumRGB = R + G + B;
r = R./sumRGB;
g = G./sumRGB;
b = B./sumRGB;
i = ... |
function [ diff, min_val, max_val ] = getDiffImg( imgToCompress, template )
%getDiffImg Computes the difference between the two images.
%
% Returns the difference image as double values between 0 and 1, as well
% as the maximum and minimum pixel values in the original integer
% difference matrix. To restore the o... |
%------------Get precision of the experiment------------------
threshold = 135;
windowSize = 31519;
windowSize = 20000;
nBreath_ann = 0;
nBreath_recgcorrect = 0;
nBreath_recg = 0;
for t=1:10
t_nBreath_ann = 0;
t_nBreath_recgcorrect = 0;
t_nBreath_recg = 0;
filename = strcat('F:\CMUlab\trainData\dat... |
Met de functie save() kun je data-bestanden aanmaken. |
% 1st derivative, p=2 SBP operator
% From SBP SAT Review paper
function [H,D1]=D1_4(n)
h11 = 17.d0/48.d0; h22 = 59.d0/48.d0; h33 = 43.d0/48.d0; h44 = 49.d0/48.d0;
q11 = -1.d0/2.d0; q12 = 59.d0/96.d0; q13 = -1.d0/12.d0; q14 = -1.d0/32.d0;
q23 = 59.d0/96.d0; q24 = 0.d0;q34 = 59.d0/96.d0;
%setting up H and D1
H = eye(n,n... |
%% ECE411 aux1 - consists of step response, bode and nyquist plots
clear all
clc
s=tf('s');
w=10;
k=1;
Gs_under=k*w^2/((s^2+.3*w*s+w^2));
figure(1);clf
subplot(1,3,1)
step(Gs_under)
subplot(1,3,2)
bode(Gs_under)
subplot(1,3,3)
nyquist(Gs_under)
% pathS=[];
% cradius=.02;
% for i=cradius:.05:500
% pathS(end+1)=com... |
% V es una matriz que en cada fila tiene uno de los individuos (pesos de la red) ordenados con el de mayor fitness primero
% F es un vector con los fitness correspondientes a las entradas de V
% k es la cantidad de individuos que quiero seleccionar (tiene que ser menor o igual al total)
function [S, T] = boltzmann(V, F... |
function libResetFigureFonts( fontIncrease, handle, tf_fontSizeGiven)
narginchk(2,3)
if (nargin < 3)
tf_fontSizeGiven = false;
end
if not(all(ishandle(handle)))
warning('Invalid graphics object handle given');
return;
end
if length(handle) > 1
for lp = 1:length(handle)
libResetFigureFonts( fontI... |
function all_theta = oneVsAll(X, y, num_labels, lambda)
% all_theta = oneVsAll(X, y, num_labels, lambda)
% trains logistic regression classifiers for each label
[m n] = size(X);
all_theta = zeros(num_labels,n+1);
X = [ones(m,1) X];
options = optimset('GradObj', 'on', 'MaxIter', 100);
init_theta = zeros(n+1, 1)... |
filename = 'SENZ3D_N_0NoChange1.mat';
resourceFilePath = strcat(pwd,'\Pipeline\EXPERIMENT\resource\', filename);
%% GLOBALS (DO NOT MODIFY)
% mls_h = 3.0;
icp_tol = 1e-4;
for mls_h = 0.3:0.1:5.0
%% LOAD RESOURCE FILE
load(resourceFilePath);
%% PERFORM LOOP
i=1;
D1 = SURF{i}; %D1=gridMLS(D1,mls_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.