text stringlengths 8 6.12M |
|---|
function f = Generate_Song1(song,bpm,SampleFrequency,wave,key,adjust)
% input:
% song: type: n*2 matrix, the first colume represents the note('rest' means
% rest in music, while the second colume represents the duration of time;
% bpm: type: int, beats per minute;
% SampleFrequency: type: int, the frequency of sampling... |
% physio_script.m
% Script that calls physio routines to construct physiological regressors
% acquired using the spike data acquisition software.
% This script is for demonstration purposes and may need editing in order
% to generate the required regressors.
% The main routine to create the physio regressors is make_ph... |
% Stima l'angolo della PSF
%
% theta = angle_estimation(X)
%
% X = IMMAGINE BLUR
%
% theta = ANGOLO STIMATO
function theta = angle_estimation(X)
[M, N] = size(X);
%% Creo la finestra di Hann
mask = zeros(M, N);
for i = 1:N
mask(:, i) = hann(M);
end
mask = mask.*mask';
%% ... |
function idx = resampling_index(w)
%% basic resampling algorithm
%{
---------------------------------------------------------------------------
Created by:
Felipe Uribe (felipe.uribe@tum.de)
Engineering Risk Analysis Group
Technische Universitat Munchen
www.era.bgu.tum.de
-------------------------------------------... |
%% Range of movement of Elbow in Sagittal Lifting
% Code AUTHOR: Yaiza Benito Molpeceres. DATE: January-May 2020.
% Adapted to Octave by Guillermo Asín Prieto
% Segmentation is based on box signal and consists of five phases shown in figure 1:
% 1: Subject starts at upright position and lowers down to pick the bo... |
function [M,T] = scoreMatrix(E)
[height,width] = size(E);
E_weight = ones(height,width);
[M,T] = scoreMatrixWithWeight(E,E_weight);
end |
% Used for HKUST ELEC 5660
close all;
clc;
addpath('./utils','./readonly');
Rot = [ 0.999957 0.00279888 -0.00878733
0.00298411 -0.999772 0.0211375
-0.00872617 -0.0211628 -0.999738
]
[Z, X, Y] = RotToRPY_ZXY(Rot)
return
figure(1)
h1 = subplot(3,4,1);
h2 = subplot(3,4,2);
h3 = subplot(3,4,3);
h4 = subplot(3,4,4... |
function SE_static = SE3P_Laplace_gridding_precomp(x, opt)
% SE3P_LAPLACE_GRIDDING_PRECOMP Precomputation of fast gridding vectors
% SE_STATIC = SE3P_LAPLACE_GRIDDING_PRECOMP(X,OPT)
%
% Parameters:
% :param X: source locations (N×3)
% :param OPT: Structure with Ewald options
%
% :returns: **SE_STATIC** -- Structure... |
clc; clear all ; close all
% INICIALIZACION DE KINECT, CAMARA RGB Y SENSOR DE DISTANCIA
imaqreset;
depthVid= videoinput('kinect',2);
triggerconfig (depthVid, 'manual');
depthVid.FramesPerTrigger=1;
depthVid.TriggerRepeat=inf;
set(getselectedsource(depthVid),'TrackingMode','Skeleton');
viewer=vision.DeployableVideoPlaye... |
function [ output_args ] = two_plots( one_over_lambda,train_erros,test_errors )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
fig = figure
subplot(2,1,1)
plot(one_over_lambda,train_erros)
title('1/ \lambda vs train errors')
xlabel('1/ \lambda')
ylabel('Error')
subplot(2,1,2)
plot(one_... |
%matrix norm
function f = matrixNorm(A,p)
f = norm(A,p); |
function img_motion = motion_blur(img)
% FSPECIAL('motion',LEN,THETA)
THETA = unifrnd(0,360);
% LEN = unifrnd(10,20);
LEN = 20;
PSF = fspecial('motion',LEN,THETA);
img_motion = imfilter(img, PSF,'conv','circular'); |
clear all;
h=100;
w=100;
ColMap=[0.9,0.9,0.9];
map=load('/home/xiaoling/SpiralWave/data/Spi7_n6_2Rho0t240p500c10_map.dat');
map=map([1:h]+h,:);
map1=map(75:78, 81:84);
data=ones(100, 100);
% [MatX, MatY]=meshgrid(1: size(data,2), 1:size(data, 1));
% MatR=sqrt( (MatX- (w+1)/2).^2 + (MatY- (h+1)/2).^2 );
% data( abs(M... |
function strout = tnm034(testImage)
% Get stafflines
[peaks, staffLocations, imageRotated] = GetStaffLines(testImage);
%% Whitespace
whiteSpaceMedian = whitespaceLength(staffLocations,imageRotated);
%%
image = removeGcleff(imageRotated);
%%
%Create a mask
dividedImage = createMask(image,whiteSpaceMedian, staffLocat... |
function p = getCentralBodyProperties(body)
switch body
case 'earth'
p.Tir_Day = 254;% default: 254; % Black-body temp during day time (K)
p.Tir_Night = 254;%default: 254; % Black-body temp during night time (K)
p.radius = 6371; % Radius (km)
p.albedoFactor = ... |
function []=Show(Input,Model,Degree)
clf();
plot([Model.x],[Model.y],'*');
hold on;
x=linspace(min(Model.x),max(Model.x),100);
y=zeros(1,length(x));
for i=1:length(x)
if(Degree==1)
y(i)=(Input(1)*x(i)+Input(3))/(-Input(2));
elseif(Degree==2)
y(i)=(Input(1)*x(i)^2+Input(2)*x(i)+Input(4)... |
function syntheszed_signal = SynthesizeLegacy_STRAIGHT_default(x, fs)
% Conditions are based on the web document
%
f0raw = MulticueF0v14(x,fs);
ap = exstraightAPind(x,fs,f0raw);
n3sgram=exstraightspec(x,f0raw,fs);
syntheszed_signal = exstraightsynth(f0raw,n3sgram,ap,fs);
end |
function [A,B,C,M1,N1,S1,SF1,NumFrames,NumCols,NumRows,FrameInt,AcquisitionRatio,ActMap,Times] = daRead6(daFile,XCoord,YCoord)
%this function plots the time series for a single pixel of the redshirt
%camera, both filtered and unfiltered. Pass it the file name and
%coordinates. (1,1) is top left. It returns three matri... |
function MDL(config_file)
% MDL is the main (wrapper) script of the MDL tool
% This function sets the profile of the parallel server using the default
% local profile
%
% Copyright (c) 2012-2014, Imperial College London
% All rights reserved.
%setmcruserdata('ParallelProfile', 'local.settings');
MDLserver(c... |
function [T] = Bcs( n,m,T,T0,T1)
%This function sets Bounry conditions
%Left
T(:,1)=T0; %Dirichlet Bcs On Left side
%Right
T(:,m)=T1; %Dirichlet Bcs On Right side
%Top
T(1,:)=T(2,:); %Neumann Bcs On Top side
%Bottom
T(n,:)=T(n-1,:); %Neumann Bcs Bcs On Bottom side
end
|
function [Features,Labels] = get_training_set()
%% Returns training set for SVM
directory = './training_set/';
scale = @(m)ones(1,m)*0.7;
Features = [];
Labels = [];
% --- dataset 1 ---
file = [directory 'zcup_move_1&rgb&r-3467165-69.png+zcup_move_1&rgb&r-3533842-70.png.csv'];
image1 = [directory, 'r-3467165-69.png'];... |
function C = dct_ii(N)
% DCT_II Discrete Cosine Transform matrix
%
% C = DCT_II(N) Generates the 1-D DCT transform matrix of size N,
% such that Y = C * X transforms N-vector X into Y.
% Uses an orthogonal Type-II DCT
C = ones(N,N) / sqrt(N);
theta = ([1:N] - 0.5) * (pi/N);
g = sqrt(2/N);
for i=2:N,
... |
clear
%%%% 2nd layer filter visualization %%%%
numhid=24;numtx=1;
addpath('utils','function_code','results');
load('sandstone_alloy_w6_b24_rot_nrot1_pb0.3_pl10_iter_2000.mat');
sigma=gather(weight.sigma);
filters_t=gather(weight.vishid);
% load('Tlist_6ws_1r.mat');
%
load('sandstone_2nd_(24f40f6ws9ws)_alloy_w9_b40_tra... |
%modulation using QAM quadrature amplitude modulation
M=16;
k=log2(M);
n=3e4;
nsamp=1; % over sampling rate
x=randint(n,1);
stem(x(1:40),'filled');
title('random bits');
xlabel('bit index');
ylabel('binary value');
grid on;
xsym=bi2de(reshape(x,k,length(x)/k).','left-msb');
figure;
stem(xsym(1:10));
title('random symb... |
function [sample] = rskewnorm(location,scale,shape)
% % work out what the approx highest probability will be
% x = linspace(-scale,scale);
% y = zeros(100,1);
% for ii = 1:100
% y(ii) = skewnormal(x(ii),location,scale,shape);
% end
% highest probability the skew normal pdf defined by skewnromal.m will
% reach
% m... |
% 1. This program extracts data from a .txt file created by Labview, then plots a curve
% from the equation w(z) = w0*sqrt(1+((\lambda*z)/pi*w0^2)^2) to the extracted data,
% along with simulated data and finds a curve minimum.
% 2. Plots 3D meshes of the raw data
% 3. Plots 3D meshes of w(z) = w0*sqrt(1+((\lambd... |
% This code is used to generate the main results of the gain task
% reported in the following paper:
%
% Meirhaeghe N, Sohn H, Jazayeri M (2021) A precise and adaptive neural
% mechanism for predictive temporal processing in the frontal cortex.
% bioRxiv; https://doi.org/10.1101/2021.03.10.434831
%
% The script runs ... |
function PSVstruct2nc(data,dpath)
% This function create a NetCDF file from DSD structure
% Use: ncDSDstruct(data,dpath)
% data is DSD structure, a dpath is the folder of output
% JValdivia - 08/2019
file=['PARSIVEL_',datestr(data.time(1),'yyyymmdd'),...
'.nc'];
name=[dpath,file];
if exist(na... |
classdef parameterized_system_properties < system_properties
properties
%% Solubility definition
% Polynomial to calculate solubility in kg/kg. The first element is
% the coefficient of zero-order temperature term.
solubilityPoly = [4.564e-3; 3.032e-5; 8.437e-6];
%% ... |
function [predclass]=svm_classify(newdata,SVM)
%CLASSIFYSVM Predict class of test data using the SVM structure obtained
%from svm_train.m
%Unpack SVM structure
sv=SVM.sv;
alphaHat=SVM.alphaHat;
bias=SVM.bias;
shift=SVM.shift;
scaleFactor=SVM.scaleFactor;
par=SVM.par;
% shift and scale columns of data matrix:
for c = ... |
function speed_box=findBoxspeed(test_obtData)
% It automatically calculates the box speed i.e target speed that lies in
% opto coverage.
%INPUT test_obtData data obtained in matrix form
%OUTPUT speed_box scalar variable equivalent to speed of box.
optoData= test_obtData; %#codegen
contOne=0;
temp=zeros(size(optoDat... |
load('JpegCoeff.mat');
load('hall.mat');
[accode,dccode,quantized_coef,width,height]=jpeg_encode(hall_gray,QTAB,ACTAB,DCTAB);
compression_ratio=calc_compression_ratio(length(accode),length(dccode),size(hall_gray,1),size(hall_gray,2)) |
%Laboratorio 4: Correlacoa entre sinais de tempo discreto
figure(1); set(1,'Name','Gráficos dos sinais');
x = [1,2,3,0,3,2,3]; nx = [0:6];
subplot(1,2,1);
stem(nx,x);
title('x[n]')
xlabel('n');ylabel('x');
axis([-1 7 -2 4]);
grid;
w = [-1,2,3,0,3,2,-3]; nw = [0:6];
subplot(1,2,2);
stem(nw,w);
title('w[n]')
xlabel('n... |
function T = statsTableTimeseries(D,groupname,varargin)
%% default
stats = {'mean','se'};
timename = 'time';
timeprefix = 't';
vararginProcessor
%% export data
tu = unique(D.(timename));
time = cellfun(@num2str,num2cell(tu),'UniformOutput',0);
colname = strjoinrows([cellfunexpr(time,timeprefix) time],'');
gnu = un... |
%Reset all:
clear all;
close all;
clear, clc;
%Parameters:
topology = [ 0 1 0 1;
0 0 1 0;
0 0 0 1;
0 0 0 0]; %it gotta be triangular superior with zero diagonal
top_bidir = topology + topology'; %Auxiliary: adjacency matrix.
N = size(topology,1); %number agents
... |
%% fn_map
%% Syntax
% B = fn_map(fun,A,mode)
%% Description
%
% map function 'fun'
% to elements(mode=0) / columns(mode=1)[default] / rows(mode=2) of A
%% Source
% Thomas Deneux
%
% Copyright 2006-2012
%
|
function [S1, S2, S3, S4] = get_supervision_pairs(m, y_train)
% Input: m number of supervisions needed. y_train = class labels
% Output: S1 and S2 index of randomly chosen pairs that are in the same
% cluster
%% computing the data parameters from data
max_y = max(y_train);
n_train = length(y_train);
n_train_e = zero... |
function O = nantonum( M, num )
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
k = find(isnan(M))';
M(k) = num;
O = M;
end
|
function robot = gen_contact(robot, flagWriteFcn)
params_ = import_robot_params('symbolic');
robot.contactBodyNum = 5;
robot.contactPos = [params_.L(3) 0 0];
jaco_xyz = contactJaco(robot, params_.rq, params_.rqd, robot.flagFloat, robot.contactBodyNum, robot.contactPos);
jaco_contact_redundant = simplify(jaco_xyz(1:2,... |
function [newcell] = add2cell(elt,oldcell)
% add an element to the end of a 1-dimensional cell
cellsize = max(size(oldcell));
newcell = oldcell;
newcell{cellsize+1} = elt; |
function [y_new] = projection2(y,radius,center,N)
% this function is the projection operator used in Algorithm 2, which project any input y into a spherical set with parameters center and radius
% N is the node number (size of y)
% y_new is the projected point
dif_y = y - ones(1,N).* center;
y_new = zeros(N,N);... |
function matrix=pivot(matrix,i)
%PIVOT Computes the Gauss Jordan pivot with pivot element matrix(i,i)
% MATRIX = PIVOT(MATRIX,I,J)
%
% MATRIX : The resulting matrix
%
% MATRIX : The input matrix
% I : Indication of the pivot element
%
% See also: http://www.cs.rug.nl/~rudy/matlab/
% R... |
% SwarmEvaluation
%% Fuzzy Controller
% function meanConvHullAera = SwarmEvaluation(isFuzzy, numRobots, Safe_Dist, detectorRange, fis, sampleTime, evalTime)
%% NN Controller
function meanConvHullAera = SwarmEvaluation(FuzzyOrNN, numRobots, Safe_Dist, detectorRange, controller, sampleTime, evalTime)
%% Set up Envi... |
function [ puncta, groups, bg ] = GUIgetints( images, varargin )
%%%%%%%%%%%% OUTPUTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% puncta ... |
function [ ppLabels ] = postProcess( testLabels )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
minOccurence = 5;
besideOccurence = minOccurence*2;
ppLabels = zeros(size(testLabels,1),1);
before = 0;
index = 1;
c=0;
while index < size(testLabels,1)
... |
function [Ab, fit] = kill(Ab, fit)
I = []
for i=1:size(fit,1)
if fit(i) < 0.4 %1/r
I = [I; i]
end
end
Ab = extract(Ab,I);
fit = extract(fit,I);
end |
function Z = calcAGIE(q_, L_, m_, I_, gear_, eff_, scenario, drive)
J_ = fcn_Jaco_Contact(q_, L_);
% disp(scenario)
switch scenario
case 'bwd'
switch drive
case 'ser'
H = fcn_H_q_ser_bwd(q_, L_, m_, I_, gear_, eff_);
case 'par'
H = fcn_H_q_par_bwd(q_, ... |
function condNum = ConditionNumber( X, type )
% ConditionNumber Condition number with respect to inversion.
% cond(X) returns the 2-norm condition number (the ratio of the largest
% singular value of X to the smallest).
%
% cond(X,P) returns the condition number of X in P-norm (matrix norm).
%
% See also... |
function I_B = fTranslateInertiaMatrixFromCOG(I_G, Mass, r_BG)
% Transform inertia matrix with respect to COG to the inertia matrix with respect to point B
%
% NOTE: the vectors and the inertia matrix needs to be expressed in the same coordinate system.
%
% INPUTS:
% I_G : Inertia matrix 3x3 with respect to COG
% ... |
%INITPARAMS - Get all default parameters
clear params;
%% Text Parameters
params.text.subtt_trans_method = 'words'; % alternatives are 'chars' or 'words'
params.text.allowable_error = 0.75; % error rate for the number of matching idxs
params.text.min_line_length = 2; % ignore all assignments for lines short than thi... |
function jsmBoxPlot(y,grp,varargin)
%jsmBoxPlot - see below for inputs and optional parameters
%
%
% INPUTs
% y [m x n] matrix of data
% grp {m x 1} cell of histological labels, i.e. different boxes
%
% OPTIONAL
% cols [g x 3] rgb values of colours for correct number of unique(grp)
% order [g x 1] vector to chan... |
%This function reshapes the kspace coordinates to be in the format required
%by the dcf calculating function and gridding recon
function k=Bruker_reshape_kspace_coords(k_in)
npts=size(k_in, 2);
nviews=size(k_in, 3);
x=k_in(1,:,:); x=squeeze(x); x=x(:);
y=k_in(2,:,:); y=squeeze(y); y=y(:);
k=complex(x, y)... |
function [] = SubTrainData(train_data,seq_ID_mat,sub_train_num,...
common_index,diff_index_num,boundry,...
TIME_SLOT,SEN_NUM)
%UNTITLED13 此处显示有关此函数的摘要
% 此处显示详细说明
remain_index = setdiff(seq_ID_mat(1,:),common_index);
k_subset = nchoosek(remain_index,diff_index_num)... |
function measure = con_CCAplus( data,rdm,target,ratio,sp_coind,tp_coind )
%% construct UMR
dt=size(target,1)-1;
nt=size(target,2);
ds=size(data,1)-1;
ns=size(data,2);
dc=size(sp_coind,2);
source_common=data(sp_coind,:);
temp1=data;
temp1(sp_coind,:)=[];
source_only=temp1;
target_common=target(tp_coind,:)... |
%Question 3
data = readtable('seeds.csv');
kernel_width = data.Var5;
kernel_height = data.Var7;
variety = data.Var8;
X = [kernel_width kernel_height];
X = [X; [-1 -1]; [10 0]];
disp('3a)');
disp('Scatter Plot');
figure(1);
[idx, C] = kmeans(X, 3, 'Start', 'Sample', 'Replicates',100);
gscatter(X(:,1), X(:,2), idx);
x... |
function [ mq, Sigmaq, Lambdaq ] = opperGetMeanParamStruct( prior, post )
%OPPERGETMEANPARAMSTRUCT It uses prior and posterior structues
%
%% Get prior Parameters
K = prior.Sigma; % Prior Covariane
Lambdap = prior.Lambda; % Prior precision
Deta = diag(post.eta);
N = length(post.eta);
%% Computes ... |
function [xs ys] = spring(xa,ya,xb,yb,varargin)
persistent ne Li_2 ei b
if nargin > 4
[ne a r0] = varargin{1:3};
Li_2 = (a/(4*ne))^2 + r0^2;
ei = 0:(2*ne+1);
j = 0:2*ne-1; b = [0 (-ones(1,2*ne)).^j 0];
end
R = [xb yb] - [xa ya]; mod_R = no... |
clear all;
close all;
clc;
format long;
files=char('client-09_03012202');
num=size(files, 1);
for i=1:num
name=files(i,:);
dataAll=dlmread(sprintf('../exps/data/%s.csv', name),',',1,0);
responseTime=dataAll(:,7);
TS=dataAll(:,1);
QoE1=dataAll(:,4);
QoE2=dataAll(:,5);
save('QoE2202', 'respon... |
function [classifier] = knn(Tbl, Labels, K, Dist)
if K == -1 || isempty(Dist)
neighbours = [3, 5, 7, 9, 11, 13];
distances = [ ...
string(euclidean), ...
string(seuclidean), ...
string(mahalanobis)];
classifiers = cell(length(neighbours), lengt... |
function obj = changeCaxis(obj)
% Biafra Ahanonu
% Started: 2021.03.25 [22:11:25] (branched from ciatah.m)
userInput = inputdlg('CAXIS min max');str2num(userInput{1});
S = findobj(gcf,'Type','Axes');
% C = cell2mat(get(S,'Clim'));
C = str2num(userInput{1});
% C = [-1 7];
set(S,'CLim',C);
end |
function pAgtmcpu(varargin);
% pAgtmcpu( [...] );
% T Mbase CPU
h = timeplot({'CPU_Pct'}, ...
'T Mbase CPU', ...
'CPU', ...
{'CPU\_Pct'}, ...
varargin{:} );
|
function [x]=Linear_Mesh(Xmin,Xmax,DeltaXmax,DeltaXmin,N)
DeltaXincrement=(DeltaXmax-DeltaXmin)/N; %%%% definition of the increment mesh
Xm=Xmin+0.5*(Xmax-Xmin); %%%% definition of the middle of the interval to mesh
Xo=Xmin;
xb=Xo;
x1(1)=Xo;
x1(2)=Xo+DeltaXmin;
i=2;
while xb<Xm-DeltaXmax
... |
% Graft fatty acids in a triangular structure inside a periodic box,
% E. Weiand - 01/2022,
% Based on: https://github.com/JeroenMulkers/lammps_graphene/blob/master/graphene.m
% General notes:
% - The random damage seeds are NOT repeatable (i.e. launching this
% script twice will give you two different damage patt... |
function [roll, pitch, roll_error] = rollPitchFromAccelerometer(accelerometer, mu)
% Normalize and invert acceleration vector
% to measure up instead of gravity.
zbase = -accelerometer / norm(accelerometer);
% Find roll from accelerometer
roll_unstable = atan2d(zbase(2), zbase(3));
if ~exis... |
function [ mu, lambda, nu] = fitStudent( data, nu_init, W, mu_init, lambda_init)
%FITSTUDENT Maximum likelihood estimate for Student-t distribution
% Use W for setting weights to data
if nargin == 2
[mu, temp] = fitGaussian(data);
lambda = 1/temp;
nu = nu_init;
start = 1;
for i=1:100
... |
%This function takes a central derivative on a staggered grid of a
%field F defined on a regular grid.
function dF = Dsimp2(dx,F,type)
if (strcmp(type,'x'))
dF = (F(2:end,:)-F(1:(end-1),:))/dx;
else
dF = (F(:,2:end)-F(:,1:(end-1)))/dx;
end
end
|
clear all
clc
LoadSingleFile=1;
BlockSize=15E7; % change depending on memory (RAM) size
dataFolder='E:\LeuvenData\Developement\EyeTrackerDataAnalysis\Eye MovementFiles'; % User-defined!
%
%
% rootFolder=fileparts(mfilename('fullpath'));
% switch LoadSingleFile
% case 1 %%% Select single file
% ... |
function [sphericity, volume, surfaceArea] = sphericityIndex (FV)
volume = meshVolume(FV);
surfaceArea = meshSurfaceArea(FV);
sphericity = pi^(1/3) * (6*volume)^(2/3) /surfaceArea;
end |
function [ x, y, z ] = ReconstructMeshgrid( vect2D )
%RECONSTRUCTMESHGRID reconstructs a regular 3D grid in 'meshgrid' format
% from a 2D vector containing the respective coordinates
%Input:
% <vect2D> 'meshgrid' coordinates in 2D vector format [x,y,z]
%Output:
% <x> x coordi... |
close all; clc; clear all;
s = tf('s');
T = 0.5;
L = 4;
g = 4/(T*s+1)*(1-L/2*s)/(1+L/2*s)
rlocus(g)
ts = 2.5;
Mp = 0.1;
zita = 1/sqrt((pi/log(Mp))^2+1);
wn = 4/(zita*ts);
pd1 = -zita*wn + 1i*wn*sqrt(1-zita^2)
pd2 = -zita*wn - 1i*wn*sqrt(1-zita^2);
polos_g = pole(g)
ceros_g = zero(g)
%Aportes angulares de todos ... |
function [x y] = projectile()
% example from page 312 of Gilat,
% MATLAB: An Introduction with Applications
syms V X ang real
syms v0 g t positive
ihat = [1; 0];
jhat = [0; 1];
X0 = [0; 0];
V0 = pol2vec(v0, ang);
A = -g * jhat;
V = V0 + int(A, t);
X = X0 + int(V, t);
... |
function avitotiff
obj = VideoReader('movie.avi');
vid = read(obj);
frames = obj.NumberOfFrames;
for i = 1 : frames
if numel(num2str(i))==1
imwrite(vid(:,:,:,i),strcat('0000',num2str(i),'.tif'));
elseif numel(num2str(i))==2
imwrite(vid(:,:,:,i),strcat('000',num2str(i),'.tif'));
elseif numel(num2str(i))==3
... |
function [lat, new_Coord, deviation]= move_along_SoftMode_Mutation(coord, numIons, lattice, eigvector, mut_degree)
% USPEX Version 8.0.0
% atom mutation based on soft modes: all atoms moved along eigenvector corresponding to the softest mode
global ORG_STRUC
global POP_STRUC
N = sum(numIons);
vec = zeros(1,3);
new_C... |
function data = generate_force_extension_plot_data()
if(not(isfile('optim_collision_results_table.mat')))
generate_results;
end
collision_results = load('results\force_sim_and_optim_collision_results.mat', 'table_data');
collision_results = collision_results.table_data;
load_dig... |
%{
# Drug
drug : varchar(32)
---
(drug_source) -> hillman_lab.Source
drug_description='': varchar(255)
%}
classdef Drug < dj.Lookup
properties
contents = {{'caffeine'}, {'alcohol'}} % need an update
end
end
|
close all; clear all; clc;
x = [1 2 3 4 5];
y = [.5 1.7 3.4 5.7 8.4];
n = length(x);
A = [n sum(log10(x));sum(log10(x)) sum((log10(x)).^2)];
X = [];
Y = [sum(log10(y)) sum(log10(y).*log10(x))];
X = Y/A;
a2 = 10^X(1,1)
b2 = X(1,2)
plot(x,y,'o');
hold on;
ym = log10(a2) + b2*log10(x);
plot(x,ym); |
function [C Cframes COMMUNITIES]= get_co_membership_matrix(OUTPUT_STRUCT,adjacency_used)
if nargin<2
adjacency_used = 'W';
end
total_frames = length(OUTPUT_STRUCT);
N = size(OUTPUT_STRUCT(1).Wframes,1);
C = zeros(N);
Cframes = cell(total_frames,1);
COMMUNITIES = cell(total_frames,1);
parfor t=1:total_frames
... |
function [ts_T,wave1elec,waveTelec,chan_cell,firewave,LR_T,IsoD_T,Trodalness,info] = op_readcell_single(filename,DSPchan)
%--------------预定义变量-----------------------%
cc = 1;
ts_T = []; % cell 结构
wave1elec = [];
waveTelec = [];
chan_cell = [];
firewave = []; % cell 结构
LR_T = [];
IsoD_T = [];
% -----------把 cell 的信息读... |
function u1=denoising_SBNLTV(u0,mu,lambda,lambda_SKR,inner,wopts,wopts_SKR,HR,lambda_DL)
[Ny,Nx]=size(u0);
%mu=1./mu; % to be consistent with the code: mu is on the fidelity term in the denosing code
display_messages = 0;
VecGeneralParameters = [ display_messages; Ny; Nx; wopts.m; wopts.w; wopts.NbNeigh; lambd... |
%% MyMainScript
tic;
%% Your code here
clc
clear all
close all
myReconstruct('../../../att_faces/s', 112, 92, 32, 6, 4, 58);
% This face corresponds to s10/3.pgm
toc;
|
% grid = atomic_grid(iAtom,xyz_a0,atoms,nRadialPoints,nAngularPoints)
%
% Generates a full 3D spherical grid (product of 1D radial and
% 2D angular grid) centered at Center and radially scaled for
% the element given in Element.
%
% It returns the Cartesian coordinates of the grid points and
% their respective w... |
function [fl re]=lines(metinim)
% Metni satırlara böl
% metinim->input image; fl->ilk satır; re->kalan satırlar
% ÖRNEK:
% metinim=imread('TEST_3.jpg');
% [fl re]=lines(metinim);
% subplot(3,1,1);imshow(metinim);title('GİRİŞ RESMİ')
% subplot(3,1,2);imshow(fl);title('İLK SATIR')
% subplot(3,1,3);imshow(re);titl... |
function [ y ] = val_pol_carat_trid( A , lambda )
% VAUTAZIONE POLINOMIO CARATTERISTICO TRIDIAGONALI
% Calcola le immagini del polinomio caratteristico della matrice A nei
% punto lambda, p(lambda)=det(A-lambda*Id).
%------------------INPUT
% A : matrice tridiagonale
% lambda: punto qualsiasi in cui valutare il... |
clear
clc
back_ground = imread('open2/1.JPG');
back_ground_gray = rgb2gray(back_ground);
current_file = imread('open2/2.JPG');
current_file_gray = rgb2gray(current_file);
sub = imsubtract(back_ground_gray, current_file_gray);
[height width] = size(sub);
for i = 1:height
for j = 1:width
if su... |
function [spike_resp_ds, flash_col_ds, flash_pos_ds, flash_zone_ds, target_flash_ds] = downsample_target_flashes(spike_resp, flash_pos, flash_col, flash_zone, green_or_cyan, sample_white)
%%% Use all the flashes not in the target zone to develop a flash histogram
%%% Input is a single neuron for an entire session, p... |
% Script to run through different frequencies to observe effect.
function titrate_focus_position()
% Structured as a function so that we can write helper functions in the
% same file.
% Setup the transducer array.
width = 5e-4;
height = 5e-4;
elements_x = 100;
elements_y = 1;
kerf = 1e... |
function outdata = PolyExp_pipeline1(indatasrc)
outdata = indatasrc*0.332451909263490;
end
|
function density = materialDensity( material )
% Return density of materails at given x-ray energy ( g / cm^2)
% Inputs:
% material - material name, see below for defined material names
% Outputs:
% density - ( g / cm^2)
%
% NIST materials:
% {'Air_Dry_near_sea_level', 'Adipose_Tissue_ICRU-44', 'Wate... |
clear all;
N=250;
theta1 = linspace(-180,180, N)*pi/360;
r = 8
data(1:N,1) = -5 + r*sin(theta1)+randn(1,N);
data(1:N,2) = r*cos(theta1)+randn(1,N);
data(1:N,3) = 1;
data(1:97,4) = 0;
data(N+1:2*N,1) = 5 + r*sin(theta1)+randn(1,N);
data(N+1:2*N,2) = -r*cos(theta1)+randn(1,N);
data(N+1:2*N,3) = 0;
data(N+1:2*N,4) = ... |
%% Computes a histogram
% This function takes magnitudes and angles then places them into a
% histogram with 'numberOfBins' based on their unsigned orientation.
% A gradient's contribution to the histogram is equal to its magnitude;
% the magnitude is divided between the two nearest bin centers.
% Normalizi... |
close all;
clc;
clear;
original = imread('tag.png ');
imshow(original);
figure();
distorted = imread('frame_544.jpg'); % approx 0.14s/frame
% distorted = imread('frame_720.jpg'); % approx 0.24s/frame
subplot(2,2,1);
imshow(distorted)
subplot(2,2,2)
imshow(distorted(:,:,1))
subplot(2,2,3)
imshow(dis... |
%The function used to simulate the channel
function sn_delay = channelMod(channel_delay, SNR, phase_error, impulseresponse)
load OFDMspace.mat;
timpulse=[];
impresp=[];
s_conv=[];
t_conv=[];
delay_samples = round(channel_delay/T);
ttotal= 0:T:(Tu*(M+1)+M*T+T*delay_samples+(M)*guard); %Total time including delay
%CHANNE... |
function bmat = genb( N, n, ell, sb )
%GENB Generates B matrix
bmat = zeros((2*n)^2,(2*ell*n)^2);
for px=1:2*ell*n
for py=1:2*ell*n
if px<(ell-1)*n+1 || px>(ell+1)*n || py<(ell-1)*n+1 || py>(ell+1)*n
for lamx=1:2*n
for lamy=1:2*n
bmat(lamx+2*n*(lamy-... |
clc;
clear y Fs;
format long;
%% Carregamento Arquivo
%https://www.mathworks.com/help/matlab/ref/load.html
f = load('data.mat');
%A primeira coluna é o tamanho da casa, a segunda coluna é o número de quartos, e a terceira coluna é o preço da casa.
%% Colocado os dados em matrizes
%https://www.mathworks.com/help/matla... |
cd ~/Science/wallis/LFP_regression
load('encoders', 'pos_encoders', 'neg_encoders')
frequencies = 2.^(0:0.5:8);
% The frequency values saved in encoders are only to four decimal
% places (not rounded, but the first four in the actual numbers).
% In order to compare them to the actual frequencies, we need to
% round to ... |
function [CR,PSNR,origsize,newsize] = cube_transcode(name,cube,ext,varargin)
%CUBE_TRANSCODE statistics
% CUBE_TRANSCODE performs buildt-in MATLAB transcoding of cubes to
% perform pseudo-analysis on the compression ratio as well as calculate
% its total PSNR.
%
% [CR,PSNR] = CUBE_TRANSCODE('name',cube,'ext') c... |
% ########################################################################
% Fahrzeugregelung II, M.Sc. Jochen Gallep
% Übung 1
% Fourier Analyse einer Sägezahnfunktion mit Periode 2pi und Amplitude 2pi
% #######################################################################
x=[0:0.01:6*pi];
y=pi*sawtooth(x)+p... |
function success = uq_Reliability_test_APCKMCS_RS(level)
% SUCCESS = UQ_RELIABILITY_TEST_APCKMCS_RS(LEVEL):
% Comparing the results of APCKMCS to the analytical failure
% probabilities. And checking for some other properties of APCK-MCS.
%
% See also: UQ_SELFTEST_UQ_RELIABILITY
%% Start test:
uqlab('-nosplas... |
function [p] = proba(input, ref, sigmaSquare_Epsilon,i,mask)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
if i==0
% input
% ref
% abs((input-(2*ref-1))).^2
p=(-1/2*log(2*pi*sigmaSquare_Epsilon)-(abs((input-(2*ref-1))).^2)/(2*sigmaSquare_Epsilon)); %.*(mask; %ref =0 if... |
function p = plotTrajMC(trajData, labels, dim, labelsFontSz)
if ~exist('labelsFontSz','var')
labelsFontSz = 14;
end
map=colormap('jet');
labels1=labels+1;
labelsR=round(size(map,1)*(labels1)/(max(labels1)));
for k = 1:length(labels)
if dim==2
p(k) = plot(squeeze(trajData(1,:,k)), squeeze(trajData(2,:,k)),... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.