text stringlengths 8 6.12M |
|---|
theta_old = rand(3,1)%random theta old
theta_new=rand(3,1)%random theta new
alpha=0.05;%step size
tolerance=0.01;%tolerance
maxIter=100000%max number of iteration
[theta_new res count] = LRTheta(X, Y, theta_old,tolerance,maxIter,alpha)
errors = abs(Y - res);%absolute difference between true labels and predicted ones
er... |
%load Cactus_96frames
load Cactus_96frames_cfp8
%a=a(:,:,1:48);
a=double(a);
a=shiftdim(a,2);
for x=1:1024
%x
for y=1:1024
% a(:,x,y)=dyadic_periodic_decom(a(:,x,y),5);
end
end
a=shiftdim(a,1);
%-----------------------------------------------------------------------
M=8;
N=size(a); w=floor(N(1:2)/M);... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%README:
%%This function creates multiple logical vectors which indicate the
%%position of the turbines, pv strings, transformer positions and reactor
%%positions. Moreover, it makes a vector indicating which variables are
%%discontinuous. Thi... |
classdef DCKumanoBasin < BCFormation
properties
MICP % Cell array of tables
colorOrder % array containing order index of loaded MICP tables
depthOrder % array containing depths in the order of loaded MICP tables
MICPInterp % Cell array of tables of MICP that will actually be used
... |
function [ddz, F] = dynamics_contact(z,dz,P)
x = z(1,:);
y = z(2,:);
q = z(3,:);
dx = dz(1,:);
dy = dz(2,:);
dq = dz(3,:);
% Figure out what the contact point is doing:
th = -q + P.slope;
[pc,dpc] = autoGen_kinematics_contact(x,dx,y,dy,q,dq,th,P.r);
% Desired contact point:
c = pc(1)*[1; P.slope]; %Project the cont... |
function DEV_ImageSelection()
% Rate all images in 3 person-specific craved categories + 1 not craved
% Create output file (csv + mat) including all ratings, tiers (0,1,2,3) and pic names
global wRect w XCENTER rects mids COLORS KEYS ImgRatings inputDir
testing = 0; % set this to testing=1 if you have no dropbox
stu... |
function y = iSTFT(X, ljanela, window, hop, nFFT)
% y = DGistft(X, ljanela, window, hop, nFFT)
% Calculates the inverse STFT of X where a (ljanela)-point FFT has been calculated
% with window of ljanela points and hop number of points.
%
% X = [B; B((end-1):-1:2,:)] where B is from specgram().
%
% David Gunawan 2004
... |
dir = '';
heart_scale_instreino=[];
heart_scale_labeltreino=[];
name = 'hist_gabor_curvo_TOTAL_cacheco2_meiopi_4.txt';
%name = 'hist_gabor_curvo_PCA4_0.2_Arface_100_14_8x8_5x16_30x30.txt_concat.libsvm';
[heart_scale_labeltreino, heart_scale_inst1] = libsvmread(name);
heart_scale_inst1 = full(heart_scale_ins... |
function alfa = alfaTVpvini(x,p)
% alfaTVpvini gets initial value for TV alpha parameter
%
% input arguments:
% x Observed image
% p For TV prior shoud be 2
%
% output arguments:
% alpha initial alpha value
[M N dims] = size(x);
p=p.*ones(M,N);
[Dhx, Dvx] = circ_gradient2(x);
... |
ptbCorgiData = uiGetPtbCorgiData();
%Set some figure options:
figurePosition = [0 0 1000 500];
%JMA: Next let's loop through each participant and each condition.
%
for iParticipant = 1 : ptbCorgiData.nParticipants,
%JMA: get the data for this participant.
sortedData = ...
ptbCorgiData.participan... |
function [n, J, m, l, dxcom, dycom, dzcom, Ixx, Iyy, Izz, Ixy, Iyz, Izx, a, alp, d, th, qi, qf, dEn, incr, g, T, t] = practical5_Inputs()
n=2;
J = [0 1];%joint type
T = 10;
m=[0.5 0.5];
l=[0.3 0.3];
%center of mass
dxcom = [0.15 0];
dycom = [0 0];
dzcom = [0 0.15];%in body fixed frame
%Inertia mome... |
function [ model ] = updateAlpha_forL2OLR_v2(X,y,model)
%UPDATEALPHA Summary of this function goes here
% Detailed explanation goes here
%If covBeta's diagonal elemtns are not positive, fix it.
covBeta=model.covBeta;
beta=model.beta;
varBeta=diag(covBeta);
varBeta(varBeta<0)=0;
alpha=length(beta)./(sum(varBeta)+sum... |
% 3/2/2017
% made by : Ahmed Almetwaly
% Get the homogenous transformation with DH Method for Scara Robot
%----------------------------------------------------
% for Scara Robot (change parameters here for readability)
%
% i thetai di ai alphai
% 1 theta1 l1 l2 0
% 2 theta_2 0 l3 180
% 3 0 ... |
function b=lsqfirin(h,d,gf)
% LSQFIRIN Least square inverse filter design with lowpass or bandpass-filtering
%
% b=LSQFIRIN(h,d)
% input parameters:
% h --> measured impulse response
% d --> desired output sequence
% gf --> grafic on / off
% (1: yes... |
function regFrameNums = regFrameNums_set(file2read, noMotionTrs)
numFrs = frameCounts_read(file2read);
%%
numfrs_cs = cumsum(numFrs);
frs = arrayfun(@(x)numfrs_cs(x)+1 : numfrs_cs(x+1), noMotionTrs, 'uniformoutput',0);
regFrameNums = cell2mat(frs);
|
function conditional_density = APSA3B_conditional_u1(u1, u2, theta)
if u2 <= 0.5
conditional_density = u2 + theta*u1*(- 2*u2^2 + u2) + theta*(- 2*u2^2 + u2)*(u1 - 1);
else
conditional_density = u2 + theta*(u1 - 1)*(2*u2^2 - 3*u2 + 1) + theta*u1*(2*u2^2 - 3*u2 + 1);
end
end |
function [Fvec,dFvec,dFavg,dFstd,Tavg] = trial_avg_dff(F,frameidx,...
PreStimFrames,PostStimFrames,...
Omitpre,Omitpost)
%[Fvec,dFvec,dFavg,dFstd,Tavg] = trial_avg_dff(F,frameidx,PreStimFrames,
% P... |
function [alfa,b] = get_alfa_w_b_by_SVM_quadratic_kernel(x,z)
% 输入:
% 标签z(NX1)
% 数据x(NXd)每行为一个样本,d维
% 输出:
% w(1XN)
% b(1X1)
% alfa(NX1)用于判断是不是支持向量
% 转变公式形式
len = length(z);
H = (1 + x * x').^2 .* (z *z');
f = -ones(len, 1);
A = -eye(len);
a = zeros(len, 1);
B = [z.'; zeros(len-1, len)];
b = zeros(len, 1);
% 求解SVM
... |
load traindata_cfs.mat
%function [] = test_cfs(Mut,Lam,Wei,No_rows_test)
% for r = 1:6
% for y = 1:No_rows_test
% difft = Testing_limit(y,:) - mu_validation;
% format long;
% Fi_testing(y,:) = exp(-(difft*Z*difft'));
% tempt_testing = Fi_testing;
% end;
% Phi_testing = [Phi_testing tempt_test... |
function [ data ] = readTifImageJ( obj, cols, rows, channels, stacks )
%READTIFIMAGEJ Read data from Tiff files in non-standard imageJ format
data = zeros(length(rows), length(cols), length(channels), length(stacks), obj.datatype);
fseek(obj.filePtr, obj.offsetToImg, 'bof');
imageSize = obj.height * obj.width * obj.c... |
function startRFSlopeCalibration(varargin)
%startRFSlopeCalibration(varargin)
%
%USAGE: startRFCalibration()
% startRFCalibration(moteIDs)
% startRFCalibration(moteIDs, threshold)
% startRFCalibration(moteIDs, threshold, windowSize)
%
%this function starts calibration of the motes.
%It effectually... |
function [J grad] = nnCostFunction(nn_params, ...
input_layer_size, ...
hidden_layer_size, ...
num_labels, ...
X, y, lambda)
%NNCOSTFUNCTION Implements the neural network cost func... |
function [result] = matskew(v)
vx=v(1);
vy=v(2);
vz=v(3);
result=[0 -vz vy;vz 0 -vx;-vy vx 0];
end
|
% Script for pre-generating channel specific model
% (C) Copyright 2019 The Huang Lab
%
% All rights reserved Weldon School of Biomedical Engineering
% Purdue University
% West Lafayette, Indiana
% ... |
clc; clear all; close all;
dirName = 'DK0:[MICROCT.DATA.00002000.00026721]';
fid = fopen('aim_sub.txt','wt');
% Make sure runing Matlab script in directory where RAW files are saved
fileNames = dir('*.AIM');
% open ipl
fprintf(fid,'\n%s','$ipl');
for i=1:length(fileNames)
fileName=fileNames(i).name;
f... |
function Aweighting_prs(obj, evt)
hndl = get(gcf, 'Userdata');
hndl = get(hndl.mainFig, 'Userdata');
chndl = get(hndl.calibrationFig, 'Userdata');
chndl.setting.general.Aweighting = get(obj, 'Value');
set(hndl.calibrationFig, 'Userdata', chndl); |
function define_global()
% Define indices of model variables as global variables
global iH_x idPsi iATP_x iADP_x iAMP_x iGTP_x iGDP_x iPi_x iNADH_x ...
iQH2_x iOAA_x iACCOA_x iCIT_x iICIT_x iAKG_x iSCOA_x iCOASH_x ...
iSUC_x iFUM_x iMAL_x iGLU_x iASP_x iK_x iMg_x iO2_x iCO2tot_x ...
iCred_i iATP_... |
function [blockNames,blockData,ok]=ReadStarFile(name)
% function [blockNames,blockData,ok]=ReadStarFile(name)
% Read a Relion .star file and put its contents into two cell arrays.
% blockNames is a cell array of the blockNames. For example here are
% values from reading a post_run.star file.
%
% >> blockNames{1} =
% ... |
Mdl = fitrsvm(trainX,trainY) |
function [ area ] = meshArea( verts, tris )
%MESHAREA compute area of triangles defined by vertices
% This function works for 2D and 3D embeddings.
%
% verts is NxD list of vertices
% tris is Nx3 list of vertex indices
%
[nv,nd] = size(verts);
nt = size(tris,1);
area = 0;
for i = 1:nt
tv = verts( ... |
% Example showing the ability of BSBL to recover non-sparse signals.
%
% The signal to recover is a real-world fetal ECG data, which consists two
% peaks of fetal ECG and one peak of maternal ECG.
%
% The goal is to recover the signal without distorting the two peaks of fetal
% ECG (the two peaks locate around at 65 an... |
function [ msd_val ] = get_msd( N ,w_act, w )
%MSD Summary of this function goes here
% Detailed explanation goes here
[r c] = size(w);
temp = zeros(1,r);
for l=1:N
temp(l) = norm(pdist([w_act(1,:);w(l,:)])) .^ 2 ;
end
msd_val=sum(temp)/N;
end
|
% This program:
% 1. takes images from both cameras
% 2. finds the locations of viewable tags in the HDImage
% 3. Transforms these to coordinates in the thermal image
% 4. Finds temperatures at these coordinates in the thermal image
% It will do this a specified number of times
numTags = 40; % Set this at beginning. T... |
function smsopen(varargin)
% This function opens the necessary files.. according to wchiever programming i am doing..
switch varargin{1}
case {'fem','afea','sfeam','f'}
open sms
open SFEAM
open AGG
case {'sa','mc'}
case {'md'}
end
end |
function pegasos_test
% load data from csv files
data = importdata(strcat('data/data3_train.csv'));
global X
X = data(:,1:2);
Y = data(:,3);
[n, d] = size(X);
disp('======Gaussian Kernel SVM======');
% Carry out training.
global alpha
global gamma
global K
epochs = 1000;
lambda = .02;
gamma = 2^1;
function z = gaus... |
%% Demo of the synthetic experiments.
%% Requires UGM at http://www.di.ens.fr/~mschmidt/Software/UGM_2009.zip
%% Requires TFOCS at http://tfocs.stanford.edu
%% Graph parameters
p=10; % number of cts variables
q=10; % number of discrete variables
n=2000; % sample size
e=ones(n,1);
L=2*ones(q,1); % levels in each... |
function [px2,py2,x2,y2] = xxxAnnotationConvertOpt2MS(dpn,x,y)
% Determine the MS location based on the region selected in the optical
% image
% First stage is to differentiate between a single click annotation and a
% rectangular annotation. This is required to ensure that the boundaries
% are specified to match the ... |
function [ featInfo ] = extract_localfeatures_mcho( filePathName, fparam, bShowFeat )
% extract local features, frames, and their patches
%
% input: filename and parameters
% output:
% featInfo.typeFeat( featIdx )
% featInfo.feat( featIdx, :) - x y a b c orientation scale
% featInfo.shscMatrix( f... |
%close all
%megaclear
%close all
% successful vertical trajectory
%load sync/jun1/lcmlog_2012_06_02_44.mat
%load ../controllers/matlab_tvlqr/rollTrajOptJune1_30z_73.mat
% successful horizontal trajectory
%load sync/jun1/lcmlog_2012_06_02_48.mat
%load ../controllers/matlab_tvlqr/rollTrajOptJune1_30z_73.mat
% successf... |
function [MatrixResults, time_MTF_GLP] = doMTF_GLPSSens0(imageDataFile)
% doMTF_GLPSSens0 performes a MTF_GLP reconstruction of a Multi-spectral image,
% whose relevant information is contained in ./Sensors/data/imageDataFile.mat file,
% the obtained results are compared with groundtruth following the
% Wald’s protocol... |
function proba_r_s_global=compute_C(n,displacement,discretization,labels)
total_number_of_event=(size(displacement,1)-1)*size(labels,1); %get the total number of events to get the global probabilities
matrix_r_s_global=zeros(n-1,n-1); %declare the matrix
%{
for i=1:size(labels,1) %create the structure to compute ... |
function [Q, R] = cgsqr(A)
m = size(A, 1);
n = size(A, 2);
R = zeros(n,n);
Q = zeros(m,n);
R(1,1) = norm(A(:,1),2);
Q(:,1) = A(:,1)/R(1,1);
for k = 2:n
R(1:k-1,k) = Q(1:m,1:k-1)'*A(1:m,k);
z = A(1:m,k) - Q(1:m,1:k-1)* R(1:k-1,k);
R(k,k) = norm(z,2);
Q(1:m,k... |
classdef Color
properties
% 2f4ea1 292b78
blue = [47, 78, 161]/255;
dblue = [41, 43, 120]/255;
% ee2123 7b1214
red = [238, 33, 35]/255;
dred = [123, 18, 20]/255;
% 6cbd45 9cce6e
green = [108, 189, 69]/255;
dgreen = [156, 206, 110]/255... |
classdef PlotController
properties
results ModelResults
pops SubPops
end
methods
function obj = PlotController()
end
function obj = update(obj, results)
obj.results = results;
obj.pops = SubPopulations(resul... |
function [D3a, dh_hist, LOG]=KTL03_to_ATL06(D2, params, which_seg)
% KTL03_to_ATL06(D2, params, which_seg)
% Inputs:
% D2: a 2-element structure array containing two beams worth of L2b
% ICESat-2 data, from the 'heights'group in the output of read_KTL03
% params: a 2-element (one per beam structure containing metad... |
global epsZero;
epsZero = 100*eps;
G = @(x,y) sin(x.^2)-y
dGx = @(x,y) 2*x*cos(x.^2)
dGy = @(x,y) -1
[x y] = implicitCurve(G, dGx, dGy, 0, 0, 5, 10^-3, 10^-3, [1;1]);
plot(x,y);
|
function [out] = monthStats(dat,mt);
% H1 Line -- compute stats for a speficic month
% Help Text -- work with structure data table (dat) created with the code
% impHYDATV2.m. Sort the data according to the selected month (mt) and
% compute max, average, min and std od imput data tables.
% mt is the numeric month v... |
function out = pad_brain (brain, step_size)
%gabor_wlen, gabor_orie
out = zeros(512);
stats = regionprops(logical(ceil(brain)), 'BoundingBox');
if size(stats,1) == 0
return;
end
center = [stats(1).BoundingBox(1) + stats(1).BoundingBox(3)/2,...
stats(1).BoundingBox(2) + stats(1).BoundingBox(... |
function ros=read_data_from_wrfout(wrfout,time)
% for witch its 3100 2600
format long
p=nc2struct(wrfout,{'F_ROS11','F_ROS12','F_ROS13','F_ROS11','F_ROS21','F_ROS23','F_ROS31','F_ROS32','F_ROS33'},{},time);
ros=zeros(size(p.f_ros11,1),size(p.f_ros11,2),3,3);
ros(:,:,1,1)=p.f_ros11;
ros(:,:,1,2)=p.f_ros12;
ros(:... |
function [BodyCostMap] = BodyCost(CostMap, Config)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
MarginX = Config.MarginX; % margin of the cost map
MarginY = Config.MarginY;
Radius = Config.Radius; % search radius for every foot
OffsetX1 = Config.OffsetX1;
O... |
% Reading images
D = './images';
S = dir(fullfile(D,'*.jpg')); % pattern to match filenames.
% Loading query image
query_image = imread('images/yellow7.jpg');
% Extracting colour planes of query image
q_red = single(query_image(:,:,1));
q_green = single(query_image(:,:,2));
q_blue = single(query_image(:,:,3));
% Tabl... |
close all; clc; clear all;
data = textread('DataSet.txt'); % read data from text file
data = data(:,1:end-1); % get rid of the last column which is full of zeros
data = sortrows(data,1); % sort the data set by the classes (first row)
x = data(:,2:end)'; % Extract data features as column vectors of matrix x
y =... |
function DATAadd = CalculateAdditionalSignals(DATA, SimStartTime, SimStopTime)
%% Calculate Additional Signals for SIM results
% Cumulative fuel flow
DATAadd.SIM.TEST.FuelFlow = DATA.SIM.TEST.ECU_qInjTot_PHY.Data * 1e-6 .* DATA.SIM.TEST.TrsmMdl_nCrksft_PHY.Data * 6 / 2 * 60;
DATAadd.SIM.TEST.CumFuelFl... |
function [K,node]=emc2EntropyD(Y)
[Y,KT]=sort(Y);
maxgain=inf; %-inf
diff=zeros(size(Y,1),1);
% entropy0=computeEntropy(Y);
node=1;
for i=2:size(Y,1)
gain=computeConditionalEntropy(Y,i);
if(gain<=maxgain)
maxgain=gain;
diff(i)=gain;%DiffEntropy(Y,i);
else
diff(i)=gain;
node=i... |
function writeSynSamplingHDF5(FID, pop_ind_pre, pop_ind_post, syn_type, sample_ind, time_index)
% write data sampling settings for individual neurons
% FID: file id for writing data
% sample_ind: vector of post-synaptic neuron indices to be sampled in pop_ind
% time_index: logical vector to define time points to... |
function [preL,nRejected] = generateFromIntuitiveClouds(LI_stats,nPerCloud,perturbedMapping,varargin)
% Generate patterns from conditional Gaussians fit to LI data.
%
% @ Matt Golub, 2018.
VERBOSE = false;
numConditions = size(LI_stats.signalMean,2);
if length(nPerCloud)==1
nPerCloud = nPerCloud*ones(1,numConditi... |
%This script runs Random hill climbing, simulated annealing and Genetic algorithms for rastriginsfcn
%% RHC
%%[x,fval,exitflag,output] = RHC_Ras(intialPoint,InitialMeshSize)
%For wide range of intial points
% j = 1;
% for i = -2 : 0.05: 2
% best_points(j,:) = RHC_Ras([i i],0.25);
% j = j+1;
% end
%For particular sta... |
% This scrip tests different training and post-processing parameters.
% Make sure nothing in the workspace interfers. Remove everything.
clear all;
% TODO Don't let this be global, pass to functions instead.
global DURATION;
% Require data.
disp('Enter path to ENST directory:');
enstDirectory = input('', 's');
disp(... |
% this function is to
% switch two elements in the permutation
function p = switch_ele(p,xi,xj)
temp = p(xi);
p(xi) = p(xj);
p(xj) = temp;
end
|
function [biny,cf0]=en_subband_L3(subband,aspect)
if aspect==0
[cf0,z,sn,cfnon]=coef_sign(subband);
else
[cf0,z,sn,cfnon]=coef_sign54(subband,3);
end
maxcf0=double(max(cf0));
%max_mean=[maxcf0 mean(double(cfnon))]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cf0=cf0+1; %<=== treat cf0 as runs!
maxcf=maxcf0+1;
nc=hist(double(c... |
function dispersion = getDispersion(roll) %takes a 5-length vector of numbers in
%range 1:6, and returns a
%vector of length 6 where each
%index is set to the count of
... |
% plot reinforcement learning figure 5 - pooled SNR
%
% Matlab script for plotting Fig 5
% for submission to Nature Neuroscience
%
% created by jcl on 08/07/08
%%
% create figure
fh = figure;
mm2inch = 25.4;
pw = 120/mm2inch; % paper width, make it nature size of one column, 85mm x 85mm
ph = 120/mm2inch; % paper... |
function itd=ia_tdiff(H_l, H_r, frq, sampling_frq)
% itd=ia_tdiff(H_l, H_r, selected_frq, sampling_frq)
% Calculates the interaural time delay of a critical band centered a frq
% time delay is positiv if left ear is leading, negative for right ear leading
% frq might be a vector with several frequencies
sz_l... |
img=zeros(250,250);
img(100:150,100:150)=1;
figure(1)
imshow(img);
%set parameters
gs.x=16;
gs.y=16;
thresh=3;
[Gx,Gy]=gradient(img);
img_grad=sqrt(Gx.^2+Gy.^2);
figure(2)
imshow(img_grad);
[ mask ] = divider(img_grad,gs,thresh);
figure(3);
imshow(mask); |
close all;
clear;
clc;
x = 0:2000:60000;
xq = 0:0.5:60000;
y0 = [0 0 0 0 0 0 0 0 0 0 0 0 0.0263158 0.0947368 0.221053 0.405263 0.578947 0.721053 0.847368 0.931579 0.963158 0.968421 0.994737 1 1 1 1 1 1 1 1]
yy0 = interp1(x, y0, xq, 'pchip');
y1 = [1 1 1 0.995 0.995 0.985 0.975 0.915 0.8 0.625 0.5 0.33 0.18 0.1 0.045 0... |
function [corrs]=condcorr(conds,arr1,arr2,outlier)
% given two variables of interest distributed over conditions,
% and a list of conditions (all column vectors)
% calculates the correlation for each condition.
% Useage: rqcondcorr(conds,arr1,arr2)
if nargin<4
outlier=zeros(size(arr1));
end
conditions=u... |
function [SOL,sysDex] = GetAdjust4CBC(REFS, BC, NX, NZ, OPS)
%% Number of variables and block positions in the solution vector
numVar = 4;
%% Set an initial solution vector
SOL = zeros(numVar*OPS,1);
if BC == 0
% Create boundary condition indices
iW = 1;
iT = 3;
... |
% problem4.m
clear, clc
disp('Find the largest palindrome made from the product of two 3-digit numbers.')
tic
palindrome = 0;
for a = 999 : -1 : 100
for b = a : -1 : 100
c = a*b;
if c > palindrome % gradually eliminate smaller palindromes
productStr = num2str(c);
... |
classdef enumSWEVerticalEddyViscosity < int8
enumeration
Constant (0)
Parabolic (1)
GOTM (2)
None (3)
end
end
|
# -*- octave -*-
function b=msk_analysis
b1 = read_bits("../../DataKRK/MSK_DHO_bits/y2013-m11-d07.txt");
## b2 = read_bits("../../DataKRK/MSK_NAA_bits/y2013-m11-d07.txt");
N=100000;
for i=1:N
c(i) = corrcoef(b1(1:N), b1(1+i:N+i));
endfor
plot(c);
endfunction
function b = read_bits(fn)
fid = fopen(f... |
function result = KerFunc( data1, data2, para )
%核函数计算
global gamma;
global coef0;
% para=1 : 线性核
if para == 1
result = data1 * data2';
elseif para < 4
% para == 2, 3 代表多项式核函数,并且作为幂次
result = gamma * data1 * data2';
result = ( result + coef0) .^para;
elseif para == 4
% para=4 : 高斯核 ... |
%iptsetpref('imshowtruesize','manual');
iptsetpref('ImshowInitialMagnification','fit');
iptsetpref('imshowborder','tight');
|
function out = MILP(u)
global wpt_list cnt wpt NUM_UAV p_i chk_range NUM_TASK cntt POSI cnttt
global popup
clock_zero = u(NUM_UAV*2+1) ;
for idx_UAV = 1 : NUM_UAV
pos(1,2*(idx_UAV-1)+1) = u((idx_UAV-1)*2+1) ;
pos(1,2*(idx_UAV-1)+2) = u((idx_UAV-1)*2+2) ;
end
if (clock_zero == 0 )
fo... |
%fluctuation generation
function [rang, time, fluct_xt]=generate_fluctuations(radial_kc,poloidal_nc,freq_c,number_of_time)
radial_k=(-8*radial_kc:radial_kc/ceil(radial_kc/2/pi):8*radial_kc)';
poloidal_n=-8*poloidal_nc:poloidal_nc/ceil(poloidal_nc):8*poloidal_nc;
delta_freq=freq_c/8;
freq=(-floor(number_of_time/2):flo... |
%-----------------------------------------------------------
%
% opens domain mean profiles for an ensemble of models that
% have run the RCEMIP experiments
%
% physical constants are defined in the create_RCEMIP_colors.m
% script
%
% when adding new models, the data needs to be imported via one of
% the calls to th... |
function normalizedPatches = normalizeLocalContrast(imagePatches, windowSize, patchSize)
% pre-allocate output memory
[nRowPatches, nColPatches] = size(imagePatches);
normalizedPatches = zeros(nRowPatches * patchSize, nColPatches * patchSize);
rowPatchSizeVector = patchSize * ones(1, nRowPatches);
colPatchSizeVect... |
% Cryptographie chaotique
% ***********************
%
% Calcul d'erreurs pour le mélange
% --------------------------------
allplot = 0;
%% 1 - Erreurs
if formeMessage == 1 || formeMessage == 2
EA_Decrypt = abs(Decrypt-inputSignal);
ER_Decrypt = 100*EA_Decrypt./abs(inputSignal);
mse_Decrypt = mean(EA_Decr... |
clear;
close all;
format long
addpath(genpath('/home/mvnl/Downloads/API_MO-master'));
%%
SOFAstart;
% Subject index of the file to convert
if ~exist('subject','var'), subject=80; end;
% File name of the RIEC file
RIECfn='/home/mvnl/Downloads/RIEC_hrtf_all/RIEC_hrir_subject_';
RIECfn='/home/mvnl/Downloads/qu... |
function sar = sa_ranked( SensBox, names_par, names_xj )
%rank the control coefficients over iterations over time
iters = length(SensBox(:,1,1,1));
time = length(SensBox(1,:,1,1));
% taking mean of iters for every time point
coefs = zeros(time, length(names_par),length(names_xj));
coefs_ot = zeros(length(names_par),l... |
function [T] = fk_solve(Transforms, states, vals, n)
%FK_SOLVE This function substitutes the states in the transformation matrix
%with the values specified while maintaining the joint constraints imposed
%by the ABB Arm
% @param transforms is the 4x4xm transformation matrices to solve
% @param states are the states... |
function NPcompVmesh2(fn,xxT,yyT,zzT,xx,yy,zz,QQ)
fid=fopen(fn,"w");
y0=yyT(1);
for i=1:length(yyT)
if (abs(yyT(i)-y0)<eps) && (i>1)
fprintf(fid,'\n');
endif
V=NPgetV(xxT(i),yyT(i),zzT(i),QQ,xx,yy,zz);
fprintf(fid,'%12.7f %12.7f %12.7f %12.7f\n',xxT(i),yyT(i),zzT(i),V);
endfor
fclose(fid);
endfunction
|
%% General
load simulatedSLAM;
K = numel(z);
N = min(N, K);
%% EKFSLAM
Q = diag([0.25, 0.25, 0.07].^2);
R = diag([6e-2, 1.45e-2].^2);
doChecks = false;
doAsso = true;
JCBBalphas = [1e-6, 1e-3]; % first is for joint compatibility, second is individual
slam = EKFSLAM(Q, R, doChecks, doAsso, JCBBalphas);
% allocate
eta... |
function image = matrix2img(matrix)
Settings;
vR=[];
vG=[];
vB=[];
[row col prof] = size(matrix);
rowI=matrix(3,1,4);
colI=matrix(4,1,4);
for j=1:col
vR=[vR matrix(:, j, 1)];
vG=[vG matrix(:, j, 2)];
vB=[vB matrix(:, j, 3)];
end
mR=reshape(vR,[rowI,colI]);
mG=reshape(vG,[rowI,colI]);
mB=reshape(vB,[rowI,... |
function [zNorm] = normalize_all_angles(z)
% Go over all angles and normalize them
for(i=1:length(z))
z(i) = normalize_angle(z(i));
endfor
zNorm = z;
|
% load data
load('BackPropData.mat');
%%
% The following code shows the first picture in the training set.
% TODO 1: Change it to show the first 10 images
for i = 1:10
figure;
imshow(reshape(x_train(i,:),[28,28])')
end
% Example of how to run backprop
[wInputHidden, xHiddenOutput, total_error_train, total_err... |
function mrk = tl_mrk_unifyMarkers(mrk,type,cl_target)
% Unifies marker families
switch type
case 'start'
cl_orig = {'start move red','start move green','start idle red','start idle green','start phase1','start rt','start'};
case 'light'
cl_orig = {'light move red','light move green','light id... |
function labedge = DetectLabEdge(labimg)
L = labimg(:,:,1);
A = labimg(:,:,2);
B = labimg(:,:,3);
[M, N] = size(L);
s = M*N;
temp = L;
temp(1, :) = [];
L_rise = [temp; L(M, :)];
temp = L;
temp(M, :) = [];
L_fall = [L(1, :); temp];
temp = L;
temp(:, N) = [];
L_right = [L(:, 1) temp];
temp = L;
temp(:, 1) = [];
L_left ... |
% a)
clear;
kuva = imread('noisylena.tiff');
%Muuttujan D muodostaminen
sx = size(kuva,2)/2;
sy = size(kuva,1)/2;
x = -(sx-1):sx;
y = -(sy-1):sy;
[X,Y] = meshgrid(x,y);
D = sqrt(X.^2+Y.^2);
n = [2,3,5,6,7,8,10,11,12];
Do = [10,20,30,40,50,60,70,80,90];
%Tarkasta D, "[]" Skaalaan kuvan
figure; imshow(D,[]);
color... |
%reset McSpace2
if(S232('getAPlockstatus') & S232('getXBlockstatus'))
S232('PA4mute',1);
S232('PA4mute',2);
S232('PD1stop',1);
S232('PD1clear',1);
end
m110dx( C_.STOP);
if(exist1('H.rasterfig')) close(H.rasterfig); H.rasterfig =[]; end
if(exist1('H.McSpace2_finalspikeratefig')) close(H.McSpace... |
function [b] = bilinear_interp(I, pt)
% bilinear_interp Performs bilinear interpolation for a given image point.
%
% Given the (x y) location of a point in an input image, use the
% surrounding 4 pixels to output the bilinearly interpolated intensity.
%
% Note that images are (usually) integer-valued functions (... |
function [logZZ_est, logZZ_est_up, logZZ_est_down] = ...
compute_RBM_AIS(vishid,hidbiases,visbiases,numruns,beta, batchdata, verbose)
% Version 1.000
%
% Code provided by Ruslan Salakhutdinov, modified by YC Harn
%
% Permission is granted for anyone to copy, use, modify, or distribute this
% program and accompanyi... |
% This program is used to calculate the overall forces on the vehicle.
% 1. Parameters such as geometric dimensions of bodies, speeds, altitude,
% thrust are defined
% 2. Normal forces and force locations are determined
% 3. Drag forces are calculated.
%% Input variables
% initiate vectors for data collection in for lo... |
clear;
clc;
close all;
%NOTE:
%For all 3D matrics, parameters follow [channels, width, height] format.
%% Input portion:
% change this when actually want to work with this
cl=3;
wl=150;
hl=150;
%imageL=zeros(cl,wl,hl);%this is Il
imageL=(255).*rand([cl,wl,hl]);
cl2=12;%this is cl+1
z1=12;%this is z'-size of meta f... |
% 08/07/2017
% Nayef Alsindi
% Apple, Inc.
% This main function tests the PDOA function to estimate the AoA using the
% acos method.
% PDOA Input:
% dsoFileName DSO file name including the directory path
% aoaParams structure that holds the main aoa parameters needed
% for e... |
% tomography and randomized bnenchmarking
%%
q = 'q2';
setQSettings('r_avg',3000);
state = '|0>';
data = Tomo_1QState('qubit',q,'state',state,'gui',true,'save',true);
% rho = sqc.qfcns.stateTomoData2Rho(data);
% h = figure();bar3(real(rho));h = figure();bar3(imag(rho));
%%
q = 'q10';
setQSettings('r_avg',5000);
process... |
function [X, info] = IRhtv(A, b, varargin)
% IRhtv Least squares solver with heuristic total variation penalization
%
% options = IRhtv('defaults')
% [X,info] = IRhtv(A,b)
% [X,info] = IRhtv(A,b,K)
% [X,info] = IRhtv(A,b,options)
% [X,info] = IRhtv(A,b,K,options)
%
% This penalized restarted iteration method incorpora... |
addpath('harris')
addpath('transformation')
vis = 1;
readnew = 1;
tic
if readnew
% I1 = imread('images/boat/img1.pgm');
% I1 = imread('images/rescaled/00.jpg');
I1 = imread('images/own/orig.jpg');
I2 = imresize(I1,0.5);
I3 = imresize(I1,1/3);
if length(size(I1)) == 3
I1 = rgb2gray(I1);... |
function [t p b R Outliers] = LinearRegression(Xp,Yp,RemoveOutliers,Graph)
% function [t p b R Outliers] = LinearRegression(X,Y,RemoveOutliers)
%
% INPUT : X - independent variable data points
% Y - dependent variable data points
% RemoveOutliers - a vector of outliers indeces not to be included
% ... |
function res = geo3x3_encode (lat, lng, level)
if level < 1
res = "";
else
res = "";
if lng >= 0.0
res = "E";
else
res = "W";
lng = lng + 180.0;
end
lat += 90.0;
unit = 180.0;
for i = 1 : level - 1
unit = unit / 3;
x = floor(lng / unit);
y = floor(... |
function result = simulateTest_1step(data,Ys,netNP)
% pred_vel = trainedModel.predictFcn(data);
pred_vel = cellstr(classify(netNP,data))';
dataT=array2table(data');
velocity=cellstr(Ys);
test_results = addvars(dataT,velocity,pred_vel);
test_results = sortrows(test_results,'velocity');
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.