text stringlengths 8 6.12M |
|---|
LumFile{1} = 'LeftEye_2013-06-21.mat';
LumFile{2} = 'RightEye_2013-06-21.mat';
PlotColor = {'*r','+b'};
for e = 1:2
load(LumFile{e});
Results = sortrows([Lum.SampleOrder, Lum.Measurement'],1);
Levels = unique(Results(:,1));
MeanLuminances(:,e) = Results(:,2);
plot(Levels, MeanLuminances(:,e), Plot... |
%% format_graphs
Y = (1:1:20)./4;
Y2 = rand(1,20)+1.*2;
X = 1:1:length(Y);
hold off
plot(X,Y, 'r--')
hold on
plot(X,Y2, 'b-')
pause(1)
grid on
pause(1)
grid minor
pause(1)
xlabel('Days from 2008 Housing Crash');
pause(.5)
ylabel('Price of Security X');
pause(.5)
title('Housing impact on stocks');
pause(.5)
axis([1, l... |
function [ XYZ_A ] = alignPointCloud( XYZ )
%ALIGNPOINTCLOUD Rotates and centers the points based on variance
%
%% Step 1. Center the data at zero:
xyz0=mean(XYZ);
A=bsxfun(@minus,XYZ,xyz0); %center the data
%scatter3(A(:,1),A(:,2),A(:,3));
%% Step 2. Find the direction of most variance using SVD and rotate the data ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%---------------méthode d'Euler :---------------%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [ ]=methode_d_euler()
%lecture de l'équation différentielle
f =input('donnez votre équation différntielle f(t,y) = ','s');
t0 =input('do... |
function [H, C] = snmf(M,No_cluster)
addpath('NMFLibrary');
addpath('NNDSVD');
addpath('symnmf2');
[wh, ~] = symm_anls(M, No_cluster,[]);
H = wh.W;
[~,C] = max(H,[],2);
end
|
1.类的设计
1>类名
*类名的第一个字母必须是大写
*不能有下划线
*多个英文单词,用驼峰标识
2>属性
3>行为(功能)
2.植物大战僵尸的僵尸
*类名:Zoombie
*属性:life、speed、attack
*行为:walk、bite、die
3.雷电的飞机
*类名:Plane
*属性:life、attack、speed、bombCount
*行为:fly、bomb、shoot、die
4.电脑
*类名:Computer
*属性:band、expirDate
*行为:open、close
|
data = load ('svd.txt');
error_rate_knn = error_rate_knn(data);
error_rate_svm = error_rate_svm(data);
error_rate_nb = error_rate_nb(data);
error_rate_dt = error_rate_dt(data); |
% MEYERAUX Meyer ウェーブレット補助関数
%
% Y = MEYERAUX(X) は、ベクトルまたは行列 X の要素に対して計算された
% Meyer ウェーブレットを生成するために用いられます。
%
% 関数は、35*x^4 - 84*x^5 + 70*x^6 - 20*x^7 です。
%
% 参考 MEYER.
% M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 12-Mar-96.
% Last Revision: 14-May-2003.
% Copyright 1995-2004 The MathWorks, Inc.
|
function [R_N, R_E] = earthrad(L)
wgs_84_parameters;
k = sqrt(1 - (e*sin(L))^2);
R_N = R_0*(1 - e^2)/k^3;
R_E = R_0/k;
end
|
function callbackAnnotationContextMenu(source,callbackdata, obj)
% CALLBACKANNOTATIONCONTEXTMENU
%
% DESCRIPTION:
%
%
% SYNTAX:
%
%
% INPUTS:
%
%
% OUTPUTS:
%
%
% COMMENTS:
%
%@
% Copyright 2016 The Johns Hopkins University Applied Physics Laboratory
%
% Permission is hereby granted, free of charge, to any pe... |
function param = extract_network_parameters(param, network, distribution, surrogate_number)
%% Load data for connectivity
% normW : matrix of normalized weighted connectivity of human connectome
% fiberdist : matrix of distances between nodes
load data/normW.mat normW
% load data/fiberdist.mat fiberdist
if nargin <... |
function [al, be, mu, sigma] = beta_ab2ms(al, be)
mu = al/(al+be);
try
sigma = sqrt((al*be) ./ ( ((al+be)^2) * (al+be+1) ));
catch
a=1;
end
end
|
function outData=creatingInterpolatedDistribution(data,nBin,xq)
[a1,b1]=hist(data,nBin);
outData = interp1(b1,a1,xq);
end |
% clear;
addpath(genpath('~/github/global_tool'));
addpath(genpath('cut_face_and_area_downsample'));
bosphorus = dir('Bosphorus');
bosphorus = bosphorus(3:end);
cou = 0;
for i_b = 1:length(bosphorus)
bosph_sub = dir([bosphorus(i_b).folder filesep bosphorus(i_b).name filesep '*.bnt']);
for i_s = 1:length(bosph_s... |
%% render subcube
subcube=M(11:512,11:512,1:128);
%% set up
x = 1:512;
y = 1:512;
z = 1:128;
[x,y,z]=ndgrid(x,y,z);
TH_LOG = 12;
th = 2^TH_LOG-1;
pls = subcube;%-min(min(min(subcube)));
pls(pls>th)=th;
pls(pls<0)=0;
%% plot
slice(double(pls), 500, 1, 1:20:100);
%% format
axis off
%colorbar
shading flat
colormap jet
vie... |
classdef tTeleportation < matlab.unittest.TestCase
%TINITIALIZATION Summary of this class goes here
% Detailed explanation goes here
methods (Test)
function tTeleportQubit(testCase)
% create entangled resource
entangleRegister = qregister(2,0);
entangleRegi... |
function [X] = fitAAMGlobal(image,Pini,type_of_model,type_of_feature,percent_for_app,debug)
%Global code to fit AAM model
%--------------------------------------------------------------------------
% 1) load models and toolboxes, charge image
%--------------------------------------------------------------------------
... |
% This function calculates the Frobenius norm of a matrix X
function Xf = Frobenius(X)
Xf = sqrt(sum(sum((abs(X)).^2)));
end |
%> @brief Get the total number of output step in the output NetCDF file
function [ Noutput ] = accessOutputStepNumber( obj )
outputStepNum = zeros( obj.Nmesh, 1 );
for m = 1:obj.Nmesh
ncid = netcdf.open( obj.outputFile{m} );
timeDimId = netcdf.inqDimID( ncid, 'Nt' );
[ ~, outputStepNum(m) ] = netcdf.inqDim... |
function [distance,location] = fcn_findSensorHit(wall_start,wall_end,sensor_vector,varargin)
% fcn_findSensorHit calculates hits between sensor vector and walls
% Syntax:
% fcn_findSensorHit(wall_start,wall_end,sensor_vector,varargin)
% Examples:
%
% % BASIC example - find all the points
%
% ... |
function [sigShifted,tShift] = shift_by_rxn_time(sig,buttonLocs,plotIt)
rxnTimes = buttonLocs{condInt};
[sorted,indexes] = sort(rxnTimes);
sortedSig = sig(:,:,indexes);
% calculate first response time, shift others based from there
sortedBasedOffFirst = sorted - sorted(1);
sigShifted = sortedSig;
numNonNan = sum(~is... |
function [outWave outSpec] = concatMrcExport(gD,sbjList,condList)
%function [outWave outSpec] = concatMrcExport(gD,sbjList,condList)
for iN = 1:length(sbjList);
for iC = 1:length(condList),
outWave(iN,iC,:,:) = gD.(sbjList{iN}).(condList{iC}).Exp_MATL_HCN_128_Avg.Wave.none;
outSpec(iN,iC,:,... |
% This function produces a plot for the phasors F. The phasors can be expressed
% in a one column array in rectangular complex form or in a two column array in
% polar form, with 1st column magnitude and 2nd column phase angle in degree.
% Copyright (c) 1998 H. Saadat
function phasor(F)
rankF=length(F(1,:));... |
function dHeelPos_x = dHeelPos_x(in1)
%DHEELPOS_X
% DHEELPOS_X = DHEELPOS_X(IN1)
% This function was generated by the Symbolic Math Toolbox version 8.5.
% 04-Dec-2020 16:30:53
q_t1 = in1(:,1);
q_t2 = in1(:,2);
q_t3 = in1(:,3);
q_t4 = in1(:,4);
q_t5 = in1(:,5);
q_t6 = in1(:,6);
t2 = cos(q_t1);
t3 = cos(q_t2);... |
function x = convexCircle(K)
% CONVEXCIRCLE(K) generates K equally spaced points on a circle on a simplex
%
% Copyright Sohan Seth sohan.seth@hiit.fi
r = 1; % Radius
theta = (0:(2/K):2) * pi; theta = theta(1:end-1); % Equispaced K angles
A = [[0, sqrt(2) * r]; [2 * (1 + sqrt(2)) / sqrt(3) * r, -r]; ...
[-2 * (1 +... |
function [WavFile, Nwav]=EvalWavPanel(figh, Prefix, P)
% EvalWavPanel - compute frequency series from Frequency stepper GUI
% Freq=EvalWavPanel(figh) reads the location of the .wavlist file
% in the GUI figure with handle figh (see WavPanel), and converts
% it to the locations of the wav files listed in that file... |
mex imcorrel.cpp image.cpp error.cpp
|
function U = poisson_fft3z(F,h,w)
% solve poisson equation in nD, n up to 3 supported
% - div D grad U = F
% D is diag(d(1)I, d(2)I, d(3)I)
if ~exist('w','var'),
w=[1,1,1];
end
p = length(h);
if p~=3 & p~=2,
error('poisson_fft3z: only 2 or 3 dimensions supported')
end
n = ones(1,3);
n(1:ndims(F)) = ... |
%Buoy_Rrs_Gen
%Draft script to pull in Luke generated .csv buoy data for Roodeplaat
%Deployment Jun2016
%Define wavelength
lambda=[320:5:895];
%Get file name
[csv_name, in_pname]=uigetfile('*.csv', 'Choose a buoy csv file');
%Load rads data
All = csvread(csv_name,1,0)
%Assign into acquisitions
Rad0945(:,1)=All(:,2... |
function result = initializeBlanks(len)
%INITIALIZEBLANKS Initializes the array with len number of blanks to guess.
% len: number of blanks to make. Also is going to be the size of the
% array.
% Author: Corey Miles
% initialize result for storing blanks.
% The value -1 means blank or underscore.
result = si... |
function N2 = buoyFreqfromTemp(p, t, S0, p0)
% N2 = BUOYFREQFROMTEMP(p, t, S0)
%
% inputs:
% - p:
% - t:
% - S0 (optional):
% - p0 (optional): reference pressure for computing density.
%
% outputs:
% - N2: buoyancy frequency squared in (radians/s)^2.
%
%
%
% Olavo Badaro Marques, 27/Ju... |
%creates a set of coils disposed along a XxY grid for the transmitting setup
%and R receiving independent coils that perform random walk.
%-plotAnimation = boolean, show the animation of the coils in 3D?
%-evalMutualCoupling = boolean, calculate the interactions between the coils and
%save it in a file?
%-D = acceptabl... |
function result = normalize_face(image_window, mean_face)
% function result = normalize_face(vector)
%
% normalizes the vector so that the size matches that of
% mean face, the mean is 0 and the std is 1.
result = imresize(image_window, size(mean_face), 'bilinear');
result = result(:);
result = result - mean... |
function [y, n] = periodic(x, P)
% Generates y(n) = periodic(x, n); n1 <= n <= n2
% -------------------------------------------------------
% [y,n] = periodic(x, n1, n2)
% P la chu k? muon lap
% so lan lap khong nhat thiet la 1 chu ky, khong lap lai dung 1 chu ky
% n1 muon bao nhieu cung duoc, chay tu n1 den n2
% phai ... |
function path_added=SetAdvisorPath(varargin)
%------------------Add ADVISOR directories to the MATLAB path-------------
% Add the appropriate paths based on where advisor.m is found with the which command (This
% defines the main ADVISOR directory)
%
% NOTE: paths will only be added with the addpath command if they do... |
function dy=DCmotor(t,y);
Kj=reinforce(t,y);
R=8;
L=6e-5;
J=0.02;
Kt=1;
Kb=1;
Tl=1;
N=1;
phi=0.0015;
wref=5000;
iref=(Tl/Kt);
dy=zeros(2,1);
ystar=[iref;wref];
v=Kj*(y-ystar);
dy(1)=(-R*y(1)-Kt*y(2)+v);
dy(2)=(Kt*y(1)-Tl);
end
|
clear all
close all
derad = pi/180;
radeg = 180/pi;
twpi = 2*pi;
kelm = 8; %阵元个数
dd = 0.5; %阵元间距
d=0:dd:(kelm-1)*dd;
iwave = 3;
theta = [10 30 60]; %待估计角度为10 30 60
snr = 10; %信噪比
n = 500; %快拍数
A=exp(-j*twpi*d.'*sin(theta*derad));
S=randn(... |
plot(magic(2)) |
% Name: Zheng Wen
% USC ID: 7112807212
% USC Email: zwen1423@usc.edu
% Submission Date 1/27/2020
function var = noiseVar(array)
var = 0;
avg = noiseAvg(array);
for i=1:length(array)
var = var + (array(i) - avg)^2;
end
var = var / length(array);
end |
function hsl_ma97_test()
%
% Unit tests for hsl_ma97 matlab interface
%
fails = 0;
fprintf('Testing Poisson(2) real:\n')
A = gallery('poisson', 2);
fails = fails + test_with_matrix(A);
fprintf('Testing toy example real:\n')
A = sparse ([1 1 1 2 2 3 3 3 4 4], [2 3 4 1 3 1 2 3 1 4], [1.1 2.2 3.3, 1.1 4.4, 2.2 4.4 5.... |
db_mode = 0; % debugger skips some of the initial steps and instead loads stuff that usually would be computer from a .mat file
if db_mode == 0;
%mask_fn='/Volumes/Aidas_HDD/MRI_data/S1/Analysis/mask.nii';
mask_fn='/Volumes/Aidas_HDD/MRI_data/S3/Analysis/mask.nii';
%%
roi_path = '/Volumes/Aidas_HDD/MRI_data/S3/Analysi... |
function [speed, ta] = get_wheelspeed(wheeldata)
%find when rising or falling edge is happening
d = diff(wheeldata);
% only look at rising edges
d(find(d==-1)) = 0;
% try 1s windows
for i = 1:floor(length(d)/30) % because it's sampled at 30kHz
speed(i) = sum(d((i-1)*30+1:i*30));
end
ta = 1:length(speed);
% for i... |
%HW5 Homework 5
function [num_questions] = hw5()
format compact;
close all;
%Part-A
% 1. Calculate Camera Matrix
% 2. Replot the points
% 3. Calculate RMS error
world_coords=importdata('world_coords.txt');
world_coords=[world_coords, ones(15,1)];
image_coords=importdata('image_coords.txt');
grid_data... |
%% value.m
% *Summary:* Compute expected (discounted) cumulative cost for a given (set of) initial
% state distributions
%
% function [J, dJdp] = value(p, m0, S0, dynmodel, policy, plant, cost, H)
%
% *Input arguments:*
%
% p policy parameters chosen by minimize
% policy policy structure
% ... |
%% settings_Link3_learnImp.m
% *Summary:* Script to set up impedance parameter learning for a 3-link
% robot.
%
%
%% Indices & State definitions:
% command window: Printed function values [opt >= ?]
% figure(1): Optimization progress [opt >= 3]
% figure(2): a... |
function [A, B] = covPPiso(v, hyp, x, z)
% Piecewise polynomial covariance function with compact support, v = 0,1,2,3.
% The covariance functions are 2v times contin. diff'ble and the corresponding
% processes are hence v times mean-square diffble. The covariance function is:
%
% k(x^p,x^q) = s2f * (1-r)_+.^j * f(r,j... |
clear
clc
vrep=remApi('remoteApi');
vrep.simxFinish(-1);
clientID=vrep.simxStart('127.0.0.1',19999,true,true,5000,5);
if (clientID>-1)
disp ('Connected')
%Handles
[~,needle_tip]=vrep.simxGetObjectHandle(clientID,'Needle_tip',vrep.simx_opmode_blocking);
[~,target]=vrep.simxGetObjec... |
classdef mmap_wrapper < handle
properties
env
pid
recv_mmap
send_mmap
send_byte
recv_byte
obs_size
act_size
mmapped_file_dir = "./shared_files/"
end
methods
function obj = mmap_wrapper(env, pid)
... |
function [ ] = convertjpgbmp( directoryName )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
cd(directoryName);
outputfolder=strcat(directoryName,'bmp');
mkdir(outputfolder);
d=dir;
for i=3:length(d)
str=d(i).name;
I=imread(str,'jpg');
%change name to bmp
str=strcat(str... |
function visReconstruction(x,pau,sl,dy,xlab,ylab)
%VISRECONSTRUCTION Visualizes a slice of each of the reconstructed
%volumes
% VISRECONSTRUCTION(X,{PAU},{SL},{DY},{XLAB},{YLAB})
% * X is the reconstructed data
% * {PAU} indicates whether to pause the execution, it defaults to 1
% * {SL} serves to select a ... |
clc;close all;clearvars;
ksmm=0.018;
kb=0.00028; %h-1
Y=0.31;
km=25;
rho= 1.65; %g/cm3 soil bulk density
rho_wood=1.1;%g/cm3 max carbon density in form of wood
nx=100;ny=100; %One pixel = 25micron
Vol_mic = 50*50*50; %um^3
Vmic_cc=Vol_mic*1e-12; %cm3
Vdomain_cc=Vol_mic*nx*ny*1e-12 ; % cm^3
maxC_ms=(rho_wood*1e-1... |
classdef enumLimiter < int8
enumeration
None (0)
Vert (1)
TVB (2)
BJ (3)
end
end
|
function varargout = circumCenter(a, b, c)
%CIRCUMCENTER Circumcenter of three points
%
% CC = circumCenter(P1, P2, P3)
%
% Example
% circumcenter
%
% See also
% points2d, circles2d, circumCircle, centroid
%
% ------
% Author: David Legland
% e-mail: david.legland@grignon.inra.fr
% Created: 2011-12-09, ... |
function a = precalc_winding_area(g)
%%% Pre-calculate winding area for resistance calculations ahead of running
%%% a simulation
%%% Polygon Area %%%
p1 = g.s.p3;
p2 = g.s.p4;
p3 = g.s.p5;
p4 = g.s.p6;
p5 = g.s.p9;
a1 = 1e-6*2*g.s.ff*abs(.5*((p1(1)*p2(2) - p1(2)*p2(1)) + (p2(1)*p3(2) - p2(2)*p3(1)) + (p3(1)*p4(2) -... |
% FUNCTION: kolmogorov.m
% DATE: 9th Feb 2005
% AUTHOR: Stephen Faul (stephenf@rennes.ucc.ie)
%
% Function for estimating the Kolmogorov Complexity as per:
% "Easily Calculable Measure for the Complexity of Spatiotemporal Patterns"
% by F Kaspar and HG Schuster, Physical Review A, vol 36, num 2 pg 842
%
% Input... |
function dat = get_dat( bufferD, idxSample )
% dat = get_dat( bufferD, idxSample )
if bufferD.running
try
if all( idxSample >= 0 ) && idxSample(2) >= idxSample(1)
dat = buffer('get_dat', idxSample, bufferD.host, bufferD.port );
dat = dat.buf;
else
dat = [];
... |
plot(baztrain(find(Ytrain == 2), :))
walking_baz = baztrain(find(Ytrain == 2), :);
plot(walking_baz(:))
sitting_baz = baztrain(find(Ytrain == 4), :);
hold on
plot(sitting_baz(:), 'r')
walkdown_baz = baztrain(find(Ytrain == 3), :);
plot(walkdown_baz(:), 'g')
walk_baz = baztrain(find(Ytrain == 1), :);
plot(walk(:), 'k')... |
function [X_norm, mu, sigma] = featureNormalize(X)
%FEATURENORMALIZE Normalizes the features in X
% FEATURENORMALIZE(X) returns a normalized version of X where
% the mean value of each feature is 0 and the standard deviation
% is 1. This is often a good preprocessing step to do when
% working with learning alg... |
%*******************
%% UNIT CELL
%****************
L1=0.3;
L2 =0.4;
Rx=4; %% radius in the the x-direction of the ellipse [m]
Ry=8; %% radius in the the y-direction of the ellipse [m]
x0=0;y0=0;
%*******************
%% DASHBOARD
%****************
%Nx = 200;
% Ny = 200;
dx = 1/Nx;
dy = 1/Ny;
xa = [0... |
function LL=cvLME(TABLE,formula, fold)
% Perform k-fold cross-validation on RNN's LME model fiitted on TABLE using
% formula provided
[col, ~] = size(TABLE);
single = floor(col / fold);
LL = 0;
for nx=1:fold
test = TABLE(((nx-1)*single+1):nx*single,:);
train = [TABLE(1:single*(nx-1),:);TABLE(single*nx+1:end,:... |
function load_camera_calibration (self)
% LOAD_CAMERA_CALIBRATION (self)
%
% Load camera calibration from dataset.
% Camera calibration file
calibration_file = fullfile(self.dataset_path, 'Calib_Results_11.mat');
assert(exist(calibration_file, 'file') ~= 0, 'Camera calibration "%s" not foun... |
%此程序为辨识电机参数的转动惯量
function [sys,x0,str,ts] = Synchronous_demarcate2(t,x,u,flag)
switch flag,
case 0, %初始化
[sys,x0,str,ts]=mdlInitializeSizes;
case 2 %离散状态计算,下一步仿真时刻,终止仿真设定
sys=[];%mdlUpdates(t,x,u);
case 3, %输出信号计算
sys=mdlOutputs(t,x,u);
case {1,4,9}, %输出信号计算
sys=[];
otherwise
D... |
function [ Ncell, EToV ] = InitQuadConnect2d(N)
%InitQuadConnect2d - Description
%
% Syntax: [ Ncell, EToV ] = InitQuadConnect2d(input)
%
% Long description
Np = ( N + 1 ) .^ 2;
Ncell = N ^ 2;
EToV = zeros(4, Ncell);
sk = 1;
s2 = Np - N;
s1 = s2 - ( N + 1 );
for row = 1 : N
v1 = s1; v2 = s2;
for kb = 1:N
... |
%FHM_initial
%Rory Conolly
%February 4, 2017
global MODPAR
%Brain
param.V_Brain = 1.20E-05; %
param.V_BrainBlood = 1.20E-07; %
param.E2 = 0; %V_BrainBlood.E2
param.FAD = 0; %V_BrainBlood.FAD
param.LHFSH = 0;% V_BrainBlood.LHFSH
%Gill
param.V_Gill = 1.58E-05; %V_BrainBlood... |
% onsetDetection.m
clear;clc;
%[in,Fs] = audioread('AcGtr.wav');
[in,Fs] = audioread('monoDrums.wav');
frameSize = 1024;
% Overlap, hop for analysis
overlap = 4; % [2:4]
hop = frameSize/overlap;
N = length(in);
NFrame = ceil(N/frameSize);
% zero-pad input to always have complete frame at end
if (mod(N,frameSize) > 0... |
% In this script an elman network is trained and tested in order to model a so called Hammerstein model.
% The system is described like this:
% x(t+1) = 0.8x(t) + sin(u(t+1))
% y(t+1) = x(t+1);
% Elman network should be able to understand the relation between output
% y(t) and input u(t). x(t) is a latent variable r... |
classdef optimalControlAbstract < handle
properties
setupMode = '';
c_cost = []; % fixed in DOC, changes in IOC
c_const = [];
featureSet = []; % fixed in IOC, changes in DOC
normalizeCostSet = [];
costFunctionStruct = [];
splineDt;
w... |
close all;
clear all;
clc;
%main:
[cover,FsCover] = wavread('cover.wav');
[secret,Fssecret] = wavread('secret.wav');
%sound(100*cover,FsCover);
frameSize = (10/1000)*Fssecret;% frame length= 10 ms without overlap
hfileIn = dsp.AudioFileReader('secret.wav','SamplesPerFrame', frameSize, ...
'OutputDataTyp... |
function R = KNNRecall(trainZ,testZ,K,gt)
[numTest,b] = size(testZ); R = zeros(size(K));
for i = 1:numTest
point = testZ(i,:);
dist = sum(bsxfun(@xor,trainZ,point),2);
[~,idx] = sort(dist);
for j = 1:numel(K)
idx1 = idx(1:K(j));
if iscell(gt)
c = intersect(idx1,gt{i});
... |
runProcessedData =importdata([fileSave{1} filesep 'runProcessedData.mat']);
params =importdata([fileSave{1} filesep 'params.mat']);
Data_Anticipation =importdata([fileSave{2} filesep 'Data_Anticipation.mat']);
nTrialPerRun = 25;
indexRun = [ones(1,nTrialPerRun) 2*ones(1,nTrialPerRun) 3*ones(1,nTrialPerRun) 4*ones(1,... |
function bitword=dewatermark_k(varargin)
%Questa funzione effettua l'operazione di estrazione di un watermark di
%tipo stringa, inserito tramite la funzione watermark_k.
%Accetta almeno un parametro di ingresso e restituisce un solo parametro di
%uscita (la stringa appunto). Può accettare un'eventuale key numerica
%ut... |
%map bits using ASK
function [ data_modulated ] = ASK(input_data,nr_bits_axe)
reshaped_data=reshape(input_data,nr_bits_axe,length(input_data)/(nr_bits_axe));
data_modulated=zeros(1,length(input_data)/(nr_bits_axe));
for i=1:nr_bits_axe
data_modulated=data_modulated+2^(nr_bits_axe-i).*(-1).^sum(reshaped_data(1:... |
% loop over years to load in tmax/tmin/pet/ppt data
for yr=1:31
tmean=tmaxdata/2+tmindata/2;
clear tmaxdata tmindata dataout
tmean=shiftdim(tmean,2);
pptdata=shiftdim(pptdata,2);
% f refers to non-empty cells if needed
tmean=tmean(:,f);
pptdata=pptdata(:,f);
% carry forward snow from previous december or spinu... |
function lockedChannels=checkLock(baseNumber,etaScanDir,chans)
rootPath=[getSMuRFenv('SMURF_EPICS_ROOT'),sprintf(':AMCc:FpgaTopLevel:AppTop:AppCore:SysgenCryo:Base[%d]:',baseNumber)];
if nargin < 2
[status,cmdout]=system('readlink /data/cpu-b000-hp01/cryo_data/data2/current_eta_mitch_epics');
... |
function j_l = generate_spherical_bessel_basis(maxL, s_list, k_max, k_grid)
% Generate spherical Bessel functions used for expansion of the volume
%
% Inputs:
% * maxL: cutoff for spherical harmonics expansion
% * s_list: list of number of radial frequencies per spherical harmonics
% order
% * k_max: assumed b... |
function xu_generateTiles(imgPath,imgName,neiN,rotN,ps,tl,br,slidePtr,levelforRead,magHigh,magCoarse,magToUseAbove)
%% process most salient image patch
if nargin==11
tlp=tl;
brp=br;
tlp=(tlp-1).*(magHigh/magCoarse)+1;
brp=(brp-1).*(magHigh/magCoarse)+1;
ARGB = openslide_read_region(slidePtr,tlp(2),... |
%% linspace_angles
function thetas = linspace_angles(min,max)
% calculate number of points based on min, max
diff = max - min;
term = 10;
num_pts = diff/term;
% check the remainer
remained = rem(diff, term);
if remained ~= 0
num_pts = round(num_pts);
end
thetas = ... |
function outv = nsort(vec)
for i=1:length(vec)-1
fLow=i;
for y=i+1:length(vec)
if vec(y)>vec(fLow)
fLow=y;
end
end
temp = vec(i);
vec(i) = vec(fLow);
vec(fLow)=temp;
end
outv=vec;
end
|
%Algoritmo que invoca todas as funcoes e plota os graficos
%Invoca a funcao que prepara a matriz A e o vetor b
[A,b]=Ab();
%Invoca as funcoes que resolvem o sistema normal das 3 diferentes formas
[x_a, R_a]=questao_1_a(A,b);
[x_b, R_b]=questao_1_b(A,b);
[x_c, R_c]=questao_1_c(A,b);
%Invoca a funcao que com... |
% Noi suy tuyen tinh (Linear interpolation)
function [a0 a1] = api_1(x0, f0, x1, f1)
a0=(x1*f0 - x0*f1)/(x1-x0);
a1=(f1-f0)/(x1-x0);
end
|
% Wrapper to run network on multiple images
function joints = applyNet(files, opt)
opt.numFiles = numel(files);
fprintf('config:\n\n');
disp(opt)
fprintf('\n');
% Initialise caffe
net = initCaffe(opt);
% Apply network separately to each image
joints = zeros(2, opt.numJoints, opt.numFiles, 'single');
for ind = 1:opt... |
function p = predictOneVsAll(all_theta, X)
m = size(X, 1);
num_labels = size(all_theta, 1);
% You need to return the following variables correctly
p = zeros(size(X, 1), 1);
% Add ones to the X data matrix
X = [ones(m, 1) X];
h = sigmoid(X * all_theta');
[maxH, imaxH] = max(h');
p = imaxH';
end
|
function trajectory_state = trajectory_planner(question, waypoints, max_iter, waypoint_times, time_step)
% Input parameters
%
% question: Which question we are on in the assignment
%
% waypoints: Series of points in [x; y; z; yaw] format
%
% max_iter: Number of time steps
%
% waypoint_times: Time we should be... |
function [closeVal1, closeVal2] = ...
findZVCMid(currTimeStart, currTimeEnd, crossingStruct, jointAngleData, toleranceGap)
midVal = 0.5*(currTimeStart + currTimeEnd);
lowerBound = currTimeStart < crossingStruct.Time;
upperBound = crossingStruct.Time < currTimeEnd;
inBound = and(lowerBou... |
function [error_prom] = test(w,x,yd)
x=[-1*ones(size(x,1),1) x];
desempenio=0;
y = [];
# recorrer por patron
for patron=1:size(x,1)
y=[y; x(patron,:)*w];
error= yd(patron)-y(patron)/yd(patron);
endfor
figure;
plot(y);
hold on;
plot(yd);hold on;
legend("prediccion","r... |
function graph = genGraph(num_tasks,num_workers,r)
graph = eye(num_tasks,num_workers);
B = ones(max(num_workers,num_tasks),2*r);
graph = spdiags(B,[[1:r-1] [-num_tasks+max(num_tasks-num_workers+r-1,0)-r+1:-num_tasks+max(num_tasks-num_workers+r-1,0)]],graph);
|
% load('dat/TbUWBRAD.mat','UWBRADc')
load('dat/TbMEMLS.mat')
%UWBRADSensor=GetSensorData('~/Data/UWBRAD/CSA_antenna_phi0_theta_pattern.dat');
fname='dat/ConicalSpiral_40Turns_NoseConeGeometry.csv';
UWBRADSensor.GaindB=csvread(fname,1,1,[1,1,181,16]);
UWBRADSensor.Theta=180:-2:-180;
UWBRADSensor.Freq=linspace(0.5... |
% We consider the following linear mixed model:
%%%---------------------------------------------------------------------%%%
%%% y = X*beta + Z*b + eps, %%%
%%%---------------------------------------------------------------------%%%
%%% where:
%%% * beta is vector of fix... |
addpath('Mex')
% Start the Kinect Process
if(~exist('KinectHandles','var'))
KinectHandles=mxMSCreateContext();
end
% Show the Video-Frames until a player is found
figure,
Pos= mxMSSkeleton(KinectHandles);
I=mxMSPhoto(KinectHandles);
h=imshow(I);
while(Pos(1)==0);
I=mxMSPhoto(KinectHandles);
Pos= mxMSSk... |
function [comData, nameData, Title] = analyzeSTFFTData(signalType, file)
data = file(:, 2:size(file, 2));
data = table2array(data);
indicies = data(2, :);
positive = indicies == 1;
sleep = indicies == 0;
artifact = indicies == -1;
if signalType == "Delta"
posDelta = data(3, positive);
sleepDelta = data(3, ... |
function feat = feature_extraction(path,ext,type)
fls = dir([path '/' '*.' ext]);
if isempty(fls)
error('No image was found.');
end
feat = cell(1,length(fls));
if strcmp(type,'hog')
descriptor = @hog;
elseif strcmp(type,'dsift')
descriptor = @dsift;
else
error('undefined descriptor.');
end
parfor in... |
function [ r ] = relabelBinnedVector( v )
%RELABELBINNEDVECTOR Summary of this function goes here
% Detailed explanation goes here
indices = sort(unique(v));
l = size(v, 1);
r = zeros(l, 1);
for i=1:l
r(i,1) = find(indices == v(i,1));
end
end
|
function data = Ayoub_PitchShift(a,b)
audioInterfaceName = 'ASIO4ALL v2';%'MOTU Audio ASIO';% 'MOTU MicroBook';
sRate = 48000; % Hardware sampling rate (before downsampling)
downFact = 3;
frameLen = 96; % Before downsampling
defaultGender = 'female';
%% Visualization configuration
gray = [0.5, 0.5, 0.5];
ostMult =... |
%MAIN - series elastic actuator
%
% Runs a simulation of a simple pendulum that is controlled by a series
% elastic actuator
%
%%%% NOTES %%%%
%
% It seems like the best control strategy is to send a command torque that
% has three parts:
%
% 1) Adds critical damping between the motor and the end effector
%
% 2) PD-... |
function ret = waitcolor_step( correct )
%WAITCOLOR_STEP Step a wait forc olor simulation code forward
% Returns a 32x32x3x60 trial representing a view of the screen as a same
% different psychophysics task runs. The task runs in the following way:
% 20 frames: blank
% X frames: color1
% 10 frames... |
clear all;
close all;
f0=inline('x.^4.*exp(-x.^3.)');
c=quad(f0,0,5);
f=inline('x.^4.*exp(-x.^3.)/d','x','d');
figure(1); % display density function f(x)
t=0:0.01:5;
N=length(t);
plot(t,f(t,c));
title('function of f(x)');
K=5000;
x=zeros(1,K);
x(1)=0.5; %initial
rand('seed',0);
for k = 2:K
y ... |
%QT_DIRCOS Convert quaternion into direction cosine matrix
%
% Syntax:
% C = qt_dircos(q)
%
% In:
% q - Unit quaternion(s) as 4xN matrix
% use_sym - Return symbolic variables (default 0)
%
% Out:
% C - Cosine matrices as 3x3xN matrix
%
% Description:
% Convert quaternion into direction cosine matrix
% suc... |
function updateBTA(source,~,data)
h = guidata(source);
if(strcmpi(source.Tag,'checkbox'))
color = permute(source.CData(2,5,:),[1 3 2]);
set(source,'CData',getButtonImage(color,source.Value));
end
if(h.isActive)
computeBTA(source,[],data);
end |
function k=DEM_surf_1()
a1 = 200; %height of frame (width of cropping rect)
a2 = 930; %width of frame (length of cropping rect)
a3 = 934; %number of frames
a4 = 5; %index of frame width
a5 = 1/a4;
c1 = 10; %1st column of cropping rect
c2 = 240; %1st row of cropping rect
b=zeros(a1,a2,a3);
for x=1:a3 %Th... |
Bijna geen enkele Matlab gebruiker kent alle standaard functies
die Matlab standaard heeft, dat is een feit.
Een goede manier om nieuwe Matlab functies te leren kennen is
door gebruik te maken te maken van een zoekmachine. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.