text stringlengths 8 6.12M |
|---|
function [betha] = fdm_twod_validacao_coef_betha(no, meshing)
betha = [0, 0];
|
classdef VTOLAnimation < handle
%
% Create satellite animation
%
%--------------------------------
properties
center_handle
panel1_handle
panel2_handle
stick_handle
target_handle
length
width
square
distance
panelLeng... |
function [T S]= TV_L2_Decomp(Im, lambda)
%TV_L2_DECOMP Summary of this function goes here
% Detailed explanation goes here
if ~exist('lambda','var')
lambda = 2e-2;
end
S = im2double(Im);
betamax = 1e5;
fx = [1, -1];
fy = [1; -1];
[N,M,D] = size(Im);
sizeI2D = [N,M];
otfFx = psf2otf(fx,sizeI2D);
otfFy = psf2ot... |
function [R,lambda] = linreg_initial( X , Y , lambda )
%% method 2: using SVR in liblinear %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X = [ones(size(X,1),1) X];
featdim = size(X,2);
shapedim = size(Y,2);
param = sprintf('-s 12 -p 0 -c %f -q', lambda);
%param = sprintf('-s 12 -p 0 -c 0.3 -q');
R_tmp = zeros( fe... |
%Lista de exercícios – Carregamento transversal
%Esboçar gráficos no Matlab de esforço cortante e momento fletor p/ os
%carregamentos abaixo. (Lista 8 numero 4)
clear all
close all
clc
disp('|*******************************************************|');
disp('| Programa que Esboça gráficos de ... |
syms v psi lr lf delta a L x y
f = [ v*cos(psi + atan(lr/L*tan(delta))); v*sin(psi + atan(lr/L*tan(delta))); a; v/lr*sin(atan(lr/L*tan(delta)))];
A = jacobian(f, [x; y; v; psi]);
B = jacobian(f, [a; delta]);
X = [x; y; v; psi];
U = [a; delta];
C = f - A*X - B*U; |
%% RDIR Enhanced - Examples of use
%
% This script demonstrates how to use the different abilities of the
% enhanced |rdir| function.
%
% Examples are based on |matlabroot| directory content. Results may vary
% depending on your version of Matlab.
%
%% Standard use
rdir([matlabroot, '\*.txt'])
%% Using double wildca... |
function [env_inc,env_dec,env_all] = set_generic_environmental_probabilities(disps,r_inc,dp)
% generate generic ON and OFF probability distributions
LPNORM = 2; % power of generalized distribution
k = 0; ... |
clear all;
I=imread('image4.jpg');
% Thresholding is the classification of each pixel into two types of information (background/object)
[m,n]=size(I);
segmented_image=zeros(m,n); % initialisation with zero
blk_size=32;
for i=1:blk_size:m-blk_size+1,
for j=1:blk_size:n-blk_size+1,
local_T=graythresh(I(i:i+bl... |
function [ output ] = mutual( data,nof )
[m,n]=size(data);
data=round(data);
data(isnan(data))=0;
data=data+1;
data=[1:n;data];
m=m+1;
mu=zeros(n,n);
for i=1:n
for j=i+1:n
x=data(2:m,i);
y=data(2:m,j);
ma=max(max([x,y]));
px=zeros(1,ma);
py=px;
pxy=zero... |
% Description:
% This code computes and plots decoding accuracy as function of sample size
% for all datasets, using a Linear Discriminant Analysis (LDA).
%
% by:
% Etienne Combrisson (1,2) [PhD student] / Contact: etienne.combrisson@inserm.fr
% Karim Jerbi (1,3) [PhD, Assistant Professor]
% 1 DYCOG Lab, Lyon Neurosc... |
function [] = Engage_McSpace2()
global H
global XStimParams
global TDT
global FN
global C_
global M_
global GUI
% Engage_McSpace2
%*******************************************************************************
% The McSpace2 Test operation 3/15/07
% plays co-localized Dean & McAlpine-like stimuli
% als... |
[x1,Fs] = audioread('sample.mp3');
ip=x1(:,1);
figure;
stem(abs(fft(ip)));
title('input');
xlabel('n');
ylabel('x[n]');
fpass=1000;
fstop= 1500;
fs=8000;
wpass=(2*fpass)/fs;
wstop=(2*fstop)/fs;
d1=0.9;
d2=50;
wc=(fpass+fstop)*2*pi/(2*fs);
tb=((fstop-fpass)*2*pi)/fs;
N=(8*pi)/tb;
h=zeros(1,N);
for n=1:N
h(n)=sin(... |
clear
close all
%% Adding file path
addpath('D:\research_UW\PIT\AVI_Files\')
addpath(genpath('D:\research_UW\lib'))
%% Getting info about the file from log
prompt = '\n Enter filename: ';
filename = input(prompt, 's');
% filename = 'pit_0451';
temp = strsplit(filename, '_');
case_id = temp{2};
log_da... |
function [ leOut ] = clipDataToTimeWindow( leIn, startTime, timeWindow, logFreq)
% Returns a clipped logElement
if nargin < 4
logFreq = 400;
end
if startTime < leIn(1).time(1)
error("startTime must be larger or equal than first logged time!");
end
if startTime+timeWindow > leIn(1).time(end)
error("endTime must... |
%% Augment the existing stimuli names .mat
% imnums 261 to 270
stimuliNamesApr = [repmat({'pilot_waves_sparse'}, 5, 1); ...
repmat({'pilot_noisebars_sparse'}, 5, 1)];
% imnums 271 to 320
stimuliNamesJun = [repmat({'patterns_sparse'}, 5, 1); ...
repmat({'gratings_sparse'}, 5, 1); ...
repmat({'noisebars_sparse'}, 5, ... |
clc;
clear variables;
dim=[5 20 100 250];
%dim=[260]
%dim=round(linspace(1,256,10));
n=imread('rect_17.jpg');
[row,col,channel]=size(n);
I=rgb2gray(n);
I=double(I);
isRandom=0;
% Initializing variables %
eigval_u=zeros(row,row);
eigvec_u=zeros(row,row);
eigval_v=zeros(col,col);
eigvec_v=zeros(col,col);
e... |
function sy9(n)
% 实验九 彩色图像
% n=1 生成红色圆
% n=2 生产四方块rgb图
% n=3 对角线三颜色图 rgb图像方法
% n=4 对角线三颜色图 索引图像方法
% n=5 边缘检测、图像分割
if(n == 1)
% 生成红色圆
a = zeros(256);
for i=1:256
for j=1:256
if(sqrt((i-128)*(i-128)+(j-128)*(j-128)) <= 128)
a(i,j... |
function y = nanmad(x,varargin)
% Median absolute deviation, ignoring NANs
m = nanmedian(x,varargin{:});
y = nanmedian(abs(x - repmat(m,size(x)./size(m))),varargin{:}); |
%% Monte-Carlo Modeling of Electron Transport
% Assignment 1 - Joanna Abalos 100962263
close all
clear
clc
Assignment1_1
Assignment1_2
Assignment1_3
% In this assignment, 10 000 particles are modelled to calculate
% temperatures, make models and observations using Monte-Carlo modeling. 7
% particles are plotted to o... |
function [] = RunPerformance(nc)
DataIn=csvread('Test cases.csv',2,0,[2,0,(1+nc),34]);
[~,~,C9,~]=Performance(DataIn);
for i=1:nc
TakeOffPerformance(i)
ThrottleBackDesignPoint(i)
end
clc
if nc>1
mes=['Process complete, for results see files named Input_1 - Input_' num2str(nc)];
disp(mes)
else
mes='P... |
classdef Bus < handle
properties
location % (x,y) vector
road % index of current road
velocity % (x,y) vector for velocity
acceleration % the bus acceleration per tick
breakspeed % the bus breakspeed per tick
busLength % the length of the bus from the front
end
methods
... |
function [tex_ch] = GetTexCh(obj,tex,i)
%GetTexCh Summary of this function goes here
% Detailed explanation goes here
tex_ch = tex(1+obj.n_face_pixels1*(i-1):obj.n_face_pixels1*i,:);
end
|
clc;
% to fetch data
filename = './lab1data1.txt';
%to load data
Data2 = load(filename);
X = Data2(:,1);
y = Data2(:,2);
%% 2.1
figure(1)
plotData(X,y); %to scatter plot data
%% 2.2
% to calculate parameters
w = LinearReg(X,y);
disp('the parameters for data1 are ')
disp(w);
%% 2.3
% to compute profit
pr_35 = w(1,1... |
function [] = SetInfo_spacePicker;
% SetInfo_spacePicker
global GUI
global H
global FN
global REC_INFO
if exist1('H.pickerfig') figure(H.pickerfig); end
% check for UseLastLocations_flag
if get(H.UseLastLocations,'value')
GUI.UseLastLocations_flag =1;
eval(['load ' FN.current_path 'Locations_cur... |
function sc22mat(file)
% SC22MAT converts sc2 files to matfile
%
% MTL2MAT(name_core)
% name_core is name of mtlfile without extension (.sc2) and
% running index. The matlab-file will be named name_core.mat
% Klaus Hartung (hartung@aea.ruhr-uni-bochum.de)
% Lehrstuhl fuer allg. Elektrotechnik und Aku... |
close all;clear all;clc;
disp('======= matlabDisp_Test =======');
preDir = 'E:\KITTI_DataSet\KITTI2012\data_stereo_flow\training';
saveDir = 'E:\StereoVision\Code\matlab_Disparity\';
Files = dir('E:\KITTI_DataSet\KITTI2012\data_stereo_flow\training\image_0\*10.png');
% error threshold
tau = 3;
d_err = 0;
for i=1:leng... |
function[code]=oned2twod(dop,l,n)
[r,w]=size(dop);
for i=1:r
dop2=cumsum(dop(i,:));
a1=[];
b1=[];
code1=[];
a1=zeros(1,w);
b1=zeros(1,w);
for j=1:w
if j<w
[a1(1,j),b1(1,j)]=one2twof1(dop2(1,j),n);
if j>1
[a0,b0]=one2twof1(dop2(1,j-1),n);
... |
%% Control point of Matlab program
%% version : 1
%% 0911006 & 0911015
% get attribute table
eval('atab');
% Weight calculate
eval('w_calc');
% rating calculation
eval('r_calc');
% Grey NOrmalized Matrix Calculation
klm = 1;
QNorm = [];
for i = 1:size(Q,2)
q1 = Q(:,klm:klm+1)/max([Q(:,klm) ; Q(:,klm+1)]);
... |
function [ results ] = phAnalyzeAP(dData, acqRate)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
[gUp, gDown]=phUtil_FindXings(dData, 0, 1); % find the zero crossings
gUp=floor(gUp);
gDown=ceil(gDown);
if nargin<2
acqRate=10;
end
if isempty(gUp)
... |
function [output] = myCount(raw_cell,Letter)
output = 0;
rc = size(raw_cell);
r = rc(1);
if(Letter < 92)
Letter = lower(Letter); %make lower case letter
end
for i = 1:r
if ( isempty(raw_cell{i}) )
break; %exit condition
elseif (raw_cell{i}... |
% Heat Equation by implict
clear; clc; close all;
h=0.1; k=0.5*h^2; alpha=k/h^2; beta=1+2*alpha;
x=0:h:1; t=0:k:0.5;
n=size(x',1); m=size(t',1);
u=zeros(m,n);
Real=zeros(m,n);
u(1,:)=sin(pi*x);
A=zeros(n-2,n-2);
B=zeros(n-2,1);
A(1,1)=beta; A(1,2)=-alpha; A(n-2,n-3)=-alph... |
function sino = phaserLargeDetectorBinning( sino )
if ndims(sino) ~= 3
error('only works for 3D geomerty. \n');
end
nv = size( sino, 1 );
if mod( nv , 6 ) ~= 0
error('incorrect detector height. \n');
end
k = nv / 6;
for i = 0 : k-1
row = ( sino( 2*i+1,:,: ) + sino( 2*i+2,:,: ) ) / 2;
sino(... |
clear;
fid = fopen('data');
data_in = textscan(fid, '%f');
data = cell2mat(data_in);
% (a)
sample_mean = mean(data); % m
sample_variance = var(data, 0); % s^2
fprintf("(a) sample mean: %.2f, sample variance: %.2f\n", ...
sample_mean, sample_variance);
% (b)
sorted_data = sort(data);
len = length(data); % len... |
function [ status, message ] = op_Phasor( data_handle, option, varargin )
%OP_Phasor Does Phasor analysis map on t/T images/traces
%--------------------------------------------------------------------------
%
%---Batch process----------------------------------------------------------
% Parameter=struct('selected_data... |
%===================================================
% Machine Vision and Cognitive Robotics (376.054)
% Exercise 5: Clustering
% Daniel Wolf, Michal Staniaszek 2017
% Automation & Control Institute, TU Wien
%
% Tutors: machinevision@acin.tuwien.ac.at
%
% MAIN SCRIPT - DO NOT CHANGE CODE EXCEPT FOR THE PARAMETER SETTIN... |
function [El, Eh, mY, mX, Y, X, Vl, Dh] = Get_PCA_Train( par )
%calculate PCA of training faces
img_path = par.train_path;
img_type = par.train_type;
img_dir = dir( fullfile(img_path, img_type) );
%load( 'Data/train3.mat');
X = [];
Y = [];
img_num = length(img_dir);
%img_num = size(images_hr, 3);
for i = 1 : img_nu... |
function drl_preproc( line_count, dim_x, dim_y )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
global drill_present
global drl_data % The cell array holding the header specifications.
global drl_def % The cell array holding all the aperture definition data.
global drl_header_data % Th... |
classdef schedule < handle
properties
name;
children = []; %List of child states
parent = []; %List of parent states
list = [];
fullList = [];
fullTrialList=[];
retry = 0; %0 = ignore, 1 = immediate, 2 = random
hasTr... |
function b = fn_isemptyc(c)
% function b = fn_isemptyc(c)
%---
% returns an array of logicals of the same size as cell array c indicating
% which elements of c are empty
% Thomas Deneux
% Copyright 2011-2012
b = false(size(c));
for k=1:numel(c), b(k) = isempty(c{k}); end
|
c = repmat(2:100, fliplr(size(2:100)));
disp(['The number of the distinct elements is ',num2str(length(unique((c(:)').^repmat(2:100, size(2:100))))),'.'])
|
function stpPlotParabola( a, b, c, sp, color)
%% 绘制二次曲线的函数
x = min(sp(:, 1)) : 0.1 : max(sp(:, 1));
y = a * x .* x + b * x + c;
plot(x, y, str);
plot(sp(:, 1), sp(:, 2), [color, '*']);
end
|
% Copyright (c) 2017, Amos Egel (KIT), Lorenzo Pattelli (LENS)
% Giacomo Mazzamuto (LENS)
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are met:
%
% * Redistributions of source ... |
function p = tUniqueModel(p,stims,weights_before)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Matlab code for making a Self Organising Feature Map grid (SOFM)
%
% Rosie Cowell (Dec 2011)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Load the p... |
function img = fn_cubeview(data,d,r)
% function [img =] fn_cubeview(data[,d[,r]])
%---
% creates an image of the 3-dimensional data where we see 3 faces of a
% cube with xy, yz and xz sides
%
% if no output is requested, displays the image in a figure and add edges
%
% faces display: ______ ... |
function varargout = GUI(varargin)
%GUI M-file for GUI.fig
% GUI, by itself, creates a new GUI or raises the existing
% singleton*.
%
% H = GUI returns the handle to a new GUI or the handle to
% the existing singleton*.
%
% GUI('Property','Value',...) creates a new GUI using the
% given pr... |
function [sorted_tri] = SortTri(obj)
%SortTri Summary of this function goes here
% Detailed explanation goes here
sorted_tri = num2cell(1:obj.rf.n_vert);
for i = 1:obj.rf.n_vert
[tri_set, ~] = find(obj.tri == i);
sorted_tri{i} = tri_set;
end
end
|
function funs = tuto_5_functions
funs.square_function=@square_function;
funs.squareAndCubeFunction=@squareAndCubeFunction;
funs.costFunctionJ = @costFunctionJ;
end
function J = costFunctionJ(X, y, theta)
%X is the design matrix containing our training examples
%y is the class labels
m = size(X, 1); % number of ... |
sorted_dir = '/media/basile/09F6A5BC59F7E39C/Dominic_Data/Ronnie/P06/P06-quning';
chan_map = '/home/basile/Desktop/Code/Preprocessing_pipeline_Neuropixel/Kilosort2/configFiles/neuropixPhase3A_kilosortChanMap.mat';
setenv('NEUROPIXEL_MAP_FILE',chan_map);
ks = Neuropixel.KiloSortDataset(sorted_dir);
ks.load();
stats = ks... |
clear all;
load calculated_features.mat
p=ones(1,39);
h=ones(1,39);
%1
i=1;
[p(i),h(i)] = ranksum(clc_feat.avg_power(1,1:7),clc_feat.avg_power(1,8:14),'alpha',0.01);
%2
i=i+1;
[p(i),h(i)] = ranksum(clc_feat.avg_power(2,1:7),clc_feat.avg_power(2,8:14),'alpha',0.01);
%3
i=i+1;
[p(i),h(i)] = ranksum(clc_feat.s... |
function fig = seeClassPerf(Prediction, varargin)
% Plots performance metrics of classification model
% -------------------------------------------------------------------------
% fig = seeClassPerf(Prediction, varargin)
% -------------------------------------------------------------------------
% INPUTS
% REQU... |
function mlplot(data, lineType, lineColor)
% Multi-line plot function
%
% Prototype: mlplot(data, lineType, lineColor)
% Inputs: data - data to plot = [y, x],
% lineType,lineColor - line type & line color
% Example:
% mlplot(randn(100,1));
%
% See also miniplot, msplot.
% Copyright(c) 2009-2020, by Gong... |
function optns = vscopf_options( )
% Create struct for containing options
optns = struct();
optns.gen = struct();
optns.plot = struct();
end
|
% -------------------------------------------------------------------------
% Classification pipeline for layer-1 text pathway on Flickr
% using binary-binary RBM
%
% dotest (1/0), foldlist (1:5), optgpu (1/0),
% doc_length : minimum length for tags (5)
% numhid : number of latent variables
% numstep_... |
function encr_data=rc6_encr(data,S)
% encryption
w=32;
r=20; %rounds
data=sprintf('%02x',data);
A=data(1:8);
B=data(9:16);
C=data(17:24);
D=data(25:32);
B=sprintf('%08x',mod(sscanf(B,'%x')+sscanf(S(1,:),'%x'),2^32));
D=sprintf('%08x',mod(sscanf(D,'%x')+sscanf(S(2,:),'%x'),2^32));
for i=2:r+1
B_d... |
function json_write_labels(fileID_labels, label_string, label_ind, subject_id, last_entry)
%% Write 5 lines per subject
% e.g. "---QUuC4vJs": {
fprintf(fileID_labels, [' "', subject_id, '": {\n']);
% e.g. "has_skeleton": true,
fprintf(fileID_labels,[' "... |
for i = window/2 + 1:num_hours-window/2
window_size = i-250:i+250;
window_mean = mean(window_size);
window_std = std(window_size);
if transformed_data(i) >= window_mean + 3*window_std | transformed_data(i) <= window_mean - 3*window_std
outliers(i) = 1;
else
outlier... |
function [ J ] = frequencyDomainFiltering( I ,d0, way,n)
%frequencyDomainFiltering 频域滤波
% I 为原图,d为低通滤波或高通滤波的阈值
% way 1 理想低通滤波,高斯低通滤波,巴特沃斯低通频域滤波,
% n: 如果使用butterworth滤波,取的参数n(如果不采用butterworth滤波,则n 不被使用
% 变换到频域
I=double(I);
F=fftshift(fft2(I)); %fft2 傅里叶变换 % fftshift Shift zero-frequency component to center of spectrum... |
global saveProcess
%% Parameters
alignEvent_MI = spectrogramData{1}.state.ST_MOV;
alignEvent_MIT = spectrogramData{1}.state.ST_STOP;
alignEvent_FIXATION = spectrogramData{1}.state.ST_HOLD;
alignEvent_RELAX = spectrogramData{1}.state.ST_RELAX;
timeBeforeEventMI = 2;
timeAfterEventMI = 0;
timeBeforeEventMIT = -0.5;
ti... |
function figure4
close all
file_prefix = './selected_features_v2_';
file_sufix = {'4_public', '8_public', '4_ohca', '8_ohca'};
%% Plot Public and OHCA errobars in the same figure.
file_prefix = './selected_features_';
%file_prefix = '';
file_sufix = {'4','8'};
%%%% STEP 2 : plot data
pos = [0 100 700 600];
close al... |
function plot_evpi_prB(x, ymat)
% DATE: 5/12/2014
% DESCRIPTION: Plots EVPI vs pr_prob at different
% budgets
% AUTHORS: MATLAB, Payal Bal
% INPUTs
% x: vector of x data
% ymat: matrix of y data
% OUTPTS
% plots
% Create figure
figure1 = figure;
% Create axes
axes1 = axes('Parent',figure1,'FontSize',16);
box(... |
% % % % % % % % % % % % % % % % % % % % % % % % % % %
% % % % % %
% % % Does nothing for now % % %
% % % % % %
% % % % % % % % % % % % % % % % % % % % % % % % % % %
function Token = Tokenize(Buffer)
GroupSep = (... |
function deathPercents = deathPercentsMax(percentage,loszeros)
%From here actual deathpercent findings
sizeZeros=size(loszeros,1);
deathPercents=cell(sizeZeros,1);
percentage = [{'.'} ; percentage];
%Idea with max number
%The idea is to start from a 0% (fresh stock) and then look back some frames
%Aft... |
function dFF_mat = GetdFFtraces
%import ROI information, make MASK for each ROI, extract mean dFF response
%within each ROI (=neurons)
addpath(genpath('~/Dropbox/None_But_Air/Ana_ver11/'));
[dFFname, dir] = uigetfile('*.mat', 'Select dFF data (.mat)');
disp('loading MAT data as dFF >>>')
y = load([dir,dFFname]);
dFF... |
function [BMA] = SG_report_H(results,H)
options = [results(1,:).run_options];
models_H_idx = find(ismember([options.dynamics],[0 H])) ;
results = results(:,models_H_idx);
for iS=1:size(results,1)
[BMA.subject(iS).posterior] = VBA_BMA({results(iS,:).posterior},[results(iS,:).F]);
[BMA.subject(iS).effects] ... |
function update_table (filename, ref_param_line_nb, num_array)
% update table of values in a RAS file with given numeric array
%
% Syntax : update_table (filename, ref_param_line_nb,
% num_array)
%
% Param : filename, string, name of RAS text file
%
% Param : ref_param_line_nb, integer, line number of
% sent... |
%% fixed boundary param
% [RMS] this mesh shows LLE failure
mesh = readMesh('dogface.obj');
P = mesh.v; Pn = mesh.n; N = size(P,1);
isboundaryv = mesh.isboundaryv;
%figure; plotMesh(mesh,'efb');
boundaryUV = embedBoundary( mesh, 'circle' );
%% weight plots
interiorv=mesh.vidx(mesh.isboundary... |
function f = plot_pyramid(pyr, dataX0, dataY, pyrname)
% figure true height (exclude NaNs)
p1 = pyr;
if (strcmp(pyrname, 'Laplacian'))
p1 = pyr(1:end - 1, :);
end
pyrH = size(p1, 1);
f = figure('Name', pyrname, 'visible', 'off', 'units','normalized','outerposition',[0... |
% ## Copyright (C) 2017
% ##
% ## This program is free software; you can redistribute it and/or modify it
% ## under the terms of the GNU General Public License as published by
% ## the Free Software Foundation; either version 3 of the License, or
% ## (at your option) any later version.
% ##
% ## This program is di... |
x0 = [0 3 5 7 9 11 12 13 14 15];
y0 = [0 1.2 1.7 2.0 2.1 2.0 1.8 1.2 1.0 1.6];
x = 0:0.1:15;
y1 = interp1(x0,y0,x);
y2 = interp1(x0,y0,x,'spline');
pp1 = csape(x0,y0);
y3 = fnval(pp1,x); %求插值点的函数值,调用fnval,参数是pp
pp2 = csape(x0,y0,'second');
y4 = fnval(pp2,x);
[x',y1',y2',y3',y4']
subplot(1,3,1);
plot(x0,y0,'+',x,y1);
t... |
function [SSS] = trvi(Open,High,Low,Close,Volume,RVI_period)
% Function to calculate Relative Vigor Index
% RVI = (Close – Open)/(High – Low)
% TRVI include Volume as TRUE source for the market movement.
% calculate true RVI, sma of rawRVI
if RVI_period <=3
error('RVI_period cannot be less than 4')
... |
function wf=workflow(wf,c)
% function wf=workflow(wf,c)
% special-purpose workflow implementation for plotting LCIA results, originally
% from the Used Oil CalRecycle project. Takes two struct arguments:
%
% wf is a workflow structure containing all information required to produce the
% plots.
% wf fields:
%
... |
% demo 2 to test bcdLL1_alsls algorithm.
% The purpose of this demo is to show how to use all default parameters
clear all
close all
clc
%**********************************************
%--- Choose PARAMETERS of the DEMO
%**********************************************
%--- Data parameters ----
data_type='comp... |
clear all ; % on efface toutes les variables deja crees
close all
clc
% Suffixe = '.tif' ; % suffixe des images
Suffixe = '.bmp' ;
% Nom comprenant l?endroit ou se trouvent les images et le nom de base des images
% NomDeBase = 'C:\Users\Guillaume\Documents\MATLAB\TP-Tracking\SequenceAvecVariation\Image' ;
NomD... |
function varargout = shadePlot(varargin)
%SHADEPLOT
%
% SYNTAX:
% shadePlot(Y, Z)
% shadePlot(X, Y, Z)
% shadePlot(X, Y, Z, LineSpec)
% shadePlot(X, Y, Z, LineSpec, 'PropertyName', PropertyValue,...)
% H = shadePlot(...)
%
% OPTIONAL OUTPUT:
% H: WINDOWOBJ
% A handle to the window... |
function A=Bimolecular_Reaction_Diffusion(A,Na,move,Lx)
warning('off','all')
%Start diffusion steps
if Na>0
r1 = randn(Na,3); %random number to test SDE for each molecule
%find the updated positions and the updated velocities
A=A+move*r1;
A=mod(A,Lx);... |
%conference paper fig2b: orig+zoom
clc;
clear all;
load '0227exp/roipixdat_exp_bao01.mat';
vdind = 112;
olind = 362;
cdind = 29;
vdpixsig1 = cell2mat(pixcell(vdind));
olpixsig1 = cell2mat(pixcell(olind));
cdpixsig1 = cell2mat(pixcell(cdind));
vdpixsig = vdpixsig1(4:1000);
olpixsig = olpixsig1(4:1000);
cdpixsig = cdpix... |
% script to find an equilibrium J given a C_hat and other parameters
%parameters
p.function_path='./functions/'; %folder containing functions necessary for simulation
addpath(p.function_path) %adding folder containing functions
p.N=60;
p.T_batch_size=2; %sec
p.stim_del=10; %delay for stimulation (ms)
p.net_del=2; %2 (... |
load gong.mat;
soundsc(y,Fs);
figure,specgram(y,[],Fs);
pause(5);
a=[-0.2427,-0.2001,0.7794,-0.2001,-0.2427];
z=conv(y,a);
soundsc(z,Fs);
figure,specgram(z,[],Fs);
%In my view, the parts of the signal which are unfamiliar with the a
%function will be removed. In other words, it will remove the lower level
%of the sign... |
% Initialize G matrix, and then use the python script "inchi2gv.py" to decompose each of the
% compounds that has an InChI and save the decomposition as a row in the G matrix.
function training_data = createGroupIncidenceMatrix(model, training_data)
% get the scores for the mappings of compounds (reflecting the certa... |
classdef Metrics
methods(Static=true)
function kl = klDivergenceSymm(x, y)
klxy = Metrics.klDivergence(x, y);
klyx = Metrics.klDivergence(x, y);
kl = (klxy + klyx)/2;
end
function klxy = klDivergence(x, y)
logFactor = log(x./y);
klxy = sum(x.*logFactor);
end
end
end |
function xxxMat2Mat
%xxxMat2Mat - replace a processed file (with annotations) with the data
%from another. And do this for a whole folder's worth of files.
%
% TESTED
%
% James McKenzie, 2017.
% Ask the user for a folder, but if nothing found then quit
path = 'E:\Data\Haixing\Haixing-Annotated\Tumour\';
%[path] = uige... |
clear;clc;
smooth_ = true;%false;%
close all;
addpath 'data';
addpath 'depth2point';
addpath 'Normal Extraction';
addpath 'normalSimilarity';
addpath 'ply convertor';
%%
max_range = 25;
w = 10;
space_sigma = 5;
range_sigma = 0.02/max_range; % 0.02/max_range;
%% Loading data
load sim_flat_xyz.mat;
x... |
function f = DBGetFigures(query,varargin)
%DBGetFigures - Get all figures that match given criteria.
%
% Open figures and get related information such as code used to generate them.
%
% USAGE
%
% f = DBGetFigures(query,<options>)
%
% query optional figure list query (WHERE clause; see Example)
% <op... |
clear;
m=input('PODAJ LICZBĘ WĘZŁÓW (0 - QUIT) m=');
if (m==0) end
if (m<0) || (m==1) rat1; end
if (m>1)
n=m-1;
a=-1;b=1;
step1=(b-a)/n;
x=a:step1:b;
y=1./(1+100.*x.*x);
step2=(b-a)/100;
xt=a:step2:b;
wn=polyfit(x,y,n);
ywn=polyval(wn,xt);
plot(x,y,'ko',xt,1./(1+100.*xt.*xt),'y-',xt,ywn,'b-');
legend('wezly rownoodlegl... |
function s = insert_movement_event_trigger(eeg_file_path, eeg_file_set, rt_data, output_dir)
% function s = insert_movement_event_trigger(rt_data)
%
% Create a new trigger for each trial at the time of movement onset as
% determined by the behavioral data
%
% INPUT:
% (1) eeg_file_set - a .set file that has the eeg d... |
function [trainErrorMatrix,testErrorMatrix] = OneVersusOne(Xtrain,Ytrain,Xtest,Ytest)
lambda_ = logspace(log10(0.001),log10(3),10);
C = 1:10:200;
% Dtrain = dist_euclidean(Xtrain,Xtrain);
% Dtest = dist_euclidean(Xtest,Xtrain);
% gammaTrain = median(Dtrain(:));
% lambdaTrain = lambda_/gammaTrain;
% gammaTest= median(D... |
y = imread('fountainbw.tif');
image(y);
colormap(gray(256));
axis('image');
title('original')
z = double(y);
Y = Uquant(z,2^1);
image(Y);
colormap(gray(256));
axis('image');
title('Y = Uquant(z,2^1)')
|
function [search_window, src_img] = get_template_search_image(orig_img, test_pts_nx2, warped_img, dest_pts_nx2)
% Take out the small window for search
w_height = dest_pts_nx2(3, 2) - dest_pts_nx2(1, 2);
w_width = dest_pts_nx2(3, 1) - dest_pts_nx2(1, 1);
ymin = max(1, dest_pts_nx2(1, 2) - w_height/2);
ymax = min(size(wa... |
function [sig_long, sig_short, sig_rs ] = Trix (bar, nDay, mDay,type)
% Trix 三重指数平均
% sig_long: 金叉买入,没有设置平仓; sig_short:死叉卖出,没有设置平仓;
% 可以补充顶背离和底背离的反转情形
% 2013/3/21 daniel
%
% TRIX线基本用法
% TRIX指标是属于中长线指标,其最大的优点就是可以过滤短期波动的干扰,以避免频繁操作
% 而带来的失误和损失。因此TRIX指标最适合于对行情的中长期走势的研判。
% 在股市软件上TRIX指标有两条线,一条线为TRIX线,另一条线为TRMA线。
% TRIX指标的一般... |
% [modes] = InferOneLocation(mm, nn, opt, plotopt)
function [modes] = InferOneLocation(mm, nn, opt, plotopt)
if ~exist('opt', 'var') | isempty(opt)
[opt, ~] = DefaultOptions;
end
if ~exist('plotopt', 'var') | isempty(plotopt)
[~, plotopt] = DefaultOptions;
end
tao = ReadTaoTriton(mm,nn);... |
%% Code to generate panels B-F of Figure 2
%% Panel B
load('Figure2Data')
phaseBins = linspace(-pi,pi,12);
phaseBins(end)= [];
figure
set(gcf,'position',[100 100 500 400])
ba = bar(phaseBins,nanmean(allSupraHist(:,1:11)),'histc');
ba.LineWidth = 1.5;
ba.EdgeColor = [0 0 0];
ba.FaceColor = [.5 .5 .5];
hold ... |
function reImportData(source,eventdata)
%path(path,'Rutines');
global data const
if ~isempty(data)
disp('Previous data found in workspace.');
importMode = questdlg('Do you want to keep deleted and shift masks?','Data import','Discard','Keep','Cancel','Keep');
else
disp('Previous data NOT found in w... |
clc;
close all;
subplot(2,3,1);
pic1=imread('C:\Users\Sony_Owner\Documents\MATLAB\John\ECC Encryption\lena.jpg.');
pic2=rgb2gray(pic1);
%pic1=imread('fp1_1.bmp');
%pic2=imresize(pic1,[128 128]);
%pic2=pic1;
imshow(pic2)
title('original image');
%title('original image')
subplot(2,3,4)
imhist(pic2)
title('Histogram of O... |
function [hypothesis, a_1, z_2, a_2] = propagate(example, Theta1, Theta2)
a_1 = [ones(rows(example), 1), example];
z_2 = Theta1 * a_1';
a_2 = sigmoid(z_2);
a_2 = [ones(1, columns(a_2)); a_2];
z_3 = Theta2 * a_2;
hypothesis = sigmoid(z_3);
endfunction
|
%Author: REDJAN F. SHABANI
%Universita' degli studi di Roma "LA SAPIENZA"
%Ingegneria Informatica - Intelligenza Artificiale
%Version: Gen. 2010
function up=upperRecog(NET,IM)
Wh=NET.WHidden;
bh=NET.BHidden;
Wo=NET.WOut;
bo=NET.BOut;
%image conversion to linear vector
x=IM(:);
%getting the network resp... |
function predict_human( fit_fn, figs )
if ~exist('fit_fn','var'), fit_fn = 'gamma'; end;
if ~exist('frac','var'), frac = 1/50; end;
if ~exist('figs','var'), figs = {'predict_ab'}; end;
if ~iscell(figs), figs = {figs}; end;
pdh_dir = fileparts(which(mfilename));
analysis_dir = fullfile(pdh_dir, '..');
%% Load data
lo... |
function [ output ] = laplacian( data,nof )
[m,n]=size(data);
data=[1:n;data];
data(isnan(data))=0;
m=m+1;
lap=zeros(n,n);
kd=data(2:m,:)';
nog=round(n/5);
label=kmeans(kd,nog);
for i=1:n
for j=i+1:n
x=data(2:m,i);
y=data(2:m,j);
k=length(x);
c=0;
if label(i,1)... |
function [w,f,J] = train_cg_con(x,y,lambda,varargin)
% TRAIN_CG Train a logistic regression model by conjugate gradient.
%
% W = TRAIN_CG(X,W) returns maximum-likelihood weights given data and a
% starting guess.
% Data is columns of X, each column already scaled by the output (+1 or -1).
% W is the starting guess f... |
function [vibratoDepth, vibratoRate, noteDynamic, intervalSize, pp, nmat,cents]=getPitchVibratoDynamicsData(times,yinres,nmat)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [vibratoDepth, vibratoRate, noteDynamics, intervals]
% =getPitchVibratoDynamicsData(times,yinres)
%
% Description... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.