text stringlengths 8 6.12M |
|---|
function [flag, idxout] = isparam(param, paramlist)
% isparam Check parameter list to see if given parameter was specified
%
% flag = isparam(param, paramlist)
%
% returns true if param is found in paramlist (a cell array), false otherwise
%
% [flag, idxout] = isparam(param, paramlist)
%
% sam... |
clc;
clear all;
close all;
disp('Welcome to BMI calculator');
N=input('Enter your name');%ENTER YOUR NAME WITHIN ""
choice=menu('Welcome to BMI calculator','Imperial System','SI standard system');
if(choice==1)
w=input('Enter your weight in pounds');
h=input('Enter your height in inches');
BMI=703*... |
function [pjump] = poissonjp(njumps, lambda, ntraj)
% POISSONJP generate and plot a number of trajectories of a Poisson
% process with a given number of jumps
%
% [pjump] = poissonjp(njumps, lambda [, ntraj])
%
% Inputs: njumps - number of jumps to generate in each trajectory
% lambda - arrival intensi... |
function [ F ] = fork( varargin )
%FORK Syntactic sugar for creation of forks
if numel(varargin) == 1 && iscell(varargin{1})
args = varargin{1};
else
args = varargin;
end
nargs = args;
k = 1;
for j = 1:numel(args)
if iscell(args{j})
n = numel(args{j});
nargs(k:(k+n-1)) = args{j}(:);
... |
function e=greenTicket(a,b,c)
% Returns 0 if a and b and c are all different
% Returns 20 a=b=c
% Returns 10 if any two are same
% Taha Bakhtiyar 5/2011.
if (a == b && a == c)
e = 20;
elseif (a == b || b == c || a == c)
e = 10;
else
e=0;
end
end |
function Esol = fivepoint_solver(x1n,x2n)
%Computes Essential matrices from the normalized image coordinates x1n and x2n
%x1n should be 3x5 where each column corresponds to a homogeneous point
%x2n shoudl have the same format.
M = zeros(5,9);
for i = 1:5;
%Lägg till ekv
xx = x1n(:,i)*x2n(:,i)';
M(i,:) = xx(... |
Video_Path = 'D:\temp\A2.wmv';
Sampling_Rate = 25;
Video_Temp = VideoReader(Video_Path);
lastFrame = read(Video_Temp, inf);
Total_Frames = Video_Temp.NumberOfFrames;
RGB_Frame_Mth = read(Video_Temp, 25);
Gray_Frame_Mth = rgb2gray(RGB_Frame_Mth);
Filt_Frame_Mth = medfilt2(Gr... |
function termmang(term_typ,term_opr,term_loc)
%
% Utility function: TERMMANG
%
% The purpose of this function is to be the manager of all possible terms
% that can be added, edited, and iterated.
% Author: Craig Borghesani
% Date: 8/7/94
% Revised:
% Copyright (c) 1999, Prentice-Hall
% obtain handle infor... |
function ligne = creerLigneTableau(vecteur,typeDonnees,titre,sep,avecSautDeLigne)
ligne = [titre '='];
switch typeDonnees
case 'float'
if(length(vecteur)>1)
for(i=1:length(vecteur)-1)
ligne = [ligne num2str(vecteur(i)) sep];
end
end
if(avecS... |
function java_writebtffile()
global cs;
cs.writebtffile;
end
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Center for Astronomy Signal Processing and Electronics Research %
% http://casper.berkeley.edu % ... |
% ROTATE Rotate Diffraction object Data along a specified angle
%
% Usage:
% >> object=rotate(object,angle);
% The "angle" may be scalar angle (in degrees) or an orientation such as
% "left", "right", "clockwise", or "counter-clockwise".
%
% See also Xray, Diffraction, rotate
%
%
% created November 17, 2015 by Tommy ... |
function [M, S, W] = EM(X, k, M, S, W, delta)
m = size(X, 1);
g = zeros(m, k);
g0 = zeros(m, k);
%phi = @(x,mu,sigma) (1/(sqrt(2*pi)*sigma)*exp(-(x-mu)^2/(2*sigma^2)));
while 1
%E
g0 = g;
for i = 1:m
for j = 1:k
g(i,j) = (W(j)*normpdf(X(i),M(j),S(j... |
function [X,Y] = file2vec (fnameX, fnameY, nums) % fname: nama file tanpa index, nums: jumlah file
X = []; % X: input dengan tiap kolom berisi 1 gambar
for i = 1:nums % ulangi untuk setiap file
ff = [fnameX, num2str(i, '%03d'), '.jpg']; % nama f... |
function frameset=MakeMovieFrames(Temperature_List,Frames_Per_Second,V1,e1s,xscreen,yscreen)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Function to create a set of frames for a movie of the CTE quadratic
%surface. Developed by Zachary Jones on Jan 21, 2010.
%%%%%%%%%%%... |
% rosenbrock argmin = (1,1) min = 0
% http://orion.uwaterloo.ca/~hwolkowi/henry/teaching/w06/666.w06/666miscfiles/extrosenfn.m
doSave = 0;
close all
%alpha=1;
alpha=100;
rosen = @(X) (1-X(:,1)).^2 + alpha*(X(:,2)-X(:,1).^2).^2;
%{
xx = [-2:0.125:2]';
yy = [-2:0.125:3]';
[x,y]=meshgrid(xx',yy') ;
meshd = al... |
ip = '/Volumes/Data/PX/Lesion/Repeat/fMRI/DataAnalysis/Test/Mask/1001.hdr';
op = '/Volumes/Data/PX/Lesion/Repeat/fMRI/DataAnalysis/Test/1001.nii';
px_spm8_convert_nifti(ip,op) |
% See http://nibot-lab.livejournal.com/73290.html for more info
function save2pdf(name)
% Get the correct size of the figure
fig = gcf;
fig.Units = 'inches';
w = fig.OuterPosition(3);
h = fig.OuterPosition(4);
% Set the page properties
set(gcf, 'PaperUnits', 'inches');
set(gcf, 'PaperSize', [w ... |
function [T_Ckm1_Ck, T_Var_Ckm1_Ck] = GetCamTform(imOld, imNew, mask, K )
%GENCAMTFORM3 Gets normalized camera transform
%--------------------------------------------------------------------------
% Required Inputs:
%--------------------------------------------------------------------------
% imOld- n by m image, t... |
addpath('mex');
N=256;Ntheta=180;
f=phantom(N);
theta=(0:Ntheta-1)/Ntheta*pi;
epsilon=1e-12;%usfft accuracy
g=radon_usfft(f,theta,epsilon);
ff=radon_usfftadj(g,theta,epsilon,1);
imagesc(real([f ff]));
%adjoint test
fwd=@(f)radon_usfft(f,theta,epsilon);
adj=@(g)radon_usfftadj(g,theta,epsilon,0);
f=rand(N);
g=rand(N,Nth... |
classdef Galvo2pPlusStage_NoAmp < nih.squirrellab.shared.rigs.Galvo2p_NoAmp
% Galvo2PPlusStage_NoAmp - This rig description is identical to Galvo2p_NoAmp, but
% includes an instance of Stage as a device to talk to another instance
% of Matlab running the Stage Server app
%
% Created 03-18-2019... |
% process freq comb data
%
% 20190902
%% 201908902
% load('OM_FreqComb_df_1.00kHz_20190902T120908.mat');
% load('OM_FreqComb_df_5.00kHz_20190902T123737.mat')
% %%
% ffigure;
% plot(data.f, data.data, '.-');
% xlim([min(data.f), max(data.f)])
fns = filefun('OM_FreqComb_*.mat');
%%
ffigure;
... |
%%% Problem 1 %%%
% Part a)
Cqi = 8; % fF/(um^2)
Bge2 = 240; % fF/(eV * um^2)
phi = linspace(-0.3, 0.3);
vg = 0.7;
Cq = sqrt(Cqi^2 + (Bge2*phi).^2);
Cox = -(phi.*Cq)./(phi-vg);
figure(1)
plot(phi, Cq, phi, Cox);
xlabel('\phi (V)'); ylabel('Capacitance (fF/(um^2))');
legend('C_q', 'C_o_x');
title('PB1 - Part a');
gr... |
rand('state',sum(100*clock));
close all;
clear all;
clc;
disp('MAIN');
%% initialize
Settings.Vpn = input('Participant: ');
Settings.StimSize = 350;
Settings.StimDuration = 200;
Settings.Fixation.Size = 10;
Settings.Fixation.Duration = 1000;
Settings.ITI = 1000;
Settings.Instruction = 1; % sti... |
function Pej_Test_DEG_Enrichments(DEGoutputfolder,DB_Path)
Qthr = 0.05;
CFthr= 0; % Minimum fold change to be considered,
Shuffle = false; % If you put this on true, it shuffles the DEG qvalues, so should technically give flat pvalues all the time.
if nargin < 2
DB_Path = '/Users/pmohammadi/Desktop/LocalTMP/PEJ_R... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
%
%
% System response to sinusoidal inputs
% which element of vector a has the closest value to z
a=-4:4
z=2.3;
a-z
abs(a-z)
[m,i]=min(abs(a-z))
a(i)
% ... |
%I am using edge detection with gausian to clean up the noise and get the clear image, so that it's parts are easi;y observable for further expermient.
G = fspecial('gaussian',[5 5], 2.5);
Tongue1f = imfilter(Tongue1,G,'same');
Edge1f=edge(Note1f,'sobel');
sub_Tonguef = imcrop(Edge1f,rect_Tongue1);
figure(5), imshow(su... |
i = 0;
for compIndex = 1:size(B, 2)%828:size(B, 2)
compIndex;
if (~isempty(B{compIndex}{3}))
%i = i + 1;
minZ = B{compIndex}{3}(3);
%minZs(i) = minZ-B{compIndex}{5};
minY = B{compIndex}{3}(2);
minX = B{compIndex}{3}(1);
end
if (~isempty(B{compIndex... |
function [ PH CH colorScale] = plotSeries(varargin)
%
% [ PH CH colorList ] = plotSeries(AH,x,y,s,colormap,OPTIONS)
%
% Plots x and y data with each column of y color-coded according to scalar
% values defined in s. plotSeries is particularly useful to illustrate how
% a x-y dataset *changes* in response to som... |
% EXAMPLE_THREE_IMAGES Multicmap demo for two images.
%
% See also MULTICMAP, EXAMPLE_TWO_IMAGES, EXAMPLE_SPEECH.
% Author: Kamil Wojcicki, UTD, February 2012.
clear all; close all; clc; fprintf('.\n');
%% Create image data for plotting
% Read the sample sample images
data.clown = load( 'clown' );... |
function [MATRIX, lastday] = returnMatrix(DATE,LOAD, TEMP)
disp("Returning Matrix");
% Convert Date into Doubles
MATRIX = datevec(DATE);
lastday = DATE(length(DATE));
% Eliminate the garbage rows
MATRIX(:,6) = [];
MATRIX(:,5) = [];
dayVector = weekday(DATE);
MATRIX(:,5) = dayVector;
... |
function detect_door_action(sp,LeftRightFront,lidar,distance_to_door)
%Left:0,Right:1,Front:2
global door_index
pause_turning = 2;
pause_drive_forward = 5; %distance_to_door/50 + 8;
if door_index == 1
pause_drive_forward = pause_drive_forward + 6;
end
if door_index == 3
pause_drive_forward = pause_drive_forwa... |
function data = preCalcData(calcMode,calcHints,net,data,doPc,doPd,doFlattenTime)
% Copyright 2012 The MathWorks, Inc.
isGPU = isa(data.X,'gpuArray');
if isGPU && (doPc || doPd)
precision = class(gather(data.X(1)));
gpuMode = nnGPU('precision',precision);
gpuHints = gpuMode.hints;
gpuHints = nnGPU.netHints(net... |
clc;
clear;
utilpath = fullfile(matlabroot, 'toolbox', 'imaq', 'imaqdemos', ...
'html', 'KinectForWindows');
addpath(utilpath);
fnum = 200;
filename='Dataset_v1/Gaurav_2'; % File name for video and also data file
depthDevice = imaq.VideoDevice('kinect',2);
save(strcat(filename,'_camera'),'depthDevice');
... |
function D = disparity_ncorr(L, R)
% Compute disparity map D(y, x) such that: L(y, x) = R(y, x + D(y, x))
%
% L: Grayscale left image
% R: Grayscale right image, same size as L
% D: Output disparity map, same size as L, R
% TODO: Your code here
end
|
function [lib, extras] = mpiLibConf
% Default back to installed MPICH2 if using local scheduler
if ~isempty(getenv('MDCE_USE_ML_LICENSING'))
[lib, extras] = distcomp.mpiLibConfs( 'default' );
return
end
mpich = '/home/software/rhel6/mpich/1.4.1p1/lib/';
lib = fullfile(mpich, 'libmpich.so');
mpl = fullfile(mp... |
function I = disp_to_color (D,max_disp)
% computes color representation of disparity map
% code adapted from Oliver Woodford's sc.m
% max_disp optionally specifies the scaling factor
D = double(D);
if nargin==1
max_disp = max(D(:));
end
I = disp_map(min(D(:)/max_disp,1));
I = reshape(I, [size(D,1) size(D,2) 3]);
... |
display('- - - - - - 0 - - - - - -')
display('Closing open figures and clearing variables...')
display('- - - - - - - - - - - - -')
clear all,close all,set(0,'DefaultFigureWindowStyle','docked') |
function [L,G] = GetConnectedGraph(xi,sensing_range)
%GetConnectedGraph computes the connected graph in terms of Graph object and its Laplacian given a set of node coordinates (xi - 2xN
%vector) and a sensing range for each node
%Author: Ramviyas Parasuraman, ramviyas@purdue.edu
N = length(xi); % Number of nodes
sourc... |
% Stern Progress in Electromagnetics Research (1995), PIER 10, 123-186
% Finite Difference Analysis of Planar Optical Waveguides
%
% Quasi-TM (Ex) modes
%
% ._____________.____._______.____.__________________.
%
% condtions de dirichlet
function g=helm1D_TM
clc
clear all
close all
h=0.05;
g=uniform_grid(-5.0, 5.0,... |
function [g_s] = g(t, s)
theta = s(1);
theta_dot = s(2);
g_s = [theta_dot; 0.5*cos(t/2) - sin(theta)];
end
|
load meanLabDatabase.mat;
allColors = zeros(size(meanLabDatabase,2)/3, 3);
allColorsIter = 1;
for i = 1:3:size(meanLabDatabase, 2)
allColors(allColorsIter,:) = [meanLabDatabase(1,i) meanLabDatabase(1,i+1) meanLabDatabase(1,i+2)];
allColorsIter = allColorsIter + 1;
end
allColors = allColors';
labFig = plot_Lab... |
%%% Selma Wanna
%%% Homework #3
%%% Dr. James Sulzer
%% initialize the DH Table for RRR Mechanism
is_revolute_joints = [1 1 1 1 1 1 1];
num_of_links = length(is_revolute_joints);
a_vector = [0 0 0 0 0 0 0];
alpha_vector = [-pi/2 -pi/2 pi/2 pi/2 -pi/2 -pi/2 0];
%% Forward Kinematics Setup
seven_dof = ForwardKinematic... |
function varargout = select_player(varargin)
% SELECT_PLAYER MATLAB code for select_player.fig
% SELECT_PLAYER, by itself, creates a new SELECT_PLAYER or raises the existing
% singleton*.
%
% H = SELECT_PLAYER returns the handle to a new SELECT_PLAYER or the handle to
% the existing singleton*.
%
% ... |
%% Parte 1: Digitalizando uma imagem
% Para ler uma imagem no matlab é extremamente fácil.
% O comando usado é o imread. As imagens coloridas são
% arrays de 3 dimensões, sendo as duas primeiras as coordenadas
% x e z e a terceira depende do sistema de cor (No caso default,
% cada uma corresponde às cores Vermel... |
%
%
%
%
%
function object = subtractBaseline(object,varargin)
if nargin == 1
SignalNumber = size(object.Settings,2)-1;
Signals = 1:SignalNumber;
else
Signals = varargin{1};
end
for i = Signals;
Baseline = object.Settings{12,i+1};
BaselineData(:,i) = object.RawSignal.Data(:,i)-Baseline;
%BaselineData =... |
function y = valve_computation_liquid(type_out, val_in, type_in, Pin_bar, Pout_bar, Tin_C, fluidName)
% valve_computation_liquid Valve parameter computation (with no flashing)
%
% Use:
% y = valve_computation_liquid(type_out, val_in, type_in, Pin_bar, Pout_bar, Tin_C, fluidName)
% with:
% - type_out :... |
function varargout=save(object)
% manage multiple digitizers
if numel(object) > 1
for n=1:numel(object)
save(object(n));
end
return
end
% single digitizer
command=sprintf('DISK:CDIRECTORY "%s"',object.RemoteDirectory.Location);
fwrite(object.VISA,command);
fwrite(object.VISA,'DISK:PWD?');
current... |
%% Init
clc;
clear;
close all;
%% import Data
d.SpeicherA = importfile('../DATA/SolarspeicherA_07.09.2020 11_51_36.csv');
d.SpeicherB = importfile('../DATA/SolarspeicherB_2_07.09.2020 13_36_42.csv');
d.SpeicherB2 = importfile('../DATA/SolarspeicherB_07.09.2020 13_13_26.csv');
%% Berechnung UA Wert
t1 = d.SpeicherA.Scan... |
clear;
A=1.74;%Lm-2h-1bar-1
B=0.16;%Lm-2h-1bar-1
S=307*10^-6;%m
y_=.1:.2:.5;
c_ls=.1;
fai=.5;
q_ls=1;
c_f_ro=35;
q_f_ro=(1-fai)*q_ls/fai;
c_os=73.07/100;
mem_area=.01:.01:.4;
for i=1:length(y_)
y=y_(i);
c_b=c_f_ro/(1-y);
q_b=q_f_ro*(1-y);
deltaP_pro_max=c_os*(c_b-c_ls);
deltaP_pro_=1:1:deltaP_pr... |
function init_mass_pioneer
global Mass
Mass.Iweight = [200 300 450]*0.4535924; % [lb]
Mass.Ixx = [34.832 34.832 34.832]*1.3558; % [slug-ft^2]-->kg m^2
Mass.Iyy = [67.08 67.08 67.08]*1.3558; % [slug-ft^2]-->kg m^2
Mass.Izz = [82.22 82.22 82.22]*1.3558; % [slug-ft^2]-->kg m^2
Mass.Ixz = ... |
% This is material illustrating the methods from the book
% Financial Modelling - Theory, Implementation and Practice with Matlab
% source
% Wiley Finance Series
% ISBN 978-0-470-74489-5
%
% Date: 02.05.2012
%
% Authors: Joerg Kienitz
% Daniel Wetterau
%
% Please send comments, suggestions, bugs,... |
function Q = IC(x, y)
% function Q = IC(x, y)
% Purpose: Set Initial conditio for 2D Advection. Simple sinecos wave
Q(:,:,1) = -1 ...
+10*(sqrt(0.04 - (x+0.5).^2 - (y-0.5).^2)).*( (x+0.5).^2 + (y-0.5).^2<= 0.04)...
+2*(-sqrt(((x-0.5).^2 + (y-0.5).^2)/0.04) + 1).*( (x-0.5).^2 + (y-0.5).^2<= 0.04).... |
%% Visualize clustered data
clear variables
close all
ids = {'9861','10021','12876','14380','15496','15697'};
nbrains = length(ids);
celltypes = {'neurons','oligodendrocytes','astrocytes'};
ncelltypes = length(celltypes);
for bnr = 1:nbrains
for cnr = 1:ncelltypes
%% Load data
id = ids{bnr};
fnaddition = ['Select... |
% Functions to balance the Dataset. It uses oversampling.
function datastore = balanceDatastore(datastore, desiredNumObservation)
labelCount = countEachLabel(datastore);
if (isa(desiredNumObservation, 'string'))
switch desiredNumObservation
case "max"
desiredNumObservation = max(labelCount{:, 2... |
clear; close all;
addpath('../../matlab_lib');
addpath('../../matlab_lib/FastICA_21');
ica_filename_list = { ...
'./data/raw_S2WA_5_SUP_1.txt'
};
train_filename_list = { ...
'./data/raw_S2WA_5_SUP_1.txt'
};
train_output_filename = ...
strcat('../../../../../RNN/LSTM/data/input/', ...
'exp_S2W... |
function nd = findcurrie_n(nb,FPR,FNR)
% 本底计数nb,实现误报率FPR,漏报率FNR所需的最小样品净计数nd
% 联立以下方程求解nd
% Lc = a1*sqrt(2*nb) % a1对应误报率要求阈值达到Lc
% nd=Lc+a2*sigma(nd) % a2 对应漏报率要求nd比Lc高多少
% sigma(nd)=sqrt(nd+2*nb) % nd的误差
%
% Reference:
% Knoll.P97-98
% syms x b a1 a2
% eq = x == a2*sqrt(2*b)+a1*sqrt(x+2*b... |
% This code is to implement BCH decoding algorithm
% I use two algorithm:
% 1. Berlekamp-Massey Algorithm
% 2. Euclidean Algorithm
clc; clear;
% ----- set up Galois Field primitive element and field -----
t = 5; % error correcting capability
m = 6;
alpha = gf(2,m); % primitive element of GF(2^m)... |
function [ EdgeBin ] = EF_EdgeQuantization( EdgeMap, numBin )
%EF_EDGEBINNING Summary of this function goes here
% Detailed explanation goes here
% [height, width] = size(EdgeMap);
%
% EdgeBin = zeros(height, width);
%
% for i=1:height
% for j=1:height
% interval = 360/numBin;
% if EdgeMap(i,j)... |
dico = imread('re.jpg');
% For demo purposes, let's resize it to be 64 by 64;
dico = imresize(dico, [64 64]);
% Get the dimensions of the image. numberOfColorBands should be = 3.
[rows columns numberOfColorBands] = size(dico)
ca = mat2cell(dico,4*ones(1,size(rgbImage,1)/4),4*ones(1,size(rgbImage,2)/4),3);
%ca = ... |
function [J_Ef, J_Wf, J_Es] = get_Js( parms, mats, soln )
%build matrices corresponding to third rank tensor contributions from
%matrices that depend on body position (E, ET, W)
%--Various variables
%# of x-vel (flux) points
nu = get_velx_ind( parms.m-1, parms.n, parms.mg, parms );
%# of y-vel (flux) poi... |
classdef Gauss_NormInvGammaDist < ProbDist
% p(X,mu,sigma2|m,k,a,b) = N(X|mu, sigma2) NIG(mu,sigma2| m,k,a,b)
properties
muSigmaDist;
productDist;
end
%% Main methods
methods
function m = Gauss_NormInvGammaDist(varargin)
[m.muSigmaDist, m.productDist] = processArgs(varar... |
%% density function mfile
function res = densityfun(theta, x, y)
res = 1/sqrt(2*pi)*exp(-(y-(theta(1)+theta(2)*x)).^2/2);
end
%% define the scaled log likelihood function
function res = likelihood(func_handle, theta, x, y)
res = -sum(log(func_handle(theta, x, y)))/length(x);
end
%% Define MLE function
% Th... |
function rgb2colordef(rgb,cmapname,fname)
%RGB2COLORDEF Create color definitions file for use with Circos.
%
% RGB2COLORDEF(RGB,CMAPNAME,FNAME) creates the color definitions file FNAME
% based on the color map name CMAPNAME and the colors defined by the N-by-3
% array of RGB values (values between 0 and 1).
%
% ... |
clear all;
clc;
im=imread('breast_Xray.tif');
imd = double(im);
[rows,cols]=size(im);
out=zeros(rows,cols);
for i=1:rows
for j=1:cols
pixel=imd(i,j);
out(i,j)=255-pixel;
end
end
out=uint8(out);
figure;
subplot(1,2,1); imshow(im); title('Original')
subplot(1,2,2); imshow(out); titl... |
classdef YangSumPool < dagnn.Filter
methods
function outputs = forward(self, inputs, params)
outputs{1} = sum(sum(inputs{1},1),2) ;
end
function [derInputs, derParams] = backward(self, inputs, params, derOutputs)
sz = size(inputs{1});
derInputs{1} = repmat(derOutputs{1}, [sz(1) sz(2) 1 ... |
function S = aspiral(n)
%SPIRAL SPIRAL(n) is an n-by-n matrix with elements
% 1:n^2 arranged in a rectangular spiral pattern.
% Usage: S = aspliral(n);
% polar(S); or plot(S)
% Enjoy the pretty
S = [];
for m = 1:n
S = rot90(S,2);
S(m,m) = 0;
switch(m==1)... |
function [results] = testMLsim(varargin)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%BLP ESTIMATION WITH SIMULATED DATA SET
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% D... |
% util.MOVE_POINT was generated on Sat Jan 04, 2014 08:39:28 PM by xcpp
%
% Adds a number to each of the coordinates of a point.
%
% parameters:
%
% `p`: the point to be moved.
% `x`: the amount the point should be moved.
%
function varargout = move_point(p, x, varargin)
tdump = excentu... |
function microtonic_resolution = get_resolution(orchestra_instance)
% GET_RESOLUTION - Accessor of slot 'microtonic_resolution' in an
% orchestra instance.
%
% Usage: microtonic_resolution = get_resolution(orchestra_instance)
%
microtonic_resolution = orchestra_instance.microtonic_resolution; |
function PlotSubjVarGeneralization()
dd216 = load('../output/group468/ddCRP2000_rng1_subj_var.mat');
dd216 = dd216.subj_var;
dd172 = load('../output/group468/ddCRP3000_rng1_subj_var.mat');
dd172 = dd172.subj_var;
dd155 = load('../output/group468/ddCRP4000_rng1_subj_var.mat');
dd155 = dd155.subj_var;
dd140 = load('../o... |
function [ validUDATA ] = checkUDATA( fidLog, CTINFO )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
CTINFO = CTINFO;
validUDATA = 0;
try
if CTINFO{1,5} == 39
WriteToLogFile(fidLog,'U_DATA extended Format is used');
validUDATA = 1;
else
WriteToLogFile(... |
%%
%%
%%
function max_val = end_concs(tname, sd, Timing, Tstart, Tend, Toffset)
max_val = [];
for i = 1: numel(Timing);
tid = find( strcmp( sd{1}.DataNames, tname ) );
time = sd{i}.Time - Toffset;
data = sd{i}.Data(:,tid);
id = find((time >= Tstart)&(time <= Tend));
id = max(id);
max_val = [max_val, data... |
function glycanString = glycanStrwrite(glycanStructObj,varargin)
%glycanStrwrite write the sequence of a glycan to a string
%
% GLYCANSTRING = glycanStrwrite(GLYCANSTRUCTOBJ, GLYCANFORMAT) writes the
% sequence of a glycan to a string named as the string output argument
% GLYCANSTRING using a sequence format spec... |
function [ w ] = flip_it( v )
w = v(end:-1:1);
end
|
% Last Change: Mon Jun 04 10:00 AM 2007 J
n = 1e5;
d = 30;
x = randn(n, d);
mu = randn(n, d);
for i=1:10
y = gden(x, mu);
end;
|
function [p_r, x, p_dist] = kdf(p_st, b_width)
%=========================================================================
% Function explanation:
% This function, the Kernel Density Function (kdf), generates the distribution of the observed price data for
% a partiuclar agnet.
%
% Function input:
% p_st: S... |
function strct = copse_modify_struct( strct, fld, newval )
%Modify a struct, error if field doesn't already exist
if ~isfield(strct,fld)
error ('struct "%s" no field "%s"',inputname(1),fld);
end
strct.(fld)=newval;
end
|
function [trackDist, lon_interp, lat_interp]=glider_track_distance(lon, lat)
% Usage: [trackDist, lon_interp, lat_interp]=glider_track_distance(lon, lat)
%
%lon and lat are 1D vectors with gps coordinates for all casts.
%Since the glider only surfaces every few casts, seperate casts from the
%same sequence have the ... |
function matrix = skew(vector)
matrix = [0 -vector(3) vector(2);
vector(3) 0 -vector(1);
-vector(2) vector(1) 0];
end |
function pc=RemoveBaseDrift_1D(InputTrace,FrameRange)
%
% function RemoveBaseDrift(InputTrace,FrameRange)
%
% Will create a SmoothedInputTrace that will be subtracted from InputTrace.
% Will be used to remove very slow drift in the baseline of data InputTrace
% in which we are attempting to detect dye-protein landing ... |
% A rough prefiltering step, where images that does not contain a single
% peak that is above 5*average, is removed (step 2)
data = datacube;
mz_list = mzs;
s = size(data);
no = s(3);
dim = s(1)*s(2);
output = zeros(1,2);
ind = 1;
idx = zeros(1,no);
% find significant imgs
for i=1:no
img = data(:,:,i);
img(i... |
function [x,y] = shuffle(x,y)
% SHUFFLE - Desordena un conjunto de patrones de entrenamiento
%
% [x,y]=shuffle(x,y);
%
% Copyright (c) Pedro L. Galindo (1998)
[dummy,orden] = sort(rand(1,size(x,2)));
x = x(:,orden);
if nargin==2,
y = y(:,orden);
end; |
function optimal = Quadratic_Inverse_YALMIP(param, data)
% Define Variables
s = data.s;
x = data.x;
epsilon2 = param.epsilon2;
d = param.d;
C = param.C;
h = param.h;
W = param.W;
H = param.H;
solver = param.solver;
... |
%% read picture
path = 'C:\Users\takumi\Documents\MATLAB\ECE407\final\test\';
file = dir(fullfile(path,'*.bmp')); % get all picture's info
fileNames = {file.name}'; % read name of pictures as n*1 vector
n = size(fileNames,1);
test = zeros(100*100,n);
for k = 1 : n
file_path = strcat(path, fileNames(k));
... |
function permMat = myrandperm(inputMat)
% MYRANDPERM(A) returns matrix A with elements randomly permuted. This
% function uses RANDPERM.
numElements = prod(size(inputMat));
randInd = randperm(numElements);
permVect = inputMat(randInd);
permMat = reshape(permVect,size(inputMat)); |
function output = versionEncode(string)
% Convert version number string (x.y.z) to an integer for easy comparison.
% 2.12.6 becomes 2012006.
if ischar(string)
version = cellfun( @(s)sscanf(s,'%f'), strsplit(string,'.') );
elseif isnumeric(string)
version = string;
else
error('Invalid input');
end
if numel... |
% designate a subset of files to process (or leave it empty to process all)
FP_PROC_SUBSET = [ "103119" ];
% FP_PROC_SUBSET = [ "0124", "0129" ];
% change these to the relevant locations on your disk
FP_RAW_FILE_DIR = 'C:\Users\zls5\Desktop\Zach\Alexa reformatted';
FP_PROC_FILE_DIR = 'C:\Users\zls5\Desktop\Zach\Alexa ... |
% function fDegreeHour = ...
% ComputeDegreeHourFromTemperatureSignal( ...
% atRoomTemperatureSignals, ...
% fUpperBound, ...
% fLowerBound )
%
function fDegreeHour = ...
ComputeDegreeHourFromTemperatureSignal( ...
atRoomTemperatureSignals, ...
fUpperBound, ... |
clear all
close all
addpath(genpath('/home/julia/workspace/lcfmri/matlab/'));
% load data
data_dir='/home/julia/projects/lc/raw/20181006_165517_JH_LC_rsfMRI_03_1_1/25/';
scan='2';
acq_params=readBrukerParamFile(strcat(data_dir,'acqp'));
method_params=readBrukerParamFile(strcat(data_dir,'method'));
visu_params=readBru... |
function fit_musc_rats
%%
addpath ~/ratter/Analysis/Pbups
%% Get the data
ratnames=bdata('select distinct(ratname) from pbups.pbupssumm')
for rx=1:numel(ratnames)
this_rat=ratnames{rx};
if ~exist(['chrono_' this_rat '_rawdata.mat'],'file')
% Use all control sessions, not just the fof ones.
first_sess=b... |
function [image] = histHakan(image)
z = zeros(1,256);
zCum = zeros(1,256);
[r,c]=size(image);
for i=1:1:r
for j=1:1:c
z(image(i,j)+1)=z(image(i,j)+1)+1;
end
end
for i=1:1:size(z)
z(i)=z(i)/(r*c);
value=0;
for j=1:1:i
value=z(i)+value;
end
... |
%%
clear all;
close all;
clc
%note, this matters. Overtraining is more severe for larger numbers of
%components; at around 4 components, Grid and Random become pretty similar
%(74% correct or so).
nComponents = 10;
load libsCoinData.mat ds
obsInfo = ds.observationInfo;
gridKeys = cat(1,obsInfo.gridN... |
%==========================================================================
% Algoritmo transforma stalk-surface-below-ring em que:
% Entrada: Matriz[qtde_Instâncias,1] com valores "f", "y", "k" e "s"
%
% Retorno: Matriz[qtde_Instâncias,4] com valores 0's e 1's de modo que:
% fibrous(f) = [1 0 0 0]
% ... |
function [ out ] = prep_rejectArtifactMAxMin( dat, varargin )
% dat = data;
opt = opt_cellToStruct(varargin{:});
% Need to check option default
% if isfield(opt.threshold)
% warning('Please input the value of threshold');
% end
% if ~isfield(opt)
% warning ('There is no threshold, Please input the value of t... |
%a0=1.0e-06*[0.0291; -0.0485; -0.1299; -0.0384; 0.0844; 0.0309; 0.0622; -0.1391];
%options = optimset('Algorithm','active-set','Display','off');
options = optimset('Algorithm','interior-point','Display','off');
%func = @(x) exp(x(1))*(4*x(1)^2 + 2*x(2)^2 + 4*x(1)*x(2) + 2*x(2) + 1);
func = @(a) -(a'*N1-0.5*a'*M2*a); ... |
%% script to regress covariates (age, gender, mean network cortical thickness and whole brain ct) out of raw ct network stacks
% ct basc scale 11 admci template frontal networks and MTL (#2,3,6,11)
clear all
model = '/home/angela/Desktop/adsf/ct_subtypes/admci/model/admci_model_20161013_civet_sc11.csv';
[tab,sid,ly,... |
% Copyright Claudio Menghi, University of Luxembourg, 2018-2019, claudio.menghi@uni.lu
function [input,robustness]=falsify(abstractedmodel,init_cond, input_range, cp_array, phi, preds, TotSimTime, opt)
global m
disp('Falsifying');
disp(datestr(now));
m=abstractedmodel;
opt.... |
function C1 = RieszSynthesis(C1, config)
% RIESZSYNTHESIS perform the backward 3D Riesz transform
%
% --------------------------------------------------------------------------
% Input arguments:
%
% C1 Riesz coefficients. It consits in a 3D matrix
% whose 3rd dimension corresponds to Riesz channels.
%
% CONFIG RieszCo... |
%% 'pipeline' script
nodeInfo = []; % structure just to hold node labels, xyz coords etc
data = {}; % actual data;
summary = []; % for summary statistics, etc
filename = '\data\Colleen_ts.xlsx'; % using colleen's TS in a folder 'data'
thresh = .5; % limit of FD for keeping frames
numIter = 5... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.