text stringlengths 8 6.12M |
|---|
% Offset the boilerplate stuff to make the main loop easier/shorter to read
%% Add paths
Screen('Preference', 'SkipSyncTests', 1);
Screen('Preference','VisualDebugLevel', 0);
addpath(genpath('Psychoobox'));
addpath(genpath('ptbutils'));
tgt = ParseTgt(file_name, ',');
HideCursor;
tgt = struct2table(tgt); % R2013b ++!... |
classdef rx1 < handle
% rx1 Implements CSMA/CA receiver protocol 1
properties
addr % Our address
domain % Collision domain of rx
state % Current state
delay % Current amount of delay
tx % Who is xmitting to rx
end
methods
... |
function f = store_data(filaments,P)
% store the number of barbed ends in each foci, labelled by the
% corresponding vertex
f = zeros(P.K,1);
for j=1:P.K
aux = find(filaments(:,1)==j);
if ~isempty(aux)
f(j) = sum(filaments(aux,2)==0);
end
end
end |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% catfiles.m
% Concatenates a list of files formatted for TS to a specified location.
%
% Written by Kevin Shebek
% November 13, 2017
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Choose read/write locations
files = uipickfiles;
[file_name, path_name] = uiputfile('... |
%%
% File: Main_LFR.m
% Directory: 2_demonstrations/workspace/konzultacio/_2021-02-08_Jacopo_Piccini
% Author: Peter Polcz (ppolcz@gmail.com)
%
% Created on 2021. February 08. (2020b)
%
close all;
clear;
clc;
fig = 0;
warning('off')
%% Main LFR
syms data alpha
A = -[
2*alpha*data^2 2*alpha*data
2*alp... |
function [ prob ] = Calculate_prob( pic, pij, pii, L,edges )
%Calculate_prob is used for computing p(Zk|Li)
% pic is the observation (binary feature)
% L should represent a location appearance, that is a normalized histogram,
% even if I am not quite sure about it. Using, as L, the binary histogram
% itself it seems t... |
clear all;
code_folder = pwd;
%exp_folder = 'D:\Leo\1012exp';
exp_folder_cell = {'D:\Leo\0409', 'C:\Users\llinc\GitHub\retina_personal\0503' ,'D:\Leo\0503'};
for eee = 2
exp_folder = exp_folder_cell{eee};
cd(exp_folder);
mkdir MI
cd MI
sorted = 0;
special = 0;
unit = 0; %unit = 0 means using 'unit_a' which is writen do... |
clear all;
close all;
clc;
%input data
A = importdata('linear_sp.txt');
%let it be, c1,c2,c3, donot change, works fine
c1 = A([1:350],[1:2]); %class 1
c2 = A([501:850],[1:2]); %class 2
c3 = A([1001:1350],[1:2]); %class 3
mu_C1 = mean(c1);
mu_C2 = mean(c2);
mu_C3 = mean(c3);
%making ... |
function [x,y,z] = helix(t)
% Helix paper 2010
x = 5.*cos(t);
y = 5.*sin(t);
z = t;
end
|
clc;
clear all;
mfld = fileparts(mfilename('fullpath'));
cd(mfld);
% add variable variate lib:
addpath([mfld filesep() 'var']);
%load('wrms_single_tone_bits.matsc','res','vr','p','s')
%load('wrms_spurr_test.matsc','res','vr','p','s')
%load('fftf_test.matsc','res','vr','p','s')
load('fftf_test_2.matsc','res','vr','p... |
function [f,g,h] = nlwarp(type,parms)
%
% Provide a family of nonlinear warping functions
%
% Creation date: August 25, 2008
% Programmer: Chen,Zhengqing
% Updates: Auguest 27, 2008
% Modification Made by: S.A.Zahorian
% Modi_2nd: Adding Sigmoid as warping option. by CZQ on 16-NOV-200... |
clear;clc;close all
tic
recdate='Mar_13_14';
cellnum='A';
trial=1;
module='ion_species';
load([module '_' recdate '_' cellnum])
prestep_V=-30; % Voltages are in volts
prestep_t=5;
starting_step_V=-65;
finishing_step_V=-90; % Times are in seconds
increments=11;
resistance_increments_less_than_increments=0;
step_t=5;
p... |
% i = del_S;
% del_Tj(i+1,1) = 2*del_S/(v(i+1,1)+v(i,1)) + dwell;
% Timej(i+1,1) = Timej(i,1)+del_Tj(i+1,1);
for i = del_S:del_S:S_max
% Calculating time of actual speed (without filter if set separated)
del_Tj(i+1,1) = 2*del_S/(v(i+1,1)+v(i,1));
Timej(i+1,1)= Timej(i,1)+del_Tj(i+1,1);
end
v_try... |
clear all
% Lire le fichiers OBJ
OBJ=read_wobj_modified('I:\Chercheurs\Soulez_Gilles\Projets\AAA_2D3D\Marie\Elastic1_CT\1.Patient\1.Series\Meshes\thrombus_modified.obj');
% On obtient OBJ.vertices qui est un tableau à 3 colonnes avec les coordonnées de sommets
% Création de la liste contenant les coordonnées de somm... |
function [ur,vr,vl] = fixedDOF(dim,fixnod)
for ii = 1:length(fixnod)
ur(ii,1) = fixnod(ii,3);
vr(ii,1) = fixnod(ii,2);
end
kk = 1;
for jj = 1:dim.ndof
is = false;
for ii = 1:length(fixnod)
if jj == vr(ii,1)
is = true;
ii = length(fixnod)+1; %force exit for ii
... |
% 05-2012
% Victor Barres
% USC Brain Project
% Script to create the default electrodes structure based on FreeSurfer using
% BrainStorm default EEG elec pos and MNI_Colin27 brain.
function data_defaultElec()
confirm = input('ARE YOU SURE YOU WANT TO CREATE A NEW DEFAULT ELECTRODE DATA?(yes,no)\n','s');
if ~strcmp(c... |
clear all
close all
syms s
%por la formula de Mason tengo que obtener la funcion de transferencia
%a partir del diagrama de flujo obtenido
%tengo 3 caminos
camino1=(1/(1+0.1*s))*(-0.01)
camino2=(1/(1+0.33*s))*(0.033)
camino3=(1/(1+0.33*s))*(1/(1+0.33*s))*(0.033)
%No tengo lazos por lo que el determinante es igual ... |
rng('default')
rnds = rand(1,100);
trnd = linspace(0,1,100);
fnc = rnds + trnd;
% plot(fnc)
Mean = mean(fnc(1:25));
StandardD = std(fnc(1:25));
[a,b]=cusum(fnc,5,1,mfnc,sfnc);
compared = 5*StandardD + Mean
fnc(a)
% figure(2)
% plot(fnc) |
function showPointCloud(pointCloud, data)
% showPointCloud - This function shows a 3D point cloud and its
% corresponding distance map.
%
% Inputs:
% pointCloud - nx3 matrix containing the world coordinates in
% (x,y,z)-format in mm for each of the n data points.
% data - single data frame
%
% Other m-files ... |
T = 0.6;
t=sqrt(T);
r=sqrt(1-T);
mod = [33;39;39];
mod = mod/norm(mod);
st_params=num2cell([ 0.125,0,pi,0,pi,pi,pi,0,0,0,0,0]);
[a1,al1,al2,al3,al4,ala,alb,th1,th2,th3,th4,thb]=deal(st_params{:});
a01 = @(al,thet)...
[
t r*exp(1i*al) 0;
-r*exp(-1i*al) t 0;
0 0 exp(-1i*thet)
];
a12 = @(al,thet)...
[
exp(-1i*th... |
function M = RM_eul(x)
M(1,1) = atan2(x(3,2),x(3,3));
M(1,2) = asin(-x(3,1));
M(1,3) = atan2(x(2,1),x(1,1));
end
% calculate the euler anagles vector from a rotation matrix |
clear classes
p = importdata('_position.mat');
p.T = 0; p.M =0
|
function [ new_r_l ] = calculateRBCCoreRadius( Vessel_dynamic, Vessel, Hct )
%UNTITLED5 Summary of this function goes here
% Detailed explanation goes here
Vessel_dynamic = Vessel_dynamic*10^6;
(Vessel - cfl_thickness(Vessel_dynamic,Hct))/(Vessel - cfl_thickness(Vessel))
new_r_l = Vessel_dynamic - CFL;... |
clear all
close all
% 30/05/19
load acmod
ac.p_exp = 1;
% Z = [u(1:N),v(1:N),w(1:N),p(1:N),q(1:N),r(1:N),Phi(1:N),Thet(1:N),...
% ...Psi1(1:N),x(1:N),y(1:N),z(1:N),df(1:N),da(1:N),de(1:N),dr(1:N),CTx(1:N),CTy(1:N),Psi0,VR,tfin]
% 18*N+3
% load('../../purna6DoFDF/results/reshaped/loiterLin_reshape_001.mat')
% l... |
%% input data
user13final = removevars(user13finalfile,{'VarName1'});
gt = user13final(:,{'groundtruth'});
array = table2array(gt);
gt_new = cellstr(array);
gt_class_labels = grp2idx(gt_new);
user13final = removevars(user13final,{'groundtruth'});
user13final = table2array(user13final);
user13final = transpose(user13fin... |
%% main script for MATH 76 research project
% Will Kaufman 2018
%
%close all; clear all; % apparently MATLAB thinks this is inefficient...
prefix = '../graphics/ex1_';
printGraphs = true;
x0 = 1;
a = 1/2;
ref_func = @(k) toy_func(x0, a, k);
x1 = -.25;
b = 1/4;
chg_func = @(k) toy_func(x1, b, k);
N = 1000;
K = 50;
J ... |
%% Project #1: Simulated Filter Characterization
%
% This M-file is written to characterize the performace of basic MATLAB
% filtering operations and assessing their impact on simulated signals
% corrupted with AWGN.
%
% Inputs:
% N/A
%
% Outputs:
%
% Dependancies:
% Linear_FM_Gen.m
%
% Author: 2d Lt Taylor Bodin
... |
function params = gendata(om, k, rdir, dx, dy, flags)
prec='real*4';
ieee='b';
fs = 14; fn = 'times';
% sponge cells on north boundary
nsponge = 15;
% Domain dimensions (m)
Lx = 2*pi/k;
Ly = 800e3;
Lz = 4e3;
% vertical grid, exponential high res near surface
nzc = 30;
mindz = 25; maxdz = 500;
dz = smooth([ones(1,fl... |
function [ Dq ] = kinematicMotionControl(q, r_des, v_des)
% Inputs:
% q : current configuration of the robot
% r_des : desired end effector position
% v_des : desired end effector velocity
% Output: joint-space velocity command of the robot.
% Compute the updated joint velocities. This would be u... |
classdef ConfigWrapper
%UNTITLED3 Summary of this class goes here
% Detailed explanation goes here
properties
id string
name string
configs Config
end
methods
function obj = ConfigWrapper(name)
%UNTITLED3 Construct an instance of th... |
clc;clear;
x=linspace(-10,10,100);
y=linspace(-10,10,100);
[X,Y]=meshgrid(x,y);
Z=X.^2/3+2.*sin(3.*Y);
Z(sqrt(X.^2+Y.^2)<1 | sqrt(X.^2+Y.^2)>3)=NaN;
afisare(X,Y,Z); |
function [events] = EventsSpikes(raster,events)
% Take the event line and get the average spike times and std of the spike times for each event.
% The threshold for percentage of reps with a spike.
perc_station = events.NumRepetitions*(events.PercentageReps/100);
event_index=[];
for e = 1:length(events.StartEvent) ... |
classdef DB
%DB Summary of this class goes here
% Detailed explanation goes here
properties
name
scale
bin_path
img_path
ann_path
img_type
ann_type
n_vert
n_ch
tri
n_tri
comp
n_comp
parts
n_parts
... |
% compute error per component
cerr = zeros(test_ds.n_data,test_ds.n_comp);
for j = 1:test_ds.n_comp
for i = 1:test_ds.n_data
[rms_err,p2p_err,ram_err,hel_err] = ...
computeerr(fann(test_ds.comp{j},:,i), ...
test_ds.data{i}.ann(test_ds.comp{j},:), ...
test_ds.data{i}.ann, ...
test_d... |
function bd = tsbright(music0)
[data,fs] = audioread(music0);
md = mono(data);
% 秒
t = 1;
%最後の方のデータは切り捨て
l = fix(length(md)/(44100*t));
bd = zeros(1,l)';
for i = 1:l
mmd = miraudio(md((i-1)*44100 + 1:i*44100));
bd(i) = mirgetdata(mirbrightness(mmd));
end |
function hash_value = hash(image_name)
RGB = imread(image_name,'JPG');
RGBsmall = imresize(RGB,[8 8]);
GRAY = rgb2gray(RGBsmall);
SRED = mean2(GRAY);
figure('Tag','Contrast');
subplot(2,2,1);
imshow(rgb2gray(RGB))
title('Initial')
subplot(2,2,3);
imshow(RG... |
function emgdiagnosticgraphs(data,plotdetrend)
% plots emg diagnostic graphs
% usage: emgdiagnosticgraphs(data,plotdetrend)
if nargin<2, plotdetrend=0; end
figure;
maxy=max(max(data.NoBlinks));
eventscale=maxy./max(max(data.EventTrain));
if plotdetrend
plot([data.RescaleData' data.NoBlinks... |
function [fxlong,fxlat,fire_area]=read_file_perimeter(wrfout,time)
% Volodymyr Kondratenko April 3 2012
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Input: data : String - data, that contains the name of the Text file.
% First 2 columns - coordinates of a... |
userData=get(0, 'userdata');
userDataList;
for i=1:length(userDataVariables)
if isfield(userData, userDataVariables{i})
eval([userDataVariables{i}, '=userData.', userDataVariables{i}, ';']);
end
end |
function simulate_unicycle
% SIMULATE_UNICYCLE simulates a trajectory for the unicycle system
opts = odeset('MaxStep',0.1);
t0 = 0;
tf = 10;
% get unicycle desired path
[y_spline, z_spline] = unicycle_spline(t0, tf);
% verify that \dot y > 0 for the given spline.
t_chk = t0:0.001:tf;
ydot_min = min(ppval(fnder(y_s... |
function [freq,phase,coef] = PEMfreqBasis
syms a1 a2 a3 a4 freq phase coef
x=-5:2:5;
y=-4:2:4;
lx = length(x);
ly = length(y);
for i=1:lx
for j=1:lx
c1(i,j) = a1*x(i) + a2*x(j);
end
end
for i=1:ly
c2(i) = a1*y(i);
end
for i=1:lx
for j=1:ly
c3(i,j) = a1*x(i) + a2*y(j);
end
end
f... |
function [img, m2, m3] = plot_stability_m(k, H1, H2, s1, s2, Q)
%PLOT_STABILITY_M Plots a slice of the parameter
% space with white for linearly stable, grey for M-P unstable and
% black for flux unstable.
m2 = linspace(0,2,801);
m3 = linspace(0,2,801);
omegaDR = nan(length(m2)... |
close all;
clear all;
clc;
nc = 2; NP = 3;
NV=3+NP+nc+NP*nc+2; %number of variables
NX = 5; NY = 5;
flag = 1;
sweep = zeros(10,1);
time = 'Time = 100';
str = time;%
% change numf to output different properties
% 2 -- pressure 3--temperature 4--water saturation 5--gas saturation, etc
numf = 3% number of variable to p... |
addpath('../lib')
addpath('..')
load('../LET_200.mat')
x = zeros(N, 6);
u = zeros(N, 3);
T = sol(9*N+1,1);
VR = sol(9*N+2,1);
for i = 1:9
j = (i-1)*N + 1;
if i <= 6
x(:,i) = sol(j:j+N-1,1);
else
u(:,i-6) = sol(j:j+N-1,1);
end
end
chi = zeros(1,N);
[~,t] = fourierdiff(N);
t = T*t/(2*pi);... |
clear all; close all; clc;
im = imread('images/castle.jpg');
temp = imread('images/castleTemp.jpg');
% [temp, ~] = imcrop(im);
% imwrite(temp,'images/balloonsTemp.png');
tempR = rotateImage(temp,-45);
figure, imshow(tempR);
imwrite(tempR,'rotated.jpg');
mask = tempMatchRotation(im,tempR);
figure,imshow(m... |
function a_grav = get_gravity(model)
% get_gravity spatial/planar gravitational accn vector for given model
% get_gravity(model) returns the gravitational acceleration vector to be
% used in dynamics calculations for the given model. The return value is
% either a spatial or a planar vector, according to the t... |
function [A,B,Na_new,Nb_new,Ntemp1,Ntemp2]=Unimolecular_Reaction(A,B,Na,Pf)
r1=rand(1,Na);
dtemp=(r1<Pf);
Dtemp=A(:,dtemp);
for i=1:size(Dtemp,2)
B(:,end+1)=A(:,i);
end
A(:,dtemp)=[];
Na_new=size(A,2);
Nb_new=size(B,2);
Ntemp1=Na-Na_new;
Ntemp2=Nb_new-Nb; |
function [azimuth,elev] = gnss2azelv(staXYZ,SatPos,lat,lon)
% converts station position and satellite position to azimuth and elevation
% angles
% written by Dave Purnell https://github.com/purnelldj/gnssr_lowcost
dx=SatPos(1)-staXYZ(1);
dy=SatPos(2)-staXYZ(2);
dz=SatPos(3)-staXYZ(3);
%lla=ecef2lla([ecestaXYZ(1) staX... |
function [L, U, p, sig, B] = lutx(A)
%LU Triangular factorization
% [L,U,p] = lutx(A) produces a unit lower triangular
% matrix L, an upper triangular matrix U, and a
% permutation vector p, so that L*U = A(p,:).
numPiv = 0; % initialize the number of pivots
[n,n] = size(A);
p = (1:n)';
... |
clear all
close all
% Program reads the data from atmos-files starting 1.1.2011 and writes the output file for sosa
Avog = 6.0223E23; % molecules / mol
RG = 8.314; % J / mol / K
MAir = 28.97; % mole mass of air
MH2O = 18.0153; % mole mass of H2O
Avog = 6.0223... |
% MULTILOGGABOR Multichannel decomposition by Log-Gabor filters.
% J = MULTILOGGABOR(I,NSCALES,NORIENTATIONS,OCTAVES,Q) performs the multichannel
% decomposition of input image I by a bank of Log-Gabor filters, where NSCALES
% is an integer to indicate the number of scales, NORIENTATIONS is an integer
% to ind... |
clc
clear all
close all
%Parametros del Modelo
R = 4; % resistencia de la vía aérea
C = 0.05; % complianza o distensibilidad
Pvent = 20; % a presión ventilatoria
% Simlucaion 1: 1 cmH2O. K = 0.1
% Simlucaion 2: 1.7 cmH2O. K = 0.17
% Simlucaion 3: 5 cmH2O. K = 0.5
K = 0.5 ; % contanstate Pmus = K * V/C
sim(... |
clear all
ns=4;
basisExp=zeros(ns,ns);
xx=1:(ns-1);
xi=1;
ys=exp(-abs(xx)/xi);
basis=[1 0 1 0; 1 0 0 1; 0 1 1 0; 0 1 0 1;];
rvec=diag(rand(1,4).*2-1)*1;
uint=diag([ys(2) ys(3) ys(1) ys(2)]);
Hnon=diag(sum(basis*rvec,2));
Hint=diag(sum(uint,2));
yint=[1 1 1 1]./sqrt(4);
ts=linspace(0,10*2*pi,10000);
dt=ts(2)-ts(1)... |
% 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 ... |
% fp_precision.m compara dos precisiones en punto fijo y punto
% flotante
%
% Version: 001
% Date: 2020/03/18
% Author: Rodrigo Gonzalez <rodralez@frm.utn.edu.ar>
clc
clear
close all
% Fixed-point quantizer
q = quantizer('fixed', 'floor', 'saturate', [5 1]); % [wordlength fractionlength]
u = linspace(-15,... |
% Combine LAMMPS trajectory files in MATLAB format to a single .mat file
% E. Weiand - 01/2022
clear
clc
%% parameters
fMin = 1; % minimum file index
fMax = 2; % maximum file index
%% processing
sortedDataFull = [];
volDataFull = [];
writeToRestartRatio = 2;
for ff=fMin:fMax
fileName = ['tabTraj_nvt_pt' n... |
function makeAndSaveSVM(dataSelect, filename)
[x,u] = loadData(dataSelect);
x = x';
u = u';
svm = fitrsvm(x,u);
save(filename,'svm');
end |
clear; close all;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Resolution de l'equation de la chaleur avec
%%% conditions aux limites de Dirichlet homogene,
%%% par la methode des elements finis P1 et un
%%% maillage fixe.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% Load %%%%... |
%% Lineage Mapper Tracking
% This script generates and runs the necessary Macros ImageJ code to
% perform cell tracking
% --------> direct: Directory path where the original images are saved (string)
function [] = LineageMapperTrackingOnLine(direct,ident)
if ~exist([direct,'\Tracking'],'dir')
mkdir([direct,'\Tr... |
%% Stelling 10
%
% Met de functie flipud() kun je in Matlab de volgorde
% van de elementen van een rijvector omdraaien.
%
Antwoord = 0;
|
function [ TOPQ, dTOPQ ] = TOPQ( h,No,hmax,Ho )
%TOPQ NeQuick formula
% REAL FUNCTION TOPQ(h,No,hmax,Ho)
%----------------------------------------------------------------
% NeQuick formula
%----------------------------------------------------------------
% REAL No
persistent g rfac;
if isempty(g)
... |
function [yc, cl, cu] = checkConstraints(obj, x, tol, output_file, permission)
% Check the violation of the constraints
if nargin < 3
tol = 1e-3;
end
if nargin > 3
% print to the file
if nargin < 5
permission = 'w';
else
validatestrin... |
function [W_final, lin_ang_accel_save] = solve_using_rk4(t, W, QuadModel, desRPM, h)
K = zeros(length(W), 4);
K(:,1) = QuadrotorDynamics(t, W, QuadModel, desRPM);
K(:,2) = QuadrotorDynamics(t + 0.5*h, W + 0.5*h*K(:,1), QuadModel, desRPM);
K(:,3) = QuadrotorDynamics(t + 0.5*h, W + 0.5*h*K(:,2), QuadModel... |
function [translatedROIs, inFrameROIs,picXOffset, picYOffset] = findCorr(sourceImage, moveImage, BW1, BW2, imaheTitle)
% Finds the needed translation between two images
%% Input:
% sourceImage - the image which statys the same, no translation
% moveImage - the image which we calculate the tranlsation accoring to
% B... |
function Model_FRF = FRF_train(Xtrain, Ytrain, n_tree,mtree,min_leaf, D, Command)
% FRF performs Functional Random Forest which predicts drug sensitivity
% measure "Area under the Curve (AUC)" using functional data like dose
% response curve points
% Input:
% Xtrain: N x P design matrix, where N is the... |
function gd_train_script(depth,t0)
DATASET='USPS';
LEARNING_RATE.alpha=1;
LEARNING_RATE.t0=t0;
CONVERGENCE.max_iter=10000;
CONVERGENCE.conv_thres=1e-2;
CONVERGENCE.conv_count=Inf;
NET_DEPTH=depth;
NUM_CLASSES=1;
ERROR_CHECK_ITER=100;
if strcmp(DATASET,'USPS')
n_sample=Inf;
train_data=load('USPS Data/train_data.mat'... |
function [ ] = linearity_test( )
fgen = gen_open('10.128.4.143');
discard = 50;
pause(2);
for offset = 0:0.1:3.3
fprintf('Offset:%f\n',offset);
conf = gen_config(fgen,'type','dc','offset',offset,'state','on');
pause(0.1);
file_name = './measures/DC_Ful... |
function [wq, v] = asymmaxcutW( S, X, Wq, V, loss, param, initwq, initv )
% This function finds linear separators to generate a new bit for query and database objects.
%
% Input:
% S: An N*N similarity matrix of objects in the training set
% X: A d*N matrix of features for objects in the training ... |
%AIC test
function[data]=BS_order(dat)
% winlen = 12;
% maxorder = 10;
winlen = 12;
maxorder = 10;
points = size(dat,1);
aic = aic_test(dat,winlen,maxorder);
%
%wind = 5; %Select window size.
wind = 2; %Select window size.
if (wind > (points-winlen+1) || wind <= 0)
errordlg('please input correct wind... |
function out = splitSimplexes(obj)
% - разделить все симплексы по две пары
% - как именно?
simplexesCount = size(obj.simplexList, 1);
processedSimplexes = [];
firstPair = [];
secondPair = [];
pairTuples = [];
for i = 1:simplexesCount
if (any(ismember(processedSimplexes, i)))
... |
function borderXY = scRoiExtract(img,nPoints,desiredPoint)
centroid = round(size(img)/2);
% Extract pixels in polar coordinates from clicked point:
nRays = 300;
% nPoints determines the radius of the captured circle. This should contain
% the entire cell:
theta = linspace(0, 2*pi, nRays);
rho = nPoints:-1:1;
[thetaG... |
[s w] = unix('ls --color=never -lh /home/cbass');
entVals = strfind(w, '.fit');
for m=1:length(entVals)
entry{m} = w(entVals(m)-15:entVals(m)+3);
end
eloff = -2:0.15:2.01;
azoff = -2:0.15:2.01;
keyboard;
index = 1;
fullMap = [];
for m=1:length(eloff)
thisRow = [];
for n=1:length(azoff)
eval(sprintf('thisF... |
function[theta,m] = retinal2environmentalvelocity(vL,vR,x,z,ipd)
% function[theta,m] = retinal2environmentalvelocity(vL,vR,x,z,ipd)
%
% converts to environmental velocity (theta,m) given left and right eye retinal
% velocities (vL,vR), motion location (x,z), and interpupillary distance
% (ipd).
A = [z, -(x+ipd/2); z, ... |
amplitudine = 1.5;
perioada = 4;
frecventa = 1/perioada;
w = 2*pi*frecventa;
rezolutie1 = 0.002;
rezolutie2 = 0.02;
rezolutie3 = 0.2;
t1 = 0:rezolutie1:perioada*5;% 5 perioade
t2 = 0:rezolutie2:perioada*5;% 5 perioade
t3 = 0:rezolutie3:perioada*5;
semnalInitial1 = amplitudine*sin(w*t1);
subplot(2,1,1), plot(t1, semn... |
%cd('/Users/xcitech/Documents/Runs/RUN1100');
%open all files for averaging
LSXFiles = dir('*LSX.nc');
fields = cellstr(['PRECIP'; 'AVAP '; 'LMASK '; 'TS2 '; 'TS '; 'RUNOFF'; 'DRAIN ']);
field_val = zeros(180,90,12,length(fields));
for f = 1:length(fields)
for i=1:length(LSXFiles)
disp(strcat(fiel... |
% TODO
% normalize the eigenfunction caxis([0 1])
function plotthething5(filename,outer,inner,fignr,xticksvec,yticksvec)
figure(fignr)
hold on
ticks = 12; % Schriftgroesse der Achsenunterteilungen
set(gca,'fontsize',ticks,'fontweight','bold','LineWidth',2);
%Z = Z/Z(min(find(abs(Z(... |
function [adata_out, cdata_out] = import_bio_test2()
%IMPORT_RP1_TEST Summary of this function goes here
% Detailed explanation goes here
adata = import_155_data('analog-test-data_2.lvm');
cdata = import_155_data('counter_2.lvm');
%
% Correct counter data fuel K factor
%
cdata(:,7) = cdata(:,3)/2222;
cdata(:,9) = cda... |
function [chro,pred] = prediction(net,chro,dataset)
% obtain the input variables selected
var = select(dataset);
% normalizo los datos
[p,ps] = mapminmax(var');
% set the normalization parameters
chro.norm_params = ps;
% n... |
patientList = dir('LV');
addpath('~/Documents/MATLAB/metaImage');
for i = 1:34
load('roipoints.mat');
pid = patientList(i+2).name;
% Loading the previously segmented myocardium boundary
img = (metaImageRead(['LV/' pid '/' pid '-LGE-cropped.mhd']));
x = p(i,1);
y = p(i,2);
z = p(i,3);
... |
function [GVOLUME,RVOLUME,Volume_ratio_R_G] = adaptive_thresh(green_volume,red_volume,green_sensitivity,red_sensitivity,name)
%UNTITLED Summary of this function goes here
close all;
% Detailed explanation goes here
% adaptively threshold the image
%Calculate locally adaptive image threshold chosen using local fi... |
function out = elastic_regression(f, y, t, lambda, option)
% This function identifies a regression model with phase-variablity using
% elastic methods
%
% input:
% f (M,N): matrix defining N functions of M samples
% y : response vector of length N
% t : time vector of length M
% lambda: regularization parameter
%
% def... |
function out = rASR(file_name, chanlocs, PATH)
p1 = genpath(strcat(PATH, '/eeglab2019_0'));
addpath(p1)
eeglab;
eeg_data = load(file_name).data
EEGin = pop_importdata('dataformat', 'array', 'data', eeg_data, 'srate', 250, 'xmin', 0, 'nbchan', 11, 'chanlocs', chanlocs);
arg_flatline = 5;
... |
t = linspace(0,10);
x = sin(2*t);
y = cos(t);
z = t;
plot3(x,y,z)
title('A5Q5 3D Plot')
zlabel('Z')
xlabel('X')
ylabel('Y')
|
%Nhom 1
%53
%Pham Ba Tung
%B15DCDT221
I=imread('chuoi.jpg');
A=medfilt2(I,[3 3]); %loc trung vi
figure,imshow(A);
B=edge(A,'canny',0.08);
figure;
imshow(B)
|
function [Copt Sopt Res] = get_cv_sigma_krr(Xtr,Ytr,C,S,folds)
% Xtr--input data matrix
% Ytr--output data matrix
% C --values to test
if nargin<3
C=[ 5.^[5:-1:-1]];
end
% C=.1*dataVarEst(Xtr,1)*C;
if nargin<4
S=(0.1:100:1000.1);
%S=[ 5.^[3:-.1:-3]];
end
S=.1*dataVarEst(Xtr,1)*S;
if nargin<5
folds=5;
... |
figure();
plot(1,1, 'ks', 'linewidth',1,'markersize' ,15,'MarkerFacecolor','w','MarkerEdgecolor',[0.5, 0.5, 0.5]);
hold on
plot(2,2, 'ks', 'linewidth',1,'markersize' ,15,'MarkerFacecolor','k','MarkerEdgecolor', [0.5, 0.5, 0.5]);
%legend(gca,{'firing cell ($$\tau_{on}$$)','non-firing cell ($$\tau_{off}=5$$)'}, 'FontSi... |
% panel start at the far top left hand corner
function shop_program( action )
% figures
global CUSTOMER_VIEW
global MAIN_PANELS
%The ticket panel parameters
global TICKET_PANEL
global TICKET_BUTTON_NAMES
global TICKET_PRICES
global TICKET_QUANTITIES
%The ci... |
%%
testTS = fts_window(RANGE);
logret = diff(log(fts2mat(testTS.series1)));
realVolMAT = sqrt(conv(logret.^2,ones(20,1))*252/20)*100;
% align it with their corresponding testTS.dates
% check
% realized(t) = sqrt(mean(diff(log(fts2mat(testTS.series1(t-20:t)))).^2)*252)*100
% == nxtmnthVols(t) except precision loss
realV... |
n_meas = length(clusters);
clusters_gr = {};
for i=1:n_meas
i
clusters_gr{i} = group_clusters(clusters{i});
end
|
% This is an implementation of our ACC paper "Reduced-order
% Aggregate Dynamical Model for Wind Farms",arXiv, S.
% S. Vijayshankar and V. Purba and P. Seiler and S.
% Dhople for details of the model.
% In this code, we compare the responses of Full-order and Reduced order
% models.
load xend
clf;
N = 1
x0 = [xend(1:... |
function signal = conventional_am(x, Ac, mu, fc)
fs = 600;
t = 0 : 1 / fs : 1 / fs * (length(x) - 1);
signal = Ac .* (1 + mu .* x) .* cos(2 * pi * fc * t);
end |
clear;
T =200;
mu = 1;
eta = 1;
kappa = 0.7;
s = 0.2;
omega=0.03;
L_0 = 1;
T_span =[0;T];
N = 200; %number of space steps
h = 1/N; %space step length
x = linspace(0,1,N+1).';
init_cond = [omega*(1-x.^2);L_0];
[T_out,Y_out] = ode23s(@(t,y) PDE_system_run(t,y,x,h,kappa,s,mu,eta),T_span,init_cond);... |
% Reads in files, takes averages over J and x_0 of the original vs prdicted
% values.
%temp = 0.01;
t = 400;
dt = 0.01;
n = 50;
j_samples = 1;
jamp=1;
%% Read in all the simulation files at the given temperature
pathName = '/home/k1594876/Documents/theoretical_modelling/data/';
T_range = [0.001, 0.010, 0.1, 1, 5];
... |
function [ indMorningCrossStar ] = isMorningCrossStar(obj, bars )
%%
% 《日本蜡烛图技术》,1998年5月第一版,P67
%%
indMorningStar = obj.isMorningStar(bars);
indCross = obj.isCross(bars);
indCross = [0;indCross(1:end-1)];
indMorningCrossStar = indMorningStar&indCross;
end
|
function [QQ,VP,VT,AA,bb]=TgetQQ(xxP,yyP,xxT,yyT,mmP,mmT,UPT)
# mmP in mmT sta lastna prispevka kvadratkov in trikotnickov
# UPT: napetost med plosco in trikotnikom
eps0=8.854e-12;
nP=length(xxP);
nT=length(xxT);
AA=zeros(nP+nT+2);
bb=zeros(nP+nT+2,1);
# plosca
for i=1:nP
AA(i,i)=mmP;
bb(i)=0.0;
# s plosco... |
function path = reconstruct_path(rrt_tree,goal_vert)
reverse_path = rrt_tree(goal_vert).vertex;
child_node = goal_vert;
parent_node = rrt_tree(goal_vert).parent;
%n = 2;
while parent_node ~= 1
[~,intermediate] = forward_simulate(rrt_tree(parent_node).vertex,rrt_tree(child_node).action,rrt_tree(child_node).time);
... |
%% plot whole exp
A = zeros(length(Oindex_comb),1);
index = get_condition_index2(convergence_data,'convergence');
A(index) = 4;
index = get_condition_index2(convergence_data,'convergence_A');
A(index) = 3;
index = get_condition_index2(convergence_data,'convergence_B');
A(index) = 2;
index = get_condition_index2(conve... |
%% Satellite probagation
TLE2RV
clc
%close all
clear all
%close all
format long g
global AuxParam eopdata PC Cnm Snm const swdata
%% Load initial data
SAT_Const
load DE430Coeff.mat
load Epoch.mat
load State.mat
load TD.mat
load Kep.mat
load BStar.mat
PC = DE430Coeff;
Y0 = Y(1,:)';
%% Load File
% read Earth gravi... |
Ke = 0.06902;
taue = 151.51*10^-6;
taum = 0.0161;
G = tf([1/Ke],[taum*taue taum 1]);
% Open and Closed Loop Responses
Gcl = feedback(G,1);
figure(1)
step(G)
hold on
step(Gcl)
grid on
legend('Open Loop Response', 'Close Loop Response')
ylabel('Speed')
xlabel('Time (sec)') |
% MOCAPPLAYFACEFILE Play a face file of motion capture data.
% Load patches
% connections = mocapFaceConnections('../data/manuel/connections.txt');
% connections(:, 73:end) = [];
% connections(73:end, :) = [];
patches = mocapFacePatches('../data/manuel/patches.txt');
for i = 1:4
patches(i).colour = zeros(size(patc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.