text stringlengths 8 6.12M |
|---|
function [ pathCell ] = embryoGTGraph( G )
%GROUNDTRUTHGRAPH Construct graph embryo model from ground truth.
%
% INPUTS
% G: (logical matrix) ground truth image of embryo with M edges.
%
% OUTPUTS
% pathCell: (M x 1) cell array of edge samplings. Entry i, a sampling of
% the i-th edge, is a (2 x n) matrix of n samples ... |
function carved = insertVertSeams(img, n)
carved = img;
vertSeams = zeros(size(img,1),n);
for seam=1:n
vert = accMinVertPathMap(carved);
v = findVertSeam(vert);
vertSeams(:,seam) = v;
carved = vertSeamCarve(carved, v);
end;
printVertSeams(img,vertSeams);
... |
function [vpath,startingState,prior,trans,meansFull,covarsFull,mixmat,obs,stateOrd] = runHMMAlignment(notenum, means, covars, align, yinres, sr, learnparams)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%[vpath,startingState,prior,trans,meansFull,covarsFull,mixmat,obs,stateOrd]
% = runHM... |
clc
clear all
addpath('../jsonlab-1.5/');
datapath='..\data';
%input variables
master_data=loadjson([datapath filesep 'master_data.json']);
Performance_data=loadjson([datapath filesep 'Performance_data.json']);
Performance_data_design=loadjson([datapath filesep 'Performance_data_design.json']);
load isatable.... |
function out1 = hess_grf_ceq_heel221(in1,toe_th,dmax,cmax,k,us,ud)
%HESS_GRF_CEQ_HEEL221
% OUT1 = HESS_GRF_CEQ_HEEL221(IN1,TOE_TH,DMAX,CMAX,K,US,UD)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 23-Jun-2020 12:15:53
out1 = 0.0;
|
function test_resizeStack()
test_values();
test_size();
end
function test_values()
% Create two images, 5*5
im1 = reshape(101:125, 5, 5);
im2 = reshape(301:325, 5, 5);
stack(:, :, 1) = im1;
stack(:, :, 2) = im2;
% Resize, truncate, pad
sz = 3;
padding = 1;
resized ... |
function [sigmoid]=funcion_sigmoide (z)
sigmoid = 1./(1+exp(-z))
end |
% this function is to randomly
% switch m elements(n>2) for some iterations and
% then switch 2 elements randomly for 2000 iterations.
% p=p(randperm(numel(p))) % repermutate
function [p, y, y2] = switchperm(A,p,m,n,y,y2)
fp = fvalue(A,p,n);
%% exchange m elements randomly
fp = fvalue(A,p,n);
for j = 1:8000
... |
%% Find good clusters
NPSP_threshold = 60;
for ii = 1:numel(psth)
ix(ii) = psth(ii).NPSP < NPSP_threshold;
end
good_clusters = find(ix ~= 0);
%% Plot them
num_rows = numel(psth(1).params.dB_levels);
num_columns = numel(psth(1).params.freqs);
num_stim = num_rows*num_columns;
index = reshape(1:num_stim, num_columns, num_... |
function X = dtft(x,n,w)
% Computes the discrete-time Fourier transform
% X = dtft(x,n,w)
% X = DTFT values computed at w frequencies
% x = finite duration sequence over n
% n = sample position vector
% w = frequency location vector
x = x(:);
x = x.';
n = n(:);
n = n.';
w = w(:);
w = w.';
W=exp(-j*w.'*n);
X=W... |
% UTILIZAÇÃOS DOS PARAMETROS OBTIDOS ANTERIORMENTE PARA SIMULAR OS GRAFICOS
% DA AMPLITUDE, DESLOCAMENTO ANGULAR E O TORQUE ATRAVÉS DO TEMPO
% ========================================
%DECLARAÇÃO DAS VARIÁVEIS
clc
clear all
syms t;
S= (1757*sin(pi.*t))/100;
S1 = diff(S);
S2 = diff(S1);
S1
S2
l = 0... |
function [] = main4(dataPath, matrixName, calculatePath, timeMoment, timeThreshold, windowSize)
if nargin < 5
dataPath = "data";
matrixName = "smooth_colorEvents3.mat"
baseLinePath = "data";
calculatePath = "Calculate";
timeMoment = 0;
timeThreshold = 0.1;
win... |
function [freqindex,locindex,parsed_result] = ...
parse_HRTF(HRTF_matrix,frequencies,locations,freqlimits,AZlimits,ELlimits);
%Parses an HRTF matrix according to LOCATION criteria
%The matrix must have frequencies assigned to rows, locations assigned to columns
%Usage:
% parse_HRTF(HRTF_matrix,locations,freql... |
%exactLineSearch = true;
exactLineSearch = false;
%f = @(x) 0.5*(x(:,1).^2 - x(:,2)).^2 + 0.5*(x(:,1)-1).^2;
f = @(x) aokiFn(x);
[x1 x2] = meshgrid(0:0.1:2, -0.5:0.1:3);
Z = f([x1(:), x2(:)]);
Z = reshape(Z, size(x1));
figure(1);clf
contour(x1,x2,Z,50)
hold on
h=plot(1,1,'ro'); set(h,'markersize',12,'... |
function b = ASDRpiano(y)
x1=linspace(0,6,length(y)/7);
x2=linspace(6,2,length(y)/7);
x3=linspace(2,3,length(y)/7);
x4=linspace(3,2,length(y)/7);
x5=linspace(2,2,2*length(y)/7);
x6=linspace(2,0,length(y)/7);
b=[x1,x2,x3,x4,x5,x6];
extra=length(y)-length(b);
filler=zeros(1,extra);
... |
%--------------------------------------------------------------------------
% Single POINT Positioning (SPP) using pseudorange AND phase observations
% ------------------------------------------------------------------------
% Coder : Mohammed Abou-Galala
% Date : 13-10-2021
%----------------------------... |
function [plotOrder, plotNames, catColors] = getTestPlotInfo()
% GET TEST PLOT INFO - Get ordering, reordering, and colors, for
% testing the plotting code
% SETUP:
% Data is collected in three blocks of five ascending bars data.
% Data is displayed with the first block reversed, a pyramid inserted, a
% short second b... |
% Camera Center Stencil Code
% CS 4495 / 6476: Computer Vision, Georgia Tech
% Written by Henry Hu, Grady Williams, James Hays
% Returns the camera center matrix for a given projection matrix
% 'M' is the 3x4 projection matrix
% 'Center' is the 1x3 matrix of camera center location in world coordinates
funct... |
function Plot_TimeAmplitude( AudioPath, AlgorithmFile, onsetTime, index )
%PLOT_TIMEAMPLITUDE Summary of this function goes here
% Detailed explanation goes here
%plot
figure(index)
[y, fs] = audioread(AudioPath);
dt = 1/fs;
t = 0:dt:(length(y)*dt)-dt;
plt = plot(t,y, 'black');
xlabel('Seconds');
ylabel('Amplitude... |
function [isel jsel] = fn_subrect(a)
% function indselect = fn_subrect(a)
% function [isel jsel] = fn_subrect(a)
%---
% opens a window, displays image a, let user select a rectangle and returns
% indices corresponding to this selection
% Thomas Deneux
% Copyright 2010-2012
if nargin<1
h = 0;
else
h = figure;
... |
function [ positions ] = inverseVelKin(jacobian, velocity )
velocity = velocity';
jacobian = jacobian(1:3, 1:3);
iJacobian = inv(jacobian);
positions = iJacobian * velocity;
end
|
function [E,A,U,V,nn,ll]=zzguptri2(E,A,tol)
% [EE,AA,U,V,nn,ll,na0]=zzguptri2(E,A,tol);
%
% ll(1) ll(2) ll(3) ll(4)
% [sE11-A11 sE12-A12 sE13-A13 sE14-A14] nn(1)
% U*(sE-A)*V = [ 0 sE22-A22 sE23-A23 sE24-A24] nn(2)
% [ ... |
function hfigs = plot_particle_distribution_with_uav(TargetID, pf,k,est,truth,uav,plot_title, model)
% Input: particles info pf, time index k
% Output: plot
LineWidth = 1;
ptk = pf{TargetID}.particles(:,:,k);
pwk = pf{TargetID}.w(:,k);
% pwk = ones(1,pf{TargetID}.Ns)./pf{TargetID}.Ns;
hfig = scatte... |
clear all;
addpath('../General');
dt = 0.001;
[~, ~, couplingBaseVectors] = buildBaseVectorsForPostSpikeAndCoupling(1, 1/1000, [0.001 0.009], 1e-2, 0);
%[~, ~, couplingBaseVectors] = buildBaseVectorsForPostSpikeAndCoupling(5, 1/1000, [0.001 0.03], 1, 0);
figure();
lenOfVec = size(couplingBaseVectors,1);
time = linspa... |
function x = Vector_sum_proc_(p, u)
% Vector_sum_proc: FFT vector-sum filterbank.
% Combines the FFT bins into bands.
%
% x = Vector_sum_proc(p, u)
%
% p: Struct containing the filterbank parameters.
% u: Complex FTM with p.num_bins rows (FFT_filterbank_proc output).
%
% x: Complex FTM with p.num_bands rows.... |
% Network visualization with cytoscape
clear;
cprintf('*[1,0.5,0]','\n\n --->Requirements to run the example: CYTOSCAPE');
pause(2)
cprintf('*[1,0.5,0]','\n\n --->Shows network');
pause(2)
Arabidopsis_circadian_SM;
inputs.model.shownetwork = 1;
AMIGO_Prep(inputs)
cprintf('*[1,0.5,0]','\n\n --->Shows network with ... |
function [] = myPath()
path('my_math;html',path);
end |
function [b1]=c1_horner(a,c,n)
% c : the x of the polynomial
% a : the coefficient of th polynomial 从低次数到高次数
b(n) = a(n);
for k = n-1 : -1 : 1
b(k) = a(k)+c*b(k+1);
end
b1 = b(1) |
function DisplayFeatureTableData(handles, TableData, GroupNum)
%Format
TableHeader=get(handles.UITableItem1, 'ColumnName');
TableEdit=get(handles.UITableItem1, 'ColumnEditable');
TableWidth=get(handles.UITableItem1, 'ColumnWidth');
TableFormat=repmat({'char'}, 1, length(TableHeader)-1); %Need to be overwritt... |
%-----------------------------------------------%
% Begin Function: get_pdyn_hr %
%-----------------------------------------------%
function [pdyn,hr] = get_pdyn_hr(in,auxdat,name)
re = auxdat.re;
f_ell = auxdat.f_ell;
date0_doy = auxdat.date0_doy;
date0_sec = auxdat.date0_sec;
atm_model = auxdat.atm... |
function trackers = config_trackers
% Register state-of-the-art trackers
register('trackers', struct('name','SRDCFdecon','namePaper','SRDCFdecon'));
register('trackers', struct('name','HDT','namePaper','HDT'));
register('trackers', struct('name','Staple','namePaper','Staple'));
register('trackers', struct('name','SRDC... |
function [x,y] = getUpperPixels(line)
% GETLOWERPIXELS. This function iterates from bottom to top and itretrieves
% the first black pixel found for every column. This black pixel correspond
% to the lowest one in the column.
if ~islogical(line)
line = im2bw(line);
end
x = [];
y = [];
cou... |
In Matlab kun je met de ronde haken ( ) character
vectoren samenvoegen. |
clear;
close all;
addpath(genpath('calib_data'));
addpath(genpath('Corner'));
addpath(genpath('lightDirectionSnaps'));
he=imread('/usr/not-backed-up/CalibData/cam4/light3pos0.bmp');
cform = makecform('srgb2lab');
lab_he = applycform(he,cform);
ab = double(lab_he(:,:,2:3));
nrows = size(ab,1);
ncols = size(ab,2);
ab ... |
load('data/XTrain.mat');
load('data/yTrain.mat');
[m,n] = size(XTrain);
c = size(yTrain, 2);
relation = zeros(c,c);
for i=1:m
if mod(i, 100) == 0 printf('%d ',i); fflush(stdout); end;
idx = find(yTrain(i,:));
s = size(idx, 2);
for p=1:s-1
for q=p+1:s
relation(idx(p),idx(q)) = rela... |
function ContactPointR = ContactPointR(x,y,thetaL,thetaR,g,lCG,lL,mL,jL)
%CONTACTPOINTR
% CONTACTPOINTR = CONTACTPOINTR(X,Y,THETAL,THETAR,G,LCG,LL,ML,JL)
% This function was generated by the Symbolic Math Toolbox version 7.1.
% 08-Jan-2017 14:10:15
ContactPointR = [x+lL.*sin(thetaR);y-lL.*cos(thetaR)];
|
% Book cover: symmetric matrix with images, different color on diagonal.
n=10;
i=-n:.1:n;
d=zeros(length(i));
for ii=1:length(i)
for jj=1:length(i)
d(ii,jj) = log( complex(i(ii),i(jj)) );
end
end
d(~isfinite(d))=min(d(:));
surf(abs(d)+real(d)+imag(d)), axis xy, axis square, axis off
shading inte... |
function Calls = Automerge_Callback(Calls1,Calls2,AudioFile)
%% Merges two detection files into one
Calls=[Calls1; Calls2];
% Audio info
audio_info = audioinfo(AudioFile);
%% Merge overlapping boxes
Calls = merge_boxes(Calls.Box, Calls.Score, Calls.Type, audio_info, 1, 0, 0);
|
function [L,rho] = simple_self_inductance_square_coil(d_out,number_of_layers,N_total,spacing,width)
%SIMPLE_SELF_INDUCTANCE_SQUARE_COIL Summary of this function goes here
% Detailed explanation goes here
d_in=d_out-2*floor(N_total/number_of_layers)*(spacing+width);
d_avg=(d_out+d_in)/2;
rho=(d_out-d_in)/(d_out+d_in);... |
function puzzle = recognizeCNN(cropped_image)
% This function takes in the cropped images as a 28*28*1*81 matrix and
% outputs the recognized puzzle (9*9 matrix) using CNN.
% Load the pre-trained network
load MNIST_transfer_net netTransfer
% Make classfication
result = classify(netTransfer, cropped_image);
% Out... |
function gam = proj_tangspace_from_Oprange(y,problem,varargin)
%proj_tangentspace_from_Omega This function projects a m-sparse matrix y
%with values in Omega
%into the tangent space
% T:= {U*Z1' + Z2*V' ; Z1 \in \R^(d1xr), Z2 \in \R^(d2xr)}. The map can be
% written as
%P_T(P_Omega'(y)) = U*U'*P_Omega'(y) + *P_Omega'(y... |
% ReleaseControl - ReleaseControl() This will allow the renderer to start up again.
function ReleaseControl()
D3d.Viewer.Mex('ReleaseControl');
end
|
function [h,slope,m]=plot_covariance_ellipse(m,cv,alpha)
% h=plot_covariance_ellipse(m,cv,alpha)
% h=plot_covariance_ellipse(X,alpha)
if length(m(:))==2,
m=m(:);
if nargin<3,
alpha=[];
end;
else
if nargin<2,
alpha=[];
else
alpha=cv;
end;
X=m;
isvalid=all(~isnan(X),2);
X=X(i... |
%% 从测试的结果来看,当数据量达到1000以后 正态分布和logistics分布的拟合效果已经很好了
%% t分布的拟合效果相对不好
%% 产生正态分布的随机数 进行参数估计
%产生随机数
data=random('norm',5,1,100,1);
%极大似然估计
phat=mle(data,'distribution','norm');
%自己定义正态分布的分布函数
cuspdf=@(data,mu,sigma) 1./(sqrt(2*pi)*abs(sigma))*exp(-1/2*(data-mu).^2/sigma^2);
phat2=mle(data,'pdf',cuspdf,'start',[5,1]);
% x... |
function angles = performHough(points, sliceRange, peaks)
global showFigures;
% figure(3); clf;
% axis([-5 5 -5 5 -1 5]);
if (showFigures)
hold on; grid on;
xlabel('x');
ylabel('y');
zlabel('z');
end
displayPoints2 = points(points(:,3) > sliceRange(1) & points(:,3) < sliceRange... |
%Function to determine the nearest neighbors for each particle. Along with
%the index of each relevant particle. Aiming to implement either Tim Still
%or Eric Weeks polydispersity script.
load finalvalues.mat
%%
close all
% out(:,1) = out (:,1) - min (out(:,1)); %move particles to origin, due to mask of cntrd.m
% ou... |
classdef ffnn < handle
%NN Neural network
% Contains NN structure
properties
%neurons in each layer
architecture
%% number of layers
L
%weihts, initialize to random values
W
%cell array containing linear part of output... |
function [] = multitaper(sig)
% Setup experiment variables
sample_rate = 1000;
time_step = 1/sample_rate;
window_len = 0.5;
window_len_ms = window_len*1000;
freq_res = 1/window_len;
fNyquist = sample_rate/2;
f_grid = 0:freq_res:fNyquist;
total_n_sample = length(sig);
mtpr_spectrogram = NaN( length(f_gri... |
function CreateGUI(obj)
%
% Copyright 2015 Yulin Wu, Institute of Physics, Chinese Academy of Sciences
% mail4ywu@gmail.com/mail4ywu@icloud.com
AlertSchemeOptions = {'Idle','Base Temperature','Warming up','Cooling down','No Alert'};
choice = questdlg_multi(AlertSchemeOptions, 'Alert options', 'No Alert',... |
classdef brainViewer < Window
%BRAINVIEWER
%
%% CHANGELOG
% Written by Josh Grooms on 20131208
% 20140829: Updated for compatibility with the WINDOW class updates (formerly WINDOWOBJ).
% 20160525: Updated to restore minimum working functionality (still pretty buggy, though).
%% TODOS
% TODO - Implem... |
% PLANE_BBOX_INTERSECTION short description
% Copyright (c) 2008 Andrea Tagliasacchi
% All Rights Reserved
% email: ata2@cs.sfu.ca
% $Revision: 1.0$ Created on: 2008/08/04
function [predicate] = plane_bbox_intersection( Pp, Np, BBOX )
global TH_ZERO;
hasAbove = false;
hasBelow = false;
predicate = false;
if isempt... |
clc; close all; clear;
file = load('spm10.mat');
m = file.a;
b = rand(10,1);
% file = load('sparse1000by1000.mat');
% m = file.A_sp_full;
% b = rand(1000,1);
% PLAIN
disp('Plain');
u = chol(m);
l = u';
y = fwdSub(l,b)
x = bwdSub(u,y)
% PERMUTATION
disp('Permutation');
p = amd(m);
% p = zeros(size(b,1),1);
% for... |
function FBins = calculateFreqBins(Fs,Nfft)
% Nfft ~ window length
% Fs ~ sample rate
FNyq = 0.5*Fs; % Nyquist frequency
% FreqBinWidth = FNyq/Nfft;
% FBins = (0:(Nfft-1))*FreqBinWidth;
FBins = linspace(0,FNyq, ceil(Nfft/2));
return
end |
% This script demonstrates the hierarchical clustering algorithm on a set of
% artificially generated data points. Data points are considered to be
% sampled from three different multivariate distributions identified by the
% parameters MU1, MU2, MU3 and SIGMA1, SIGMA2, SIGMA3.
%Initialize workspace.
clc
clear all
% ... |
%watermark embedding
imagefolder=('C:\Users\hp\Desktop\project on watermarking\database\standard_test_images');
filename=dir(fullfile(imagefolder,'*.tif'));
totalimages=numel(filename);
p=cell(totalimages,1);
s=cell(totalimages,1);
m=cell(totalimages,1);
b=cell(totalimages,1);
r=cell(totalimages,1);
b22=cell(t... |
function [ ] = plot_segments( brk, clse )
%The function plots the segments of the time series clse as given by the
%segmentation function
figure;
len = length(clse);
plot([1:len]',clse,'k-');
hold on;
yL = get(gca,'Ylim');
for i = 1:len
if(brk(i) == 1)
line([i,i],yL,'Color','k');
end
end
% mx = max... |
clear;
clc;
function returnedVal = EgriFonksiyonu(x)
returnedVal = (5*power(x, 3)+3*power(x, 2)-2*x-8);
endfunction
EsikDeger = 0.01;
AraNokta = 0;
IterasyonSayisi = 0;
X = [-2, 2];
while true
IterasyonSayisi++;
X(3) = (X(1) + X(2)) / 2;
AraNokta = X(3);
FX(1) = EgriFonksiyonu(X(1));
... |
function [A,B,C,D,phi,it1,it2,phi_vec]=bcdLrMrNr_alsls(X,L_vec,M_vec,N_vec,lsearch,comp,Tol1,MaxIt1,Tol2,MaxIt2,Ninit,A,B,C,D)
%BCDLMN_ALSLS Block Component Decomposition (BCD) in rank-(Lr,Mr,Nr) terms.
% [A,B,C,D]=bcdLMN_alsls(X,L_vec,M_vec,N_vec) computes the BCD-(Lr,Mr,Nr) of a third-order tensor.
% The alternat... |
function data = conv_sdecode(y,ieff,en_mode,A,level,map_mode)
%CONV_SDECODE 卷积码软判决译码函数
% 采用Viterbi译码
%
% 输入参数:
% y 1*n double 卷积码码流
% ieff 2,3 1/编码效率
% en_mode 0,1 编码模式: 0->不收尾, 1->收尾
% A 1*1 double 电平幅度
% level 1,2,3 每电平比特数
% map_mode 0,1... |
classdef FilterFeature
%FILTERFEATURE extract features from a image by using filters
properties
image;
featureImg;
filter;
end
methods
function obj=FilterFeature(img, filterName, siz, sigma)
%... img is already in grayscale, right?
obj.image =... |
x = [0:1:2];
y = x;
plot(x, y);
% 绘图设置
xlabel('x');
ylabel('y');
title('y=x');
grid on;
axis equal;
|
% THIS SCRIPT IMPLEMENTS A MPC CONTROLLER FOR TRAJECTORY TRACKING OF ROBOT
% MOTION
%% CONFIGURATION SPACE
% X-AXIS: 0...50
% Y_AXIS: 0...50
%% INITIALIZE
% Scenario 1
%init_scen_1;
% Scenario 2
init_scen_2;
% Scenario 3
%init_scen_3;
%% OBTAIN MODEL
% Lateral model
robot_sys_ss= lateral_2_dof_model(robot_vel,... |
function GG=Gauss_anybasePoly(Alpha,g,h,delta)
G=GgaussDirectPoly(h,g,delta);
GG=Alpha*G;
end
|
function displayimgnmask2_alex(Image,area_mask,save_dir,area_names,divfactor)
if nargin<5
divfactor=0.3;
end
num_areas = size(area_mask,3);
im_class = class(Image);
figure('units','normalized','outerposition',[0 0 1 1]);
Image = imresize(Image,divfactor);
area_mask = imresize(area_mask,divfactor,'nearest');
fo... |
pt1 = [1;1];
placelabel(pt1,'pt1');
x1 = 1;
y1 = 1;
pt1guide = [1.25;1.5];
placelabel(pt1guide,'guide1');
x1guide = 1.25;
y1guide = 1.5;
pt2 = [6;2];
placelabel (pt2,'pt2');
x2 = 6;
y2 = 2;
pt2guide=[5;3];
placelabel(pt2guide,'guide2');
x2guide = 5;
y2guide = 3;
hold on
plot(Calculation(x1 ,x1... |
%畫橢圓
clear;clc;clf
a=3;b=a-1;
theta=linspace(0,2*pi,100); %取線性內插
rr=a*a*b*b./(a*a*sin(theta).^2+b*b*cos(theta).^2);
r=sqrt(rr);
h1=polar(theta,r,':r') %字串內控制極座標的顏色和型式
set(h1,'Linewidth',5) %控制線條的粗細 |
function [nlp] = updateVariableBounds(nlp, bounds)
nlp.updateVariableBounds(bounds);
nlp.Phase(1).Plant.UserNlpConstraint(nlp.Phase(1),bounds.RightStance1);
nlp.Phase(3).Plant.UserNlpConstraint(nlp.Phase(3),bounds.LeftStance1);
nlp.Phase(5).Plant.UserNlpConstraint(nlp.Phase(5),bounds.RightStan... |
function alpha=Malpha(triangles,A,len)
% calculate the alpha matrix (without threshold approximate)
alpha=zeros(len,len);
for j=1:len
T_now= triangles(:,:,j);
alpha(:,j)=int_green3d_tri(A,T_now);
end
end |
doTraining = false;
if ~doTraining && ~exist('yolov2ResNet50VehicleExample.mat','file')
% Download pretrained detector.
disp('Downloading pretrained detector (98 MB)...');
pretrainedURL = 'https://www.mathworks.com/supportfiles/vision/data/yolov2ResNet50VehicleExample.mat';
websave('yolov2ResNet50Vehicl... |
function [J, grad] = costFunction(theta, X, y, lambda)
m = length(y);
grad = zeros(size(theta));
J = 1 / m * sum( -y .* log(sigmoid(X * theta)) - (1 - y) .* log(1 - sigmoid(X * theta)) ) + lambda / (2 * m) * sum( theta(2 : size(theta), :) .^ 2 );
for j = 1 : size(theta)
if j == 1
... |
k = 0.3;
t = 0.4;
m = 0.001;
r = -0.2;
global options;
options = zeros(10,1);
options(1) = optByHestonFFT(0.02,190,datenum('20-07-2018','dd-mm-yyyy'),datenum('21-07-2018','dd-mm-yyyy'),'call',193,0.2,t,k,m,r);
options(2) = optByHestonFFT(0.02,190,datenum('20-07-2018','dd-mm-yyyy'),datenum('21-07-2018','dd-mm-yyyy'),'c... |
clc;
clear ALL;
%%
% Data generation
bitSize = 4;
pattern = zeros(1, 2^bitSize);
for i = 1 : 2^bitSize
pattern(i) = i;
end
numOne = 2^(bitSize -1) - unidrnd(4);
numTwo = 2^(bitSize -1) - unidrnd(4);
temp = randperm(2^bitSize);
classOne = zeros(1, numOne);
for i = 1 : numOne
classOne(i) = temp(i) - 1; %for n... |
function retval=laplacian(x,y)
nx = length(x);
dx=x(2)-x(1);
retval(1)=0.0;
for i=2:nx-1;
retval(i)=(y(i+1)+y(i-1)-2.0*y(i))/(dx^2);
end
retval(nx)=0.0;
return;
end
|
clear all
close all
clc
%Comments:
% 1. We should take care of the fact that we don't know when the TX
% will transmitt, we assume that the first sample of rx_bb is correct
%% ----------------------Initialization------------------------------------
filter=load('filt.mat');
EbN0_db = 0:20; ... |
function threedpupilgraph(p, dodetrend)
% graphs pupil data as a surface
if nargin<2,dodetrend=0;end
figure('Name','3d Pupil Graphs');
subplot(1,2,1);
if dodetrend
surfl(p.NormedDetrendPupTrials);
else
surfl(p.NormedPupTrials);
end
shading interp; colormap copper; axis tight; xlabel('Time (s) ')... |
%% Test des 60 images
nbValid = 0;
for k=1:60
if k<10
numImg = strcat('00',int2str(k));
elseif k<31
numImg = strcat('0',int2str(k));
elseif k<40
numImg = strcat('00',int2str(k-30),'b');
else
numImg = strcat('0',int2str(k-30),'b');
end
valid = ChaineDeTraitement(... |
clear myExchange;
clear myFeedPublisher;
clear myTradingRobot;
load('AKZA1.mat');
myExchange = CreateExchangeArb();
myFeedPublisher = FeedPublisher();
myExchange.RegisterAutoTrader(myFeedPublisher);
myFeedPublisher.StartAutoTrader(myExchange);
myTradingRobot = TradingRobot();
myExchange.RegisterAutoTrader(myTrading... |
clc; close all;
load('Motor_initialization_data')
load('Closed_Loop_data.mat')
%% Quarc Post Processing Data: Closed Loop
r = Reference; %Input Response
pos = Theta; %Output Response [rad/s]
%% Time Response of System
figure()
subplot(2,1,1)
plot(Time, r)
xlabel('Time [s]')
ylabel('... |
clc;
%% Declaração/Inicialização de variáveis
X = input('Digite o vetor de pontos x: ');
Y = input('Digite o vetor de pontos y: ');
n = length(X);
gr = n-1;
Li = '';
pn = '';
num = '';
dem = 1;
%% Primeira amostra
plot(X, Y,'*r');
hold on
%% Cálculo de Li
for i=1:n
for j=1:n
if i ~= ... |
function [accessory_area, accessory_im, movement_info] = rand_movement(accessory_im, accessory_area, hor_range, vert_range, rot_range)
% Randomly move the accessory horizontaly, vertically, or rotate it
% within the ranges: [-hor_range,hor_range], [-vert_range,vert_range],
% and [-rot_range,rot_range]
movement_inf... |
% This script creates a trajectory in mm following a sphere and inputs it
% into a .mat file.
clear all
%**************************************************************************
%*** Parameters
dt = 0.002;
% Time and number of spirals in the first part
T1 = 3;
Revs1 = 10;
t1 = dt : dt : T1;
a1 = (3*pi*Revs1)/T1;
b... |
%% CSR Prototype - Condensed Sparse Matrix code template
%% 2015 - LMST Project
%% Aryan Eftekhari
classdef csr < handle
properties (Access = 'public')
rows; % C++ -> int rows
cols; % C++ -> int cols
val; % C++ -> std::vector<double const> val
col_in... |
function newring = atrotatelattice(ring,index)
%atrotatelattice gives a new lattice starting with index as the first
%element. We assume that the lattice is a collumn cell array
if index>length(ring);
error('index too big!');
end
if index==1
newring=ring;
else
newring=[ring(index:end);ring(1:index-1)];
end |
addpath('Functions')
%% Set initial info and function
initSeed = 1;
batchSize = 2000;
confLevel = 0.95;
% Time and area
XInt = [0,2*pi];
T = 1; TInt = [0,T];
% Numerical precision, number of points
refN = 2^17;
refh = (TInt(2)-TInt(1))/refN;
N = 2.^(5:13); % Time
h = (TInt(2)-TInt(1))./N;
numN = length(N);
M = 2^13; %... |
% QAM_mapper.m
function [symbol] = QAM_mapper(bitseq,Nb)
if Nb==2, symbol=QAM4_mapper(bitseq);
elseif Nb==4, symbol=QAM16_mapper(bitseq);
elseif Nb==6, symbol=QAM64_mapper(bitseq);
else disp('When you need M-QAM modulation, you need to provide log2(M) as the 2nd argument');
end
function [symbol] = QAM4_mapper(bitseq)
... |
%Crop the 20 patches in oecf chart
%
% Input
% *img: The oecf chart picture, can be the file path or loaded image(in RAM)
%
% Output
% *grid: The 24 * 4 map of all coord of the cropped regions
function grid=oecf_align(img)
CROP_MARGIN = 10;
if 2==size(size(img),2)
%Looks like a file name
... |
function ErrorMetrics(file1, file2)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
input_unit = fopen (file1, 'r' );
a= -1;
pointNum=-7 ;
coordinates= 0 ;
while ( coordinates >a)
coordinates = fgetl ( input_unit );
pointNum= pointNum +1 ;
end
xyz_data_read(file1, pointNum)
mes... |
%% update_supporting_structs.m
% Updates the supporting structures
%% Input:
% %output_array: The newly updated output_array
% %move: the move that resulted in the update
% %num_machines: the number of machines
% %fix_moved: Indicates whether the 4th col of output_array exists and
% whether moved programs... |
function [psd_tf,coh_tf,pdc_tf] = hmmtimefreq(spectra,Gamma,center)
% obtains a time-frequency representation of the power spectra density,
% coherence and PDC - the estimations of which (contained in fit) had to be
% estimated with hmmspectramar or hmmspectramt. If coherence or PDC are
% missing from the estimation, t... |
function [Lh,fh] = a04ex02getPDE(xh,f,consts,flag)
% Assignment 4, Programming exercise 2, Two point BVP
% Compute the operator Lh according to the flag
% the right-hand side vector fh
% on the inner grid xh
% corresponding to the problem
% -a*u''+b*u'+c*u = f
% u(o) = alpha, u(1) = beta
% where the model parame... |
function simulate
% Daniel S. Standage
% May 1, 2012
% Adapted from code originally obtained from Benjamin Seibold at
% http://math.mit.edu/cse/codes/mit18086_fd_heateqn.m
% Parameters for Hes1 system
mu = 3e-2; % Degredation rate
Df = 7.5e-10; % Diffusion coefficient
alpha_p = 1.... |
clear all
close all
clc
N = 100;
writer = VideoWriter('simulation.avi');
writer.FrameRate = 10;
i = 0;
fname = 'frame0';
scatter([], [])
set(gca, 'nextplot', 'replacechildren')
axis tight manual
open(writer);
while isfile(fname)
fdata = readmatrix(fname);
scatter(fdata(:,1), fdata(:,2));
frame = getframe(gcf... |
function M_sort_r_finalcut = onesize(M_sort_cut,check) %,pixeldistance,pixelvalues,ROIsize)
%dic_onesize adds specified radius (same for all particles) to an added
%column in M_sort_r.
global FolderName FileNameImage ImageNumber
clc;
close all;
% clear all;
fprintf('*************ADDING COLUMN OF KNOWN RADII TO M_SOR... |
close all;
clear variables;
subjectName = 'BRIAN_TA';
folder = fullfile(pwd, 'Plots', subjectName);
mkdir(folder);
info_csv = fullfile(pwd, 'protocol_info.csv');
protocolInfo = table2struct(readtable(info_csv));
oneParamTemplate = fullfile(pwd, 'one_param_struct.csv');
twoParamTemplate = fullfile(pwd, 'two_param_... |
% This function acts as a matrix product between a hadamard matrix and a
% inverse daubechies wavelet matrix, both in two dimensions. the resulting
% matrix is subsampled by the linear indices specified by `idx`.
%
% INPUT:
% x - Column vector. The vector will be reshaped to the two dimensional
% matrix X.
%... |
function [layers] = createNNlayers(labels)
% Create Network that we'll use train, from get set, and change so that the
% output is correct.
%% Choose Network Architecture
choice = questdlgtimeout(60,'Which net do you want to use?',...
'Transfer Network', 'alexnet', 'vgg16', 'vgg19', 'alexnet');
switch choice
c... |
function x = TriInt0(j1,a)
%Returns the integral of \|x\|^{2a} over the triangle {(x,y) : 0 < x < 0.5, 0 < y < x}
%See Appendix B for details
x=sqrt(2)*j1^(2*a+2)*hypergeom([0.5,1.5+a],1.5,0.5)/(4*(a+1));
end
|
function [ y, lb, ub,x, M ] = Booth_2d()
addpath('help_functions')
addpath('TPLHD')
n = 2;
lb = [-10;-10]; % lower bound
ub = [10;10];
% Initial samples
x = scaled_TPLHD(6,lb,ub);
M = @(xx) Booth_function(xx);
y = zeros(size(x,1),1);
for i=1:size(x,1)
y(i,1) = M(x(i,:));
end
end
function y = Bo... |
function [ fullPathFileNameWithoutExt baseNameFile path ext ] = trimext( fullPathToFile )
[path, baseNameFile, ext ] = fileparts(fullPathToFile) ;
if isempty( path ); prefix = '';
else prefix = [ path filesep ]; end
fullPathFileNameWithoutExt = [ prefix baseNameFile ];
|
oldpath = path;
path(oldpath,fullfile(pwd,'..\\'));
conn = dbconn();
query = 'delete from users where id = 12345';
execute(conn,query);
%% Test valid value
query = 'insert into users set id = 12345 , email = ''test_user_12345''';
execute(conn,query);
query = 'insert into tasks set id=12345, owner = 12345 , type = ''pre... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.