text stringlengths 8 6.12M |
|---|
function train_multi_branch(p,split,stage)
model_file = sprintf('%s/model/stage_%d.mat',p.data_path,stage);
if ~exist(model_file,'file')
branch = p.branch;
if ~exist(model_file,'file')
feature = cell(p.branch,1);
label = cell(p.branch,1);
for ii = 1:branch
[feature{ii},label{ii}] = extract_all_featur... |
clc
close all
clear
%Mylena - 28/09/20
A = [1 -0.49 -0.495];
B = [0 0.008856 0.004428];
sys0 = idpoly(A,B);
u = iddata([],idinput(300,'rbs'));
e = iddata([],randn(300,1));
y = sim(sys0,[u e]);
z = [y,u];
sys1 = arx(z,[2 2 1]);
t = 1:100;
figure
subplot(2,1,1)
step(sys1,10)
grid
subplot(2,1,2)
... |
function g = sigmoid(z)
%SIGMOID Compute sigmoid functoon
% J = SIGMOID(z) computes the sigmoid of z.
a = size(z,1);
b = size(z,2);
for i = 1:a
for j = 1:b
g(i,j) = 1.0 ./ (1.0 + exp(-z(i,j)));
end
end
end
%temp1 = sum(sum(Theta1(:,2:size(Theta1,2)).^2,1),2) +sum(sum(Theta2(:,2:size(Theta2,2)).^2,1),2... |
%% Calibration and Validation
% please run Cal_GSWP3_1.m before running this code
clear
load('D:\RCMIP\Pre_GSWP3_1901_2016.mat') %1901-2016
load('D:\RCMIP\Tas_GSWP3_1901_2016.mat') %1901-2016
load('D:\RCMIP\score_0116_3mon.mat')
temp1=mean(Pre_GSWP3(:,:,948+1:1392),3)*12;
Pre_mean_116=temp1';
load('D:\RCMIP\Mas... |
function [yaw, pitch, roll] = gauss_newton(K, platform_to_camera, p_model, uv, weights, yaw, pitch, roll)
%
% Task 1c: Implement the Gauss-Newton method
%
% This will involve calling the functions you defined in a and b.
max_iter = 100;
step_size = 0.25;
for k=1:max_iter
... |
files = dir('~/Stanford/f19/psych221/postprocess');
ip = ipCreate;
for num = 3:numel(files)
filename = files(num).name;
fileparts = strsplit(files(num).name,'.');
nameparts = strsplit(fileparts{1},'_');
load(strcat('~/Stanford/f19/psych221/postprocess/', files(num).name));
fullName = strcat('... |
function [x_beta,n] = getn(x,xmean,xsd,Rx)
[M,N]=size(x);
for i=1:length(xmean)
kexi(i)=sqrt(log(1+(xsd(i)/xmean(i))^2)) ;
lamda(i)=log(xmean(i))-0.5*kexi(i)^2;
end
for i=1:1:M
for j=1:1:N
n(i,j)=(log(x(i,j))-lamda(j))/kexi(j);
end
end
for i=1:1:M
x_beta(i)=sqrt(n(i... |
%% Spectral Clustering
% Course: Big Data Analysis and Applications
% Author: Liu Junhao
clear;
clc;
% Load the Spectral Clustering Tools written by myself. This toolbox
% includes the datasets which is common in machine learning research especially
% clustering and the api seems like the popurlor machine learning pa... |
%% CASO M=N
warning('OFF', 'MATLAB:table:ModifiedAndSavedVarnames');
tabella_efficienza_righe = readtable('test_valutazione_elab2_prodotto_righe.xlsx', 'Range', 'C32:E33');
tabella_efficienza_colonne = readtable('test_valutazione_elab2_prodotto_colonne.xlsx', 'Range', 'C32:E33');
tabella_efficienza_blocchi = readtabl... |
function [grad,dx,dy] = spmat_gradient2d(ny, nx, nc)
%spmat_gradient2d Assembles linear operator for gradient
% Input args are nx, ny, the dimension of the image and nc the number of
% color channels. The resulting gradient operates on a column wise
% stacked image vector with the images from the individual colo... |
% This function calculates the glottal flow and derivative from a given
% frame.
% 1) The IAIF algorithm is used to get the glottal derivative.
% 2) The pitch is then calculated by 'get_pitch_from_derivative'.
% 3) The flow derivative is integrated with a filter to give the flow.
% 4) The lingering DC component... |
% Q431_11510714
% salt-and-pepper and shaking
I=imread('Q4_3_1.tiff');
InputImage=double(I);
[M,N]=size(InputImage);
cent=ones(M,N);
for i=1:M
for j=1:N
if rem(i+j,2)==1
cent(i,j)=-1;
end
end
end
F0=fft2(InputImage.*cent);
%% Alpha-trimmed mean filter
win=[9,9];
a=(win(1)-1)/2;
b=... |
function [X, varargout] = ForwardEuler_t(fhand, x0,p,U,b, varargin)
X(:,1) = x0;
if length(varargin) ==1
tvec = varargin{1};
tf_prod = zeros(1, length(tvec));
for n = 1:length(tvec)-1
u = U(:, n);
dt = tvec(n+1)-tvec(n);
f = fhand(X(:,n),p,u,b, tvec(n));
tf_prod = max(dt*f);
... |
function norm_mse = NMSE(original,procesada)
var_erro=std2(original-procesada)^2;
var_orig=std2(original)^2;
norm_mse=100*var_erro/var_orig; %JAE S LIM pag 529
|
function [ydot] = fofy(t,y,u)
ydot=-u(1)*(y-(t*t+1))+2*t;
% ydot(1)=-u(1)*y(1);
%
% ydot(2)=u(1)*y(1)-u(2)*y(2);
%
% ydot(3)=u(2)*y(2);
end
|
path(path,'/home/viblab/legacy_STRAIGHT-master/src');
prm.spectralUpdateInterval = 5.000000;
prm.levelNormalizationIndicator = 0;
dur = 961;
%fprintf(1,'\nSynthesizing /home/viblab/BillyCoba/DNN_Ekspresif_dependent/Bahagia14ulang2/gen/ver1/1mix/0/vibid_fyat_001.wav\n');
fid1 = fopen('/home/viblab/BillyCoba/percobaan_... |
%A more robust version of multable.m, this one has documentation and can catch errors!
%wOw documenting code is important !1!1! totally did not know that 1!1!1
%P.S. documentation will be shown with >> help multable
function [table, summa] = multablerobust(n,m)
%MULTABLE multiplication table.
%T = MULTABL... |
%%
% opt_algo_DA.m
% Construct an optimal estimation algorithm in A(D)
% given the acquisition process and the approximability model
%
% Implements the optimal algorithm described in the paper
% "Approximability models and optimal system identification"
% by M. Ettehad and S. Foucart
% Note: CVX is needed to perform th... |
clc
close all
clear
fo = 100; %freq do sinal
fs = 1000; %freq de amostragem
Ts = 1/fs; %periodo de amostragem
L = 100;
n = 0:(L-1);
t = Ts*n;
x = sin(2*pi*fo*t)+0.2*randn(1,L);
figure
stem(t,x)
xlabel('t')
ylabel('x(t)')
grid
%analise em freq (DFT)
k = 0:(L-1);
omega = 2*pi*k/L;
Xdft = fft(x);
... |
function net = weedProcessSteps(net)
% weedProcessSteps Remove processing steps that result in no changes
% Copyright 2012-2015 The MathWorks, Inc.
for i=1:net.numInputs
for j=numel(net.inputs{i}.processFcns):-1:1
if net.inputs{i}.processSettings{j}.no_change
net.inputs{i}.processFcns(j) = [];
net... |
D = 1:5
S = (max(D) - D) + min(D)
L = S/sum(S)
PP = 1 - (D/max(D))
S = (max(D(:)) - D) + min(D(:)); % convert distance to similarity
lik(i,:) = S/sum(S); % normalized similarities
|
function [pathBackwards] = AStar(OccupancyMap, GoalLocation, RobotLocation)
Open = [];
Closed = [];
[rows, cols] = size(OccupancyMap);
pathBackwards = [];
% closed array gets all the 1's
% closed array format is x y parentx parenty
% NOTE: Formatting array instead of building object or researching Matlab
% farther, but... |
function updatedTransform = updateTransform(transform, transformType, rotate, skew, scale, transX, transY)
if isempty(transform)
if strcmp(transformType, 'translate')
updatedTransform = ['matrix(1 0 0 1 ' transX ' ' transY ')'];
end
return;
end
if strcmp(transform, 'none') || strncmp(transform, ... |
function [ y ] = SOLA_batch( x, N, TSM, filename )
% [ y ] = SOLA( x, N, TSM )
% Synchronised Overlap Add (SOLA) Time-Scale Modification Implementation
% Roucos and Wilgus, High Quality Time-Scale Modification for Speech 1985
% x is the input signal
% N is the frame length. Must be power of 2. 4096 recommended f... |
function docNode=addMaterialLevel_FEB(docNode,FEB_struct)
%%
rootNode = docNode.getDocumentElement;
MaterialNode = docNode.createElement('Material');
MaterialNode = rootNode.appendChild(MaterialNode);
% Adding material fields
disp('Adding Material level')
materialIndexSet=[FEB_struct.Geometry.ElementMa... |
function swap_tif(fname)
%fname = '-198000_000000_420000.tif';
info = imfinfo(fname);
num_images = numel(info);
temp = imread(fname);
[r,c] = size(temp);
A = zeros(r,c,num_images);
% Load data
for k = 1:num_images
A(:,:,k) = imread(fname, k);
end
% invert order
A = flip(A,3);
% Swap top and down
A = flipud(A);
... |
clear
P=load('C60.txt');
str=load('C60_str.txt');
Lat=[20 0 0
0 20 0
0 0 20];
N_H=[] ;
for ii=1:size(str,1)
p=P;
s=str(ii,:);
s(s==0)=[];
ads=P(s,:);
pos=[P;ads+(ads-repmat( [10 10 10] , size(ads,1) , 1 ))/3.3]/Lat;
d=[60 size(ads,1)];
n=['POSCAR... |
%% Simulador de uma Rede Cognitiva descentralizada com "single channel" para avalia??o do impacto do treshold de energia a adoptar pelos utilizadores secund?rios
clc;
clear;
close all;
% --- Vari?veis --- %
PU = 70;
ratio = 15;
simu = 1;
% ------------------ %
% --- Amostragem --- %
W = 10*10^3;
T = 1... |
function [acc] = my_accuracy(y_test, y_est)
%My_accuracy Computes the accuracy of a given classification estimate.
% input -----------------------------------------------------------------
%
% o y_test : (1 x M_test), true labels from testing set
% o y_est : (1 x M_test), estimated labes fro... |
function [A B C D] = nsystem
% Usage: [A,B,C,D]=nsystem
%
% dx = Ax+Bu+v
% y = Cx
%
A = [1.8 1; -.95 0];
B = [1.5 0]';
C = [0.5 0];
D = 0;
|
function A = makeA(m,n)
% MAKEA - General purpose matrix creation function
%
% A = MAKEA(m,n) creates an m x n matrix A for which
% the I, J th element is equal to I+J
%
for I = 1:m
for J = 1:n
A(I,J) = I+J;
end
end
end
|
% loading the file and spliting the files into words with the lowercase.
%using using finding the unique words with their indexes. Histcounts,
%counts the occurance of each word. Now we are sorting the count(words)
%with the descending value of count.
%returns the max occurances of first n words with their counts
%retu... |
clear all ; close all ;
timeframes = {'minute_0015','minute_0030','minute_0060','minute_0240','minute_1440'};
currs = {
'AUDCAD','AUDCHF','AUDJPY','AUDNZD','AUDSGD','AUDUSD','CADCHF','CADHKD','CADJPY','CHFJPY','CHFSGD','EURAUD','EURCAD','EURCHF','EURDKK',...
'EURGBP','EURHKD','EURJPY','EURNOK',... |
function output = loadTrainingTestData(path,which)
mf_train = matfile([path,'_train'],'Writable',false);
trainconcat = cell2mat(mf_train.concatTrainArray');
mu_data = mean(trainconcat(:));
std_data = std(trainconcat(:));
trainconcat = (trainconcat-mu_data)./std_data;
if strcmp(which,'test')
mf_test = matfile([pat... |
W = exp(-1j*2*pi/N_SC);
f0 = ones(N_SC+CP_LEN,1)/sqrt(N_SC); % Some arbitrary prototype filter
S = ifft_in_mat;
M=N_SC;
FF = conj(dftmtx(M)); % The IDFT matrix
repnum = ceil(length(f0)/M);
Q = FF*S;
% Q=ifft(S);
Q = repmat(Q,repnum,1);
Q = Q(end-N_SC-CP_LEN+1:end,:);
Q =... |
% run: generating training sets:
clc
clear
%% 1. read data:
filenames = {'rawdata/1_2.mat'};
load('theta.mat');
load('seqlen.mat');
load(char(filenames(1)));
filenum = size(filenames, 1);
State = zeros(filenum*seqlen, 3);
A = zeros(filenum*seqlen, 1);
%% process data
for i = 1:1:size(filenames, 2)
fi... |
% Code taken from Pablo Alvarado's stoch_rmsprop.m lines 221 to 248
%
% The following parameters are required:
%
% J: target function computing the loss (or error)
% gradJ: gradient of target function
% theta0: initial point for the iteration
% Xo: vector holding the original data (e.g. the house areas)
% Yo: vector ho... |
function [Xm, Omega] = rgb2mosaic(X)
% To rggb
[h, w, c] = size(X);
Xm = zeros(h,w);
Omega = [];
for tub = 1:c
for hor = 1:w
for ver = 1:h
if tub==1
tmp = (hor-1)*h+ver;
if mod(ver,2)==1 && mod(hor,2)==1
Omega = [Omega,tmp];
... |
function [T,I,Y]=naivePerfusionResponsepotentP2X4pool(ton,toff,Ttot)
ode=modelODEpotentP2X4pool(ton,toff);
naive=zeros(33,1);
naive(1)=1;
setAuxiliarypotentP2X4pool(naive);
[T,Y]=ode15s(ode,[0 Ttot],naive,odeset('NonNegative',1:33));
I=getTotalCurrentpotentP2X4pool(Y);
end |
clc;
clear;
close all;
%reading image
a=imread('2.jpg');
%INITIALIZAITON OF FACE PART DETECTION ALGORITHM
detector=vision.CascadeObjectDetector; %default 'Face' %Detect Object using th Voila-Jones algorithm
eyeDetector=vision.CascadeObjectDetector('EyePairBig');
NoseDetector=vision.CascadeObjectDetector('Nose');
imshow... |
function [obj, condi] = geointersect ( varargin )
if nargin < 2
error('Not enough input arguments.')
end
types = [int32(varargin{1}.Type) int32(varargin{2}.Type)];
inputobj = {varargin{1} varargin{2}};
[types, id] = sort(types);
inputobj = inputobj(id);
if isequal(types, [2,2])
% line line
if inputobj{1}... |
function varargout = testfit(x_vals, y_vals, fit)
% function [r_squared mean_err s_err] = testfit(x_vals, y_vals, fit)
%
% Tests a fit on a given set of x and y values to see how well it
% fits the data
%
% Inputs
% XVALS x-values of the test set
% YVALS y-values of the test set
% FIT the coefficients of the polyno... |
function [x_pca,exp_var_pca,exp_var_pca_2,coeff] = get_pca(x,dims)
x_aux = zeros(size(x,2)*size(x,3),size(x,1));
for i = 1:size(x,2)
for j = 1:size(x,3)
for k = 1:size(x,1)
x_aux((i-1)*size(x,3)+j,k) = x(k,i,j);
end
end
end
D = L2_distance(x_aux',x_aux');
[coeff,~,e... |
i = 0;
while i<10
fprintf('Hello vinod \n');
i=i+1;
end |
function [xp] = mathematicalmodel(x, theta)
global time
% Step change in real parameters
% if time>40
% theta(1)=7;
% theta(2)=21;
% theta(3)=1;
% end
xp(1) = theta(1)*(x(2)-x(1));
xp(2) = x(1)*(theta(2)-x(3))-x(2);
xp(3) = x(1)*x(2)-theta(3)*x(3);
end |
function L = squareRoot(A)
%bad matrix in case
if ~all(all(A == A')) || ~all(eigs(A)> 0)
error("bad matrix");
end
[m,n] = size(A);
L = zeros(n,n);
for i=1:n
L(i,i) = sqrt(A(i,i) - sum(L(i,1:i-1).^2));
for j=i+1:n
L(j,i) = (A(j,i) - sum(L(i,1:i-1).*L(j,1:i-1)))/L(i,i);
end
end |
% Segmentation demo
% Run segmentation
X = [ones(10,2); -ones(10,2)]; % state vectors
post = sem_segment(X); % run event segmentation
% plot results
subplot(1,2,1);
imagesc(X');
xlabel('Time step','FontSize',25);
ylabel('State features','FontSize',25);
title('States','FontSize',25);
set(gca,'FontSize',20,'Y... |
function img = from_laplacian(pyr)
% AUTHOR: Son La
% STUDENT NUMBER: y107227
%
% This function reconstructs the image from a laplacian pyramid
% PARAMETERS:
% pyr: laplacian pyramid
% OUTPUT:
% img: reconstructed image from the laplace pyramid
img = pyr{end};
for i = size(pyr,2):-1:2
img = ... |
function solutionChowLiu
clear all; close all
import brml.*
load ChowLiuData
drawNet(ChowLiu(X)); title('Chow Liu Net from data') |
function [Hp] = affine_reconstruction(v1,v2,v3,v1p,v2p,v3p,Pproj1,Pproj2,w,h)
%Corresponding 3D points by triangulation
point_1 = triangulate(euclid(v1), euclid(v1p), Pproj1, Pproj2, [w, h]);
point_2 = triangulate(euclid(v2), euclid(v2p), Pproj1, Pproj2, [w, h]);
point_3 = triangulate(euclid(v3), euclid(v3p), Pproj1, ... |
function pc=Find_Landings_OneFrameInterval(InputTrace,UpThreshold,DownThreshold,MinUpFrames,MinDownFrames)
%
% function Find_Landings_OneFrameInterval(InputTrace, UpThreshold,DownThreshold,MinUpFrames,MinDownFrames)
%
% Will delineate high and low intervals in the InputTrace, thus recognizing when and
% how long dye-l... |
clear
%number of nodes
n = 20;
%length of the beams
L = 1;
%lattice spacing
h = L/(n-1);
%lattice
xh = linspace(0,L,n)';
%mass density
mu = 1;
%vertical shear force
Qv = 0.2;
%shear momentum
Mv = 0;
%horizontal shear force
Qh = 0;
%beam in which the force is applied
bf = 4;
%final time
T = 20;
%number of time steps
n... |
function ignored = read_ignore(file)
if ~exist(file, 'file')
ignored = {};
return
end
f = fopen(file);
l = fgetl(f);
if l == -1, l = ''; end
ignored = regexp(l, '(\S+)', 'tokens');
for i = 1:length(ignored)
ignored{i} = ignored{i}{1};
end
|
function cellMat = loadCSVAsCell(varargin)
% Loads in a CSV file as a cell array with data{iRow, iCol} containing cell
%
% Handles quoted commas, quoted new lines, and double quotes correctly
% Works with Google Docs spreadsheet csv output with default arguments
%
% cellMat : cell matrix (nRows x nCols) containing th... |
tic
format short e
clear
clear global
%% load ADAS atomic reaction coefficients
run ADASdata_CCD96.m %ADASdata.m %ADASdata_CCD96.m
%% Variables for DYON runs
global W_coef1 W_coef2 t_Drecycling Gas_puffing Btoroidal Volume_Vacuum amu EM MU0 e0 Qe ln_lambda T_0 Lmk2 Rmk2 M_p_mk2
global t_D3D V_D3D Are... |
% cemDipoleRadiatingE.m
close all
clc
clear
% Speed of light
c = 2.99792458e8;
% Time t0
t0 = 0;
% wavelength wL / propagation constant k /
% freq f / period / ang freq w / w*t
wL = 1;
k = 2*pi/wL;
f = c/wL;
T = 1/f;
w = 2*pi*f;
wt = w*t0;
% Grid
% polar angle p P (elevati... |
% plots distributions for pareto, lognormal, etc
% set x - doesn't matter
% ev=logspace(-4, 0, 200);
% ev=logspace(log10(0.016), 0, 200);
ev=linspace(0, 1, 200);
% p=cdf('Generalized Pareto', ev);
% gen fxns and plot
clf; hold on
p=pdf('Generalized Pareto', ev, 1,1,0.02);
l=pdf('Lognormal', ev, 0.0... |
function [x,fs]=audioread(varargin)
% [x,fs]=audioread(varargin)
% Compatibility tool for versions of Matlab <2015.
if length(varargin)>=2 && strcmp(varargin{2},'size'),
fprintf('audioread does not accept size argument\n') ;
x = []; fs = [] ;
return
end
[x,fs] = wavread16(varargin{:}) ;
|
function [resL, resR] = residual(p, uvl, uvr, Twca, Twcb, cmodl, cmodr)
2dl = proj_3d_to_2d(Twca, p, cmodl);
2dr = proj_3d_to_2d(Twcb, p, cmodr);
resL = uvl(1:2,:) - 2dl(1:2,:);
resR = uvr(1:2,:) - 2dr(1:2,:);
end |
potentP2X4coop1.getTotalCurrent=@ getTotalCurrentpotentP2X4coop1;
potentP2X4coop1.ode=@ modelODEpotentP2X4coop1;
potentP2X4coop1.pulseODE=@ modelPulseODEpotentP2X4coop1;
potentP2X4coop1.perfusionResponse=@ perfusionResponsepotentP2X4coop1;
potentP2X4coop1.naivePerfusionResponse=@ naivePerfusionResponsepotentP2X4coop1;
... |
%% Ratio sensor
clear all
close all
clc
%
g1 = 0.6; %1/hr
g2 = 0.4; %1/hr
d1 = 0.2; %/OD
d2 = 0.2;
ti = 2;
od_0 = 0.001;
C1 = [0 2.^(-7:1)];
C2 = [0 2.^(-9:1)];
%
cost = 1.2;%linspace(1.1,1.5,5);
r = 1;
ti = linspace(1,2,3);
ts_vec = linspace(0,20,100);
C1 = 0.1; %[0 2.^(-11:-9)];
C2 = 0.1; %... |
function drawHistogram(cnd)
% function drawHistogram
%
% using trialSpikes, draws the histogram for condition cnd to the screen
global trialSpikes wins params
gray=(WhiteIndex(0)+BlackIndex(0))/2;
Screen(wins.hist,'FillRect',gray);
validSpikes = cell2mat(trialSpikes{cnd}');
... |
function img_processed = ProcessingImage(I1,I2)
I3 = rgb2gray(I1);
I4 = rgb2gray(I2);
I3 = imcrop(I3,[1,1,640,270]);
I4 = imcrop(I4,[1,1,640,270]);
points1 = detectSURFFeatures(I3);
points2 = detectSURFFeatures(I4);
[f1, vpts1] = extractFeatures(I3, points1);
[f2, vpts2] = extractFeatures(I4, points2);
indexPai... |
% This script compiles *.cpp with mex tool.
% You should run `mex -setup C++` firstly to configure the
% C++ language compilation.
% mex -setup C++
mex -largeArrayDims iteration.cpp
mex -largeArrayDims find2cells.cpp |
function Tests = pseudofuncTest( )
Tests = functiontests(localfunctions);
end
function testDiffDefault(this)
import parser.Pseudofunc;
actCode = Pseudofunc.parse('diff(diff(y))');
expCode = '((((y)-(y{-1})))-(((y{-1})-(y{-1-1}))))';
assertEqual(this, actCode, expCode);
end
function testDiff(this)
import parser.... |
function zmq=zero_monotonicQ(v,tol);
% ZERO_MONOTONICQ returns 1 whenever the game v is zero-monotonic.
%
% Usage: zmq=zero_monotonicQ(v)
% Define variables:
% output:
% zmq -- Returns 1 (true) or 0 (false).
%
% input:
% v -- A TU-game of length 2^n-1.
% tol -- Tolerance value. By default, it is s... |
function cdfi_mtloc_osx(subjID, acq)
% mtloc([subjID, acq]): MT localizer, AB design
%
% This presents concentric circles, with alternating blocks of static image and
% radial (in+out) motion.
%
% ras, 02/04: automatically detects external monitor if connected. Also, fixed a timing bug.
% ras, 06/04: apparently the mon... |
% generate beamSplitter opertor with specific transmission and asymmetric losses
% input: transmission coefficient tau, losses
% output: beamsplitter operator
% comments:
function [beamsplitter] = Gate_beamSplitterAsymmetric(tau,loss1,loss2)
ident = eye(2);
beamsplitter = zeros(4,4);
beamsplitter(1:2,... |
clear all;
close all;
clc;
I0 = imread('1.jpg');
I=rgb2gray(I0);
% Input values for manual (r1, s1) and (r2, s2)
r1 = input('Enter r1: ');
s1 = input('Enter s1: ');
r2 = input('Enter r2: ');
s2 = input('Enter s2: ');
% Slopes for s function outputs
m1 = s1/r1; %subtract by zero, so nothing
m2 = (s2-... |
mu = [1,2];
sigma = [1,1.5;1.5,3];
A = mvnrnd(mu,sigma,10000);
var1 = var(A(:,1));
var2 = var(A(:,2));
var12 = var(A(:,1)+A(:,2));
strip = ['The Var[X+Y] ',num2str(var12),' is different from the sum Var[X] + Var[Y] ',num2str(var1+var2)];
disp(strip) |
%@(#) cplot.m 1.2 94/01/25 12:42:14
%
%set(gcf,'pointer','watch');
DNAMEMAT=setprop(4);
if length(DNAMEMAT)<9,
ccplot;
elseif strcmp(DNAMEMAT(1:7),'MATLAB:')
matvarread;
else
ccplot;
end
%set(gcf,'pointer','arrow');
|
l = 512; %dft点数
fs = 1000; %采样频率
T = 1 / fs; %周期0.001s
ws = 2 * pi * fs;
w = - fs /2+(0:l-1) * fs/l; %频率坐标
f1 = 50; f2 = 100; %测试信号频率 △f = 50,fs / △f = 20
n = 15; %采样点数,此时N < fs / △f
t = (0: n - 1) * T;
x = sin(2 * pi * f1 * t) + 5 * sin (2 * pi * f2 * t);
Xm ... |
function info = getFileInfo(depth)
%GETFILEINFO Get metadata of the caller of function.
%
% INPUT depth: int
% Get a higher order callig function instead of the direct
% caller. 2 corresponds to the caller of this function. Use 3 or
% more to return the info for higher order callers.
% ... |
function [LP, HP] = isotropicBandlimitedAnalysis(Im, dim, J, isotropicWaveletType, spatialDomain)
% multidimensional isotropic wavelet decomposition
%
% input:
% ------
% Im: multidimensional image to decompose
% dim: dimension of the image. Should be 1, 2 or 3.
% J: number of wavelet scales
% isotropicWaveletType: opt... |
function poly2 = resamplePolygonByLength(poly, step)
%RESAMPLEPOLYGONBYLENGTH Resample a polygon with a fixed sampling step.
%
% RES = resamplePolygon(POLY, STEP)
% Resample the input polygon POLY by distributing new vertices on the
% original polygon such that the (curvilinear) distance between the new
% vert... |
function T=TimeSolution(q,qq,model)
d0=model.d0; %fasele anbare miyani az anbare asli
d1=model.d1; %fasele har 2 anbare miyani
d2=model.d2; %fasele 2 moshtari az ham
d3=model.d3; %fasele moshtari az anbare miyani
for h=1:h
for hh=1:hh
m=randi([1 3]);
switch m
case 1
... |
%
% Formats and outputs the factor scores from qmode2mainm. %
function x = fmatrixprint(lpfid,title,inmatrix,variable) [n m] = size(inmatrix);
rownum = [1: 1:n]';
label = '';
for i = 1: m
label = [label '%12i ']; end
label = [label '\n']; format = '%12.4f '; for j = 1: m-1
format = [format '%12.4f ']; end
format = [for... |
function run
% dset = 'EUR-Lex';
% dset = 'Wiki10';
% dset = 'Ads-9M';
dset = 'EUR-Lex-dense';
% dset = 'Amazon-dense';
%{
param = [];
param.num_tree = 3;
param.max_leaf = 100;
param.cent_th = 0.01;
param.num_thread = 1;
param.svm_iter = 50;
param.beam_size = 10;
param.disco... |
classdef TaskManager < handle
%TASKMANAGER Organisiert die Auswertung verschiedener
%Oscillationskonfigurationen
% Speichert bereits Parameter von kalibrierten WQ, damit diese evtl.
% nicht neu berechnet werden müssen
properties
InputVariParam = []; % Beinhaltet den zu va... |
function StartDefinitiveTCM
% Opens the DefinitiveTCM GUI
executable = isdeployed;
% Get the path of this function and change the directory accordingly
programDirectory = fileparts(mfilename('fullpath'));
originalDirectory = cd(programDirectory);
fprintf('Program directory: %s\r\n', programDirectory);
... |
function [fdcomm, radar, radar_comm, cov] = tsp_ini_random_v1(radar,fdcomm,radar_comm, snr_rtr)
%%%%-----------------------------------
%% Precoding matrices initialization
I = fdcomm.UL_num;
J = fdcomm.DL_num;
K = radar.codelength;
P_UL = fdcomm.ULpower;
P_UL_ini = cell(I,K);
Mr = radar.TX;
Nr = radar.RX;
Nc = fdcomm... |
%test harris
clc
%clear
close all
%% harris
% R = det(M) - a*(trace(M))^2
I = checkerboard(50,2,2);
window = 3;
% GaussWeight = [0.000007 0.000425 0.001704 0.000425 0.000007;
% 0.000425 0.027398 0.109878 0.027398 0.000425;
% 0.001704 0.109878 0.440655 0.109878 0.001704;
% 0... |
%
% evalAlign
%
% This is simply the script (not the function) that you use to perform your evaluations in
% Task 5.
% some of your definitions
trainDir = '../data/Hansard/Training';
testDir = '../data/Hansard/Testing';
fn_LME = './Eng_LM.mat';
fn_LMF = './Fre_LM.mat';
lm_type = 'smooth';
d... |
function files = nevSNR(dirstring)
global WaveformInfo;
files = dir(dirstring);
files([files.isdir])=[]; %added to remove '.' and '..' (and other directories) from list of files to process. 03Oct2012 -ACS
for k = 1:length(files)
files(k).name
nevWaveforms(fullfile(dirstring,files(k).name)); %changed to include ... |
function [dImg, dFlow] = fRotate(dImg, dFlow, sInputOri, sOutputOri)
% dImg 2D to 5D image
% dFlow same number of dimensions as dImg with last dimension storing flow in x/y/z direction, i.e. if ndims(dImg)==3 -> size(dFlow) = [size(dImg,1),size(dImg,2),size(dImg,3), 2 or 3], last dim holds cat(4, ux, u... |
function mrlbkup(l,phid,rfn,phin,gn) ;
% Does backup when slew insufficient ...
% to prevent rfn from exceeding rfm
% Called by mrlrm.m / mrlremap / mrlmmap
% Calls backcalc (mrlbkclc)
global mrldweln mrldwelr mrlphi mrlphis mrlrf mrlrfm mrlslew ...
mrlbckf mrlgn mrlgm mrlphin mrlrfn mrlemtxt mrlermf ...
mrlclearf mr... |
%
% Kinematic Control for an n-link arm to follow the S-shape
%
%
% initialization
%
clear all;close all;
%
% define unit vectors
%
zz=zeros(3,1); ex = [1;0;0]; ey = [0;1;0]; ez = [0;0;1];
%
% load the letter S as a curve
%
load S_letter_path
% specify end effector orientation
[xT,yT]=setR0T(Sls); % <<<< you need t... |
function [ys,ysCum] = fernsRegApply( data, ferns, inds )
% Apply learned fern regressor.
%
% USAGE
% [ys,ysCum] = fernsRegApply( data, ferns, [inds] )
%
% INPUTS
% data - [NxF] N length F binary feature vectors
% ferns - learned fern regression model
% inds - [NxM] cached inds (from previous call to fern... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2010 - 2015 Moon Express, Inc.
% All Rights Reserved.
%
% PROPRIETARY DATA NOTICE:
% The data herein include Proprietary Data and are restricted under the
% Data Rights provisions of Lunar CATALYST Space Act Agreement
% No. SAAM ID#... |
function blocks = getBlockBatch_memory(imdb,imBatch)
%GET_BATCH gets blockbatch from memory
% Detailed explanation goes here
blocks.data = imdb.images.frames(imBatch);
end
|
clear all;
data = dataPaths();
[~,my_foldername] = fileparts(pwd);
path_results = fullfile(data.resultsdir, ['Holger/2018_JR/ToyModels/WithDriver/rk4_drivStrength200uV/A_2NodesUnidirect/' my_foldername]);
results = load(fullfile( path_results, 'all_coh.mat'));
paramSizes = cellfun(@length, results.paramValues);
phas... |
function C = computeCmatrix(alpha, beta, gamma, delta)
theta_z = (delta-beta)/2;
R_z = [exp(-i*theta_z/2) 0; 0 exp(i*theta_z/2)];
%R_y = [cos(theta_y/2) -sin(theta_y/2); sin(theta_y/2) cos(theta_y/2)];
C = R_z;
endfunction |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This function creates the initial ecog structure that we will use later
% for STRF fitting. It is called as a function in a main "analysis
% control" script.
% Inputs:
% subjPath : the path to subject folder. This
%... |
function COM = CenterOfMass(matrix)
[baris kolom] = size(matrix);
ij = ones(baris,1)*[1:kolom] + (ones(kolom,1)*[1:baris])' - 2;
COM = sum(sum(ij.*matrix)) / double(sum(sum(matrix)));
end |
# process mission info data
function [msnTime_start, msnTime_stop] = processMissionInfo(inFile)
# read data file
inData =textread(inFile, "%s", "delimiter", " ");
# loop trough data
for i = 1:length(inData)
# find time start stamp
if (strcmp(inData(i,1),"time_start:"))
msnTime_start = str2num(cell2mat(inData... |
function calc = mtbi_extraction(filename, start, endfile)
addpath('/media/tmtb/LinuxDrive/matlab project');
addpath('/media/tmtb/LinuxDrive/matlab project/Pre-Epi-Post data');
addpath('/media/tmtb/LinuxDrive/matlab project/EEG');
addpath('/media/tmtb/LinuxDrive/matlab project/CRP toolbox/crptool');
close all;
src_ma... |
function sdsh=p_SD_ShapleyValue(v)
% P_SD_SHAPLEY_VALUE computes the surplus division Shapley value that
% is identical to the Shapley value of a TU-game v using Matlab's PCT.
%
% Source: David Pérez-Castrillo and David Wettstein (2001), JET
% Bidding for the Surplus : A Non-cooperative Approach to the Shapley Value
%... |
%% Subpixel analysis
function [BEFound, BullsEyeWidth, EstimatedVD, EyeTestedGuess, ClipIm] = SubPixelAnalysis(videoFrameGray,BEbbox,SizeOfLargeTarget,PixelsPerDegreeOfIm, x0, y0)
Gap=2;
ClipIm=videoFrameGray(round(-5+BEbbox(2)+(1:(BEbbox(4)+10))), round(-5+BEbbox(1)+(1:(10+BEbbox(3))))); %get just the bullseye with bu... |
function res = test()
import matlab.unittest.TestSuite
testCase = SimSocketTest; res = run(testCase);
testCase = MosaikSimulatorTest; res = [res run(testCase)];
testCase = MosaikAPITest; res = [res run(testCase)];
testCase = SimulatorUtilitiesTest; res = [res run(testCase)];
end
%suiteFolder = TestSuite.fromFolder(... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% Marco Brianti, Vito Cormun, PhD Candidates, Boston College,
% Department of Economics, Feb 18, 2019
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc
clear
close... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.