text stringlengths 8 6.12M |
|---|
function [solObj, sol] = ...
SAO(numDim, ... % Dimension of your objective function.
numInitial, ... % 0: User-defined initial N: N initials by LHD
optflag, ... % (+1): maximization (-1): minimization
maxLoop, ... % Max number of search iteration
Initial, ... % Necessar... |
prompt = 'how many random number do we want : ';
n = input(prompt);
p = 11;
q = 19;
m = p*q;
xi = 3;
size = 4;
n = n*size;
par = [];
i =1;
rand = [];
while i <= n
xi_square = xi^2;
xi_mod = mod(xi_square,m);
binary = dec2bin(xi_mod);
j = 1;
cnt = 0;
while j <= length(binary)
... |
load fisheriris
rng default % for reproducibility
Y = tsne(meas,'Distance','mahalanobis');
figure;
gscatter(Y(:,1),Y(:,2),species)
D=pdist2(meas,meas,"mahalanobis");
rng default
Y2 = tsne(D,'Distance',@ExampleDistFunc,'NumDimensions',2);
figure;
gscatter(Y2(:,1),Y2(:,2),species);
rng default
[Y3]=pkg.e_tsnebyd(D,2);
... |
function [A, b] = generate_probabilities_system(rows)
M = zeros(rows);
%construiesc diagrama
% cu i parcurg coloanele si cu j liniile la construirea labirintului
M(1,1) = 1;
for j = 2:rows
M(j, 1) = M(j-1, 1) + j - 1;
endfor
for i = 2:rows
M(i, i) = M(i-1, i-1) + i;
for j = i+1:rows
M(j, ... |
function overlays = ClosestSurfaceVertex(midthickness_files, maps, max_dist, thresh)
coords = cell(2,1);
for hem = 1:2
fid = fopen(midthickness_files{hem});
xmlstr = fread(fid,'*char')';
fclose(fid);
block_starts = strfind(xmlstr, '<Data>');
block_starts = block_starts + 6;
block_ends = strfind... |
function [S1, S2, alpha] = principal(s11, s22, s12)
% This subroutine computes the principal stresses and direction
% [-pi/2, pi/2] given the three components of a 2D stress state.
S1=(s11+s22)/2 + sqrt(((s11-s22)/2)^2 + (s12)^2);
S2=(s11+s22)/2 - sqrt(((s11-s22)/2)^2 + (s12)^2);
alpha=atan2(2*s12, (s11-s22))/2;
... |
function varargout = Run(varargin)
% RUN MATLAB code for Run.fig
% RUN, by itself, creates a new RUN or raises the existing
% singleton*.
%
% H = RUN returns the handle to a new RUN or the handle to
% the existing singleton*.
%
% RUN('CALLBACK',hObject,eventData,handles,...) calls the local
% ... |
function Ad = getAd(phi, h, d)
% getAd: get the A-matrix as in equation (15)
%
% Usage: Ad = getAd(phi, h, d)
%
% INPUTS:
% phi: a cell containing all the systems Phi_i(s)
% h: the fast sampling interval
% d: the vector of fractional delays
%
% OUTPUT:
% Ad: matrix Ad as in equat... |
clear all ; close all ;
subs = {'alex','dina','genevieve','jeremie','russell','sukhman','tegan','valerie'};
source_folders = {'den_retino_allstims_01','den_retino_allstims_02','den_retino_gamma_01','den_retino_gamma_02','den_retino_movie','den_retino_rest'};
clean_fmri_names = {'bp_clean_retino_allstims_01','bp_cl... |
function move_robot(ut,ur)
% moves the robot applying translational speed ut and rotational speed ur
% for 1 second. Only one of the two can be different from 0, i.e., either
% you move forward or you rotate, but you do not move along an arc
persistent x y theta
% initialize persistent variables when needed
if isem... |
function G=per_freq(wf)
s=size(wf);
lc=MyConst.a_Si/MyConst.ab;
dV=(lc/s(1))^3;
ub=fftshift(fftn(wf)).*dV;
s=size(ub);
x=(1:s(1))-(s(1)/2+1);
[X,Y,Z]=meshgrid(x,x,x);
G=zeros((s(1)*s(2)*s(3)),6);
G(:,1)=X(:).*2.*pi./lc;
G(:,2)=Y(:).*2.*pi./lc;
G(:,3)=Z(:).... |
function time = num2tme(number);
%
% num2tme(number)
%
% A number is expressed in a string as time.
% 9.6 corresponds to 9.36. The result is
% truncated to minutes.
%
% Unfortunately, we cannot use vectors.
%
% (c) jjwikner, MERC, 2000
%
if length(number) > 1
warning('No vectors !');
else
golvet = floor(number)... |
%% export GAL1 fcs data
load('../RawData/mig1d_gal80d_wt_data.mat')
wildtype = cell(8,12);
for i_row = 8:-1:1
for j_col = 1:12
tmp = {alldata(5,i_row,j_col,2).yfp};
wildtype{9-i_row, j_col} = tmp;
filename = sprintf('well %s-%s.csv', num2str(9-i_row),num2str(j_col));
csvwrite(fullfil... |
%J. C. Spall, March 1999
%Written in support of text, Introduction to Stochastic Search and Optimization, 2003
%Simulated annealing code. Uses geometric decay of temperature.
%Provides two ways of dealing with noisy
%loss measurements: one is by using the tau coefficient to alter the
%decision criterion and the ... |
function sampleInc = LRClightSampleInc
%LRCLIGHTSAMPLEINC Summary of this function goes here
% Detailed explanation goes here
% Nominal sampling increment size in seconds of the light logger
sampleInc = 180;
end
|
function [data] = raw2complex(filename)
%RAW2COMPLEX converts a raw binary file consisting of 8 bit real/imag
%values
fileID = fopen(filename);
bin = fread(fileID, 'int16');
length = size(bin, 1);
real = bin(1:2:length)/4096.0;
imag = bin(2:2:length)/4096.0;
data = complex(real, imag);
fclose(fileID);
end
|
clear
close all
clc
%%
% This script takes a series of CPMG files (from the CPMG sequence) at
% different lift positions, as well as a reference file (for coil
% sensititvity correction). It Fourier transforms each, does a sensitivity
% correction, then concatenatates the whole set into a 2D profile, but
% using FT rat... |
%矩阵元素的处理
%上取整
%下取整
%四舍五入
%小数
%floor/ceil/round/fix
%取模和取余
%mod/rem要考虑x和y的符号 |
% Copyright 2018 National Institute of Advanced Industrial Science and Technology (AIST)
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
% ... |
function res = lra_hdr(img)
%% pre-processing
gray = rgb2gray(img);
L = double(gray)/255;
%% Local Region Segementation
function R_map = local_region_segmentation(L, PBmin, PBmed, PBmax)
[height, width] = size(L);
map_size = height * width;
H = imhist(L);
PB = cumsum(H)/map_size;
for i = 1:256
... |
%ABS Datafile overload
function a = abs(a)
prtrace(mfilename,2);
isdatafile(a);
a = a*filtm([],'abs');
return;
|
function pp = g_m_contourf(lon,lat,z,cvec,cmap)
% g_m_contourf Make contourf plot with own colormap on an m_map
% PP = g_m_contourf(LON,LAT,Z,CVEC,CMAP) makes a contourf plot using
% CVEC and CMAP.
%
% INPUT lon,lat - position vectors
% z - contour matrix
% cvec - cont... |
function [ gray ] = RGB2gray( origin )
%togray: change rgb image to gray
% 此处显示详细说明
origin = double(origin);
gray = 0.299 * origin(:,:,1) + 0.587 * origin(:,:,2) + 0.114 * origin(:,:,3);
gray = uint8(round(gray));
end
|
function [ MOV ] = AvgModDiff2B( Ref, Test, ModDiff2B )
%[ MOV ] = AvgModDiff2B( Ref, Test, ModDiff2B )
% As described by ITU-R BS.1387-1 Section 4.2.2
global debug_var
if debug_var
disp(' AvgModDiff2B');
end
Z = size(Ref.Mod,2);
w = zeros(size(Ref.Mod));
w(Test.Mod>Ref.Mod) = 1;
w(Test.Mod<Ref.Mod) = ModDiff... |
function DCMnb = euler2dcm(euler)
% euler: 3x1 Euler angles [roll pitch yaw] (rad, rad, rad).
% DCMnb: 3x3 nav-to-body DCM.
phi = euler(1); theta = euler(2); psi = euler(3);
C1 = [cos(psi) sin(psi) 0; ...
-sin(psi) cos(psi) 0; ...
0 0 1];
C2 = [cos(theta) 0 -sin(theta); ...
... |
% File: SA3_4.m for Study Aid Example SA3-4
clear;
R = 38400;
Tb = 1/R;
f = -200000:2000:200000;
% Creating PSD
Pf = 10*log10((SA(pi*f*Tb)).^2);
plot(f,Pf);
xlabel('f (Hz)');
title('Power Spectral Density');
ylabel('P(f) -- dB units')
axis([-200000 200000 -50 0])
|
function [C, flag] = MatrixMulti(A,B)
% MatrixMulti realize multiplication between two matrix.
% Initializaitons
flag = true;
Asize = size(A);
Bsize = size(B);
C = zeros(Asize(1),Bsize(2));
aux = 0;
% Check if operation is possible
if Asize(2) ~= Bsize(1)
flag = false;
return;
end
% Matrix multiplication
for... |
%optim_running written 2-3-18 by JTN to run optimization routine
%several times over
clear all; clc
%q_ols = cell(7,8,4);
%J_ols = zeros(7,8,4);
IC_str = '_front';
model_str = 'root';
q_ols = cell(7,21,5);
J_ols = zeros(7,21,5);
num_it = zeros(7,21,5);
num_it_auto = zeros(7,21);
data_str = 'advection_art_data_front... |
function [W, b, Loss] = MyMLP(X,Yd,k,lambda,Act_fun,eta,epoch_num)
% Train a multilayer perceptron neural network
% Input:
% X: d x n data matrix
% Y: p x n response matrix
% k: T x 1 vector to specify number of hidden nodes in each layer
% lambda: regularization parameter
% Act_fun: Which Activation F... |
function [out] = GPR_CurbNew_IV(data, ValidIdx, options0, InitHyp)
PtsNumThr = options0.PtsNumThr;
epsilon = options0.epsilon;
MinPts = options0.MinPts;
tData = options0.tData;
tDist = options0.tDist;
IS_SHOW = options0.IS_SHOW;
if size(data, 2) ~= 2
data = data';
end
if size(data, 2) ~= 2
error('... |
function testfunction(input_file, output_file)
input_vars = load(input_file)
save(output_file, 'input_vars')
|
location_file = '../data/car_image_location.txt'
tag_file = '../data/car_image_tags.txt'
n_region = 50;
n_topic = 10;
lambdaB = 0.1;
locations = importdata(location_file)
raw_tags = importdata(tag_file)
tags = spconvert(raw_tags)
[priors, mu, sigma, Pwz, Pzr] = LGTA(tags, locations, n_region, n_topic, lam... |
function [y varargout] = reconstructMPOCS(y, lx, ux, N, M, lambda)
% Reconstruction of bounded signal using projection onto convex sets
% y - initial estimate
% lx - signal lower bound
% ux - signal upper bound
% N - length of signal (bandwidth = 0.5Hz)
% M - number of iterations
... |
function history = algorithm_bop(algo,algoset,probstruct)
algoptions.TolFun = probstruct.TolFun; % Standard TolFun
algoptions.Ninit = 50;
algoptions.MaxFunEvals = probstruct.MaxFunEvals;
algoptions.PopSize = 200;
algoptions.OptimizationMethod = 'mcs';
algoptions.SelectionMethod = 'one';
algoptions.Training... |
%6-link mobile manipulator
clc;
close all;
clear;
format long;
global aa rr Talpha mmm nnn h l1 l2 l3 l4 l5 l6 b d r xc yc init mm nn pp;
global R n m n3m1 sBound A alpha Nalpha bP dP dM In3m1 R_noise gol;
global T qa qP qM qDp qDm beta q0 theta0 Pinfty Minfty gamma myInf ...
cclalpha taskstartangle;
global fla... |
% test matching orbit bump
% test errors and correction functions
close all
clear all
addpath(genpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/correction/'));
addpath(genpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/errors/'));
% load lattice
s28d=load('/machfs/liuzzo/EBS/S28D/LATTICE/AT/S... |
% This matlab script analyzes the time response of the hoverboard chassis/base due to a force input
%%%%%%%% Free-body Diagram %%%%%%%%
%
% ______________________________
% | |
% | m_chassis | <-- F_u
% | _______________... |
function EVs = create_EVs_struct (EVs_number,condition,templateDir, templateName)
% creates a struct file that is used to generate the EVs portion of a fsf
% file for FEAT analysis in FSL.
% For an explaination of the fields in the struct, refer to the #text
% portion in write_fsf_template (or in any fsf file).
% Jun... |
function BnBOptimization(BnB_root)
% function solves the following optimization problem:
%---------------------------------------------------------------
%
% min_x x^T * BnB_root.Cost
%
% such that: x(:) in {0,1}
% BnB_root.EQmatrix * x == BnB_root.EQvector
% ... |
function plotMatlabOutputs(fileName,Type)
% plot the MATLAB outputs
%
% Written by T.Y. Yang on 09/12/2009
% load the Matlab outputs
load(fileName);
% select the plot cases
switch Type
%%%%%%%%%%%
case 'DMNR'
% plot the element hysteresis
figure;
for j=1:numElem
... |
function []=plotDemand(skus_to_plot)
symbolKey = trainForesight;%'o+*x^#w@$';
t0=datenum('5-Jan-2014');
xlTimes = xlTimes+t0;
newTotTime=[xlTimes,xlTimes(nt)+timeInc*(1:max(trainForesight))];
legendTerms = {'Historical Demand'};
for i = 1:dimOutput
legendTerms{i+1}=[num2str(trainForesight(i)),'-Timestep Predictio... |
function y = sigmf(x,b)
u = 1 + exp(-b(1)*(x-b(2)));
y = 1./u; |
function tvregsimpleplot(state, iter, delta, u, h) %#ok<INUSL>
%TVREGSIMPLEPLOT A simple plot callback to use with tvreg
% TVREGSIMPLEPLOT(state, iter, delta, u) plots the grayscale or color
% image u on the current axis, and displays the iteration number iter in
% the axis title. This function can be passed a... |
cwd = fileparts(mfilename('fullpath'));
gemini_root = [cwd, filesep, '../../../GEMINI'];
addpath([gemini_root, filesep, 'script_utils'])
addpath([gemini_root, filesep, 'setup/gridgen'])
addpath([gemini_root, filesep, 'setup'])
%WHERE TO PUT THE GRID FILES, ETC.
outdir=[gemini_root, filesep, '../simulations/input/KHI_... |
classdef SpectrumMaskCreatorInterface < handle
%SpectrumMaskCreatorInterface Interface for spectrum mask creatrs
methods (Abstract)
[cellMask, pureWaterMask] = CreateMask(obj, spectrum)
end
end
|
function [Phi, Phi_t, Lambda, M, S] = calc_eigen_functions(shape,k)
% Linear FEM
[M,S]=laplacian([shape.VERT(:,1) shape.VERT(:,2) shape.VERT(:,3)],shape.TRIV);
M = diag(sum(M,2));
[Phi,Lambda] = eigs(-S,M,k,1e-5);
Lambda = diag(Lambda);
[Lambda,idx] = sort(Lambda,'descend');
Phi = Phi(:,idx... |
function HW4_Q5()
%SLIC
I=imread('/Users/user/Desktop/HW4/im023.jpg');
%imshow(I);
II=rgb2lab(I);
S=16;
Lx=fix( size(I,1)/(S*2) );
Ly=fix( size(I,2)/(S*2) );
X=S:2*S:3304;
Y=S:2*S:4408;
C=zeros(Lx*Ly,5);
for i=1:Lx
for j=1:Ly
C(Ly*(i-1)+j,:)=[II(X(i),Y(j),... |
function file = writePLYhead(PLYfilename, pointCount)
file = fopen(PLYfilename,'w');
fprintf (file, 'ply\n');
%fprintf (file, 'format ascii 1.0\n');
fprintf (file, 'format binary_little_endian 1.0\n');
fprintf (file, 'element vertex %d\n', pointCount);
fprintf (file, 'property float x\n');
fprintf (file, 'property flo... |
function [seg]=seg_str(data, options,tr,all_cl,str_tr, str_lo, str_mo, str_co)
t = 1;
[tr_XYTRGB,tr_id]=quick_tr(tr);
tr_ins = find(tr_XYTRGB(3,:)==t);
str_ins = all_cl(tr_id(tr_ins));
tr_lo = tr_XYTRGB(1:2,tr_ins)';
tr_loind = sub2ind([data.height data.width], int16(tr_lo(:,2)), int16(tr_lo(:,1)));
label = da... |
function [ ] = visualizeEnergyEllipse( model_str, trial )
%VISUALIZEENERGYELLIPSE Summary of this function goes here
% Detailed explanation goes here
close all
addpath('/Users/nimafazeli/Documents/MATLAB/2017 01 - Learning Contact New Data/models')
addpath('/Users/nimafazeli/Documents/MATLAB/2017 01 - Learning Cont... |
% Esercizio 1.2. Si modifichi la precedente routine cosi` da studiare
% l'approssimazione, similmente all'esempio precedente, delle funzioni:
% abs(x-0.3), exp(x^2), exp(x), sin(x), sinc(x) = sin(x)/x.
clear all; esempio = 6;
d = [-1, 1]; %intervallo
switch esempio
case 1
ff = @(x) 1./(1+25*x.^2)... |
% Copyright (c) 2012 Howard Hughes Medical Institute.
% All rights reserved.
% Use is subject to Janelia Farm Research Campus Software Copyright 1.1 license terms.
% http://license.janelia.org/license/jfrc_copyright_1_1.html
classdef UnitConvertingExternalDevice < Symphony.Core.ExternalDeviceBase
pr... |
function InputProperty = InputProperty(n,property_level,energy_cost)
load Net;
Property = zeros(n,2);
for i=1:n
Property(i,1) = ceil(rand*property_level);
Property(i,2) = ceil(rand*energy_cost);
end
Net_location = Net;
save('Net_location.mat','Net_location');
save('Property.mat','Property');
Net = [Net,Pro... |
function BER = simple_channel(h)
%% Computes the BER of transmission over a simple channel with equalizer h
% Input:
% - h : coefficients of the FIR equalizer
% Output:
% - BER : bit error rate
% Channel variables
sigma2 = 0.001;
c = [0.4032 0.3992 0.1976];
% Simulation variables
Nbits = 1e4; % number of... |
function [colouredPointCloud] = colorPointCloud( pointCloud, color )
if(size(color,1)<size(color,2))
color = color';
end
colouredPointCloud = [pointCloud;repmat(color,1,size(pointCloud,2))];
end |
function SetProgressText(str)
global D3d_Progress_tb
set(D3d_Progress_tb,'String',str,'Visible',true,'Enable',true);
end
|
clear;
ccc_table = load('CCCtable_2antenna', ...
'CCCtable_conv_SINRp_alphap_QAMq_QAMp', ... % no joint ml detection
'CCCtable_prop_SINRp_alphap_QAMq_QAMp'); % joint ml detection
%% Randomize:
rng('Shuffle');
%% Model parameters:
num_users = 5;
num_cell = 7; ... |
% Author: Daniel Rubak
% Functionality: drawing vector box
close all;
clear all;
clc;
% axis ranges
min = -5;
max = 5;
% declaration of figure
figure('Name', 'Pole pradowe', 'Numbertitle', 'off', 'Color', [1 1 1]);
hold on;
grid on;
% arrow drawing
p11 = [0 min];
p12 = [0 max]; ... |
% The class for arbitrary body
% Methods: Body2d(x,y,ccw) x,y: coordinates; ccw: (counter)clockwise
% glide(self,theta,a,b,x0,y0) theta: Angle; a,b: coordinates
% moved; x0, y0: origin of the pitch axis
% Added 20210219: acceleration, velocity of the body
classdef Body2d < handle
properties
... |
function [Y_pred, A] = LSTM_predict(X, param, r_or_c, amp_noise, noise_samples)
% X: input data, shape: (n_input, m_test, t_time)
% param: struct containing the following:
% 1) W_f: weight matrix of forget gate, shape: (n_hidden, n_hidden + n_input)
% 2) b_f: bias of the forget gate, shape: (n_hidden, 1)
... |
function pls_figures(RESULTS, PLS_NumComp,X_TABLE, Y_TABLE,...
Table_permuted_index)
if PLS_NumComp == 1
%disp('Cannot build plots with only one PLS component');
pls_figures_OnePLS(RESULTS, X_TABLE, Y_TABLE, ...
Table_permuted_index);
return
end
if size(Y_TABLE,2) >2
figure
plot(scaledata... |
function loops = polygonLoops(poly, varargin)
%POLYGONLOOPS Divide a possibly self-intersecting polygon into a set of simple loops.
%
% LOOPS = polygonLoops(POLYGON);
% POLYGON is a polygone defined by a series of vertices,
% LOOPS is a cell array of polygons, containing the same vertices of the
% origina... |
%%in barnamei baraye MOTION BLUR(frequncy) ast,BARAYE
%EJRAYE BARNAME HAME BARNAME RA ENTEKHAB KARDE(Ctrl+A & Ctrl+C)VA DAR Command
%Window MATLAB PASTE KONID.
clc
clear all;
close all;
a=0.3;
b=0.5;
T=1;
Img_in=imread('cameraman.tif');
[M,N] = size( Img_in );
[X,Y] = meshgrid(1:N, 1:M);
Y = Y - floor( M/2 );
X = X - ... |
function [xCS,ints,ind,target] = icoshift(xT,xP,inter,n,options,Scal)
% interval Correlation Optimized shifting
%
% [xCS,ints,ind,target] = icoshift(xT,xP,inter[,n[,options[,Scal]]])
%
% Splits a spectral database into "inter" intervals and coshift each vector
% left-right to get the maximum correlation toward a ... |
%@(#) setaxplot.m 1.2 94/01/25 12:43:27
%
function h=setaxplot(pos);
curf=gcf;
clmap=setprop(3);
handles=get(gcf,'userdata');
if nargin==1,
h=figure('position',pos);
else,
p=get(gcf,'position');
pnew=p;
pnew=[5 p(2) 540 420];
if (p(1)+p(3))<600, pnew(1)=580;end
h=figure('position',pnew);
end
eval(c... |
function [] = check_output_dir_exists( dir_path )
%check_out_dir_exists creates the path if it does not exist
%check whether the path is absolute
isabsolute = false;
if isunix
if isequal(dir_path(1),'/') || isequal(dir_path(1),'~')
isabsolute=true;
end
else
%untested on windows
if isequal(dir_... |
function params = generateRandParams(weigthsfilters,possible,quantewind)
% Random filters generator: generates a structure of filter parameters
% selects
% - a type,
% - a set of bands to be filtered
% - a set of filter parameters (sizes, orientations, ...)
%
% and saves them in the structure params
%
% pa... |
function [A_norm]=vecnormalize(A)
if isvector(A)
H=sqrt(sum(A.^2));
else
H=sqrt(sum(A.^2,2));
H(H==0)=eps;
H=H*ones(1,size(A,2));
end
A_norm=A./H;
end |
N=379;
L=914;
p=L/(N*(N-1)/2);
ER=cell(1,100);
degree=cell(1,100);
numbers=cell(1,100);
counts=cell(1,100);
for i=1:100
ER{i}=rand(379,379)<p;
ER{i}=triu(ER{i},1);
ER{i}=ER{i}+ER{i}';
for j=1:379
A(j,i)=sum(ER{i}(j,:));
end
degree{i}=A(:,i);
numbers{i}=unique(degree{i});
... |
close all;
%% General parameters
% DCE map size to fit to
num_rows = 256;
num_cols = 256;
% Dimension of slices (of CBF/MTT map)
slice_dim = 3;
% Map to choose (CBF/MTT etc.)
Map_To_Choose = 'MTT';
% Maximum value from which we zero voxel's value
Max_allowed_val = 15;
% Slice to display in debugging
Slice_num_to_d... |
function [T,I,Y]=perfusionResponsepotentP2X4coop2back(y0,ton,toff,Ttot)
ode=modelODEpotentP2X4coop2back(ton,toff);
[T,Y]=ode15s(ode,[0 Ttot],y0,odeset('NonNegative',1:21));
I=getTotalCurrentpotentP2X4coop2back(Y);
end |
%% SPECIFY CONSTANTS
DIM = 2;
INTERVAL = [-1, 1];
NUMPTS = 100;
NUM_REPEAT = 1000;
numIt = zeros(1, NUM_REPEAT);
disag = zeros(1, NUM_REPEAT);
doPlots = false;
doErrorEstim = false;
plotX = linspace(INTERVAL(1), INTERVAL(2), 100);
for kk = 1:NUM_REPEAT
%% DEFINE A LINE
linePts = INTERVAL(1) + (INTERVAL(2) - INTER... |
function printResults(dataset)
%PRINTRESULTS prints out results as formatted tables
% PRINTRESULTS(dataset) searches all the experiment
% directories and prints out the best results as
% formatted tables
expDirs = getExpDirs(dataset);
results = cellfun(@(x) getBestResult(x), expDirs, 'UniformOutput', false); ... |
%%
% This is an example of how to display a simple image in MATLAB®.
%
% Read about the <http://www.mathworks.com/help/matlab/ref/image.html |image|> function in the MATLAB documentation.
%
% For more examples, go to <http://www.mathworks.com/discovery/gallery.html MATLAB Plot Gallery>
%
% Copyright 2012-2014 The... |
function disparity_map = stereo_computation(I_left, I_right, min_disp, max_disp, w_size, cost)
% Function that computes the disparity between a pair of rectified
% images using a local method based on a matching cost
% between two local windows.
%
% The input parameters are 5:
% - left image
% - right image
% - minim... |
function [output_alleles, intervals, error] = check_allsegments(assignment, family)
error = 0;
output_alleles = [];
intervals = [];
if( isempty(family) )
error = 1;
disp('error in family structure');
return;
end
if( isempty(assignment) )
error = 1;
disp('error in global IBD');
return;
end
fu... |
Tsample=.01;
Ttotal=1 ;
Ton=.05;
Toff=.2;
amplitude=1;
[s,t]=triSigGenerator(Ttotal,Tsample,Ton,Toff,amplitude);
close all;
plot(t,s,'linewidth',2);
S=fft(s);
figure();plot(S) |
%%%%%%%%%%%%%%%%%%%%%%
%LDA & NB for mobile data classification
%import and pre-process data
training_set = dlmread('~/Desktop/Data Mining & Machine Learning/Data Mining Competetion/training_data.csv');
training_labels = dlmread('~/Desktop/Data Mining & Machine Learning/Data Mining Competetion/training_labels.csv');
t... |
clear all
close all
clc
%% User specification
data_set = 2; % 1 = parking, 2 = kitti, 3 = malaga
seconds_between_iteration = 0.1; % seconds of pause between iteration (allow figure to show up)
seconds_pause_keyframe = 0.0;
%% Import
addpath('./plot');
addpath('./localization');
addpath('./triangulation');
addpat... |
function [A]=tis3(x,i)
%casova invariantnost systemu y[n]=y[n-1]+x[n]
%tis3(x,i) x vektor vstupniho signalu, i posun o i-vzorku
%vyzaduje funkci fun3.m
y=fun3(x);
d=length(x);
A=[];
for k=d+1:d+i
y(k)=0;
end
%figure
subplot(311);
stem(y,'fill');
set(gca,'XTick',[1:d+i]);
ylim([min(y)-1 max(y)+1]);
title('vystupni ... |
clear; global s
dt = 1/1e4;
f = 100;
s = daq.createSession('ni');
s.addAnalogInputChannel('Dev1', [0 1 2 3], 'Voltage');
s.Channels(1).Range = [-5 5];
s.addAnalogOutputChannel('Dev1',0,'Voltage');
s.Rate = 1/dt;
A = logspace(-3,0,100)';
t = (0:dt:(1-dt))';
raw = cell(length(A),3);
if s.IsLogging; error('DAQ is ru... |
function [world_obj,homoPts]=ForwardIntersection(left_obj_pts,left_L,left_x0,left_y0, ...
right_obj_pts,right_L,right_x0,right_y0,...
left_ctrl_pts,right_ctrl_pts)
%Step 1: Extract Homonymy points.[input: obj_pts; output: homoPts]
loc=1;
for i = 1:... |
function [ClassRate,num1,label]=rulelearning_test_r(training,testS,testL,number)
% Inputs:
% training: trainig samples
% testS:test samples
% testL:label of test set
% number:the number of seleted rules on training set
% Outputs:
% ClassRate: the classification accuracy on the test set
% num1: the number of sel... |
function [ newvec ] = moveto_primitive_method2( vec1,vec2,targetvec )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
% vec1,vec2 components are "integers"
n1vec=[-vec1(2),vec1(1)];
n2vec=[vec2(2),-vec2(1)];
bvd1=dot(n1vec,vec2);
bvd2=dot(n2vec,vec1);
proj1=dot(n1vec,targetvec);
pro... |
function [state] = update_state (state,handle,read,TAB,IDL,mode)
switch read
case 'CP'
if mode == 1 %Temperature and pressure are known
[state.rho,state.h,state.s,state.Q,~] = CP5('PT_INPUTS',state.p,state.T,'D','H','S','Q','T',handle);
elseif mode == 2 %Enthalpy and pressure are kn... |
%% 模拟数据分析
clc;
close all;
clear;
currentPath = fileparts(mfilename('fullpath'));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%下面是需要设置的参数,本程序仅在此需要更改参数,其他地方不需要更改
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
useGUI = 1;%如果需要合并多个数据为一个,不能使用GUI,需要从53行开始进行手动设置
rpm = 420;... |
function sl_customization(cm)
cm.ExtModeTransports.add('ert_rpi.tlc', 'tcpip', 'ext_comm', 'Level1');
%end function
|
%clear
%clear classes
capFirst = @(str) [upper(str(1)) str(2:end)];
randStrFn = @() capFirst(char(randi(double(['a', 'z']), 1, randi([3 7]))));
bdayLims = [datenum(datevec('1/1/1950')) datenum(datevec('12/31/2000'))];
randBdayFn = @() datestr(randi(bdayLims));
randGenderFn = @() subsref(randsample({'male', 'female'}, ... |
function [ a ] = matrix1( n )
% to create a matrix according to the rules discovered
a = zeros(n,n+1);
for i=1:n
a(i,i) = -1;
end
for i=1:n
a(i,i+1) = 1;
end
end
|
% Erzeuge PKM mit EE-FG 3T2R
% Moritz Schappler, moritz.schappler@imes.uni-hannover.de, 2020-03
% (C) Institut für Mechatronische Systeme, Leibniz Universität Hannover
clc
clear
% Siehe parroblib_update_csv
parroblibpath=fileparts(which('parroblib_path_init.m'));
restab1=readtable(fullfile(parroblibpath, 'synthesis_... |
function Corr = pa_predictvocal(strfFname,vocFname,dname,sndFiles)
% PA_PREDICTVOCAL
%
% Assumptions: 0.25 octave, 2.5 octave bandwidth
%% Initialization
close all
if nargin<2
vocFname = 'joe6711c01b00.mat';
% vocFname = 'nep';
end
if nargin<1
strfFname = 'joe6715c01b00.mat';
% strfFname = 'nep';
... |
%Drill Axis Calibration Test
%CISC 330 - Computer Integrated Surgery
%Assignment 3
%Grace Pigeau 10187678
%
%Purpose: Test the accuracy of the drill axis calibration function
function DrillAxisCalibration_test(truth)
trialCount = 1;
amntRight = 0;
%for range of 30, 90, 180, and 360 degrees
for ix = [... |
function [ras, cellsize] = rasterize(data, remove, dim1, dim2, eps, ras)
%note that this must be equal, otherwise will change later cellsizes used
%in generating the random datasets; if needed revise later
cellsize = eps;
rdim1 = ceil(dim1/cellsize);
rdim2 = ceil(dim2/cellsize);
if max(size(ras)) == 0
ras = zer... |
%% Main Rotation portfolio's
rot = load('rotation_data4.mat');
rot2 = load('rotation_data.mat');
rot_MA = load('rotation_MA.mat');
PCA = load('rot_PCA.mat');
eff_PC = PCA.eff_PC;
rot_PC_eff = rot2.rot_PC_eff;
rot_PC_MA = PCA.rot_PC_MA;
rot_PC_PM = PCA.rot_PC_PM;
%important
rot_old = rot2.rot_old;
rot_ar1_... |
'D optimal'
examinee_record_D_practical = zeros(size(theta,1),test_cali);
item_record_D_practical = zeros(J,target_sample);
unselect = index_cali;
item_finish = [];
random_sample_size = 50;
sparse_D_practical = 9*ones(N,J);
power = .1;
% first 50 examinee randomly choose items
for examinee = 1:random_sample_size
u... |
function [] = npend(N,g,nsteps)
T=20*pi/sqrt(g);
x0=pi/2*ones(N,1);
v0=zeros(N,1);
u=[x0,v0];
figure(1);
z=[0;cumsum(-1i*exp(1i*u(:,1)))/N];
hp=plot(real(z),imag(z),'.-b');
xlim([-2,2]);
ylim([-2,1]);
axis manual;
pbaspect([1 1 1]);
t=linspace(0,T,nsteps);
h=t(2)-t(1);
for i=2:nsteps
u=rk4step(h,g,u);
z=[0;cums... |
%{
#
-> ephys.LFP
-> ephys.LFP
-> reference.ElectrodeConfigElectrode
-> reference.ElectrodeConfigElectrode
---
(lfp) -> ephys.ExternalEphysStore
(lfp) -> ephys.ExternalEphysStore
%}
classdef LFPChannelLFP < dj.Imported
methods(Access=protected)
function makeTuples(self, key)
%!!! compute missing fields for ... |
% === Dominion_Full() ===
TopologyCaseName = 'Dominion_Full';
TopologyCaseNum = 1;
Start_date = '1/1/2020 00:00:00AM'; % fictional
Line_outage = 0;
TX_outage = 0;
SR_outage = 0;
Boundary_outage = 0;
|
function sthlm3_extractFeatures(inputimagefile,tissuemaskfile,outputfile,varargin)
% sthlm3_extractFeatures - Extract features from image.
%
% sthlm3_extractFeatures(inputimagefile,tissuemaskfile,outputfile, ...)
%
% Extracts numerical features from whole slide image in blockwise manner
% and stores them.
%
% Required... |
function [Xv, Zv, Gt] = sample_problem()
C1t = [-2, 2, 3]';
C2t = [-2,-2, 3]';
C3t = [ 2,-2, 3]';
C4t = [ 2, 2, 3]';
% q is parameterized by [a,b,c];
[R1, q1] = simpleRot(C1t, [ 2,-2, 0]');
[R2, q2] = simpleRot(C2t, [ 2, 2, 0]');
[R3, q3] = simpleRot(C3t, [-2, 2, 0]');
[R4, q4] = simpleRot(C4t, [-2,-2, 0]');
[X, Y] ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.