text stringlengths 8 6.12M |
|---|
%LOGPOLAR Remaps an image to semilog-polar coordinates space
%
% dst = cv.logPolar(src, center, M)
% dst = cv.logPolar(..., 'OptionName',optionValue, ...)
%
% ## Input
% * __src__ Source image.
% * __center__ The transformation center; where the output precision is
% maximal.
% * __M__ Magnitude scale para... |
function varargout = img_gui(varargin)
% IMG_GUI MATLAB code for img_gui.fig
% IMG_GUI, by itself, creates a new IMG_GUI or raises the existing
% singleton*.
%
% H = IMG_GUI returns the handle to a new IMG_GUI or the handle to
% the existing singleton*.
%
% IMG_GUI('CALLBACK',hObject,eventData,... |
function [root, iteration] = falsePositionMethod(xl, xu, error, maxItr)
relativeError = 100;
for count = 1: 1: maxItr
xr = xu - (myFunction(xu)*(xl-xu))/(myFunction(xl)-myFunction(xu));
% replacement
if myFunction(xr) == 0
break
else if myFunction(xr)*myFunction(xl) > 0
xl = xr;
else
... |
function TransferProcess
filename = 'Convection1D_4_8.nc';
time = ncread(filename, 'time');
% timestep = numel(time)
x = ncread(filename, 'loc');
p_h = point1D(filename, x, time);
end% func
function p_h = point1D(filename, x, time)
% ind = 1:6:numel(x);
itime = 1;
var = ncread(filename, 'var', [1, 1, itime],[inf, in... |
% function [P Ps]=Pcalc(ws,N)
function P=Pcalc(ws,N)
% Calculation of P matrix for the calculation of the out-of-band filter
% energy, given the fact that the filter is a symmetric FIR filter of EVEN
% LENGTH!!!
% Method for calculation of P matrix presented in "Eigenfilters: A
% New Approach to least squares... |
%% Function to find onset of diabetes distributions for Li et al data
function [meandat,onset_dist] = onset_time_dist_full
%TO GET INITIAL CONDITIONS, RUN ODE UNTIL GLUCOSE REACHES 250. AT THIS
%POINT, WE HAVE OUR INITIAL STATE CONDITIONS.
wave = 0;
allParam_vals;
InitialState = [4.77*10^5; 0; 0; 0; 300; 100; 10; 0; 0;... |
function KnEA(Global)
% <algorithm> <H-N>
% A Knee Point Driven Evolutionary Algorithm for Many-Objective
% Optimization
% rate --- 0.5 --- Rate of knee points in the population
%--------------------------------------------------------------------------
% The copyright of the PlatEMO belongs to the BIMK Group. You are... |
function [out1, out2] = getBinBarPos(xLength)
% Determines bar positions for binned SCL AUC under WavePain Waves
total = xLength;
stim = xLength / 1.1;
lead = xLength / 110 * 5;
% Determine barpositions
start = 0;
for n = 1:8
if n == 1
jump = lead / 2;
elseif n == 2 || n == 8
jump = stim / 1... |
function [Xi,peak] = POC_func(IA,IB)
[height,width] = size(IA);
A = fft2(IA);
B = fft2(IB);
Ae = A./abs(A);
Be = (conj(B))./abs(B);
SPh = ifft2(Ae.*Be);
Pp = fftshift(SPh);
[mm,x]=max(Pp);
[mx,y]=max(mm);
px=y;
py=x(y);
%cubic hokan
sum = Pp(py-1,px-1)+Pp(py,px-1)+Pp(py+1,px-1)+Pp(py-1,px)+Pp(py,px)+Pp(py+1,px)+P... |
load ts_ref.mat
u_res = [5,6,7,8]+25;
patch_cont_md(cont,ts,u_res);
fig = figure(1); hold on;
M_X.visual(fig,1:M_X.numV-1,'.b',8);
M_X.visual_bnd(fig,[],'black',2);
M_X.visual(fig,B_list,'.r',12);
M_X.visual_bnd(fig,bnd_B,'red',2);
M_X.visual(fig,cont.sets{end},'.c',12);
holes = M_U.get_coord(u_res);
plot(holes,ho... |
%LDA commands
cd /Users/sharifaalghowinem/GibbsLDA++-0.2
for i=1:60
system(['src/lda -est -alpha 25 -beta 0.1 -ntopics 2 -niters 100 -savestep 0 -twords 0 -dfile models/myData/LDA_traindata',num2str(i),'.dat']);
system(['src/lda -estc -dir models/myData/ -model model-final -niters 50 -savestep 0 -twords 0']);
... |
classdef ExponentialFamily
methods(Static=true)
function cumulativeDensity = normalCumulativeDensity(x, expectation, stdDeviation)
% Let X \distr N(expectation, stdDeviation^2). Then what is CDF at x?
xShiftedScaled = (x-expectation)/stdDeviation;
cumulativeDensity = erfc(-xShiftedScaled/sqrt(2))/2;
end
func... |
function assetallocation(Price,Names)
filename ='Portfolio.xlsx';
T = readtable(filename);
headings = T.Properties.VariableNames(1:end)';
CouponRate = xlsread(filename,'A:A');
Holdings = xlsread(filename,'B:B');
terms = xlsread(filename,'C:C');
Blotter = dataset({Names,'Names'},{Price, 'Price'}, {Holdings, 'Hol... |
function [linePoint, I_lower_uppest, boneInlower_boximg,boxRect_lower, isFoundLowerUppest, rev] = ...\
getLowerPoint(rota_bwSkullBone,rota_original_img);
% get bump of lower
% Detailed explanation goes here
% find the upper bump
rev = 0;
boneInlower_boximg=[];
boxRect_lower = [0,0,0,0];
isFoundLowerUp... |
function dbPanelInspect(~,~,fig,defP)
%dbPanelMSA - for multiple sample analysis
% We need to have a singly ticked file, which corresponds to the correct
% format.
[data,file,flag] = checkFile(fig);
% Check that we have compatibility
if ~strcmp(flag,'msa')
ed = errordlg('Incompatible file(s)');
pause(1.5);
... |
close all
clear all
load Topo.txt;
%load Q_result.txt
load NE_IBCZ_seismicity.txt
cat=NE_IBCZ_seismicity(:,5:7);
load 01_output.txt
tomo=X01_output;
%tomo=Q_result;
[x,y,z] = meshgrid(min(tomo(:,1)):0.2:max(tomo(:,1)),min(tomo(:,2)):0.2:max(tomo(:,2)),-(min(tomo(:,3)):2:max(tomo(:,3))));
[m n p]=size(x);
Z=[];
count=0;... |
function assert_numeric_nonnegative_increasing(x)
assert(isnumeric(x) && isempty(find(x<0)) && isempty(find(diff(x)<0)), 'Input must be positive scalar or a numeric vector with non-negative increasing values');
end
|
function plot_compare_coch(file_path1,file_path2,save_dir,ear)
time_step = 18;
freq_step = 3;
if strcmp(ear,'left')
chan = 1;
elseif strcmp(ear,'right')
chan = 2;
end
slash_ix1 = find(file_path1 == '/', 1, 'last');
slash_ix2 = find(file_path2 == '/', 1, 'last');
var_name1 = file_path1(slash_ix1+1:end);
var_n... |
%% Point Estimation
m = MvnDist('-ndimensions',10,'-prior',MvnInvWishartDist('-ndimensions',10));
S = sample(m,100);
mPoint = fit(m,DataTable(S));
%% Bayesian Estimation
m = MvnConjDist('-ndimensions',10); % defaults to using MvnInvWishartPrior with its default settings
mBayes = fit(m,DataTable(S... |
clear param
param.orientationsPerScale = [8 8 8 8]; % number of orientations per scale (from HF to LF)
param.numberBlocks = 1;
param.fc_prefilt = 4;
load_path = '/media/lcc/Windows/Downloads/SSRL_SKY/';
save_path = '/home/lcc/code/python/SolarPrediction/dataset/NREL_SSRL_BMS_SKY_CAM/input_data/';
%load_path = '/home/lc... |
% Arjan de Koning
% Institute of Environmental Sciences (CML), Leiden University
% 1 September 2014
% Calculating & exporting the Leontief inverse from the Industry by Industry
% input output table based on fixed product sales assumption. The
% Leontief inverse: Linv = (I-A)^-1
clear all;
disp('Calculating Le... |
function dim3 = dim3Ini(datas, numClass, dataNum, tTime)
dim3.lam1 = sum(sum(sum(datas)))/(dataNum^2*tTime);
dim3.lam2 = 1-dim3.lam1;
dim3.numClass = numClass;
dim3.dataNum = dataNum;
dim3.tTime = tTime;
re_Label = zeros(dataNum, dataNum);
re_Label = zeros(dataNum, dataNum);
for t = 1:tTime
for i=1:dataNum
... |
function [fits, sems] = getML_ddOUn(fname, recompute)
% get coh and time dependence of neurometric performance using OU model
% INPUTS:
% fname - 'txt' filename
if ~isempty(findstr(fname, 'LIP'))
dtype = 'LIP';
elseif ~isempty(findstr(fname, 'MT'))
if ~isempty(findstr(fname, 'PRe'))
dtype = 'MTPRe';... |
classdef SystemPriors < systempriors
methods
function this = SystemPriors(varargin)
this = this@systempriors(varargin{:});
end
end
end
|
function [err,errSet,W, Wtime] = backprop(input,NumLayers, bpStep, numBP,Wsoln,randSeed)
%Input one (in future generalize to more inputs)
%E.g. initialize as backprop(randn(5,1),3,.01,10000)
rng(randSeed); %seed random number generator
err= zeros(numBP,1);
M = size(input,1);
N= NumLayers;
numEx=size(input,2); %Num... |
function [mx] = find_extrema(img,thresh,radius)
%img = abs(img);
[h,w] = size(img);
% get interior image subtracting radius pixels from border
p = img(radius+1:h-radius, radius+1:w-radius);
%get pixels above threshold
[yp,xp] = find(p>thresh);
yp=yp+radius; xp=xp+radius;
pts = yp+(xp-1)*h;
%create offset ... |
function injectPackets(packetPorts, packets)
%injectPackets(packetPorts, packets)
%
%This function takes a list of packetPorts and a list of packets
%and writes them all in little-endian format to the mote.
%
%This provides a packet-level interface to writing to motes.
%
%Note that the packet-level interace to reading ... |
close all;
clear
clc
addpath('F:\4.Related to work\1.Postdoct\Year1\Project_Compression_Artifacts_Reduction\STCNN\train\code\utilities');
%% settings
stride = 21;
JPEG_Quality=10;
depth_network=20;
if JPEG_Quality==10
lamda_lq=0.04;%for q20
%lamda_lq1=0.01;%for q20
elseif JPEG_Quality==20
lamda_lq=0.02;%for q10
%lamda... |
% M = cell2ndmat(h_seg);
% [~, n] = size(M);
% [D, T] = dist_seq(M(1:0.25*end, :).^2, 0.01, 5, 0.90, 5, 0.25);
%
% R = T * ones(n, 1) / n; % R: statistical results
% S = []; % S: resulting distance sequence
% for j = 1 : length(R)
... |
function instructionsIm(scr,const,my_key,nameImage,exitFlag)
% ----------------------------------------------------------------------
% instructionsIm(scr,const,my_key,text,button,exitFlag)
% ----------------------------------------------------------------------
% Goal of the function :
% Display instructions draw in .... |
close all;clear all;clc;
load('jpegcodes.mat','dcbin','acbin','m','n');
load hall hall_gray;
[a,b] = size(hall_gray);
a*b*8/(length(dcbin)+length(acbin)+32) % 图像大小m、n应当计入码率 |
function [out]=sum3(in);
%
% Written By: Michael Hutchins
out=sum(sum(sum(in)));
end |
function [ status ] = mdsclose()
% MDSCLOSE - closes currently active tree
%
% This routine will close the tree at the top of the open tree stack.
%
% Previous incarnations also disconnected thin-client (mdsconnect) connections.
% THAT IS NO LONGER DONE
%
info = mdsInfo();
status = 1;
if info.... |
clear
format compact;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Setting the stage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
root = '/Users/yinuozhang/Dropbox/Grad School/research/polarization/MCodes';
cd(root);
global pL ALh numIndividua... |
function [index, distance] = KNNIndex(X, k)
X2 = sum(X .^ 2, 1);
distance = sqrt(bsxfun(@plus, X2, bsxfun(@minus, X2', 2 * (X' * X))));
[~, index] = sort(distance, 1);
index = index(2 : k + 1, :);
distance = distance(1 : k + 1, :);
|
% Objective function for quadratic sum of cable forces
%
% Author : Darwin LAU
% Created : 2016
% Description : The weights are the diagonals of the Hessian matrix (A)
classdef IDObjectiveMinQuadCableForce < IDObjectiveQuadratic
properties (SetAccess = protected)
weights
A_full
... |
function show_spectrum_data( feature_vec )
colormap(gray);
imagesc(feature_vec);
end
|
function y = fcw(T)
Tid = [0, 55, 70, 100, 200, 400, 1000, 2000];
cwd = [0.2, 0.12, 0.1, 0.08, 0.05, 0.03, 0.02, 0.016];
[xx, yy] = linearize_samples(Tid, cwd, 50);
y = spline_interpolation(xx, yy, 0, 1/2000, T);
end |
function [I0vector I0stdVector] = extractI0(processedManyTraj)
%
% Created by Isabel Llorente-Garcia, Nov 2011.
% If you use this code please acknowledge Isabel Llorente-Garcia in your
% publications.
%
%
% This function selects the results which have a 'GoodTrajFlag' equal to 1,
% and puts together all the I0 (intens... |
% Problem3 Deng Yang
func = @(x,y) exp(-0.5.*(x.^2)).*exp(-0.5.*(y.^2)).*sin(2*pi.*x).*cos(pi.*y);
fx = @(x,y) 2*pi.*exp(-x.^2/2).*exp(-y.^2/2).*cos(2*pi.*x).*cos(pi.*y) - x.*exp(-x.^2/2).*exp(-y.^2/2).*cos(pi.*y).*sin(2*pi.*x);
fy = @(x,y) -pi.*exp(-x.^2/2).*exp(-y.^2/2).*sin(2*pi.*x).*sin(pi.*y)-y.*exp(-x.^2/2).*exp... |
function x = newton(f,fprime,x,tol,n)
% mètode de newton de Cleve Moler
s = '%5.0f %19.15f %19.15f %19.15f\n';
fprintf('%5s %10.5s %19.5s %19.5s\n','k','x','f','l')
fprintf(s,0,x,f(x),[])
k = 0;
xprev = x-1; l = abs(x-xprev);
while (k < n) && (l > tol)
xprev = x;
x = x - f(x)... |
filefolder = 'C:\Users\praveen\Desktop\imgp\1\Input Images\';
imagefiles = dir(fullfile(filefolder,'*.*'));
nfiles = length(imagefiles);
count = 0;
for i=[3 14 16 17 18 19 20 21 ]
filename = imagefiles(i).name;
fullfilename = fullfile(filefolder,filename);
im = imread(fullfilename);
[rows column depth] ... |
function [output_black,output_white] = masking(inputfile, maskfile)
%inputfile = 'pears.png';
A = imread(inputfile);
B = imread(maskfile);
B = im2uint8(B);
output_black = bitand(A,B);
B1 = not(B);
B1 = im2uint8(B1);
output_white = bitor(A,B1);
outstr1=strcat('black_background_',inputfile);
imwrite(output_black... |
% not working yet
function ret = RANDSRC(m,n,alphabet)
bigval=1e9;
ret=randn(m,n);
ret=ret.*bigval;
ret_index=mod(ret,length(alphabet))+1;
for ii=1:m,
for jj=1:n,
ret(ii,jj)=alphabet(ret_index(ii,jj));
end
end
end
|
function [sinoAtt, sinoPC] = loadLiverCTSinogram( fileName, geom, dataSize, fileType )
% [sinoAtt, sinoPC] = loadLiverCTSinogram( fileName, geom, dataSize, fileType )
%
% Meng Wu at Stanford University
% 2013
if nargin < 3
dataSize = [ geom.detSize(1) geom.detSize(2) geom.noViews ];
end
if nargin < 4
fileT... |
syms x
x = x^3;
f = diff(x);
x=-5:0.01:5;
y=eval(vectorize(f));
plot(x,y,'r')
grid on
xlabel('x')
ylabel('y')
title('Otra uzdevuma grafiki')
hold on
syms X
X = X^3;
f = int(X);
X=0:0.01:5;
Y=eval(vectorize(f));
plot(X,Y,'--b')
legend('y=3x^2','y=x^4/4')
hold off
|
function Tau_heel = Tau_heel(in1,in2)
%TAU_HEEL
% TAU_HEEL = TAU_HEEL(IN1,IN2)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 17-Jul-2020 17:33:53
Fx = in2(:,1);
Fy = in2(:,2);
q_t1 = in1(:,1);
q_t2 = in1(:,2);
q_t3 = in1(:,3);
q_t4 = in1(:,4);
q_t5 = in1(:,5);
q_t6 = in1(:,6);
t2 ... |
function [x,y] = invcurvature(curve,len,ang0)
% function [x,y] = invcurvature(curve,len,ang0)
% Estimates the midline coordinates based on curvature. ang0 is optional, but it
% specifies the angle of the first body segment. Otherwise the first angle is assumed to
% be zero. len is the body length.
ds = len/(size(cu... |
% runToAnalyseColocalis.m
% cybD-mCherry-ATPase-GFp data set.
%
% If you use this code please acknowledge Isabel Llorente-Garcia in your
% publications.
%
%% First, generate plots for bright field images:
% For bright field (BF) images:
% [ybf497 xbf497] = overlapBF('497',1,'end',30,30,30,30,1,1);
% close all; % clos... |
function b = myfunction(a)
b = squareMe(a) + doubleMe(a);
end
function y = squareMe(x)
y = x.^2;
end
function y = doubleMe(x)
y = x.*2;
end |
% Demo of IAMP analysis on fMRI data
close all;
for pp = 1:9
thePacket=packetCellArray{1,pp};
% Construct the model object
temporalFit = tfeIAMP('verbosity','none');
% grab the average hrf and prepare it as a kernel
check = diff(thePacket.response.timebase);
responseDeltaT = check(1);
nSamples = ceil((thePacket.ke... |
%-------------------------------------------------------------------------------
% USAGE of "demo_errors_pdcub".
%
% This demo computes the cubature of a function "f" on a rectangle by an
% algebraic formula of degree "n" on Padua points.
% A comparison of relative errors between FFT method and MM method is made.
%--... |
clc;
[ a ] = pfmread_op('E:\³ÌÐò´úÂë\É«µ÷Ó³Éä²âÊÔ\pfm\memorial_o876.pfm');
T=[0.299, 0.578, 0.114; -0.147, -0.289, 0.436; 0.615, -0.515, -0.100];
T1=[0.299, 0.587, 0.114; 0.596, -0.274, -0.322; 0.211, -0.523, 0.312];
a=double(a);
T0=T^-1; T2=T1^-1;
% yuv=zeros(768,512,3);
% for ii=1:3
% yuv(:,:,ii)=a(:,:,1).*T(ii... |
%-----------------------------------------------------------------------
% Job configuration created by cfg_util (rev $Rev: 4252 $)
%-----------------------------------------------------------------------
matlabbatch{1}.spm.spatial.preproc.data = {'/Users/andreirusu/software/spm8/templates/T1.nii,1'};
matlabbatch{1}.sp... |
function obj = Iterate(obj)
persistent h1
persistent h2
persistent h3
persistent h4
persistent h5
% propagate step
% //TODO: See how particle velocity is handled (independently of Agent
% velocity) check (1).
for k = 1:obj.ParticlesCount
n = obj.Particle(k).Agent.CurrentIterationStep;
if (n == 1)
... |
%% This function is used to find the frequency of the grating
function fs = FindFrequency( Name_img, Fs_row, Fs_columns)
if nargin == 1
Fs_row = 1;
Fs_columns = 1;
elseif nargin == 3;
else
fprintf("The number of parameters is wrong!");
return;
end
if ischar( Name_img )
img = doubole( imread( Name_... |
function varargout = matchws(filename)
c=evalin('base','who');
s=whos('-file',filename);
flag=0;
ind3=1;
for ind1=1:length(c)
for ind2=1:length(s)
if strcmp(c{ind1},s(ind2).name)
varargout{1}{ind3}=c{ind1};
disp(c{ind1});
ind3=ind3+1;
flag=1;
... |
function [Q,R] = RecursiveBlockQR(A,nb)
% function [Q,R] = RecursiveBlockQR(A,nb)
% Thin QR factorization A = QR via block recursion.
% A is mxn. Assume m>=n.
% nb is the blocking factor. Assume nb<=n.
% Q is mxn with orthonormal columns.
% R is nxn upper triangular with nonnegative diagonal entries.
% GVL4: A... |
function H2to1 = computeH(p1,p2)
% INPUTS:
% p1 and p2 - Each are size (2 x N) matrices of corresponding (x, y)'
% coordinates between two images
%
% OUTPUTS:
% H2to1 - a 3 x 3 matrix encoding the homography that best matches the linear
% equation
% assume that:
% x2 h11 h12 h13 ... |
function varargout=fn_readmesh ( filename )
% function [vertex,faces,normals]=fn_readmesh ( filename )
% function {vertex,faces}=fn_readmesh ( filename )
%
% See also fn_savemesh
% Thomas Deneux
% Copyright 2005-2012
if nargin==0, filename=fn_getfile({'*.vtk;*.tri;*.mesh'}); end
if isempty(findstr(filename,'.')), fil... |
function [x1, y1] = mapUnitCircle(x0, y0)
% take the angles of x, y and map it to the unit circle by extracting
% the joint angles
r = 1;
th = atan2(y0, x0);
y1 = r*sin(th);
x1 = r*cos(th); |
% Inputs:
% alpha - dimensionless patch area
% mesh - meshing for the domain, runs from 0 to 1, i.e. 0:0.01:1
% lambda - membrane tension at the boundary, in units of pN/nm
% alpha0 - dimensionless coat area
% rF - radius of the area of applied force (on a flat membrane), in units of nm
% zp - pole z-posit... |
classdef Rec709ToLinear < CTF
methods
function name = getCTFName(obj)
name = 'Rec709ToLinear';
end
function operators = getOperators(obj)
gamma = Rec709ToLinearGamma;
operators = {gamma};
end
end
end
|
function [F, O] = integrals(q, u1_sq, u2_sq ,u3_sq, use_overtone)
%% functions
% some projections
p1 = @(theta,phi) u1_sq * (sin(theta) .* cos(phi)).^2;
p2 = @(theta,phi) u2_sq * (sin(theta) .* sin(phi)).^2;
p3 = @(theta,phi) u3_sq * (cos(theta)).^2;
% exponential term
f = @(theta,phi) p1(theta,phi) + p2(theta,phi) + ... |
function f = Select_vonMises(i)
if i == 1
f = @(b, x) b(1) * exp(b(2) * cos(x - b(3))) + b(4);
elseif i == 2
f = @(b, x) b(1) * exp(b(2) * cos(x - b(5))) .*...
exp(b(3) * cos(2*x - 2*(b(5)+b(6)))) + b(4);
end
end |
function total_vector_error = computeTVE(vecA, vecB)
% Total vector error between two vectors
%
% Args:
% vecA: first vector
% vecB: second vector
%
% Returns:
% TVE
total_vector_error = mean(mean(abs(vecA - vecB) ./ abs(vecB)));
end
|
close all;
clear; clc
n = 22;
% f = @(x) exp(-x.^2);
% f = @(x) cos(0.5*pi*x);
f = @(x) 1./(1 + x.^2); % función de Runge
a = -5;
b = 5;
%%%% nodos equiespaciados %%%%
% s = a + (0:n)*(b - a)/n;
%%%% nodos de Chebyshev %%%%
t = cos(0.5*pi*(2*(0:n)+1)/(n+1)); % en [-1,1]
s = 0.5*(b-a)*t + 0.5*(b+a); % trasformaci... |
clc;
clear;
[absolute, first, second] = mInput();
nodes = input('Enter the number of nodes: ');
nodes = absolute/(nodes - 1);
x = first : nodes : second;
func = sin(x);
points = linspace(x(1), x(end), 100);
polynomNewton = mNewton(x, func, points);
figure
fplot(@sin, [first second])
hold on
plot(x, func, 'ko', point... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Script for perfect model experiment of SH2017 Model. %%%%%%%%%%%%%%%%%%%%%%%
clear;
%close all;
figfontsize=14;
set(0,'defaultlinelinewidth',1.0)
close all
clc
%%
addpath ~/Dropbox/Math/Research/Stechmann/Matlab/Data_Assimilation/StechHott2017_DA/GlobalFuns/
% Windows
%addpath C... |
function resu = test(model, datag)
% Make predictions with a principal motion method. Performs
% PCA on the frames in each video from the vocabulary, storing the PCA
% models. Frames in test-videos are projected into the PCA space and
% reconstructed using each of the PCA models, one for each gesture in the
% voca... |
function lat_OK = latticeCheck(Lattice)
% USPEX Version 6.2
% Change: added 3rd constrain
% Returns 1 in case the lattice is OK, 0 - otherwise.
% this function checks whether the given lattice fulfills the hard
% constraints for lattices. There are three sorts of hard constraints.
% 1) A minimal angle between any two... |
%%% Extract parameter estimates for each subject and the between subject
%%% regressor to perform the PLS
%% Settings
DCMdir = 'C:\Users\luigi\Home\Work\EC\ABIDE_EC\DCM_359_van.tar\';
basedir = fullfile(DCMdir, 'DCM_359');
subjdir = fullfile(basedir,'Sub_359');
phenoDir = fullfile(basedir, 'pheno');
phenofile = ful... |
function fn_structdisp(Xname)
% function fn_structdisp Xname
% function fn_structdisp(X)
%---
% Recursively display the content of a structure and its sub-structures
%
% Input:
% - Xname/X one can give as argument either the structure to display or
% or a string (the name in the current workspace of t... |
function [CLOSED] = upgrade_CLOSED(rob_mat, CLOSED)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
CLOSED = [CLOSED; rob_mat];
end
|
smask = imread('spheremask.png');
bmask = imread('bottlemask.png');
MAX = [0,0];
for i = 1:332
k = 0;
for j = 1:328;
if (smask(i, j) == 255)
k = k+1;
end
end
if (k>MAX(1,1))
MAX(1,1) = k;
MAX(1,2) = i;
end
end
CenterY = [0,0];
for i = ... |
function [ x ] = crt( R, P )
%Chinese remainder theorem - accepts R and P and returns
% a vector of solutions which satisfies:
%res(i)=r(i)mod p(i)
Ptot=prod(P);
x=0;
if length(R)~=length(P)
warning 'Length mismatch!'
return
end
for i=1:length(P)
T(i)=invmodn(Ptot/P(i),P(i));
x=mod(x+(P... |
%Ladataan kuva caremaman
kuva = imread('cameraman.tif');
%Luodaan kvantisointivektori
k = 2.^[8:-1:1];
pituus = max(size(k));
jakaja = [1,2,4,8,16,32,64,128];
figure;
for n = 1:pituus
kvantisoitu = kuva/(jakaja(n));
kvantisoitu = kvantisoitu * jakaja(n);
subplot(3,3,n);
histogram(kvantisoitu)
end
fig... |
function stats = CsdBasic(lfp, eventTimes, lfpInfo, varargin)
% CSDBASIC computes the current source density
% Inputs:
% LFP [nTime x nChannel] - raw voltage traces
% events [nEvents x 1] - timestamps of the events
% lfpInfo [struct] - lfp info struct from io.getLfp
%
% optional argum... |
load data_error.txt
format long e
a=data_error;
c=0;
for i=1:32768
c=c+((a(i,2))/(a(i,3)^2)); %seri x(i)/(sigma(i)^2)
end
w=0;
for j=1:32768
w=w+1/(a(j,3)^2); %seri(1/sigma(i)^2)))
end
meanvariance=1/w; %meanvariance(1/(seri(1/sigma(i)^2)))
mean=c/w; %mean(seri(x(i)/sigma(i)^2))/seri(1/sigma(i)^2))
d... |
ch=108;
freqs=10;
tr=36;
clear j xf xch xep PC0 PC7 FC0 FC7 xtr
Y=0;
nsource=2;
Options=[];
G=[];FC=[];PC1=[];PC2=[];xf=[];xch=[];xtr=[];ph=[];
for si=1:nsource
xf(:,si)=randn(freqs,1)+j*randn(freqs,1);
xch(:,si)=normpdf(1:128,mod(19*si,128),10);
xch(:,si)=xch(:,si)/norm(xch(:,si));
xtr(:,si)=randn(tr,1... |
varExist = exist('spect2Plot','var');
if varExist == 0
spec2Plot = true;
end
%% Preprocessing
params.params_preprocessing.cutoff = [];
params.params_preprocessing.type = {'bandpass'};
params.params_preprocessing.backward = true;
[runProcessedData,~] = preprocess_signal_runs(runData,params.params_prepr... |
% add paths for Why3 proving
addpath([pwd '/simabstract'])
addpath([pwd '/library'])
addpath([pwd '/prove']) |
% TFY4340 Mesoscopic physics, spring 2010. Exercise 5:
% One-dimensional "triangular" confining potential in GaAs
% at AlGaAs-GaAs interface, giving rise to a 2DEG.
% Solved by straightforward matrix diagonalization, using
% the Matlab function eig
%
% Let us use SI units until the matrix has been diagonalized:
hbar = ... |
function [V] = constructVMatrix(phonemeRecordings,pointsPerSample)
%CONSTRUCTVMATRIX construct spectral component matrix (V) from
%phonemeRecordings.
% PhonemeRecordings are short recordings of phonemes to contruct V from
% in the format of a cell array of cell arrays of waveforms, where each
% item in the outer ... |
function [Zk,Vk,Ik]= Final_function(w,L,C,N,Zl,Vo)
Z = zeros(1,N);
Zk = zeros(1,N+1);
Ik = zeros(1,N);
Vk = zeros(1,N);
Z(N) = Zl;
for k = 1:N-1
Z(N-k) = ((Z(N+1-k)+1i*w*L)*1/(1i*w*C))/(Z(N+1-k)+1i*w*L +1/(1i*w*C) );
end
Zk(2:N+1) = Z;
Zk(1) = Zk(2)+1i*... |
clear all, close all
it=2;
yy = [1 2 4 8 16];
xx = [11 5 3 1.5 0.75];
i=yy(it);
nx=270*i;
dx=xx(it);
ny=nx*3;
dy=ny*4+nx
pin=['/nobackupp2/mpschodl/llc/prep/llc_' num2str(nx) '/bathy/'];
smi3=readbin([pin 'ibcao/llc' num2str(nx) '_ibcao_bed_grn_bathy_v1_md_' num2str(dx) 'km_tile3_' num2str(nx) 'x' num... |
clear all;
close all;
clc;
pipedir = '\\SPIKE2-PC\Data\pipe\';
txtformat = 'SCENE%i_FG_COLOR %f %f %f\n';
stimTexVar = 0.1;
texscale = [768,1024]/4;
Screen('Preference', 'SkipSyncTests', 1);
resMon = Screen('Resolution',2);
fprintf('\nOpening window 1');
w1 = Screen('OpenWindow',2);
fprintf('\nOpening window 2... |
run('init.m');
% %asma images
% im1 = DPImage('real',[dataPath '\subImage_test' '\1250.tif']);
% im2 = DPImage('real',[dataPath '\subImage_test' '\948.tif']);
% im3 = DPImage('real',[dataPath '\subImage_test' '\912.tif']);
% %rachel images
% im4 = DPImage('real',[dataPath '\subImage_test' '\11476.tif']);
% i... |
function result = find_face2(frame)
% function result = find_face2(frame)
%
% it takes as argument a depth frame. It is a hacky approach, that just looks for
% the nearest blob of a certain size.
[rows, cols] = size(frame);
person = find_person(frame);
projections = sum(person, 2);
% find top row of face
... |
clc,clear;
varR=80.0;
Nod_num=961;
obs_Num=[315,325,335,625,635,645];
Obs_Num=length(obs_Num);
time_step=10;
out_node=Obs_Num;
kl_term=15;
ki_1_mean=1e-12;
ki_2_mean=3e-12;
ki_3_mean=5e-12;
theta_1_r_w=0.24;
theta_2_r_w=0.22;
theta_3_r_w=0.21;
theta_1_s_w=0.63;
theta_2_s_w=0.64;
theta_3_s_w=0.65;
m_v_1=0.33;
m_v_2=0.34... |
function Volatility=impliedvolatility(aSpot,aStrike,aTime,aOption,aIsPut)
sigma=0.2;
value=100 + aOption;
while any(value-aOption > 1e-9)
[call, put] = BlackScholes(aSpot,aStrike,aTime,0,sigma);
value(aIsPut) = put(aIsPut);
value(~aIsPut) = call(~aIsPut);
sigma=sigma+(aOption-value)./Vega(aSpot,aStrike... |
function [ seam ] = getSeam( costs )
%GETSEAM Retourne la seam verticale (un indice par ligne) de coût minimal
% Remonte les coûts calculés pas la fonction "pathsCost"
% TODO : Question 2
h = size(costs,1);
seam = ones(h,1);
r_seam = find(costs(h, :)==min(costs(h, :)));
seam(h) = r_seam(1,1)... |
function [f,Df]=rosenbrock(x)
% the 2D Rosenbrock function and its gradient
[m,n]=size(x);
if (m ~= 2 || n ~= 1)
error('Bad data sent to 2D Rosenbrock function')
end
z = [x(1)^2 - x(2), x(1)-1]';
f = 100*z(1)^2 + z(2)^2;
Df = [400*x(1)*z(1) + 2*z(2), -200*z(1)]'; |
image=imread('dilbert1.jpg');
image=im2double(image);
%ginput% obtain corrdinates to extract templates
% compute an averaged template
template=(image(141:158,35:52)+image(161:178,380:397)+image(177:194,668:685))/3;
% flip the template
template=fliplr(template);
colormap gray
imagesc(template)% display t... |
clear all; clc;
N = [256,500,2048];
n = 0:1:500;
fs = 5000;
ws = 2*pi*fs
x1 = sin(2*pi*n/50);
x2 = cos(2*pi*n/50);
figure(1)
index_graph =1:7;
for i=1:length(N)
ejex = [-ws/2:ws/N(i):ws/2-1];
X1 = fftshift(fft(x1,N(i)));
%Magnitud
mag1 = abs(X1);
%real
rX1 = real(X1);
... |
function closest = getClosestTrajectories(trajData, inds, countTraj)
meann = mean(trajData(:,:,inds),3);
distt = squeeze(sum(sum((bsxfun(@minus, trajData(:,:,inds), meann)).^2,1),2));
[~, closest] = sort(distt, 'ascend');
closest=inds(closest(1:min(length(closest), countTraj)));
end |
%测试fft
clc;
clear;
close all;
%信号抽样
n=50001;
t=linspace(0,4*pi,n);
x0=1*sin(t)... %低频信号%
+ .4*cos(5.1*t)+0.1*cos(9.1*t);%... %中频信号,高频信号
x=x0+0.4*randn(size(t)); %白噪声
x(10001)=10; %脉冲信号
figure(1);
plot(t,x);
%fft
z=fft(x);
figure(2);
bar(abs(z));
title('z=FFT(x)');
xlabel('k');
ylabel('|z|');
%去噪 1%
t... |
classdef MLOptNodeMaster < OptObjectMaster
properties
sigmaMax
densityVariable
yieldConstraints
controlArea
end
methods
function obj = MLOptNodeMaster(sigmaMax, controlArea)
if nargin > 0
obj.sigmaMax = sigmaMax;
end
... |
function [timeline_jan2012_ace_model, timeline_jan2012_ace_data,...
timeline_jan2012_ace_model_diff, timeline_jan2012_ace_data_diff,...
timeline_jan2012_ace_data_5min,...
timeline_mar2015_ace_model, timeline_mar2015_ace_data,...
timeline_mar2015_ace_model_diff, timeline_mar2015_ace_data_diff,...
... |
function [cnt]= Main(folder, file, texturedatabase, cnt)
% Compute texture values for a given image.
%
% Changelog:
% - [03.03.11] added Gabor feature (std, mean)
% - [28.02.11] added support for orientation based
% coordinates
% - [14.02.11] added counter for ima... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.