text stringlengths 8 6.12M |
|---|
function [mycolormap] = make_ecc_colormap(mapres,show)
% Creates a matrxi useful for plotting pRF and ccRF polar angle maps
%
% Usage:
% [mycolormap] = make_polar_colormap(show)
%
% defaults:
% show = 0; do not plot the resulting polar angle colormap
%
% Written by Andrew S Bock Oct 2014
%% Set up default... |
arg_list = argv ();
filename = arg_list{1};
SR = 64; % Sample rate in hertz
stepSize=32; % Step size in samples
offDelay=2; % Evaluation delay in seconds: tolerates delay after detecting
onDelay=2; % Evaluation delay in seconds: tolerates delay before detecting
% Parameters to... |
function [z,z1,z2,z3]=rmsemg(w,m,n,sc,datx);
par=w;
md=par(1,1:m*n);
dv=par(1,m*n+1:2*m*n);
ys=par(1,2*m*n+1:2*m*n+m)';
for i= 1:m,
med(i,:)=md(1,i*n-n+1:i*n);
dev(i,:)=dv(1,i*n-n+1:i*n);
end;
v1=datx(:,1)';
fy=datx(:,2)';
for i=1:length(fy),
v=v1(1,i);
f(1,i)=efbd(v,ys,med,dev);
end;
z=sqrt((1/length(fy))*sum((fy... |
clear
%% NL Demand Simulation
% * Only estimate
demand = NLDemand();
demand.alpha = 1;
m1 = SimMarket()
m1.demand = demand;
m1.model.markets = 100;
m1.create()
dt1 = m1.data;
%% NL Demand estimation
demand = NLDemand(dt1);
demand.var.market = 'marketid';
demand.var.panel = 'productid';
demand.var.price = 'p';
dem... |
% Setup a bingo game.
% Creates drawpile and continuously draws until you stop.
draw_pile=randperm(75);
Letter=['B','I','N','G','O'];
for i=1:75
disp([Letter(ceil(draw_pile(i)/15)),num2str(draw_pile(i))])
w= waitforbuttonpress;
end |
#!/usr/bin/octave -qf
warning('off',
'Octave:possible-matlab-short-circuit-operator');
args = argv();
fn = args{1};
printf("reading weight matrix from %s\n", fn)
W = full(mmread(fn));
D = diag(sum(W));
L = D - W;
printf("calculating alg-conn and fiedler vector ...\n");
tic; [V,l]= eig(L); toc
ac = l(2,2);
fv ... |
classdef MaskPlotterInterface < handle
%MaskPlotterInterface Interface for mask plotters
methods (Abstract)
Plot(obj, mask, sizeX, sizeY, title)
end
end
|
% this function averages the frequency magnitude per octaveband
function amp = avgAmplitudesPerAngle(y,fs, octaveBand)
% INPUT:
% -y: signal to be averagef
% -fs: sampling frequency
% -octaveBand: array containg octave band upper limits, see function 'getOctaveBands'
% OUTPUT:
% - amp: average amplitude per frequency ... |
a=uigetimagefile;
a=imread(a);
img=a;
mask=prediction;
mask=double(mask);
mask=im2bw(mask);
figure;
sc(sc(mask,'y',mask)+sc(img));
%post-processing
% fill holes
%
|
%% Object Creation
clear
cla
len = [27.0, 48.0, 153.0];
offset_angle = deg2rad(0);
offset_coord = [0, 0, 0];
axis_limits = [0 , len(3)+len(2)+len(1) ...
-len(3)-len(2)-len(1) , len(3)+len(2)+len(1) ...
-len(3)-len(2) , len(3)+len(2)]; ... |
function features = feature_extraction(extraction,colorspace)
switch colorspace
case 'opp'
load('stl10_matlab/train_opponent.mat');
[num_train_images, ~] = size(X_train_opponent);
X = X_train_opponent;
otherwise
load('stl10_matlab/train_cu... |
function stan_process_birds(DIR,varargin)
%
%
%
%
proc_name='aggregated_data.mat';
stan_dir='stan';
save_filename='stan_withinbird';
newfs=250;
anti_alias=125;
skip={'SLEEP','mat_ttl','sleep'};
% load in MU calculation, compare across days
% this script should be run in the base ephys directory (e.g. ephys_barecarbo... |
% A script for setting up the matrices for the second-order
% modulator that is often used in SC circuits
A=[1 0; 0.5 1];
B=[0.5 -0.5; 0 -0.5];
C=[0 1];
D=[0 0];
ABCD=[A B; C D];
|
% bw resim 2boyutludur,rgb resim ile çarpılabilmesi için 3 boyutlu yapılması gerekir.
% 3 boyutlu olan rgb ve bw resimlerinin birebir matris çarpımı yapılabilmesi için ölçeklerinin de aynı olması gerekir.
rgb=imread('rgb_1.jpg');
size(rgb)
bw=imread('bw_1.jpg');
size(bw)
% yukarıdaki adımda iki resmin boyutlarını k... |
function [ ProbabilityDomain ] = BCJR_fast( Trellis_Index_io , sigma , TRANS , Trans_EX , rx_waveform , Window_Size)
State_Cardinality=size(Trans_EX,1);
numBranches_par=size(Trans_EX,3);
Number_of_inputs=size(Trans_EX,4);
numBranches_tot=State_Cardinality*2^(Number_of_inputs);
rx_waveform_pac=[reshape(rx_wave... |
function [ x ] = plot_simple( signals, n, names )
count = 1;
figure;
for i = 1:n
subplot(n,1,i);
plot(signals(:,i));
title(['Subplot ' num2str(i) ': plot for ' names(count) names(count+1)]);
count = count+2;
end
x = 'ayyyy';
end
|
function [J, grad] = costFunctionReg(theta, X, y, lambda)
%COSTFUNCTIONREG Compute cost and gradient for logistic regression with regularization
% J = COSTFUNCTIONREG(theta, X, y, lambda) computes the cost of using
% theta as the parameter for regularized logistic regression and the
% gradient of the cost w.r.t. ... |
%%% Design of frame
clc
%% Input for the support at the base
s1 = input('Enter 1 or 2 for support hinged or fixed respectively at left side of the frame: ');
s2 = input('Enter 1 or 2 for support roller or hinged respectively at left side of the frame: ');
%% input for beam
lb = input('Enter the span of the beam: ');
... |
function R = sizeImage( Im )
% x = size(A, 1);
% y = size(A, 2);
R = size(Im);
R = R(1:2);
end
|
% Model for Radio Frequency Reciever for mobile phones
% This is a Digital Filter - FIR - Bandpass type
% All frequency values are in kHz.
%*************************************************************%
% Part 1: Generating a test signal with different freqencies
fs = 15e3 ; % Samping frequency of 15 kHz
... |
% em_04.m
% DOT AND CROSS PRODUCT
% DOING PHYSICS WITH MATLAB
% https://d-arora.github.io/Doing-Physics-With-Matlab/
% DOWNLOAD Scripts from
% https://github.com/D-Arora/Doing-Physics-With-Matlab/tree/master/mpScripts
% https://drive.google.com/drive/u/3/folders/1j09aAhfrVYpiMavajrgSvUMc89ksF9Jb
%... |
load('G:\NFC_A_02_d1-3_TPWS\labels\NFC_A_02_disk01a_predLab.mat')
load('D:\WAT_HZmetadata\TPWS\ClusterBins_120dB_linear\WAT_HZ_01_disk05_Delphin_clusters_PG0_PR95_MIN100_MOD0x_PPmin95FPincl.mat')
load('D:\WAT_HZmetadata\TPWS\ClusterBins_120dB_linear\WAT_HZ_01_disk05__toClassify.mat')
probs = double(probs);
predLabels ... |
function PDF = PDF_Val(x, N)
%x es el vector de entrada
%N es la cantidad de bines
n = length(x);
PDF = hist(x, N);
PDF = PDF/n; |
function [COLLECT_DATA,COLLECT_DATES,TIME]=stan_cadata_collect_freedomscope_v2(DIR)
% takes data where cell arrays correspond to separate songs, rows to samples, and columns to rois
% and reformats for stan_cadata_sortmat
%
% e.g. newdata=stan_format_cadata(data1,data2,data3);
%
% returns a new cell array where each el... |
%% This code is based on methods in J. Reidl et al. 2007 and discussions between Chi and Hiroshi
% This code uses function subaxis and JadeR (Cardoso, 2013)
% Overall this code should do a good job.
% Foe cortex-wide imaging of GC6s signal from excitatory neurons, first 40 PCA modes are retained to do ICA further.
... |
function [x_intersect, y_intersect] = ball_trajectory_calculater(context)
if context.DEV_ENVIRONMENT
load(strcat('samples/sample', int2str(context.DEV_SAMPLE), '.mat'))
sample_x = x_points;
sample_y = y_points;
sample_z = z_points;
else
% Do nothing
end
%% Visu... |
%%%%%%%%%%%%%%%%%%%%%%
%
% 201503120 Jun Young Park
% juny1905@naver.com
%
% Dept. of Embedded Systems Engineering
%
% Incheon Nat'l University
%
% Unit : Metric
%
% - The Linear Systems Project : Pendulum waves -
%
% Reference : STL Reader
% - https://www.mathworks.com/matlabcentral/fileexchange/2... |
function r = fhnd2fdx2(t,fd_cell,p)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% fhnd2fdx2
%
% The second derivative of the FitzHugh Nagumo equations with respect
% to the input x, at time t.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%y = cell2mat(eval_fdc... |
function plusOneFrame_Callback(hObject, eventdata)
global vid_fig_hand;
global vid_obj;
curr_frame = get(vid_fig_hand.frameEdithandle, 'String');
curr_frame = str2num(curr_frame);
framePlusTen = curr_frame +10;
updateFrameFunction(framePlusTen, vid_obj);
end |
clear
img = load('hall.mat');
hall = double(img.hall_gray)-128;
figure(1);
imshow(hall);
transd = dct2(hall);
tranversed = transd.';
rotted90 = rot90(transd);
rotted180 = rot90(rot90(transd));
tran = uint8(idct2(tranversed)+128);
ro90 = uint8(idct2(rotted90)+128);
ro18 = uint8(idct2(rotted180)+128);
figure(1);
subplot... |
function varargout = QRdim(A, dim, type, par)
%
% block version of the QR decomposition
%
[m, n] = size(A);
mn = min([m,n]);
if strcmp(type, 'rank')
par = min([par, m, n]);
end
colnorm = sum(A.^2, 1).^(1/2);
H = cell(mn, 1);
p = 1:n;
r = -1;
for i = 1 : (mn/dim)
workidx = (i-1)*dim + (1:dim);
... |
function Note(mysh)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
joystickPress = readJoystick(mysh);
switch joystickPress
case 1
fs = 130;
case 2
fs = 155;
case 3
fs = 170;
case 4
fs = 185;
case 5
... |
% Intrinsic and Extrinsic Camera Parameters
%
% This script file can be directly excecuted under Matlab to recover the camera intrinsic and extrinsic parameters.
% IMPORTANT: This file contains neither the structure of the calibration objects nor the image coordinates of the calibration points.
% All those c... |
function [Q,varargout]=ortha(A,X)
%ORTHA Orthonormalization Relative to matrix A
% Q=ortha(A,X)
% Q=ortha('Afunc',X)
% Computes an orthonormal basis Q for the range of X, relative to the
% scalar product using a positive definite and selfadjoint matrix A.
% That is, Q'*A*Q = I, the columns of Q span the sam... |
% boolval = IsInitialized(myobj)
%
% Determine if the running plugin (if any) is currently in
% the 'initialized' or 'uninitialized' state. Returns a
% true value if the plugin has finished initializing. When a
% plugin is first started, it remains in the... |
#include "java_io_OutputStreamWriter.h"
const struct clazz *base_interfaces_for_java_io_OutputStreamWriter[] = {};
struct clazz class__java_io_OutputStreamWriter = {
DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_java_io_OutputStreamWriter ,0 , &__GC_MARK_java_io_OutputStreamWriter, 0, cn1_c... |
function y = partialfouriersums(A,T,t)
y = zeros(size(t));
%because number of fourier coefficients is 2*N+1
N = (size(A,2)-1)/2;
for k = -N:N
%fourier series reconstruction
y = y + A(k+N+1)*exp(1i*2*pi*k*t/T);
end
% plot(t,y,'r');
% xlabel('Time');
% yla... |
%Jake Tully 100904392
%
% TE Modes optical waveguide
% Nano particals on core
clear
clc
close all
%Parameters
c = 299792458; % m/s
lambda = 1550*10^-9;
f = c/lambda;
up = lambda*f;
n1 = 1.45;
n2 = 1.44;
nm = 0.5 - 11i;
DelNeff = 10^-5;
Bo = (2*pi*1.447)/lambda;
B =(2*pi)/lambda;
epsilon1 = (8.8541878176*10^-12)*n1^2;... |
function f = GetSymbolicFunction(chromosome, numberOfVariables, constantRegister, operators, cMax)
nGenes = length(chromosome);
variableRegister(1:numberOfVariables) = sym(0);
variableRegister(1) = "x";
constantRegister = sym(constantRegister);
operands = [variableRegister, constantRegist... |
%% multiples 3 and 5
clear; clc; format compact
multuples = zeros(1000);
total = 0;
counter = 1;
for n = 1:1:1000
if mod(n,3) == 0 || mod(n,5) == 0
total = total + n;
multuples(counter) = n;
counter = counter + 1;
end
end
for x = 1:counter
multuples(x);
end
dis... |
load('/home/sofiakp/projects/Anshul/matlab/medusa/data/Jul13/hg19.encode.rna_asinh_rpk100_z2_clust30/runs/hocomoco_sqb_test3.1.mat')
%%
iters = 920;
subplot(2, 2, 1);
plot(1:iters, trstats(1:iters, 1), 'b', 1:iters, tsstats(1:iters, 1), 'b--', 'LineWidth', 1);
legend({'train', 'test'}, 'Location', 'SouthEast');
xlabel(... |
function error = plot_inheritance(assignment, family, list, coor, limit)
error = 0;
nloc = length(coor);
if( nloc <= 0 )
error = 1;
return;
end
[nind, c] = size(family);
if( nind <= 0 || c < 12 )
error = 1;
return;
end
alleles = assignment.alleles_all;
intervals = assignment.intervals;
[nseg c] = s... |
function [] = Main(ind_fair, group_fair,lambda, lvl_n, lvl_loc)
% ind_fair; % if 1 then cost function gets a penalty of individual fairness (refere to Berk et al.)
% group_fair; % if 1 then cost function gets a penalty of group fairness (refere to Berk et al.
% lvl_n; % number of levels of the protected feature
% lvl... |
function attsWin = AttWindows(windows,atts,N,D )
%UNTITLED7 Summary of this function goes here
% Detailed explanation goes here
Blocksize =16;
embeddingInt = readCCA(fullfile('model','CCA.bin'));
windows =[windows(:,1)+1 windows(:,2)+1 windows(:,3)+1 windows(:,4)+1];
windows = double(windows);
windows = [ceil(wind... |
function [out, b_hat] = decoder_5(degree,y,in)
%
%Variable decoder of Belief propagation for BSC channel
%
%Author: Yuqi Zhang 2016/2/25
%
%
for ii = 1:degree
ind = find([1:degree]~=ii);
if sum([y,in(ind)]) >= 0
out(ii) = 1;
else
out(ii) = -1;
end
end
if sum([y,in]) >= 0
... |
function [x,approx_x,theta,Lyapunov] = parallel(flag)
time = 0:0.001:20; x0 = [0; 0; 0; 0];
gamma1 = 1; gamma2 = 1;
[~,par_solved] = ode45(@(t,x) solve_parallel(t,x,flag,gamma1),time,x0);
x = par_solved(:,1);
approx_x = par_solved(:,2);
theta = [par_solved(:,3) par_solved(:,4)];
theta_tild = [theta(:,1)-2 theta(:,2)-1... |
function plotting_saveObj(S_obj,results_dir)
if strcmp(S_obj.type,'2DfieldFFTmov') || strcmp(S_obj.type,'2DcoeffsFFTmov') || strcmp(S_obj.type,'2DfieldTWmov') || strcmp(S_obj.type,'DmnAVGABSmov') || strcmp(S_obj.type,'DcoeffsFFTmov')
M = S_obj.M;
save([results_dir '/' S_obj.fname '.mat'],'M');
e... |
clear
clc
y = [1 0.5 0.33 0.25 0.2 0.1667];
n = length(y)
x = linspace(0,5,n);
plot(x,y)
run Simpson(x,y)
trapz=trapz(x,y)
|
% function Selected_Data_Index = DRLSH(Data,M,L,W,ST)
% This is a function of Locality Sensitive Hashing for Data Reduction
% It is based on the Algorithm developed by Aslani and Seipel in the
% following paper:
% "Mohammad Aslani, Stefan Seipel, A fast instance selection method for support vector machines in build... |
function ioStore3dData(filePath, pts, n, u, v)
% Writes file with 3d points.
data = [pts n u v];
save(filePath, 'data', '-ascii', '-tabs');
|
function [subimg] = subimgs(imgobj, imgbg)
sz = size(imgbg);
r = sz(1);
c = sz(2);
diffThreshold = 8;
subimg = zeros(r, c, 3);
imgobj = im2double(imgobj);
imgbg = im2double(imgbg);
for i = 1:r
for j = 1:c
diffR = imgobj(i, j, 1) - imgbg(i, j, 1);
... |
% *** Dynamic Causal Modeling for Cross-Spectral Densities ***
% -------------------------------------------------------------------------
%%
% Load subject list and loop through it
% loadsubj
% numsubj = size(allsubj,1);
for s = 1:numsubj
% subjname = allsubj{s};
% fprintf('\n\n\n*** Processing subje... |
function [ means ] = sensRep( preferred, stimuli, tuningWidth, sensitivity )
%SENSREP calculate sensory representation of stimuli
% preferred: preferred stimulus orientation of different channels
% stimuli: 2×t array of stimuli, orientation (top) and contrast (bottom)
contrast = repmat(stimuli(2, :), length(preferr... |
% Tao Du
% taodu@stanford.edu
% May 29, 2014
% Xp coordinates:
% [0, 0]... [nx-1, 0]
% .
% .
% .
% [0, ny-1] [nx-1, ny-1]
function [ Xp ] = camera_to_pixel( XXc, kc, KK )
x = XXc(1) / XXc(3);
y = XXc(2) / XXc(3);
Xn = [x; y];
r = norm(Xn);
dx = [2*kc(3)*x*y+kc(4)*(r^2+2*x^2); kc(3)*(r^2+2*y^2)... |
clc;
clear all;
pob = crearPoblacion;
pob;
for i = 1:10000
disp(i);
total = cicloFit(pob);
pob=ordenamiento(total);
[setPadresUno setPadresDos] = seleccion(pob);
[setPadresT setHijos] = cruzaIndividuos(setPadresUno, setPadresDos);
setHijosM = mutacionIndividuo(setHijos);
nuevaPob = ... |
% Wave Packet Dynamics
function [q_pos, p_vel, pPRIME_acc, gamma_packet_width, eta_packet_momentum, etaPRIME_acc] = ...
initialize_squareWell(simulation_steps, q_0, gamma_0)
% POSITION - start at 1,0,0 --> really just 1 because the 2nd and 3rd
% components will always be 0 so we're not going to keep t... |
classdef NotEqualsDataFilter < MatchDataFilter
% implements a one-field ~= one-value type filter
methods(Static)
function keywords = getKeywords()
keywords = {'notEquals', '!=', '<>', '~='};
end
end
methods
function initialize(filt, field, value)
filt.field... |
function [startsamp,endsamp] = findnonsilent(d,sr,win_ms,thresh_db)
% [startsamp,endsamp] = findnonsilent(d,sr,win_ms,thresh_db)
% Takes waveform in d (at sr) and breaks it into nonoverlapping
% blocks of win_ms (32 ms), finds the largest block, then returns
% the sample indices of the first and last time block... |
% File: P3_20.m for Problem 3-20
clear;
dB = -30:1:-5;
M = 256;
n = log(M)/log(2);
mu = 255;
SNRa = 6.02*n + 4.77 - 20*log10(log(1 + mu));
plot(dB,SNRa*ones(length(dB),1));
xlabel('xrms/V at input in dB units');
|
function y = gaussian(mu,sigma,n)
%function that calculates n random values y following the a Gaussian pdf
% having a mean value mu and standard deviation sigma.
%
% Inputs:
% mu = the mean of the Gaussian curve
% sigma = the standard deviation
% n = length of the column vector
pi = 3.14159;
%creat... |
x_plot=0:0.1:100;
cont=1;
for x=x_plot
if x<=30
y_plot(cont)=x_plot(cont)/10;
elseif (x > 30 & x<=80)
y_plot(cont)=3;
elseif (x > 80 & x<=100)
y_plot(cont)=2;
end
cont=cont+1;
end
plot(x_plot,y_plot)
axis([0 100 0 10]) |
function make3plots(X1, Y1, Y2, Y3)
%CREATEFIGURE1(X1,Y1,Y2,Y3)
% X1: vector of x data
% Y1: vector of y data
% Y2: vector of y data
% Y3: vector of y data
% Auto-generated by MATLAB on 14-Feb-2007 22:38:36
% Create figure
figure1 = figure;
% Create subplot
subplot1 = subplot(3,1,1,'Parent',fig... |
% [x] = bins(bo)
%
% Given a binning object, returns a vector that indicates the bin centers.
%
function [x] = bins(bo)
x = bo.x;
|
clear;
parameter_initialization_CDCF;
fai=.5;
c_d0=35;
c_f0=0.1;
o_p_power=0.5*van_coe*(c_d0-c_f0);
%o_p_energy=van_coe*((1-volume_ratio)*c_d0-volume_ratio*c_f0+(2*volume_ratio-1)*sqrt(c_d0*c_f0));
max_deltaP=2*o_p_power;
delta_p=1:1:max_deltaP;
area=0.01:.1:.4;
for i=1:length(area)
mem_area=area(i);
... |
function e = imghuff(x)
C=imread(x);
Y=0;
Z=repmat(0, [512 512]);
A=cat(3, C, Z);
siz=size(A);
ft=size(C);
if (siz(3)==4)
for i=1:siz(3)
for j=1:siz(2)
Y=cat(1,Y,C(:,j,i));
end
end
huffman(Y);
else
for j=1:siz(2)
Y=cat(1,Y,C(:,j));
end
e=huffman(Y);
end
end |
function [zetas2, zetaOld] = kMeansLinearKernel(X,k)
oldcentroids = randomCentroidInitialization(k,X);
zetaOld = dataAssignment(oldcentroids,X);
convergence = false;
criterionConvergence = 0.0;
maxIterations = 1000000;
iterations = 1;
costs = [];
while(convergence==false && iterations < maxIterations)
%plotClasses(ze... |
vchoice = volchoice(Grad,volstep,Vol);
u = u';
p = p';
choices = volstep*[0.5,1,2];
costchoice = [0,0,0];
Volorig = 2*Vol;
for i = 1:3
Vol = Volorig - choices(i)*Grad;
Vol = 0.5*Vol;
Eulerimplicit;
[voldx,voldx2,voldt] = derivativesxt(Vol,NodesX,NodesT,dx,dt);
spatial = zeros(NodesT,1);
for j = ... |
function [xa g] = postMultiplier(F,Ht,wt,Q1,Bo,N,xsf)
%Step 4:
%Having w
%if j==1
Q = [Q1 Q1 Q1 Q1 Q1 Q1];% Q1 Q1];%*0+1;
%else
% Q = [Q1 Q1 Q1 Q1 Q1 Q1]*0;
%end
b = backwardSweep2(F,Ht,wt,N);
g = forwardSweep2(F,Q,Bo,b,N);
%Step 5:
xa = xsf + g;
%gnorm = norm(g) |
function tpslattice
global FAMLIST THERING GLOBVAL
Energy = 3.0e9;
GLOBVAL.E0 = 3e9;
GLOBVAL.LatticeFile = 'DBA24P79H2-1828';
FAMLIST = cell(0);
disp([' Loading TPS 3GeV magnet lattice ', mfilename]);
AP = aperture('AP', [-0.1, 0.1, -0.1, 0.1],'AperturePass');
L0 = 518.40000000000513280787070372276; % de... |
function featuresNorm = NormalizeFeatures(features)
% Normalize image features to have zero mean and unit variance. This
% normalization can cause k-means clustering to perform better.
%
% INPUTS
% features - An array of features for an image. features(i, j, :) is the
% feature vector for the pixel img(i, j,... |
function [acrq a_x]=CddAntiCoreQ(clv,tol)
% CDDANTICOREQ checks the existence of the anti-core of game v.
%
%
% Usage: [acrq a_x]=CddAntiCoreQ(v,tol)
% Define variables:
% output:
% crq -- Returns 1 (true) or 0 (false).
% x -- The smallest allocation that satisfies all anti-core constraints.
% input:
%... |
% generic script for a line plot from a .dat file in Matlab
clc, clf;
% absolute path to data file
abs_data_path = '/home/djs244/k_distinct_paths/dummy_fortran/resultscum';
fname = "ngt_cum.dat";
ffmt="%d %f %f %f %f";
col1_idx = 1; % column no. containing x data
col2_idx = 2; % column no. containing y data
% set dime... |
% This script runs Rewards Only Low & High productivity multiplex simulations.
% Find & replace "RO" with "RP" for the Rewards Plus Multiplex treatment.
% I recommend running this script in a folder to catch all 24,276 * 2
% output files and associated solution files. See "multiplex_dynamics.m"
% for detailed explan... |
function [re_bkimagefeature re_weights] = resampleBk(bkimagefeature,imagefeature,weights)
[row column num] = size(weights);
re_bkimagefeature = bkimagefeature;
re_weights = weights;
for i = 1:row
for j = 1:column
value = 1.0;
markpos = 1;
for q = 1:num
if weights(i,j... |
clear all
path=get_path;
parameters = get_parameters;
experiments = get_experiment_list;
% animal = [501:538 551:568 571:588];
animal = [601:642 301:325];
fs = 3200;
save_data = 1;
downsampling_factor = 10;
fifteen_min = fs * 60 * 15;
% three_min=fs*60*3;
% bands=[4 12;12 30;30 50];
threshold = 5;
for n = 1 : lengt... |
t = 1;
D_bar = sqrt(2*e_0/L);
if m == 1
gamma = min(1/L ,D_bar/sqrt(N_iter*sigma^2));
else
gamma = alpha/(2*L);
end
all_iterates = zeros(r, data.dim);
all_iterates(1,:) = z;
while t < r
SGradient;
z = z - gamma*GR;
%S3VM
if z(1) > 2*data.ratio-1+data.toler
z(1) = 2*data.ra... |
function result = mpEllipticD( Phi, M )
%MPELLIPTICD Legendre elliptic integral D.
% MPELLIPTICD(Phi,M) is elliptic integral D of the elements of Phi
% (argument) and M (parameter). Phi and M must be real and the same size
% or any of them can be scalar.
%
% MPELLIPTICD(M) is the complete elliptic integral ... |
clear all;
close all;
% data preparation
load 'healthy controls_subj1_ple';
probidData = class_n';
load 'healthy controls_subj2_ple';
probidData = [probidData;class_n'];
load 'healthy controls_subj3_ple';
probidData = [probidData;class_n'];
load 'healthy controls_subj4_ple';
probidData = [probidData;c... |
clear
close all
% run for
%ue_grad = -0.25
%Re_L = 10^3,10^4,10^5
global Re ue0 duedx;
Re = 10^5;
ue0 = 1;
duedx = -0.25;
n = 101; % defines number of panels
Int = 0; %variable that stores integral value
x = linspace(0,1,n); % dimentionless x/L
ue = linspace(1,1+duedx,n); % dimentionless ue/U
m = zeros(1,n);
H = ze... |
function [out,Xt,str,ts] = rfnn_mimo_grid(t,Xt,u,flag,itaVector,alphaVector, NumInVars,NumInTerms,NumOutVars,x0,T)
% This program is an implementation of the on-line RFNN (MIMO) system.
% The structure of the network is determined by the user.
% Inputs space is partitioned using the grid-type method.
% All parame... |
bah=zeros(300,600,3)+255;
k=0;
bah(:,:,1:2)=0;
%{
bah(1:100,:,1:2)=;
bah(201:300,:,1:2)=0;
%}
bah(1:100,:,2:3)=255;
bah(201:300,:,2:3)=255;
bah(101:200,:,1)=0;
bah(101:200,:,2)=255;
bah(101:200,:,3)=0;
for c=1:200
bah(k+1:300-k,c,:)=0;
k=k+1;
endfor
figure(),imshow(bah);
figure(),imshow(bah); |
fpga = serial('COM3');
fpga.InputBufferSize = 10000000;
fpga.OutputBufferSize = 10000000;
fpga.BaudRate = 115200;
fclose(instrfind);
fopen(fpga);
fpga.Timeout = 60; % One minute timeout period
fprintf('\nEstablishing connection..... %.2f %%',0);
for i=1:30 %wait for 15 seconds
clc;
fprintf('... |
f=[-2; -3; 5];
a=[-2,5,-1;1,3,1]; b=[-10;12];
aeq=[1,1,1];
beq=7;
lb = [0,0,0];
%[x,y]=linprog(f,a,b,aeq,beq,zeros(3,1));
[x,fval] = linprog (f,a,b,aeq,beq,lb)
|
% EVIDENCIA INTEGRADORA DE PROGRAMACIÓN AVANZADA
% INGENIERÍA EN INFORMÁTICA
% 8°A
% PETER SAVIER OROPEZA MARTÍNEZ OMPI152172
% DIEGO GUSTAVO HURTADO OLIVARES HODO140402
% FECHA: 11/08/17
function [ x ] = fibo( a )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
if a ==... |
function initAudio()
global pahandle;
% Perform basic initialization of the sound driver:
InitializePsychSound;
PsychPortAudio('Close');
% Open the default audio device [], with default mode [] (==Only playback),
% and a required latencyclass of zero 0 == no low-latency mode, as well as
% a frequency of ... |
function MCplotStimulationPowerRatioSingleRamps_test(experiments,expType,StimArea,RespArea,trim)
% by Mattia
stimulusType={'ramp'};
Path=get_path;
freqWindows = [4 12;12 30;30 100]; % add to param
Frequency = 0;
countAnimal=0;
PowerPre=[];
PowerStim=[];
% SpectrumStim=[];
% SpectrumPre=[];
% SpectrumRatio=[];
for n_ani... |
%clear all
%close all hidden
%clc
% [Dose] = DepthDose('/Users/josmond/Data/Spectral/LinacFlux6MV.txt', 1, 2, '/Users/josmond/Data/Spectral/CsIAtt.txt', 1, 3, [1 2 3 4 5 6 7 8 9 10], 4.51)
% Depth: Array of depths in mm.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%... |
clear
clc
t = [0.01 0.99 0.01 0.99 0.01];
a = [0.9 0.3 0.7 0.5 0.6];
i = 0;
summ = 0;
pdsum = 0;
for i=1:5
summ = summ + (1./2).*(t(i)-a(i)).^2;
pdsum = pdsum + (a(i) - t(i));
end
summ
pdsum |
% close all;
clc;
max_time = 200;
num_time_steps = 3;
num_time_func = 5;
min_num_sample_paths = 50;
multiplier = 10;
figure;
hold on;
for j =1:num_time_func
num_sample_paths = min_num_sample_paths + j*multiplier
cur_macrostate = [0 0 0 0];
coordinates = zeros([max_time 2]);
for i=1:max_time
... |
function meta = calcSegmentMeta(seg)
% meta = calcSegmentMeta(seg)
% Builds the meta information structure for the given
% segmentation volume.
%
% seg
% A three-dimensional segmentation volume where the
% different segments are numbered consecutively star-
% ting from one. Zer... |
function [P_new,i] = setNewPopulation(obj)
P_new = [];
i = 1;
while(length(P_new) + length(obj.F{1,i}) < obj.N)
P_new = [P_new obj.F{1,i}];
i = i + 1;
end
end
|
% Find Img.
function [xOff yOff] = MatchImg(ImgA, ImgB, Neg)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create negative image if necessary:
if ( strcmpi(Neg,'y') == 1 )
ImgANeg = max(reshape(... |
function [xs,ys]=hysampling(x,y,nval,idlog,option)
%HYSAMPLING - Sample a signal at regular intervals.
%
% Syntax: [xs,ys] = hysampling( x, y, nval [,idlog [,option]] )
%
% x,y = vectors containing the input signal
% nval = number of values of the output signal
% xs,ys = sampled signal
%
% OPTIONAL ARG... |
%bagfile = rosbag('can_coach_2020-10-06-11-45-12.bag')
% bagfile = rosbag('can_coach_2020-10-06-13-47-10.bag') % no ghost mode
bagfile = rosbag('can_coach_2020-10-06-14-52-45.bag') %bag for when we skipped to ghost mode
%%
sg_bag = select(bagfile,'Topic','/space_gap')
sg = sg_bag.timeseries
%%
dist869_bag = select(bagf... |
function [ R, s, ty, tx, new_X, new_Y] = rigid (X,Y)
% usage [ R, s, ty, tx, new_X, new_Y] = rigid (X,Y)
% Do the rigid registration of Y on centered X.
% new_Y = (ty + Y) * R * s.
% new_X is centered X (centroid in [0,0,0]). new_X = tx + X.
% this code is a simplified version of the CDP_RIGID program => Copyright (... |
clc;clear all;
%双声道计算量较大
%考虑到中央A为440Hz,音乐频率范围在80-1000Hz区间内,主频在500Hz以内
%根据奈圭斯特定理,为防止混叠,采样率应在2倍以上,设采样频率为1024Hz,方便计算
%由于性能限制,采样区间宽度固定0.01ms,参考价值可能较低
%绘制频谱图,实时显示和计算
%未完成
%分离高低频
%写出文件
% audiowrite('Output.wav',out)
%打开音频文件,读取数据、比特率及参数信息
[Audio,Fs] = audioread('E:1.wav');
info = audioinfo('E:1.wav');
%... |
function description = class2txt(data, varargin)
%% DESCRIPTION:
%
% Function to convert various classes to a descriptive text string.
% Designed to be used in combination with Selection_GUI and SIN_select.
%
% INPUT:
%
% data: data to create a descriptive string for. Should more or less
% work with t... |
%% housekeeping
close all
clc
%% rise the model
m=rise('lwz_model','solve_linear',true);
%% get the parameters
[p,priors]=create_parameters(true);
m=set(m,'parameters',p);
%% bring in the data
data=create_data();
%% estimate the model
clc
profile off
profile on
ms=estimate(m,'data',data,...
'estim_priors',pri... |
classdef LogregBinaryMc < ProbDist
%% Binary logistic regression with Gaussian prior
% We use Monte Carlo approximation to the posterior
properties
paramDist; % bag of samples
transformer; % A data transformer object, e.g. KernelTransfor
lambda; % precision of diagonal Gaussian
fitEng;
a... |
function [genodata2,markinfo2]=snp_pickmarker(genodata,markinfo,s)
%[genodata2,markinfo2]=snp_pickmarker(genodata,markinfo,idx)
% Population Genetics and Evolution Toolbox (PGEToolbox)
% Author: James Cai
% (c) Texas A&M University
%
% $LastChangedDate: 2013-04-23 18:40:46 -0500 (Tue, 23 Apr 2013) $
% $LastChangedRevi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.