text stringlengths 8 6.12M |
|---|
function bildeut = fjernstoy( bildeinn )
[rader, kolonner] = size(bildeinn);
bildeut=bildeinn;
for r=2:rader-1
for k=2:kolonner-1
bildeut(r,k) = finnMedianen(bildeinn(r-1:r+1, k-1:k+1));
end
end
end
function medianen = finnMedianen(M)
vektor = sort(M(:));
medianen = vektor(5);
end |
%{
vis2p.LaserPower (imported) #
rec_timestamp : timestamp # i) the timestamp..
scan_prog : enum('MPScan','AOD') # i) Scanning program
lens : tinyint unsigned # i) lens magnification
laser_wavelength: smallint unsigned # i) (nm)
gdd : mediumint unsigned # i)... |
function [ImageInfo_InROIBox, BinaryMaskInfo_InROIBox]=AutoSeg_DF(DataItemInfo, Param)
%%%Doc Starts%%%
%-Description:
%1. This method is to segment the different tissues and to store the segmention result as the binary layers.
%2. It is designed for lung tumors on contrast enhanced scans.
%-Parameters:
%1. Tissu... |
% function CompressionAnalysis
function [Qd,Qn,Bd,Bn] = CompressionAnalysis
% dmd_B = 23;
% norm_B = 21;
% dmd_Q = 33;
% norm_Q = 28;
clc
fprintf('\n\n\n');
global quadsData_dmd
quadsData_dmd = struct;
quadsData_dmd(1).patient = '00000';
global quadsData_norm
quadsData_norm = struct;
quadsData_norm(1).patient = ... |
% ih.m
%
% this channel definition is from Traub 2003
% and seems to contain Kir as well (????)
% very strong effect, shifts V_rest to almost -60 mV
%
% hyperpol-activated channel from Traub 2003
%
% $Revision:$
%
function [I_h, dm, m_inf] = ih(V_m, m)
E_h = -35; % mV
g_h = 0.25; % mS/cm^2
I_h = g_h*m*(V_m - E_h);... |
function [cellx,cellr]=win_new(carajo,veamos,Bip17,S17,Num)
%function [TI,TN, cellx,cellr,to,tu]=win(carajo,veamos,Bip17,S17,Num)
count=0;
clear TI TN cellx cellr tu to
fn=1000;
%for index=1:length(carajo)
for index=1:size(carajo,1)
% index=3;
% index
% length(carajo)
% whos carajo
checa=carajo(index,:);
maxch=che... |
function out = train_classifier( obj , varargin )
opts = struct( ...
'name' , 'test' , ...
'classes' , [] , ...
'classes_outer', [] , ...
'target_labels', [-1 +1] , ...
'blocks_in' , 'all' , ...
'blocks_outer', 'none' , ...
'channels' , 'all' , ...
'time' , 'all' , ...
'detrend... |
function [imgYuv]=readYUVFrame(fileId,width,height)
subSampleMat = [1, 1; 1, 1];
% read Y component
buf = fread(fileId, width * height, 'uchar');
imgYuv(:, :, 1) = reshape(buf, width, height).'; % reshape
% read U component
buf = fread(fileId, width / 2 * height / 2, 'uchar');... |
function [fundamentalMatrix] = EightPointAlgo(pointsImg1, pointsImg2)
% Implementation of the 8 point algorithm, which computes the Fundamental
% matrix based on 8 or more point correspondences.
% pointsImg1: Matrix containing homogeneous points from the first
% image. (One point per column!)
% pointsImg2: Matrix ... |
clc;close all;clear all;
t = 0:0.01:2*pi;
eclipse_x = 30*cos(t);
eclipse_y = 20*sin(t);
plot(eclipse_x,eclipse_y,'--');
hold on;
plot([0 0],[-20 20]);
plot([-30 30],[0 0]);
axis([-50 50 -50 50]); |
A = [0 1 0 0; 20.601 0 0 0;0 0 0 1;0 0 0 0];
B = [0;-1;0;0.5];
C = [0 0 1 0];
D = [0];
K = [-157.6336 -35.3733 -56.0652 -36.7466];
KI = -50.9684;
AA = [A - B*K B*KI;-C 0];
BB = [0;0;0;0;1];11
CC = [C 0];
DD = [0];
t =0:0.02:6;
[y,x,t] = step(AA,BB,CC,DD,1,t);
x1 = [1 0 0 0 0]*x';
x2 = [0 1 0 0 0]*x';
x3 = [0 0 1... |
function Setup_Acoustic(damp_coeff)
global N c gamma zeta1 nn kn phi dphi
global L
N = 10; % Number of modes
c = 330; % Speed of Sound
gamma = 1.4; % Gamma of Air
zeta1 = damp_coeff; % Damping Coefficient
nn = 1:N;
% %Closed-Open
%
% kn = 0.5*pi*(1:2:2*N-1)/L; % Wave numbers for N m... |
De code in de if-statement wordt uitgevoerd:
======= Code =======
if false
% code
end
======= Code ======= |
out=[];
thetap=[];
thetan=[];
Fp=[];
Fn=[];
for i=1:size(channels,2)
out{i}=S.default.train_classifier('classes',{{14};{20}},'blocks_in',1:4,'time',1:64,'channels',i,'freqband',[.5 13]);
thetap(i,:)=[ out{i}.rp mean(out{i}.f(out{i}.labels==1)) std(out{i}.f(out{i}.labels==1)) ];
thetan(i,:)=[ out{i}.rn... |
%test ipm_sdp_predcor
%m1,m,n so nastimane kot v opisu funkcije
m1 = 5;
m = m1^2;
n = 6;
C = ones(m1);
c = C(:);
A1 = eye(m1);
A2 = zeros(m1);
A2(1,2) = 1;
A2(2,1) = 1;
A3 = zeros(m1);
A3(2,3) = 1;
A3(3,2) = 1;
A4 = zeros(m1);
A4(3,4) = 1;
A4(4,3) = 1;
A5 = zeros(m1);
A5(4,5) = 1;
A5(5,4) = 1;
A6 = zeros(m1);... |
clc
close all
clear all
%t=-5:0.001:5;
%xt= (t+1).*(t>=-1 & t<=0) +1.*(t>0& t<=1) + (2-t).*(t>1& t<=2);
%x1t= 1.*(t<=1 & t>=-1);
t= -3:0.01:3;
x= t+1;
x1= 1;
x2= 2-t;
xt= x.*(t>=-1 & t<=0) +x1.*(t>0 & t<=1) + x2.*(t>1 & t<=2);
subplot(2,1,1)
plot(t,xt)
grid on
axis([-2 3 -1 2]);
xticks(-2:1:3);
yticks(-1:1:2);
xlab... |
function [fSpeechBlkCh0, fSpeechBlkCh1, fSpeechBlkCh2, fSpeechBlkCh3, fSpeechBlkCh4, fSpeechBlkCh5, fSpeechBlkCh6] = DetectSpeechBlk_WuWSpeech_7ch(InputFolder)
iSmoothWin = 10;
iNoiseTol = 10;
sInputFileCh0 = [InputFolder,'\WuWRescaled_ch0.wav'];
sInputFileCh1 = [InputFolder,'\WuWRescaled_ch1.wav'];
sInputFileCh2 = [... |
% =========================================================================
%> @section INTRO ReadElevation
%>
%> - 파일로부터 초기 지형의 고도를 읽어들여 이를 반환하는 함수
%>
%> @version 0.1
%> @callgraph
%> @callergraph
%>
%> @retval elev : 초기 지형 고도 [m]
%>
%> @param elevationFile : 초기 지형이 기록된 파일 이름
% ===================... |
function fig = RW_results(option)
if nargin==0
global vinf
%Colors
blue=[.4 .7 1];
green=[0 .9 .45];
yellow=[1 1 .635];
red=[1 0 0];
pink=[1 .5 .5];
%Big figure
%center figure on screen
figsize=[637 513];
screensize=get(0,'screensize'); %this should be in pixels(the default)
... |
function [] = guiFinalProject()
%close all previous figures that may be open
close all;
%create a global called gui
global gui
%create gui figure with a plot in the middle
gui.fig = figure();
gui.p = plot(0,0);
gui.p.Parent.Position = [0.3 0.15 0.6 0.6];
%for customization of the graph such as giving it a... |
function plothistogram(Xsetosa, Xversicolor, Xvirginica, labels)
for i = 1:length(labels)
subplot(2,2,i);
histogram(Xsetosa(:,i), 'FaceAlpha', .5, 'FaceColor', 'b');
hold on
histogram(Xversicolor(:,i), 'FaceAlpha', .5, 'FaceColor', 'g');
hold on
histogram(Xvirginica(:,i), 'FaceAlpha', .... |
%% calculates the mean of a vector
% file: q3a.m
%
% by Nathaniel Chang
% Created: 16/03/2021
% last edited: 16/03/2021
% programing (MATLAB and C) Semester 1
% intializing values
n = 0;
vector_mean = [];
mean_total = 0;
% asking for user input
n = input("how many numbers do you want in the vector (type '0' for defau... |
function [x, y, h]=RK4adaptive(func, y_init, x_init, x_end, h_init, errorbound)
% Matlab Function of the 4th Order Runge-Kutta Method using Adaptive h
% func: the ODE to be solved
% y_init: Initial y value
% x_init: Inital x value
% x_end: Final x value
% nstep: No. of steps to get from x_init to x_end
% Current x, y ... |
% A
syms t;
fx = 1*heaviside(t) - 1*heaviside(t-2) + (t-2)*heaviside(t-2);
subplot(2,1,1);
fplot(fx,[0 5]);
laplace_fx = laplace(fx);
subplot(2,1,2);
fplot(laplace_fx);
% B1) ans = 9
syms x y z;
int(int(int(2*x,z,[0 6-2*x-3*y]),y,[0 (-(2/3)*x + 2)]),x,[0 3]);
% B2) ans = 49/5
syms x y z;
int(int(int(1,x,[0 (8-y-z)]... |
function [x,y] = ufd_detectSingleScale(x, y, Scale, IntegralImage, w, h, HaarCascades)
% This function detects objects using a fixed scale through a Haar cascade
% classifier. Return the window coordinates [x,y] where objects (faces)
% were "detected"
% (Based on code by D. Kroon)
%Calculation the inverse area of the ... |
function imdb = setup_imdb_imagenet100(imdbs_dir,varargin)
opts.seed = 1 ;
opts.joint = 0;
opts.datasetName = 'ILSVRC2012_base';
opts.imdbs_dir = imdbs_dir;
opts.imdb_pattern = 'imagenet-1000-100-01-01.mat';
opts = vl_argparse(opts, varargin) ;
imdbPath = fullfile(opts.imdbs_dir, opts.imdb_pattern);
exemplars = load(im... |
%% Optimal gait trajectory generating with contact invarient method
clear all;
modelName='human_3';
addpath dyn/
addpath obj/
addpath gaitCon/
addpath plotRobot/
addpath (['../',modelName,'/robotGen/'])
addpath (['../',modelName,'/robotGen/grad/'])
addpath (['../',modelName,'/robotGen/posCons/'])
addpath (['../',modelN... |
clc;
close all;
clear;
P_cycles = 20000;
mu_min = 8;
mu_max = 50;
muArray = mu_min:2:mu_max;
sigma = 5;
offsetMult = 1.1;
numIter = 1;
maxBufferArray = zeros(length(muArray), numIter);
BufferWithTimeArray = {};
writeTimes = {};
leftDiscard = 0;
rightDiscard = 3;
disp('Simulation Running');
% parfor masterIDX = 1: (... |
function [ ] = mkdir_basename(fn)
[dir,~,~] = fileparts(fn);
[s,mess,~] = mkdir(dir);
if ~s
error(['Could not create ' dir ' Message:' mess]);
end
end |
function hfig = tightax(hfig)
% Function to resize the axis handle of a figure to fill the entire figure
% without excess space around them. The figure size is kept constant and
% the axes are enlarged to fit the figure.
% The colorbars are moved, after finding their tightinset.
% Inspired from tightfig.
% Input
% ... |
function [C,Indice_all]=local_adj(indi,D,glind,C,SEl,Z)
Indice_all=[];
for k=1:size(indi,1)
Ainb=return_id(SEl(SEl(:,1)==glind,2:3),SEl(SEl(:,1)==D(indi(k,1),1),2:3));
L=[];
for j=1:size(Ainb,1)
L=[L,Z(Ainb(j,1),Ainb(j,2))];
end
% X=1:size(L,2);... |
% hgeom
% Creation Date: 6.19.2012
% Written By: David Freestone (DMF)
% Patrick Heck (PH)
%
% Purpose: Approximates the hypergeometric function.
%
%
% Copyright Information xxx
%
%
% CHANGELOG:
% ----------
%
% DMF 04.20.2013: Maintenance.
% DMF 11.xx.2012: Uses a more accurate method / stopping a... |
function [Lgamma,nablaL,hessianL] = dualfunction(p,gam,x_cond,mu_cond,N_lgwt)
% <This function does what?>
%
% Input:
% <what?>
%
% Output:
% <what?>
%
%
if nargout >= 1
% compute the dual function, L(gamma), in expression (5.2)
Lgamma = lgamma(p,gam,x_cond,mu_cond,N_lgwt);
end
if nargout >= 2
% comput... |
function [selected, index_selected] = tournamentSelection(fitness_scores, p, selectionFunction, N)
selection = @(fscores,pop) selectionFunction(fscores, pop); % Selection Strategy
%N = 3; % Tournament Size
nt = nchoosek(length(p),N); % Number of Tournaments
tournaments = nchoosek(1:length(p),N); % all possible tournem... |
%%%%%%%%%%%%%%%%%%%%%%%%%%
%(c) Ghassan Hamarneh 1999
%%%%%%%%%%%%%%%%%%%%%%%%%%
%This file is added on July 6, 2004 in order to allow the user to load an
%already labelled training set.
%The labelled data can be in so many formats so I will now create the
%functionality to load a particular data set.
%%%%%%%%%%%%%%%%%... |
% Arkaplan Cikarimi
input = imread('kapi_biri.bmp');
im1 = rgb2gray(imread('kapi.bmp'));
im2 = rgb2gray(imread('kapi_biri.bmp'));
im3 = imsubtract(im1,im2);
im3 = bwareaopen(im3,500,8);
im3 = imfill(im3,'holes');
im3=uint8(im3);
im3(im3 == 255) = 1;
im33 = cat(3, im3, im3, im3);
im = input .* im33;
imshow(im);
|
% Description:
% This code computes and plots the statistical chance level as a function of trial number using the cumulative
% binomial distribution function.
%
%
% by:
% Etienne Combrisson (1,2) [PhD student] / Contact: etienne.combrisson@inserm.fr
% Karim Jerbi (1,3) [PhD, Assistant Professor]
% 1 DYCOG Lab, Lyon ... |
function rhs_sample = sample_func(x)
rhs_sample = [ exp(-x^2); sin(x); exp(-x)*sin(x)]; |
function [fitness,nEvals]=fobj(X1,NuRun,fnc,caseStudyData,otherParameters,deParameters,nEvals)
fit_superorganism=0;
for gh=1:NuRun
[fit_superorganism1, ~]=feval(fnc,X1,caseStudyData, otherParameters);
fit_superorganism=fit_superorganism+fit_superorganism1;
... |
clear all; close all; clc;
%% Setup
addpath('../MATLAB_TSM-Toolbox_2.01');
% dataset
load('src.mat');
load('tar.mat');
source_gender = 'F';
target_gender = 'M';
% dictionary
dictionary_file = 'dictionary\F002_to_M003.mat';
% option
opt.mccDIM = 39;
opt.dynamic_flag = 2;
... |
N = 200;
T = 100;
input = 1:N;
r1 = ramp(N);
r2 = [zeros(1, T), r1(1:N-T)];
u1 = ustep(N);
u2 = [zeros(1, T), u1(1:N-T)];
for i = 1:N
sum(i) = r1(i) - r2(i) - T * u2(i);
endfor
plot(input, r1, 'g-', 'LineWidth', 2);
hold on;
plot(input, -r2);
hold on;
plot(input, -T * u2);
hold on;
plot(input, sum);
|
% EM Algorithm for Missing Values
% Reference:- Probabilistic Principal Component Analysis by
% Michael E. Tipping; Christopher M. Bisho
function [W,sigma,M,mean,x_t] = EM_Missing(X,q,itr)
x_row = size(X,1);
x_col = size(X,2); % N
x_t = zeros(x_row,x_col); % Mean of... |
clc;
clear;
delfigs;
prwaitbar off;
prwarning off
%create data set
nist_data = prnist(0:9,1:1000)
prmemory(64000000);
clc;
iter = 10; % Number of performance evaluations
num_test = 100; % Number of test objects per class
average = 0;
classify = quadrc; %scenario 1 classifier
%classify = ldc; %scenario 2... |
function [meanTheta, G, x, lsCoff, ldCoff] = stpCalcGmatrix(welllog, angleTrNum, superTrNum, offsetMin, offsetMax, dt)
% 这是一个计算初始模型的函数
% 读取基本测井数据
tDepth = welllog(:, 1);
tVs = welllog(:, 3);
tVp = welllog(:, 2);
tRho = welllog(:, 4);
%tPor = welllog(:, 5); % 孔隙度
%tSw = welllog... |
%% 이미지 불러오기 및 초기 설정
img = imread('nir_img.png');
img = img(1:end-1, :); % 3배수 맞게 이미지 자르기
img = double(img);
[H, W] = size(img);
N = 3; % 3배수
%% Q1. 1/3 sub-sampling with gaussian LPF
% 이미지 외각 copy padding
img2 = [img(:,1), img, img(:,end)];
img2 = [img2(1,:); img2; img2(end,:)];
% Gaussian 필터
lpf = [1 2 1; 2 4 2; 1 ... |
% daqSessionUpdateDataBuffer.m updates the data buffer based on the length
% of the plot window (as set by the user upon initialization)
function daqSessionUpdateDataBuffer(event)
global session % our global variable to store everything
% update data
session.temp.data = [session.temp.data; event.TimeStamps ... |
% 例2,周期矩形脉冲序列的功率谱展示
% 北京邮电大学,尹霄丽
% 2018年12月
close all;
clear all;
set(0,'defaultAxesFontName','Microsoft YaHei UI')
syms t n;
T=2*pi;
%tao=0.5*T;
tao=0.2*T;
w1=2*pi/T;
Fn=int(1*exp(-i*n*w1*t),'t',0,tao)/T;
N=21;
f0=tao/T;
n=[-N:-1]; Fn1=subs(Fn);
Pn1=Fn1.*conj(Fn1);
n=[1:N]; Fn2=subs(Fn);
Pn2=Fn2.*conj(Fn2);
P... |
function Validation_speed( obj, id )
MeasureSpeed =[ fileparts( mfilename('fullpath') ), '/tide/MeasureSpeed.txt'];
Mspeed = load(MeasureSpeed);
time = ncread('Sanya2k_0613.1-1.nc', 'time');
Cspeed = obj.PostProcess_speed;
x1 = Mspeed(:,1);
y1 = Mspeed(:,id+1);
x2 = time(167:316,1);
y2 = Cspeed(id,167:316)';
plot(... |
function output = qpskdemod( input )
output = zeros(1,length(input)*2);
for i = 1 : length(input)
output((2*i-1):(2*i)) = qpskdemodsymbol(input(i)) ;
end
end |
function p = FbTransform(c,b)
% Transforms a plane curve c into another plane curve p according to the
% b-transform.
[~,n]=size(c);
v=curveDeriv(c);
[theta,rho,~]=curve2Polar(v);
psi=theta/(2*b);
nu=2*b*sqrt(rho);
[x(:),y(:)]=pol2cart(psi,nu);
p=zeros(2,n);
for j=1:n
p(1,j)=x(j);
p(2,j)=y(j);
end
|
clear;
clc;
Yini = single(imread('test2.jpg'));
%Yini = single(imread('Mars_dunes.jpg'));
ltot = size(Yini,1);
ctot = size(Yini,2);
trois = size(Yini,3);
X = reshape(Yini, [ltot*ctot,3]);
n=size(X,1);
nl = 3;
nc = 3;
ncomp = 1;
l = floor(ltot/nl);
c = floor(ltot/nc);
numBitsSent = 0;
Yfinal=[];
Ybloc=[];
i=1;
j=1;... |
function aggr_ls_test(gNo, setNo)
cS = const_so1(gNo, setNo);
cS.dbg = 111;
% spYearV = cS.spS.spYearV(1) : cS.spS.spYearV(end);
meanLPerHour_tscM = 1 + rand([cS.demogS.ageRetire, cS.nSchool, cS.nCohorts]);
aggrHours_tsyM = 3 + rand([cS.demogS.ageRetire, cS.nSchool, length(cS.wageYearV)]);
for iSchool = 1 : cS.nSc... |
function vel=sweepp(u,v0,v1)
% u_xx-u=-K
% u_0=kappa1*u_1+mu1
% u_N=kappa2*u_{N-1}+mu2
global dx
N=length(u(:,1));
kappa1=v0/v1; mu1=0;
kappa2=1; mu2=0;
alpha=zeros(N,1);
betta=alpha;
K=u(:,1);
a=ones(N,1); b=a;
c=a+b+dx^2; f=K*dx^2;
alpha(1)=kappa1; betta(1)=mu1;
for i=1:N-1
d=c(i)-al... |
function D = DSSpecDir(f,theta,phi,d,N,c)
nSensors = N;
%% convert to column vectors
f = f(:);
N = (1:N)';
theta = theta(:);
%% align the vectors with their respective dimensions
N = permute(N,[3,2,1]);
f = permute(f,[2,1]);
%% replicate the vectors to facilitate vectorized calculations
N = repmat(N,[size(theta,1),si... |
function [center_fit,H_matrix_fit,omega3,frequency3,c,H_fit_V,H_fit] = calculate_trap_freq_byfitting_NOfirst(center_data,x,y,z,static_matrix,pseudo2_matrix,um,q,mass)
%calculate the center point and trap frequency by poly function fit after
%find the center points by matrix. This method is to fitting pseudo potentia... |
function tag = getMetaTag(descriptor, type)
% GETMETATAG: Returns meta tag for a certain descriptor
% Needs the global variable TABLE_META_TAGS.
% Parameters:
% DESCRIPTOR: The descriptor you search the associated tag with
% For a list of the descriptors, have a look at:
% octsegConstantVariables
% T... |
function exportSubvolume(DataDescriptors)
% CSVSAVEBSCANS GUI for creating subvolumes from fixed depth or segmented
% layer boundaries. Storage in HE .vol format. Wrappes the createSubvolume
% function.
%
% Writen by Markus Mayer, Pattern Recognition Lab, University of
% Erlangen-Nuremberg, markus.mayer@informatik.uni... |
% Frequency responses of the Two-Wheeled Robot Control System
%
% closed-loop interconnection
sim_robot_2dof
%
s = tf('s');
Intg = 1/(s+10^(-5));
%Intg = 1/s;
%
systemnames = ' sim_ic Intg ';
inputvar = '[ ref{4}; noise{2}; control{2} ]';
outputvar = '[ sim_ic(1:6); ref(1:4)-sim_ic(1:4); ... |
%% Input
% t - vettore dei tempi [double]
% y - vettore dei valori [double[]]
% num - numero di campioni da prendere [int]
% degree - grado fit polinomiale ... |
function [zd,ptr]=decode_block3_n0s(bin,n0s0,ptr)
%for de_KsideSub_ns1s
codebook=cell(8,1);
codebook{1}=[0 0 0];
codebook{2}=[0 0 1];
codebook{3}=[0 1 0];
codebook{4}=[1 0 0];
codebook{5}=[1 1 0];
codebook{6}=[0 1 1];
codebook{7}=[1 0 1];
codebook{8}=[1 1 1];
[sym,ptr]=deSFcode(bin,3,ptr); nrs=sym-1;
zd=zeros(1,5*n0... |
function x = jacobi(matriz, terminos_independientes, vector_aprox, num_it, precision)
%resuelve un sistema de ecuaciones mediante el metodo de jacobi
% A=input('ingrese la matriz de coeficiente A:');
% b=input('ingrese la matriz transpuesta de términos independientes b=');
% x=input('ingrese un vector d... |
function [B] = myAHE(A,N)
% Performs adaptive histogram equalization
% A: Input Image
% N: Patch size
% B: Output Image
tic
imshow(A);
%B=zeros(size(A));
input_height = size(A,1);
input_width = size(A,2);
for i=1:input_height
win_top = max(1, i-ceil(N/2-1));
win... |
function T = grpstatsTable(y,grp,varargin)
%% standard grpstats table output
%% default
% group name unique list, sorted alphabetically
gnameu = unique(grp);
gnameutitle = 'gnameu';
meantitle = 'mean';
%header for the table, input must be a table
grpheader =table;
if ~iscell(gnameu) && isnumeric(gnameu)
gnameu = c... |
function [ rows,cols ] = detect_features( image )
%%%
% Computer Vision 600.461/661 Assignment 2
% Args:
% image (ndarray): The input image to detect features on. Note: this is NOT the image name or image path.
% Returns:
% rows: A list of row indices of detected feature locations in the ima... |
function ans = sig_mult2()
n0 = 1;
n = -20: 2: 20;
y0 = zeros(size(n));
y0 = [(n - n0) < 0];
y = 3*y0;
stem(n, y);
|
function [ netW ] = weights_init( param )
IP = param.input_N;
OP = param.output_N;
NOL = param.num_layers;
NOD = param.num_nodes;
Win = zeros(NOD, IP+NOD);
for i=1:NOD
for j=1:IP+NOD
Win(i,j) = rand ./ 2 - 0.25;
end
end
netW.win = Win;
W = zeros((NOL-2)*NOD, 2*NOD);
for i=1:(NOL-2)... |
function [ ratios ] = make_ace_nitrogen_ratios_with_pratmo( tanstruct_o3_in, tanstruct_T_in, lst_input )
%A function to calculate the ratio of the VMRs of nitrogen-containing
%species at the input local solar time (LST) and at the ACE measurement
%times. The ratios can be used later to scale the ace measurements of the... |
% Trettel
close all
clear all
plot_style
repository = '../../Verification/Sprinklers_and_Sprays/';
skip_case = 0;
if ~exist([repository, 'terminal_velocity_dt_1_0_1.prt5'])
display(['Error: File ' [repository, 'terminal_velocity_dt_1_0_1.prt5'] ' does not exist. Skipping case.'])
skip_case = 1;
end
if ~exi... |
function Wprofile= plot_Wprofile(cueType,adult,endo,exo)
% for individual visualizations there are no error bars associated, when
%{
analyzing group stats need to add error bars
varargin - pass the structure endo or exo based on what paradigm you are
looking into
%}
% copyright Maha Ramamurthy, Stanford University, ... |
function RR = RR_from_laden_chunk_file_paths(laden_chunk_file_paths, zoom_step_count, chunk_size_ijk)
laden_chunk_count = length(laden_chunk_file_paths) ; % "laden" meaning non-empty, I.e. the chunks actually represented in the 'octree'
% RR = zeros(laden_chunk_count, 6) ; % one row for each (actually extant)... |
%% Read image
i = 500;
B = imread(strcat('../DaimlerBenchmark/Data/TestData/00m_25s_704914u.pgm'));
%A = rgb2gray(B);
A = B;
C = B;
%% Load NN
load('nnetwork.mat');
%% Loops
jump = 4;
dim = [36, 18];
scale_X = dim(1,2):jump:floor((size(A,2)-dim(1,2))/jump)*jump;
scale_Y = dim(1,1):2*jump:floor((size(A,1)-dim(1,1))/(2*... |
function [position,isterminal,direction] = EventsFcn_Tstance_L(t,x,contact_pos,ter_i,k2,L_sp0,m2)
g = 9.81;
position = [k2*(x(4)-L_sp0)*cos(x(5))-m2*g,...
contact_pos(2)+x(4)*cos(x(5)) - Terrain(contact_pos(1)-x(4)*sin(x(5)),ter_i)];
% The value that we want to be zero
isterminal = [1, 1]; % Halt integratio... |
function [out] = sumtorial(in)
% Write a function that takes in a number, and recursively finds the sumtorial of this number.
% To find the sumtorial, use the following information:
% sumtorial(1) = 1
% sumtorial(n) = n + sumtorial(n-1);
%use recursion to compute sumtorial until n = 1
out = 0;
if in == 1
out = ... |
%function simulate()
recordTime = 600; %Recording time in seconds
tauIn = 25; %stimlus sampling rate in Hz
tauOut = 100;%tauIn;%100; %response sampling rate in Hz
memory = round(.2*tauOut);%.1*tauOut;%memory length of the gain control in output samples
nonlin = false;
numStim = recordTime*tauIn;
order = round(lo... |
function ydot = testfunc(t, y)
ydot = zeros(size(y))
ydot(1, 1) = y(1, 2);
ydot(1, 2) = -y(1, 1);
end
tspan = [0, 2*pi];
y0 = [1., 0.];
sol = ode113(@testfunc, tspan, y0);
plot(sol(:, 1), sol(:, 2), 'b-')
|
global MPI_COMM_WORLD;
load 'MatMPI/MPI_COMM_WORLD.mat';
MPI_COMM_WORLD.rank = 32;
Alluxio_Row_mv_version3;
|
function varargout = DerivacaoNumerica(varargin)
% DERIVACAONUMERICA M-file for DerivacaoNumerica.fig
% DERIVACAONUMERICA, by itself, creates a new DERIVACAONUMERICA or raises the existing
% singleton*.
%
% H = DERIVACAONUMERICA returns the handle to a new DERIVACAONUMERICA or the handle to
% ... |
A=1;tau=1;
time=0:0.1:2;
Vt=A*(exp(-time/tau)-1+time/tau);
plot(time,Vt,'g'),xlabel('time'),ylabel('Vt'),title('Vt vs time') |
function [ J] = outerBoundaryTracking( I )
%UNTITLED2 此处显示有关此函数的摘要
% 遍历,如果有邻域有黑的白色像素就是边界,把边界坐标存起来
% 用极坐标表示这些坐标,并排序,按角度从小到大输出成动画
[M, N ] = size(I);
J = zeros(M,N);
boundaryPixels = zeros(M*N,3); % 每行前两个变量是边界像素坐标,第三个像素是其斜率x/y,用于顺时针排序
numOfBoundaryPixels = 0;
xSum = 0;
ySum = 0;
whiteSum = 0;
% 找到所有边界点的坐标
for x = 1:M... |
%% Define Red Pitaya as TCP/IP object
clc
close all
% IP= '192.168.101.108'; % IP of your Red Pitaya...
IP= 'rp-f01b63.local'; % rp-MAC.local MAC are the last 6 characters of your Red Pitaya
port = 5000; % If you are using WiFi then IP is:
RP=tcpip(IP, port);
fopen(RP... |
% read in sequence timings
t_tag = load('t_tags.txt');
t_delay = load('t_delays.txt');
t_adjust = load('t_adjusts.txt');
% corrections - pulse sequence in the scope doesn't quite do what it's
% supposed to
t_delay = t_delay + 0.003 ;
t_adjust = t_adjust + 0.009 ;
t_tag = t_tag - 0.002 ;
timing_parms.t_delay = t_... |
function [locs, vals] = aed(sig, params)
% sig = sig(1:floor(length(sig)/2));
%-Short time signal energy - Fagerlund 2004
N = 128;
H = 64;
theWin = hanning(N);
numFrames = floor((length(sig)-(N-H))/H);
theFrames = zeros(numFrames,N);
stse = zeros(numFrames,1);
startIdx = 1;
endIdx = N;
for i =... |
%% Plot robot workspace
function plotWorkspace(alpha, f, e, rf, re)
E = [0; -300; 0]; % User desired pose of TCP (Tool Center Point)
% Solve IK
[q1, F1, J1, E1] = IK(E, alpha(1), f, e, rf, re);
[q2, F2, J2, E2] = IK(E, alpha(2), f, e, rf, re);
[q3, F3, J3, E3] = IK(E, alpha(3), f, e, rf, re);
... |
function [eVecm,nit] = ffw_lmo(g,v0,options)
%FFW_LMO Linear minimization oracle over SDP cone
% [EVEC,EVAL] = FFW_LMO(G,V0,options) produces the minimal eigenvalue
% EVAL and a corresponding eigenvector EVEC of the gradient operator G,
% using the Power Iterations algorithm.
% set options
maxit = getoptions(opt... |
function x_dist_map = x_dist_map_vector(bw, num_of_lines, length, width, start_row_idx, end_row_idx, start_col_idx, end_col_idx)
gap = floor(length / (num_of_lines + 1));
i = start_row_idx + gap;
x_dist_map = zeros(1,num_of_lines);
count = 1;
while count <= num_of_lines
target_row = bw(i,:);
% i
% width
... |
function [x,fval] = test_quadp()
H = [1,-1,1
-1,2,-2
1,-2,4];
f = [2;-3;1];
lb = zeros(3,1);
ub = ones(size(lb));
x0 = zeros(3,1);
opts = optimoptions('quadprog','Algorithm','active-set');
[x,fval] = quadprog(H,f,[],[],[],[],lb,ub,x0,opts); |
function ShowFastPoisson()
% Illustrates 2D Fast Poisson solving with various boundary conditions
n1 = 32; In1 = eye(n1,n1);
n2 = 16; In2 = eye(n2,n2);
b = randn(n1*n2,1);
type={'DD','DN','ND','NN'};
clc
disp(' T1 T2 ||uFast - uSlow|| ')
disp('-------------------------------------')
for i=1:4
for... |
function A = chromk_anova(data1,data2)
%function A = chromk_anova(data,g1,g2)
%data1 = data(:,g1);
%data2 = data(:,g2);
[o,b] = size(data1);
[o1,b1] = size(data2);
if o < b
data1 = data1';
end
if o1 < b1
data2 = data2';
end
x = length(data1);
x2 = length(data2);
% size(data1)
% size... |
function [errstd, errmean, errmax, errmin] = avperrstd(avperr, t0, t1, isdisp)
% Calculating AVP error std.
%
% Prototype: errstd = avperrstd(avperr, t0, t1)
% Inputs: avperr - AVP error array
% t0 - start time point
% t1 - end time point
% Outputs: errstd - error std.
% errmean - error mean.
... |
function optim = setOptimOpts(optim)
fprintf('-> Setting up optimization algorithm ...\n');
if optim.order >= 2
optim.Alg = 'gamultiobj'; %'gamultiobj' - multiobjective optimization
elseif optim.order == 1
optim.Alg = 'ga'; ... |
% plot_pop_rho_neuronal_JCSOinTT.m
% script used for plotting in pop_rho_neuronal_JCSOinTT.m
% % %
% for CV cells
% plot rho_neuronal related analysis
%
dononzeroslopes = 1; % change ind_good: none zero slopes of both A and B
doconsislopes = 1; % change ind_consislope: consistent slopes
if ismember(cla... |
%analysis based on mean
function dataStructNum = post_cluster_analysis_numeric_mean1( saveFilePath, outputFile, cols, f)
% dataStruct is save for writing to html file
load ([saveFilePath 'mark_out']);
load ([saveFilePath 'mark_filter']);
%%retrieve the index of double marked out
tmp = true(length(mark), 1 );
... |
function J = computeCost(X, y, theta) %This function compute the cost for linear regression
% Theta is a vector with [theta0, theta1] its order is (2x1)
% X order is (97x2) so we have to transpose in order to multiply with theta
% X and y are matrices whose rows represent the examples from the training set
m = len... |
%% CLEANUP
clear
CODE_PATH = pwd;
addpath(CODE_PATH)
spm fmri
%% %%%% MANUAL SET: all that needs to be set manually is in section
% EXPERIMENT_DIR = '/Volumes/backup/mvpa/3_random_subjects';
EXPERIMENT_DIR = '/Volumes/backup/mvpa/functional';
%
% %% DICOM IMPORT ALL SUBJECTS IN THE EXPERIMENT_DIR => PROC DIRECTORIE... |
% update the parameters of GBNs for K clusters
warning off;
addpath(genpath('../bnt'));
clear all; close all; clc;
load City_Level_UD_Interp_New.mat;
load CityInfo.mat;
load training_ind_season_new.mat;
load ST_candidates_v1_new.mat; %v1 - pattern mining + granger causlaity, v2 - only granger causality
load City_Level_... |
function z = skewquad(fname,L , Qs , method)
%skewquad(Fname, L, Qs, method)
z = multipole(fname,L, [0 Qs 0 0], [0 0 0 0], method); |
classdef DisplayVideos < handle
%DISPLAYVIDEOS Show/control a GUI to play synced videos from an NWB file.
%
% This allows the parallel, time-synced display of multiple video
% streams, alongside other timeseries data displayed as static graphs.
% A vertical bar on the graphs indicates the current time point shown
% in ... |
function [tiploc]=get_tiplocation(InboundEdge,SegL,MVlengthlimit_min,MVlengthlimit_max,closedistlimit)
MVBW=(SegL==3);
se = strel('disk',10);
BW=imclose(MVBW,se);
se=strel('cube',5);
BW=imerode(BW,se);
CH = bwconvhull(BW);
se=strel('cube',3);
CH=imerode(CH,se);
CH=~CH;
% imshowpair(CH,BW);
%title('Unio... |
dx=1; % Change in variable is set to a high value
x=input('Enter the initial estimate -> '); % Initial estimate
iter = 0; % Iteration counter
disp('iter Dc J dx x')% Heading for result
while abs(dx) >= 0.001 & iter < 100 ... |
function [todss,fromdss,ratio,pwr]=dss0(c1,c2,keep1,keep2)
%[todss,fromdss,ratio,pwr]=dss0(c1,c2,keep1,keep2) - dss from covariance
%
% todss: data-to-dss matrix
% fromdss: dss-to-data matrix
% ratio: power ratio of dss components relative to baseline
% pwr: power per component
%
% c1: baseline covariance
% c2: biased... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.