text stringlengths 8 6.12M |
|---|
%% Stelling 2
%
% Wanneer je het element behorende bij index 2 opvraagt
% van de vector v=[ -3 -2 -1 0 1 2 3], krijg je een
% foutmelding.
%
Antwoord = 0;
|
function y = Sint_RI(T,band)
% y = Sint_RI :: Funcion con argumentos de entrada
% La funcion sintetiza la respuesta al impulso teniendo en cuenta las
% frecuencias centrales normalizadas segun la banda.
% Argumentos T,Fs,bandas :: T[segundos];Fs[Hz]
%..notas:: T es el tiempo de duracion
% Bandas corresponde al filtra... |
function b = ps_bwlabeln(img)
%ps_bwlabeln Label connected components in binary image
% Part of the LST toolbox, www.statistical-modeling.de/lst.html
%
% Sorry, there is no further documentation at this moment.
%
% Set borders of image to zero
img(:,:,1) = 0 .* img(:,:,1); img(:,:,end) = 0 .* img(:,:,end);
img(:... |
function [prob_y_given_x] = Compute_prob(x,h,K)
h_best = zeros(K,size(x,2));
for k = 1:size(h,2)
m = h(1,k);
prob_f_given_y1 = normpdf(x(m,:),h(2,k),h(3,k));
prob_f_given_y0 = normpdf(x(m,:),h(4,k),h(5,k));
h_best(k,:) = log(realmin+prob_f_given_y1) - log(realmin+prob_f_given_y0);
... |
function CS = CSCalc(CLA)
%CSCALC Calculate CS value from CLA
CS = .7*(1 - (1./(1 + (CLA/355.7).^(1.1026))));
end |
function [cpic] = MakeClassifierPic(all_ftypes, chosen_f, alphas, ps, W, H)
cpic = zeros(H, W);
weights = alphas .* ps;
for i=1:length(chosen_f)
cpic = cpic + weights(i) * MakeFeaturePic(all_ftypes(chosen_f(i), :), W, H);
end
end
|
function IR_distance = fcn_drawRobot(robot,varargin)
% fcn_drawRobot draws the robot
% Syntax:
% fcn_drawRobot(robot,varargin)
% Examples:
%
% % BASIC example - find all the points
%
%
% This function was written on 2020_04_13 by S. Brennan
% Questions or comments? sbrennan@psu.edu
%
%% S... |
function logs=AddSoaringData(logs, thermal)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
if nargin<2
thermal.pos = [0,0];
end
for i=1:length(logs)
logs(i).SOAR.posN = logs(i).SOAR.north;
logs(i).SOAR.posE = logs(i).SOAR.east;
lo... |
% FluidProp class contains properties and methods related to the
% fluid properties.
classdef FluidProp
properties(SetAccess = private)
contRho
contMu
dispRho
dispMu
sigma
end
methods
%%
function obj = FluidProp(contRho, contMu, dispRho, dispMu, ... |
if ~exist('recordingsPose', 'var')
disp('loading compressed recordings from file...')
load('recordingsPose.mat')
end
names = fieldnames(recordingsPose);
pose = Collection('pose');
for s = 1:numel(names)
name = names{s};
addprop(pose, name);
subject = Subject(name, 0.88, pose);
if strcmp(name, 'g... |
function fea_stack = do_stack(fea, Nstk, use_delta)
if ~exist('use_delta', 'var')
use_delta = true;
end
if ~use_delta
assert(size(fea,2) == 123);
fea = fea(:, 1:41);
end
N = size(fea, 1);
fea = [repmat(fea(1,:), Nstk, 1); fea; repmat(fea(end,:), Nstk, 1)];
fea_dup = arrayfun(@(i) fea(i:N+i-1,:), 1:2*Nstk... |
% 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
%
% Find the sum of all numbers which are equal to the sum of the factorial
% of their digits.
%
% Note: as 1! = 1 and 2! = 2 are not sums they are not included.
%
%
% A : 40730 , numbers like 145 are called factorions.
function prob_034
% If number ... |
function DispGrid(GridConf, Mode)
%DISPGRID print grid configuration to stdout.
Mode = 'short';
w = 14;
if strcmp(Mode, 'short')
fprintf('%*s : %d px\n', w, 'MaxCanvasWidth', GridConf.MaxCanvasWidth);
fprintf('%*s : %d px\n', w, 'Baseline' , GridConf.Baseline);
fprintf('%*s : %... |
function result=highpass_fuse(matrixA,matrixB)
matrixA1=abs(matrixA);
matrixB1=abs(matrixB);
%% parameter settings
Para1.iterTimes=110;
Para2.iterTimes=110;
stt1=std2(matrixA1);
stt2=std2(matrixB1);
S21=max(max(matrixA1));
S22=max(max(matrixB1));
S11=graythresh(matrixA1);
S12=graythresh(matrixB1);
Para1.alpha_f=log... |
fid = fopen('task2.dat','r')
data =fscanf(fid,'%f');
fclose(fid);
[vals,bins]=hist(data,100);
plot(bins,vals/trapz(bins,vals),'*',bins,1/sqrt(2*pi)*exp(-bins.^2/2),'-');
legend('rejection sampling','p(x)');
xlabel('x');
ylabel('density');
pause; |
function krEndTrial(dio)
% Pin 32: FirstPortA Bit 1
putvalue(dio.line(2),0) % turn bit ON;
|
function main
clear all; close all; clc
k = 0.23;
Cao = 2.3;
tspan = [0 10];
% create an options variable
options = odeset('Events',@event_function);
% note the extra outputs
[t,Ca,TE,VE] = ode45(@myode,tspan,Cao,options);
TE % this is the time value where the event occurred
VE % this is the value of Ca where the ev... |
%calling function function [node]=simple_matching(sellers,buyers,node)
function [current_sellers] = getSellers(node,sellers)
current_sellers = [];
for i = 1:length(sellers)
if(~isempty(node(sellers(i)).requestList))
current_sellers = [current_sellers;sellers(i)];
end
end |
clc
clear all
close all
a=imread('cameraman.tif');
b=imread('lena.bmp');
b=imresize(b,[256 256]);
[m n]=size(a);
alpha1=input('Enter the value of alpha:');
alpha2=input('Enter the value of alpha:');
alpha3=input('Enter the value of alpha:');
alpha4=input('Enter the value of alpha:');
for i=1:m
for j=1:n... |
% Plot FRF for all tests in Exp 3 where k was varied while c and m were
% constant.
function rect_q10()
%% PRIOR KNOWNS:
xunits = "mm";
% Experiment IDs of Each Test where c and m are held constant:
exps = [2 6 7];
k_heavy = mean([714, 760]); % Mean Heavy Spring Stiffness Determined in Lab 1
... |
function [mergeTaskDAG,mergeNodeCount] = MergeSomeGraph(taskDAGList,nodeCountList,userList,mergeUserCount)
% 合并用户组DAG
% 输出:mergeTaskDAG 合并后的DAG;mergeNodeCount 合并的节点数量
% 对合并的用户、DAG等信息初始化
nodeCount_max = max(nodeCountList);
mergeTaskDAGArray = zeros(nodeCount_max,nodeCount_max,mergeUserCount); % 合并前的DAG数组
... |
function plotrawdata(D,vel,raw)
% plotrawdata(D,vel,raw)
% This function plots the raw data (velocity vs diameter)
% D is diameter (mm), vel is velocity (m s^-1), and raw is the drops
% number
%
% JValdivia - 07, 2018
% raw = raw/max(raw(:)) * 100; % normalized to max value
dD=[ones(1,10)*0.125, on... |
% PUSH Add an element to top of stack. Return new stack.
%
% function s = push(s, x)
%
function s = push(s,x)
s.top = s.top + 1; % Increment the top index
s.data{s.top} = x; % Add the element to the stack
|
classdef Vector3
% Vector3 class inspired from C Sharp and Unity
properties
x
y
z
end
properties(Dependent, SetAccess = private)
magnitude
normalized
end
methods
% Constructor
function V = Vector3(x, y, z)
V.x = x... |
function [] = draw()
S.COL = [0 0 0]; % Start with blue.
S.fh = figure('units','pixels',...
'position',[500 300 300 300],...
'menubar','none',...
'name','Diseņar Letra',...
'numbertitle','off',...
'resize','On');
S.ax = axes('units','pixels',...
'position',[80 80 137 129],...
'Xlim',[0 1]... |
% Add the path to the ZIP and microarray db
path(path,[cd,filesep,'zipcode']);
path(path,[cd,filesep,'microarray']);
|
%[x,y] = ode4(@odefun,h, T, f0)
%odefun diff eq like this -> y' = f(x,y)
%h - шаг по сетке
%T = [x0, xf] integration limits
%f0 = [x0,y0] - initial conditions
function [x,y] = ode4(odefun,h, T, f0)
x = T(1):h:T(2);
y = zeros(length(f0(2:end)),length(x));
y(:,1) = f0(2:end);
x(1) = f0(1);
for n = 1:length(x)-1
... |
classdef testCloudBlobClient < matlab.unittest.TestCase
% TESTCLOUDBLOBCLIENT Test Suite for the Cloud Blob Client
% For testing the methods and use of the CloudBlobClient
% assertTrue
% assertFalse
% assertEqual
% assertFilesEqual
% assertElementsAlmostEqual
% assertV... |
function [dpY, dpX, quality, geom] = multi_seed_2D(pre, post, params)
%%
%I. DESCRIPTION
%This code is an implementation of the seeds algorithm proposed by Lujie
%Chen et al in A quality guided displacement tracking algorithm for
%ultrasonic elasticity imaging. This algorithm performs 2-D
%motion tracking axially and... |
function plotVectorFields( imageStack, predictionLocs, locMeans, trackletData )
[T,~,N] = size(trackletData);
for t=1:T
% Obtain subset of trackletData that is nonzero at frame t
locs = [];
vels = [];
counter = 1;
for n=1:N
if (trackletData(t,1:2,n) ~= [0 0])
locs(counter,1) = t... |
%% %%Delays and Echoes%% %%
clear all
close all
clc
%% Delays and Echoes
% Q4
figure(1)
freqz ([1 0 0 0 1],[1],'whole');
title('freqz when D = 4');
fs = 8000;
[h1,w1] = freqz ([1 zeros(1,49) 1],[1],'whole',fs);
[h2,w2] = freqz ([1 zeros(1,99) 1],[1],'whole',fs);
figure(2)
plot(w1,20*log10(abs(h1)));
% plot(w1/2/pi*f... |
function [points] = intersectPointM(rayVector, rayPoint, planeNormal, planePoint)
%INTERSECT Find the intersection between a line and a plane
pdiff = rayPoint - planePoint;
prod1 = dot(pdiff, planeNormal);
prod2 = dot(rayVector, planeNormal);
prod3 = prod1 ./ prod2;
points = rayPoint - rayVector .* repmat(prod3,3,1)... |
function Indicator = Analysis(Pop,Info)
% Analysis the result
PF = load(Info.PF);
Costs=[Pop.Cost];
%% draw PF
if(Info.nObj<=3)
hold on;
PlotPF(PF);
hold off;
end
%% calculate GD
GD = CalculateGD(PF,Costs');
%% calculate IGD
IGD = CalculateIGD(PF,Costs');
%% for return
Indicator.GD = ... |
function sliceViewer(anatObj,funcObj)
% Create text file of [LA;RA;NZ] fiducials in RAS voxel coords from vAnatomy.dat
%
% SYNTAX: vAnatomyFiducials
% vAnatomyFiducials(vAnatomyPath)
% if ~exist('vAnatomyPath','var')
% [vAnatFile,vAnatPath] = uigetfile('vAnatomy.dat','Choose vAnatomy.dat file');
%... |
x = [0, 1.25,2.5,3.75,5];
fX = [1.7499,0.983,1.2554,3.0802,2.3664];
p = lSquares(x, fX, 3);
scatter(x, fX); hold on
x = linspace(min(x), max(x));
plot(x, polyval(p, x)); hold off
p |
if ~isdeployed
addpath(genpath('/mnt/home/alikamr3/matlab/'))
%addpath(genpath('/mnt/home/alikamr3/matlab/machineLearning'))
addpath(genpath('/mnt/home/alikamr3/matlab/machineLearning/'))
end
|
function []=set_fonts(fsize,fname,varargin)
for i=1:length(varargin)
set(varargin{i},'FontSize',fsize,'FontName',fname);
end |
clear all;
clc;
%function TSMG
%
%inputs:
%simulation time: simulation time in seconds
%lambda: big flow arrival rate
%miu: inverse of flow lifetime
%
%outputs:
%
%
%simulation parameters
COST = 10; %存储代价
SIMULATIONTIME = 50000; %仿真时间
SLOTPERSECOND=50; %时隙
TIMES = 10; %最大存储次数,映射为多层图层数
STORAGE = 100*SLOTPE... |
function [] = CreateWAV( Frequency, Duration, SampleRate, Filename)
%Generates a sine wave and converts to audio WAV file.
% Frquency in Hz
% Duration in ms
% Sample Rate in Hz
%Converting Duration from ms to seconds (because Hz is used as units in frequency and sample rate)
Duration = Duration / 1000;
... |
function [x_opt, f_opt, x_path] = fw_20150423(fun, grad, A, rhs, x0, opts)
% function x_opt = fw_20150423(fun, grad, A, rhs, x0, opts)
%
% Use the Frank-Wolfe algorithm to solve the problem
%
% argmin_x fun(x) : A x <= rhs
%
% Inputs
% fun: objective, scalar function of n variables
% grad: gradient, n-dimensional v... |
% --------- Main File
% Some extra info
% Start
%----------------------------PROGRAM---------------------------------------
%----------------------------Read Excell Data------------------------------
run('excell_data_reader.m')
%----------------------------Run Engine Part-------------------------------
run('Engine_p... |
function [ x1,x,y,M,Omega ] = random_inverse( d,m,p,l,noise )
x = randn(d,1);
M = rand_sampling_matrix(m,d);
e = noise*(2*rand(m,1) - 1);
% generate random tight frame with equal column norms
if p == d
T = randn(d);
[Omega, ~] = qr(T);
else
Omega = randn(p, d);
T... |
% Lec 8.1 : Stiff systems & solutions using ode15s
function fval = myVDP(t,y)
mu = 1;
x = y(1);
v = y(2);
fval(1,1) = v;
fval(2,1) = mu*(1-x^2)*v-x;
end |
classdef Bipartite
% The class of bipartite graphs ((A, B), E)
properties
AB_AdjMatrix;
end
methods
function graph=Bipartite(AB_AdjMat)
graph.AB_AdjMatrix = AB_AdjMat;
end
end
methods(Static = true)
function adjMatrix = getAdjMatrix(bipartiteAdjMatrix)
[rows, cols] = size(bipartiteA... |
function [z, y] = TopEyelidLocation(Iris, nr, nx, ny)
% z 为上眼睑的函数,每列对应ROI当列的行坐标
% TopEyelidROI为感兴趣区域 ROI
% a 为选中用于ployfit的最终上眼睑边缘点
% I5 为ROI的横向边缘检测结果
% TopEyelidROI_rgb 为ROI的最开始选择的上眼睑边缘点
load TopEyelidTrainM1
TopEyelidTrainM1 = y;
load TopEyelidTrainM2
TopEyelidTrainM2 = y;
load TopEyelidTrainM3
TopEyelidTrainM3 = y;
c... |
function weight = perceptron(inputs, labels)
[rows,cols] = size(inputs);
updates = 0;
error = -1;
weight = zeros(1,cols);
j = 1;
while j<=100 && error == -1
%assume no more training required
error = 0;
for i=1:rows
sign = labels(i) * dot(weight, inputs(i,:));
if sign <= 0
weight ... |
function r = load_rules(r,panels)
climate = panels(1);
weather = panels(2);
if climate
r.eval('(batch "C:\\Documents and Settings\\Dani\\My Documents\\NetBeansProjects\\EOLanguage\\src\\rules_objective_climate1.clp")');
r.eval('(batch "C:\\Documents and Settings\\Dani\\My Documents\\NetBeansProjects\\EOLanguage... |
for i = 1:numWindows
idxBB = idx_b_Windowed{i};
p = xx(idxBB);
y = (A_k_partial{i}*(WMLWindowed{i}(idxBB,:)'*p) - A_k_nonzero(idxBB,idxBB)*p)./sigma_tilde_squared(idxBB)';
Ap(idxBB) = WMLWindowed{i}(idxBB,:)*(A_k_partial{i}'*y) - A_k_nonzero(idxBB,idxBB)'*y + sigmaML^-1*p - sigmaML^-1*WMLWindowed{i}(idxBB,:)*... |
function f_filtered = filter_m(f, m, l_max)
% This function filters a 2D field using Fourier-Bessel series
% should be used after build_grid_2d.m
%
% Input:
% f: a scalar field in the original Cartesian grid,
% either be 2D(x-y) or 3D(x-y-z)
% m: filter f to only maintain the azimuthal mode number of m
% l_max:... |
clc;
close all;
clear all;
o = 0:0.01*pi:2*pi;
e = cos( ((pi) * cos(o)) )
polar(o,abs(e)/max(e));
title('Radiation pattern of an antenna');
figure();
plot(o.*180/pi,abs(e));
xlabel('angle(in degrees)');
ylabel('absolute gain');
grid on; |
function y = fn_reshapepermute(x,varargin)
% function y = fn_reshapepermute(x,dimshift)
% function y = fn_reshapepermute(x,resh,perm[,resh2])
%---
% perform a combination of reshape and permute from a single function
%
% Input:
% - x input array
% - dimshift cell array - shows which dimensions will appear ... |
%% build 18
finalDS.eighteenAQ = cell(5,5);
for ph1=1:size(finalDS.eighteenAQ, 1)
clear data1 sess1_data
data1 = finalData(1).imagingData(:,ph1);
sess1_data = finalData(1).tcurveData(ph1);
for ph2 = 1:size(finalDS.eighteenAQ, 2)
clear data2 sess2_data
if isempty(finalDS.eighteenAQ{ph1... |
function [disp_az, disp_el, disp_data] = plotdiam(azi, ele, spacedata, contournum, contourcolor);
% PLOTDIAM plots space data using pcolor and corrects axes
% [] = plotdiam(azi, ele, spacedata);
if (nargin<4)
contournum = 0;
contourcolor = 'w';
end;
% display parts not shown in using pcolor and adjus... |
%{
beh.MouseWeight (manual) #
-> vis2p.Mice
timestamp : timestamp #
---
weight : double(5,2) #
%}
classdef MouseWeight < dj.Relvar
methods
function self = MouseWeight(varargin)
self.restrict(varargin{:})
end
... |
clear;
subfolder = 'Yale_Patch';
dataset = 'yale';
noise_type = 'patch';
noise_level = 160;
[O, ~] = yale_patch(1, noise_level);
O = O(:,:,1:64);
True_M = mean(O, 3);
% fprintf('Loading Mehdi...\n');
% method = 'mehdi';
% to_load = sprintf('/vol/bitbucket/mb2215/Thesis/Results/%s/results_%s_%s_%s_%f.mat', subfolder,... |
clear all
clc
R = loadsvg('clef_lspia.svg', 0.01,0 );
C = R{1,1}';
parametri = curv2_param(1, C(1,:), C(2,:)); % calcolo parametri dei punti campionati参数化
g = 3; % grado della spline
grafici = 3; % 3 per mostrare tutti i grafici
n_q = 70; % numero punti di approssimazione
n = 15; % numero punti di controllo
equidista... |
function [counter_id, result, available_entrust_Id] = counterlogin(addr, broker, investor, investor_pwd, product_info, authen_code)
%[counter_id, result, available_entrust_Id] = counterlogin(addr, broker, investor, investor_pwd, product_info, authen_code)
% counter_id 是柜台编号,ctp交易期权,商品,ETF需要不同的账号。
% 并且各自的服务器地址也不同。
% res... |
% this is function do Jacobian of f.
% px+ = px + vx*dt
% py+ = py + vy*dt
% vx+ = vx + ax*dt + nx
% vy+ = vy + ay*dt + ny
%
% Jacobian notation
% Y_x = dy/dx
%
% xo : output variable
% XO_x : Jacbian of xo wrt state.
% XO_u : Jacbian of xo wrt control
% XO_n : Jacbian of xo wrt noise
function [xo, XO_x, XO... |
%% Lab 5 Code
%1a
Fs = 6000;
d = fdesign.highpass('Fst,Fp,Ast,Ap',300,350,40,1,Fs);
hd = design(d,'kaiserwin');
b = hd.Numerator; a = 1;
fvtool(b,a)
%%
%1b
Fs = 6000;
d = fdesign.highpass('Fst,Fp,Ast,Ap',300,350,40,1,Fs);
hd = design(d,'equiripple');
b1b = hd.Numerator; a1b = 1;
%%
fvtool(b1b,a1b)
%%
%1d
Fs = 6000;
d... |
close all; clear all;
im1='demo.jpg'
[OutputMap] = analyze(im1);
imagesc(OutputMap);
|
function [y,fval] = Formula6_Fmincon(caplet_vol)
x0 = ones(4,1)*0.01;
obj_fun = @(x) (sum((Formula6(x(1),x(2),x(3),x(4))-caplet_vol).^2));
lb = ones(4,1)*(-20);
ub = ones(4,1)*10;
[y,fval] = fmincon(obj_fun,x0,[],[],[],[],lb,ub);
end
|
%% Working out the Residual Stream function from integrated meridional
%% transport using potential temp layers
function [PsiTemp]=RSF2(Fname)
%% This funtion cacluates the redisual streamfunction in density co-orindates
% To do this simply integrate zonally and cumulatively sum up the water
% column.
% INPUTS:
% fnam... |
function plotRes_2d(model_index, out)
global roadS1;
global roadS2;
global roadS3;
global roadS4;
% global curveRays;
global curveCenters;
global trajec;
close all
clc
figure('WindowState', 'maximized');
hold on, box on, grid on
model = strcat('Model', int2str(model_index));
% nLanesStraight = 3;
% nLanesCurve = ... |
function plot_BetaBursts_RP(R,BB)
subplot(2,3,3)
for cond = 1:length(R.condname)
p(cond) = polarhistogram(BB.segRP{cond}(1,:),BB.range.RP); hold on
p(cond).FaceColor = R.condcmap(cond,:);
p(cond).FaceAlpha = 0.8;
title([R.bandinits{3} ' Relative Phase']);
pax = gca; pax.ThetaLim = [-180 180];
pa... |
%% Matlab for Brain and Cognitive Scientists
% Matlab code for Chapter 33
% Mike X Cohen
%
% This code accompanies the book
% "Matlab for Brain and Cognitive Scientists" (MIT Press, 2017).
% Using the code without following the book may lead to confusion,
% incorrect data analyses, and misinterpretations of res... |
function [ grid ] = SYS_grid_cell_locs( C_x, C_y, N_x, N_y, d, layout )
%SYS_GRID_CELL_LOCS Generate X / Y locations
%
% Input:
% C_x, C_y: Center points in X and Y dimensions
% N_x, N_y: Number of TXs in X and Y dimensions
% d: Distance between TXs
% layout: Layout style (1) Grid (2)... |
function s = get_s(in1,in2,theta_begin,theta_end)
%GET_S
% S = GET_S(IN1,IN2,THETA_BEGIN,THETA_END)
% This function was generated by the Symbolic Math Toolbox version 7.0.
% 05-Jan-2017 15:29:10
q3 = in1(3,:);
q4 = in1(4,:);
q5 = in1(5,:);
s = -(q3+q4.*(1.0./2.0)+q5.*(1.0./2.0)+theta_begin)./(theta_end-theta... |
function xxxEraseFunction(src,event,fig,erase)
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
% Guidata
dpn = guidata(fig.fig);
if isempty(dpn)
return
end
% Get the number of lines and then the replacement value
lines = str2double(get(erase.lines,'String'));
value = str2double(ge... |
%trcount=4;
beg=1;
vgain=zeros(trcount,1);
for i=1:trcount
%figure(i)
beg=200*(i-1)+1;
interv=beg+50:beg+200-1;
plot(t_all(interv),f_all(interv))
cfun=fit(t_all(interv), f_all(interv)-Bias, 'sin1');
coefs=coeffvalues(cfun);
hold on
plot(t_all(interv),coefs(1)*sin(coefs(2)*t_all(interv)+c... |
clear; clc; close all;
audio = "som.wav"; audio_interf = "sominterf.wav";
[y1,Fs1] = audioread(audio);
Y1 = fft(y1)';
wk1 = 2.*pi.*(0:length(y1)-1)/length(y1);
wk1(wk1>pi) = wk1(wk1>pi)-2*pi;
Y1 = [Y1(wk1<0) Y1(wk1>=0)];
wk1 = [wk1(wk1<0) wk1(wk1>=0)];
F1 = (wk1./(2*pi)).*Fs1;
[y2,Fs2] = audioread(audio_... |
% Text Sentiment Analysis Yelp
% Scope
% This code aims to:
% 1. Represent descriptions as word2vec matrices
% 2. Train an SVM to correctly classify sentiment based on existing
% categorical labels
% 3. Train a NN also (task 2)
% Required Matlab add-ons:
% 1. Text Analytics Toolbox
% 2. Text Analytics Too... |
input_layer_size=784;
hidden_layer_size1=20;
%hidden_layer_size2=20;
output_layer=10;
load('train.mat');
m=size(X,1);
y1=X(1:5000,1);
X1=X(1:5000, 2:end);
Theta1=rand(hidden_layer_size1,input_layer_size+1).*(2*.012)-.012;
Theta2=rand(output_layer,hidden_layer_size1+1).*(2*.012)-.012;
%Theta3=rand(hidden_l... |
% A package for calculating the Component Contribution values for a given
% metabolic model. |
function [ r ] = draw_boundary( r , c , i , j , th , iter )
[row col] = size(c) ;
[ m , v ] = build_bound_matrix( c , i , j ) ;
while true %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ATTENZIONE
r = mandel( m , iter , v ) ;
end ;
end
|
function [ P,T1,F1 ] = specto( sr, EEG, Tspindle_st, k)
% k is one spesific spindle number
% Spectrogram
Fs=sr;
n=512; %Number of points in moving window
freq=2:40; %Frequencies we are interested in
cueInd=round(Tspindle_st(k)*Fs); %First cue SAMPLE
indTrial =cueInd-Fs/2:cueInd+2.5*Fs; %-500 ms to +2000 ms around cue
[... |
function final_blobs = lostInDTU(I)
%% Explore the HSV components
HSV = rgb2hsv(I);
Hcomp = HSV(:,:,1);
Scomp = HSV(:,:,2);
Vcomp = HSV(:,:,3);
%% Filter on the values of the HSV to get the red and white parts of the image
segmRed = (Hcomp > 0.92 | (Hcomp < 0.1 & Scomp > 0.5)) & Scomp > 0.4... |
%% understand the turbulent energy spectrum
function tes = turb_energy_spectrum(u,v)
[sx,sy]=size(u);
% Energy calculation
Fu=fftshift(fft2(u)); Fv=fftshift(fft2(v));
phy11=conj(Fu).*Fu;phy22=conj(Fv).*Fv;
phy=phy11+phy22;
% mesh(log(phy+1));
% wave number estimation
cx=(sx+... |
function [A,B,K,J,Cov] = mysystem(This,Alt)
% mysystem [Not a public function] VAR system matrices.
%
% Backend IRIS function.
% No help provided.
% -IRIS Macroeconomic Modeling Toolbox.
% -Copyright (c) 2007-2017 IRIS Solutions Team.
try
Alt; %#ok<VUNUS>
catch
Alt = ':';
end
%---------------... |
function success = uq_test_sobol_indices_LRA(level)
% success = UQ_TEST_SOBOL_INDICES_LRA(level) Test routine for LRA based
% sobol indices.
% Evaluates the sensitivity for a function, and validates
% the results against the correct values.
success = 0;
if nargin < 1
level = 'normal';
end
fprintf(['\nRunning: |',... |
path = '/Users/jonathangornet/Google Drive/Computational_Neuroscience/STDPData/01-3-2019/01';
cd(path)
dinfo = dir;
GammaEneuron01 = zeros(10,21,2);
GammaIneuron01 = zeros(10,21,2);
gnum = 1;
for dd = 1:length(dinfo)
name = dinfo(dd).name;
if name(1) == 'G'
load(name)
... |
delete(gcp("nocreate"));
diary off;
fprintf("\33[0m\33[H\33[J");
|
function setMetadata(obj, varargin)
% SETMETADATA Sets the metadata for the blob
% Key Value pairs in char vector format can be passed as an individual pair or
% as containers.Map containing multiple Key Value pairs.
% Copyright 2018 The MathWorks, Inc.
logObj = Logger.getLogger();
if nargin == 3
keyStr = vararg... |
function P = RSADigitalSigAuthenticate(s,e,n)
% P = RSADigitalSigAuthenticate(s,e,n)
P = FastExp(s,e,n);
|
% Returns structurei, rotation, basis, coeff instead of just structure.
% For compliance with the NRSFM full-initialization interface.
function [structure, rotations, basis, coeff] = ...
nrsfm_init_find_structure_adaptor(f, projections, rotations, K)
structure = f(projections, rotations);
[basis, coeff] = fact... |
classdef (Abstract) BoundaryMarker < handle
% BOUNDARYMARKER
%
% Description:
% Abstract class parent for IPL-GCL and INL-IPL boundary markers
%
% Constructor:
% obj = BoundaryMarker(source)
%
% Inputs:
% source volume name or abbreviation (char)
%
% Method... |
function [g,Cell,EnergyBend]=gBending(Cell,Y,Set)
% K(i,j)= derivative of g(i) wrt to x(j)
% energy based on the total cell area W_s= sum_cell ((As-As0)/As0)^2
%% Input
Set.Sparse=true;
%% Set parameters
ncell=Cell.n;
%% Initialize
dimg=Set.NumTotalV*3;
g=zeros(dimg,1); % Local cell residual
En... |
function [c,h] = funny(x)
c=[];
h=x(2)-x(1)^2;
end
|
pow_es_CL_active = getPowSpd(es, es.traj~=0 & es.contrast~=0 & es.outcome==2);
freqSpd_CL_active = freqVsSpd(pow_es_CL_active);
pow_es_CL_pass = getPowSpd(es, es.traj~=0 & es.contrast~=0 & (es.outcome==1));
freqSpd_CL_pass = freqVsSpd(pow_es_CL_pass);
pow_es_CL_miss = getPowSpd(es, es.traj~=0 & es.contrast~=0 & (es.o... |
factors1=[9.85; 9; 8.87; 9.5]; %Central African Republic
factors=factors1;
K=[1/2 0 1/3 1/6; 0 2/3 1/6 1/6; 1/2 0 3/8 1/8; 1/4 1/4 1/4 1/4];
year=5;
delta=0.02;
Y=zeros(100);
for i=1:100
factors=factors1;
factors(1)=factors(1)-delta*i;
target=sum(factors);
for j=1:year
factors=K*factors;
... |
function [photonCounts , variance ] = generateLogProjectionVarianceLookupTable( electronicNoiseStd, a, b )
if nargin < 2
a = 2;
b = 8;
end
N = 100000;
M = 200;
photonCounts = logspace(a, b, M);
mu = zeros(1,M);
variance = zeros(1,M);
for i = 1:M
if photonCounts(i) < max( electronicNoiseStd^2 * 100... |
% k-means
function mu = kmeans(X, K, max_iter, plotProgress)
% K = 2; max_iter = 10;
[m, ~] = size(X);
mu = X(randi(m,K,1),:);
distances = zeros(m, K);
if plotProgress
plot(X(:,1),X(:,2),'.b'); hold on;
plot(mu(:,1),mu(:,2), 'xr', 'MarkerSize',10,'LineWidth', 3); hold off;
end
f... |
function result = boosted_detector(image, scales, classifiers, ...
weak_classifiers, face_size, ...
result_number)
% function result = boosted_detector(image, scales, classifiers, ...
% weak_classifiers, face_size,... |
function [drugID, concentration, drugLabels, drugMap, concMap] = getCondition_PanelA(Loc)
% This code 'getCondition_PanelA.m' is copyright 2021
% Authors: Edward R. Polanco, Tarek E. Mustafa, Thomas A. Zangle
% This code is distributed under a creative commons attributable
% sharealike license. This license allow... |
clear
clc
close all
t=-5:0.2:2;
t0=3;
y=unitstep(t+t0);
figure(1)
stem(t,y,'color', [0 0 100]/255,'Linewidth',2)
axis([-5 2 -1 1.5])
xlabel('n')
ylabel('f[n]') |
%a
v=zeros(1,21);%am initializat un vector de zerouri cu 21 de elemente
v(6)=1;
v(12)=1; %in vector, cinci de 0 sunt urmati de un 1, adica vom gasi 1 pe pozitiile 6,12 si 18
v(18)=1;
n=0:20;
m=-5:15;
figure(1);
subplot(2,1,1),stem(n,v),title('vectorul v in functie de n'),grid,xlabel('n'),ylabel('v')
subplot... |
% General GC regression analysis on a single realization (data)
% [srd, rd, aveX] = GC_regression(X[, od_max[, od]])
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% input data
[p,len] = size(X);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% analysis
if ~exist('od_max', 'var')
od_max = 99;
end
s_od = 1:od... |
function [biny,sep]=en_runs_2sepsA(r,p,cbook,biny)
%Difference from en_runs_2seps.m: does not consider length (assuming long
%enough situation). Since 1 sep is excluded, length is coded and thus
%length is not required in decoding.
%biny0=biny;
%if lenz > 1000
% biny=[biny 0]; %flag length(z)>1000
%se... |
% Execute N commands one after another:
a=1; b=2; c=3;
% Disable last warning in Octave.
[text, id] = lastwarn();
warning('off', id)
% Format how output (disp() or a simple output) will be displayed.
format long
format short
% Documentation for the function: [help function_name].
help eye
help help
% Set uo Octave ... |
function scans_to_process = LONG_warpROIsToNativeSpace(scans_to_process, templatepath, roipath, timepoint, modulation)
%LONG_warpROIsToNativeSpace - warp atlas ROIs into native timepoint
%space
%
% Syntax: scans_to_process = LONG_extractROIsInNativeSpace(scans_to_process, timepoint)
%
% Inputs: scans_to_process - ar... |
function frames()
%path = [-0.75625 -0.125 12; -0.75125 -0.125 100; -0.7500556641395 -0.01285937583185 1765.5173];
%path=[-2 0.5 1; -1.9 0.4 2; -1.8 0.3 4; -1.7 0.2 7; -1.6 0 11;]
path = [
-10 -10 -10 2;
0 0 0 2;
10 10 10 2;
];
numFrames = 7;
interpType = 'pchip';
full... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.