text stringlengths 8 6.12M |
|---|
function [output] = normalize(data)
% edim - dimension of examples, fdim - dimension of features.
[edim fdim] = size(data);
maxdata = max(data);
mindata = min(data);
avgdata = mean(data);
divisor = max((maxdata - avgdata), (avgdata - mindata));
for i=1:fdim
output(:,i) = (data(:,i) - avgdata(1,i))./... |
%Problema 3 tema de casa.
%a)
% rezolutie temporala de 2ms
t1=0:0.002:10;
nivel1 = [ -1 1 ];
%nivel1 este dupa cum l-am si denumit primul vecor cu 2 valori: 1 si -1
hold on
%Folosim hold on pentru a retine graficul curent si pentru a adauga in
%aceeasi fereastra alte reprezentari grafice, pana se aplica "hold... |
% Section 3
close all;
clear all;
img = imread('kids.tif');
strImg = stretch(img, 70, 180);
figure(1);
image(strImg+1);
axis('image');
graymap = [0:255;0:255;0:255]'/255;
colormap(graymap);
print('-dpng', '-r300', '../report/kids_str.png');
figure(2);
hist(strImg(:),[0:255]);
xlabel('pixel intensity');
ylabel('number ... |
function [ opts Main_fig] = guiSetOpts(algs,paraTList,paraList,parasRef)
%% GUI for setting paprmeters
% algs: structure of algorithms (have fields: name,details
% paraTList: type def
% paraRefs: default values
global TDALABHOME;
FileDir=horzcat(TDALABHOME,filesep,'userdata',filesep); %% can be replaced by anyot... |
d=input('d=');
%traceA^2-4*determinantA<0
%d<0 saddle d>0 attract point[x y]=meshgrid(-3:0.25:3,-3:0.25:3);
dx=-0.5*x+d*y;
dy=-2*x-0.5*y;
quiver(x,y,dx,dy); axis tight
|
close all;clc;
%flightData = xlsread('myData.xls');
[~,~,PUCK] = xlsread('datarev.xlsx');
[~,~,TICKET] = xlsread('InputData.xlsx','Tickets');
[~,~,GATE] = xlsread('InputData.xlsx','Gates');
[flightData,~,GATE] = datasetPreprocessing(PUCK,TICKET,GATE);
%Test:100 samples
%flightData = flightData(1:300,:);
GLOBE... |
function [pre_res,rec_res,f1_res,retri_res]=AG2E(Xl,Xu,Yl,Yu,psize,mu,lambda,k_w,t_w,k_s)
% =====================
% Adaptive Graph Guided Embedding for Multi-label Annotation (AG2E)
% =====================
% Author: Lichen Wang
% Date: Dec. 27, 2018
% E-mail: wanglichenxj@gmail.com
% Input: Labeled and unlabel... |
function [alldata, mscanLag] = mergeActivityIntoAlldata_fn(alldata, activity, framesPerTrial, ...
trialNumbers, frame1RelToStartOff, badFrames, pmtOffFrames, minPts, dFOF, S_df, set2nan)
% alldata = mergeActivityIntoAlldata(alldata, activity, framesPerTrial, ...
% trialNumbers, frame1RelToStartOff [, badFrames... |
function [labels,seqs]=get_seqs(filename)
% usage: [seqID, alignment]=get_seqs(filename)
%
% Imports an alignment in .free format. In this format, an alignment is
% represented as follows: each line should contain a seqID, a tab character,
% the sequence comprised of the 20 amino-acids and a gap denoted by a
% period o... |
classdef enumNonhydroBoundaryCondition < int8
%ENUMNONHYDROBOUNDARYCONDITION 此处显示有关此类的摘要
% 此处显示详细说明
enumeration
Zero (0)
ZeroGrad (1)
end
end
|
function ffeat = frectangle(image)
sum = 0;
for x = 310:333
for y = 160:192
sum = sum + image(y,x).^2;
end
end
ffeat = sum;
end |
%% Plays clicks and noise, records response
% Initializing TDT
fig_num=99;
GB_ch=1;
FS_tag = 3;
Fs = 48828.125;
[f1RZ,RZ,~]=load_play_circuit(FS_tag,fig_num,GB_ch);
% Initialize ER-10X (Also needed for ER-10C for calibrator)
p10x = genpath('C:\Experiments\ER-10X\MATLABAPI\Matlab\');
addpath(p10x);
loaded... |
function p = getAudapterDefaultParams(sex, varargin)
switch sex
case 'male'
p.nLPC = 17;
p.fn1 = 591; % === Formant 1 === %
p.fn2 = 1314; % === Formant 2 === %
case 'female'
p.nLPC = 15; % SC-Mod(2008/02/08) Used to be 9
p.fn1 = 675;
p.fn2 = 1392;
otherwise,
error('specify sex (ma... |
function [myconv] = myConv(y1,y2)
k=0;m=0;
n = length(y1);
n1 = length(y2);
myconv =(0:n+n1-2);
while k<=n+n1-2
myconv(1,k+1)=0;
m=-n-n1+2;
while m<=k
if (m>=0 & m<=n-1 & k-m>=0 & k-m<=n1-1)
myconv(1,k+1)=myconv(1,k+1)+y1(1,m+1)*y2(1,k-m+1);
end;
m=m+1;
end;
k=k+1;
... |
function ret = bishop(varargin)
ret = 1;
end |
function t = readtable(filename,varargin)
%READTABLE Create a table by reading from a file.
% Use the READTABLE function to create a table by reading column-oriented data
% from a file. READTABLE can automatically determine the file format from its
% extension as described below.
%
% T = READTABLE(FILENAME) cre... |
%watermark embedding
imagefolder=('C:\Users\hp\Desktop\project on watermarking\database\standard_test_images');
filename=dir(fullfile(imagefolder,'*.tif'));
totalimages=numel(filename);
p=cell(totalimages,1);
s=cell(totalimages,1);
m=cell(totalimages,1);
b=cell(totalimages,1);
r=cell(totalimages,1);
b2=cell(to... |
% Last Updated: 2020/12/14
%Set initial parameters
%Measurement steps
nSteps = 64; %StepperCal = 64, RGB950 = 40
%Wavlengths of interest
LambdaList = 630;%, 630, 650, 670];
%Store number of wavelengths
nLambda = length(LambdaList);
%image size for dynamic programming (not done yet)
ROI = 1500;
%%
%Calibration fil... |
syms z1 z2 z3 z4 u m l g M
dxdt = [z2;
(u+m*l*sin(z3)*z4^2-m*g*cos(z3)*sin(z3)) / (M+m-m*cos(z3)^2);
z4;
(u*cos(z3)-(M+m)*g*sin(z3)+m*l*cos(z3)*sin(z3)*z4^2) / (m*l*cos(z3)^2-(M+m)*l)];
jacobian(dxdt, [z1, z2, z3, z4])
|
function [indic_dominate] = domination_compare(data_1,data_2)
%this function perform the domination relation comparison
%return value meanings
%1: data_1 dominates data_2
%2: data_2 dominates data_1
%0: data_1 and data_2 do not dominate each other
if data_1(1)==data_2(1)
if data_1(2)==data_2(2)
indic_domina... |
c = 55/201;
Bx = [0 2 6 8;
1 3 7 nan;
2 5 nan nan;
4 nan nan nan];
By = [0 1 0 -1;
2 2 3 nan;
4 3 nan nan;
5 nan nan nan];
Bz = [-2 1 -2 0;
4 -2 3 nan;
0 5 nan nan;
3 nan nan nan];
T = [0 0; 1 0; 0 1];
T0 = [0.25 c];
bar = pointbary(T0,T)
p0 = decasteljau3(Bx,By,Bz,bar);
norm(... |
%simulation of low earth sattelite
clear;
clc;
planet
global rt_hat;
global timespan;
global tether_s;
global tether_v;
%initial conditions
m_s=50; %mass of spacecraft in kg
m_v=25000;
altitude=408*1000; % in meters
x0=R+altitude;
y0=0;
z0=0;
semimajor=norm([x0;y0;z0]);
inclination=0;
Vcirc=sqr... |
omega = 7.2921150E-5;
phi = 0.872665;
g = 9.81;
l = 8;
wo = sqrt(g/l);
r = 6371397; %m
time = 2*60*60; %2 hours in sec
h = 0.1;
t= 0;
x = zeros(time/h+1,0);
y = zeros(time/h+1,0);
m = zeros(time/h+1,0);
n = zeros(time/h+1,0);
t_vector = zeros(time/h+1,0);
x(1) = 1;
y(1) = 0;
m(1) = 0;
n(1) = 0;
t_vector(1) = 0;
i=1... |
function []=imageConvert12bitTo8(d,varargin)
%default options
includeSubDirs=true;
originalImageType='tif';
ouputImageType='jpg';
%print out default arguments and values if no inputs are given
if nargin==0
defaultArguments=who;
for i=1:numel(defaultArguments)
eval(['defaultArgumentValue=' defaultArgume... |
function dpnOptRotate(~,~,fig,cor,direction)
%dpnOptRotate - get the optical image for the giudata, rotate it according
%to the instruction, and redraw the image
% Get guidata
dpn = guidata(fig.fig);
if isempty(dpn)
return
end
% Get the optical image
opt = dpn.opt.orig;
opt = rot90(opt,direction);
%opt = imrotate... |
function timings = gather_times(name, folder, files)
% GATHER_TIMES Loads execution times from files in a given folder.
%
% timings = GATHER_TIMES(name, folder, files)
%
% Parameters:
% name - Name of this list of times.
% folder - Folder containing files with times.
% files - Files with times, use wildcards.
%... |
function [ max_utility ] = alg3_opt(threshold,T,L,M,value,N,...
variance,location_x,location_y,location)
%utility = cal_uti(location(:,1),variance,value,threshold,M,N);
enum = zeros(5^(T-1)*N,T);
for p=1:N %µÚp¸öÈË
enum(1+(p-1)*5^(T-1),1) = location(p,1);
end
for t=2:T
for p=1:N
for row=1:5^(T-... |
function tempstr1=makeMATLABcallstring(howmany,subscripts,centercomma,parens,i,j);
declare_globals
tempstr1=''; %default
for k=1:howmany
is_real=0; is_complex=0; is_integer=1; is_logical=0; is_1d=0; is_2d=0; scalar=1;
is_2d_r=0; is_2d_c=0;
if howmany==1
if isinf(j)
start=parens(1); finish=parens(2);
... |
function [downsampled] = DLC_downsample(DLC_data, fps, downsamplerate)
%DLC_distancefrom() calculated the distance from a fixed point of each body
%part in a DLC frame
% DLC_data = data in DLC format i.e. numeric matrix with no headers,
% first column is frame number,
% then groups of 3 columns for each tracked par... |
function [F, Q, H, R, y, x0, P0, u0, s0] = build_KF_SASE_matrices(...
LblPMU, Lbl0Inj, G, V, I, S, sigma_off, sigma_skew, Delta, meas_type)
% Computes all the quantities necessary to run the SASE filter where the
% state vector is expressedn in powers. No reference node is chosen.
%
% Args:
% LblPMU: label of no... |
function [] = Xstim_help
% Xstim_help
% function to provide help from main Xstim menu
%
global H
val = get(H.Xstim_help,'Value');
switch val
case 1 % Timing Hangups
DLGNAME = 'Timing Hangups';
HELPSTRING{1} = 'When playing out stimuli, the rhythm sometimes skips.';
HELPSTRING{2}... |
function [r,params] = load_instrument2measurement_inheritance_rules(r,params)
[~,txt,~] = xlsread(params.template_definition_xls,'Attribute Inheritance');
instr2meas = txt(:,3:4);
%% Instrument to measurement
for i =2:size(instr2meas,1)
att = instr2meas{i,1};
inherit = instr2meas{i,2};
if strcmp(inherit,'I... |
f=4;
t=0:0.002:0.5
s=square(2*pi*f*t)
s(find(t>=0 & t<0.25))=1;
s(find(t>=0.25 & t<0.5))=-1;
figure(1)
plot(t,s)
xlabel('Timp [s]'),ylabel('Amplitudine'),grid
%Rezolutia temporara este 20ms
%Punctul a)
f=4;
t=0:0.02:0.5
s=square(2*pi*f*t)
s(find(t>=0 & t<0.25))=1;
s(find(t>=0.25 & t<0.5))=-1;
figure(2)
plot(t,s)
xlabe... |
%%
% 哈工大数值分析2020年秋研究生,上机实验
% 第一部分 | 非线性方程组求解
% 时间: 2020/10/15
% 学生: 20S008082 齐晓放
% ----------------------------------------------------------
% 1、【二分法】
% 2、【牛顿法】
% 3、【割线法】
% 4、【改进的牛顿法】
% 5、【拟牛顿法】
%%
% define the algorithm for which be used to solve the nolinear equation
% where the variable can be 0、1、2、3、4 , each o... |
clear all;
fprintf('***********************************\n');
fprintf('********** RUNNING TESTS **********\n');
fprintf('***********************************\n');
fprintf('If you do not see a "success" message\nin the end of the script,\nit means there is an error\n');
tempd = pwd();
cd('../matlab');
[babel_bin, cxcalc... |
function [dydt,algvars] = daeODE(t,y,params,flag)
% ODE for rat b-adrenergic signaling model(based on Jason Yang's mouse
% model)
% dydt = ratODE(t,y,params)
%
% Copyright 2011, Cardiac Systems Biology Lab, University of Virginia
% JS: Jeff Saucerman <jsaucerman@virginia.edu>
% JY: Jason Yang <jhyang@virgini... |
function qh_ann = choke_boundary_plant(Qvec_ann,L_eigv,choke_position,Kc,...
area_ann,Cl,CTE,max_itr,tol)
qh_ann = newton_solver(@(qh_ann)choke_bc_plant(qh_ann,Qvec_ann,L_eigv,choke_position,Kc,area_ann,Cl,CTE),...
@(qh_ann)choke_jacob_plant(qh_ann,Kc,choke_position,Cl,CTE,L_eigv,...
area_ann),Qvec... |
function returnFunc = createVasicek(a,b,c,x,y,z,xs,ys,zs,h,t,s,muX,sigmaX)
gamm=sigmaX*sqrt(1-exp(-2*a*h));
density=(pi*gamm^2/a)^(-1/2)*exp(-(x-b-(xs-b)*exp(-a*h))^2*a/(gamm^2));
tempFunc = subs(density,{a,b,c,h,xs},{1,1,2,1/52,1});
returnFunc = simplify(tempFunc);
end
|
%To read the raw image (Bayer pattern RGGB)
%
% Input
% *file: The name of the file (string)
% *w: The width of the picture
% *h: The height of the picture
% *format: Support 'm10' or 'q10'
%
% Output
% *ret: The w*h array of image data, in 16bit (only 10 bit is effective)
function ret=read_qualcomm_raw(file, w, h, fo... |
function S = makeInversesGui_brc()
S = skeriDefaultInverseParameters;
S.SNR = [10 50 300];
f = fieldnames(S);
n = numel(f);
h = 0.8/n;
fig = figure('defaultuicontrolunits','normalized');
U = zeros(1,n);
for i = 1:n
uicontrol('style','text','position',[0.1 0.95-i*h 0.4 h],'string',f{i});
U(i) = u... |
function testKM
%TESTWS Summary of this function goes here
% Detailed explanation goes here
ti1 = imread('../data/test/256_OC/computer-mouse_3.jpg');
cform = makecform('srgb2lab');
lab_ti1 = applycform(ti1, cform);
ab = double(lab_ti1(:,:,2:3));
nrows = size(ab, 1);
ncols = size(ab, 2);
ab = reshape(ab, nrows*ncols,... |
% reset
clc;
% definitions
wait4release = @() TouchReleaseWait();
% record touch press
ok = 1;
tstart = GetSecs;
while ok
[xMouse,yMouse,buttons] = GetMouseTransient([],1);
ok = ~any(buttons);
disp(buttons);
end
disp('press!');
tpress = GetSecs - tstart;
disp(tpress);
% record touch release
wait4relea... |
dat = data;
nr_trials = 12;
target = [2, 3, 4, 5];
cost = 2.5;
%% Find the percentage of trials in which the first 4 clicks are equivalent to the inner 4 locations
relevant_trials = 0;
same_cost_trials = 0;
for k = 1:length(dat)
if dat(k).info_cost1 == cost
same_cost_trials = same_cost_trials + 1;
a... |
clear all
n=4;
H=ones(n)-eye(n);
X=[ -2:0.1:2];
Y=X;Z=X;C=X;
T=zeros(numel(X),numel(Y),numel(Z),numel(C));
T2=zeros(numel(X),numel(Y),numel(Z),numel(C));
T3=zeros(numel(X),numel(Y),numel(Z),numel(C));
E=zeros(numel(X),numel(Y),numel(Z),numel(C));
d=zeros(numel(X),numel(Y),numel(Z),numel(C));
cl=zeros(numel(X),numel(Y),... |
function [ data ] = removeSmallClusters( data )
%removeSmallClusters finds clusters below the minimum frame per cluster threshold and removes all those frames
mfpc = data.minFramesPerCluster;
bf = false(numel(data.frames),1);
nGroups = numel(data.clusters);
% Find small clusters
for i=1:nGroups
cg = data.c... |
function res=sig_trace(varargin)
%% Trace relaxation signals.
% addpath('/rota/Analysis/PS/osc2011/'); % path with sigproc library
func=@sigproc.sig_freq;
res=sigproc.foreach_sig(func, varargin{:})
end
|
function [C] = stageIII(Xw,bmin,bmax)
%
%
% Objetive: The main goal of this stage is to define the subject's
% condition, that is, healthy or unhealthy motivated by
% the presence or absence of WS.
%
% Input:
% - Xw: Estimated wheezing spectrogram
% - bmin: lower limit o... |
function [variables, outputMesh, timing] = points_CGAL_filterCall(functionFolder, inputMesh, param, timing)
variables.null = [];
parameters = mesh_constructCGALparameters(param.(functionFolder));
pathFull = fullfile(param.CGALpath, functionFolder, 'build');
fName = functionFolder; % try t... |
function [ context,LMAX ] = PARAMS( context,ISW )
%PARAMS cross sections, solar fluxes
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
% SUBROUTINE PARAMS(ISW,LMAX)
%........ this program determines the cross sections, solar fluxes, and
%........ given in m. torr et al g.r.l 1979 p771, table 2 a... |
function [val,subscripts]=min3d(A)
[min_valuesd1,min_subscriptsd1]=min(A);
[min_valuesd2,min_subscriptsd2]=min(min_valuesd1);
[min_valuesd3,min_subscriptsd3]=min(min_valuesd2);
subscripts(3)=min_subscriptsd3;
subscripts(2)=min_subscriptsd2(1,1,subscripts(3));
subscripts(1)=min_subscriptsd1(1,subscripts(2),subscrip... |
function [x,x_debias,objective,times,debias_start,mses,taus,xinit,iter_total]= ...
SpaRSA(y,A,tau,varargin)
% SpaRSA version 2.0, December 31, 2007
%
% This function solves the convex problem
%
% arg min_x = 0.5*|| y - A x ||_2^2 + tau phi(x)
%
% using the SpaRSA algorithm, which is described in "Sparse Reconstr... |
%outputs:
%Thrust (Newtons),
%Power Required (kiloWatts),
%CT
%CQ, (make sure these 3 numbers are within expected range),
%CT/Sigma
%, Disk loading (kg/m^2)
%, max Mach number (must be below 0.7 for accuracy)
%inputs must be in METRIC
%outputs will be in metric
%inputs:
%b ... |
%pi是1*k矩阵,mu是1*dim*k矩阵,sigma是dim*dim*k矩阵
%num为标量,k表示类别,dim表示数据维度,num表示要生成的数据数量。
function generatedata(pi,mu,sigma,num)
temp=size(mu);
dim=temp(2);
trainSet=zeros(num,dim);
for i=1:num
%pi给出的类别先验概率确定此次循环生成数据的类别,然后确定相应的均值和协方差矩阵
k= discretize(rand(1),[0 cumsum(pi)]);
muk=mu(:,:,k);
sigmak=sigma(:... |
function[delay_margin]=parDMF(g,a,A,B,C)
% delay margin finder (DMF) for neutral systems
% A,B,C: square real matrices satisfying A+B is Hurwitz
% g: grid step for alpha (coarse grid)
% a: required accuracy of the solutions
n = size(A,1);
if max(abs(eig(C)))>=1
error('Spectral radius of C is larger than unit... |
%% This script is simulate the data center responding to an DR program
% input: DR signals (speed, duration, frequency, rate)
% Data center predict workload & schedule follow the DR
% TODO: The code may not co-locate the batch jobs.
% TODO: make platform independent.
init_settings;
IS_LOAD = false;
%% Simulation
%% w... |
function word = getPopularWordFromTweets(tweets)
% GETPOPULARWORDFROMTWEETS get the most popular words in a number of input
% tweets
% Create a matrix to store features of tweets collection. This matrix has
% rows as samples (tweets) and columns as features. 1997 is the number of
% words in vocab list, corr... |
classdef SparsePyrLKOpticalFlow < handle
%SPARSEPYRLKOPTICALFLOW Class used for calculating a sparse optical flow
%
% The class can calculate an optical flow for a sparse feature set using
% the iterative Lucas-Kanade method with pyramids.
%
% See also: cv.SparsePyrLKOpticalFlow.calc, cv.calcOp... |
%testeo de los codigos
function [Se,Ie,Re,Spc,Ipc,Rpc,Md] = Testeo(So,Io,Ro,b,a,t,n)
close all
tic
[Se,Ie,Re]=SIR_Euler(So,Io,Ro,b,a,t,n);
toc
tic
[Spc,Ipc,Rpc]=SIR_PC(So,Io,Ro,b,a,t,n);
toc
h=t/n;
tp=0:h:t;
%ploteo de resultados
figure(1)
hold... |
function SSCM_SalienceIOR(FIXATIONFILE,img_dir,imageX,imageY)
% created by Seth Koenig 11/21/2012
% modified for SSCM content analysis and IOR 5/26/2014
% function determines rate of return fixations, the time between return
% fixations, time within trial of return, and salience at returned
% location. Inhibition of r... |
function [ q_next,i_next ] = RK4second(h,L,R,C,qi,iL,ti,vf)
% q = x
% iL = q'
vin = vf(ti);
fq = @(q,i) i;
fi = @(q,i) (vin - q/C - R*i)/L;
k1_q = h*fq(qi,iL);
k1_i = h*fi(qi,iL);
k2_q = h*fq(qi+k1_q/3,iL+k1_i/3);
k2_i = h*fi(qi+k1_q/3,iL+k1_i/3);
k3_q... |
% Master script
% Runs the various simulations and generates figures
% Author: Tim Bray (t.bray@ucl.ac.uk)
%% 1. Simulations
% 1.1 Set number of reps across simulations
reps=1000;
% 1.2 Run simulations for varying FF and SNR with R2* = 0
% [FFmaps,errormaps,sdmaps] = Simulate_Values_SNR(v,reps)
[FFmaps,errormaps,sdm... |
function [] = kin_tester(A)
%kin_tester() Simply connects to the arduino and executes a path.
% Steps:
% 1 Connect to arduino at port and initialize servos
% 2 Move to desired position and pause
% 3 Pick up object with claw and move to drop point
% 4 Drop object into cup
% 5 Move ba... |
function retZ = cannonize(Z)
i = (size(Z,1)-1):-1:0;
p = 2.^(i);
sv= p*Z;
[v,i] = sort(sv,'descend');
retZ = Z(:,i); |
% Generated through Matlab
% Author: Killian Keller
% E-Mail: killian.keller@ief.ee.ethz.ch
% Organization: ETHZ ITET IEF
function [model, materials, comsol_parameters] = ModelSetup_Parameters(param_list, para_list_index, varargin)
%GEOMETRY Setup of Model
% Detailed explanation goes ... |
%Borrar las variables y limpiar el espacio de trabajo
clear; clc; clf; close all;
%Definir las variables simbólica
syms r t rx ry rx2 ry2
%Definir variables iniciales
puntox = 0; puntoy = 0;
% Resolución de la malla
n = 30;
%Dominio de la malla
dominio = [-15,15,-15,15];
% Posición y longitud de las... |
clear;
clc;
%Least-squares regression
VehicleData = readtable('data/VehiclesItaly.xlsx');
summary(VehicleData)
y=VehicleData.Registrations;
x=VehicleData.Population;
alpha=x\y;
VehicleRegFit=alpha*x;
scatter(x,y)
hold on
plot(x,VehicleRegFit)
Residual=y-VehicleRegFit;
stem(Residual);
Rsq1 = 1 - sum((y - VehicleRegFit... |
% SetInfo_Mc2Source
% combines all the other 'set...' scripts into one
%check ILDAloneFlag
% XStimParams.space_flag == 1 for ILDalone
% == 0 for fully cued
if get(H.Mc2Src_DynamicRangepb,'value')
XStimParams.HiDynamicRange = 1;
set(H.Mc2Src_DynamicRangepb,'string','push for Normal Dynamic Range... |
%% Attempting to "Loopify" something to read in many filenames
%% Goal: Have a Matrix of all the Tempfiles from a given Folder
%Trying to Read in the file in matlab
%running line 43-47 on one file that was manually opened and resaved as txt
%took about 30 seconds
%% July 2020 OpenAPS File LIst. Create a list of ... |
function [] = faceDetection_MultipleImages(mergeThreshold, scaleFactor, data, saveFolder)
%% 申明全局变量,初始化
global imageGather
global maxIndex
global CorrectDetectionNum
global DetectionNum
global TotalLabeledFrontalFaces
global TotalImages
CorrectDetectionNum = 0;
DetectionNum = 0;
TotalLabeledFrontalFaces = 0;
TotalImag... |
function [ d , profileWidth ] = getProperty( tempBody )
profileWidth= [];
%% ================ Mod
[ imgB1 , rangeB1 ] = myCrop(tempBody);
for i = 1:1:size(imgB1,1)
tempFind = find(imgB1(i,:));
profileWidth(i,1) = tempFind(end) - tempFind(1);
end
%%
edge_imgB1 = edge(tempBody,'prewitt');
[H,theta,rho]... |
clear all;
code_folder = pwd;
%exp_folder = 'D:\Leo\1012exp';
exp_folder_cell = {'D:\GoogleDrive\retina\Chou''s data\MB', 'C:\Users\llinc\GitHub\retina_personal\0409' ,'D:\Leo\0503'};
for eee = 1
exp_folder = exp_folder_cell{eee};
cd(exp_folder);
mkdir MI
cd MI
sorted = 0;
special = 0;
unit ... |
A = fopen('C:\Users\user\Documents\w3\input3.dat','r');
[B,count]=fscanf(A,'%f');
C=B.';
n=input('enter the n:');
if mod(n,2)==0
n=n+1;
end
length=(n-1)/2;
for ii=1:count
co=0;
sum=0;
if ii <= length
for jj=1:2*ii-1
sum=sum+C(jj);
co=co+1;
end
avg= sum /co;
els... |
%#codegen
function [ ] = mc_arduino_output( )
coder.ceval('output');
end
|
function VTSoptPath = VTS_makeSessionOptFile
prompt = {'Enter number of stimulators to use',...
'Enter frequency of the NIdaq device (Hz)'...
'Enter names(s) of the NIdaq device(s) (Hz)'...
'Enter file name for Opts file'};
defaults = {'8', '1000', 'cDAQ1mod1', ...
sprintf('VTSOpts-%s', date)};
[answ... |
function [v,dist,beta2n] = inverseExp_Coord(beta1,beta2,register)
% Calculate the inverse exponential mapping between two elements of open
% curve elastic shape space. The shape manifold is described in Chapter 5
% of the text by Srivastava and Klassen (2016). Here, we fix the first
% element and optimally rotate a... |
addpath('/Users/Raw_csv')
clear all
clc
W =[1,2,3,4,12,19,20,21,23,24,25,28,29,31,32,33,36,39,42,43,45,47,50,51,52,55,57,59,62,65,67,68,70,71,72,73,75];
for iii = 1:length(W)
w = W(iii);
DataClean(w);
end |
function [ f,mag ] = normalizedFFT( x, Fs)
%
% normalizedFFT Returns the scaled and zero-centered FFT
%
% Input Arguments
% x : the time-domain signal vector
% Fs : Sampling rate of x
%
% Output values:
% f : The freuency axis values
% mag : The magnitudes corresponding to f
%
nSamples=length(x)... |
function result = add(A)
result = sqrt(sum(bsxfun(@times,A,A),2))
end |
function lderpe(I,or2,aa,bb)
I = imresize(I,[256 256]);
%imshow(I,[]);
%figure;
%x1=rgb2gray(I);
%imshow(x1,[]);
%figure;
x1=double(I);
[a b]=size(x1);
or=zeros(a+2,b+2);
or1=zeros(aa,bb);
ark(1)=0;
for i=2:a+1
for j=2:b+1
or(i,j)=x1(i-1,j-1);
end
end
for i=1:a-1
for j=1:b-1
... |
%計算1到10之間的偶數和
clear;clc
total=0; %設定初始total為0
for i=2:2:10 %將變數i依序設定成向量裡的每一個元素值,然後執行敘述主體
%起始值與終止值和間隔值
%執行到最後一個i小於等於終止值10為止
total = total + i; %把下一個i加到total裡
fprintf('i= %d, total=%d \n',i,total)
end |
%例子:
%二元插值interp2
%不规则数据griddata
clear;close;
%二元插值interp2
x=0:4;y=2:4;
z=[82 81 80 82 84;79 63 61 65 81;84 84 82 85 86];
[x,y]=meshgrid(x,y);
subplot(2,2,1);
mesh(x,y,z);title('RAW DATA');
xi=0:0.1:4;yi=2:0.2:4;
[XI,YI]=meshgrid(xi,yi);
zspline=interp2(x,y,z,XI,YI,'spline');
subplot(2,2,2);
mesh(XI,YI,... |
%% Copyright 2011-2012 The MathWorks, Inc.
function ReplaceCard()
% This is a simple demo to show a match & replace of the video
% data.
%
% To try this,
% 1. Get a deck of playing cards with "MATLAB & Simulink" logo or print
% the file "MWqueen_crop_small.bmp" on a color prin... |
function [T, U] = Energy(q, p)
% Get Kinetic & potential energy
%
%
r = zeros(3, p.n, size(q,1));
w = zeros(3, p.n, size(q,1));
V = zeros(3, p.n, size(q,1));
T = zeros(size(q,1),1);
U = zeros(size(q,1),1);
for k=1:size(q,1)
phi = @(i) q(k,p.iq(i,1) : p.iq(i,1)+p.iq(i,2)-1);
dphi = @(i) q(k,p... |
function LE_plot_SO(mappedX,bin_mov)
xmin=min(mappedX(1,:));
xmax=max(mappedX(1,:));
ymin=min(mappedX(2,:));
ymax=max(mappedX(2,:));
zmin=min(mappedX(3,:));
zmax=max(mappedX(3,:));
figure(1);
hold on;
axis([xmin,xmax,ymin,ymax,zmin,zmax]);
title('Laplacian Eigenmaps','FontSize',28);
set(gca,'FontSize',22)
v... |
disp(sum(1:10))
|
lut = zeros(1,64);
lut(1) = 0;
for i = 2:64
lut(i) = floor(log2(1.0+(i-1)/64)*(256)+0.5);
end
lut_frac=lut./2^6;
|
classdef CZIDirectoryEntry
%CZIDIRECTORYENTRY Implementation of the Directory Entry schema
% The class represents the information stored in the DirectionEntryDV schema,
% according to the CZI FileFormat specification
%
% AUTHOR: Stefano Masneri
% Date: 13.10.2016
properties (SetAccess = protected)
schemaTyp... |
function [Z]=gauss2D_rescale_lim(X,Y,mi,three_sigma_n)
% INPUT
% X,Y - coordinates a point at which we calculate the density
% mi - distribution mean vector
% three_sigma - three times the std of the distribution
% OUTPUT
% gauss2D_rescale_lim - value of a density proportional to
% ... |
function [r, p, y] = part1( target, link_lengths, min_roll, max_roll, min_pitch, max_pitch, min_yaw, max_yaw, obstacles )
%% Function that uses optimization to do inverse kinematics for a snake robot
%%Outputs
% [r, p, y] = roll, pitch, yaw vectors of the N joint angles
% (N link coordinate frames)
%%In... |
%% Auteur : NGUYEN Anh Vu
%% Instructeur : Oscar ACOSTA
%% FACE RECOGNITION WITH THE METHOD OF EIGENFACES
%% Reference: M. Turk, and A. Pentland, “Eigenfaces for recognition,” J. Cognit. Neurosci., vol.3, no. 1, pp. 71-86, 1991.
close all
clc
%% Load the Database of Images
load('ImDatabase.mat');
%% Useful coeffici... |
ag = run_experiments( config_getbest(1,1), ...
'testset best mean with optimized track estimates, nov, naive and us', ...
config_getdefaultsegcalculation, ...
config_getbestnoveltyconfig );
|
%%%%% MAIN %%%%%
% Predicts the population density in Gothenburg using linear regression
% and Kriging prediction, i.e. the classical geostatistical approach.
% For estimation using ML - see the file ml.m
% Clear for new run
clear all
%%%%% PARAMETERS %%%%%
bins = 50; % For estimating the Maté... |
train_data = textread('../data/digitstrain.txt','','delimiter',',');
train_features = train_data(:, 1:num_features);
num_instances_per_class = 300;
images = cell(10, 1);
for i=1:num_instances_per_class:3000
img = reshape(train_features(i,:), 28, 28)';
filename = sprintf('../data/visualization/%d.png', roun... |
%%
clear all;close all
TI=channels;
TI=TI(2:2:end,2:2:end);
SIM=ones(80,80)*NaN;
options.n_mulgrids=3;;
options.n_cond=[25 25 25 25];;
options.n_template=[9 9 9 9].^2;;
options.plot_interval=1e+9;;
rng(1);
[out_1,O_1]=mps_snesim(TI,SIM,options);
%%
O_2=options;
O_2.n_template=[9 9 9 9].^2;;
O_2.n_cond=[25 15 10 9];... |
function [U1rmws U2rmws U1dc U2dc Pact Prea Papp PF] = swm1(U1,U2,rootedWW,WW)
% Input-arguments:
%------------------------
% U1: Signal-array for U1 (Voltage-channel)
% U2: Signal array for U2 (Current-channel)
% rootedWW: Array containing the windowing-function
% Function Outout
%------------------------
% U1rmws... |
function [px,py] = GetSelPolygon(action,color)
% [px,py] = GetSelPolygon(action,h)
% Set up & get a polygonal selection region
% For the first edge, the user holds and drags; if the distance
% is sufficiently short, the process is aborted. For future edges,
% the user clicks to set the vertex. A double click closes the... |
function cost = single_cost(T1, T2)
if abs(T1 - T2) <= 0.5
cost = 0;
elseif abs(T1 - T2) <= 1
cost = 1;
elseif abs(T1 - T2) <= 1.5
cost = 5;
elseif abs(T1 - T2) <= 2
cost = 10;
else
cost = 10000;
end
end
|
clear;
close all;
clc;
%图像标题会错位,不知什么原因
%% 1 read image rgb2gray
rgb = imread('gecko.bmp');
Ir2g = rgb2gray(rgb);
% Ir2g = medfilt2(rgb2gray(rgb));%转化灰度图后进行中值滤波,效果比未滤波有明显提升
% I = imhmin(Img, 1);
imwrite(Ir2g, 'gray.png');
se1 = strel('disk', 15); %构建多尺度
%高帽,低帽变换,增强亮处和暗处
Itop = imtophat(Ir2g, se1);
% figure
% imshow... |
function data = lineScanAmplitudeExp(scans)
baselineStartTime = 0.1;
baselineEndTime = 0.2;
decayStart = 0.24;
decayEnd = .7;
% Select line scans if not passed to function
if nargin < 1
loadDirs = uipickfiles;
counter = 1;
for i=1:length(loadDirs)
if isdir(loadDirs{i}) == 1
... |
function [tags,lines] = tagfinder(filename,tagList)
% Find all of the tags in the given file. Tags begin with a # character, contain
% at least one other character, no spaces, and must reside within an m-file
% comment. The file must be on the Matlab path.
%
% INPUT
% filename - the m-file to search
%... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.