text stringlengths 8 6.12M |
|---|
function [L,U] = swann(f,x0)
%----------------------------------------------------------------------------------------------
% Author: Hemanth Manjunatha
% Date: Oct-02-2015
%
% Function : swann.
%
% Purpose : Implements swann's algorithm to bracket the minima.
%
% Parameters : f-> Unimodal function, L-> ... |
function [ pix_prob ] = compute_pixel_probability(pixel_x,pixel_y,heats,sig, weight, detection_probabilities )
%[ pix_prob ] = compute_pixel_probability(pixel_x,pixel,_y,heats,radius )
% computes the probability of detection at a specific fire pixel.
% inputs
% pixel_x, pixel_y : location of fire pixel
% h... |
% mgstat_clean : clean up temporary files from visim, sgems
visim_clean;
sgems_clean;
|
%
% Copyright (c) 2018, Yunlong Wang
% All rights reserved. Please read the "license.txt" for license terms.
%
% This code is to demonstrate the PC-TC algorithm in comparison with other
% approaches.
%
% Project Name: PC-TC(v1.0)
%
% Contact Info: yunlong.wang.stud@outlook.com
%
close all;
clc;
clear;
... |
if ~exist('optgpu', 'var'),
error('define optgpu (0/1) and initialize with gpuDevice')
end
map_test = [];
fname = {};
% -----------------------------
% first layer pretraining
% -----------------------------
% [~, ~, map_test(end+1)] = flickr_img_l1(1,1:5,optgpu,1024,5,0.001,1,0.2,1e-5,1,300,100,0.005,2,1);
% f... |
function IsThere = CheckTFCol(PinX,PinY,Nodes,ValidMatrix,CheckWho)
% Check Col to search if exist "0xxx0" only for function ThreeFourCross
% Output: 1 if patern is found; 0 if no patern
if IsInRange(PinX-3,PinY,Nodes)&&(ValidMatrix(PinX-3,PinY)~=-CheckWho)
if IsInRange(PinX+1,PinY,Nodes)&&(ValidMatrix(PinX+1,Pi... |
boat = imread('boat256.jpg')
dome = imread('dome256.jpg')
subplot(2,4,1)
imshow(boat)
subplot(2,4,2)
boatH = myHistogram(boat)
subplot(2,4,3)
imshow(enhanceContrastPL(boat,2))
subplot(2,4,4)
myHistogram(enhanceContrastPL(boat,2))
subplot(2,4,5)
imshow(dome)
subplot(2,4,6)
domeH = myHistogram(dome)
subplot(2,4,7)
ims... |
function drawpoints (px, py)
hold on;
plot(px, py, 'g+');
|
load('C:\Users\Administrator\Documents\Paw_Point_Marking_Data\R0027\20140512\R0027Session20140512PawPointFiles.mat');
day = 3;
score = 1;
[all3dPoints] = RatDattoReal3Dpoints(RatData,score);
[sucessRate, failureRate,RatID,totalNumReaches] = getRatInfo(RatData)
[allCentroids,averagedCentroidsSuccess, euclidianDistDiff... |
function [] = plotFamilDiffs(firstRat, lastRat, folderName)
% analyze familiarity differences
% now called directly from create_sim
% currently, taking the maximum familiarity differences at each trial
% produces the set of most desirable results
% folderName must be a string (without / on either side)
% folderName ... |
%--------------------------------------------------------------------------------------------------
% alpha_plot_windows.m
%
% script used to add the values from particular windows in the tropics and plot the comparison
% of alpha from those windows with alpha from the rest of the tropics.
%
% use with:
% driver_ens... |
% TESTDS2
% Skript na testovanie zadaneho datoveho suboru MENO zadany v ULOZIT
% Ak su zadane parametre v poriadku, spusti sa FILTRACIA
%
% Copyright is with the following author(s):
%
% (c) 2012 Juraj Oravec, Slovak University of Technology in Bratislava,
% juraj.oravec@stuba.sk
% (c) 2012 Monika Bakosova, Slovak Uni... |
function [c1,c2,c3,c4] = stitching(im1, im2, T, plot, floors,color)
% Function to stitch two alligned images together.
% Note that the transformation image transforms the initial image such that
% its keypoints match that on the second image.
% Counting starts at the top left of the matrix/imag... |
I=imread(Image1.png');
I=double(rgb2gray(I));
F=makeRFSfilters;
[Left,Right]=CreateHalfMasks();
for count=1:size(F,3)
Id(:,:,count)=imfilter(I,F(:,:,count));
end
X=zeros(size(I,1)*size(I,2),size(F,3));
for count=1:size(X,2)
Y=Id(:,:,count);
X(1:size(X,1),count)=Y(:);
end
k=64; [idx,C]=km... |
function acc = ComputeAcceleration(v, r)
% volume of sphere
vSphere = 2/3 * pi * r^3;
% volume of cone
h = 2 * r;
vCone = 1/3 * pi * r^2 * h;
% gravity force
g = 9.8;
rhoWater = 998.2336;
mass = (vSphere + vCone) * rhoWater;
forceGravity = mass * g;
% air friction
rhoA... |
function [qs, qm, qmaps] = imageQualityIndex(x, y, ws, p, o1, o2, o3)
% Universal Image Quality Index for 3D images/arrays (m*n*z)
% 06/12/2012 - Version 1.0
% 09/12/2012 - Version 1.2
% 26/01/2013 - Version 2.2 - based on imfilter, precision option
% Author: Aristidis D. Vaiopoulos
% Def... |
% Berechnung der Regressionsparameter über Matrizengleichung
X = [ones(size(T)) RF T RF.*T RF.$\mathrm{\wedge}$2 T.$\mathrm{\wedge}$2];
bmat = inv(X'*X)*X'*Cp;
Cpres = Cp - X*bmat;
% Erstellen einer Matrix mit den neuen Beobachtungen
xneu = [];
for rf = 10:10:90
for t = 10:10:90
xneu = [xneu; [1 rf t rf*t ... |
function glmb= lmb2glmb(tt_lmb,H_req)
%express LMB in GLMB structure
rvect= get_rvals(tt_lmb); %vector of existence probabilities
costv= rvect./(1-rvect); %cost vector
neglogcostv= -log(costv); %negative log cost
[pat... |
function [re_predict_order]= test_replace(predict,real)
[val,~,i_b] = intersect(predict,real);
[~,iib]=sort(i_b);
real_order = val(iib);
re_predict_order = predict;
%subset order
j = 0;
for i = 1:length(predict)
if ismember(predict(i),val)
j=j+1;
re_predict_order(i) = real_order(j);
end
en... |
%hvmerge - issue 1.2 (21/04/2009) - HVLab HRV Toolbox
%----------------------------------------------------
%[outdata] = hvmerge (data1, data2, … dataN)
% Merge two or more data sets end-to-end
% outdata = name of new HVLab data structure containing the merged data.
% data1 = name of HVLab data structure co... |
function [F,A,D,Err] = eof225(X, bad, toler)
more off
% OBS: I MADE A SMALL MODIFICATION ON THE ROUTINE. I DISABLED THE COMPUTATION OF THE
% CORRELATION (BECAUSE WAS GETTING DIVISION BY ZERO). IT TRULY DOESN'T MATTER, SINCE
% THE ROUTINE IS SETUP TO USE THE COVARIANCE MATRIX TO COMPUTE THE EOF's. IF FOR SOME
% REASON ... |
function [ pop_index ] = greed_step( chrom_l, population, chromosome, inc_matrix )
%GREED_STEP Summary of this function goes here
% Detailed explanation goes here
N = size(population, 2);
population_size = size(population, 1);
temp_dists = zeros(population_size, 1) + 99999;
continues = 0;
for i = ... |
%%
% Gausse-Seidel method for solving load-flow problem
% By: Daniel Khashabi, December, 2010
%%
clc
clear all
% number of buses:
n = 6;
% Acive power:
P = [0.7 -2.4 3.2 -1.6 -2.4 6.0];
% bus voltages:
V = [1 1 1 1 1 1];
% type of buses:
% 1: PQ
% 2: PV
% 3: Slack
type = [2 1 2 1 1 3];
% Reactive... |
close all; clear all; clc;
%% Show the original image
img = imread('cameraman.tif');
img = mat2gray(img); % rescale the image values
figure(); imshow(img,[]);
[row, col] = size(img);
%% Create the blurred image
angle_r = 10/10000; % change it here
img_b = img;
for i = 1:(10/angle_r)
im... |
function [x,info] = spgSolver(funObj, funProj, x0, options)
%% Spectral projected-gradient solver for convex constrained problems
%
% [x,info] = spgSolver(funObj, funProj, x0, options)
%
% solves the convex constrained problem
%
% minimize funObj(x) subj to x in C
%
% where C is a convex set implicitly defined by ... |
function [status, v] = require(name)
%REQUIRE Check if a toolbox/package is available
%
% [status, v] = mexopencv.require(name)
%
% ## Input
% * __name__ name of toolbox/packge to check.
%
% ## Output
% * __status__ boolean result of test.
% * __v__ version struct.
%
... |
function plotreconst2(varargin)
temp = dir('*Ek*');
Ek=load(temp(1).name);
temp = dir('*Speck*');
Speck=load(temp(1).name);
% temp = dir('*frog*');
% fid=fopen(temp(1).name);
% settings = textscan(fid, '%s');
% fclose(fid);
% for ind1=1:length(settings{1})
% if strcmp('error',settings{1}{ind1})
% s... |
close all
clear variables
clc
%OS main
fs=20000; %Sampling frequency of acquisition.
acer=1;
%HPC, PFC, EEG FRONTAL, EEG PARIETAL.
channels.Rat1 = [ 46 11 6 5];
channels.Rat3 = [ 31 49 NaN 54]; %To confirm
channels.Rat4 = [ 37 34 NaN NaN]; %Two prefrontal. Right:29. Left:16.
%Two parietal: Anterior (5) , Posterior... |
function[v] = smooth(v,sigma)
%SMOOTH - smooths v by convolving with a gaussian box of radius r
if all(sigma)==0
vs = v;
return
end
if length(sigma)==1
s(1:ndims(v)) = sigma;
elseif length(sigma)==ndims(v)
s = sigma;
else
error('improper input for sigma')
end
R = ceil(2*s);
x1 = -R(1):R(1);... |
clc
clear all
close all
f0=150; % cutoff frequency
Q=35; % Q factor
[out, t, freqint] = plotATM('Subject00_1_edfm'); %reading the input EEG, the signal is stored in y
Fs = freqint(1); %sampling frequency that is stored in freqint is moved to Fs
figure()
subplot(3,1,1)
plot(t,out,'b') %plotting the input EEG ... |
clear all;
kinematyka;
Mp = 97;
Mk = 5;
Mc = Mp + 2*Mk;
L = 0.3;
d = 0.0000000001; % 10 miejsce
Rk = 0.075;
Iz = 6.609;
Izz = (Mk * d*d)/12 + (Mk*Rk*Rk)/4;
Ip = Iz + 2*Izz + 2*Mk*L*L;
M11 = Mc+2*Mk*L*L;
M22 = Ip/(L*L);
K = 100;
R = 5;
w = 1;
k1 = 1;
k2 = 1;
x0 = 0;
y0 = 0;
teta0 = 0;
figure();
plot(xd,yd);
hold... |
function [ A1, A2, A3 ] = mygrayscale( img )
% Summary of this function goes here
% Detailed explanation goes here
% lightness = (max(R,G,B) + min(R,G,B))/2
% avg = (R+G+B)/3
% luminosity = 0.21R+0.72G+0.07B
Red = img(1:end,1:end,1); %Creates three 2D arrays
Green = img(1:end,1:end,2);
Blue = img(1:end,1:en... |
%% Import data from text file.
clear all
filename = '~/github/econ_courses/econ241b/assts/asst5/prob_set5.csv';
raw = readtable(filename);
% NOTE: this is the same data as for asst 3; I did not save the Stata
% edits made for assignment 4.
%% set up data
% keep just public wages and drop the pubwage column
wage = r... |
function res = art(Xpoints,Ypoints,k,t,valeurX)
n = length(Xpoints);
m = k-1;
X = zeros(n,n);
Y = zeros(n,n);
X(:,1)=Xpoints;
Y(:,1)=Ypoints;
for i=(k+1:n+1)
if(valeurX<=t(i))
r = i-1;
break;
end
end
for j=(2:k)
for i=(r-k+(j-1)+1:r)
alpha = (valeurX-t(i)) / (t((i)+k-(... |
function exact_solution = Analytical(time, gravity, dragCoefficient, mass)
%Analytical SOLVES THE EXACT SOLUTION OF A GIVEN OBJECTS VELOCITY AT A GIVEN
%TIME
% THIS FUNCTION SOLVES THE REAL VELOCITY OF A MASS IN FREE FALL AFFECTED BY
% DRAG. THIS FUNCTION TAKES IN FOUR PARAMETERS: time WHICH DEFINES THE TIME
... |
clear all;
j = sqrt(-1);
seed = 200;
nS = 4;
nR = 4;
nT = 4;
dataSize = 1;
%LTE-A codebook
u=[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1;
-1, -j, 1, j, (-1-j)/sqrt(2), (1-j)/sqrt(2), (1+j)/sqrt(2), (-1+j)/sqrt(2), -1, -j, 1, j, -1, -1, 1, 1;
-... |
function [tf format num] = isDateStrCell(c, varargin)
% tf = isDataVecCell(c, ['fmat', fmat,] ['allowMultipleFormats', tf])
% returns true if every element of cell c is a date string (a la isdatevec)
% or is empty or NaN. if the date format is known, pass it as fmat
%
% allowMultipleFormats : require all dates ma... |
%曾鈺皓_0071035_Matlab簡介_作業6
clear;clc;clf;
figure(1)
%假設鹽度 S=0 時,?度範圍 1 < t < 30°C,壓力範圍 0 < p < 1000
%計算海水密度 ρstp 隨?度(T)及壓力的變化,並繪製成三維(T,P, ρstp)圖
subplot(2,1,1)
s1=0;
t1=linspace(1,30,100);
p1=linspace(0,1000,100);
[t11,p11]=meshgrid(t1,p1);
dense1=den_funct(s1,t11,p11);
surf(t11,p11,dense1)
xlabel('溫度(T)');ylabel('壓力(P)... |
%% Function to replace unused / similar dictionary atoms
function Dictionary = I_clearDictionary(Dictionary,W,Data,st)
if ~exist('st') % to show the dict convergence or not.
st = 1;
end
T2 = 0.99;
T1 = 3;
K = size(Dictionary,2);
Er = sum((Data-Dictionary*W).^2,1); % remove identical atoms
G = Dictionary'*... |
function [x,fval,exitflag,output] = trim_solve(trim_function, ...
InitialStates, ...
options, ...
LowerRotor_inteference, ...
Up... |
function [ schedule ] = a1_1( preparedTasks, m, n, initSchedule, startTaskIndex )
%Algorithm A1.1
schedule = {};
% sort initSchedule by escape times
queue = sortrows([ (1:m)' cat(1, initSchedule{:,3}) ], 2);
for i = startTaskIndex:n
currentTask = preparedTasks(i,:);
if queue(1,2) + currentTask(2) > currentTas... |
%% make h1, a sampled sinusoidal vector, with 8192 points, at freq pi/8...
ang = pi/8;
[x, y] = pol2cart(ang, 1);
lambda = x+(1i*y);
winsize = 64;
h1 = lambda.^(0:winsize-1);
%% h2 has inverted phase...
h2 = lambda.^(winsize/16:winsize+winsize/16-1);
h = [h1;h2];
H = fft2(h);
%% xfade is an angle from 0 - pi, descri... |
function fair(root, TI, TR, NAVGS, verbose)
%
%function fair(root, TI, TR, NAVGS, verbose)
%
% Computes perfusion map using Buxton's model
% for FAIR experiment
% uses the file Mot.dat, which was generated by
% t1_map.m
%
% magnitude data
%% Assumed constants %%%
if nargin==2
NAVGS=TI
end
lambda_T2 = 0.7;
T1... |
% Es 17
% circular convolution.
% Given x(n) = delta(n-2), defined for n in [0, 4]
% Given y(n) = [5, 4, 3, 2, 1], n in [0, 4].
% Compute z(n) as the linear convolution between x and y.
% Which is the support of z(n)?
% Compute the cyclic convolution between x and y.
% Try using matlab function cconv and check the re... |
function newsInfo = AnalysisNews(news,newsInfo)
%ANALYSISNEWS Summary of this function goes here
% Detailed explanation goes here
if nargin < 2 || isempty(newsInfo)
volatilityInfo = table((1:4)',nan(4,1),nan(4,2),'VariableNames',{'week', 'realizedVolatility', 'expectedVolatility'});
newsInfo.vola... |
classdef node
properties (SetAccess = public, GetAccess = public)
id
name
pos_x
pos_y
edges_in
edges_out
end
methods
function obj=node(tname,tpos)
obj.id = nan;
obj.name = tname;
obj.pos_x = tpos(... |
function [ q,vq,aq, tarray] = path_planning(tm, dt,qstates,constraints,viaPoints )
%Given a time, a set of states qstates, amd the
%constraints the function gives the trajectory (in configuration space) to
%achieve the points in the order they are given
%t_m = time to perform the maneuver from the first point to the... |
classdef trial
%trial should store the data of user's location, date, time as well as
%the raw solar data
%each discrete location should be it's own object, meaning that
%Example:
%mondavi_center=trial
%----Static Objects
%mondavi_center.location_name='Mondavi Center'
... |
% AUTHOR: Mohammad Mahdi Ghassemi, PhD Candidate,
% Department of Electrical Engineering and Computer Science,
% Massachusetts Institute of Technology
% ghassemi@mit.edu
% PURPOSE: This file takes EEG data and generates features that
% measure connectivity.
% INPUTS: x - a mat... |
function sgmga_write_tests ( )
%****************************************************************************80
%
%% SGMGA_WRITE_TESTS calls SGMGA_WRITE_TEST with various arguments.
%
% Licensing:
%
% This code is distributed under the GNU LGPL license.
%
% Modified:
%
% 20 June 2010
%
% Author:
%
% John Bu... |
function Experiment_intro1()
%% Third Party Dictator Game Script Ver 0.3
%% Configure Cogent
config_display(0, 4, [0 0 0], [1 1 1], 'Helvetica', 38, 28, 0); % Configure display (window mode, resolution, black background, white foreground, fontname, fontsize, nbuffers, direct mode)
config_keyboard; ... |
function [skupinky, Z] = seskup2(QRSm, vzdalenost)
% function SESKUP2 je zalozena na shlukove analyze
%
% skupinky = seskup2(QRSm, vzdalenost)
% QRSm - bunkove pole, co bunka to svod
% - kazda bunka obsahuje pozice nadetekovanych bodu v danym svodu
% vzdalenost - minimalni vzdalenos... |
function res = num_leaves(filepath)
addpath('./evaluation');
res = max(max(max(CondenseLabels(imread(filepath)))));
end
|
function est = sliding_window(xfm, d, Nt, t0, window)
% xfm is an object of the transform class
% d is measured data (output dimensions equal to size(xfm*imdata)
% Nt is the total number of projections in the data
% t0 are the centre points for each window
% window is the odd window size
switch xfm.mode
cas... |
clear;
close;
clc;
%case 1, base 1, any exponent
case1 = roots([1 -5 4])
%case 2, base -1, even exponent
two_root = roots([1 -5 6]);
pow_root= polyval([1 4 -60],two_root);
case2 = two_root(find(mod(round(pow_root),2)==0))
%case 3, any base, exponent 0
case3 = roots([1 4 -60])
%sum of roots
sum([case1' case2 case3'])
... |
%Oppgave 3a - Rekursive funksjoner
function outvar = minPot(a,n)
if n > 0
outvar = a*minPot(a,n-1);
else
outvar = 1;
end
end
%Oppgave 3b - Beskriv følgende funksjon
%function utvar = mysFunk(x,y)
%if y == 1
% utvar = x;
%else
% utvar = x + mysFunk(x,y-1);
%end
%x^y*x |
clear all;
clc;
debugmode=1;
%closeSerial;
%Roland Hall localzation
%ActualPos is where tag (plane) is inside of roland
%X ActualPos(1) is meters north of the center of roland
%Y ActualPos(2) is meters west of the center of roland
%Z ActualPos(3) is altitude in meters above the floor
%6 beacons spaced around roland... |
function varargout = main3(varargin)
% MAIN3 MATLAB code for main3.fig
% MAIN3, by itself, creates a new MAIN3 or raises the existing
% singleton*.
%
% H = MAIN3 returns the handle to a new MAIN3 or the handle to
% the existing singleton*.
%
% MAIN3('CALLBACK',hObject,eventData,handles,...) cal... |
clc;
clear;
startup();
imagePath = ["inputs/im01.jpg", ...
"inputs/im02.jpg", ...
"inputs/im03.jpg", ...
"inputs/im04.jpg", ...
"inputs/im05.jpg"];
totalImage = numel(imagePath);
images = cell(t... |
function X = simul2(n, cl1, cl2, p1, p2)
A = rand(1, n);
P1 = p1 * ones(1, n);
X = cl1 * (A < P1) + cl2 * (A > P1);
end |
function CL = claytonCL(theta,data)
% function CL = claytonCL(theta,data)
%
% The negative copula log-likelihood of a
% member of Clayton's family
% From Joe(1997), p141
%
% Friday, 29 Sep, 2000
%
% Andrew Patton
% INPUTS: theta
% data = [U V];
% Written for the following papers:
%
% Patton, A.... |
clear;clc;
syms x y theta_b dx dy dtheta_b real
syms dx_m dy_m dtheta_b_m real
syms w h m g real
q = [x; y; theta_b];
dq = [dx; dy; dtheta_b];
dq_m = [dx_m; dy_m; dtheta_b_m];
% Calculate interias
I = 1/12*((2*w)^2 + (2*h)^2);
M = [m 0 0
0 m 0
0 0 I]; % Since dq = [dx; dy; dtheta_b], Mbar is directly the gen... |
function fVal = fun4pro7(x)
% function for assignment 3 ; problem 7
fVal = 5+3 * cos(x);
end |
function [raw, image] = image_convert(image, type)
if isfield(image, type)
raw = image.(type);
return;
end;
switch (type)
case 'gray'
if isfield(image, 'rgb')
image.gray = rgb2gray(image.rgb);
end;
raw = image.gray;
case 'rgb'
if isfield(image, 'gray')
image.rgb = cat(3, image.gray, ima... |
% clear
% close all
% clc
load('pointcloud.mat')
myvals = whos;
fig = figure(1);
fig.Position(3) = fig.Position(3)*length(myvals);
fig.Position(4) = fig.Position(4)*2;
hold on
for n = 1:length(myvals)
figure(1);
subplot(2, length(myvals), n);
temp = eval(myvals(n).name);
pc = temp... |
function [cp,xlim,ylim] = waxecp(~,axe)
%WAXECP BUG for axes CurrentPoint property.
% M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 06-Feb-98.
% Last Revision: 20-Jul-2010.
% Copyright 1995-2010 The MathWorks, Inc.
% $Revision: 1.9.4.1 $
% We suppose that fig and axes use same units.
%-------------------------... |
function [env_csd, tfs_csd, env_psd, tfs_psd, input_env_psd, input_tfs_psd, freq] = getCSD(input_env, input_tfs, s, phi, NW, NFFT, psth_fs, estimate_psd)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
WINDOW = hamming(ceil(length(input_env)/3));
OVERLAP = .75;
if strcmp(es... |
x=0:0.01:2*pi;
y=cos(x);
plot(x,y);
xlabel('time');
ylabel('amplitude');
title('cosine wave form');
|
function [ self ] = fillQuoteL2( self, str)
% [ self ] = fillQuoteL2(l2_str);
% 从L2行情数据中构建QuoteStock
% 长度124, 第11个为字符串InstrumentStatus
% Data Sample:
% DataTimeStamp,DataStatus,SecurityID,ImageStatus,PreClosePx,OpenPx,HighPx,LowPx,LastPx,ClosePx,InstrumentStatus,NumTrades,TotalVolumeTrade,TotalValueTrade,TotalBidQty,We... |
r1= rand(100,1);
r2= rand(100,1);
z1 = zeros(100,1);
z2 = zeros(100,1);
for i=1:100
x1=1.*(r1(i)<=.33)+ 2.*(r1(i)>.33 && r1(i)<=.66) + 3.*(r1(i)>=.66 && r1(i)<1);
z1(i,:)=x1;
end
for j=1:100
x2=1.*(r2(j)<=.33)+ 2.*(r2(j)>.33 && r2(j)<=.66) + 3.*(r2(j)>=.66 && r2(j)<1);
z2(j,:)=x2;
end
... |
function [sac2,sac1] = C2_Easy(Images,options);
%function [sac2,sac1] = C2_Easy(Images,options);
%
%images must be either a cell array of images,
%or a matrix where each column is an image, wherin the original size parameter of options must be set
if(nargin < 2)
options = [];
end
d.OriginalSize = [81 81];
if(not(i... |
function [ CCLeftInCertainClique ] = DetectCCLeft(MinRiUE,whichCliquesUEIn,Allocation_matrix_c )
NumOfCC = size(Allocation_matrix_c,2);
AllCertainCliques = whichCliquesUEIn{MinRiUE};
CCLeftInCertainClique = zeros(size(whichCliquesUEIn{MinRiUE},2) , NumOfCC);
for i=1:1:NumOfCC
for j=1:1:size(whichCliquesUEIn{MinRiUE... |
# chest-xray: https://drive.google.com/file/d/1w50HQihj2ShD7blEALNkjHBKdCMAA5M1/view?usp=sharing
|
function homogeneous_points = homogenize( x )
%HOMOGENIZE Summary of this function goes here
% Homogenizes given points x by adding column of zeros
homogeneous_points = [x, ones(length(x),1)];
end
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CMPT 412 pencilfinder.m
% Ivy Tse
% Feb 1, 2016
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Code Citations
%
% Title: uigetfile
% Author: Matlab
% Date: 2015
% Availability: http://www.mathworks.com/... |
load classification_times.mat
avg = 1;
[val, wisardIdx] = min(mean(train_times(:, 6:end, avg)));
classifiers_indexes = [(wisardIdx+5) 2 3 4];
classifiers_names = {'wisard' 'svm' 'fisher' 'nbc'};
% only single trials
train_times = squeeze( train_times(:,classifiers_indexes, 4) );
test_times = squeeze( test_times(:,cl... |
function [dicom_ROI_sizes,corr_ROI_sizes,gated_ROI_sizes,var_all_sizes] = ReadOutROISize()
files_to_extract = uigetfile_n_dir();
number_of_files_to_extract = length(files_to_extract);
name={};
counter = 1;
for p=1:number_of_files_to_extract
name=files_to_extract{1,p};
filepath_dicom = strcat(name,'\mask_... |
%% Master file using Signs to compute fates
%% Add folders to path
addpath(genpath('Model'))
addpath(genpath('solvers'))
%% Load the parameters
% SetModelParam
%
global ModelParam
%%If using linear Noise approximation to compute initial condition run this part, otherwise skip
% %Time for initial condition:
% t0... |
% read_surfer_grid : Read Surfer ASCII GRD file
%
% CALL :
% [data,x,y]=read_surfer_grid(filename);
%
% IN:
% filename [char] :string
% OUT:
% data [ny,nx]
% x [nx]
% y [ny]
%
%
% Copyright (C) 2008 Thomas Mejer Hansen
%
% This program is free software; you can redistribute it and/or
% modify ... |
function autoreadwfm()
clearvars
close all
% auto recognizing the number of files to work on:
numf = dir('*.wfm');
numfil = size(numf,1);
tic
filetitle='mso64';
% 20,24 creats mat, file. 20,20 create wfm files
names=zeros(20,24);
wfm=numf;
wfmcell=struct2cell(wfm);
namcell=wfmcell(1,1:numfil);
%creatin... |
function yEER = Database5_3_MC
x = 0:2000:60000;
xq = 0:0.5:60000;
y0 = [0 0 0 0 0 0 0 0 0 0 0 0 0 0.0684211 0.173684 0.347368 0.536842 0.747368 0.894737 0.963158 0.984211 1 1 1 1 1 1 1 1 1 1];
yy0 = interp1(x, y0, xq, 'pchip');
y1 = [1 1 1 1 1 1 0.995 0.96 0.9 0.805 0.685 0.515 0.33 0.205 0.095 0.065 0.04 0.01 0 0 0 ... |
function varargout = fAESURFZ(varargin)
func = varargin{1};
switch func
case 'readline'
varargout{1} = readline(varargin{2},varargin{3},varargin{4});
case 'minRows'
varargout{1} = 1;
case 'maxRows'
varargout{1} = 1;
otherwise
error('invalid i... |
function sgmga_product_weight_tests ( )
%****************************************************************************80
%
%% SGMGA_PRODUCT_WEIGHT_TESTS calls SGMGA_PRODUCT_WEIGHT_TEST.
%
% Licensing:
%
% This code is distributed under the GNU LGPL license.
%
% Modified:
%
% 15 February 2010
%
% Author:
%
% ... |
function [comp_match, method_data] = ctapeeg_recudetect_blink_ICs(EEG, varargin)
%CTAPEEG_RECUDETECT_BLINK_ICS measures the effect of removing each blink-like
% IC from the original data by projection.
%
% Description: Similarity of each IC to the blink template
% is measured by eeglab_detect_icacomps_blinktemplate() ... |
clear all;
close_serial = instrfind; %close open serial connections
if(close_serial ~= 0)
fclose(close_serial);
end
s = serial('COM5');
set(s, 'BaudRate', 115200); %match baud rate with arduino setting
set(s, 'DataBits', 8);
set(s, 'StopBits', 1);
set(s, 'Parity', 'none');
fopen(s); ... |
function [PC_back,cycle_back,intmem_back,idatax_back]=MovDirToUnd(PC,cycle,intmem,idatax,promem,i)
intmem_back=intmem;
idatax_back=idatax;
%load PSW
PSW=loadPSW(intmem(209,1));
if (PSW(4,1)==0 && PSW(5,1)==0)
rn=intmem(i,1);
elseif (PSW(4,1)==0 && PSW(5,1)==1)
rn=intmem(i+8,1);
... |
function create_feature_matrices()
project_path = '/Users/burakonal/Desktop/edu/ee-58j/project';
fname = fullfile(project_path, 'attribute_data', 'apascal_train.txt');
[img_names_apascal_train, ~, bbox_apascal_train, ~] = read_att_data(fname);
fname = fullfile(project_path, 'attribute_data', 'apascal_te... |
function price=fare(distance,age)
price = 2;
roundDistance = round(distance)
if roundDistance > 1 && roundDistance <= 10
price = price + (roundDistance-1)*0.25;
elseif roundDistance > 10
price = price + 9*0.25 + (roundDistance-10)*0.10;
end
if age <= 18 || age >= 60
price = price - price * 0.2;
... |
function spfn = getUKBspfn( RSfolder, do_gaussianize, mask )
% GETUKBSPFN( data, do_gaussianize, mask ) obtains a function that
% generates fields from data.
%--------------------------------------------------------------------------
% ARGUMENTS
% Mandatory
% RSfolder the RSfolder you're working on/in
% Optional
... |
i = 8;
h = figure;imshow(img{i})
hold on;
ref{i} = [];
j = 0;
while (1)
[x,y] = ginput(2);
s = [x(1) y(1)];
e = [x(2) y(2)];
line([s(1) e(1)], [s(2) e(2)], 'Color',[0 0 1],'LineWidth',3);
ref{i}(s(1), s(2), 'g','.','LineWidth', 3);
ref{i}(e(1), e(2), 'r','.','LineWidth', 3... |
classdef LogisticRegression < BaseEstimator
properties
reg = 1E-2; % regularization
coef_; % coefficients
sample_weights; % weights for individual samples
end
methods
% constructor
function obj = LogisticRegression(params)
if nargin>0
... |
function w = LinearReg(X,y)
% this function computes the parameters given input and output
% varaibles
% to add ones for get the design matrix
phi = [ones(size(X,1),1) X];
% by least squares solution to estimate parameters
temp = pinv(phi'*phi);
w = temp * phi' * y;
|
%% the homework 1 for pattern recognition
% author: She Bin
% time : 2015-09-22
clc;
close all;
clear;
%% initial some constant param.
nSample = [1000, 1000]; % the number of training samples for each group
dim = 3;
coeff = {
[1.6 1.0; -1.5 1.0; 1.4 1.0;], ...
[-1.7 1.0; 1.6 1.0; -1.5 1.0;]}... |
%% Get file to analyze ***FOR NEW DATA
data_dir=uigetdir('C:\Documents and Settings\UrbanLab\Desktop\basic_code_2015_revamp Folder','Choose a data folder to import');
destination=uigetdir('C:\Data','Choose a folder to keep this data');
[pathstr,name]=fileparts(data_dir);
mkdir(destination,name);
new_dir=fullfile(dest... |
function [CNR photons] = spectrumCNR( spectrum, thickness, ltissue, lbone, lmetal )
% Compute attenuations lookup table for two sprectrums
materialsDir = 'physicsdata/materials/';
[E_tissue1, mu_tissue1] = readMaterialAttenuation('Adipose_Tissue_ICRU-44', materialsDir);
[E_tissue2, mu_tissue2] = readMaterialAttenu... |
function y0 = Hermite_interp(X, Y, DY, x0)
%X,Y是已知插值点向量序列
%DY是插值点处的导数值
%x0 插值点横坐标
%y0 为待求的分段三次 Hermite 插值多项式在 x0 处的值
%N 向量长度
N = length(X);
for i = 1:N
if x0 >= X(i) && x0 <= X(i + 1)
k = i; break;
end
end
a1 = x0 - X(k + 1);
a2 = ... |
%% 2021/1/20
% 创建一个包含车辆地面真实轨迹的驾驶场景。
% 使用IMU和视觉里程表模型生成测量值。
% 融合这些测量值以估计车辆的姿态,然后显示结果。
clear
%% 创建具有轨迹的驾驶场景
% 创建一个包含 道路/建筑物/车辆的地面真实姿势/车辆的估计姿势
% 车辆的地面真实姿态显示为蓝色长方体,估计的姿势显示为透明的蓝色长方体。
% 使用waypointTrajectory生成地面车辆的基线轨迹
scene = drivingScenario;
% groundtruth 真值
groundTruthVehicle = vehicle(scene, 'PlotColor', [0 0... |
mousedata = edfread("C:\Users\zhoujianf.UM-AD\Documents\Zihao\TBI_screws_F29.reduced.edf");
Fs = 512; %Set standard frequency
%hourOneDelta = [];
%hourOneNormal = [];
unfiltTotal = [];
%Notch Filter
wo=60/(Fs/2);
bw=wo/35;
[b,a]=iirnotch(wo,bw);
finalFiltered = [];
totalAmount = 86388;
epochNum.epoch(1);
... |
% this code is for the FSM on 126 CESR query. This the new technique of
% calculating the graph. Created/Modified on 18/6/2015
clear all;
clc;
load('CDP1_Old_Normalize_columnFeature_makeDoubleHeight.mat');
% allAccuracyArr = doAverageForAccuracy(allAccuracyArr3);
[allAccuracyArr,mytotarr] = cellToArrForPlo... |
function [motorRPM, current] = motorRPMAtSteadyLevelFlight(weight, numBatteryCells, numMotors, numArms, propDiameter, propPitch, targetSpeed, maxCurrent, isStacked)
% Find the max motor RPM and max speed
maxMotorRPM = lookupMaxMotorRPM(numBatteryCells);
maxSpeed = speedCalculator(weight, numMotors, numArms,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.