text stringlengths 8 6.12M |
|---|
function out = Process_Slide_4_Reason_for_Flight(DashBoard,end_Time, Decision, Reason, Class, Pending, fontsize)
start_Time = '12/31/2019 00:00';
TimeCreatedSinceDeploy = datenum(DashBoard.TS_Created) - datenum(start_Time);
Departure_UTC_SinceDeploy = datenum(DashBoard.Departure_UTC) - d... |
function SloRegionData = createRegionViewsVisu(ActDataDescriptors, SloRegion, dispCorr, params)
% CREATEREGIONVIEWSVISU: Function dedicated for the use in octsegVisu.
% Loads and creates the SloRegion data for the region views.
SloRegionData.onhCenter = [];
SloRegionData.data = [];
SloRegionData.position = [];
... |
I = imread('Images/image_low_contrast.jpg');
img = rgb2gray(I);
img2 = imadjust(img);
subplot(2,2,1), imshow(img), title('Imagen original');
subplot(2,2,2), imshow(img2), title('Imagen obtenida');
subplot(2,2,3), imhist(img), title('Histograma imagen original');
subplot(2,2,4), imhist(img2), title('Histograma imagen ob... |
% clamps a value (input val) to be between lo and hi
% default values: lo = 0, hi = 1
function cVal = clamp(val, lo, hi)
if ~exist('lo', 'var')
lo = 0;
end
if ~exist('hi', 'var')
hi = 1;
end
if val < lo
cVal = lo;
elseif val > hi
cVal = hi;
else
cVal = val;
end
end |
clear;
[ret, no, tab] = newton(1);
ret;
no;
x=linspace(-1,1,1000);
y=zeros(1,1000);
for i=1:1000
y(i)=fun(x(i));
end
plot(x, y, ret, fun(ret), 'o');
grid on;
grid minor;
title('Rozwiązanie równania nieliniowego metodą Newtona-Raphsona 1-go rzędu');
xlabel('x');
ylabel('f(x)');
hold on;
%%
function f=fun(x)
f = ... |
function [td tt te] = compare_of()
%compare three different optimization functions
% rng(59);
% n_obs = 55; %number of static obstacles
% obs = rand(n_obs,2)*90+5; %obstacle locations
% rng(4); %for partially random obstacle size
% obs_rad = 3 + rand(n_obs,1)*3; %obstacle radius
%------------------------------------... |
function [ index_sample ] = Sample_index( Partition_likehood)
%SAMPLE_INDEX Summary of this function goes here
% Detailed explanation goes here
% Partition_likehood=weight_1st;
index_sample=zeros(1,length(Partition_likehood));
CDF_weights=zeros(1,length(Partition_likehood));
CDF_weights(1)=Partition_likehood(1);
for ... |
function [RES]=TFIDF(M)
S = sum(M,2);
h = size(M,1);
w = size(M,2);
TF = zeros(h,w);
for i = 1:h
TF(i,:)= double(M(i,:))/S(i);
end
IDF = zeros(1,w);
for i = 1:w
IDF(i)=log(double(h)/length(find(M(:,i)~=0)));
end
RES = zeros(h,w);
for i = 1:h
for ... |
function x = Levinson(r,b)
% function y = Levinson(r,b)
% Symmetric positive definite Toeplitz system solver.
% r is nx1 such that T = toeplitz([1;r(1:n-1)]) is positive definite and
% b is nx1.
% x is nx1 and solves Tx = b.
% GVL4: Algorithm 4.7.2
n = length(b);
y = zeros(n,1);
v = zeros(n,1);
z = ze... |
%% Load MNIST data
addpath('mnist');
X_tr = loadMNISTImages('train-images-idx3-ubyte')';
X_te = loadMNISTImages('t10k-images-idx3-ubyte')';
y_tr = loadMNISTLabels('train-labels-idx1-ubyte');
y_te = loadMNISTLabels('t10k-labels-idx1-ubyte');
%% Variables
samples = size(X_tr,2)/4;
coord = 5;
height = 28;
width = 28;
%%... |
% DrawLineAnimated(window, color, fromH, fromV, toH, toV, penwidth, speed);
%
% Draws a line of thickness PENWIDTH pixels from (fromH,fromV) to (toH,toV)
% on the screen in color COLOR.
%
% Unlike PTB-3's regular DrawLine, this draws an ANIMATED line, so that the
% tuser sees the line being drawn.
%
% SPEED is the numb... |
clear;
lb = -4;ub = 4;N = 200;
x = linspace(lb,ub,N);y = x;
[X,Y] = meshgrid(x,y);
D = 2;
%% RBF degenerate Wedge
K = 80; % number of centers wedge
% get centers
i_coord = 2;
offset_i_coord = 0.0;
t = get_centers(K,D,i_coord,offset_i_coord+1,lb-1.1,ub+1.1); % K x D
tt = sum(t.^2,2)';
% get C's weights
C = -1*ones(K,1)/... |
% Filtragem Homomorfica
clear all;
close all;
f = double(imread('cameraman.tif'));
figure(1); imshow(f,[]); pause;
f = log(f+1);
F = fftshift(fft2(f));
[nc,nr] = size(f);
nr2 = nr/2+1; nc2 = nc/2+1; % (tamanho da imagem deve ser par)
[u,v] = meshgrid(1:nr,1:nc);
z = (u-nr2).^2 + (v-nc2).^2;
gamma_h = 1; ... |
function hexagi_behaviour_test_centralVSsurround(Subjects,Bump,ProcPath,StatsPath,FigPath)
% Central vs. surround analysis, incl. barplot
% This function evaluates whether there is a difference in central vs. surround navigation strategy for old vs. young, both runs
% Gets info for surround vs. central for both runs a... |
% Script M-File: MySumFunct.m
% Written By: Christian Gruss
% Creation Date: 9/28/2016
%--------------------------------------------------------------------------------------------------------------------------------
% DISCLAIMER: All content of this file is the intellectual
% property of Christian Gruss. Any reproduct... |
function setupPolygonManager(varargin)
%SETUPPOLYGONMANAGER One-line description here, please.
%
% output = setupPolygonManager(input)
%
% Example
% setupPolygonManager
%
% See also
%
% ------
% Author: David Legland
% e-mail: david.legland@inra.fr
% Created: 2018-03-19, using Matlab 9.3.0.713579 (R2017b)... |
function [MCD] = mcd_function(mT,mC)
% MCD function
% 10/ln10*sprt(2*sigma((target-converted)^2))
% function [MCD] = mcd_function(mT,mC)
% Author: tedwu 2016/6/22
% Last update: 2016/6/22
cTen = 10/log(10);
mDiff = bsxfun(@minus,mT,mC);
mDiff2 = bsxfun(@power,mDiff,2);
mSumDim = sum(mDiff2,1);
mSqrt = sqrt(2*mSumDim);
... |
function heid = update_incident_halfedge(heid, elems, sibhes) %#codegen
% UPDATE_INCIDENT_HALFEDGE Update the incident halfedge of a vertex.
%
% It determines a unique incident halfedge ID of the origin vertex of
% heid. If the vertex is a border vertex, then a border halfedge is
% returned. Otherwise, the... |
clear all
tic
% Open Data
[FileName,PathName] = uigetfile('*.nii','Select the Nifti file');
file=strcat(PathName,FileName)
B=MRIread(file);
D=B.vol;
% Reshape
S1=size(D);
parfor i=1:S1(4)
R(:,i)=reshape(D(:,:,:,i),[1,S1(1)*S1(2)*S1(3)]);
end
% demean
S2=size(R);
parfor i=1:S2(1)
R2(i,:)=R(i,:)-mean(R(i,:));
end
... |
function plot_compact_fingerprint_analysis_probability_normalized_curves(cell_data,modality,save_plot_name)
%%
% Summary:
% 1. MATLAB script to compare compact fingerprints for twin/sibling
% types for a given modality
% 2. Plot probability normalized curves (gamma histogram fitting)
%... |
function C = LRMultiClassCost(X,Y,W)
W = reshape(W, [size(X,2)+1,size(Y,2)]);
tmp = [X ones(size(X,1),1)]*W;
tmp = tmp - repmat(max(tmp,[],2),[1,size(tmp,2)]);
k = sum(Y.*tmp,2) - log(sum(exp(tmp),2));
C = - sum(k);
end |
push 1 pall
push 2
push 3
pall
|
% L2 MUST be a bi-laplacian matrix or this will simply fail
function newfield = bilaplacian_solve(L2,field,omegas)
assert( size(omegas,2) == 1 );
assert( size(field,2) == 1 );
nv = size(L2,1);
%--- Create diagonal weight matrix
P = spdiags(omegas, 0, nv, nv);
% P = speye(nv,nv).*omegas;
%--- Create RHS
b = P*fie... |
function databd = readbd(file,varargin)
%
% databd = readbd(file,varargin)
%
% Read data from bifurcation data file like allinfo.data generated by
% XPPAUT/AUTO. It is often recommended to polish bifurcation data first by
% POLISHBD and then pass these latter to READBD.
%
% Input arguments:
% - file : Stri... |
function [ output_args ] = draw_descrete_event_mu(lambda, mu, step, flag, schedule_value )
%Построим график изменения средних ожиданий от мю
init_lambda = lambda;
X(1) = 0;
Y1(1) = 0;
Y2(1)=30;
for i=2:20
X(i)= X(i-1) + 0.5 ;
[Y1(i),Y2(i)] = average_inaction(lambda, X(i), step,flag, X(i))
end
... |
thetaX = initial_theta'*X'
htheta = sigmoid(thetaX)
htheta-y |
% icdf : inverse cimulative density function
%
% find data value associated to an pk quantile.
%
% CALL : d_obs=icdf(data,pk_obs)
%
%
function d_obs=icdf(alldata,pk_obs,doPlot)
if nargin<3
doPlot=1;
end
if nargin==1
pk_obs=[0.1:.1:.9];
disp('Using pk=0.1,0.2,...,0.9')
end
% SORT DATA
... |
function y=swich_theta_U(x, cd, d)
%turn theta into velocity
delta=(2650-1000)/1000;
ustar=sqrt(x*9.81*delta*d);
y=ustar/sqrt(cd); |
classdef testCloudTableClientCosmos < matlab.unittest.TestCase
% TESTCLOUDTABLECLIENT This is a test stub for a unit testing
% The assertions that you can use in your test cases:
%
% assertTrue
% assertFalse
% assertEqual
% assertFilesEqual
% assertElementsAlmostEqual
... |
x = single(0.8:10**(-4):1.2);
polynom = [1 -8 28 -56 70 -56 28 -8 1];
% Normale Funktion
function y_P_8 = poly_8(x)
y_P_8 = (x-1)**8;
end
% Horner Schema
function y_Horner = Horner_poly_8(x, polynom)
buffer = 1;
for i = 2:length(polynom) % Schleife für das Horner Schema
buffer = buffer * x + polynom(i);
... |
function testMetaLearn(modelOptions, modelOptionsInd, opts, funcs, dims, ...
insts, Ns, designTypes)
%TESTMETALEARN Test models on metalearning data sets.
if ~iscell(Ns), Ns = {Ns}; end
if ~iscell(designTypes), designTypes = {designTypes}; end
assert(isnumeric(funcs), '''funcs'' has to be numeric');
assert(... |
abstraction(2.5,10);
|
function [output] = convert_Spect(type, time)
%formerly "string_bean"
%script to convert spectrometer data
% time = '10/14/2015 16:38:56';
year = time(7:10);
month = time(1:2);
day = time(4:5);
hh = time(12:13);
mm = time(15:16);
ss = time(18:19);
SAB_string = strcat('/u1/lcls/matlab/data/',year,'/',year,'-',month... |
%% co2 boiling point test
clc;clear all; format long; close all;
NC = 1;
ID = 43;
XF = 1;
%load data
file = load( 'C:\Users\Heath\Documents\c4h10_nist_data_raw.txt');
T_exp = file(:,1);
P_exp = file(:,2);
% temperature and pressure
T =371.15; P = 1;
% Get pure component properties
Comp = Component.empty(NC... |
function final = k_means_(d, k, distance)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% author = Daniel Grewal
% contact email - d.grewal187@icloud.com
% k-means algorithm for cluster sizes of 1-5 only
% INPUTS
% d = dataset
% k = number of clusters (1-5)
% distance (optional) = type of distances for pdist2 - s... |
function [] = set_e3631a_50v(v, imax);
%% Instrument Connection
% Find a GPIB object.
obj1 = instrfind('Type', 'gpib', 'BoardIndex', 0, 'PrimaryAddress', 17, 'Tag', '');
% Create the GPIB object if it does not exist
% otherwise use the object that was found.
if isempty(obj1)
obj1 = gpib('NI', 0, 17);
else
fcl... |
function [tempval]=determineshape(howmany,subscripts,centercomma,parens,i,j,whichsub);
declare_globals
tempstr=''; %default
tempval=cell(1); %default
instr=subscripts{whichsub};
%Find which words and numbers are in this subscript
if howmany==1
if isinf(j)
start=parens(1); finish=parens(2);
[outflag,how... |
function [dS]=stress_grad(A,E,L,N,dR,a,m,Pa,Pm,Pl,A0)
S=(m*A./(L.^Pl)).^Pm+a*(A.^Pa).*(1-E);
dS=zeros(1,N);
dS(1,2:N-1)=(S(3:N)-S(1:N-2))/(2*dR);
end |
function rotImgs = rotateAroundCenter(img, anglePsi)
%
%
% see https://www3.mrc-lmb.cam.ac.uk/relion/index.php/Conventions_%26_File_formats#Coordinate_system
% change center of rotation from corner to the center of image
Rin = imref2d(size(img));
Rin.XWorldLimits = Rin.XWorldLimits-mean(Rin.XWorldLimits)... |
classdef BlocksAnalyzer < handle
properties
blocks = RexBlock();
nBlocks = 0;
nTrials = 0;
nCorrect = 0;
nError = 0;
nFixbreak = 0;
nAbort = 0;
nUnknown = 0;
performance = [];
end
methods
function obj = BlocksAnalyzer( blockClass, fileNames, fieldFlags )
if( nargin() <= ... |
%function chEst = estimate_channel()
%if ~exist('rx', 'var')
%load('testsig.mat');
%end
%%
rxSig = rx_i(:,2) + 1i*rx_q(:,2);
goldSig = gold_i + 1i*gold_q;
%rxSig = rxSig + normrnd(0, 10, size(rxSig));
l_rx = size(rxSig,1);
l_gold = size(goldSig,1);
cross_corr = xcorr(rxSig, goldSig);
%%
%plot(abs(flipud(cross_c... |
function [value, row, col] = image_maximum(image)
% function [value, row, col] = image_maximum(image)
value = max(image(:));
[rows cols] = find(image == value);
row = rows(1);
col = cols(1);
|
clear;
clc;
close all;
warning off;
% prepare_paths();
% experimental parameters
%focal length in pixels
fpix = 500;
tlens = [1:8:40];
pix_noise = 0.5;
%number of random trials per iteration
num = 1000;
% is_planar = 1;
ml = model.setup_methods_and_ba();
for k = 1:2
ml(k).fails(1) = 0;
end
all_ca... |
load('splitsUniform.mat')
load('ScoreMatrix.mat')
topR = 100;
% rate = recall(full(splits{1,1}), ScoreMatrix, topR);
precision = precision(full(splits{1,1}), ScoreMatrix, topR);
x = 1:100
% plot(x, rate(1:100), '--')
plot(x, precision(1:100), '--')
xlabel('Number of genes looked at')
ylabel('P(hidden gene amoing genes... |
function [W,H,D,data] = synergies (data,nsyn,nmus,unitv)
% Function to calculate muscle modes or synergies.
% [W,H,D] = synergies (data,nsyn,nmus)
% INPUT: EMG data in rows
% Created; September 19, 2016
% ortegauriol@gmail.com
%****************************************************
% SYNERGY THROUGH NNM... |
fc_tools.utils.cleaning()
[bvp,info]=fc_vfemp1.examples.setBVPStationaryConvectionDiffusion3D01(15,1);
fc_vfemp1.examples.print_info(info)
fprintf('*** Solving %s\n',info.name)
[U,SolveInfo]=bvp.solve('time',true);
fprintf(' -> ndof (number of degrees of freedom) = %d\n',length(U));
fc_vfemp1.examples.print_info(S... |
clc;
fprintf('==============================[ BioHeatTransfer.m ]===============================\n\n');
fprintf('This script calculates the pressure profile of an 80-element array and uses this\n');
fprintf('to calculate the power deposition and the localized temperature rise using the\n');
fprintf('bio-heat transf... |
function s = stumpS(z)
%{
This function evaluates the Stumpff function S(z) according
to Equation 3.52.
z - input argument
s - value of S(z)
User M-functions required: none
%}
% ----------------------------------------------
if z > 0
s = (sqrt(z) - sin(sqrt(z)))/(sqrt(z))^3;
elseif z < 0
s = (sinh(sqrt(-z)) - sqrt(-z))... |
filename1 = 'si_tr.txt'
[name1,path1] = textread(filename1,'%s %s')
filename2 = 'REVERB_WSJCAM0_tr.txt'
[name2,path2] = textread(filename2,'%s %s')
wavlist1 = path1;
wavlist1 = [wavlist1];
wavlist2 = path2;
wavlist2 = [wavlist2];
for i=1:length(wavlist2)
wav_cln = audioread(wavlist1{i});
wav_rev = audioread... |
% nikCell_t = andro_js_t_normalized; nikCell = andro_js; Fs = 20;
% nikCell_t = i4_js_t_normalized; nikCell = i4_js; Fs = 20;
% nikCell_t = i4s_js_t_normalized; nikCell = i4s_js; Fs = 60;
% nikCell_t = i6_js_t_normalized; nikCell = i6_js; Fs = 60;
% nikCell_t = andro_ntv_t_normalized; nikCell = andro_ntv; Fs = 100;
% ... |
%% Read image
I = imread('shapes.jpg');
imshow(I);
%% Rgb space
rmat= I(:,:,1);
gmat= I(:,:,2);
bmat= I(:,:,3);
subplot(2,2,1), imshow(rmat);
title('Red plane');
subplot(2,2,2), imshow(gmat);
title('Green plane');
subplot(2,2,3), imshow(bmat);
title('Blue plane');
subplot(2,2,4), imshow(I);
title('Original image');
... |
classdef SWE3DVerticalVelocityCalculation < SWE3DAbstractTest & ...
SWEBarotropic3d
%SWE3DVERTICALINTEGRAL 此处显示有关此类的摘要
% 此处显示详细说明
properties
end
properties(Constant)
hcrit = 0.001
end
methods
function obj = SWE3DVerticalVelocityCalculation(N, Nz)
... |
function newMutationProbability = CalculateMutationProbability(population, populationSize, populationDiversityLimit, mutationProbabilityScalingFactor, minMutationProbability, maxMutationProbability, mutationProbability)
populationDiversity = 0;
for iPopulation = 1:populationSize - 1
chromosome1 = population(... |
function eigenvecs = pca_fun(X, d)
% Implementation of PCA
% input:
% X - N*D data matrix, each row as a data sample
% d - target dimensionality, d <= D
% output:
% eigenvecs: D*d matrix
%
% usage:
% eigenvecs = pca_fun(X, d);
% projection = X*eigenvecs;
%
% CSCI 576 2014 Fall, Homework 5
a=1/s... |
function [imsizex,imsizey,imsizez,aExtendMinX,aExtendMinY,aExtendMinZ,aExtendMaxX,aExtendMaxY,aExtendMaxZ,psizex,psizey,psizez,aType] = GetImageProperties(iDataSet)
%
% Commonly used properties of the image in use are extracted.
%
% SYNOPSIS
%
% [imsizex,imsizey,imsizez,aExtendMinX,aExtendMinY,aExtendMinZ,aEx... |
function im = FourLayerColor(fim,respaceFlag);
%function im = FourLayerColor(fim,respaceFlag);
%
%creates an image where each layer can be seen as a different color
%adding up to white, like rgb for 3 layers.
%
%the correct colors are found by dividing up the hue circle into 4 regions
%if respaceFlag is filled in with ... |
% load('C:\Users\ALIENWARE\Desktop\decision-making\工作内容\NewDataset_C_DS_DY.mat')
% CPX= [CPX1 CPX2 CPX3 CPX4 CPX5 CPX6 CPX7 CPXc1 CPXc2 CPXw1 CPXw2];
% CPY= [CPY1 CPY2 CPY3 CPY4 CPY5 CPY6 CPY7 CPYc1 CPYc2 CPYw1 CPYw2];
load('C:\Users\ALIENWARE\Desktop\decision-making\工作内容\NewDataset_D_DS_DY.mat')
CPX= [DPX1 ... |
%% Stelling 11
%
% De functie ones() levert altijd een vector bestaande
% uit meer dan 1 element op.
%
Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
|
%%
% COURSE: Signal processing problems, solved in MATLAB and Python
% SECTION: Spectral and rhythmicity analyses
% VIDEO: Welch's method
% Instructor: sincxpress.com
%
%%
% load data
load EEGrestingState.mat
N = length(eegdata);
% time vector
timevec = (0:N-1)/srate;
% plot the data
figure(1), clf
plot(... |
function [response, timing, quitProg] = showScanBlock_noTrialStruct(display,stimulus, t0)
% [response, timing, quitProg] = showScanBlock(display,stimulus, t0)
%
% This function shows all the frames within a scan block, without the use
% of any trial structure. The main reason to use this function over
% showScanBlock ... |
function H_3x3 = computeHomography(src_pts_nx2, dest_pts_nx2)
%this function uses the eig matlab buildin function to calculate the homography.
%maximum pairs of matching points needed : 4
%step01
%for each pair of corresponding matching points a coefficient matrix should
%be created. Ths size of the input matrixes c... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Created by Li Yuanman
%%yuanmanx.li@gmail.com
%%% most of the codes are borrowed from SSC (Ehsan Elhamifar, 2012)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc, clear all, close all
dbstop if error
addpath clustering
Dataset = 'Hopkins155';
alpha = 800;
maxNumGroup = 5... |
function [Kr,xr, NLL, pLastStep, Keff, rConv, alpha0Vector] = MAPDPCluster(fDebug, R, D, alpha0, mu0,a0,b0,c0, thresholdNLLConvergence, Y, fGibbs)
% MAP or Gibbs DP with block updates for cluster components.
% Parameters
% fDebug Print to screen log messages?
% R maximum number of it... |
%Sample Program for comparison of sizes
I = imread('D:\matlab files\img\grade 2.bmp');
gray = rgb2gray(I);
bw = im2bw(gray, 0.09);
%bw = im2bw(gray, graythresh(gray));
%either can be used. In case of first one value has to be changed depending on the image
cont = Contourfn(bw);
%centroid using inbuilt function
c1... |
function v = gibbs_mass(a)
% GIBBS_MASS - Specific Gibbs function [J/kg].
v = thermo_get(a.tp_id,12);
|
function H11_matrix_eq = H11_matrix(L1,L7,L8,theta3,theta4)
%H11_MATRIX
% H11_MATRIX_EQ = H11_MATRIX(L1,L7,L8,THETA3,THETA4)
% This function was generated by the Symbolic Math Toolbox version 7.0.
% 22-Oct-2018 17:33:32
t2 = theta3+theta4;
t3 = sin(t2);
t4 = sin(theta3);
t5 = cos(t2);
t6 = cos(the... |
close all
[X_tr, Y_tr] = readMNIST('./data/train-images-idx3-ubyte', './data/train-labels-idx1-ubyte',20000,0);
[X_te, Y_te] = readMNIST('./data/t10k-images-idx3-ubyte', './data/t10k-labels-idx1-ubyte',10000,0);
fprintf('Data loaded...\n')
%%
num_classes = 10;
[N,D] = size(X_tr);
T = 250;
parameters = ones(51,D).*(0:5... |
function [m,p,q,S,D,M] = alignmidiwav(MF,WF,TH,ST)
% [m,p,q,S,D,M] = alignmidiwav(MF,WF,TH,ST)
% Align a midi file to a wav file using the "peak structure
% distance" of Orio et al. that use the MIDI notes to build
% a mask that is compared against harmonics in the audio.
% MF is the name of the MIDI file,... |
function [drr_dbeta ] = calcDRachfordRiceObj(z, K, beta )
drr_dbeta = -sum(z.*(K-1.0).^2./(1.0+beta.*(K-1.0)).^2);
end
|
function minIntMatrix = GenerateMinThicknessMatrix(numTubes,squareTubes)
minIntMatrix = ones(1,numTubes);
RD5x35 = .051129; % 1
RD5x49 = .0694261;% 2
R75x35 = .078618; % 3
R75x49 = .1079106;% 4
RD1x35 = .106107; % 5
SQ1x35 = .1321857;% 6
RD1x49 = .146395; % 7
SQ1x49 = .179735; % 8
RD1x65 = .19093; % 9
SQ1x65 = .233... |
function requests = readReqFile(fileName)
fid = fopen(fileName, 'r');
idx = 1;
while ~feof(fid)
str = fgetl(fid);
s = regexp(str, '\s+', 'split');
requests(idx).id = str2double(char(s(1)));
requests(idx).src = str2double(s(2));
requests(idx).dst = str2double(s(3));
... |
%% GAIO demo
% extraction of cyclic behaviour
alpha = -1.7; % map from "On the approximation of complicated behaviour"
ft = @(z) exp(-(2*pi*i)/3)*((abs(z).^2+alpha).*z+0.5*conj(z).^2);
f = @(x) [real(ft(x(:,1)+i*x(:,2))) imag(ft(x(:,1)+i*x(:,2)))];
n = 10; x = linspace(-1,1,n)'; [XX,YY] = meshgrid(x,x);
X = [ XX(:)... |
clc
deg2rad = pi/180;
rad2deg = 180/pi;
Kp = 130;
Ki = 0;
Kd = 220;
m = 80;
r = 1.2;
I_g = m*r^2*eye(3);
M_RB = [m*eye(3,3) zeros(3,3);
zeros(3,3) I_g];
H = [zeros(3,12);
zeros(3,3) eye(3,3) zeros(3,6);
zeros(3,12);
zeros(3,9) eye(3,3)];
h = 0.01;
N = 3000;
t = 0:h:N*h+h;
Q_angle = 0.001;
Q_veloc... |
%%%Risposta in frequenza LTR%%%
% ________ _______
% | | | |
% ---|----| Kltr |-------| G_nom |------>|---->
% | |________| |_______| |
% | |
% |_____________________________________|
% Kltr=tf(K_LTR); ... |
function [subGene] = mutate(orgGene, mutationProbabilty, stateNum)
% 根据概率变异
if rand()<=mutationProbabilty
subGene = orgGene;
for i=1:stateNum
randIndex1 = randi(100,5,1)+(i-1)*100;
subGene(randIndex1) = randi(6,1,5)-1;
end
else
subGene = orgGene;
... |
function [act_buff_out, landing_out]= activation_landing(act_buff, landing, swt)
%#eml
%modifiy the left knee index
if swt>=2000;
swt=2000;
end
tran_t = round(0.1*swt);
act_buff_out = act_buff;
%landing
act_buff_out(1:swt) = zeros(1,swt);
act_buff_out(2*tran_t+1:5*tran_t) = 0.5+0.5*sin(pi*(1-linspace(1,0,3*tran... |
function test_fft()
tx=linspace(0,4.1,8000000);
xx=(2.2-tx).*sin(2.0*pi*(400+300*tx) .*tx) +...
1.3*cos(2.0*pi*1001*tx);
fprintf('sigproc.fft_sliding...\n');
[t, f, a] = sigproc.fft_sl(tx, xx, 80000, 80000);
a1 = sigproc.fft_sl_remconst(a);
find_figure('fft_sl 3D'); clf; hold on; title('fft_sl 3D');
... |
addpath('../../util'),init
if ~exist('Is','var')
load /data/vision/billf/manifold-learning/DL/Data/BSD/dn_ucb2
end
if ~exist('Iss','var')
load /data/vision/billf/manifold-learning/DL/Data/BSD/dn_ucb_Is2
end
pb=cell(1,200);
test_id =1;
psz=15;
psz_h = (1+psz)/2;
do_pre = 0;
do_s=3;
parfor id = 1:200;
sz = size... |
function [] = plot_bino_norm2(n_small, n_large)
%% is mean supposed to be n/2 instead of 1/2?
x1 = 0:n_small
x2 = 0:n_large
bin_sm = binocdf(x1, n_small, .5)
bin_lg = binocdf(x2, n_large, .5)
norm_sm = normcdf(x1, n_small/2, sqrt(n_small/4))
norm_lg = normcdf(x2, n_large/2, sqrt(n_large/4))
... |
% why are some populations the best?
%% what differentiates the good from the other populations?
% bestPopsThresh = 10; % the threshold to look for "good pops"
%find the bestest pops
lookList = [1 3];
bestPopsAllStims = find(histc(nonzeros(bestPops(lookList,1:bestPopsThresh)),0:1:numPops+1) >= numel(lookList))-1;
... |
function varargout = SIM_Handle(imgSIM,eventSIM,boxsSIM)
% handle the SIM's images
% result[event_num,start_fram,stop_fram,xc,yc,precise_x,precise_y]
pixe_size = 32.5; %nanometer
psf_hw = 1.5; % the half-high-half-width per pixel
least_fram = 4; %the fram number that the particle exists at least
region_num = length(... |
%----------------------------------------------------+
% script to read in CSV of sinkhole profiles made |
% using qprof plugin in QGIS along with feature info |
% from the shapefile with 2D profile locations, then |
% pick the edges and base of the sinkhole from these |
% profiles using the fucntion 'SH_DeDiam... |
function cS = var_numbers
%% Data variables: 201-300
% Range of data variables
cS.dataVarRangeV = [201, 300];
% Stats by [age, school, year]. Simply copied from cpsojt
cS.vAgeSchoolYearStats = 201;
% Stats by [birth year, school, age]. Simply copied from cpsojt
cS.vBYearSchoolAgeStats = 208;
% Data wage profiles... |
clear all;
close all;
% read data
[p9 x9 y9] = textread( '../DVFRegularization/h_plot_9.txt', '%f %f %f' );
xAxis='horizontal cross section [pixel]';
yAxis='displacement [pixel]';
% comparison with analitic solution
pos = [50, 50, 672, 504];
figure('Position',pos); hold on
title('level 9')
xlabel(xAxis)... |
function plotawins(hfig, W)
Nwin = length(W);
figure(hfig); hold on;
for i = 1:Nwin
plot(W(i).p1:W(i).p2, .1*W(i).awin);
end |
noCoordinates = length(points(1,:));
noFrames = length(points(:,1));
noPoints = noCoordinates / 3;
points_x = zeros(noFrames, noPoints);
points_y = zeros(noFrames, noPoints);
points_z = zeros(noFrames, noPoints);
line = zeros(1, noCoordinates);
frameNo = 1;
while( frameNo <= noFrames )
line = points(frameNo,:)... |
%% Optimization fo hyperparamaters
% classifier parameters
nFold = 4;
applyPCA = true;
cvType = {'KFold'};
nEpoch = size(training.label,2);
orderIndex = create_index_CV(nEpoch,nFold);
featSCP = change_structure_period(training.features.temporal);
featERD = change_structure_period(training.features.spectral);
labels ... |
%% This script calculates K_trans, k_e, v_e, and v_p for a given dataset
% C_tracer needs to be calculated first.
clc
scans_dir='E:\Scans_20120321\B00373\From_Scanner\Undersampled_recon_no_SW\'; %Directory containing the tracer concentration (C_tracer) 4D volume
cd(scans_dir);
load C_tracer
runno='00373';
repe... |
% Plots impulse-response functions
set(0,'DefaultFigureWindowStyle','docked') % docks all figures
if adjtype==0
linescolor = 'b.-' ;
MarkerSize = 5;
elseif adjtype==2
linescolor = 'rs-' ;
MarkerSize = 3;
elseif adjtype==3
linescolor = 'gx-';
MarkerSize = 6;
... |
function [ result ] = util_map_minmax( input, varargin )
%UTIL_MAP_MINMAX Normalize the input matrix by max/min
% Input:
% input: Input data, can be a vector or m-by-n matrix.
% maxvalue: Default:1
% minvalue: Default:0
% method: Default: 'linear'
%
% Output:... |
% haltVideo.m
%
% Use this to stop the running video object. This is called automatically
% when the video preview window is closed.
%
% JSB 11/2010
function haltVideo(obj, event)
global vid;
stop(vid);
flushdata(vid);
delete(gcf); |
addpath('/home/raleman/Documents/MATLAB/analysis-tools-master'); %Open Ephys data loader.
addpath('/home/raleman/Documents/GitHub/CorticoHippocampal')
addpath('/home/raleman/Documents/internship')
nFF=[
% {'rat26_Base_II_2016-03-24' }
% {'rat26_Base_II_2016-03-24_09-47-13' ... |
function HR_HSI= CSTF_FUS(HSI,MSI,T,BW,BH,downsampling_scale,par,s0,S)
mu=0.001;
lambda=par.lambda;
%% simulate LR-HSI
Y_h_bar=hyperConvert2D(HSI);
HSI1=Unfold(HSI,size(HSI),1);
HSI2=Unfold(HSI,size(HSI),2);
HSI3=Unfold(HSI,size(HSI),3);
%% simulate HR-MSI
MSI1=Unfold(MSI,size(MSI),1);
MSI... |
function [BestSol, newpop] = fireflyMove(nPop, pop, scale, beta0, alpha, gamma, delta, xMin, xMax, VarSize,func,BestSol)
% rij = 0;
for i=1:nPop
newpop(i).Cost = inf;
for j=1:nPop
if pop(j).Cost < pop(i).Cost
% rij= (sqrt((pop(i).Position - pop(j).Position).^2));
... |
function [Voc,Isc,FF,Vmax,Imax,Pmax]= parameter(V,I)
if (size(V,1))>1
V=V';
end
if (size(I,1))>1
I=I';
end
[y, index] = unique(-I);
Voc=interp1(y,V(index),0);
Isc=interp1(V,I,0)*1000;
% I=I(find(V>=0));
% V=V(find(V>=0));
% V=V(find(I>=0));
% I=I(find(I>=0));
% % V=voltage;
% % I=current;
... |
function ypn = ynp(m,t,h,alpha,n)
tmmp = 0
tmp = 0
for i=0:m-1
if i==0
tmp= tmp + fai(i)*(t+n*h+h)^i
else
tmp= tmp + fai(i)*(t+n*h+h)^i/factorial(i)
end
end
for j=0:n:
tmmp = tmmp + b(h,alpha,n+1,j)*f()
end
ypn = tmp + tmmp/gamma(alpha)
end
|
function []=plot_FRF(freq_rpm,response,node_dir,unstab_speed)
legend_text=[];
for i =1:length(node_dir(:,1))
node=node_dir(i,1);
dir=node_dir(i,2);
if dir == 1
node_string=['Node' num2str(node) ',x'];
end
if dir == 2
node_string=['Node' num2str(node) ',y'];
end
legend_text=[l... |
function computeQuads( self, ImgRaw)
% COMPUTEQUADS register raw img into four quadrants
% Assumed Quadrant Ordering:
% |3|4|
% |2|1|
self.ImgRaw = single(ImgRaw);
if strcmp(self.computeDevice, 'GPU');
self.ImgRaw = gpuArray(self.ImgRaw);
end
Img = max((self.ImgRaw - self.ImgDark),0.1)./max((self.ImgBlank - self.I... |
function ROOTnoSlip()
%calculates and animates a disk sliding on a surface with no friction
close all;
%parameters
p.m=1; p.g=10; p.R=1;
circle=0; %0: select any parameters 1: only circular motion 2: intersection with no slip
if circle==2
%intersection between no friction circular motion
g=p.g; R=p.R;
thet... |
function [comp] = bpcs_comp(a)
hig_comp = 112;
[row,col] = size(a);
sumtotal = 0;
for i = 1:1:row
for j = 1:1:col-1
a1 = a(i,j);
pi = a(i,j+1);
if(a1~=pi)
sumtotal = sumtotal+1;
end
a1 = a(j,i);
pi = a(j+1,i);
if(a1~=pi)
sumtotal = sum... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.