text stringlengths 8 6.12M |
|---|
clear all; close all; clc;
%% Define velocity profile and parameters
nu=1/24000.0;
kap=nu/1.0;
g=9.81; rho_0 = 1;
z=[10:-0.1:-10];z=z';
V=-0.5*tanh(z/0.5);
%% Specify range of Richardson number Ri and wavenumber k.
Ri = 0.1; % 1st value of Ri
for Riloop=1:1
rho = -Ri/9.81/2*tanh(z/0.5); % density... |
function [L_normalized, DSM, T_prenorm] = PL_normalize_hartley(L)
% hartley normalization on Plucker lines
numLines = size(L,2);
% Normalize each 3D line s.t. norm(V)=sqrt(3)
for i = 1:numLines
V = L(4:6,i);
L(:,i) = sqrt(3) * L(:,i) ./ norm(V);
end
% Translation: translate 3D lines s.t. the closest point to... |
function CrossInd = MAlineCrosses(bars, period1, period2, period3)
% v1.0 by Yang Xi
% 本函数用来算各个点包含的三条均线交叉点数
% 将bars的价格数据按照period1, period2 和 period3 的均线进行交叉,
% 然后返回各个时间所对应的交叉点数
fastMA = ind.ma(bars.close, period1);
midMA = ind.ma(bars.close, period2);
slowMA = ind.ma(bars.close, period3);
temp1 = crossOver(fastMA, midM... |
function [fi nImgInStack] = ijreadtiffinfo(pathname);
%IJREADTIFFINFO Reads TIFF file information and returns ImageJ TiffInfo object
% fi = ijreadtiffinfo(pathname);
%
% by Vincent Bonin based on original code by Aaron Kerlin
%
% 3/14/08 histed: support passing unix-style paths (forward slashes)
%
%$Id: ijreadtiff... |
f = @(z) z^3 -1;
fprime = @(z) 3*z^2;
phi = @(z) z - f(z)/fprime(z); %fixed point iteration
M = zeros(200);
flag = 0;
hold on
for x = 1:400
for y = 1:400
z = 0.01*(x-1)- 2 - 0.01i*(y-1) + 2i;
count = 1;
flag = 0;
while abs(z) < 100 && count < 1500
... |
function [ contours, img_m, img_marked_m ] = trace_cont( img, img_marked, mid, H, asblack)
%ud = -1 (up)
%ud = 1 (down)
% if img_marked == zeros(0,0)
% img_marked_m = uint8(zeros(size(img,1),size(img,2),3));
% for y=1:size(img,1)
% for x = 1:size(img,2)
% if img(y,x) == 1
... |
function [mzgrid] = mass2mz(mass,adl)
% Convert a series of mass values from a database into m/z values dependent
% on the various ion forms
% How many adducts are there?
numAdd = size(adl.list,1);
mzgrid = zeros(numel(mass),numAdd);
for r = 1:numAdd
mzgrid(:,r) = (adl.list(r,3) * mass) + adl.list(r,1);
end
end
... |
function value = str2int(str)
switch length(str)
case 1
value = str-'0';
case 2
value = (str(1)-'0')*10+str(2)-'0';
end
end |
%This project works for integrals and intervals
clear all;
clc
%Question1
fun1 = @(x) exp(x+x.^2);
fun2 = @(x) exp(-x.^2);
fun3 = @(x,y) exp(-(x+y).^2);
%Calculate the exact integrals
Theo1 = integral(fun1,-2,2);
Theo2 = integral(fun2,-inf,inf);
Theo3 = integral2(fun3,0,1,0,1);
%Monte Carlo simulation
I1 = ... |
function [status, processedList, notProcessedList] = checkFilesIfProcessed(ActDataDescriptors, metaTag)
% Checks if the task has already been performed (according to the meta
% files). The evaluator name is sticked together with the requested Tag,
% except in the case of the OCTSEG tag.
% Intended for the use in octseg... |
function stimProps=optoDispBlackWhiteStim(stimProps,stimOFF)
% Adjust source rects by stimulus angle
tmpSrc=zeros(size(stimProps.srcRect));
tmpSrc([2 4],:)=stimProps.srcRect([2 4],:);
tmpSrc([1 3],stimProps.angle==0)=stimProps.srcRect([1 3],stimProps.angle==0)+0.34*stimProps.stimOffset;
tmpSrc([1 3... |
classdef BaseEstimator < handle
% Base class for all estimators in scikit-learn.
properties (GetAccess = 'public', SetAccess = 'public')
% parameters
end
properties (GetAccess = 'public', SetAccess = 'private')
% attributes
end
methods
% get parameter names... |
global bciroot;
bciroot = {'/Users/louk/Data/Raw' 'D:/Raw' '/media/LoukStorage/Raw' '/media/louk/Storage/Raw'};
expt = 'long_movements';
subjects= {'yvonne' 'jeroen' 'alex' 'hans' 'linsey' 'marjolein' 'fatma' 'jason' 'betul' 'rik'};
sessions= {{'20110719'} {'20110720'} {'20110721'} {'20111115'} {'20111121'} {'20... |
clear;
%%
lambda = [0.1, 0.05, 0.025, 0.01, 0.005] %big go first
one_over_lambda = 1./lambda %small to big
%%
save_bool = 1
%%
test_errors = [13.79, 5.6, 2.95, 1.7, 1.1]
train_erros = [0.11, 0.03, 0.011, 0.002, 0.0005]
%%
lambda = [9000, 10000, 15000, 17000 ,20000] %big go first
one_over_lambda = lambda
%one_over_lamb... |
function plotTraces(obj,key,trace_opt,colors)
import vis2p.*
if nargin<4
if nargin<3
trace_opt = [3 17];
end
colors = lines(length(trace_opt));
end
% get trace
fps = fetchn( Movies(key) & TracesGroup, 'fps');
% clf
% subplot(4,1,1:3)
hold on
for iTrace = 1:length(trace_opt)
traces = fetchn(... |
function [theta,A,c,f,Ac,algp] = kspace_hybrid_thermo_sseg(acqp,algp)
%|function kspace_hybrid_thermo
%|
%| Inputs:
%| acqp Acquisition parameters structure containing (required):
%| data [Nk,Nc] Nc complex k-space data vectors
%| k [Nk,Nd] Nd k-space s... |
%%
%%This script generates two datasets, one is a dataset with positive
%%samples of the feature to classify, and another are negative samples.
%%this is a two class classifier
%Also, this file uses the matlab functionalities to run in parallel for
%different window sizes in the trining patters.
%First, we need to ca... |
function [params, stimulus] = retLoadEmoji(params, stimulus)
emojiPth = fullfile(vistadispRootPath, 'Retinotopy', 'standard', 'emoji');
d = dir(fullfile(emojiPth, '*.png'));
assert(numel(d)>0)
[x,y] = meshgrid(linspace(-1, 1, params.display.fixSizePixels/4));
maskblob = 255*(x.^2+y.^2<1);
for ii = 1:length(d)
i... |
%Problema 4
%Setam parametrii de baza, ca amplitudinea si peioada.
A = 0.8;
T = 3;
F = 1 / T;%notam frecventa cu formula ei legata de perioada.
t = 0:0.002:12;%Am ales t.ul sa mearga pana la 12 ca sa se vada mai multe perioade.
figure(1);
s=(A*sin(2*pi*F*t))-(-abs(A*sin(2*pi*F*t)))%Pentru a obtine semnalul sinus... |
function [Xstar,Gstar,iter]=Newton(G,X0,eps,max_iter)
X = X0;
[Y,J] = G(X0);
iter = 0;
alpha = 0.4;
while (abs(Y) >= eps) & (iter <= max_iter)
[Y,J] = G(X);
X = X - alpha*Y/J;
iter = iter+1;
end
Xstar = X;
Gstar = J;
end |
function savesession_Callback(hObject, eventdata, handles)
handles.v_det = get(handles. popupmenuDetectionFiles,'Value');
if isfield(handles,'current_detection_file')
handles.SaveFile = handles.detectionfiles(handles.v_det).name;
handles.SaveFile = handles.current_detection_file;
else
handles.SaveFile = [s... |
%Assignment 4AP
%Micah Arel
%2/19/2018
%Assignment 4AP
%Solve 1D Helmholtz Equation using Tri-Diagonal Method
%2nd Derivative approximation based on Center Difference Formula
%Total of N nodes between 0 and L; x=0 N=0, x=L N+1
clear
clc
L = 1; %Right endpoint
V0=1;
v=1;
A=1; %Given
k = 10; %Coefficient of ... |
%% Initial
clear all; clc; addpath('../../routines');
%% th ELKC
input_file_folder='input'; input_file_name='gaussian_2D.es';
p=f_read_input(input_file_folder, input_file_name);
p.hitting_set.thresholds=f_set_thresholds(-5,5,0.1);
%% percolation
lengths=f_set_thresholds(0,3,0.001, 'log10');
list_to_save=zeros(size(l... |
function stimout = RescueStim(stimin,scanrate)
% Some serious surgery for a case when I forgot to
% turn on the D/A converter, and the stimulus channels
% was massively corrupted.
vlv = stimin(1,:);
t = stimin(2,:);
% Kill any -1s we might find
badi = find(vlv == -1);
vlv(badi) = [];
t(badi) = [];
% First, find the 0->... |
function uq_PCE_print(PCEModel, outArray, varargin)
% UQ_PCE_PRINT(PCEMODEL,OUTARRAY,VARARGIN): pretty print information on the
% PCE object in PCEMODEL for the specified set of output components
% OUTARRAY (default: OUTARRAY = 1).
%
% See also: UQ_PCE_DISPLAY,UQ_KRIGING_PRINT,UQ_PRINT_UQ_METAMODEL
%% Consiste... |
function m = Contract(X,Y)
% Contract.m
% Double-index contraction between two 4th-order tensors.
% Input: X, Y, two 4th-order tensors;
% Output: m, a 4th-order tensor;
%--------------------------------------------------------------------------
m = zeros(3,3,3,3);
for i=1:3
for j=1:3
... |
%%
% Definition of variables
k = 5;
nb_chain = 1.5e6;
time = 200;
pi0 = ones(1, k)/k;
realization = chain_1(nb_chain, time, pi0); % change the function for other chain
%% a)
% Plot P values of P over time
count_pij = getPOverTime(realization, k);
plot(2:time, reshape(count_pij(:, :, :), [k*k, time-1]))
%% c)
% After ... |
% p2
close all; clear; clc
%%%p2.2
[x, Fs] = audioread("gtr-jazz.wav");
Ts = 1/Fs;
%Parámetros delay
audiofile = "gtr-jazz.wav";
outputname = "gtr-jazz_delay-multitap.wav";
N = 4; M = 0.125/Ts;
b =.35*ones(N,1);
% Delay multitap de ganancia cte sobre gtr-jazz
[y, Fs] = delay_multitap(audiofile,outputname, N, M, b)... |
%=============Author:小范同学================%
%=======福州大学物理与信息工程学院===========%
%==============2020.06.06==================%
%=============通信原理课程设计==============%
function varargout = Serein(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singlet... |
function [w] = SOM(alto, ancho, entradas, nro_epocas)
w=rand(alto, ancho, 2)-.5;%*10 -4;
tipo_distancia = 3;
min_dist=distancia( w(1,1,:), entradas(1,:), tipo_distancia );
% abs(w(1,1,1)-entradas(1,1))+abs(w(1,1,2)-entradas(1,2));
pos_min=[1 1];
epoca_salto = 1; % numero de epocas que se saltean al grafi... |
function mask = spatialTempMatch(im, temp)
imInitial = im;
%% Template Image
temp = rgb2gray(temp);
temp = edge(temp,'canny');
[x,y] = find(temp>0);
b = size(x);
%median of indices x and y
x_m = floor(mean(x));
y_m = floor(mean(y));
Dy = imfilter(double(temp... |
%% Post-processing
clear
close all
% Data directory and the mat file
mfile = 'base_case';
% Plot settings
clrf = [0.7, 0.7, 0.7];
clrm = [21/255, 23/255, 150/255];
% County size
n_county = 967506;
% New Rochelle size
n_new_rochelle = 79205;
% Real data
% For 03/03 or later
real_active = load('real_data/real_active... |
%-------------------------------------------------------------------------%
%
% File: ConstrCostFun(x,x0,neigh)
%
% Goal: script that defines constraints for the construction of greedy
% points
%
% Inputs: x: the greedy points, parameters to be optimized
% x0: the original point (the seed)
... |
function showAD(ka,R)
load(strcat('logsensing_Ka=',num2str(ka,'%.5f'),'_R=',num2str(R,'%.5f'),'.mat'))
for i=1:length(t)
figure(gcf);
plot(x,x.^2/max(x.^2),x,sol(i,:,1));
axis([0 1 0 max(max(sol(:,:,1)))*1.1]);
title(num2str(t(i),'%1.3f'));
pause(0.03);
end
end |
addpath('./utils/');
addpath('./core_functions/');
% CPU
tic();
X = rand(3e4, 100);
f = gaussianKernel(2);
K = f(X,X);
toc;
% GPU
tic();
X = rand(3e4, 100);
X = gpuArray(single(X));
f = gaussianKernel(2);
K = f(X,X);
K = gather(K);
toc; |
function ndx = NDsub2ind(siz,subs)
%function ndx = NDsub2ind(siz,subs)
%-------------------------------
%like MATLAB standard sub2ind, but easier
% to integrate into larger scripts when the dimensionality of the mtrx is unknown
%siz should be like [10 10 4 5] if subs is like
% 9 8 3 5
% 1 1 1 1
% 10 10 4 5
% 5 8 3 3
%
... |
function year = tsYear(timeStamp)
dtvc = datevec(timeStamp);
year = dtvc(:,1); |
%% 方位去斜,方位FFT
Ba = 2*delta_theta*V*cosd(ThetaVRefEstim)/Lambda;
% % N = round(Na*Prf/Ba/2)*2;
% N = 32768;
N = 51200; %L波段FFT点数
N_Ba = round(Ba*N/Prf/2)*2-3600;
%
% AlphaCalcu = 90;
% PixelAziNum = Na;
% GamaV = 0;
% PixelAziSpace = V/Prf;
% NumOfSubAzi = round(Na/4096);
%
% DeltaAlpha = Pixel... |
% To solve wave equation using finite difference method
% By antennatutorials.com
% phitt=phixx 0<x<1
% boundary conditions
% phi(0,t)=0=phi(1,t) t>=0
% iniital conditions
% phi(x,0)=sin(pi*x) 0<x<1
% phit(x,0)=0 0<x<1
% define no. of steps for r =1
clc
x=0 :0.1 :1;
t=0:0.1:1;
N=10;
%defin... |
load FAvalues;
load varFAstack;
mat=128;
TR=5; %ms
tic
[T1map, Mo_map, E1]=calcT1map_3D(TR, FAvalues, varFAstack, mat);
current_directory=pwd;
fid=fopen([current_directory '\T1map.raw'], 'w');
fwrite(fid, T1map, 'float32', 'l'); %Little-endian ordering (lab convention)
fclose(fid);
current_directory=p... |
sol = zeros(7,2);
w = [0,0.5,1,2,4,8,16];
for i=1:7
t = 0:80;
q_init = [0;0];
[t,q] = ode45(@ode,t,q_init);
function dqdt = ode(t,q)
q1 = 0;
q2 = 0;
dqdt_1 = 0;
dqdt_2 = 0;
dqdt = [0;0];
dqdt_1 = q2;
dqdt_2 = - 4*q1 - 5*q2 + 10*cos(w(i)*t);
dqdt = [dqdt_1; dqdt_2];
end
sol(i) = [... |
function [labels accuracy] = dcsvm_test(testy, testX, model)
% [labels decision_values] = dcsvm_test(testy, testX)
%
% Input Arguments:
% testy testing labels, an n by 1 matrix.
% testX testing data, an n by d matrix, each row is a data point.
% model the DCSVM model generated by dcsvm_train
%
addpath('... |
function draw_VMF(K, dim, kappa_value, num)
% K is number of Latent States
% dim is the dimension of vectors
K = 3; % Number of Latent States
dim = 3;
kappa_value = 10;
num = 400;
% Initialize parameters...
N = 2; % Length of the HMM
%Ini = [0.4 0.5 0.1 0];
%A = [0 1 0 0; 0 0 1 0; 0 0 0 1;1 0 0 0 ];
Ini = rand(1,K); In... |
clc
clear
% ploter=true;
%
% LEVEL_MAX = [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15];
%
% NSAMPLES = zeros(size(LEVEL_MAX));
% rule_type = 3;
% order=4;
% dim_num =4;
% level_max = LEVEL_MAX(order);
% level_weight = ones(dim_num,1);
% [sparse_XYPHI_new,sparse_weight_new] = test_sgmga(rule_type,dim_num,level_weight,le... |
classdef tgt2
% TGT 后验打分系统 ensembles a cluster of score methods.
% each method returns a score for indicator test use.
% One could play lots of hit games with whose scores.
% tgt2与tgt的区别在于,后者输入量是一般变量,前者是Bars或TsMatrix
% ver1.0; Cheng,Gang; 20130410
properties
end
methods (Access = 'private'... |
function flag = lineInsideCircle(line , circleCenter, radius)
flag = pointInsideCircle(line(1:2), circleCenter, radius) && pointInsideCircle(line(3:4), circleCenter, radius);
end
|
function a=binIn(file)
fid=fopen(file,'r');
c=fread(fid, 'uint8')'; fsz=length(c);
fclose('all');
a=zeros(1,fsz*8);
for ia=0:fsz-1
b=dec2bin(c(ia+1),8);
a(ia*8+1:(ia+1)*8)=abs(b);
end
a=a-48;
|
%Name:
% sortedA
%
%Purpose:
% This program will create a sorted version of the matrix A either by the
% first column or by the first row
%
%Parameters:
% A - the matrix to sort
% byRow - boolean indicating if we should sort by row
% byCol - boolean indicating if we should sort by column
%
%Return... |
% plot vector field
clear all;
close all;
%set(0, 'DefaultAxesFontSize', 16);
[x,y] = meshgrid(-4:1:4,-4:1:4);
u=x;
v=y;
f = quiver(x,y,u,v,'LineWidth',2,'Color','k')
title('Vector field', 'fontsize', 16, 'fontweight', 'b');
xlabel('x-Axis', 'fontsize', 16);
ylabel('y-Axis', 'fontsize', 16);
saveas... |
function MvtCurseur(obj,event)
Liste_Fichier=getappdata(gcbf,'liste_fichier');
set(obj,'pointer','fleur');
pos = get(gca,'currentpoint');
Id_Curseur_Debut=findobj('type','line','linewidth',2,'color','b');
Maxi=get(findobj('type','line','linewidth',2,'color',[0 .5 0]),'xdata');
Mini=get(findobj('type','line','linewidth'... |
function [lscale eigfreqx,eigfreqy,eigfreqz,ionpos] = IsingDynamics(Params)
%
% 15.10.2013, CR
% This program calculates the equilibrium positions and normal modes of a
% linear string of trapped ions (all having the same mass and charge).
% Based on this information, the spin-spin coupling constants induced by a
% bic... |
function [LBPM] = lbp(I)
% LBP Calculation
%
% Input:
% - I: Binary image
%
% Output:
% - LBPM: Matrix where each element is the 8 bit lbp code of the 3x3
% block of the image
%
% Author:
% - Alessandro Fornasier (alessandrofo@edu.aau.at)
[r,c] = size(I);
LBPM = zeros(si... |
function [A,B,C]=Extract_ABC(S2)
%Extract A B C
%Input:The time series matrix of the node to be reconstructed and its neighbor nodes:S2
% Reconstructed node:i
%Output: A the state matrix of neighbor nodes when node i is zero at time t
% B the state of node i at time t+1
% C the state m... |
function xuWLLS = WLLS(X,r2,L,sigma2)
A = [-2*X' ones(L,1)];
b = r2 - sum(X'.^2,2);
W = (1/4)*diag(1./(sigma2.*r2));
xuWLLS = pinv(A'*W*A)*A'*W*b; xuWLLS = xuWLLS';
end |
function [ y ] = polynomialvalue( x, plotflag )
% These commented lines directly below the function line will be displayed if
% you type help polynomialvalue at the command prompt. Often it is useful to
% give a copy of the function call so you can clearly see what the input and
% output variables are, meaning:
% [y... |
%[P, m_dly, rms_dly] = pdp_parameters(pdp)
%[P, m_dly, rms_dly] = pdp_parameters(delay, gain)
%
% Computes total power, mean delay and RMS delay spread of
% input PDP. Assumes unitary sampling interval for delay calculation.
%
% Arguments:
% 2 arg version:
% delay - base excess tap delay vector [s]
% gain -... |
function [ Y, info ] = geo_brtf_hall( X, opt )
%GEO_BRTF Summary of this function goes here
% Detailed explanation goes here
[ Data, Info ] = BRTF( X, 1, size(X,3), 'initVar', opt.lambda, 'updateHyper', 'off', 'maxRank', 100 );
Y.A = Data.L;
Y.E = Data.E;
info.err = Info.err;
info.iter = 1:length(Info.LB);
end
|
clear all;
close all;
clc;
% Bass Line Detection
[x,Fs] = wavread('../Audio/Rolling.wav');
x = x(:,1);
% note_matrix = readmidi_java('Nirvana.mid');
% Low Pass Filter
Fc = 240;
[b,a] = butter(4,2*(Fc/Fs),'low');
input = filter(b,a,x((42*Fs):(51*Fs)));
out = amdf_w_acf_example(input, Fs);
% hps_example(input, Fs... |
nro_part = 20;
c = [1 1];
condicion_de_finalizacion = .1;
t_max = 100;
figure;
for i=1:3
switch i
case 1
x = [-512 512];
f = @(x) -x .* sin(sqrt(abs(x)))+450;
fit = f;
% fit = @(x) 1 - exp(-(((x-420)/420).^2));
case 2
x = [0 20];
f = @(x) x + 5*sin(3*x) + 8*cos(5*x);
... |
function R = Two_JAKSTATt_extr2_small_rates(x, par, t, stimulus)
R =[par(3)*(par(1)*stimulus(1))*(x(1));
par(4)*x(2);
par(5)*(par(2)*stimulus(2))*(x(3));
par(6)*x(4);
par(7)*x(2)*(x(5));
par(8)*x(4)*(x(5));
par(9)*x(2)*(x(6));
par(10)*x(4)*(x(6));
par(11)*x(7)*x(7);
par(12)*x(7)*x(8);
par(13)*x(9);
par(14)*x(11);
par(1... |
%% Generated with one octave
% dir: corpus/oneSin2
% 16000 samples long 1(s)
% f = [440, 493.88, 523.25, 587.33, 659.25, 698.46, 783.99]
figure;
[x1,fs] = audioread('corpus/scale/sinus0.wav');
subplot(2,1,1); plot(x1);
[y1,fs] = audioread('oneOctave.wav');
subplot(2,1,2); plot(y1);
%% Generated with one sinusoid
fig... |
function [X,w]=dft(x, n)
% modified version of the dft to use n<0
N=length(n);
k=0:N-1;
if size(x,1)<size(x,2)
x=x.';
end
W=exp(-1i*(2*pi/N)*(k.')*n);
X=W*x; X=X.';
w=k*2*pi/N;
end
|
function plotLynxPath(map, path, totalT)
% PLOTLYNXPATH Plots the lynx following a set of waypoints produced by a
% mapping algorithm such as Astar or RRT
%
% INPUTS
% map - a struct containing the workspace map
% path - a set of Nx6 configurations of the lynx
% totalT - the total time for the plotting (... |
function f = proj_608(x)
d = 6371*2*pi/360;
data_1 = xlsread('/Users/kunpenghao/Desktop/EE_608/Project/tranportation_data.xlsx', 1 ,'B1:D28');
result = 0;
for i = 1 : 27
Distance = distance([data_1(i,2), data_1(i,3)], [x(1), x(2)]) * d;
result = result + Distance * data_1(i, 1);
end
f = result |
%Calculates rms voltage, power, and converts if using an attenuator
voltage=input('What was the peak-to-peak voltage? ');
attenuate=input('How much attenuation do you have(dB)? ');
rmsvoltage=voltage/(2*sqrt(2))
power=(rmsvoltage)^2/50
totalpowerout=power*10^(attenuate/10)
dbm=10*log10(totalpowerout*1000)
tota... |
function [model] = regression_spline(X,y,options)
% regression_spline(X,y,options)
%
% Description
% - Fits a regression spline of degree m
%
% Options:
% - degree: This is degree of the spline (default: 2)
% - nknots: Number of knots (default: 20)
% - lambda: Penalizes complexity of fit
%
% Au... |
function obj = speaking_face2_fmincon_objfun(x, lip_scores, pos_pairs, neg_pairs, weights)
%SPEAKING_FACE2_OBJFUN Objective function to use with fmincon
%
% See also: speaking_face2, speaking_face2_optimize_fmincon
%
% Inputs
% variable to optimize: x -- nc x ncft
% lip scores (ls): lip_scores -- nc x ... |
function [MX,f] = nptSpikeTimesFFT(sptimes,varargin)
%nptSpikeTimesFFT Computes FFT magnitude given spike times
% [MX,F] = nptSpikeTimesFFT(SPTIMES,VARARGIN) plots the magnitude of
% the FFT of the spike train created from the spike times contained
% in the SPTIMES vector. If SPTIMES is a matrix, the FFT is tak... |
n_evaluations = length(filenames_noext_cell);
n_other_trials = n_evaluations-1;
n_trials1 = 99;
n_trials2 = 10;
if n_trials1 > n_other_trials
n_trials1 = n_other_trials;
end
if n_trials2 > n_other_trials
n_trials... |
%script to run GA on MyLake
clc,clear,close all
fun=@MyLake_Auburn_run;
nvars=5;%number of parameters to calibrate
lb=[0.5 0.1 10 0.000008 .000008];%lower bounds of parameters
ub=[3 2 25 0.008 0.008];%upper bounds of parameters
population_size = 50; % Populations size for each generation of the genetic algorithm... |
function [vystup] = Wiener_filtr_s_pilot(vstup)
% Funkce Wiener_filtr_s_pilot má stejné vlastnosti jako skript Projekt.m,
% kromě počítání SNR
% vstupem je: vstup ... zašumělý signál
% výstupem je: vystup ... vyfiltrovaný signál
vstup = [vstup vstup(end)*ones(1,8)]; %Předzpracování potřebuné pro stupeň
... |
clc
clear all
close all
%% 数值例子
dim=[4, 216]; % k*N,k为数据维度,N为数据数目
Nclst=3; % 簇的数量,也就是隐变量z可能取值的个数
k=dim(1);
N=dim(2);
alpha = [0.2, 0.3, 0.5]; % z1点分布概率
mureal = [1 3 5;
-3 -2 -1;
3 2 5;
-4 -6 -8]; % p(x|z)的均值
sigreal=zeros(k,k,Nclst); ... |
% Extract information from initial image and create template rectified image
function [dst] = test_pnt(px,py)
load values kc cc fc alpha_c
k = kc; c = cc; f = fc; alpha = alpha_c; R = eye(3);
% compute the KK matrix transform to pixel coordinates
KK = [f(1) alpha*f(1) c(1);0 f(2) c(2) ; 0 0 1];
% creates a... |
function [sys,x0,str,ts] = minimum_energy9(t,x,u,flag,tc_mc_to_fc_ratio,...
fc_map_spd,fc_map_trq,fc_max_trq,fc_fuel_map,fc_nox_map,fc_pm_map,...
fc_hc_map,fc_co_map,fc_fuel_lhv,fc_fuel_den,fc_trq_scale,fc_spd_scale,...
ex_cat_lim,K_Energy,K_Emis,mpg_desired,hc_desired,co_desired,nox_desired,...
pm_desi... |
% Evaluation function
function [Acc,Sn,Sp,Pre,MCC,Sorenson_Dice] = al_prediction_evaluation(ImgFiles, ImgDir, model_update,feature_index,train_mean, train_std)
TP = 0; TN = 0; FP = 0; FN = 0; Ps = 0;
for num = 1:length(ImgFiles)
fname = ImgFiles(num).name;
imgori = imread([ImgDir, '/', fname]);
... |
%% LNS
%LEER LOS DATOS
leerdatos;
%ASIGNAR DIAS DE VISITA
[mejorA,mejorFO]=asignarDias(frecuencias,LF,n,m,Cf,posiblescombinacionesdias,MD,iteracionesclustering,semillasaleatorias,cota,MA,mejorFO);
%CONSTRUCTIVO DE RUTAS INICIALES
[R,diasvisitacliente,Q,vehiculo,costoruta,Ts]=constructivoRutas2b(mejorA,R,D,Q,T... |
function [tL, ImedioL, VarmediaL,hist] = lockdownStat(data,I0f,R0f,hist,options)
%
% lockdownStat simula il modello SIR M*B volte durante
% il periodo di lockdown e restituisce i valori ottenuti.
%
% recupero i valori che mi servono
[Nass,Ibar,Rbar] = data.value;
[~,~,t_u,t_c,~] = data.time;
Kfun = data(3).Kvalue... |
%%
bkg = imread('Images/Background.JPG');
img = imread('Images/Image.jpg');
%%
img_gray = rgb2gray(img);
bkg_gray = rgb2gray(bkg);
%%
img_diff = imsubtract(bkg_gray,img_gray);
imshow(img_diff);
%%
img_ = img_diff;
% img_ = bwareaopen(img_diff,100);
img_filled = imfill(img_,'holes');
imshow(img_filled);
%%
img_fille... |
function [] = add_scatter_point(h, x, y, c, s)
%ADD_SCATTER_POINT
% h is the scattergroup handle,
% (x, y) the new point, c its color and s its size
% data is temporarily the fact object (wrapped in a jess.Value)
xx = get(h, 'XData');
set(h, 'XData', [xx x]);
yy = get(h, 'YData');
set(h, 'YD... |
function control(action)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% control.m
%
% toggle on/off control window pull-down menus and buttons
% set and implement newtime, newtseg, newstep,coordinate display
%
% Parameters:
% action - the action that the user initiated.
%
%%%... |
function [ xx yy ] = gfsk_estimate_channel(rx_signal)
load gfsk_Parameters.mat
rep_preamble = zeros(1, num_syms);
for i=1:length(preamble)
rep_preamble(i:length(preamble):end) = preamble(i);
end
tx_sig = gfsk_modulate(rep_preamble).';
tx_sig = [zeros(1,nsamp*100) tx_sig zeros(1,nsamp*100)];
tx_sig = (0.5*tx_sig)... |
function [ ] = plotNavVec(obj )
%PLOTNAVVEC Summary of this function goes here
% Detailed explanation goes here
nav = obj.cumPnlVec+obj.initNav;
hNav = plot(nav);
xlabel('Time Series No');
ylabel('Cumulative PNL');
title('Cumulative PNL as a Time Series');
set(hNav,'color',[1,0,0],'LineWidth',2);
set(gca,'Box','off... |
a0=5.29e-11; % [m]
eps0=1/4/pi;
c_au=1/137;
t_scale=24.18884e-18; % [s]
I_scale=3.51e4; % conversion from TW/cm2 to atomic units (1 a.u.=35.1e15 TW/cm2)
h_SI=6.626e-34; % [J*s]
c_SI=2.99792e8; % [m/s]
kB=1.38e-23; % [J/K]
Trot=10;
A=5.097;
% A=0.1;
B=0.4434;
D=8.8e-7;
Jvec=0:30;
Kvec=-30:30;
for indK=... |
function extract_border(meshfile)
mesh = test_cstmesh( meshfile );
verts = border_vertices(mesh);
edges = border_edges(mesh);
faces = border_faces(mesh);
C = ones(size(mesh.cells,1),1);
%tetramesh(mesh.cells,mesh.xs,C);
figure
triamesh(mesh.faces,mesh.xs)
hold on
%alpha(0.1);
surfmesh_1(faces,mesh.xs)
alpha(0.1);
for... |
swaq% This code solves the model of Graham and Wright (2010, JME)
% Incomplete Information Version Using two equation system:
% c_{t} -E_{it} [c_{t+1} - (1-beta*(1-delta))*r_{kt+1}] = 0
% r_{kt} = (Pa(z)/Q(z))*a_t + (Pc(z)/Q(z))*c_t
% Solve for Equilibrium 2 where individual consumption is stationary, no
% random wa... |
function [MVconn,MVconn_null] = computeMVconn(X,Y,opt)
% this is mainly a wrapper function: given the input MV patterns for 2
% regions, it computes MVPD, LPRD, dCor, RC and MIM and also FC and FC_SVD
% the function also simulates the null hypothesis of no functional
% connectivity by randomly shuffling the time points... |
function [globalBest, globalBestFitness, FitnessHistory] = DE(popsize, maxIteration, F, CR, Fun)
% Parameters for objective function.
dim = 30;
LB = -100 * ones(1, dim);
UB = 100 * ones(1, dim);
% Initialization swarm.
Sol(popsize, dim) = 0; % Declare memory.
Fitness(popsize) = 0;
for i = 1:popsize
Sol... |
% Modelisation d un systeme stereo
% Chaque camera est reperee par un numero
% Un modele de stenoppe classique eest utilise
% Une mire unique en 3D permettra d avoir le jeux de points de calibration
%
% Made in TRIBOULET 2008
%
clear;clc;close all;
% donnees 3D de la mire de calibration et visualisation camer... |
function [magout,phase,w] = invnichols(g)
%[magout,phase,w] = nichols(g);
nichols(g);
plot_handle = gca;
[nicgrid, nictext] = invnicchart(plot_handle);
axis([-270,0,-40,40]);
set(nictext, 'Visible', 'off');
title_handle = get(plot_handle, 'Title');
if(strcmp(get(title_handle, 'String'),''))
for i = 1:12
position ... |
Nc = 2;
Nu = 2;
Ny = 2;
A=[-0.1044 -0.1214;
-3.4152 4.6425;
3.4152 -4.6425;
1.0000 0];
b = [-0.0353;
1.3658;
2.6342;
1.5000];
Umax = 2;
Umin = -2;
G = [ 1 0;
-1 0;
0 1;
0 -1];
W = [Umax; -Umin; Umax; -Umin];
E = zeros(Nc*Nu,Nu);
z0 = zero... |
function varargout=sml1_imana(what,varargin)
% old version
% ------------------------- Directories -----------------------------------
baseDir ='/Users/nicola/Documents/Data/SuperMotorLearning';
behavDir =[baseDir '/behavioral_data'];
imagingDir =[baseDir '/imaging_data']; ... |
function genmaps(mapfile)
%mapfile='MNI_BNatlas/MNI_BNatlas.txt';
% mapfile='MNI_AAL/MNI_AAL.txt';
cachedir = 'cache/';
outputdir = 'output/';
%% load labels
fp=fopen(mapfile,'rt');
labels={};
while 1
l=fgets(fp);
data=strsplit(char(l),' ');
if size(data{1})<1,break;end
idval=str2num(data{1})
labels{idval}=data{2};
e... |
clear
clc
%% Loading country returns
bond_returns = xlsread("bond_returns.xls");
bond_returns_euro = xlsread("bond_returns_euro.xls");
real_bond_returns = xlsread("Real_bond_returns.xls");
real_bond_returns = real_bond_returns(1:end-1,:);
%short = 1, medium = 2, long = 3, ultra = 4
term = 1;
if term == 1;
futures_r... |
function [ output_args ] = plot_population( population, epoch_number )
%PLOT_NASH Summary of this function goes here
% Detailed explanation goes here
N = size(population, 1);
figure
title(sprintf('Epoch #%d', epoch_number));
chromosome_size = 64;
chromosome_min_value = 0;
chromosome_max_value ... |
load('D_iris.mat');
%Dataset preparation
D = D_iris(1:4,:);
X1 = D(:,1:50);
X2 = D(:,51:100);
X3 = D(:,101:150);
rand('state',111)
r1 = randperm(50);
Xtr1 = X1(:,r1(1:40));
Xte1 = X1(:,r1(41:50));
rand('state',112)
r2 = randperm(50);
Xtr2 = X2(:,r2(1:40));
Xte2 = X2(:,r2(41:50));
rand('state',113)
r3 = randperm(50);
X... |
function [fdat, BinCenter, OrientImg] = HoG2DIBEX(varargin)
% Implementation of Histogram of gradient orientations (HoG) features for
% 2D images.
%
% fdat = HoG2D(Img)
% fdat = HoG2D(Img, Mask)
% fdat = HoG2D(Img, nBins)
% fdat = HoG2D(Img, Mask, nBins)
%
% INPUT
% Img - 2-dimensional image
% ... |
%{
TAYLOR SERISI YONTEMI
y(x1) = y(x0) + y'(x0)(x1-x0)/1! + y''(x0)(x1-x0)^2/2!
+ y'''(x0)(x1-x0)^3/3! + ...
%}
%{
Ex: y'=x-y, x0=1,y0=2
%}
close all ; clear all ; clc ;
x = [0];
y = [1];
h = 0.1;
for i=2:11
x(i)=x(i-1)+h;
df = exp(3*x(i-1))+3*y(i-1);
dff = 3*exp(3*x(i-1))+3*df;
... |
function even = even_index(a)
even = [];
for i = 1:length(a)
if mod(a(i), 2) == 0
even = [even a(i)];
end
end
end
|
classdef spinpref
%SPINPREF Class for managing SPIN preferences.
%
% Available preferences ([] = defaults):
%
% dealias * If 1, use the 2/3-rule to zero high wavenumbers.
% [0] No dealiasing by default.
%
% dt * Time-step for time discretization.... |
% Copyright (c) 2017, Amos Egel (KIT), Lorenzo Pattelli (LENS)
% Giacomo Mazzamuto (LENS)
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are met:
%
% * Redistributions of source ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.