text stringlengths 8 6.12M |
|---|
%% Flood-Fill demo
% Demonstrates how to use cv.floodFill
%
%% Input image and mask
% some color image with defined connected components (as squares)
img = zeros([256,256,3],'uint8');
img(:,:,1) = 255;
img = cv.rectangle(img, [0 0], [255 255], 'Thickness',15);
img = cv.rectangle(img, [30 40 100 100], 'Thickness','Fill... |
function plot2dsamples(Xsetosa, Xversicolor, Xvirginica, pairs, labels)
for i = 1:6
idx1 = pairs(i, 1);idx2 = pairs(i, 2);
subplot(2,3,i);
plot([Xsetosa(:,idx1) Xversicolor(:,idx1) Xvirginica(:,idx1)],...
[Xsetosa(:,idx2) Xversicolor(:,idx2) Xvirginica(:,idx2)], '.')
xlabel(labels{idx1}... |
function eyepos = getEyePosition(PDS, kTrial)
if PDS.initialParametersMerged.eyelink.use == 1
cm = PDS.initialParametersMerged.eyelink.calibration_matrix;
eyeIdx = PDS.initialParametersMerged.eyelink.eyeIdx;
useRaw = PDS.initialParametersMerged.eyelink.useRawData;
% --- Get eye position from ... |
%read in images
%I and I2 were taken by me
I = imread("myimg1.jpg");
I2 = imread("myimg2.jpg");
I3 = imread("snow1.jpg");
I4 = imread("venice1.jpg");
%convert to greyscale using function
gs = rgb2gray(I);
gs2 = rgb2gray(I2);
gs3 = rgb2gray(I3);
gs4 = rgb2gray(I4);
%show image before and after converting to greyscale
... |
%BER of BKSK Signalling in Rayleigh fading channel
clear all;
SNR_dB = 6 ;
Nt=10^5;
count=0;
% possible codewords
d = (0:15)';
b = de2bi(d,'left-msb');
G = [1 0 0 0 1 1 1;0 1 0 0 1 1 0;0 0 1 0 1 0 1;0 0 0 1 0 1 1];
u = mod( b * G,2);
up = (-1).^ mod( b * G,2);
dmin_idx=0;
f_b = zeros(1,4);
dmin_b= zeros(1... |
function [D time_bins ALL_DIFFS total_observations] = get_inter_event_time_distribution(DATA,day_indices)
secs_in_day = 3600*24;
time_bins = 0:60:secs_in_day;
total_days = length(day_indices);
total_observations = 0;
D = zeros(length(time_bins),1);
ALL_DIFFS = [];
max_diff = 0;
for day=1:total_days
DATA_WOR... |
clear;
clc;
Parameter;
possi_list = [];
possi_tmp = 0;
whole_test_num = 1e8;
result = {};
for i = 1:whole_test_num
i
[r_num,rr_num,v_num] = threed_sample(final_table);
range = range_label(r_num);
range_rate = range_rate_label(rr_num);
v = v_label(v_num);
[~,a_list] = value_function3(range,range_... |
% =========================================================================
% Coupled Dictionary Learning for Multi-contrast MRI Reconstruction
% =========================================================================
%
%This software is to perform Coupled Dictionary Learning based Multi-contrast MRI Reconstructi... |
clc;close all; clear all;
im = iread('vision_prac.jpg');
imr = im(:,:,1);
img = im(:,:,2);
imb = im(:,:,3);
imR = 1-(imr./(img+imb+imr));
imG = 1-(img./(img+imb+imr));
imB = 1-(imb./(img+imb+imr));
imB = imR - imB;
imBlue =(imb./(img-imb+imr));
imBlue = imBlue./((1-imG)+(1-imR));
imGreen = imR-imBlue;
imRed = imG-imBl... |
clear all;
rng(1);
% Load the dataset
D = load('handwriting.mat');
%displayData(D.X(490:510,:));
X = D.X;
% Number of number of patterns, attributes and classes
[N, K] = size(X);
J = 10;
% Number of hidden nodes
S = optimizableVariable('s', [10^(-3),10^(3)], 'Type', 'real'); %%Nuestra Sigma
% Regularizatio... |
clc
clear;
close all;
%Set RUN_SIM to true to run the flight simulation
RUN_SIM = true;
MOVIE = false;
%% initialize everything
mySim = initialize_simulation();
drone = initialize_drone();
drone.data.x = zeros(8,mySim.idx_end);
drone.data.u = zeros(4,mySim.idx_end);
Flight_Plan = initialize_flight_plan();
[map,NW... |
function [err, uex] = a05ex04error(eps,xh,uh)
% Assignment 5, Programming exercise 4b,
% Returns the error err between uh and the restricted exact solution uex
% exact solution
u = @(x) x - (exp(-(1-x)/eps) - exp(-1/eps))./(1-exp(-1/eps));
uex = u(xh);
err = norm(uex - uh, Inf);
|
function s = getSharpness(b_scan)
%returns the mean vertical gradient magnitude from a Sobel filter
% [~,~,Gv] = edge(a_scan, 'sobel', 0, 'vertical');
% s = max(abs(Gv))/mean(abs(Gv));
s = -sum(sum(b_scan.^4));
end
% Other metrics that haven't worked out:
% s = iqr(abs(Gv));
% s = mean(abs(Gv)); |
function x = NR(f_func,J_func,x0,accuracy,max_itr)
x=x0;
if nargin<4; accuracy=1e-6; end
if nargin<5; max_itr=30; end
for iter=1:max_itr % Newton loop
J=J_func(x);
f=f_func(x);
dx=-J\f;
nf(iter)=norm(f); ndx(iter)=norm(dx); % save norms for debugging
if nf(iter) < accuracy && ndx(iter) < ac... |
function [ xhat] = Gao_RobustCSS(y1,A1,L,sigma,eta)
%% The function is used to recovery original signal from compressed measurements used for TSP paper...
%% ``Wideband Spectrum Sensing on Real-time Signals at Sub-Nyquist Sampling Rates in Single and Cooperative Multiple Nodes''
%%Inputs
%% y1 compressed measurements... |
%%%%基于16*32基矩阵生成Z=360,180,90,45都不含4,6环的矩阵
clc;
clear all;
close all;
%%%%%新生成的码字基矩阵 0对应矩阵中的-1,1对应非零值
QC_H_ori = dlmread('hb_9x27A1.txt');
[M, N] = size(QC_H_ori);
z_max_s = 512;
K = N - M;
CodeRate = K / N;
xpos_s = ceil(M / 2);
%矩阵中0替换为-1,不需要则屏蔽掉此段程序
for ii=1:1:M
for jj=1:1:N
if (QC_H_ori(ii,jj)==0)
... |
function sim_write_bh(filename,simimage,x_size,y_size,timegates)
% Copyright (C) 2013 Imperial College London.
% All rights reserved.
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Softwa... |
%% GMAT Performance Analysis
% Script to generate comparison plots of GMAT orbit with
% - Conic Sections 2-body problem
% - Keplarian 2Body problem with crude numerical orbital perturbations
export = false; % export figures as PDF
%% extract GMAT Data
% Extract data from GMAT Ephemeris
gmatEphem = fopen('Leader.e... |
function [testClassPredicted,sparsity]=nnlsClassifier(trainSet,trainClass,testSet,testClass,option)
% NNLS Classifier: testSet=trainSet*Y, s.t. Y>=0.
% Usage:
% [testClassPredicted,sparsity]=nnlsClassifier(trainSet,trainClass,[],testClass)
% [testClassPredicted,sparsity]=nnlsClassifier(trainSet,trainClass,testSet,t... |
function polygonsResampleByLength(frame, varargin)
%POLYGONSCONCATENATE Resample each polygon with a specific sampling length
%
% For each polygon, resample with the same number of vertices.
%
% Inputs :
% - obj : handle of the MainFrame
% - varargin : contains the parameters if the function is called f... |
function aaa = drawmolecule(gca,Rnuc)
[num_Nuc,~]=size(Rnuc);
[xx,yy,zz]=sphere(20);% 20是sphere的 马赛克 度
xx0=0.2*xx;
yy0=0.2*yy;
zz0=0.2*zz;
for i =1:num_Nuc
xx=xx0+Rnuc(i,1);
yy=yy0+Rnuc(i,2);
zz=zz0+Rnuc(i,3);
aaa(i)=surf(yy,xx,zz,'parent',gca);
end
end |
% Jiaxi He
% Swinburne University of Technology
% jiaxihe@swin.edu.au
function d = Dy3(u)
[rows,cols,dims] = size(u);
d = zeros(rows,cols,dims);
d(2:rows,:,:) = u(2:rows,:,:)-u(1:rows-1,:,:);
d(1,:,:) = u(1,:,:)-u(rows,:,:);
return |
function op_plot2axis(method1,method2,xx,data1,data2)
% 两个坐标轴画图,第一个画图方法用method1,第二个画图方法用method2
ax1 = axes('xlim',[min(xx) max(xx)]);hold on
feval(method1,xx,data1,.9,'facecolor','k')
set(ax1,'ylim',[0,15],'ytick',[0 3 6 9 12 15],'linewidth',2,'Fontsize',18,'tickdir','out')
xlabel('EPM score')
set(get(ax1,'YLabel'),'St... |
% WTSDSEGMENT Semiautomatic segmentation of breast lesions using watershed transform.
% S = WTSDSEGMENT(I) computes the lesion segmentation using the watershed transform,
% where I is the breast ultrasound image. The constraint Gaussian variances are
% introduced manually by marking four points to indicate the ... |
function stringVal = strpad(stringVal,totalChars,charPosition,fillChar)
if nargin<4
fillChar = '0';
if nargin<3
charPosition='pre';
if nargin<2
warning('You must pass the required totalChars');
end
end
end
if length(stringVal)>=totalChars
warning('The str... |
function Ipv = Photovoltaic(Vpv,Irr,TaC)
%% REFERENCE PAPER:
% Francisco M. González-Longatt, "Model of Photovoltaic Module in
% MatlabTM", II CIBELEC 2005.
%% Solar panel: Suntech STP-280S
% photovoltaic.m function calculates solar array current with a
% given voltage, irradiance and temperature
% Ipv = photovoltai... |
close all
Sig1file = 'Sig1.wav';
Sig2file = 'Sig2.wav';
Sig3file = 'Sig3.wav';
Sig4file = 'Sig4.wav';
[Sig, fs] = audioread(Sig1file);
Fourier = (fft(Sig));
T = linspace(0,length(Sig)/fs,length(Sig));
freq = linspace(0,fs,length(Fourier));
f1 = 100;
figure()
plot(T,Sig)
xlim([0 1/f1])
figure()
plot(... |
function b = padImage( a , vpad , hpad )
if ( nargin == 2 )
hpad = vpad;
end
u = repmat( a(1,:) , [ vpad 1 ] );
b = repmat( a(end,:) , [ vpad 1 ] );
l = repmat( a(:,1) , [ 1 hpad ] );
r = repmat( a(:,end) , [ 1 hpad ] );
ul = repmat( a(1,1) , [ vpad hpad ] );
ur = repmat( a(1,end) , [ vpad hpad ] );
bl = repmat( ... |
function loadMacro(obj)
%LOADMACRO Load a log file and uses it as a macro to automatically execute processes
%
% Inputs :
% - obj : handle of the MainFrame
% Outputs : none
% open the file selection prompt and let the user select the file he wants
% to use as a macro
[fileName, dname] = uigetfile('*.txt');
... |
% Face Recognition System
% Version : 1.0
% Date : 28.5.2012
% Author : Omid Sakhi
% Website : http://www.facerecognitioncode.com
% Please visit the website for complete program and guide
% Original Paper :
% H. Miar-Naimi and P. Davari A New Fast and Efficient HMM-Based
% Face Recognition System Using ... |
function [ graph ] = VG( ts )
global n
n=length(ts);
graph=zeros(n,n);
for i=1:n-1
graph(i,i+1)=1;
end
m=max(ts);
index=find(ts(1,:)==m);
lindex=length(index);
for i=1:n-2 %参考点
km=ts(i+1)-ts(i);%参考点与右边第一个邻居的斜率
if i<index(1) %如果参考点在右边最大值的左侧
for j=i+2:index(1)%参考点右边第二个点到最大值之间的当前点
... |
function [c,ceq,dc,dceq] = Cfun(Z,ac,N,D)
VR = Z(end-1);
tfin = Z(end);
chi0 = Z(end-2);
t = ((tfin/N)*(1:N))';
X = zeros(N,8);
for i = 1:8
X(:,i) = Z((i-1)*N+1:i*N);
end
F = zeros(N,6);
for j = 1:N
Xval = X(j,:) + [0,chi0*t(j),zeros(1,6)];
F(j,:) =... |
classdef dynamixelGripper < handle
properties (SetAccess = public)
% These properties comply with Dynamixel Protocol 2.0
% Dynamixel Gripper RH-P12-RN
% Control table address
ADDR_TORQUE_ENABLE_GRIPPER = 562;
ADDR_GOAL_POSITION_GRIPPER = 596; ... |
function [ fM, fP ] = matEvaluateSurfValue( obj, fphys )
[ fM, fP ] = mxEvaluateSurfValue( obj.FToM, obj.FToE, obj.FToN1, obj.FToN2, fphys );
end
|
function firstlevel_canonical_pmod
% specify firstlevel pmod with parametrically modulated stick functions
host = wave_ghost2('fmri');
base_dir = fullfile(host.dir, 'fmri');
n_proc = host.n_proc;
go_back = pwd; % go back to the directory we started in
% Subs
all_subs = [5:12 14:53];
% all_subs = ... |
% This program displays three options for obtaining the transformer
% performance characteristics/
%
% Copyright (C) 1998 by H. Saadat.
clc
global par1
par1 = -1;
menu1 =[
' TRANSFORMER ANALYSIS '
' '
' Type of parameters for... |
function [neg_log_P, neg_log_samples, stats, vlogL] = logCL_SW(preCalc, full_params, config, variables, ivariables)
global MLParamsStruct;
% To prevent zero probability of observing a SNP (which would ruin the
% maximization) we put a lower bound on the relative predicted diversity to
% be 0.1% of the maximal value ... |
clear all;
% ---- Initialisation des constantes
delta_t = 0.015;
T = 2*pi;
N_T = floor(T/delta_t);
% ---- Lecture du maillage et rajout volumes finis
mesh = lect_mesh('../Meshs/disq0');
mesh = raf_mesh(mesh);
mesh = face_number(mesh);
% Attention il y a une condition de stabilite a respecter. Si on divise le
% ... |
%% INIT
instrreset;
clc;
close all;
%% Start serial
teensy = init_serial();
%% Reset teensy and begin
reset_teensy(teensy);
pause(0.1);
begin_teensy(teensy);
pause(0.1);
start_encoder(teensy);
pause(0.01);
%% Send initial 180 command
send_vesc_command(teensy,180.0, 0.1, 0.001);
%% Clear serial
% discard (by readi... |
clear all
close all
Ts = 0.05;
A = [1 Ts; 0 1];
B = [Ts^2; Ts];
H = [1.079 0.076; 0.076 1.073];
F = [1.109 1.036; 1.573 1.517];
G = [1 0; 0 1; -1 0; 0 -1; 0.05 0; 0.05 0.05; -0.05 0; -0.05 -0.05];
W = [1 1 1 1 0.5 0.5 0.5 0.5]';
S = [1 0.9 -1 -0.9 0.1 0.1 -0.1 -0.1;
1.4 1.3 -1.4 -1.3 -0.9 -0.9 0.9... |
function [i, y_q, y_index, coef]= SDPC_Encode_ch8(y,q,DC_Measure, num_rows,block_size)
i = zeros(size(y));
y_q = zeros(size(y));
num_col = num_rows / block_size; %每列有多少块。
y_index = zeros(size(y,2),1);%标志位
L_norm = 1; % 1 or 2
coef = zeros(size(y,2),1);
for j = 1 : size(y, 2)
index_arr = satisfy(j, num_col);%对于... |
classdef (Abstract) SolverApplication < handle
% SolverApplication defines an abstract interface class for NLP solvers
%
%
% @author Ayonga Hereid @date 2016-10-21
%
% Copyright (c) 2016, AMBER Lab
% All right reserved.
%
% Redistribution and use in source and binary forms, with or... |
function segment=segmentFind(inputVec, opt, showPlot)
% segmentFind: find positive segment in a vector
% Usage:
% segment=segmentFind(inputVec)
%
% Example:
% x=randsrc(1, 20);
% x(x==-1)=0;
% segment=segmentFind(x, [], 1);
% fprintf('x = %s\n', mat2str(x));
% for i=1:length(segment)
% fprintf('Segment %d: %d~%... |
classdef intan_RHD2132 < hardware.headstage.headstage
properties
end
methods
function p = intan_RHD2132(varargin)
p@hardware.headstage.headstage(varargin{:}); % base class constructor
p.name = 'intan_RHD2132';
p.manufacturer = 'int... |
function [] = V_E()
clear;
close all;
gap=1/30;%the gap between potentials
W=1;
L=2;
%the ratio between the length and width
co=1;
ci=1e-2;
%set the conductivities
%normalize the conductivities so that inceasing mesh density will not
%chenge the total resistance over the rectangualar plate
c1=co.*gap;
c2=ci.*gap;
%b... |
function [optTheta] = runOptimizer2Mod(func, theta, data1, data2, labels, op)
% This uses Nesterov Accelerated Gradient
learningRate = op.learningRate;
muMax = op.momentum;
iDecayLR = op.iDecayLR;
iDecayMomentumAtEnd = op.iDecayMomentumAtEnd;
iIncreaseMomentumWithTime = op.iIncreaseMomentumWithTime;
iUseValSet =... |
A = -0.5;
t0 = -2;
m = 5;
x = -m:0.1:m;
y = zeros(1, length(x));
for i=1:length(x)
if (x(i) >= (0 + t0))
y(i) = A.^(x(i)-t0);
end
end
stem(x,y); |
function [] = plotIVcurve(pulseV,DifCurrents,monitor)
% This function gives back the IV curve. The inputs it need are the
% responses, the pulseStart, the pulseEnd, the correctedPulses, and the
% monitor. If monitor is set to 1, it is lab, otherwise it is laptop
a=1
if monitor == 1
figure, set(gcf,'units','points','po... |
function cleaned= preprocessing(IMG, treshold, structel)
binar=im2bw(IMG, treshold);
opening=imopen(binar,structel);
opening=opening+0;
cleaned=filterimagedots(IMG,opening);
imshow(cleaned,[min(min(cleaned)) max(max(cleaned))])
end
|
function response = getResponses(x,pmax,dt)
% returns mean responses as:
% response.pos
% response.vel
% response.acc
% response.time
x(isnan(x)) = pmax; % eliminate nans
response.pos = mean(x)';
%dAll.posResponse_large(subj,:,c) = nanmean([-d{subj}.Bi{c}{1}.CrX_post ; d{subj}.Bi{c}{5}.CrX_post]);
response.tim... |
% GETERROR return the string containing the last error
%
% err = getError()
%
% Use the function to get the last error message. The error message is not
% cleared after the call to the function, so it can be used several times
% in your code.
%
% Example:
%
% clear all; % clear all objects including recorded samples
%... |
% Md = [R S G]'
clc
clear all
close all
Time = 48;
gamma = 1.1;
maxscore = 100;
maxrep = 20;
maxrom = 180;
Md = zeros(3,Time);
Md(:,1) = [maxrep maxscore maxrom]';
Mt = zeros(3,Time);
Mt1 = zeros(3,Time);
start = [10 60 150]';
Mt(:,1) = start;
epsil = zeros(3,1);
epsilon = zeros(3,1);
fs = 15;LW = 2;
for i=2:Time
... |
function featTbl = getTopFeats(Mdl)
varNames = {'Features', 'Rank', 'Importance', 'Label' };
featTbl=table({},[], [], {}, 'VariableNames', varNames);
labelNames= fieldnames(Mdl);
for i=1:numel(labelNames)
if isfield(Mdl.(labelNames{i}), 'topkFeatures')
tmpTbl = Mdl.(labelNames{i}).topkFeatures(:, ... |
function [S1plot, T1plot, S2plot, T2plot] = HMplotBM
% create brownian motion with drift = 0, volatility 1
obj = bm(0,1);
dt = 0.01/1000;
% simulate a sample path for 1000 periods, with dt
[S1, T1] = simulate(obj, 1000, 'DeltaTime', dt);
[S2, T2] = simulate(obj, 1000, 'DeltaTime', dt);
% transform p... |
classdef times_ < time_unit
% times
properties(Access=private)
t
end
methods(Access=public)
% constructor
function obj=times_(t,unit)
if(nargin<1); obj.t=[]; obj.unit='sec'; else obj.t=t; obj.unit=unit; end
end
% Time in years (w... |
clc;
hold off;
p01=[0;0];p12=[1;0];p23=[1;0];p34=[1;0];p45=[1;0];p5T=[1;0];
P=[p01 p12 p23 p34 p45 p5T];
kcross=[0 -1;1 0];
q=rand(5,1)*2*pi;
figure(5);
plotplanararm(q,P,2,'k');
hold on;
R01=rotplane(q(1));
R12=rotplane(q(2));
R23=rotplane(q(3));
R34=rotplane(q(4));
R45=rotplane(q(5));
... |
function params=randParams(numStrains, T, d, S0, meanCost, cstar, Vstar, Kstar, seg_rate, conj_rate, epsilon, sigma_cost, sigma_growth)
%Growth parameters
bp_cs=cstar.*abs(1+normrnd(0,sigma_growth(1), [1, numStrains]));
bp_Vs=Vstar.*abs(1+normrnd(0,sigma_growth(2), [1, numStrains]));
bp_Ks=Kstar.*ab... |
function [Positions] = FindNoteHeads(BW, Gklaus, str)
%This function find the positions of the note heads.
imshow(BW);
%Removes everyting to the left of the Gklaus and 20 pixels to the
%right.
Limit = round(Gklaus(1,1)+20);
BW(:,1:Limit) =0;
NoteHeads = BW;
%Remove horizontal and v... |
function [ param, mu_q, sigma_q, nelbo ] = varLinearGaussStochastic( y, param, rbconf )
%VARLINEARGAUSSSTOCHASTIC Stochastic Optimization for Variational Linear
%Model
fprintf('using alpha=%f, nbatch=%d', rbconf.alpha, rbconf.nbatch);
%% Reads off parameters of prior and likelihood
nu_p = param.prior{1};
Lambda_... |
function u = irpCentralMoments(m)
% u = irpCentralMoments(m)
% Berechnet die Zentralmomente auf Basis der Momente.
%
% Parameter:
% 'm' 10d Zeilenvektor mit Momenten
%
% Rückgabewerte:
% 'u' 10d Zeilenvektor mit Zentralmomenten
% Initialisiere 'u'.
u = zeros(1, 10);
% Berechne Mittelwe... |
function [verified_lower, verified_upper, stats] = vsdp_wrapper(A, b, c, K, solveropt, verbose, tolerance, use_xu)
% input: problem instance, solver+optimizer, options
% call mysdps, vsdpup, vsdplow
% measure time and iterations at each round
% add custom options (verbose, optimizer, tolerance, etc.)
% output: upper an... |
function createNrmseFigure(yvector1)
%CREATEFIGURE(yvector1)
% YVECTOR1: bar yvector
% 由 MATLAB 于 13-Apr-2019 12:48:30 自动生成
% 创建 figure
figure('OuterPosition',...
[353 184.333333333333 574.666666666667 506.666666666667]);
% 创建 axes
axes1 = axes;
hold(axes1,'on');
% 创建 bar
bar(yvector1,...
'FaceColor',[0.... |
function [Qmod,Emod,Smod,Dmod]=PWBM(P,Ep,LAI,S0,a,b)
% This function is used to calculate the water balance components by PWBM
% The inputs:
% P: precipitation (mm)
% Ep: potential evapotranspiration (mm)
% LAI: Leaf Area Index
% S0: water storage at the beginning of period (mm; calculated by preheating the m... |
function [struct_1, struct_0] = superpixels_slic(img_sub)
[labels, numlabels] = slicmex(img_sub,1000,10);
components = regionprops(labels, img_sub, 'PixelIdxList','MeanIntensity','BoundingBox','PixelValues', 'WeightedCentroid');
struct_1 = [];
struct_0 = [];
index_1 = 1;
index_0 = 1;
... |
clear s
clear d
s = serial('COM5','BaudRate',9600);
d = serial ('COM4','BaudRate',9600);
fopen(s);
fopen(d);
%obstacles = obstacle();
obstacles = [103 74; 186 53; 253 131];
robots = [0,0;0,0];
[curr_x,curr_y]=check_1();
robots(1,1)=curr_x;
robots(1,2)=curr_y;
[curr_x,curr_y]=check_2();
robots(2,1) = curr_x;
robot... |
function localizationReceivePackets(s, packet)
%localizationReceivePackets(s, packet)
%
%This function recieves new packets from the motes we are trying to localize.
%And processes them
global LOCALIZATION
global TOF_CALIBRATION
global TOF_RANGING_CALIBRATION
global TOF_RANGING_RANGING
global TOF_RANGING_CHIRP_AM_HAN... |
% plot more stuff
for ind_plotCount = 1:ccostCount
h8(ind_plotCount) = figure;
ax(1) = subplot(3, 1, 1); hold on
plot(feature_full.t, q_opt_plot_merge);
plot(t_recon_plot_merge, q_recon_plot_merge, '.', 'LineWidth', 1);
title(['RMSE Mean: ' num2str(rmse_report.meanRMSE) ', STD: ' num2str(rmse_rep... |
%
%=====================================================================================
% Filename: XMIMO_CSI_read.m
%
% Description: load, differentiate, and convert the CSI data into imaginary and real signals.
% Version: 1.0
%
% Author: Shuai Wang
% Email : <shine.hitcs... |
%% This function just calls backwark a given number of times and accumulate
%% gradient in dPar
%function [dPar,dX,i]=neuralModelRunBackward(maxIt,x,dataset,p,delta,forwardState,sys,stopCoef)
function [dPar,dX,i]=neuralModelRunBackward(delta,forwardState,maxIt)
global dataSet dynamicSystem learning
xdim=dynami... |
function flag = isAllowedtoRecombine(RecombinationRate)
randomNumber = rand();
if randomNumber <= RecombinationRate
flag = 1;
else
flag = 0;
end
end |
function c = bshort2img(topLevelDir)
%
% NAME
%
% function bshort2img(topLevelDir)
%
% ARGUMENTS
%
% topLevelDir in (string) the "root" node from which
% to recursively find and
% convert any *.bshort files
%
% c out (int) number of bshort files converted.
% Zero if some error has occurred.
%
% DESCRIPTIO... |
function ptCloudScene = genDemoVid(openMVGPointsWorld,R_opt, Opt_C_RGB, RGB4Pts_subsampled, folder)
%% Assign TangoPose
for i = 1 : length(Opt_C_RGB)
TangoPosesWorld{i} = [R_opt{i} Opt_C_RGB(i,:)'];
end
TangoPointsWorld = openMVGPointsWorld;
imgFiles = dir([folder filesep '*.jpg']);
imgFiles ... |
function [meta] = PrepareMetadata(dataset,callbackresult)
%PREPAREMETADATA Prepare SpikeGLX metadata for exported dataset and its callbackresult
% Detailed explanation goes here
meta=[];
%% Prepare experimental metadata
exmeta = [];
if (~isempty(dataset) && isfield(dataset,'ex'))
exmeta = NeuroAnalysis.Base.Eval... |
function [shape, new_five_idx, not_use] = get_cut_bosphorus(ffp)
bnt_ffp = ffp;
lm3_ffp = [ffp(1:end-3) 'lm3'];
line_3 = line_read(lm3_ffp,3);
if ~strcmp(line_3{1}(1:2), '22')
shape = [];
new_five_idx = [];
not_use = true;
return;
end
not_use = false;
[data, ~, ~, ~, ~] = read_bntfile(bnt_ffp);
d... |
%Try to fit fourier series to motion
%Load data
specStruct.datasetName = 'healthy1';
specStruct.patient = [3];
specStruct.session = [1];
specStruct.exerciseAcceptPrefix = {'KEFO'};
specStruct.exerciseAcceptSuffix = {'SLO'}; % exercise suffix that you want. This will load only exercises that end with 'SLO'
specStruct.e... |
theta = 0:pi/30:2*pi;
r = 1*pi:pi/20:2*pi;
[R,T] = meshgrid(r,theta);
%%Create top and bottom halves
Z_top = 2*sin(R);
Z_bottom = -2*sin(R);
%%Convert to Cartesian coordinates and plot
[X,Y,Z] = pol2cart(T,R,Z_top);
surf(X,Y,Z, 'linewidth', 2);
hold on;
[X,Y,Z] = pol2cart(T,R,Z_bottom);
surf(X,Y,Z, 'linewidth', 2);
axi... |
a = 45;
b = 45;
c = 45;
Ma = [1 0 0; 0 cosd(a) -sind(a); 0 sind(a) cosd(a)];
Mb = [cosd(b) 0 sind(b); 0 1 0; -sind(b) 0 cosd(b)];
Mc = [cosd(c) -sind(c) 0; sind(c) cosd(c) 0; 0 0 1];
R = Ma * Mb * Mc;
T = [50; 50; 50];
Face1 = R * Face0 + repmat(T, 1, size(Face0, 2));
Face1_c = sum(Face1, 2) ./ size (Face1, 2)... |
t = [0, pi/6, pi/4, pi/3, pi/2];
plot(exp(1i*t), 'ro');
hold on;
plot(exp(-1i*t), 'bo');
hold on;
res = (exp(1i*t)+exp(-1i*t))/2;
plot(real(res), imag(res), 'go');
|
clc
close all
clear variables
% load('180202 simulation results.mat')
% load('180211 simulation results.mat')
% load('180219 simulation results.mat')
% load('180307 simulation results.mat')
% DCTheoreticalFormation.PlotCombined(seafloorDepthArray, ...
% minQuantityToFractur... |
delta_z=0.3;
delta_t=0.5*delta_z/299792458;
mu=4*pi()/10e7;
epsilon=1/299792458^2/mu;
E=zeros(1,101);
H=zeros(1,100);
E(31)=exp(-(((0-30)/15)^2));
n=270;
for i=1:n
for k=1:100
H(k)=H(k)-delta_t/mu/delta_z*(E(k+1)-E(k));
end
for k=2:100
E(k)=E(k)-delta_t/epsilon/delta_z*(H(k)-H(k-1));
... |
%%
% Input:
% -- dots - n-by-2 matrix of dots to clusterize
% -- means - k-by-2 matrix of centers of clusters
% -- dist - anonymous function handle @(x1, y1, x2, y2) of distance
% between 2 dots
%%
function [clusters, means] = clusterize(dots, initial_means, dist)
dots_cardinality = size(dots, 1);
means_car... |
function y = maxmax(x);
y = max(double(x(:)));
|
function map = pixsal( img , param )
summap = 0;
for ssig = param.surroundSig
ker = mygausskernel( ssig , 2 );
map_ = mynorm( (img - myconv2(myconv2(img,ker),ker')).^2 , param );
if ( param.useNormWeights )
wt_ = mypeakiness(map_);
else
wt_ = 1;
end
summap = summap + map_ * wt_;
end
map = mynorm(... |
function varargout = simdiffract_GUI(varargin)
% SIMDIFFRACT_GUI MATLAB code for simdiffract_GUI.fig
% SIMDIFFRACT_GUI, by itself, creates a new SIMDIFFRACT_GUI or raises the existing
% singleton*.
%
% H = SIMDIFFRACT_GUI returns the handle to a new SIMDIFFRACT_GUI or the handle to
% the existing si... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 本函数用于生成策略下拉菜单popupmenu_Input的字符串
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function output = readstrategyname(strategyexample)
output = strategyexample{1,1};
for index = 1:size(strategyexample,1)-1
outpu... |
classdef APF2nd < handle
% 2nd-order APF for phaser
% Phase is changing with LFO, a0 fixed at 1
properties
b0; b1=1; b2=1; a0=1; a1=1; a2;
x1 = 0; x2 = 0;
y1 = 0; y2 = 0;
rate; depth;
angle = 0;
Fs = 48000; Ts;
end
methods
function o = APF2nd(F... |
close all; clear;
% Y = importdata('cen2cen_1.dat');
X = importdata('old_fainthful_geyser_data.txt');
Y = X(:,2:3);
m = size(Y,1);
dim = size(Y,2);
k = 2; % making assumption that there are two components of the distribution
%% Initialization
% Randomly choosing k points from the sample as the initial mu
% mu = Y(ra... |
function [ output ] = cic( input )
H = dsp.CICDecimator('DecimationFactor',256, ...
'DifferentialDelay',1, ...
'NumSections',6, ...
'FixedPointDataType','Specify word lengths', ...
'SectionWordLengths',[55 55 55 55 55 55 55 55 ... |
A = imread('13A = imread('19_30.png');
A2 = imread('20_30.png');
Start1= rgb2gray(A);
Start2= rgb2gray(A2);
B = imabsdiff(A,A2)
Im=B;
rmat=Im(:,:,1);
gmat=Im(:,:,2);
bmat=Im(:,:,3);
levellr = 0.3;
levellg = 0.3
levellb = 0.3;
i1 = im2bw(rmat,levellr);
i2 = im2bw(gmat,levellg);
i3 = im2bw(bmat,levellb);
Isum = (i... |
classdef iq_ustc_ad < qes.measurement.iq
% data(m): IQ mean of demod frequency freq(m)
% extradata(num_demod_freq,n), n: num stats
% extradata(m,k), IQ of kth shot of demod frequency freq(m)
% Copyright 2016 Yulin Wu, Institute of Physics, Chinese Academy of Sciences
% mail4ywu@gmail.com/mail4ywu@icloud.c... |
%initialize some variables here
clear all;
xdim = 16;
ydim = 16;
V_now = 5*ones(4*xdim, 4*ydim);
V_prev = 5*ones(4*xdim, 4*ydim);
%iterate as long as the change in values obtained
%in negligible. In this case, max value change is 0.001
capx1 = 3*xdim/2;
capx2 = 5*xdim/2;
capy1 = ydim;
capy2 = 3*ydim;
... |
function nii_thresh_hi (P, Thresh);
%Clip image intensity so no voxels brighter than Thresh
% Example - user prompted for threshold
% nii_thresh_hi('C:\dir\img.nii');
% Example - all values greater than 0.5 are set to 0.5
% nii_thresh_hi('C:\dir\img.nii', 0.5);
if nargin <1 %no files
P = spm_select(inf,... |
function [centroids, idx] = kmeans(X, K, initg)
% This function runs the K-Means algorithm on data matrix X, where each
% row of x is a single example. Initg is used as the initial centroids.
% Check initg, if not set then we randomly init centroids
if ~exist('initg', 'var')
initg = randomInitCentroids(X, K);
end... |
function [heights] = peakmatrix(g1, y1, peak_limits);
% K H Richardson 28-07-21 Queen Mary University London
data1 = [g1(:) y1(:)];
% find the g value closest to the feature of interest
gvalues=[];
for i=peak_limits
[val,idx]=min(abs(g1-i));
closest=g1(idx);
index = find(g1==closest);
Y_po... |
% SIMUL_PARAM
%
% Sluzi na zadanie parametrov simulacie pre testovanie kvality navrhnuteho
% regulatora
%
% Spusta - TESTSIM
% Moznost spustit - ZISKAT_GS
% Copyright is with the following author(s):
%
% (c) 2012 Juraj Oravec, Slovak University of Technology in Bratislava,
% juraj.oravec@stuba.sk
% (c) 2012 Mo... |
function model = learnRF(graph,ensemble_size)
prob_t_given_A_p = cell(ensemble_size,1);
worker_abilities = cell(ensemble_size,1);
t = cell(ensemble_size,1);
[num_tasks,num_workers] = size(graph);
for T=1:ensemble_size
[A,t{T},p] = createGraph(num_workers,num_tasks,'method','custom','graph',graph);
prob_t_given_... |
function [ result ] = eligible( v, q )
%ELIGIBLE Summary of this function goes here
% Detailed explanation goes here
result = true;
if (v + q) / 2 < 92 || v <= 88 || q <= 88
result = false;
end
end
|
function [ predict, mse ] = kernel_ridge_predict( X, alphas, Xt, yt, kern )
%KERNEL_RIDGE_PREDICT(X, y, xt, yt, K)
% X ... training set matrix
% a ... estimated alpha
% xt ... samples for testing and
% yt ... their respective outcomes
% kern ... kernel function
%
%The function returns a vector of predicted
% outc... |
function [H,pts] = CS5320_Hough_analysis(imo)
% CS5320_Hough - Hough transform of image
% On input:
% imo (mxn array): gray-level image
% On output:
% H (rxt array): Hough accumulator array (r rho values; t theta
% values)
% r = [indexes to cover from [-ceil(image diagonal to
%... |
%Low Pass Filter
function f=Lti_lpf(A,t)
in=partialfouriersum(A,2*pi,t); %getting o/p
N=(length(A)-1)/2;
for x=1:length(A)
if x>=N-2 && x<=N+4
A(x)=A(x);
else
A(x)=0;
end
end
B=A;
y=partialfouriersum(B,2*pi,t);
subplot(2,1,1);
plot(t,y);
title('Output when LPF applied (a):');
subplot(2,1,2);
plot(t,in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.