text stringlengths 8 6.12M |
|---|
function [sarval]= sar( high,low,AFstart,AFmax,AFdelta)
%% Parabolic SAR计算,按照easylanguage中对应函数编写
% default AFstart = 0.02, AFmax = 0.2, AFdelta = 0.02;
% version 1.0 yanzhang 2013/4/19
%% 参数选择
% defults AFstart, AFmax, AFdelta
if nargin==2
AFstart=0.02;
AFmax=0.2;
AFdelta=0.02;
elseif nargin==3
AF... |
function test_dataset3Params()
% dataset3Params.m - Parameters to use for Dataset 3
% Note: for passing this tests you have to modify dataset3Params function!
% for the test purposes I changed dataset3Params function signature to:
% function [C, sigma] = dataset3Params(X, y, Xval, yval, C_vect, sigma_vect)
% and a... |
function [posi_data] = Inter2Max(data,a,b)
len = length(data);
M = max([a-min(data),max(data)-b]);
posi_data = zeros(len,1);
for i = 1: len
if data(i) < a
posi_data(i) = 1-(a-data(i))/M;
elseif data(i) > b
posi_data(i) = 1-(data(i)-b)/M;
else
posi... |
function [ flagSuccess ] = exportSimTimeToCsv(simTime, ...
presets, carrierFreqsInMHz, pathToSaveCsv, roundNumOfDigit)
%EXPORTSIMTIMETOCSV Save simulation time values to a human-readable .csv
%file.
%
% Example content of the .csv file:
%
% Carrier\Scenario Tipp WHIN Indiana
% 1900MHz
% 3700MHz
% 4700MHz
... |
function [t, u] = rk4_wrapper(odefun, tspan, y0, h)
t = tspan(1):h:tspan(2);
u = zeros(length(t), length(y0));
u(1, :) = y0;
for i=2:length(t)
u(i, :) = rk4(h, odefun, t(i-1), u(i-1, :)');
end
end |
function y = Fx(f,u1, u2)
% tic
% F = inline(f);
% disp(f);
% disp('inline');
% disp(toc);
% tic;
% disp('calc');
y = f(u1,u2);
% disp(toc);
|
clear
pat = patienten;
% close all
timerange = [-0.5 1];
freqrange = [13 35; 40 90] %; 100 250;];
franges = {'beta','gamma'}; %,'hfo'};
med={'ON','OFF'};
conds = {'onset-klein'; 'onset-mittel'; 'onset-gross'};
for b=1:size(freqrange,1);
non=0;
noff=0;
for a = 1:length(pat);
if ~isfie... |
function [args]=ae_train(args,layer_i)
global train_data test_data;
tic;
h=waitbar(0);
[batchSize,numDim,batches]=size(train_data);
for i1=1:args.maxecho
% waitbar(0,h,strcat('第',num2str(i1),'/',num2str(args.maxecho),'次迭代'));
for i2=1:batches
[args,error]=ae_gradient(... |
% main.m - Define meta parameters and run the algorithm with a simple maze, producing a graph similar to
% that appearing in the paper.
% k - number of samples for each state-action
% Episodes - number of Episodes
% Num_of_Agents - Number of concurrent agents
% times - number of repeats of the same expe... |
function [ output ] = crossoverga( population,crate )
[m,n]=size(population);
k=round(m/crate*100);
for i=1:k
d1=randi(m);
d2=randi(m);
r1=randi(n-3);
r2=randi(n-3);
if r2<r1
c=r2;
r2=r1;
r1=c;
end
c=population(d1,r1:r2);
population(d1,r1:r2)=population(d2,r... |
%given a preselected image sequence, compute XCSLBP w/ Gaussian Mixture Model
%Based on GaussianMixtureModel.m
%result- no noticable result again, seems slightly worse than adaptive
%background
addpath('../')
clear; clc;
%loc = fullfile('C:\Users\jusfo\Desktop\Thesis B\Matlab XCSLBP Test\Sample'); %smoke... |
% read data
T = readtable('iris.dat');
iris_X = table2array(T(:,1:4));
iris_Y = table2array(T(:,5));
% map iris classes to numbers
M = containers.Map(unique(iris_Y),[1,2,3]);
iris_Y = map(iris_Y, M);
% perform PCA on iris feature vectors
projected_data = PCA(iris_X,3);
[centroids, Y] = k_means(iris_X,3,100,0.01);
n... |
%=============================================%
%--------------3-Player TicTacToe-------------%
%---------------------------------------------%
%---------------BY: P/O SULEMAN---------------%
%=============================================%
function tictactoe_3player
%-----initializing-----
clc;
clear all;
... |
%%0-9,a-z, 0-9,10-35, null = 36
fid = fopen('annotation_test.txt', 'r');
train_len = 7224612;
val_len = 802734;
test_len = 891927;
data = single(zeros(32, 100, 1, test_len));
label = single(zeros(23, test_len));
counter = 0;
h5filename = 'test_data.h5';
path = fgetl(fid);
while ischar(path)
counter = counter + 1... |
function plotData(rawData,times)
%%% plot the raw data
figure(1)
clf()
subplot(2,2,1)
plot(times,rawData(1,:))
hold on
plot([0 max(times)], [0 0], 'k--')
hold off
title('Channel 0')
ylabel('Voltage')
xlabel('Time')
subplot(2,2,2)
plot(times,rawData(2,:))
hold on
plot([0 max(times)], [0 0], 'k--')
hold off
title('Chan... |
function [C, R, X0] = DisambiguateCameraPose(Cset, Rset, Xset)
%given four camera poses and triangulated points for each, find the actual
%camera pose by checking the cheirality condition
%X should be 3xN
max_count = 0;
for i=1:4
Ccur = Cset{i};
Rcur = Rset{i};
Xcur = Xset{i};
xmc = bsxfun(@minu... |
% estimate distribution of amplitudes for adaptor
% 100 sec sound
P.ADAPT_seed=47; P.buf_pts=30000000; P.stim_Fs=30000; P.TEST_ramp=5;
HRTF.directory='/Users/cvitanovich/Documents/MATLAB/tak-lab/HRTFs/Matlab_V6/';
HRTF.fname='1073AC_eq_ABLequal_norm.mat';
P.HRTF_fname=HRTF.fname;
P.HRTF_directory=HRTF.directory;
% pre... |
% #########################################################################
% TUHH :: Institute for Control Systems :: Control Lab
% #########################################################################
% Experiment CSTD1: Identification and Control of a Torsional Plant
%
% Copyright Herbert Werner and Hamburg... |
%% test_sys_helical_scatter.m
% This test script is mainly for testing the helical system geometry,
% helical reconstruction, and scatter simulation.
%
% Meng Wu at Stanford University
% 2013 - 2014
%% Load simulation parameters and datas
load 'temp.mat';
% load phantom
[phan, map] = loadXCATPhantom(p);
turns = 6;... |
%%%%%%%%%%%%%%%%%%%Load recording data%%%%%%%%%%%%%%%%%%%%%%%%%
%NOTE: Alter the following path to point to the folder containing all the
%training data.
trainRecordings = getRecordings('../training_data/');
%%%%%%%%%%%%%%%%%%%ENF Extraction %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
frame_size = 5; %size of a frame (ENF poi... |
function [Model]=train()
load('Model.mat');
%feature= ExtractFeature(X); % feature is nData*nFeature matrix
feature= TrainFeatures;
nData= size(TrainFeatures,1);
nFeature= size(TrainFeatures,2);
% feature=[1 2 3;
% 2 3 4;
% 3 2 1;
% ];
% nData= 3;
% nFeature=3;
% K=2;
K=10; %K clusters
centr... |
%% Homodyne Reconstruction Demo
clear;
close all;
clc
%% single-channel T2-weighted data
% load 'T2_single_channel' % Image borrowed from package https://mr.usc.edu/download/loraks2/
% kspace = kData; % K space
% [nvx nvy] = size(kspace);
%% single-channel Baseline Cardiac Image
load 'Cardiac_FS_Image'
kspace = Ca... |
function Q = turbflw(k,PR)
% Q = TURBFLW(k,PR)
% Calculates turbine flow [m^3/(s sqrtK)]
% Q = k(1).*sqrt(1-PR.^k(2));
%
% Data:
% k : vector of parameters to be fitted (1x2)
% PR : pressure expansion ratio [-]
% Output:
% Q : turbine flow [m^3/(s sqrtK)]
%
% Author: Andreas Torp Karlsen (... |
classdef al_trialflow
%AL_TRIALFLOW This class definition file specifies the
% properties and methods of a trialflow object
%
% A trialflow object determines the components of a trial
% such as whether the cannon is shown or hidden, and whether we
% present confetti or cannonballs.
... |
function newAngle = WristR_correct(rightWristAngle_raw)
if (rightWristAngle_raw >155) % Perpendicular pose of wrist
newAngle=0.65; % Wrist joint value for straight pose
else
newAngle=0.2; %Wrist joint value for Up/Dowm pose
end
end |
%% Section 4.5.3 Kernel ridge regression
% This page contains simulations in Section 4.5.3.
close all; clear; clc
testcase='mixed'; % (among means,var,orth,mixed,MNIST,cifar10)
kernel='gauss'; % (among poly,poly_zero,gauss,linear)
k=2;
switch testcase
case 'means'
p_over_n=4;
p=256;
cs=[... |
function value=ice_inverse_kaiser_bessel( x, W, beta)
arg = pi*pi * W*W * x*x - beta*beta;
if ( arg >= 0.0 )
arg = sqrt( arg );
if ( arg < 1.0e-4 )
dsinc = 1.0 ;
else
dsinc = sin( arg ) / arg;
end;
invKB = dsinc * beta / sinh(beta);
else
arg =arg.* -1.;
arg = sqrt( arg ... |
function [bin,qcf,binq]=en_sub(sub,n,delta0)
[cf_tem,abssb,sb]=coef_scan3d(sub,sub,n);
[qcf,binq,qctr]=quant_sub(sb,delta0); %ctr1 %%%%%%%%%%%%%%%%%
len=length(qcf);
if qctr==1
sn=zeros(1,length(n));
cf0=abs(qcf);
lensn=0;
for ia=1:len
if qcf(ia)>0
lensn=lensn+1;
sn(lensn)=1;
... |
function pathToRawData = callDatasetBasePath(specStruct)
% this function exist to serve a single modification point for all the
% local installations for all data, as oppose to having to update the
% pathing information in numerous different places.
basepath = 'C:\Documents\aslab\data\'; % if all your... |
% generate a random index due to prior
function N = randomDiscrete(prior)
C = length(prior);
u = rand;
cdf = 0;
for i = 1:C
cdf = cdf + prior(i);
if u <= cdf
N = i; break;
end
end
end
|
function yaw = processTrials(directory)
folders = dir(directory);
t = 1;
for f = 1:length(folders)
foldername = folders(f).name;
if strncmp(foldername,'.',1) || ~strcmp(foldername((end-8):(end-4)),'_clip')
continue
end
trialname = foldername(1:29)
filename = sprintf('./%s/%s', directory, fold... |
function CC_merge_clusters(varargin)
H=varargin{1};
handles=guidata(H);
handles2.figure1=handles.figure1;
handles2.figure2=figure(2);
time_axis=handles.time_axis;
time_axis_slice=handles.time_axis_slice;
set(handles.figure1,'Units','Pixels');
main_window_position=get(handles.figure1,'Position');
set(hand... |
function y = CPT1NG(w,t,r,mid)
z= @(x) exp(-t)*((r*t)/(2*pi))^.5*exp(-(x-1).^2*r*t/2)+.25*exp(t/(8*r)-t*x/2).*(erf(((r*t/2)^.5)*(x-1/(2*r)))-erf(((r*t/2)^.5)*(x-1-1/(2*r))));
if w == 0
y=integral(z,-1000,mid);
end
if w ==1
y=1-integral(z,-1000,mid);
end
end |
%% Implementation for Paper: OPTIMIZATION-BASED REPRODUCTION OF DIFFUSE AUDIO OBJECTS
% by Andreas Franck, Filippo Maria Fazi (Institute of Sound and
% Vibration Research, University of Southampton) and Frank Melchior
% (BBC Research & Development)
%% Initialisation
clear;
close all;
% plots = 'false';
pl... |
function [f,n,xvalues,nu] = histogram_line(d,varargin)
%% create histogram displayed as line graph
% - each bin is a unique value found in d
%% defaults
xname = 'bin';
yname = 'N';
tname = 'histogram';
% displayopt = true;
visible = true;
logscaleon = false;
xloglim = 10000;
yloglim = 10000;
fontsize = 10;
xlog = fals... |
function density = calcDensity( numIons, atomType, Volume)
%%%%%%% This funciton is used to calculate the density of the structure
%%%%%%% unit : g/cm^3
%%%%%%% Added by Guangrui Qian
atomicMass=zeros(1, length(atomType));
for i = 1:length(atomType)
atomicMass(i) = elementMass(atomType(i));
end
dens... |
function p = integerize(A)
m = max(max(A));
if(m<0 || m>intmax('uint64'))
p = 'NONE';
else
if (m<=intmax('uint8'))
p = 'uint8';
elseif (m<=intmax('uint16'))
p = 'uint16';
elseif (m<=intmax('uint32'))
p = 'uint32';
else
p = 'uint64';
end
end |
%% PCA
% training images
n = 20;
x = zeros(n, 45*40); %size(x) = [ 20 x 1800 ]
for k=1:n,
fname = sprintf('%d.png',k);
img = double(rgb2gray(imread(fname)));
x(k,:) = (img(:))';
end;
% pca
c = cov(x); % returns covariance matrix (symmetric matrix)
[v, d] = eig(c); % returns the collection of eigenvectors,... |
function [numopen, denopen, denclsd]=dephlead(num,den,s1)
% Hadi Saadat, 1998
discr=[
' '
' The function phlead(num, den, s1) is used for the design of a phase- '
' lead compensator. num & den are row vectors of polynomial coefficient... |
%% fem.m
function [tr] = fem(x)
% 函数功能:构造模糊等价矩阵,求传递闭包
R = x;
a = size(R);
B = zeros(a);
flag = 0;
while flag == 0
for i = 1: a
for j = 1: a
for k = 1: a
B(i, j) = max(min(R(i, k), R(k, j)), B(i, j));
end
end
end
if B == R
flag = 1;
else
... |
function n = times(k, m)
% kronMatrix .*
%
|
%Calculates BER(Bit Error Rate) for QPSK 2.4 Ghz through the toolbox for a
%variety of different energy per bit to noise power(normalized SNR)
clear;
close all;
%Referncing Zigbee Throughput Analysis paper
symbol_rate = 62500; %symbols/sec
app_payload = 101; %bytes/packet
%time required to transverse CSMA-CA algorithm... |
function [ detections_number] = pilot ( image_adress, treshold_factor)
%On renvoie le nombre total de détections. Les coordonnées sont à chercher
%dans des fichiers.
% startup;
% compile;
image = imread(image_adress);
models = textread('tps/modeles/models.txt', '%s')
detections_number=0;
for i = 1:size(models) ... |
function out = piecewiselinearfit(whaleTime, whaleBearing, windowLength)
% function out = piecewiselinearfit(whaleTime, whaleBearing, windowLength)
% performs a piece wise linear fitting on a series of bearings measured at
% different time instances
%input :
% -whaleTime(Nx1)
% -whaleBearing ... |
classdef iImage < handle
% Some code was inspired by Jan Fröhlich
properties (SetAccess = protected)
img_path
save_counter
data_bayer
dng_info
data_rgb
data_bayer_stack
history
cmv_registers
end
methods
function obj = iImage(img)
if nargin == 1
obj.setHistory('Create image class');
... |
% 315CA Dinu Ion-Irinel
function [Ix, Iy, Ixy] = precalc_d (I)
% =============================================== =======================
% Processing of matrices Ix, Iy and Ixy containing the derivatives dx, dy, dxy of
% of image I for each pixel of it
% =============================================... |
function robot = CreateTX40()
%% robot = CreateTX40()
% Creates a robot model of the TX40 that is compatible with the
% spatial_v2 dynamics library.
d3 = .225;
r3 = 0.035;
r4 = .225;
% Modified Denavit Hartenberg parameters alpha_{i-1}, a_{i-1}, and d_i
% as in J.J.Craig's classic text
dhTable = [0 0 0 ... |
%cytoplasmic resistivity R_i
T = [7.7 9.8 13.0 23.5 29.9 34.9 35.0 37.1]';
q10_i = .8;
ref_R_i = 140; %Ohms*cm
ref_temp_i = 36; %C
calc_R_i = ref_R_i./(q10_i.^((ref_temp_i-T)/10));
calc_R_i = round(calc_R_i*10)/10;
given_R_i = [263.3 251.2 234.9 185.0 160.4 143.5 143.2 136.6]';
mean_sq_error = mean((calc_R_i-given... |
function run_Kilosort_AkermanLab(data_folder, sort_folder, target_rec_nrs, metadata_file, varargin)
% function run_Kilosort_AkermanLab(DATA_FOLDER, SORT_FOLDER, TARGET_REC_NRS, METADATA_FILE, OPTIONS)
%
% Your one-stop-shop for running Kilosort in the Akerman lab pipeline.
%
% Takes openepys .continuous data, reforma... |
function [PC_back,cycle_back,intmem_back]=ORLCBit(PC,cycle,intmem,promem)
intmem_back=intmem;
addr_bit=promem(PC+1,1);
%find bit
if(addr_bit<128)
m=fix(addr_bit/8);
n=mod(addr_bit,8);
addr=33+m;
bit=mod(fix(intmem(addr,1)/(2^n)),2);
else
m=fix(addr_bit/8)-16;
... |
function y = Twogauss(beta0, x);
global spc;
y1 = beta0(2)*exp(-(x-beta0(3)).^2/2/beta0(4)^2);
y2 = beta0(5)*exp(-(x-beta0(6)).^2/2/beta0(7)^2);
y = y1+y2+beta0(1); |
function success = uq_Reliability_test_lognormal(level)
% SUCCESS = UQ_RELIABILITY_TEST_LOGNORMAL(LEVEL):
% Testing reliability analysis with lognormal variables and analytical
% failure probability
%
% See also UQ_SELFTEST_UQ_RELIABILITY
uqlab('-nosplash');
if nargin < 1
level = 'normal';
end
fprintf(['\n... |
function y = sensors(x, k, model_sensors)
% y = sensors(x, model_sensors)
%
% This function is a sensor model, converting the truth state of the
% simulation into something that could have come out of Ranger's sensors.
%
% INPUTS:
%
% x = [z;dz];
% z = [6, 1] = full configuration vector
% dz = [6, 1] = full con... |
% Block Householder QR with Recursion
% Copyright (c) 2016 by Pranay Seshadri
% Golub and Van Loan (page 251 ed. 4)
% Coded July 5th 2016
% Assumes that A has full column rank and nb is a positive blocking
% parameter.
function [Q,R] = qr_BlockHouseholder_Recursive(A, n, nb)
[~,n] = size(A);
if n <= nb
% Compute a ... |
%% fn_multcheck
%% Syntax
% fn_multcheck([n,][properties])
%% Description
% custom uicontrol (row of check boxes)
%% Source
% Thomas Deneux
%
% Copyright 2009-2012
%
|
function [Aout] = CPE_sampleSelection_mQAM(Ain,nTaps,convMethod)
% Last Update: 19/02/2018
%% Input Parameters
nSamples = length(Ain.A1);
classes = fieldnames(Ain);
k = 1;
for n = 1:length(classes)
c = classes{n};
if length(c) == 1
classesQAM(k,1) = c;
k = k+1;
end
end
classesQAM = classe... |
% This code is completely same as the code
% GetFeatureOfComponentUpdated_3ExpWithSpaces. Here in this code, we tried
% to make it more flexible to skip calculating features from those column,
% which has no fore ground pixels and for those columns which has some fore
% ground pixels.
function [storFeatureMat,lukUpTab... |
classdef xyGateFidelity2Pi < qes.measurement
% measure xy gate fidelity.
% simple, fast and coarse, if fine fidelity result is needed, use QPT or RB.
% method: build a multiple 2 pi rotation by the given xy gate and
% measure the |0> state probability
% Copyright 2017 Yulin Wu, University of Science and Tec... |
%% potential
figure
zzr_height=linspace(zr_plot(1),zr_plot(2),zr_plot(3)+1);
[Plot_x,Plot_z]=meshgrid(xxr_height,zzr_height);
Plot_x=Plot_x'; Plot_z=Plot_z';
contourf(Plot_x,Plot_z,Plot_H_ydata_ao,plot_density);
hold on
plot(xxr_height,center_XH_Ao(:,3),'r','LineWidth',4);
hold on
plot(xxr_height,center_XH_TU... |
close all;
res1 = importdata('data/5-3-1-perturbation-min-phase.txt');
res2 = importdata('data/5-3-2-perturbation-non-min-phase.txt');
% time[s] SP[%] MV[%] PV[%]
%Plot the entire data set
plot(res1(:,1)-9, (res1(:,4)-28.77)/33.43, 'g'); hold on;
plot(res2(:,1)-9, (res2(:,4)-28.77)/33.43, 'r'); hold on;
plot... |
function D2 =ray_similarity_metric(ZI,ZJ)
length_weight = 1.0;
% ZI = [ray_x ray_y ray_z]
D2 = zeros(size(ZJ,1),1);
for i = 1:size(ZJ,1)
v1 = ZI; v2 = ZJ(i,:);
D2(i) = length_weight * abs(norm(ZI)-norm(ZJ(i,:))) + acos(dot(v1, v2) / (norm(v1) * norm(v2)));
end
end
% t... |
De functie ones(4,8) genereert een matrix met 4 kolommen,
gevuld met enen. |
function varargout = ind2sub(siz,ndx)
% Modification of the built-in ind2sub to remove unnecessary sanity checks
% and conversions to double, to accelerate the function - it's called many
% times in the inner loop of some functions.
% The built-in documentation:
%
%IND2SUB Multiple subscripts from linear index.
% I... |
clear all; close all; clc;
% cd ../. <- geht einen folder hoch, wird aber bei nächstem programmstart
% aufaddiert, deswegen erstmal manuell (janko):
cd('D:\My Documents\matlab janko\NeuronaleNetze\NeuronalesNetz'); % eingefügt (janko)
newPath = pwd; % geändert von cd auf pwd (janko)
setPath(newPath,true)
... |
function [externalProgramsDir] = getDirExternalPrograms(varargin)
% Returns the directory where external programs are stored. All functions should call this to find external program directory.
% Biafra Ahanonu
% started: 2021.02.02 [10:55:23]
% inputs
%
% outputs
%
% changelog
%
% TODO
%
%============... |
function [ noBubArray_RemBaseVid ] = PP_RemBaseVid( mser_param, vidNo )
% Preprocessing: Removing Base Video
% INPUT: mser_parameters struct, VideoNo
% OUTPUT: noBub array
setup;
% Creating video
addpath('/Users/ihorng/Documents/MATLAB/Oxford/4yp/Bubbles video');
bubbleVideo1 = VideoReader('bubbleVideo1.avi');
r... |
function makeTuples( obj, key )
tic
rsz = 0.25;
import vis2p.*
% get stim file
stim = fetch1(VisStims(key),'stim_file');
% get the different stimulus conditions
uniStims = stim.params.constants.location;
% Get stim data
trial_conditions = vertcat(stim.params.trials.conditions)';
allconditions = horzcat(stim.params... |
close all
X = linspace(-10*pi,10*pi,1000);
S = sin(X) + sin(10*X) + sin(100*X);
subplot(2,1,1);
plot(X,S); %plot sin function
Fx = real (fft (S) );
subplot(2,1,2);
plot(Fx); %plot transform
figure;
syms t;
f = sin(t) + sin(10*t) + sin (100*t);
subplot(2,1,1);
fplot(f);
ft_f = real ( fourier(f) );
subplo... |
function calmse(x,y)
mean((x-y).^2);
end |
close all
clear
x=imread('segmen_1.tif')
N=max(x(:));
image(x)
colormap(rand(N,3));
axis('image')
x=imread('segmen_2.tif')
N=max(x(:));
figure
image(x)
colormap(rand(N,3));
axis('image')
x=imread('segmen_3.tif')
N=max(x(:));
figure
image(x)
colormap(rand(N,3));
axis('image') |
% Computes and plots impulse-response functions
clear STATEHISTORY; clear JumpHistory
disp(sprintf('\n'))
TT = 20; %periods 1:19 fit nicely in graph 0:20
INITCONDIT=0;
% SET MONEY IMPULSES
time1moneyShock = 0;
time2moneyShock = 10*jacstep; % shock should be approx size of jacstep to preserve li... |
load 2008data.mat
x_data_2008 = data(:,2:12);
label_2008 = data(:,1);
tree = fitctree(x_data_2008,label_2008);
view(tree,'Mode','graph') |
clear all
clc
format long
%N=100
M=2; N=3
A=[zeros(1,N-1) 0; eye(N-1) zeros(N-1,1)]; % stem
N=length(A);
B=rand(N,M);
I=eye(N);
I1=eye(M);
x0=rand(N,1);
tf=1
% WB0=zeros(N,N);
% ot=0.025;
% for k=1:tf/ot
% WB0=WB0+expm(A*(ot*k))*B*B'*expm(A'*(ot*k))*ot;
% end
% C0=pinv(WB0);
syms t s real
p=s... |
function [ S ] = momento( E,m,n,c )
% Si c es 0 cuenta el negro sino los blancos.
[x,y]=size(E);
S=0;
for i=1:x
for j=1:y
if (c==0)
S=i^m*j^n*(255-E(i,j))/255+S;
else
S=i^m*j^n*E(i,j)/255+S;
end
end
end
end |
%% Problem 1
z=[1,.5,5];
M=[50,25,75];
Kpe=75
Kse=135
b=50
A=0
sim('slm1');
figure(1)
subplot(2,1,1);
plot(time,T(:,1),'b',time,T(:,2),'r--',time,T(:,3),'k:')
legend('Z=1','Z=.5','Z=5')
xlabel('time(s)')
ylabel('force (g)')
title('Simulated Force Vs. Time')
subplot(2,1,2);
plot(time,displacement(:,1),'b',time,disp... |
function [ force ] = CalcForcePeriodic(parts,eint,rc,boxSize)
%Calc lennard johns repulsion between parts; Periodic version
N = round(length(parts)/2);
NN = 2*N;
kb = 1.3806488e-23;
T=298;
kT = kb*T;
Eint = eint*kT;
%rc = 1e-7;
fac = 12*Eint*rc^11;
forceTmp = zeros(NN,N);
for i = 1:N
for j =i+1:N
r1 = par... |
%99年中国大学生数学建模竞赛a题:自动化车床管理模型一
%参见《数学的实践与认识》2000.1.p36-40
clear;opt=inf;
for n=[10 20 30]
for m=[200 300 400]
[x0,op]=fmins('jm99afun',[n m]);
if op(8)<opt,
x=x0;opt=op(8);
end
end
end
n=x(1),m=x(2),f=opt
|
function eer = runAll()
% Adding paths:
addpath('1/1','1/2','1/3','1/4','1/5')
% Running Database's Averages:
eer{1} = Database1Average();
eer{2} = Database2Average();
eer{3} = Database3Average();
eer{4} = Database4Average();
% Running 1'th Experiment:
%Database1_1
%Database1_2
%Database1_3
%Database1_4
%Experiment1A... |
classdef phaseTomography < sqc.measure.tomography
% phase tomography
% data: 2 by 2
% Copyright 2017 Yulin Wu, University of Science and Technology of China
% mail4ywu@gmail.com/mail4ywu@icloud.com
methods
function obj = phaseTomography(qubits, isParallel)
if nargin < 2
isParallel = false;... |
function [median_error]=mmad(X)
%mmad calculates the median absolute error of the values in X
median_error=median(abs(X-median(X)));
end |
% Takes eigenpairs given in the form (vals, vecs) and returns only
% those pairs with frequency between minfreq and maxfreq, sorted
% Note that vals should be an 1D array and not a sparse/dense matrix
function [vi, di] = filter_eigpairs(minfreq, maxfreq, vals, vecs)
rangepairs = find(abs(imag(vals)/2/pi) > mi... |
%% Regression test data generator
% This program should be executed at the very beginning of refactoring a
% major revision. This is for making legacy STRAIGHT v40_007d to be
% compatible with MATLAB R2015b and Octave
% Revised for initialization
% Copyright(c) 2016, Hideki Kawahara, (kawahara@sys.wakayama-u.ac.jp)
c... |
%base='/home/mfall n/nfs_data/ford_drivehistory/';
base='/afs/csail.mit.edu/proj/drivehistory/data/';
code='/afs/csail.mit.edu/u/d/donglai/FORD/drivehistory_repo/matlab/ParseCode/'
%base='/home/donglai/nfs_data/ford_drivehistory/';
%code='/home/donglai/Desktop/OSM/drivehistory_repo/matlab/ParseCode/'
addpath(base)
%a... |
datafolder = 'data\bird_data\images\';
silfolder = 'data\bird_data\silhouettes\';
Pfolder = 'data\bird_data\calib\';
datafiles = dir(fullfile(datafolder,'*.ppm'));
silfiles = dir(fullfile(silfolder,'*.pgm'));
Pfiles = dir(fullfile(Pfolder,'*.txt'));
len = length(datafiles);
for i = 1:len
data(i).Image = imread([... |
clear all;
close all;
load trainingSet.mat
trainingData = trainingStruct.data';
trainingClasses = trainingStruct.classes';
trainingData1 = trainingData(1:50,:);
trainingData2 = trainingData(51:100,:);
trainingData3 = trainingData(101:150,:);
trainingData4 = trainingData(151:200,:);
tic
[coeff, score, latent, t, expl... |
function [M] = calculateTorques(attitude)
global orbit_vec satellite
Ix = satellite.I(1,1); Iy = satellite.I(2,2); Iz = satellite.I(3,3);
%dcm
Aorb2b = quat2DCM(attitude(1:4)');
Aorb2b11 = Aorb2b(1,1);
Aorb2b12 = Aorb2b(1,2);
Aorb2b13 = Aorb2b(1,3);
Aorb2b21 = Aorb2b(2,1);
Aorb2b22 = Aorb2b(2,2);
Aorb2b23 = Aorb... |
function bounds = bootstrap_tol(time, fn, qn, gam, quants, nboot, alpha)
% This function models the functional data using a Gaussian model extracted from
% the principal components of the srvfs
%
% Inputs
% time vector of size \eqn{N} describing the sample points
% fn matrix (\eqn{N} x \eqn{M}) of \eqn{M} aligned funct... |
%% CFA\M137_C5===============================================================================================
%define the directories
clear all
close all
homedir='D:\GD_Rebecca\Work\1_Active_Projects\PAIN\Files for RM_22_9_2018\CFA\M137_C5\'
% get the data for M137_C5
fname='M137_C5_Mech_L6 05mW'
load([homedir fname 'a... |
clear;
m=input('PODAJ LICZBĘ WĘZŁÓW (0 - QUIT) m=');
if (m==0) end
if (m<0) || (m==1) abs1p; end
if (m>1)
n=m-1;
a=-1;b=1;
step1=(b-a)/n;
x=a:step1:b;
y=abs(5*x);
step2=(b-a)/100;
xt=a:step2:b;
wn=polyfit(x,y,n);
ywn=polyval(wn,xt);
err=abs(ywn-abs(5*xt));
bar(xt,err);
abs1p;
end |
function [wordMap] = getVisualWords(img, filterBank, dictionary)
% Compute visual words mapping for the given image using the dictionary of visual words.
% Inputs:
% img: Input RGB image of dimension (h, w, 3)
% filterBank: a cell array of N filters
% Output:
% wordMap: WordMap matrix of same size as the in... |
function [EVmeta,EVdata,isValid] = tsEVstatistics(pointData, varargin)
% Evangelos Voukouvalas, Michalis Vousdoukas 2015
% gevMaxima can be annual or monthly. annual by default
% in a gaussian approximation alphaCI~68% corresponds to 1 sigma confidence
% interval
defvals={[],[],.68};
minvars=1;
EVdata = [];
m... |
function result_index = nearest_neighbor(data, query1, query2)
min_diff = bitmax;
normalized_vector = [240 320 255 240 320 255]';
query1= query1 ./ normalized_vector;
query2= query2 ./ normalized_vector;
for i=1:size(data, 2)
diff1 = euclidean_distance(data(:, i), query1);
... |
function [ Objective ] = myObjective_Function_Calculator(Y, X_labels,Means,Sigma_2,Beta,mask )
Sigma_2_Labels=zeros(size(X_labels));
Means_Labels=zeros(size(X_labels));
Means_Labels(X_labels==1)=Means(1);Means_Labels(X_labels==2)=Means(2);Means_Labels(X_labels==3)=Means(3);
Sigma_2_Labels(X_labels==1)=Sigma_2(1);Si... |
function [d,p,yi,pol] = LagrangeMitFunktionBHO(a,b,n,fu)%Lagrange Interpolation
xTeil=(b-a)/(n-1);
u=a:xTeil:b;
syms x;
%Bestimmen X
yi=0; pol='0';p=0;d=1;
%Rechnen die n-Faktoren
for i=1:n
%Jeder Faktor kommt aus die Produkte (x/xj)/(xi-xj)
produkt = 1;
term = '';
d = d*(x-u(i));
f... |
function SVR_W_Permutation_2(Data_Path, Score, Perm_times_Range, ResultantFolder, Queue)
for i = Perm_times_Range
i
Job_Name = ['perm_' num2str(i)];
pipeline.(Job_Name).command = 'W_Calculate_SVR_SGE_2(opt.para1, opt.para2, opt.para3, opt.para4)';
pipeline.(Job_Name).opt.para1 = Data_Path;
pipelin... |
clear,clc;
load '../labels.mat';
load '../available.mat';
%% 将各个模态数据单独保存
for i=1:length(available)
disp(available(i).patientNo);
data_cube_slice(labels, available(i), 'resize');
data_cube_slice(labels, available(i), 'core');
% data_cube_slice(labels, available(i), 'original');
end
%% 组合模态数据???????... |
function y = forwardModel(im,opts)
ROW = opts.imHeight;
COL = opts.imWidth;
[samplingIndices,pupil,hROW,hCOL] = getSampling(opts);
X = fftshift(fft2(im)); % need to center the FFT
X = padarray(X,floor([(hROW-ROW)/2 (hCOL-COL)/2]));
% X = imresize(X,[hROW hCOL],'nearest');
y = F_LENS2SENSOR(X(samplingIndices),pupil... |
clear all
clc
%% 1. LOAD OCTONION UTILITY FUNCTIONS
% addpath([fileparts(pwd),'/Data']); %add Data directory to path;
addpath('crystal_symmetry_ops');
addpath('octonion_functions/');
addpath('rotation_conversions/');
pgnum = 30; %cubic symmetry
genplot = false;
symnames = load('PGnames.mat'); %need to add crystal_s... |
function [stats, RC_output] = init_stats()
stats=[];
stats.snr_asoc=[];%zeros(Nu,num_drops);
stats.LOS=[];%zeros(Nu*num_drops,Nb)
stats.snr_asoc_g2x=[];
stats.snr_asoc_x2u=[];
stats.pls=[];%zeros(Nu,num_drops);
stats.prx_asoc=[];%zeros(Nu,num_drops);
stats.cap=[];%zeros(Nu,num_drops);
stats.sinr=[];%zeros(Nu,num_drops)... |
function [specified_data_type, specified_data_shape, specified_data_range] = specify_data_type_shape_range(modelName, sysIns, names, specified_data_type, specified_data_shape, specified_data_range)
eval([modelName,'([],[],[],''compile'');'])
for i=1:length(sysIns)
in = sysIns{i};
in_name = names... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.