text stringlengths 8 6.12M |
|---|
function [data, bodyparts] = DLC_RawRead(filename)
% filename = csv filepath from DLC analysis e.g.
% 'E:\MK001_MK002_VideosCombinedforAnalysis\DLC\1021_G_Sanderson_1DLC_resnet50_MK001_SandersonNov1shuffle1_1030000.csv'
% Reads csv data file, throws away header
% first column is frame number (starting at 0), then sets ... |
% This script calculates the average membrane potential during baseline,
% stimulation, and the recovery section of the constant light stimulation
% experiments. The output variable prism_norm_noChR, prism_norm_ChR,
% and prism_norm_inxkd were exported to prism to generate box plots.
%
% Parameters to change:
% ... |
%==============================
%读取并分析一个来自标准数据文件的RF数据
%==============================
data=read(rfdata.data,'passive.s2p');
freq=data.Freq;
s_params=extract(data,'S_PARAMETERS',75);
y_params=extract(data,'Y_PARAMETERS');
s11=s_params(1,1,:);
smithplot(s11(:));
f=freq(end);
s=s_params(:,:,end)
y=y_param... |
% process terrain data to csv file
[c1, c2] = size(terrain);
% tmp = zeros(c1, 3*c2);
c1_ = floor(c1/20);
c2_ = floor(c2/20);
x = linspace(0, 10, c1_);
y = linspace(0, 10, c2_);
[X, Y] = meshgrid(x, y);
xold = linspace(0, 10, c1);
yold = linspace(0, 10, c2);
B = interp2(xold, yold, terrain, X, Y);
fd = f... |
function [XR] = dropSamples(varargin)
% Output XR is a logical mask of samples to be dropped to create a
% subsampled replicate.
% inputs: 1) probability of dropping samples
% 2) pointer to mat-file TempMat.mat
%
probRemove = varargin{1};
infile = varargin{2};
% Import X from matfile
X = infile.X;
% Get size of X;
[LX... |
% VC_Outbreak - Runs Outbreak for Cholera
% Called by: VC_Shell
% Calls: VC_Eqns, Plot_VC, Save_Run
% V02 - 01/10/2014 VC
% ©MathEcology, LLC 2014 - Colleen R. Burgess
%
function [t,y] = model_CholeraDual(maxtime,stepsize)
global prop_a eta theta_s theta_a delt kapp imm immprop epsi
global gamm beta lam wane ve_s ... |
%%data imported as column vectors
%the data should be in following default Imaris exported excel format
%Position X Position Y Position Z Unit Category Collection Time TrackID ID
%Position X_Bead Position Y_Bead Position Z_Bead Unit_Bead Category_Bead Collection_Bead Time_Bead TrackID ID_Bead
%% drift compensati... |
function Root=mysolver(y,Interval,N)
if nargin<3 % number of input arguments
N=100;
end
L=Interval(1);
R=Interval(2);
% check if the solution exists
if y(L)*y(R)>0
error('bad choice!!!')
end
% define the solver
for n=1:N % set iteration
xm = 1/2*(L+R);
if y(L)*y(xm)<0
R=xm; % root in [L xm]
else
L=xm; % r... |
#!/usr/bin/octave -qf
arg_list = argv ();
K_a = str2num(arg_list{1});
L_a = str2num(arg_list{2});
K_b = str2num(arg_list{3});
M_b = str2num(arg_list{4});
L_b = str2num(arg_list{5});
suffix = arg_list{6};
M = K_a*L_a+K_b*M_b*L_b;
M_bar = K_a+K_b*M_b;
in = randn(M+M_bar, 1)+1i*randn(M+M_bar, 1);
g_vec_i1 = zeros(K_a*L_... |
classdef systempriorsOptional < irisinp.systempriors
methods
function this = systempriorsOptional(varargin)
this = this@irisinp.systempriors(varargin{:});
this.ReportName = 'System Priors';
this.Omitted = [ ];
this.ValidFn = @(x) isempty(x) || isa(x,'systempri... |
function uav = uav_uniform_search_path(model)
% clearvars;
% gen_model();
nuav = model.nuav;
T = model.T;
mdp_cycle = model.mdp_cycle;
dt = model.dt;
vu = model.vu;
theta_max = model.theta_max;
T1 = 90; T2 = 10; T3 = 3;
Theta1 = pi/2;
Theta2 = 0;
uav0 = [0;0;20;0];
uav = zeros(nuav,... |
function waitforexit( jobname, tag )
doexit = 0;
disp('Waiting...');
xmlfilename = [tag, '.xml'];
while ( doexit == 0 )
system(['qstat -x ', jobname, ' > ', xmlfilename]);
output = xml2struct( xmlfilename );
for ii=1:length(output.Children.Children)
if( strcmp( output.Children.Children(ii).Na... |
% looks like a comparison between a few different algorithms for l1
% separation a CVX method and a non-cvx method. But this is mostly
% a method for comparing over randomly generated data.
clear all
N = 50;
ne = 150;
A = randn(N);
[Q R] = qr(A);
for g = 1:150
k = ceil(rand*8);
p = randperm(N);
x = zeros(... |
clc
clear
close
%%
load NewsvendorData_Label;
x = XtrainB;
y = Dtrain;
%%
beta = pinv(x*x')*(x*y');
%%
predicted_val = beta' * XtestB;
error = (predicted_val - Dtest).^2;
disp(mean(error)) |
function [varargout] = pcz_deal(var)
%%
%
% file: pcz_deal.m
% author: Polcz Péter <ppolcz@gmail.com>
%
% Created on 2017.02.02. Thursday, 12:16:16
%
assert(nargout <= numel(var), 'nargout [%d] > numel(var) [%d]', nargout, numel(var))
for i = 1:nargout
varargout{i} = var(i);
end
end |
function same = SameStructure_order(ID1, ID2, POP)
% To check if two structures are identical
% all the structure are loaded from POP
global ORG_STRUC
numIons1 = POP.POPULATION(ID1).numIons;
numIons2 = POP.POPULATION(ID2).numIons;
if sameComposition(numIons1, numIons2)
toleranceO = 0.075;
toleranceE = 0.015;... |
function [drops,Manualdrops,Manualadd]=dropbadtrials(data,graphics,lowrt,hirt,stdcutoff,dropblinkbaseline,manualbadfilename,blinkpercentfordrop,dodetrend,dropincorrect);
% drops trials that are outside specified ranges or manually specified
% usage: drops=pspandropbadtrials(data,graphics);
if nargin<2, graphics=1;... |
%% Linearize equation
clc
clear all
%Estimates from last time
%V_min = 3.3, CL_min = 0.67
V_min = 3.3; CL_min=0.67;
syms Dose V_lin CL_lin t V_hat CL_hat alpha_hat beta_hat alpha beta;
C_p = beta_hat*exp(-alpha_hat*t);
beta = Dose/V_lin;
alpha = CL_lin/V_lin;
pd_wrtbeta = diff(C_p, beta_hat); %partial derivat... |
function [fltnames, nameidx] = name_filter(rawnames, subj_filt, varargin)
%NAME_FILTER returns those elements from rawnames that match by:
% names: being equal to (or uniquely containing) one given string, or
% indices: logical vector indexing the files to keep, or
% subject numbers: having a filename... |
%%
function [Ic,C,Jx,Gxa,xi,zi,cutting,Gza,psi]=get_winding_pattern(Gfp,Gcd,Fov)
%% Edited by Sairam Geethanath
% Improved readability of the code by variable name change, structuring
% according to each operation for the two axes
% Converted to a function useful to incorporate into an optimization
% framework... |
renderSize = 256;
range = 10.245704621680851;
randc = @(varargin) (rand(varargin{:})-0.5)*2;
%% Setup Scene
fig = figure(...
'DockControls','off',...
'MenuBar','none',...
'ToolBar','none',...
'Position',[20,20,renderSize,renderSize]);
lookAt = [0.439595202235296,0.418548224382941,0.214556237970882]; % reference
a... |
function [distances] = minDist(lat,lon)
% This function finds the distance between 2 points on a map given a
% longitude and latitude
LON = -120.671667*(pi/180);
LAT = 34.468333*(pi/180);
R = 6371; %Km
distances = zeros(1,length(lat));
for i = 1:length(lat)
conValLat = lat(i)*(pi/180... |
% mesh size
N = 16;
h = 1 / N;
k = 1;
% true solution and RHS
u = @(x) sin(2*k*pi*x).*cos(2*k*pi*x);
f = @(x) 16*k^2*pi^2*sin(2*pi*k*x).*cos(2*pi*k*x);
% hat function basis
phi = {};
for i = 1 : N+1
phi{i} = @(x) 1-abs(x-(i-1)*h)/h;
end
% FEM matrix
A = spdiags([-ones(N,1),2*ones(N,1),-ones(N,1)], -1:1, N, N);
A... |
clc; clear; close all;
%EX2
%a)
n1 = -20;
n2 = 20;
n0 = 0;
[x,n] = stepseq(n0,n1,n2)
figure
stem(n,x)
%b)
n0 = |
function [p, L] = linear_regression (x, y)
% Compute linear regression of x against y.
%
% INPUT:
% x: abscissa values [column vector]
% y: ordinate values [column vector]
%
% OUTPUT:
% p: regression line coefficient ( y = p(1) * x + p(2) )
% L: minumum sum of squares
n = length(x);
% Define ... |
function v = kde2d(data, numbins)
# v = kde2d(data, numbins)
# Implements kernel density estimation
# Generating the density (using an Gaussian multivariate kernel.)
# Setting the parameters.
# here data is a mx2 matrix, and numbins is a resolution factor
# numbins can be set to 100
numData = length(data(:,1)... |
function y= lorenz(x)
n=length(x);z=0;
for i=1:n
z=z+x(i);
y(i)=z;
end |
% DBAUX Daubechies ウェーブレットフィルタの計算
%
% W = DBAUX(N,SUMW) は、SUM(W) = SUMW を満たす次数 N の
% Daubechies スケーリングフィルタです。
% N の取り得る値は、N = 1、2、3、..です。
%
% 注意:
% N をあまり大きくすると不安定になります。
%
% W = DBAUX(N) は、W = DBAUX(N,1) と等価です。
% W = DBAUX(N,0) は、W = DBAUX(N,1) と等価です。
%
% 参考 DBWAVF, WFILTERS.
% M. Misiti, Y. Misiti, G. Oppenh... |
% This test gets the stall time contour plots for either a particular
% application or random inputs.
% You can set different distribution parameters (for e.g. you can change
% the sigma) or you can change the processor frequency and put multiple
% plots on the same figure. Then, for a prticular set of parameters, y... |
function z = cellMultiply(x, y)
%
% function z = cellMultiply(x, y)
%
% Multiplication of cell matrix (block matrix)
%
% Input --
% x: cell matrix, MxT
% y: cell matrix, TxN
%
% Output --
% z: matrix, MxN
%
% Example --
% >> z = cellMultiply(x, y)
%% Parameters check
if size(x,2) ~= size(y,1)
error('Error! The #co... |
N = input("N=");
x = zeros(1,N);
x(1) = input("x1=");
x(2) = input("x2=");
for i=3:N*N
x(i) = x(i-1)+x(i-2);
end
mat=reshape(x,[N,N]);
mat=mat';
FILE = fopen("A.txt","w");
for i=1:N
for j=1:N
fprintf(FILE,"%i ",mat(i,j));
end
fprintf(FILE," \n");
end |
function [Qsim, param, varargout] = HydroMod10( P, E, param )
%
% [Qsim, param, varargout] = HydroMod10( P, E, param )
%
% MOHYSE hydrological model (modified version)
%
% INPUTS (time series of daily observations [n,1])
% P = mean areal rainfall (mm)
% E = mean areal evapotranspiration (mm)
% Q ... |
function [u,v,E] = TV_osmosis_wrapper(foreground,background,alpha,params)
% initialisation of u0,v0
switch params.flag_initialisation
case 0
u = foreground;
case 1
u = alpha.*foreground + (1-alpha).*background;
case 2
mf = alpha.*foreground; mf = sum(sum(mf))./sum(sum(alpha));
... |
% ADVISOR data file: VEH_PNGV.m
%
% Data source: CD and A came from published PNGV documents, remainder are estimates.
%
% Data confirmation: these are estimates only, no confirmation with hardware has been performed
%
% Notes: This file defines the road load parameters for a hypothetical PNGV vehicle
% *chassis... |
function [ predictedLabels, testLabels ] = predictTestData(predictor)
imgDir = char(strcat(pwd, {'\REAL\*.png'}));
%imgDir = char(strcat(pwd, {'\REAL\*.jpg'}));
infoDir = char(strcat(pwd, {'\REAL\*.txt'}));
imgFiles = dir(imgDir);
infoFiles = dir(infoDir);
[numberOfImages, ~] = size(imgFiles)... |
clear all; close all;
Zero_padding = 1; %to enable zeo padding
FFT_plot = 0; %to display the fft plot
STFT_plot = 0; %to display the stft plot
CVD_plot = 1; %to display the cvd plot
Example1 = 1;
j = sqrt(-1); %imaginary 'j'
nChirps = 256;
frequency_list_1 = [800, 750, 700, 650, 600, 550, 500... |
clear; clc; close all;
x = [10e-6;10e-6];
x = [1.7;1.7];
track = x;
k = 1;
alpha = [0; 1];
Bi = eye(2);
k = 1;
while norm(fi_(x(:,k)) ) > 10e-9 && k ~=5
alpha(k+2) = ls(x(:,k),track,alpha(k+1), alpha(k),Bi);
% alpha(k+2) = 1.0;
track = x(:,k);
B = hessian(x(:,k));
Bi = inv(B);
p = -... |
function outstr = to_camel_case(instr)
%TO_CAMEL_CASE
%
% Convert input string to CamelCase
outstr = regexprep(instr, '(?:_|\<)(\w)', '${upper($1)}'); |
function ans = diagSum(A)
sum(A(logical(eye(length(A)))));
end |
%%%magnitude
magc = cell(1,2);
feqc = cell(1,2);
for idx = 1:length(hmaplist)
hmap = hmaplist(idx);
feq = mArray(hmap.keySet);
mag = zeros(1,length(feq));
for jdx = 1:length(feq)
mag(jdx) = sum(hmap.get(feq(jdx)));
end
magc{idx} = mag;
feqc{idx} = feq;
end
1 |
%
% Licensed under the Creative Commons Attribution-NonCommercial 3.0
% License (the "License"). You may obtain a copy of the License at
% https://creativecommons.org/licenses/by-nc/3.0/.
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "... |
function [ status, message ] = data_add( obj, name, data, selected )
%ADD_DATA add new data from rawdata slices/other fluorescent data/values
% if selected=[] and data is of fimdata_handle class, data will be appended
% if selected is a mx2 array, slices will be added as new data
% if data=[], a new placeholder o... |
% createSimData.m
%
% Puts together a matrix of simulated qBOLD ASE data using phase data generated
% by the simple vessel simulator. Based on figure_sharan.m (created NP Blockley
% 30 July 2018).
%
% Separated into this file, and assembleSimData.m
clear;
t0 = tic; % main timer
%% Initialization
% Where the data is... |
function [c,gradc]=slack_cons(x,p)
c_toe = zeros(size(x,2),1);
gradc_toe = zeros(size(x,1),size(x,2),size(x,2));
c_heel = zeros(size(x,2),1);
gradc_heel = zeros(size(x,1),size(x,2),size(x,2));
for i=1:size(x,2)
c_toe(i,1)=s_toe_con(x(1:p.numJ,i).',x(3*p.numJ+5,i),p.toe_th);
gradc_toe(:,i,i)=ds_toe_con(x(1:p.... |
function [] = RRIRAMPEDR(file_path)
%UNTITLED2 此处显示有关此函数的摘要
% 此处显示详细说明
% outputArg1 = file_path;
% outputArg2 = write_file_path;
read_path = strcat(file_path, '\denoised_ecg_data.mat');
ecg_data = load(read_path);
ecg_data_1 = ecg_data.denoised_ecg_data;
Analysis = RunBioSigKit(ecg_data_1, 100, 0); % Uses ... |
function [B,t] = otsuthresh(I,block)
% function t = otsuthresh(I,blocksize)
% Calculates optimal threshold for an image (potentially separated into
% distinct blocks with size blocksize) according to the procedure from
% Otsu, N. (1978). Discriminant and least squares threshold selection.
% In Proceedings of the Fourt... |
function [load_onu] = build_traffic(nodes, branch)
total_nodes = nodes;
last_branch = branch;
mean_req = 180;
bit_rate_req = 1.5e6;
for i = total_nodes:-1:last_branch
load_onu(i) = bit_rate_req*poissrnd(mean_req);
end
end |
%
% Usage: Y =mexNormalize(X);
%
% Name: mexNormalize
%
% Description: rescale the columns of X so that they have
% unit l2-norm.
%
% Inputs: X: double m x n matrix
%
% Output: Y: double m x n matrix
%
% Author: Julien Mairal, 2010
|
function frn = modefreq(L,n,youngs,density)
% modefreq calculates the resonant frequency for a given mode
% L = Length of cable (meter)
% n = Mode
% T = Tension (Newton)
% rhoL = Mass per unit length (kg/meter)
% c = sqrt(T/rhoL); %Sound Speed (meter/sec)
c = sqrt (youngs / density);
[frn] = ((2.*n-1)./4).*... |
function [probability_obj_set,pairs,method] = ...
appGGBS_PLUS(s,d,Xf,dX,dXID,c,inq,const,alg,queryID,pairs,w,target,nq)
nx = size(Xf,1);
DX = dXID + dXID';
probability_obj_set = [];
nquery = sum(sum(queryID>0));
queryList = ones(nquery,1);
method = zeros(10001,1);
% find t... |
%--------------------------------------
% Chris Dalke
% CSC 249 - Project 01
%--------------------------------------
% High Pass Filter: Performs custom
% High Pass filter on an image, and
% saves the result to a file.
%--------------------------------------
function resultImage = HighPassFilter(inputImage)
[widt... |
function[exp_coverage] = ...
delta_soc_4(G, start_node, full_soc, immunize_dic, install_dic, ...
niter, max_time)
%{
Same as delta_soc with different definition on immunzation
In this model, a node that is immuzited can still spread information
however, it cannot be infected with a virus that resets it's
time... |
load signals.dat;
kep=2/5;
ktrans=0.6/5;
ct_trapz1=zeros(size(Cp));
ct_trapz2=zeros(size(Cp));
t=[0:length(t)-1]';
for i=2:length(t)
tf=t(i);
tau=t(1:i);
exponential=exp(-kep*(tf-tau));
ct_trapz1(i)=trapz(tau,Cp(1:i).*exponential);
exponential=exp(-kep*tau);
ct_trapz2(i)=trapz(tau,Cp(i:-1:1).*exponential);
end
... |
function [Hough, theta_range, rho_range] = myHoughTransform(Img, N)
% MYHOUGHTRANSFORM takes an image as input and detects N longest lines using
% Hough Transform
%
% Input
% I - Image
% N - No. of lines to be drawn
%
% Output
% Hough - Hough Transform of an Image
%% Function starts here
% Convert... |
function process_amps_hist_plot(filename_h,num_plot_per_fig)
f_mat = dir([filename_h '*.mat']);
f_num = length(f_mat);
Rem = mod(f_num,num_plot_per_fig);
fig_num = (f_num-Rem)/num_plot_per_fig;
if Rem ~= 0
fig_num = fig_num+1;
end
for i = 1:fig_num
Amp_plot = struct();
for j =1:num_plot_per_fig
clea... |
im=imread('a.jpeg');
% original picture
subplot(3,2,1);
imshow(im);
title('original image');
%Qa
subplot(3,2,2);
result=Q2a(im);
imshow(result);
title('negative image');
%Qb
subplot(3,2,3);
result=Q2b(im);
imshow(result);
title('mirror image');
%Qc
subplot(3,2,4);
result=Q2c(im);
imshow(result);
title('swap red & g... |
%Make Pipeline object to manage streaming
pipe = realsense.pipeline();
%Make Colorizer object to prettify depth output
colorizer = realsense.colorizer();
%Start streaming on an arbitrary camera with default settings
profile = pipe.start()
%Set the timeframe for streaming in seconds
%Wait for the fram... |
clearvars
raray = load('raray.txt');
datos_x=raray(:,1:2);
datos_y=raray(:,3);
Clase_1=datos_x(datos_y==1,:);
Clase_2=datos_x(datos_y==2,:);
Clase_3=datos_x(datos_y==3,:);
Clase_4=datos_x(datos_y==4,:);
Promedio_C1=mean(Clase_1);
Promedio_C2=mean(Clase_2);
Promedio_C3=mean(Clase_3);
Promedio_C4=mean(Clase_4);
TAMA... |
%CALCOPTICALFLOWDF DeepFlow optical flow algorithm implementation
%
% flow = cv.calcOpticalFlowDF(I0, I1)
%
% ## Input
% * __I0__ First 8-bit single-channel grayscale input image.
% * __I1__ Second input image of the same size and type as `I0`.
%
% ## Output
% * __flow__ computed flow image that has the same size a... |
function [sr,sc] = separate(s,fs)
% Midpoint of row and column freqs = 1075
wc = 2*1075/fs;
wc2 = 2*400/fs;
N = 303;
n = -(N-1)/2:(N-1)/2;
d = n == 0;
lp = hammingfilt(N,wc);
lp2 = hammingfilt(N,wc2);
bp = lp-lp2;
hp = d - lp;
sr=conv(s,bp);
sc=conv(s,hp);... |
% Ex3
% d)
N = 40;
P = 10000;
alfa = 0.1;
lambda = 1800;
C = 10;
f = [2500,5000,7500,10000,12500,15000,17500,20000];
b = 0;
PL = zeros(1,length(f));
termPL = zeros(1,length(f));
APD = zeros(1,length(f));
termAPD = zeros(1,length(f));
MPD = zeros(1,length(f));
termMPD = zeros(1,length(f));
TT = zeros(1,length(f));
term... |
function getLogData(obj)
% Read the log file for a particular tiff file and extract date and time of
% experiment.
% Log filenames are slightly different to the tiff files they're associated
% with. Fix the filename first:
% Find "T0" followed by additional "0"s in Tif filename
logexpr = 'T0*0+_';
logFile = [regexpr... |
function [names, features] = ibexFeatures(I, M, S)
% Get radiomics features matching the cerr application featureset
%
% [names, features] = cerrFeatures(I, M, S)
%
% features is a 1xN cell array of scalars
% names is a 1xN cell array of strings, formatted for table() compatibility
% Arguments are 3D image I an... |
%% -------- Simultation of exponential integrate an fire neuron --------- %
% %
% Author: Quentin AUGEREAU %
% Date: 15/04/2015 %
% ... |
function [A, B] = covLINone(hyp, x, z)
% Linear covariance function with a single hyperparameter. The covariance
% function is parameterized as:
%
% k(x^p,x^q) = (x^p'*x^q + 1)/t2;
%
% where the P matrix is t2 times the unit matrix. The second term plays the
% role of the bias. The hyperparameter is:
%
% hyp = [ log(s... |
function Pbest = UpdatePbest(Pbest,Population)
% Update the local best position of each particle
%--------------------------------------------------------------------------
% 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... |
sum = 0;
max = 0;
dx = 0.01;
for x = -1:dx:1
xx = x*x;
f = ((0.0776509570923569*xx - 0.287434475393028)*xx + 0.995181681698119)*x;
d = abs(atan(x) - f);
if (d > max)
max = d;
end
sum = sum + d*dx;
end
sum
max |
%%%% Developed by : Ibrahim Issah
%%%% Supervisor : Assoc. Prof. Humeyra Caglayan
%%%% Faculty of Engineering and Natural Sciences, Photonics,
%%%% Tampere University
%%%% https://research.tuni.fi/metaplasmonics/
%%%%%%%%%%%%%%%%%%%%%%% INITIALIZE %%%%%%%%%%%%%%%%%%%%%%%%%
close all;
clc;
clear;
%%%... |
function a = idct2(arg1,mrows,ncols)
%IDCT2 Compute 2-D inverse discrete cosine transform.
% B = IDCT2(A) returns the two-dimensional inverse discrete
% cosine transform of A.
%
% B = IDCT2(A,[M N]) or B = IDCT2(A,M,N) pads A with zeros (or
% truncates A) to create a matrix of size M-by-N before
% tran... |
function [dn] = lin_threshold(d,screen_width)
%LIN_THRESHOLD Summary of this function goes here
% Detailed explanation goes here
H = screen_width*3/4;
dn = (d > (H/2)) + (-1)*((d < (-H/2))) + (d*2/H).*((d < (H/2))&(d > (-H/2)));
end
|
function q = cubic_integrate ( a, b )
%*****************************************************************************80
%
%% CUBIC_INTEGRATE integrates the cubic from A to B.
%
% Licensing:
%
% This code is distributed under the GNU LGPL license.
%
% Modified:
%
% 11 February 2011
%
% Author:
%
% John Burka... |
% Generates Vehicle Points in KML Format
% Version-1.0
% Copyrights 2016-Changan US R&D Center Inc.
%This Function Generates KML Files with Locations
KMLName = 'VehiclePoints11';
disp('Vehicle:-BLUE: ffff0000 , lane :- RED: ff0000ff \n')
Code = 'ff0000ff';
fID = fopen(strcat(KMLName,'.txt'),'wt'); % Open file ... |
% Este programa retorna a resposta do exercício 6 da lista 2.
disp('6) No sistema de transmissão por quatro polias representadas abaixo, o eixo motor desenvolve n1 = 2000 rpm. Os diâmetros das polias medem: D1 = 100 mm, D2 = 200 mm, D3 = 70 mm e D4 = 300 mm. Determine a rotação final n4 do sistema.')
D1=100 % Diâmetr... |
% Canny边缘检测的函数
% Input:
% a: input image
% sigma: Gaussian的均方差
function e=canny_edge(a,sigma)
a = double(a); % 将图像像素数据转换为double类型
[m,n] = size(a)
e = repmat(logical(uint8(0)),m,n); % 生成初始矩阵
GaussianDieOff = .0001;
PercentOfPixelsNotEdges = .7; % Used for selecting thresholds
ThresholdRatio = .4; % L... |
function add_path(root_dir)
app_path=sprintf('%s\\src\\app',root_dir);
bin_path=sprintf('%s\\bin',root_dir);
gui_path=sprintf('%s\\src\\gui',root_dir);
neighbor_est_path=sprintf('%s\\src\\neighbor_est',root_dir);
parent_selection_path=sprintf('%s\\src\\parent_selection',root_dir);
model_path=sprintf('%s\\src\\m... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ROSflight Estimator Comparison
%
%
% Parker Lusk
% 21 May 2019
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all; clc;
set(0,'DefaultLineLineWidth',1); % 0.5
exfig = 0;
% ----------------------------------... |
function [outputArg1] = tjekKlodser()
global kloddser;
%disp('Shiiet, vi tjekker klodser')
[x, y] = size(kloddser);
L = {};
for i = 1:x
for o = 1:y
if (norm(kloddser(i,o).fhor) > kloddser(i,o).frik)
kloddser(i,o).isUnstable = true;
flytKlods(i, o)
%Putter det ind i L
... |
result=[];
for Ttag=0.5:0.02:4
kineticsDE
hold off
drawnow
result=[result [ma; mt ; m] ];
end
T=[0.5:0.02:4]
plot(T,result')
|
%使用模糊集合进行灰度变换
%定义规则为暗的更暗,灰的不变,亮的更亮
%输入灰度z0
%利用对暗、灰、亮灰度的隶属度决定最终输出的灰度v0
%v0=(Mdark(z0)*Vd+Mgray(z0)*Vg+Mbright(z0)*Vb)/(Mdark(z0)+Mgray(z0)+Mbright(z0))
clc;
clear;
close all;
[filename,filepath]=uigetfile({'*.jpg';'*.png';'*.bmp'},'Iput an Image');
str=[filepath filename];
Img=imread(str);
Img=rgb2gray(Img);
Img=double(... |
clear
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% The folder that contains your subject folders
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Exp = '/nfs/turbo/berent-lab/metabolic/Endopoid/Data';
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
#SHADER 101 1000
#PARAM_TEX shaderTexture 101 2017 |
function [J,lambdaOpt,Yhat,T] = ridgeGCV(Y,K,L,nlambda,plotGCV)
%[J,lambdaOpt] = ridgeGCV(Y,K,L,nlambda,plotGCV)
%
% Estimates a ridge regression model, also know as Tikhonov regularization,
% or minimum norm with L2 prior (or Loreta in the EEG inverse solution literature).
% For an implementation of sLORETA model se... |
%% Create colorized "raster" plot sorted by activity onset
function rasterish = ColorRaster(triggeredTraces,windowSize,fRate,figTitle)
for k = 1:size(triggeredTraces,1)
trace = triggeredTraces(k,:);
try
dActivity = trace(2:end) - trace(1:end-1);
rises = dActivity > 0.2;
riseInd = find(... |
function LastName = findLastName( Name2, Name3, Name4 )
% Find the last name of these names.
%
LastName = Name2;
for n = 1: length(1)
LN3 = find(~cellfun(@isempty,Name3));
for i = LN3
LastName(i,1) = Name3(i,1);
end
LN4 = find(~cellfun(@isempty,Name4));
... |
function [grampc,Tsim,grampc_sdata] = initData()
% This function initializes a grampc struct in MATLAB and sets parameters
% and options. In case of three output arguments the struct grampc_sdata for
% the use in Simulink is created as well. Define all options and parameters
% for the use of GRAMPC in MATLAB here.
%
%... |
%%
% File:
% L2TV_region_loc.m
%
% Author:
% Jingja Xu
%
% Description:
% TV method to find the excitation location
%%
clear all
close all
clc
%% Data loading
%%load data (include transfer matrix H, heart cor, input BSP and guide pacing location-carto map)
path='/home/wth4280/Research/data/Hackathon/Simula... |
function desiCrop(~,~,fig)
%desiCrop - get the user to specify the region that they want to keep. All
%other parts will be removed permanently.
% Define which method to use: either rect (@getrect) or gin (@ginput)
method = 'rect';
% Guidata gather
dpn = guidata(fig.fig);
if isempty(dpn)
return;
end
% Ensure al... |
%---- this code pre-processes all the pictures in myFolder and saves them
%to myNewFolder ----
%---- this code also crops out the scale bar and garbage out of the images
%specifying the folder where the files live
myFolder = 'C:\Users\nbtar\Documents\MSE 490\B89-(67.4dpa)-the-other-half';
%specifying the folder ... |
clc; clear all, close all
%% Projekt č. 10 – část LÍCOVÁNÍ
% Skript vytvořen čistě pro ilustraci:
% Možnost použití celých neořezaných očí při větším zvoleném prahu
% Či předzpracovaného obrazu (viz skript Projekt_10.m) s menším
% nastavitelným prahem
% Načtení obrazu:
I1 = rgb2gray(imread('01_L.bmp')... |
% For example
% [upStateTimes, downStateTimes] = detect_SW_negative_withStage_segments_dealWithSAW_scalp_new('REC1M_EEG_BP.mat', 1000, 2000, 'stagingRevised.mat', 5);
function [allWaves, slowWaves] = SWsDetectionAlgorithm_fieldtrip(data, hdr, SleepScoring_vector, paramDetection)
% (EEG_filename, original_fs, desired... |
%speed[] array is a two item arrage representing the speed of the left and
%right motor, the matrix[] array holds the values in the weighted matrix,
%and the sensor_values[] array holds the sensor values. The 512 normalizes
%the sensor values and the values i and j are values from a nested for loop
%that is used to ite... |
% Molar mass of the mixture[kg/kmol]
exGas.mu.av = exGas.y.O2 * exGas.mu.O2 + ...
exGas.y.H2O.b(i) * exGas.mu.H2O + ...
exGas.y.SO2 * exGas.mu.SO2 + ...
exGas.y.CO2 * exGas.mu.CO2 + ...
exGas.y.N2 * exGas.mu.N2 + ...
... |
function sOut = AMPReconstruction2(y,A,Aind,numOfVecs)
%another version of AMP algorithm
numOfChunks = size(A{end},2);
sOut = zeros(numOfChunks,numOfVecs);
%set tolerance
tol = 0.00001;
% Number of iterations
T = 1000;
for iVec = 1 : numOfVecs
yVec = y{iVec};
Atmp = A{Aind(iVec)};
xamp = r... |
function plotData(X, y)
%PLOTDATA Plots the data points X and y into a new figure
% PLOTDATA(x,y) plots the data points with + for the positive examples
% and o for the negative examples. X is assumed to be a Mx2 matrix.
% Create New Figure
figure; hold on;
% ====================== YOUR CODE HERE ===============... |
function Hip_Joint_Bearing_Calcs(fThrust, fRadial, angularVelocity, chosenC)
% so in this case, it's very much the same calculations as the hip shaft,
% but the radial force may not be calculated yet. If it is known where the
% force is located on the pin shaft, then the radial force on the bearing
% can be deter... |
function a = a_eff(Axn, Ayn, lambda, CB_set_x, CB_set_y, AoD_azi, AoD_ele, AoA_azi, AoA_ele,type)
Gx = length(CB_set_x);
Gy = length(CB_set_y);
G = Gx*Gy;
if(type == 'D')
Nx = round(2*Axn);
Ny = round(2*Ayn);
d = lambda / 2;
elseif(type == 'U')
Nx = round(4*Axn)... |
wave_times = cell(21,1);
wave_times{1} =[0, 0.16, 0.216, 0.362, 0.606];
wave_times{2} = [0.606,0.702,0.778,0.95];
wave_times{3} = [0.95,1.06,1.154,1.282,1.522];
wave_times{4} = [1.522,1.62,1.676,1.926];
wave_times{5} =[1.926,2.066,2.174,2.478];
wave_times{6} =[2.478,2.55,2.62,2.9];
wave_times{7} =[2.9,2.986,3.036,3.33... |
[data1, fs1] = audioread('NE 1002 01.m4a');
%figure;
%plot(data)
max(data)
n = 100;
crop_range = 1:163918784/n;
croped_data1 = data1(crop_range,1);
croped_data2 = data1(crop_range,2);
figure;
plot(croped_data1);
%profile_(croped_data1);
%enhancement_(croped_data1);
en_croped_data1 = croped_data1+ croped_data1.*(cr... |
function q = q2
% q2 is one of the three quaternion operators.
% q2 is usually denoted by j, but this symbol is used in Matlab to represent
% the complex operator (also represented by i).
% Copyright © 2005 Stephen J. Sangwine and Nicolas Le Bihan.
% See the file : Copyright.m for further details.
q = quaternion(0, 1... |
function VAL = logisticapply(x0, b, iterations)
acc = zeros(1,iterations);
acc(1) = x0;
for it = 1:(iterations-1)
acc(it+1) = b * acc(it) * (1-acc(it));
end
VAL = acc;
endfunction
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.