text stringlengths 8 6.12M |
|---|
function f = D_y(A, varargin)
% Derivative along y (ordinates)
%
% f = D_y(A,'c') return the centered derivative (default)
% f = D_y(A,'+') return the forward derivative
% f = D_y(A,'-') return the backward derivative
if length(size(A)) == 3
A = rgb2gray(A);
end
[m,n] = size(A);
if nargin < 2
... |
function [vpd]=computeVPD(year);
% requires that you have downloaded ERA-5 hourly dewpoint and temperature data named download_dew_YEAR.nc and download_t_YEAR.nc
a=ncread(['download_dew_',num2str(year),'.nc'],'time');
for ii=1:length(a)
dew=ncread(['download_dew_',num2str(year),'.nc'],'d2m',[1 61 ii],[Inf 510 1],... |
% This procedure find transition prob. for the different artificial forests
% under actor-critic and logstic regression
clear
close all
clc
addpath('../utility/')
fog = 6.6;
load('../../data/processed/all_forest_reward.mat','allforest')
load('../../data/processed/state_action_prob.mat','tran_prob')
m=allforest{1}.pa... |
function [G,T] = Diff_x(cellMat,CoefpsvH,CoefpsvV,Coefsh,p_x,pXi,m,f,ops,dir)
% Tensor en p_X del campo difractado por
% la estratigrafía + la incidencia real.
% Se arroja la respuesta en frecuencia y
% en coordenadas cartesianas.
G = zeros(3);
T = zeros(3);
[e] = el_estrato_es(m,ops.N,p_x.center(3));
[eXi] = el_estrat... |
% San Francisco Crime prediction
% 随机森林分类器
% 地址采用计数特征,时间、日期均为离散型
clear all;
close;
% load('testset.mat')
% load('trainset.mat')
%% 导入训练集,处理数据
train = importdata('data\train.csv');
test = importdata('data\test.csv');
%% 去掉表头
train.textdata(1,:) = [];
test.textdata(1,:) = [];
%% 经纬度
train_X = train.data(... |
function plotWindfield( windField, threeD, meF )
%plotWindfield Creates a 2D contour plot of the input windField
%% Plotting parameters
%meF = 0.005; % mesh fineness
meL = -2; % mesh lower bound
meU = 2.5; % mesh upper bound
%% Creating plot
[X , Y] = meshgrid(meL:meF:meU, meL:meF:meU);
z = windField(X,Y);
if (threeD... |
%% basic demonstration
figure;
points=[0.2 0.2; 0.5 0.9; 0.75 0.9; 0.8 0.3;];
object=SMASH.Graphics.LineSegments(points);
N=25;
origin=rand(N,2);
%matrix=eye(2);
matrix=[1 0.5;0.5 1];
ha(1)=subplot(2,2,1);
object.BoundaryType='projected';
view(object,gca);
[~,location]=calculateDistance(object,origin,matrix);
for n=1... |
function cy = center_y_1d(x);
% CENTER_X_1D calculates the x-position of the peak of the
% cross-correlation function x by fitting the nearest
% neighbors (left and right) of the maximum value of x to a parabola.
try;
[mi,mj] = find(x == max(max(x)));
mi = mi(1);
mj = mj(1);
maxcory=x(mi,mj);... |
function aclength = ac_length(acontour)
%ac_length: length of an active contour
% l = ac_length(a) computes the length, l, of an active contour, a.
%
%See also acontour.
%
%Active Contour Toolbox by Eric Debreuve
%Last update: June 15, 2006
aclength = 0;
for subac_idx = 1:length(acontour)
interval = ... |
classdef HTMLDataTableWriter < HTMLReportWriter
properties
valueStruct
columnAttrMap
fields
isKeyField
table
indexColumnBackground = '#f2f2f2';
keyFieldColumnBackground = '#def1fc';
end
methods
function html = HTMLDataTableWriter(varargin)
... |
function data = SR620_BinDump(samples, handle, ratio_on) %Add instrument handle
switch nargin
case 1
ratio_on = 0;
handle = instrfind('Type', 'gpib', 'BoardIndex', 0, 'PrimaryAddress', 16, 'Tag', '');
case 0
ratio_on = 0;
samples = 1;
... |
function A=create_A(num_net,N,Nep,inter_c,neighbor_c,con)
Ne=Nep*N;
Ni=N-Ne;
A=zeros(num_net*N,'logical');
for nn=0:num_net-1
for mm=0:num_net-1
if con(nn+1,mm+1)
AA=zeros(N);
for ii=1:N
if nn==mm
p_con=inter_c;
elseif ... |
p = 0.5;
n = 16;
k = 6;
%analiticamente
% analiticamnete
prob= factorial(n)/(factorial(n-k)*factorial(k))*p^k*(1-p)^(n-k)
%por simulacao
N = 1e5; %nr de experiencias
lanc = rand(n,N) > p;
succ = sum(lanc) == k;
res = sum(succ)/N |
%------------------MENINGIOMAS Characterization----------------------
clearvars
close all
clc
%%
general_path = 'E:\MENINGIOMI_Characterization\MENINGIOMI_ANON';
dicom_path = 'E:\MENINGIOMI_Characterization\MENINGIOMI_ANON'; %'H:\PAVIA\Totally_anon\Meningiomas'; %for space reasons
%genpath + addpath to add a folder and... |
% =========================================================================
% -- Part of "Data Detection in Massive MU-MIMO" Simulator
% -------------------------------------------------------------------------
% -- (c) 2020 Christoph Studer and Oscar Castañeda
% -- e-mail: studer@ethz.ch and caoscar@ethz.ch
% ========... |
function [er_stat]=fun_static_err_v3(re,si);
% to static the error
%% para
hist_num=40;
%% cal
n=length(re);
% abs error
Er_er = re-si;
%% abs error
Er_abs_er = abs(Er_er);
[Er_abs_me,Er_abs_ma,Er_abs_mi,Er_abs_st]=fun_static_err_abs_st(Er_abs_er);
[hi_bi0,hi_ab_0,hi_ab_r_0]=fun_static_err_abs_hi... |
close all;
clear all;
if isunix
videoReader = VideoReader('traffic.ogv')
elseif ispc
videoReader = VideoReader('traffic.mp4')
end
videoWriter = VideoWriter('animations/lane_departure_warning_2')
videoWriter.FrameRate = 15;
open(videoWriter);
set(gcf, 'DoubleBuffer', 'on');
% Development
DebugEnabled = 0;
... |
function eeg = filter_eeg(eeg)
%spectral filter
[b, a]=butter(2, 10/(512/2),'low');
eeg = filtfilt(b ,a, eeg);
[b, a]=butter(2, 1/(512/2),'high');
eeg = filtfilt(b ,a, eeg);
%spatial filter: CAR (not useful with CCA)
% means=mean(eeg,2);
% eeg(:,1) = eeg(:,1)-means;
% eeg(:,3) = ee... |
function geoms = read_energies(geoms, file)
[void, field, void] = fileparts(file);
[names, enes] = textread(file, '%s %f');
for i = 1:length(enes)
k = find(strcmp(names{i}, {geoms.name}), 1);
geoms(k).(field) = enes(i);
end
|
%
% File name: secant.m
% Author: Suh-Yuh Yang at NCU
% Date: March 13, 2011
%
clear all;
format long
M = 100;
delta = 10^(-12);
epsilon = 10^(-12);
x0 = 0.5;
v = cos(x0)- x0;
[0, x0, v]
x1 = pi/4.0;
w = cos(x1)- x1;
[1, x1, w]
%
%
%
if abs(w) < epsilon
... |
%Script to Reprocess the particle tracking Data
%file paths for input (res files) and output files
basepath= 'F:\Thermal SPT\Thermal SPT organized\POPC\POPC SPT cold redo\neg9C 10ms 205x200\tracking\';
savepath= 'F:\Thermal SPT\Thermal SPT organized\POPC\POPC SPT cold redo\neg9C 10ms 205x200\analysis\';
ima... |
function [x_dot] = ODEstep(t,x,u,A,B,q,params)
% ODEstep: A single integration step for linearized HST attitude.
%
% Inputs:
% t - time [s]
% x0 - initial state vector [omega; q; r; v; speed]
% mu - central body gravitational parameters [km^3/s^2]
% J - spacecraft inertia matrix
% ... |
function y = my_powerOf10(x, a, b)
y = a * (10 .^ x) + b;
end |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function dbFnEvaluateMatchingLocalObjectDb
% Evaluate the matching of a test image based on different local measures (which don't require the
% use of global statistics)
%
% Input parameters:
%
% Output parameters:
%
%
%%%%%%%%%%%%%%%%... |
function [s, t_sim, bg_sim, bi_sim]= sim_clin_data_for_mh(k,tout,mud,sigd)
%Additions for data generation by R Allen and T Rieger
% This function is for simulation of the model without generating simulated data with comparison to previously generated
% data distributions.
%
% Inputs:
% k - parameter vector for s... |
function [valve] = initialize_valve_data_structures_hocm_d(N, attached, leaflet_only, optimization, decreasing_tension)
%
% Initializes data structures for full solve.
%
% Parameters are declared here.
% Should be a script, but want to return in the structures
%
% Input:
% N Size parameter used throughout ... |
function [x_comp,y_comp,z_comp,t_pos,bx_comp,by_comp,bz_comp,t_B,B_tag,sc] = MMS_fgm(pathpath,B_path1,B_path2)
sc = 0;
span = 64;
for i = 1:4
for j = 1:300
try
B_path22 = [B_path2,'_v5.',num2str(j),'.0.cdf'];
[data,iinfso] = spdfcdfread([pathpath,num2str(i... |
BaseP='C:\STRDCE\John\Database\DCEOut2\Compare\';
PerfusionPath{1}='C:\DATA\x\Sivi_Movement\St11_Se52_DSC-Perfusion_15secdelay_72rep';
PerFile2FN='C:\STRDCE\John\Database\DCEOut2\Compare\Perf2\GoSh_DSC_4D.nii';
A=loadniidata(PerFile2FN);
PerfPath{1}=[BaseP 'Perf1\'];
PerfPath{2}=[BaseP 'Perf2\'];
mkdir(PerfPath{1});
% ... |
function makeTable( indir, outfile )
%% Creates and saves a latex table from a .mat file containing experimental results
%
% Author: Vahan Hovhannisyan, 2017.
files = list_files(indir);
tabledata = {''};
for i = 1:numel(files)
f = files{i};
[~, fname, fext] = fileparts(f);
if fext ~= 'm'
... |
% DiffEffiCalc.m -- determining diffraction efficiency of redirection hologram
% Written by Craig Draper & Joshua McDonald
% V0.2 4/28/2018
clear
clear all
%-------------------------------------------------------------------------%
%Filters
%Noise Reduction
nr1 = (1/9)*[1,1,1; 1,1,1; 1,1,1;];
... |
function [chi1,chi2,chi3]=compar_array_1(nume1,nume2,a1,a2,d,optin)
%
% functia citeste doua fisiere date cu numele ca parametrii de intrare
% numea1 si numea2 sau ia doua doua matrici a1 si a2, de aceeasi dimensiune
% in functie de
% valoarea lui optin:
% optin 0 ia matricile a1 si a2 si ignora numele de fisi... |
function [U, S] = pca(X)
[m, n] = size(X);
Y = (1/(m - 1)) * X' * X;
[U, S, V] = svd(Y);
end |
function varargout = GUI_Minpos(varargin)
% GUI_Minpos MATLAB code by Edi Suprayoga.
% feel free to contact me at suprayoga.edi@gmail.com
% last edit 3 Mar 2016
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_Openin... |
function [CAp,CAo] = UpdateCA(CAp,CAo,Newp,Newo,MaxSize)
% Update CA
%--------------------------------------------------------------------------
% The copyright of the PlatEMO belongs to the BIMK Group. You are free to
% use the PlatEMO for research purposes. All publications which use this
% platform or any code in t... |
function [p,r,f] = eval_prf(X,Y,c)
erx=sign(X)-sign(Y);
ofc=find(sign(Y)==c);
pfc=find(sign(X)==c);
p=(length(find(erx(pfc)==0))./length(pfc)).*100;
r=(length(find(erx(ofc)==0))./length(ofc)).*100;
if (isnan(p))
p=0;
end
if (isnan(r))
r=0;
end
f=(2.*p.*r)./(r+p);
if (isnan(f))
f=0;
end
end |
confMatrix = evaluate(categoryClassifier, testSet);
% Compute average accuracy
mean(diag(confMatrix));
|
function [yerror] = kernel_linear_estimate_error(w,X,y)
size(w);
size(X);
size(y);
ypred = w*X';
ypred = ypred';
yerror = (norm(y-ypred,2))^2/length(ypred);
end
|
function JITAcceleratorTest
u = rand(1e6,1);
v = zeros(1e6,1);
tic
u1 = u + 1;
time = toc;
disp(['用向量化的方法的时间是:',num2str(time),'秒']);
tic
for ii = 1:1000000
v(ii) = u(ii)+1;
end
time = toc;
disp(['用循环的方法的时间是:',num2str(time),'秒']);
|
function [freqsBinned] = cr_bin_power_spectrum(CBF, PowerSpec)
% The resultant powerspectrum has a higher frequency resolution (0.1 Hz)
% than is relevant.
% This functions groups the powerspectrum into coarser bins and adds the
% powers of the original powerspectrum bins together.
% CBF = A structure with at le... |
% EEGLAB history file merged with my code
% should import, load channel locs, rereference, filter, cleanline, ica, save
%-----------------------------------------------------------------------------
clear;
clc;
%open and load eeglab in matlab
[ALLEEG EEG CURRENTSET ALLCOM] = eeglab;
% this tracks which version of... |
%using this class to generate S1, S2 and RR
% CNT_number = 10000;
% Mu = 5;
% a=exprnd(Mu, 1, CNT_number);
% plot(a);
% mean = sum(a) /CNT_number
% c is the active index. c(i) = -1 means c(i) is a empty cell;
global c rr hit m MAX lru t;
c = [-1, -1, -1, -1]; % c is the cell active index, c(i) = -1 means emp... |
function [ str ] = test( )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
S={};
for i=1:10
S{1,1}(i)=i;
end
for j=1:20
S{1,2}(j)=j;
end
for i=1:2
S{1,i}
end
S
end
|
function [ HE, w_save, accuracy_save, henum_save ] = ...
train_HN_prob( epoch, count_ever, count_new, HE, data, test_x, type_index, update_rate)
% train_HN_prob: Sang-Woo Ha's batch version HN classifier explained in KIISE13 paper
% update_rate: we multiply update_rate and diffrential of objective
% function ... |
%% Make the plots for the mouse tsne coronal view (PCA sweep)
clear variables
close all
% Load additional color data
datadir = '/home/mvandegiessen/data/tSNE_ABA/AllenMouseBrain_coronal/';
colors = load([datadir 'voxels']);
%% Figure a
% t-SNE mapping colored by region with 10 components
% Load data
load('results_mou... |
function [thetad, r] = cart2pold(x, y)
%% cart2pold(x, y) Convert from Cartesian to polar co-ordinates
% [thetad, r] = cart2pold(x, y)
% returns:
% thetad: angle in degrees from x axis
% r: radial distance from origin
r = sqrt(x.^2 + y.^2);
thetad = atan2d(y, x); |
function call_main4cluster_aftercv_oasis(counter)
%counter is string
counter = str2double(counter);
randpart = 1;
metric_method = 1;
randpart_seed = mod(counter,5)+1;
split_method_index = floor(counter/5)+1;
if split_method_index == 1
split_method = 1;
oasis_weight_num = 2;
elseif split_method_index == 2
split... |
function [error] = INfileWRAP(pedigree_file, genotype_file, marker_file, hotspots_file, option)
error = 0;
% make sure all files are existing for fast processing
if( exist('cForward', 'file') ~= 3 )
disp('cForward.c not compiled');
disp('Compile all c source codes first using mex:');
... |
% demo_lowrank_hsi
load('HSI_ExampleData.mat');
subplot(1,3,1)
colormap(gray);imagesc(D(:,:,100));
for i=1:256
temp=D(:,:,i);
X(:,i)=temp(:);
end
[L, S] = RPCA(X, 0.02, 1.0, 1e-5, 1000);
subplot(1,3,2)
colormap(gray);imagesc(reshape(L(:,100),250,320));
subplot(1,3,3)
colormap(gray);imagesc(reshape(S(:,100),2... |
% Exercise 2 of Chp.2
% Generation of data from exponential distribution using the inverse from uniform.
pridir = 'C:\MyFiles\Teach\DataAnalysis\Figures\';
pritxt = 'exercise2_2';
n = 1000;
lambda = 1;
bins = 20;
rV = rand(n,1);
yV = -(1/lambda)*log(1-rV);
[Ny,Xy]=hist(yV,bins); % Xy has the centers of bin... |
path = '../../MPEG7_CE-Shape-1_Part_B/';
classes = {'apple' 'bat' 'beetle' 'bird' 'brick'};
class_size = 20;
class_num = size(classes,2);
D = dir(path);
I = cell(class_size, 1);
j = 1;
% namen der features
feature_names = {'roundness' 'compactness' 'formfactor' 'solidity' 'extent' 'euler' 'minorAxis' 'majorAxis'};
... |
function callback_roi(source,event,data,S)
uiresume(S.d)
val = source.Value;
if val==1
S.sw_x = 1;
S.sw_z = 0;
elseif val==2
S.sw_z = 1;
S.sw_x = 0;
end
source.UserData = [S.sw_x , S.sw_z];
end |
% GET_FEATURES: Extracting hierachical convolutional features
function [feat, distictive_score, idx] = ran_get_features(im, cos_window, layers, target_mask)
global net
global enableGPU
% layers_number = layers(1);
if isempty(net)
ran_initial_net(max(layers));
end
sz_window = size(cos_window);
% Preprocessing... |
function expPlot()
figure;
x =[10:0.1:22];
y = exp((4*x) - 57);
plot(x, y, 'g');
end
|
function p = qinv(q)
% Inverse of the quaternion z (inv(q)) :
p = qconj(q)/sum(q.*q); |
function population = InitializePopulation(populationSize, minChromosomeLength,maxChromosomeLength, numberOfVariableRegisters, numberOfConstantRegisters, numberOfOperators)
population = [];
numberOfOperands = numberOfVariableRegisters + numberOfConstantRegisters;
for i = 1:populationSize
chrom... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Adapted from Pankaj Sharma et al.
% Analysis of Automotive Passive Suspension System
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
m = 27; M = 275; Cs = 1120; Ct = 3100; Ks = 150000; Kt = 310000;
A = [0 0 0 1; 0 0 1 -1; 0 -(Ks/M) -(Cs/M) (Cs/M); -(K... |
function fluxplot_XP(x)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% fluxplot_XP.m v1.0
% ********************
% Beräknar skillnaden i LHGR mellan ett
% startläge och ett slutläge. Skillnaden
% anges i förhållande till startläget.
% delta_LHGR=(START-SLUT)/START
% Programmet beräknar antingen en... |
if ~verifySpmExists()
return
end
StoreVariables;
file = [imlook4d_current_handles.image.folder imlook4d_current_handles.image.file];
[filepath,name,ext] = fileparts(file);
newFile = [ filepath filesep name '_centered' ext];
copyfile( file, newFile);
% http://www.nemotos.net/scripts/setorigin_center.m
%... |
% Figure 3.12 Feedback Control of Dynamic Systems, 5e
% Franklin, Powell, Emami
%
% fig3_12.m
clf;
num=[2 1];
den=[1 3 2];
axis ('square')
pzmap(num,den)
grid;
|
clc;
srcdir = 'C:\Users\agahgol1\Desktop\SHARP\Groundtruth\';
dstdir = 'C:\Users\agahgol1\Desktop\SHARP\Upscaled2X\';
seqtag = 'flower';
srcdir = [srcdir seqtag '\'];
dstdir = [dstdir seqtag '\'];
if ~isdir(dstdir)
mkdir(dstdir);
end
imlist = dir([srcdir '*.png']);
for i = 1:numel(imlist)
x = double(... |
function c=ajuste(f,x,y,c) %funcion por la que queremos ajustar,abs y ords y la semilla...los coef de los que partimos estimados
global grafica %representacion
plot (x,y,'r.')
hold on
grafica=plot(x,y);
pause
axis([min(x) max(x) min(y) max(y)]); %ajustar ejes
c=lsqcurvefit(f,c,x,y);
end
|
radiusOfAverage=125; % set the radius of our average. radius of 25 means a 50-pt average
ra_OldEOSSAltVsTemp2=zeros((14560-radiusOfAverage*2),2); % allocate a var to hold finished data
sampleSum=0; % declare this for later
% if we're doing an average with r=25, then we can't use the ends of our original data because ... |
%MIT License
%Copyright (c) 2019 Sherman Lo
classdef GlmSelectAicAbsFilterDeg30 < GlmSelectAic
properties
end
methods (Access = protected)
function setup(this)
this.setup@GlmSelectAic('AbsFilterDeg30', uint32(1939773748));
end
end
end
|
function y0 = interpfastFromInd(x, y, x0, ind4interp)
% y0 = INTERPFASTFROMIND(x, y, x0, ind4interp)
%
% inputs:
% - x:
% - y:
% - x0:
% - ind4interp:
%
% outputs:
% - y0:
%
%
%
% Olavo Badaro Marques, 24/Jul/2017.
%%
y0 = NaN(1, size(y, 2));
%
lok = ~isnan(ind4interp(1, :));
y0(in... |
% find all the vertices that can be reached from a vertex s
function nodes = get_connected_nodes(adj,s)
num_nodes = size(adj,1);
visited = zeros([1,num_nodes]);
queue = [s];
while length(queue) > 0
curr = queue(1);
queue(1) = [];
visited(curr) = 1;
neighbors = find(adj(curr,:));
unvisited = neighbors(fin... |
function [EP, LP, TP, leafID, Area, S0] = tracking_generateLeafInformation(testIm, Template, TemplateTip, AllMasks, last_leafID, newS, smallLeaf)
nLeaf = numel(last_leafID);
LP = zeros(nLeaf, 8);
EP = cell(nLeaf, 1);
TP = zeros(nLeaf, 4);
leafID = last_leafID;
Area = zeros(nLeaf, 1);
S0 = newS;
[distance... |
function c = pitty(ab)
a = ab(:,1);
b = ab(:,2);
c = sqrt(a.*a+b.*b); |
function pc=split_glimpse_file_v1(fp,vid,step,frames,output_files)
%
% function split_glimpse_file_v1(fp,vid,step,frames,output_files)
%
% This function will read in frames from a glimpse image sequence and write
% a number of output tiff files. The frames from the glimpse file will be
% sorted into the output tiffs a... |
% chenxy, 2019-12-06
close all; clear all; clc
addpath('./TestData/');
addpath('./Norrdine/');
addpath('./func/');
filename = '4anchors_antiShake_noObstacle_moving.txt';
%filename = '4anchors_trilateration_noObstacle_moving.txt';
%filename = '6anchors_trilateration_noObstacle_static.txt';
%filename = '6anchors_antiS... |
function R = retwist(w)
wbar = trans(w);
R = eye(3) + wbar/norm(w)*sin(norm(w)) + (w'*w/(norm(w)*norm(w))-eye(3))*(1-cos(norm(w)));
end
%%test
|
factor = 2;
im = imread('sample.jpg');
im = uint8(im);
im = rgb2gray(im);
im_out = downBy2(im);
im_out = uint8(im_out);
subplot(1,2,1);
imshow(im);
subplot(1,2,2);
imshow(im_out); |
function success= phaseReference(bench, data_or_file)
% isConfigured = config.phaseReference(bench) do nothing return true if configured
% config.phaseReference(bench, filePath) load a phaseReference file
% config.phaseReference(bench, 'fetch') a gui ask the user to fetch a file
% config.phaseReference(bench, 'me... |
function CloseGDS(outputFile)
gdsPost = [0, 4, 7, 0, 0, 4, 4, 0];
fwrite(outputFile,gdsPost , 'uint8' );
fclose(outputFile); |
subplot(4,2,1)
plot(T,S(:,1),T,S(:,7)); grid on; hold on
subplot(4,2,2)
plot(T,S(:,2),T,S(:,7)); grid on; hold on
subplot(4,2,3)
plot(T,S(:,3),T,S(:,7)); grid on; hold on
subplot(4,2,4)
plot(T,S(:,4),T,S(:,7)); grid on; hold on
subplot(4,2,5)
plot(T,S(:,5),T,S(:,7)); grid on; hold on
subplot(4,2,6)
plot(T,S(:,6),T,S(... |
function [alphaDash] = getAlphaDash(FGIm,a,b,QVal)
%FGIm = Image of Fourier of Gaussian of size m x n
%Qval = Q value at a,b
[m, n] = size(FGIm);
alphaDash = exp(QVal);
Temp = 0.0;
for i=-1:1
for j=-1:1
x =-2*a +i*m;
y = -2*b +j*n;
x = mo... |
% This function returns two values
function [y1,y2] = squareAndcube(x)
y1=x^2;
y2=x^3;
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function hist = imageHisto3D(image, mask, nbBins, varargin)
% Computes the 3-dimensional histogram of an input image. The image can be
% expressed in any color space.
%
% Input parameters:
% - image: the input image (size MxNx3), in whatev... |
D = importdata('data.txt');
data = D.data;
x = data(:,1);
y = data(:,2);
n = 8;
z = data(:,n);
D.textdata{n} |
clc
close all
gate = 'Tre';
cross = {'Ara', 'IPTG', 'Rib', 'Tre'};
cross(ismember(cross, gate)) = [];
d1 = xlsread('sigResults.xlsx', [gate, 'R1']);
d2 = xlsread('sigResults.xlsx', [gate, 'R2']);
d3 = xlsread('sigResults.xlsx', [gate, 'R3']);
meanMean = mean([d1(:, 2), d2(:, 2), d3(:, 2)], 2);
stdevMean = ... |
%%%%%%%%%%%%%%%%%%%%%%%
%%D2 Data Calibration%%
%%%%%%%%%%%%%%%%%%%%%%%
%Commands used to go through Tag2Whale steps using eg06_24a
%setting path
settagpath('audio', 'D:\DUKE Tagging\SEUS 2016_Duke tagging', 'cal', 'D:\DUKE Tagging\SEUS 2016_Duke tagging\cal','raw', 'D:\DUKE Tagging\SEUS 2016_Duke tagging\raw','... |
function sv=jury_game(th,n,k)
% JURY_GAME computes from a quota and the number of jurors involved
% the corresponding simple game.
%
% Usage: sv=simple_game(th,n)
% Example:
% Let th=10 and n=12;
% sv=simple_game(10,12);
% computes the corresponding simple game.
%
%
% Define variables:
% output:
% sv -- A ... |
function [T,I,Y]=naivePerfusionResponsepotentP2X4rev(ton,toff,Ttot)
ode=modelODEpotentP2X4rev(ton,toff);
naive=zeros(37,1);
naive(1)=1;
setAuxiliarypotentP2X4rev(naive);
[T,Y]=ode15s(ode,[0 Ttot],naive,odeset('NonNegative',1:37));
I=getTotalCurrentpotentP2X4rev(Y);
end |
%½âµ÷BPSK²¿·Ö
function output_demodulate_sam = demodulate(input_signal)
car_freq = 1000;
point = 10;
sam_freq = car_freq*point;
len = length(input_signal);
t=0:(1/sam_freq):((point-1)/sam_freq);
carrier = sin(2*pi*car_freq*t);
carrier = repmat(carrier,1,le... |
%Newton's method to minimize the function. Obtain the central path
%f(x,y) = exp(x+y) + x^2 + 0.5y^2 +x*y -y st 2*x^2 +3*y^2 <= 1
f_xy = @(x,y)(exp(x+y) + x^2 + 0.5*y^2 + x*y -y ) ;
fb_xy = @(x,y,t)(t*(exp(x+y) + x^2 + 0.5*y^2 + x*y -y) - log(1-2*x^2-3*y^2)); %with barrier
%Gradient of teh above function
d_fx = ... |
function []=batch1
%
%Functia doar executa secventa, are ca parametrii frecventele si domeniul
%pe axa y
%
rez=analizor3('.\date\dark','dark',20,0,500,0,+inf);
rez=analizor3('.\date\dark','dark',20,500,1500,0,10000);
rez=analizor3('.\date\dark','dark',20,1500,4000,0,5000);
rez=analizor3('.\date\dark','dark',20,... |
function tnsr=h2l(tnsr,I,order,siz)
tnsr=reshape(tnsr,I(order));
tnsr=ipermute(tnsr,order);
tnsr=reshape(tnsr,siz);
end |
function imgCorner = cornerDetector(imgSrc)
% Donne un matrice de coordonnés de points à partir d'une image NdG.
% utilise la détection de contours "edgeDetector.m"
[edges, ~, Ix, Iy] = edgeDetector (imgSrc);
subplot(2,4,2);
imshow(edges);
hold on;
title('Module du gradient (passe haut gaussien)... |
function kcit2_chaotic(independent, gamma, noise, trial, N, outputfile)
args.gamma = gamma;
args.noise = noise;
data = synthetic('henon', trial, N, args);
if independent
X = data.Xt1;
Y = data.Yt;
Z = data.Xt(:,1:2);
else
X = data.Yt1;
Y = data.Xt;
Z ... |
function Res = MetodoCuadraturaGauss(func,a,b,error,n)
%a y b son los extremos del intervalo
h=error^(1/(2*n));
Tabla=xlsread('puntosypesosGauss.xlsx',n);
x=Tabla(:,1);
w=Tabla(:,2);
Res=0;
for k=1:n
Res=Res+(w(k)*func((((b-a)*x(k))/2)+((a+b)/2)));
end
Res=((b-a)/2)*Res; |
% CE3 - Вычислительный эксперимент ╧3
% Попытка ╧4
%echo on
% Исходные данные задачи
% Рассчитаем полиномы в числителе и знаменателе операторныx функций
% y-уставка
Ny = 3;
%Dy = conv([9 1], [21 1]);
Dy = [9 1];
% o-объект
No = conv([4 1], [7 1]);
Do = conv([10 1], [16.8 1]);
%Do = [10 1];
% n-помеха
Nn = 0.2;
Dn ... |
function ftps = mph2ftps(mph)
%MPH2FTPS Convert speed from miles per hour to feet per second
%
% ftps = MPH2FTPS(mph) convert speeds from miles per hour to feet per
% second.
%
% See also MPH2KMPH, MPH2KTS, MPH2MPS, FTPS2MPH.
% Jonathan Sullivan
% Original: May 2011
% jonathan.sullivan@ll.mit.edu
ftps... |
function [ match score ] = makeConfidentMatches_greedy( confidenceMap, nBest )
if nargin < 2
nBest = Inf;
end
match = []; score = [];
[ max_value max_ind ] = max(confidenceMap(:) );
k = 0;
while max_value > 0 && k < nBest
[ max_row max_col ] = ind2sub( size(confidenceMap), max_ind );
cur_match ... |
function [ pmX0,pmY0 ] = xCurveBSmooth( pX0 )
x=pX0(:,1)';
y=pX0(:,2)';
values1=spcrv([[x(1) x x(end) x(1)];[y(1) y y(end) y(1)]],5,100);
pmX0=values1(1,:)';
pmY0 =values1(2,:)';
|
%function [x] = convertTraj(q)
# This script converts a previous optimal trajectory for a biped into a
# starting feasible trajectory for the biped and exoskeleton. It requires
# the optimal trajectories from a pervious biped simulation (sadly) which is
# stored in prev_space.m.
#
# input: previous optimal... |
%% Load results
load('phantom_results_180821_487.mat');
vs = [1 1 1];
z = 1;
N = size(x,4);
%% Convert to complex
crho = double(rho(:,:,:,:,1) + 1i * rho(:,:,:,:,2));
cx = double(x(:,:,:,:,1) + 1i * x(:,:,:,:,2));
cs = exp(double(s(:,:,:,:,1) + 1i * s(:,:,:,:,2)));
%% Compute ranges
maxmagx = max(abs(reshape(cx... |
function [ chg mag geometry ] = import_chgcar( filename )
%IMPORT_CHGCAR Import a VASP CHGCAR file.
% [chg,mag,geometry] = import_chgcar(filename)
% Import a VASP CHGCAR file. If no filename is specified, data is read
% from CHGCAR. chg and mag are three dimensional arrays containing the
% charge magnetizati... |
function ODD02a_artifact_rejection(SBJ, proc_id, odd_proc_id, gen_figs, fig_vis, plt_id)
% This function generates figures for both the ERP stacks and the ICA Plots for the oddball trials. Also cuts out the bad trials (training, RT).
% INPUTS:
% SBJ = 'EEG#'
% proc_id = 'egg_full_ft'
% proc_id_odd = 'odd_full_ft... |
%%extract all images' features
function [feature,label] = collect_feature(p,stage,branch)
set_file = p.set_file;
im_ids=load(set_file);
image_num=length(im_ids);
feature_file=sprintf('%s/svm_feature/stage_%d_%d.txt',p.data_path,stage,branch);
if ~exist(feature_file,'file')
feature_fid=fopen(feature_file,'w');... |
clearvars
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%plot comparisons generated by compare_AC_iagos
%
%Corwin Wright, c.wright@bath.ac.uk, 2020/05/19
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function varargout = stimedit(varargin)
% STIMEDIT M-file for stimedit.fig
% STIMEDIT, by itself, creates a new STIMEDIT or raises the existing
% singleton*.
%
% H = STIMEDIT returns the handle to a new STIMEDIT or the handle to
% the existing singleton*.
%
% STIMEDIT('CALLBACK',hObject... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.