text stringlengths 8 6.12M |
|---|
function psnr = calc_psnr( T, N )
[m,n] = size(T);
err = ((T-N).^2)/(m*n);
err = sum(err(:));
psnr = 20 * log10(255/sqrt(err));
end
|
function [duty_cycle] = generate_plots_for(freq_axis, all_time_offsetted, all_power, start_freq, stop_freq, start_period, stop_period, filepath)
start_date = start_period(1:find(start_period == ' ') - 1);
store_path = [filepath '\plots\from_' num2str(start_freq) '_to_' num2str(stop_freq) '\'];
freq_index = ... |
function [word] = coldWar(vec, odd, even)
%1) calculate new ASCII values of every letter - adjusted to a scale of 1
%to 26 (subtract by 96)
%2) mod by 26 - max adjusted ASCII value of lowercase alphabet
%3) add mod value to 96 to bring back up to regular scale
%4) create final vector
%1)
values = double(vec) - 96;
ev... |
% hvrealtocmplx - issue 1.1 (23/08/09) - HVLab HRV Toolbox
%--------------------------------------------------------
%[cmplxdata] = hvrealtocmplx(indata1, indata2, mode)
% Combines data from two data structures into real-and-imaginary or
% modulus-and-phase parts of a new complex data structure
%
% cmplxdata = n... |
function [] = run(filename, N, H, Nfft)
%-Read in the file
fileDir = '/Volumes/ALEX/data/xeno_canto/';
[sig fs fileName] = readFile(fileDir, filename);
%-Get the mat filename and load in the mat
matFilename = [fileName(1:end-3) 'mat'];
load(matFilename);
%-Collapse into mono
if size(sig, 2) == 2
sig = (sig(:,1)... |
function a=mylpc(x,p)
aux=xcorr(x,p);
rx=aux(p+2:end);
Rx=toeplitz(aux(p+1:end-1));
a=Rx\rx; %inv(Rx)*rx
a=[1;-a]';
end |
clear all;
%% import datas
buses=importdata('buses.txt');
branches=importdata('branches.txt');
shunts=importdata('shunts.txt');
active_flow=importdata('Conventional Active Flow.txt');
reactive_flow=importdata('Conventional Reactive Flow.txt');
Pinj=importdata('Conventional Pinj.txt');
Qinj=importdata('Conventio... |
U1=forwardPE(1,1,0,0.125,20,400);
[X,Y]=meshgrid(0:0.0025:1,0:0.05:1);
figure;
subplot(1,2,1)
s1=surf(X,Y,U1);
s1.EdgeColor='none';
xlabel('T');
ylabel('X');
U2=forwardPE(1,1,0,0.6,20,400);
subplot(1,2,2)
s2=surf(X,Y,U2);
s2.EdgeColor='none';
xlabel('T');
ylabel('X');
figure;
r1=0.125;
A=(1-2*r1)*eye(20,20);
for i=1... |
function [] = pssmartblur(r, t, q, m)
%PSSMARTBLUR Run the Smart Blur filter.
% PSSMARTBLUR runs the Smart Blur filter with the default parameters.
%
% PSSMARTBLUR(R,T,Q,M) R for radius in pixels from 0.1 -> 100.0, default
% is 3. T for threshold from 0.1 -> 100.0, default is 25. Q for quality
% is 'high', '... |
load 'xilo.mat'
[x,f] = auread('xilo');
y = x(8000:10000)
n = 0:2000;
figure(1);
stem(n,y)
[ry,lags] = xcorr(y);
figure(2);
plot(lags,ry);
title('Xilo');
%{
Pseudo perioada semnalului xilo este aprozimativ 30.
La fel ca la punctul precedent se observa ca maximele secventei de
autocorelatie se alfa simetric de o parte ... |
% function params = initialize_system(params)
%
% Function for initializing all system parameters for a calculation
%
% Input
% Structure, params, is optional as any non-specified fields are
% replaced with defaults.
%
% Setup
% params.config -> Can ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Create a dataset from ediagnostic files
% The script extract the derivation II from the samples and check (at beat
% level) if the beat is normal/anomalies. Then compute the accuracy at
% signal level (i.e if at least one beat from an anoma... |
% Write and test a script that sum the series 1 2 3 ... + + + such that the sum is as large as possible without exceeding 123.
% Lecture4_FlowControl #4
% PRACTICE QUIZ # 3
s=1;
for i=1:123
s=s + i*i;
end
s |
function [] = plot_TOJ_concurrently(stim,tact,fsStim)
figure
hold on
t = [0:length(tact(:,1))-1]/fsStim;
plot(t,stim(:,1),'linewidth',2)
plot(t,tact(:,1),'linewidth',2)
plot(t,tact(:,4),'linewidth',2)
plot(t,tact(:,2),'linewidth',2)
legend({'stim','tactor','audio train','button'})
%vline(trainTimes/fs_stim)
... |
function S = simulateK50Model(T,trial,t_range,models)
if nargin < 3
t_range = 1:size(trial.fuse.xsmooth,2);
end
if nargin < 4
models = 4;
end
S.models = models;
S.names = T.sname(models);
S.t_range = t_range;
F = T.F(models);
X0 = xsmoothToFullState(trial,t_range(1));
n_t = t_range(end)-t_... |
function sigma = find_permutation_H0_distribution_width(envData, nPerms, Regularize, transform)
%FIND_PERMUTATION_H0_DISTRIBUTION_WIDTH use random shuffles to build a null
%
% SIGMA = FIND_PERMUTATION_H0_DISTRIBUTION_WIDTH(ENVDATA, NPERMS, REGULARIZE, TRANSFORM)
% finds the standard deviation of z-transformed cor... |
% function to check the format option and reapply the style
%
% function [] = HVGRAPHSTYLE(figure_handle)
%
% TPG 15/6/2004
% Modified TPG 24/6/2004 to include y label position code, subsequenctly
% commented out as too unreliable
function [] = HVGRAPHSTYLE(figure_handle)
handlelist=allchild(fi... |
% generates uniformly distrubted random variable
% between splitTimeBounds of size dimen
function t = createsplittimer(dimen, splitTimeBounds)
t = mean(splitTimeBounds) + ...
diff(splitTimeBounds) * (rand(dimen)-0.5);
end |
function [curvearray] = createCurvearray(y_start_p,y_end_p,approximation,fitmethod,fitresult)
clear curvearray;
curvearray=zeros((y_end_p-y_start_p),1);
z=1;
if (fitmethod==1)
for i=y_start_p:y_end_p
curvearray(z)=approximation(1)*i^9 + approximation(2)*i^8 + approximation(3)*i^7+ approximation(4)*i^6... |
function [MUi, MWi, Ui, Wi,jac] = uq_quadrature_nodes_weights_gauss(LEVELS, TYPES, PARAMETERS, POLYAB)
% UQ_QUADRATURE_NODES_WEIGHTS_GAUSS(LEVELS,TYPES,PARAMETERS,POLYAB):
% return the gaussian quadrature nodes Xi and weights Wi for polynomial
% of type TYPES{:} up to level LEVELS(:).
% PARAMETERS is mand... |
% % field1='mem'; value1=10;
% % field2='dim'; value2=2;
% % field3='good'; value3=2;
% % field4='quiet'; value4=0;
% % param=struct(field1,value1,field2,value2,field3,value3,field4,value4);
% % save([str3 '_PreTrack_','.mat'],'pos','R');
% % result=track(pos,15,param);
% % %% Divide into individual particles
% % j=1; ... |
classdef AbstractGuiApplication < ether.app.AbstractApplication
%ABSTRACTGUIAPPLICATION Base class for GUI applications
% Subclasses AbstractApplication adding minimum GUI functionality.
% Automatically deletes itself when frame closes.
%-------------------------------------------------------------------------... |
%%%%%%%%%%%%%%%%%%%%%%%%%%% HDPHMMDPinference.m %%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%%%% ****SEE 'utilities/runstuff.m' FOR EXAMPLE INPUTS *****
%%
%% Inputs:
%%%% data_struct - structure of observations, initial segmentation of data, etc.
%%%% model - structure containing hyperparameters for transition distributi... |
eid=0;
did=0;
mid = 1;
load(['train_conv' num2str(eid) '_' num2str(did)],'train_im','train_bd')
fsz = 5;
psz = 17;
num_train = size(train_im,2);
mat = reshape(train_im,[psz psz num_train]);
mat2 = zeros([psz-fsz+1 psz-fsz+1 num_train],'single');
switch mid
case 0
W0 = zeros(fsz,'single');
W0(:,2) = 1;
W0(... |
% Developed by Arian Shoari. Copyright 2017 John Foxe's Lab, University of Rochester.
% Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
% http://www.apache.org/licenses/LICENSE-2.0
% Unless agreed t... |
function grating = GenerateGrating(m,n,angle,lambda,ph,con)
% grating = GenerateGrating(256, 256, pi/2, 16, pi/2, 1);
% m/n = x/y patch size in pixels; angle = orientation of grating in degrees;
% lambda = spatial period in pixels; p=phase (0 to 1); con=contrast;
%
% J Greenwood 2009 & D Jonikaitis 2011
[X,Y] = mesh... |
function out = getRowsAs3rdDim(x, imsize, mergePatterns)
%GETROWSAS3RDDIM returns the 4D tensor where each line in X is rearranged
%as 3rd dimension.
%It is the inverse mapping for get3rdDimAsRows
%
% imsize: (rows, cols)
% This file is part of netlabExtensions.
% August 2011
% Jonathan Masci <jonathan@idsia.ch>... |
function vis(points, obstacles, target)
figure
plot3(points(1, :), points(2, :), points(3, :))
hold on
for i = 1 : size(points, 2)
plot3(points(1, i), points(2, i), points(3, i), 'ro')
hold on
end
plot3(target(1), target(2), target(3), 'gx', 'MarkerSize', 20, 'LineWidth', 4)
for i = 1 : size(o... |
% clc
% clear all
% Îļþ·¾¶ÅäÖÃ
Dir = 'L:\20181116';
baiban1_Dir = [Dir,'\baiban_1'];
baiban2_Dir = [Dir,'\baiban_2'];
baiban3_Dir = [Dir,'\baiban_3'];
baiban4_Dir = [Dir,'\baiban_4'];
baiban5_Dir = [Dir,'\baiban_5'];
for i = 2:3
if i==1
detection_Dir = baiban1_Dir;
elseif i==2
detection_Dir = ... |
function Coeff = pixel_indent(C,pixin)
% C is the curvelet coefficient matrix and pixin is the number of pixels to
% indent in on each side
% Written by Jared Doot, Laboratory for Optical and Computational
% Instrumentation
for s = 1:length(C)
for w = 1:length(C{s})
sub=size(C{s}{w});
for ii = 1:s... |
function [results] = computelife(tables,PARAMS)
%% HELP
% TABLE_DIR : Directory of tables
% PARAMS : Should include an object of all required parameters
% EXAMPLE:
% PARAMS.general = 1;
% PARAMS.age = 10;
% PARAMS.ethnic = 1; %% 0 = white, 1 = black, 2= asian
% PARAMS.gender = 0; %% 0 = ma... |
function res = test_LBP(I)
I = imread('index.jpeg');
%I = imread('tesla.jpg');
I = rgb2gray(I);
%Find and extract features.
points = detectSURFFeatures(I);
[features, valid_points] = extractFeatures(I, points);
%Display and plot ten strongest SURF features.
figure; imshow(I); hold on;
plot(valid_points.selectStronges... |
time = data(:, 1);
throttle = data(:, 2);
brake = data(:, 3);
gear = data(:, 4);
omega = data(:, 5);
vee = data(:, 6);
fuel = data(:, 7);
odo = data(:, 8);
lat = data(:, 9);
lon = data(:, 10);
ev = data(:, 12);
soc = data(:, 13);
alt = data(:, 14);
|
function [ history weight_set ] = testFSCSet( sim_pomdp , test_set , test_param_set , weight_set )
% function history = testPOMDP( sim_pomdp , test_set , test_param_set , weight_set )
% note: if given many fscs, then just picks randomly
% initialization -- in general
reward = 0;
iter_count = 0;
if ( ( nargin == 3 ) ... |
function [w rect] = start_psych(colour)
% Uses an rgb triplet for argument colour
[w rect] = Screen('OpenWindow',0,colour);
% Some settings
Screen('TextStyle',w,0); % Use normal text (1 for bold)
Screen('TextFont',w,'Helvetica'); % Use HELVETICA font
Screen('TextFont',w,40); % Use 40pt text
Screen('TextSize',w,2... |
function bit_array=logical_to_sign(bit_array)
%输入0,1矩阵,输出正负1,用于变换域第三种方法
bit_array=(bit_array-0.5)*2; |
function [] = ViewAnimation(input)
file = input.file;
dletaT = input.deltaT;
thicknessMultiplier = input.thicknessMultiplier;
refractoryDuration = input.refractoryDuratio;
excitatoryProb = input.excitatoryProb;
inhibitoryProb = input.inhibitoryProb;
attenuationProb = input.at... |
function sbxSaveAlignedSBX(path, pmt)
%SBXSAVEALIGNEDSBX Save an aligned copy of the sbx file so that future
% reading and writing is dramatically sped up. Saved as path_reg.sbx
if nargin < 2, pmt = 0; end
chunksize = 1000; % Parfor chunking
% Get original file size
afalign = [path(1:end-4) '.a... |
classdef twix_map_obj < handle
% class to hold information about raw data from siemens MRI scanners
% (currently VB and VD software versions are supported and tested).
%
% Author: Philipp Ehses (philipp.ehses@tuebingen.mpg.de), Aug/19/2011
%
%
% Modified by Wolf Blecher (wolf.blecher@tuebingen.mpg.de), Apr/26/2012
% A... |
function psi=vectoa(xc,yc,x,y,u,v,corrlen,err,b)
%function psi=vectoa(xc,yc,x,y,u,v,corrlen,err)
% (xc,yc) are vectors (row or column) of interpolation points
% (x,y) are vectors (row or column) of observation points
% (u,v) are matrices of east and north components with each day
% entered column-wise or row-wise
%... |
function [choice_x, B, B_ci] = rr_fit_psychometrics_paired(signal, choice, indicator, numparams, signal_x)
% function [choice_x, B, B_ci] = rr_fit_psychometrics_paired(signal, choice, indicator, numparams, signal_x)
% given choice for 2 conditions (selected by indicator), find optimal set
% of parameters, where conditi... |
function [ujref,dujref] = computeJetProfile(prs, p0, lpref, dlpref)
% Computes the background sheared jet
%% Compute the normalized pressure coordinate (Ullrich, 2015)
pcoord = exp(lpref) / p0;
lpcoord = log(pcoord);
%% Compute the decay portion of the jet profile
jetDecay = exp(-(lpcoord.^2 / prs... |
function[fX,CX,Gradf,GradC] = Gradient(Probleme,X,h) % X en colonne
n = length(X);
[fX,CX] = Probleme(X);
for i=1:n
H = zeros(n,1);
H(i) = h(i);
[fH_val,CH_val] = Probleme(X+H);
Gradf(i) = (fH_val - fX)/h(i);
GradC(i,:) = (CH_val - CX)/h(i);
end
Gradf = Grad... |
function [Q, R] = qr_house_holder(A)
% get shape of matrix
[m, n] = size(A);
% initialize Q and R matrices
Q = eye(m);
R = A;
for i=1:min(m - 1, n)
% compute Q and R by series of householder computations
[Q, R] = qr_step(Q, R, i, m);
end
end
function [Q, R] = qr_step(Q, R, i... |
function [ mz,x ] = combCompSparse(mz,x,ppmTol,flag)
%combCompSparse - combine neighbouring images that are within a certain
%ppm tolerance, and have PERFECTLY complementary binary images.
verbose = false;
% In some instances we don't want the data matrices to change sizes, so we
% need to return the matrices in thei... |
function [] = printAgentLocation( ...
gridMap, agentIndex, location, rescale, shape )
%PRINTAGENTLOCATION Hardcodes some color values for agent indices up to 5
%(defauting to blue after that) and call $printPointsOnGridMapWColors$ to
%print a marker on the grid for each agent. Only the last printed
%overlappin... |
function []=motorBback(mymotorB)
resetRotation(mymotorB)
mymotorB.Speed =30;
start(mymotorB);
while 1
rotation = abs(readRotation(mymotorB));
if (rotation>74)
stop(mymotorB)
break;
end
end
end |
function E = Esmooth(Sbeta)
Sbeta=curve_properties(Sbeta.betaStd,Sbeta.t); % Use unit length curve to compute smoothness penalty
E=trapz(Sbeta.t,Sbeta.curvature.^2);
|
function deathCell = deathCell(deathPercents)
%function to format the death percents
%this will fail if someone gets a 4 stock
%It just splits the original cell into a different cell where the numbers are separated by stage
indx = find(cellfun('isempty',deathPercents)) ;
asd = cell(size(indx,1),1);
fo... |
disp(' ')
disp(' waterfall_FFT.m ')
disp(' ver 1.8 June 21, 2006 ')
disp(' by Tom Irvine Email: tomirvine@aol.com ')
disp(' ')
disp(' This program calculates the one-sided, full amplitude FFT ')
disp(' of a time history ')
disp(' ')
disp(' The time history must be in a two-column matrix format: ')
disp(' Tim... |
%%MyMainScript
tic;
%%Your code here
barbara = imread('../data/barbara.png');
canyon = imread('../data/canyon.png');
tem = imread('../data/TEM.png');
canyon_r = canyon(:,:,1);
canyon_g = canyon(:,:,2);
canyon_b = canyon(:,:,3);
barbara_lc = myLinearContrastStretching(barbara, 30, 10, 170,220);
barbara_he = myHE_n(bar... |
function[realnumber]=prob_input_matrix(D,matrix)
realnumber=(matrix(1,2)-1)*D*(D+1);
realnumber=realnumber+(D+1)*matrix(1,1);
realnumber=realnumber+matrix(1,3)+1;
end |
clc
clear all
close all
Nx = 550;
x = [1:Nx];
lambda = 100;
x1 = linspace(Nx,1,Nx);
figure(1);clf
for i = 1:1500
Ep = cos(2*pi*(x-i)/lambda);
if i>Nx
En = 0.5*cos(2*pi*(x1-i)/lambda);
E= Ep+En;
end
% Set values to right of wave front to NaN so they won't be plotted.
Ep(... |
classdef PermutationGenerator < Generator
%Iterates through all the permutations of length n using Heap's Alg.
properties
n
c
i
end
methods
function obj = PermutationGenerator(n)
obj.n = n;
obj.curr = 1:n;
%Extra infor... |
function [final_parameters min_cost] = linear_regression(X, phi, max_itr, del, alpha)
y = X(:,end);
X = X(:,1:end-1);
X = [ones(size(X,1),1) X];
if(phi == 1)
X = [X X(:,2).^2 X(:,2).^3 ];
end
n = size(X,2);
m = size(X,1);
min_cost = -1;
min_theta = zeros(n,1);
min_cost_his =[];
% 0: linear
% 1: polynomial
% 2: gaussi... |
function det_boxes = testDetector(imname, CNNModel, CNNModelName, dpmModel )
%testDetector Detect feet on a given image with a trained svm-model
%
%
%
run ../matconvnet/matlab/vl_setupnn
run ../setDataPath
addpath('../commons');
CNNModelDirName = [CNNModelName '_dir'];
CLS_NAMES = {'L2','L3','R2','R3'};
[~, fNam... |
clear
clc
%误码率数组初始化
ERROR_ASK=zeros(1,21);
ERROR_FSK=zeros(1,21);
ERROR_PSK=zeros(1,21);
ERROR_4PSK=zeros(1,21);
%信噪比范围
snr=-10;
snr_db=-10:1:10;
Snr=10.^(snr_db/10);
%每一个信噪比SNR对应的误码率
for loop=1:1:21
ERROR_ASK(loop)=ASK_Function(snr);
ERROR_FSK(loop)=FSK_Function(snr);
ERROR_PSK(loop)=PSK_Function(snr);
E... |
function [ output_args ] = mq_normalizeWeightsWarpingErrors( cell_warping_weights )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
%%
%% CONSTANTS SHOULD BE PASSED AS FUNCTION ARGUMENtS
%% OR MOVE TO FUNCTION mqSetGlobals.m
%%
global PATCH_SIZE;
global EPSILON;
global BETA;... |
function [xtrain, ftrain, nTrain] = xacmes_selectTrainingPoints(arrX, arrF, aSZ, xdim, nTrainMax)
nTrain = aSZ;
if (nTrain > nTrainMax) nTrain = nTrainMax; end;
indx1 = aSZ-nTrain+1:aSZ;
xtrain = arrX(:, indx1)';
ftrain = arrF(:, indx1)';
[ftrain, arindex] = sort(ftrain,'ascend');
xtrainnew = zeros(nTrain,xdim);... |
function [cgcurve,bestFitness,bestSol]=GNDO(obj,n,d,lb,ub,t)
%obj--------objective function
%c-------population size
%d-------dimension of problem
%lb-----the lower limit of the variables
%ub-----the upper limit of the variables
%t------the maximum number of function evaluations
%cgcurve---the record of the ... |
function [header_cells,variables_cells,data_cells] = read_raw(filename)
% read_raw: usage-- [headers_cels,variables_cells,data_cells]=readraw(file)
% This m-file function reads spice3 ascii "raw" file line-by-line
% and outputs string and numeric information compatible with MATLAB.
% Input: The text string containing... |
function [x, y] = DGM_phone( qj, x0, z0)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
global L1 L2 L8 L9 sb hp
q1 = qj(1);
q2 = qj(2);
q3 = qj(3);
q9 = qj(8);
q10 = qj(9);
x = x0 - L1*sin(q1) - L2*sin(q2) - sb*sin(q3) + L8*sin(q9) + L9*sin(q10);
y = z0 + hp + L1*cos(q1) + L2*cos(q... |
function repref_drawRecognition3way(window, color_text, color_left, color_middle, color_right, imageLocs)
%% draw 3 circles shifted up
Screen('FillOval', window, color_left, imageLocs.circle_dfarleft);
Screen('FillOval', window, color_middle, imageLocs.circle_down);
Screen('FillOval', window, color_right, im... |
x_init = randn;
x_test = randn;
[a,b,c,fa,fb,fc] = bracket(@poly,x_init,x_test,poly(x_init),poly(x_test));
%% Plot
clf; hold on;
plot(min([a b c]):.01:max([a b c]),poly(min([a b c]):.01:max([a b c])))
plot([a b c],[fa fb fc],'*');
%%
[xmin,fmin]=golden(@poly,a,b,c,fb)
[xmin,fmin]=brent(@poly,a,b,c,fb) |
function [STATS,DIFS] = compare_video_spline(video_prefix,interpolation)
blk_sizes = [4 8 16 32];
mse_f = figure('Position',[0 0 800 600]);
hold all;
xlabel('Frame Interpolado','FontSize',10);
ylabel('ECM','FontSize',10);
psnr_f = figure('Position',[0 0 800 600]);
hold all;
xlabel('Fra... |
function varargout=detection_objective(tign,h,g,params,red,varargin)
% J =detection_objective(tign,h,g,params,red)
% [J,delta] =detection_objective(tign,h,g,params,red)
% [J,delta,f0,f1]=detection_objective(tign,h,g,params,red)
% compute objective function and optionally gradient d... |
function [] = plot_model(disps,env_inc,env_dec,env_all,pop,warp,N,prefs,resp_inc,resp_dec,gain,fnON,fnOFF)
set(0,'DefaultFigureWindowStyle','docked')
set(0,'defaultlinelinewidth',1)
figure; hold on;
subplot(2,3,1); hold on; title('environmental probability distributions');
plot( disps , env_inc , 'r' );
plot( disps ... |
function [opts,flag] = desiGetProcOptions(file,force)
% desiGetProcOptions - determine the processing parameters (and defaults)
% for each of the various file types...
% Decide whether we can continue; if false then we should abort
flag = true;
% Options for processing imzML files
opts.imzml.mzFrac = 0.01;
opts.im... |
% convert 24 hour clock to
% 12 hour clock in string format
function output = time_to_string( input )
hour = floor( input );
minute = (input - hour)*60.0;
hour = round( hour );
% restrict the number to below 24
hour = mod( hour , 24 );
second = (minute - floor(minute))*60;
second = round( floor(second) );
minute = r... |
function polygons = DoClusterSP(x,y,t)
hfig = ClusterSpikeProj(x,y,t);
waitfor(hfig,'UserData','done');
polygons = {};
if (ishandle(hfig))
polygons = getappdata(hfig,'polygons');
close(hfig)
end
|
%% Sparsify - Aditya Nair, Kunihiko Taira
%% Input : A -Adjacency matrix , epsilon - approximation order
%% Output: A_sparse - Sparsified adjacency matrix, Re-effective resistance
function [A_sparse, time1, time2] = sparsify_spectral(A,epsilon)
if epsilon <= 0
A_sparse = A;
else
A = full(A);
%% Initializin... |
% The MIT License (MIT)
%
% Copyright (c) January, 2014 michael otte
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
% in the Software without restriction, including without limitation the rights
% to use, c... |
/*
* Copyright (c) 2015 Lutz Hofmann
* Licensed under the MIT license, see LICENSE.txt for details.
*/
function LatexPrintMatrix(M)
s := "\\begin{pmatrix} ";
for i := 1 to NumberOfRows(M) do
for j := 1 to NumberOfColumns(M) do
s *:= Sprint(M[i,j]);
if j lt NumberOfColumns(M) then
s *:= " & ";
end i... |
clear
dates={'Aug_04_11' 'Aug_09_11' 'Jul_22_11' 'Aug_05_11'};
cellnum={'B' 'D' 'A' 'A'};
conc_propofol='100'; % Concentration of propofol in uM
start_current=10; % Starting current in pA
finish_current=150; % Finishing current in pA
increments=15;
celldata=zeros(numel(dates),6,increments);
matrixnames={'control_... |
function [mse_result] = mse(f1, f2)
%其中,结果值越大,代表与原图相差越大
% MSE = E( (img-Eimg)^2 )
% = SUM((img-Eimg)^2)/(M*N);
%计算f1和f2均方根误差
e = double(f1) - double(f2);
[m, n] = size(e);
mse_results = sqrt(sum(e.^2)/(m*n)); %得到的是一组结果集,最终结果要使用平均值
mse_result = mean2(mse_results);
end
|
%Plots cdf of # of delay per messages, for stealth and normal
[norm1 norm2 norm3 data1 data2 data3] = normvsstealth();
f = figure();
set(f,'defaultaxesfontsize', 14);
delays = [data1.delays; data2.delays; data3.delays];
[y, x] = ecdf(delays);
semilogx(x, y, 'k-', 'LineWidth', 2);
hold on
delays = [nor... |
th1 = 45 * pi / 180;
th2 = 45 * pi / 180;
th3 = -45 * pi / 180;
tol = 0.01;
X = [th1;th2;th3];
while(1)
th1 = X(1,1);
th2 = X(2,1);
th3 = X(3,1);
X_prev = X;
F = [2*cos(th1)*cos(th2)-cos(th1)*sin(th2)*sin(th3)+cos(th1)*cos(th2)*cos(th3)-2;
2*cos(th2)*sin(th1)-sin(th1)*sin(th2)*sin(th... |
function plot_corrEOG(dataEEG,vEOG,hEOG,eloc,clim)
subplot(1,2,1)
R_v = corr(dataEEG',vEOG');
topoplot(R_v,eloc);
title('Vertical EOG')
colorbar;
if nargin >4
caxis(clim);
end
subplot(1,2,2)
R_h = corr(dataEEG',hEOG');
topoplot(R_h,eloc);
colorbar;
if nargin >4
caxis(clim);
end
title('Horizont... |
%Project CtpS570
function [X1min, idx1, Index1, X2min, idx2, Index2, pure, bX1, bX2]=FindMinEntropy(Data,Index)%,Index)
Data1=Data(Index,:);
[Totalall,~]=size(Data1);
Total1s=histc(Data1(:,4),1);
%%% Go through the x1 axis
Index1=Data1(:,1);
[temp,idx] = sort(Data1(:,2));
Index1=Index1(idx,:);
tempX1 = unique(temp);... |
function sugar=main1step(ca,k1)
h=1;
x0=[75*10^-4 %[NADP+]
112*10^-4 %[ADP]
200*10^-6 %[RuBP]
1.34*10^-2 %[Ci]
200*10^-6 %[PGA]
200*10^-6 %[DPGA]
200*10^-6 %[PGAld]
0]; %[sugar]
p1=[10^10
10^0
5
5
10^23
1.34*10^-2
75*... |
function dy = motor(t,Y)
%Motor parameters kb, kt, R, L, J, B
kb = 1; kt = 1;
R = 8; L = 0.006; J = 0.02; B = 0;
%Initialization of Differential equations in vector matrix form
%with zero matrix
dy = zeros(2,1);
Tl = 1;
%Calculate the voltage given by PID according to the error in speed w
V = controller(t,Y);
%Diffe... |
function [ mean_amplitude_diff, std_amplitude_diff, amplitudes_diff ] = gs_samplitude_diff( scanpath1, scanpath2g, gaze , ff_flags)
if nargin<4, firstfixation_flag_default; end
if iscell(scanpath1)
for p=1:length(scanpath1)
% all_scanpath1g=repmat(scanpath1{p}(gaze,:),size(scanpath2g,1)... |
function [dp_m, fpf] = quantify_particle_ditribution();
% Accepts a PIV image of a particle distribution and returns the
% mean particle diameter and fine particle fraction less than 5um
clc; clear;
close all;
warning off;
% -----------------------------------
% Set calibration constant using silver particles with a... |
function [kval] = getk( Rc,Zc,r,z )
%GETK Returns the k parameter value used in elliptic integrals
% Returns k value which is the function of coil location and physical
% location of interest
kval = sqrt(4*Rc*r./((z-Zc).^2+(Rc+r).^2));
end
|
function [modlist,funlist,len,typestr]=makeheader(funname,suborfun,typestr,modlist,funlist,r,w1d);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if nargin<7 w1d=0; end
if w1d
for m=1:length(typestr)
temp=any(strcmp(typestr(m),{'d','m'})); if temp,typestr(m)='x';end
temp=any(strcmp(typestr(m),{'... |
% MANUALLY LOAD THE RESULTS FIRST
expectation_list = [ ...
"error_value_togtd_0", ...
"error_value_togtd_20", ...
"error_value_togtd_40", ...
"error_value_togtd_60", ...
"error_value_togtd_80", ...
"error_value_togtd_100", ...
"error_value_greedy", ...
"error_value_mta"];
LineColors = [... |
% _______________________________________________________________________
% Main function for SIP model
% Version 1.0 (November, 5th 2020)
% _______________________________________________________________________
% for any question or request, please contact:
%
% Dr. Yelu Zeng & Dr. Min Chen
% Joint Global Change Resea... |
function [output] = lpf(input,previous)
%Low pass filter
% Detailed explanation goes here
output = 0.6321*input + 0.3679*previous; %
% sys =
%
% 1
% ----------
% 0.01 s + 1
%
% 0.6321
% ----------
% z - 0.3679
%
% Sample time: 0.01 seconds
% Discrete-time transfer function.
end
|
function noisyTweets = kMeansNoiseRemoval(data)
% KMEANSNOISREMOVAL Using kmeans with many values of k to cluster a list of
% tweets, in order to delete tweets that have the least connections to
% others. More details of the algorithm can be found at
% http://meyer.math.ncsu.edu/Meyer/PS_Files/CaseStudyInTextMining.pd... |
% llf.m: mixed logit log likelihood function
function [llfv]=llf(y,x,theta,prob);
llfv=prob(x,theta);
llfv=sum(log(y.*llfv+(1-y).*(1-llfv)));
|
% ADVISOR Data file: MC_PM100_UQM.m
%
% Data source:
% PowerPhase 100 Data sheet. Unique Mobility website: www.uqm.com
%
% Data confidence level: Good-data from manufacturer spec sheet
%
% Notes: This motor/contoller is designed for large EV/HEV applications
%
% Created on: 6/1/00
% By: tony_markel@nrel.gov
%
... |
clear classes;clear variables;close all;clc;
%% Add FIRM toolbox to the Matlab path
addpath(genpath('C:\Ali\Dropbox\GIT_FIRM\FIRM-MATLAB'))
add_external_toolboxes()
%% Parameters
user_data = user_data_class; % The object user_data will never be used. This line only cause the "Constant" properties of the "user_... |
nstd_px = nstd_ray * focal;
fig_rot_err = figure();
errs = quantile(rot_errs_pc5p(:, :, 1, 1), 0.25, 1);
errs = mean(rot_errs_pc5p(:, :, 1, 1), 1, 'omitnan');
plot(nstd_px, errs, 'x-'), hold on;
fig_transl_err = figure();
errs = quantile(transl_errs_pc5p(:, :, 1, 1), 0.25, 1);
errs = mean(transl_errs_pc5p(:, :, 1, 1),... |
% Copyright 2018 - 2020, MIT Lincoln Laboratory
% SPDX-License-Identifier: X11
%%
function plotDistributions(outputFolder, plotFigures, saveDirectory, numExamples, weighted)
% The purpose of this function is to plot the altitude/speed distributions
% of encounters for validation.
%
% Inputs:
% outputFolder - folder con... |
% batch removal algorithm
% Geometric ratio and arithmetic
%
% INPUT:
% idata -- input expressino dataset
% ireference -- refence id; column cevtor, values: 1,0
% ibatch -- batch label; column vector
% flag -- 1 for geometic mean, 0 for arithmetc mean (default)
% OUTPUT:
% odata -- data after remov... |
function varargout = StockFillGUI(varargin)
% STOCKFILLGUI MATLAB code for StockFillGUI.fig
% STOCKFILLGUI, by itself, creates a new STOCKFILLGUI or raises the existing
% singleton*.
%
% H = STOCKFILLGUI returns the handle to a new STOCKFILLGUI or the handle to
% the existing singleton*.
%
% ST... |
function gray_image = rgb_to_gray(input_image)
% Diese Funktion soll ein RGB-Bild in ein Graustufenbild umwandeln. Falls
% das Bild bereits in Graustufen vorliegt, soll es direkt zurueckgegeben werden.
[a,b,c]=size(input_image);
if c == 3
r = double(input_image(:,:,1)); %通道R
g = doubl... |
function [x] = AMP_chol(y, A, lambda, Rho, opts)
% function [x] = AMP_chol(y, A, lambda, Rho, opts)
% using cholesky decomposition
% Abar = [A, sqrt(lambda)*I]
% ybar = [y, zeros]
if nargin == 0
clc;
d = 10;
k = 50;
y = normc(rand(d, 1));
A = normc(rand(d, k));
... |
function u0 = advdiffic(x,pars)
u0 = [1-x; pars(2)*x]; %Kronecker delta IC
%u0 = [1; pars(2)*x];
%u0 = [1; pars(2)*x]; |
# Does the % of points scored by Lebron James in the 2020 playoffs help to predict the Laker's success?
# Using Lebron's share of points as x, Lakers +/- as y, use interpolation to determine relationship
# e.g. if he scores <10%, do the Lakers have negative values (losses?)
# or if he takes over too much, does it also ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.