text stringlengths 8 6.12M |
|---|
function [T, Power] = RangerMotor(omega, alpha, I, P)
%
% This function implements a slightly simplified version of the Ranger
% motor mode, as described in the appendix of the main Ranger paper.
%
% INPUTS:
% omega = (rad/s) rotational speed after gear box
% alpha = (rad/s^S) rotational acceleration after geat bo... |
function e = residual(me_psu_r1,me_psu_r2,me_psu_r3,me_psu_r4,me_psu_rr1,me_psu_rr2,me_psu_rr3,me_psu_rr4,pred_mes,i)
if i == 1
c = 1;
else
c = (i - 1) / 10 + 1;
end
y_k = [me_psu_r1() me_psu_r2 me_psu_r3 me_psu_r4 me_psu_rr1 me_psu_rr2 me_psu_rr3 me_psu_rr4]';
e = y_k(:,c)- pred_mes;
end |
% Kyle Tress
% Applied Math 491, Senior Project
% This script analyzes 72 million patched conic lunar trajectories and plots
% those with a perilune altitude between 499.5 and 500km.
function main
clc; clear all; close all;
% Constants
muEarth = 3.986012e5; % Earth gravitational parameter
muMo... |
% set all the parameters for the Observer
aa=45;
sd=15;
beta=1/sd;
gamma=0.3;
lambda=0.05;
PFfit=@PAL_CumulativeNormal;
x=linspace(1,180,180);
response=NaN(length(x),1000);
nsim=10000;
% simulate nsim stimuli per intensity of x
for xx=x
for i=1:nsim
response(xx,i)= ObserverResponseFunction(PFfit,a... |
b = 1;
b_mle10 = estimate_b(1, 10, 100000);
b_mle100 = estimate_b(1, 100, 100000);
b_mle1000 = estimate_b(1, 1000, 100000);
subplot(3, 1, 1)
histogram(b_mle10, 50)
title('b_{mle} for b = 1, n = 10; 100,000 iterations')
subplot(3, 1, 2)
histogram(b_mle100, 50)
title('b_{mle} for b = 1, n = 100; 100,000 iteratio... |
function [Ind,Dist]=cov2Ellipse(cov)
icov=inv(cov); % inverse covariance
[U,S,V]=svd(cov);
len=round(sqrt(S(1,1)))+2;
% inverse covariance kernel trick?
k=0;
for i=-len:len
for j=-len:len
t=[i,j]*icov*[i,j]'; % eigen vectors?
if t<=1
k=k+1;
... |
%This code contains the numerical experiments with the step adaptive RKMK method based on Dormand-Prince pair (5,4)
clc;
clear all;
close all;
%% Setting the parameters
% prompt = 'How many 3D pendulums do you want to connect?\n\n';
% P = input(prompt);
Prange = 2:2:20;
%Prange = 15
accVar = zeros(length(Prange),1... |
function [game] = incredibleUno(name, color, value, handColors, handVals)
% Given the color and number of the card on top of the discard,
% write a function that finds the best way to get rid of the most
% cards in your player?s hand and outputs the move.
% Here are the rules of this Uno game:
% ? The next p... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Wenan Chen
%% Sep 24rd, 2007
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% get the segmented image rotated to the place where the midline is the
%% center of the image
function [rotate_angle,center,choosing]=ct_coord(seg_img)
%% input: seg_img is the segmen... |
pos_known=[1;5;10]; %
val_known=[0;3;2]; %
V='1 Sph(.2)'; % Select variogram model
pos_est=[0:.1:10]';
[d_est_ok,d_var_ok]=krig(pos_known,val_known,pos_est,V);
options.mean=2;
[d_est_sk,d_var_sk]=krig(pos_known,val_known,pos_est,V,options);
options.trend=1;
[d_est_kt,d_var_kt]=krig(pos_known,val_known,po... |
function [S,thePath] = setupScript(S)
% setupScript
% This script loads the paths for the experiment, and creates
% the variable thePath in the workspace.
%% system specific info
[d hostname]=system('hostname');
switch strcat(hostname)
case 'dn0a223459.sunet' % Steph's macbook pro in lab
thePath.start = [... |
classdef nnsoftmax < nntest
properties (TestParameter)
h = {1 2 3}
w = {1 2}
end
methods (Test)
function basic(test,h,w)
d = 10 ;
n = 3 ;
x = test.randn(h,w,d,n)/test.range ;
y = vl_nnsoftmax(x) ;
dzdy = test.randn(size(y)) ;
dzdx = vl_nnsoftmax(x, dzdy) ;
tes... |
function S = horizontal_seam(I)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
energy = imenergy(I);
%M = zeros(size(energy, 1), size(energy, 2));
M = energy;
for i=1:size(energy, 2),
for j=1:size(energy, 1),
M(i, j) = energy(i, j) + min(M(i-1, j-1),M(i-1,j),M(i-1,j+1));
... |
function image = RectangleAreaOverlay(image, posx, posy, color)
% Image has been captured from left to right.
y_1 = fix (posx(1,1));
x_1 = fix (posx(1,2));
y_2 = fix (posy(1,1));
x_2 = fix (posy(1,2));
for i = x_1:x_2
for j = y_1:y_2
image(i,j,:) = color;
... |
function [Xnew, uNew] = uq_enrichSample( X, N, sampling, inpt)
% UQ_ENRICH_SAMPLE Enriches the current experimental design X by introducing
% N additional points.
%
% UQ_ENRICHSAMPLE(X, N) enriches the current experimental design X,
% defined by the currently selected input object by introducing N
% additional points
%... |
function [maxeigval,w] = ahp(A)
%A为判断矩阵
[eigvec,eigval] = eig(A);
eigval = diag(eigval); %特征向量
eigvalmag = imag(eigval);
realind = find(eigvalmag < eps);
realeigval = eigval(realind) %实特征根
maxeigval = max(realeigval) %最大特征值
index = find(eigval == maxeigval);
vecinit = eigvec(:,inde... |
function [cell, kappa, dist] = CellCurvature(cell, INIT_VER, flag)
% flag, 1: angle based, 2: spline based
if flag==1
a=cell.cell(:,1);
o=[1:cell.numb]';
b=cell.cell(:,2);
if INIT_VER==1
vec1=cell.pos(o,:)-cell.pos(a,:);
vec2=cell.pos(b,:)-cell.pos(o,:);
else
a(1)=1; b(... |
function [J, grad] = costFunction(theta, X, y)
m = length(y); % number of training examples
linear_regression = X * theta;
hypothesis = sigmoid(linear_regression); % The sigmoid function allows the output to be between 0 and 1.
if_positive_result = y; % Determines if the posi... |
function sig=cal_sigma_neighbor(Pnn,DD,knn)
D=DD.*(Pnn | Pnn');
D=sort(D);
B=sum(D~=0);
if sum(B>=knn)~=length(D)
ttt=1;
end
knn_ind=length(D)-B+knn;
for i=1:length(D)
A(i)=D(knn_ind(i),i);
end
sig=mean(A); |
function [ PSNR, MSE ] = getpsnr( A, ref, depth )
%获取两幅图片的PSNR
% 此处显示详细说明
max=2^depth;
Diff = double(ref)-double(A);
MSE = sum(Diff(:).^2)/numel(ref);
PSNR=10*log10(max^2/MSE);
end
|
% Add mexopencv lib
addpath 'D:\Project\Matlab\mexopencv'
% Parameters
% Input
SEQ_NAME = 'singer1';
IMG_DIR = sprintf('D:/Dataset/tracking/seq_bench/%s', SEQ_NAME);
GT_FILE_NAME = 'groundtruth_rect.txt';
detector = cv.BRISK();
gt_file_path = sprintf('%s/%s', IMG_DIR, GT_FILE_NAME);
gt_rects = importdata(gt_file_pat... |
%% Define Red Pitaya as TCP/IP object
clc
clear all
close all
IP= ''; % Input IP of your Red Pitaya...
port = 5000;
tcpipObj=tcpip(IP, port);
%% Open connection with your Red Pitaya
fopen(tcpipObj);
tcpipObj.Terminator = 'CR/LF';
flushinput(tcpipObj)
flushoutput(tcpipObj)
%% Generate
fprintf(tcpipObj,'G... |
load masks.mat
videos = [6519:6533, 6535:6548, 6550, 6568:6575, 6578:6584, 6586:6594, 6596:6616]';
videos(1:15, 2) = 1; videos(16:29, 2) = 2; videos(30, 2) = 3; videos(31:33, 2) = 4;
videos(34:38, 2) = 5; videos(39:45, 2) = 6; videos(46:54, 2) = 7; videos(55:60, 2) = 8;
videos(61:68, 2) = 9; videos(69, 2) = 10; videos(... |
function [] = MyPlotSettings(Selector,varargin)
hold('on');
if ((nargin == 0) || (isempty(Selector)))
Selector = 'axis'; % Default Selector
end
Level = InputLeveler(nargin,Selector); % Determine the run Level
Style = GetStyle(varargin); % Load plot style
% Impos... |
p1 = HOGKNN.predictFcn(testexample);
ctr1 = 0;
p2 = HOGCSVM.predictFcn(testexample);
ctr2 = 0;
p3 = HOGEnsemble.predictFcn(testexample);
ctr3 = 0;
for i = 1:46
if (p1(i, 1) == 0)
end
if (p2(i, 1) ~= 0)
ctr2 = ctr2 + 1;
end
if (p3(i, 1) ~= 0)
... |
function [offspring1,offspring2] = crossover(prob_cross,cross_method,parent1,parent2)
if strcmp(cross_method,'one-point')
sol = binornd(1,prob_cross,1,1);
if( sol == 1)
corte = round(rand(1,1) * parent1.number_weight);
for i=1:corte
... |
function [ I2, prom ] = Histograma( input_args )
% Operaciones con Histogramas
% Este programa prueba comandos de histogramas como ecualizacion a la vez
% que prueba una implementacion de operaciones mediante ciclos de los
% mismos comandos.
%Leemos nuestra imagen
I=imread('RMI2.jpg');
%creamos un vector para la f... |
%%%%%%%%%%%% REVISION NOTE %%%%%%%%%%%%%
% 2010.01.11 First dig-in,
% 2010.01.15 Method to find the Parameters for Plane was coded.
% 2010.01.18 Detection algorithm was coded.
% 2010.01.19 Method 1 was constructed.
% 2010.01.19 I got the serious problem about Method 1.
% 2010.01.20 2nd dig-in.... |
I = imread('OrangeFlower.jpg');
I = rgb2gray(I);
I = im2double(I);
% A flower has lots of edges, so we'll try getting subsection with the
% highest count of edges
figure;
% apply canny filter to get edges
Ic = edge(I, 'canny', [0.01 0.09], 0.5);
subplot(2, 2, 1), imshow(Ic), title('Canny Filter [0.01 0.09], 0.5')
% ... |
%Reset_MaskedSpace
reset_PD1;
m110dx( C_.STOP );
if(exist1('H.rasterfig')) close(H.rasterfig); H.rasterfig =[]; end
if(exist1('H.MaskedSpace_finalspikeratefig')) close(H.MaskedSpace_finalspikeratefig); H.MaskedSpace_finalspikeratefig =[]; end
%if exist1('H.pickerfig') clearspaceaxisCB; end
GUI.locations1 = []... |
format long;
a = 1; %finish
b = 0; %start
for i = 1:15
c = secantMethod(a, b);
disp(['i=' num2str(i)]);
disp([' x = ' num2str(c)]);
disp([' y = ' num2str(polynom(c))]);
b = a;
a = c;
t=c*(a-b)/(f1-f0);
k=t/(g1*g0);
disp([x1 f1 t k]);
if isnan(c) == 1
break
end
... |
% Clear the workspace
sca;
% Here we call some default settings for setting up Psychtoolbox
PsychDefaultSetup(2);
% Seed the random number generator. Here we use the an older way to be
% compatible with older systems. Newer syntax would be rng('shuffle'). Look
% at the help function of rand "help rand" for more infor... |
function [ TP FP FN TN pred_labels decision_vals] = doNN( numRaws, HidLay, rfold,fname )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
clear net;
net = patternnet(HidLay);
% net.layers{1}.initFcn = 'initwb';
% %net.layers{2}.initFcn = 'initwb';
... |
%**************************************************************************
%
% rec_fifo_single.m (c) Spectrum GmbH , 10/2015
%
%**************************************************************************
%
% Does a continous FIFO transfer and writes data to binary files.
% Afterwards the firs... |
%calculate the entropy of the original image
im=imread('lenna512.bmp');
outcome1=entropy(im);
disp('original image');
disp(outcome1);
%calculate the entropy of the image reduced the to the half size
fun = @(block_struct)mean(block_struct.data,'all');
img2= blockproc(im,[2 2],fun);
outcome2=entropy(uint8(img2... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Description: To mark the detected gazes upon the EOG and differentiated EOG.
%--------------------------------------------------------------------------------------------------------------------------------
% Used in: analyzetrain.m
%------------------... |
% GREENBERG+MLE
clear all;
close all;
clc;
if(matlabpool('size') == 0)
maxNumCompThreads(2);
matlabpool local 2;
end;
% prob_succ(p,n)
% prob_idle(p,n)
% prob_coll(p,n)
% prob_succ_cond_idle(p,n)
% batchsizes per il test
batchsizes=[1024];
% MLE batchsizes
b=2;
x=1:16;
MLEbs=b.^x;
clear x;
slots=ceil(lo... |
files = dir('Q:\EEG Meditation Lab\Meditation A Cable\');
files = files(10:end);
for file = files'
EEG = pop_biosig(strcat('Q:\EEG Meditation Lab\Meditation A Cable\',file.name));
% EEG = pop_resample( EEG, 256);
% EEG = pop_eegfiltnew(EEG, 0.5, 58.5, 1690, 0, [], 0);
EEG = pop_select( EEG,'channe... |
function [ eles ] = queryElevationPointsFromUsgsInChunks( ...
lats, lons, language, maxChunkSize)
%QUERYELEVATIONPOINTSFROMUSGSINCHUNKS Querry elevation data for input
%locations via the National Map - Elevation Point Query Service.
%
% More information can be found at https://nationalmap.gov/epqs/
%
% Inputs:
% ... |
function xcorsta3=st1isem(sinphi,cosphi,xsun,xmon,cosla,sinla,rmon,rsun,fac2sun,fac2mon)
%
% Function st1isem
% ==================
%
% This subroutine gives the out-of-phase corrections induced by mantle
% inelasticity in the diurnal band
%
%
% Sintaxe
% =======
%
% xcorsta3=st1isem(sinphi,cosphi... |
%%
%(1)
close all
load('nspeech.mat');
x=nspeech;
[X,w] = DTFT(x,0);
X=X/length(X);
plot(w,abs(X));
ylabel('Amplitud')
xlabel('\omega [rad]')
xlim([-pi pi])
%soundsc(x,fs);% es un SOL#6 (1661,22Hz)
%pause(3)
%w0=1.323;
%H=tf([1 -2*cos(w0) 1],[sin(w0) 0 0],1/fs);
%[y,t]=lsim(H,x);
%Filtro convolución con h
[y,t]=FIR_fi... |
classdef EntrustList<TEBase
%ENTRUSTLIST 委托记录,属核心类
% 潘其超,20140618,V1.0
% 潘其超,20140725,V2.0
% 1. 将eval表达式简化。
% 潘其超,20140729,V3.0
% 1. 加入了交易专用方法updEntrustItem
% 程刚,20140805,V4.0
% 1. 加入headers域,toTable,toExcel方法
% 潘其超,20140806,V5.0
% 1. delete headers, ELVecNames;
... |
pkg load symbolic
function resultado = newton(lista_puntos)
% Diferencias Divididas de Newton para resolver un problema de interpolacion
% :param lista_puntos: Los puntos deben ser ingresados en una lista, donde cada punto
% es una lista, donde la primera posicion es el x, y la segunda posicion es el y. [... |
function out_img = img_to_clipped_gray(in_img)
r_min = 1;
c_min = 151;
width = 448;
out_img = double(mean(in_img(...
r_min:(r_min+width-1),c_min:(c_min+width-1),:),3))/255; |
function [x, it] = bootstrap_derivativefree(inner_solver, target_alpha, v, R, tol, maxit, relative_speed)
% Calls an inner solver iteratively over increasing values of alpha
% Predicts the new x using extrapolation from the two previous values,
% essentially
if not(exist('tol','var')) || isempty(eps)
tol = sqrt(ep... |
function [s2n,signal,Noise] = snr(Z)
Nsig = length(Z);
meanZ=zeros(size(Z{1},1),Nsig);
noise=zeros(Nsig,1);
for i=1:Nsig
meanZ(:,i)=mean(Z{i},2);
[~,DistZ]=annquery(meanZ(:,i),Z{i},1);
noise(i)=sqrt(sum(DistZ.^2));
% noise(i)=mean(DistZ);
end
mmeanZ=mean(meanZ,2);
[~,DistmeanZ]=annquery(mmean... |
function krMonitorSaccades(handles)
warning off
% duration to collect data
dur = 0.9;
% get the daq
ai = handles.ai;
axes(handles.EyePosition);cla;
hold on
hEx = plot(zeros(ai.SampleRate*dur,1),'b','LineWidth',1.5);
hEy = plot(zeros(ai.SampleRate*dur,1),'g','LineWidth',1.5);
hSp = plot(zeros(ai.SampleRate*dur,1),'... |
file_path = 'C:\Users\Ali\Documents\ISML\MEA Data\20170622_400_1\';
io_intensity = [2, 1.5, 1.5, 1.75, 1.25, 1.5, 2.25, 2.5, 1, 0.75, 0.5];
io_file_num = [15, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27];
decimator = 100;
f_sampling = 25000/100;
electrodes_to_look = [63, 64, 65, 66, 67, 73, 74, 75, 76, 77, 84,85,86];
fo... |
% Create paired electrodes variable
% Check if appariment is good
function plot_channel_combination(net_name,path_name,ElecToHighlight)
if isempty(net_name); net_name='egi256_GSN_HydroCel'; end
if isempty(path_name); path_name='/media/Data/Work/Scripts/newSPM/projects/SleepLexicalDecision'; end
if nargin<3, ElecToHig... |
%
% Disciplina: Redes Neurais e Sistemas Fuzzy - INF01017U
% Professor: Prof. Engel
%
% Laboratório 1 - Sistemas de Inferência Fuzzy
%
% Grupo:
% * Luiz Gustavo Frozi de Castro e Souza
% * Pedro Henrique Frozi de Castro e Souza
%
% Instituto de Informática - INF
% Universidade Federal do Rio Grande do Sul - ... |
n=0:1:15;
a=sin(2*pi/4.*n);
b=sin(2*pi/8.*n);
%<-- calculate the dot product here
dp = a * b.';
display(dp);
|
clear
close all
path='\\ZebraNas\Public\Retina\WF_stimuli\211217\';
Tot = 300;
dt = 0.01; %100Hz
T = dt:dt:Tot;
tau = 0.5;
D = 1; % dynamical range
at = 60;
a2=[];ey=[];ey1=[];
saving=1;
L = zeros(1,length(T));
for i = 1:length(T)-1
L(i+1) = L(i) + (-L(i)/tau + randn*sqrt(D/dt))*dt;
end
cutoff=1;
corrtimef=[];
... |
function success = uq_PCE_test_arbitrary(level)
% success = UQ_PCE_TEST_ARBITRARY(LEVEL): non-regression test for the
% functionality of the 'arbitrary' option in PCE PolyTypes.
%
% What is tested:
%
% 1) it forces numerical integration of recurrence terms for known
% PDFs and understands and respects the bounds ... |
%Name:
% angleBetween
%
%Purpose:
% This method will be used to get the clockwise angle between the line
% segment created by startV and middleV, and the line segment created
% by endV and middleV
%
%Parameters:
% startV - (1 x 2) vertex to use for the first line segment
% middleV - (1 x 2) vertex t... |
function data = data_from_solution(eqns,y)
contact_position_fun = matlabFunction(eqns.contact_position.');
cm_position_fun = matlabFunction(eqns.cm_position.');
cm_velocity_fun = matlabFunction(eqns.cm_velocity.');
apex_position_fun = matlabFunction(eqns.apex_position.');
apex_velocity_fun = matla... |
function [labels]=plot_fuzzy(number_of_clusters, centers, U, data)
% Classify the data points.
maxU = max(U);
index = {};
for i=1:number_of_clusters
temp = find(U(i,:) == maxU);
index{i} = temp;
end
% Find data points with lower maximum membership values.
index3 = find... |
opts = odeset('RelTol', 1e-6, 'AbsTol', 1e-6);
[t, xODE] = ode45(@kepler, [0 2], [1 0 0 5], opts);
x = xODE(:,1);
y = xODE(:,3);
figure;
subplot(3,1,1);
plot(x,y);
xlabel('x [au]');
ylabel('y [au]');
title('Przetrzen fazowa');
subplot(3,1,2);
plot(t,x);
title('Polozenie x');
xlabel('t [lata]');
ylabel('x [au]');
subpl... |
%% Input data
L = 1.4; % [m]
M = 1; % [kg]
m = 3/4; % [kg]
b = 0.1; % [sec/m]
k = 0.15; % [N/m]
g = 9.81; % [m/s^2]
h = 0.01; % Step size
T_max = 100; % Simuation time
%% Initial values
x_0 = 0;
x_dot0 = 0;
x_dotdot0 = 0;
theta_0 = 0;
theta_dot0 = 0;
theta_dotdot0 = 0;
%% Input to K... |
function y=normal(x)
y=(1/(2*pi)^0.5)*exp(-x.^2/2);
|
function varargout = gui_image_analysis(varargin)
% GUI_IMAGE_ANALYSIS MATLAB code for gui_image_analysis.fig
% GUI_IMAGE_ANALYSIS, by itself, creates a new GUI_IMAGE_ANALYSIS or raises the existing
% singleton*.
%
% H = GUI_IMAGE_ANALYSIS returns the handle to a new GUI_IMAGE_ANALYSIS or the handle to
%... |
% r_base [3x1]
% Base position in world frame
|
% Es 16
% Given x(n) = rectangular pulse of width L, n in [0, L-1]
% Given y(n) = x(n)
% Compute z(n) as the linear convolution between x and y.
% Compute the cyclic convolution between x and y
close all
clearvars
clc
%% define signals
L = 6;
x = ones(1, L);
n_x = 0:L-1;
y = x;
n_y = 0:L-1;
%% convolve them linear... |
function [x1, dist] = SolverLevenbergMarq(z)
% This function solves the optimisation problem by using the
% Levenberg-Marquardt approach. The user inputs an images and the output
% is the coefficient vector and the error of the produced vector.
% Load the Zernike basis function library
load('ZernikeTest.mat'... |
function [G,Q,F,input_weight,bias] = elmjec(origdata,L, Red_dim,nclass,lambda,lambda2,num_hidden_neurons)
% G is the cluster indicator
% Q is the ELM output weights
% F is the cluster centroid vector
%%%%%%%%%%% Random generate input weights input_weight and biases bias (b_i) of hidden neurons
input_weight = r... |
function [F] = SH2017_LinearModel_DA_F(wave_number,t,modes,tildeQ1,tildeQ2,b1,b2,taur,tau1,tau2)
% Constants
% Characteristic Scales
T = 8; %hrs
L = 1500; %kms
c = 50; %m/s
p = 40000; %km circumference of the earth.
taul = taur;
tauv = taur;
% Time and Space parameters
% Define wave number
k = wave_number*2*pi*L... |
function [t_next, s_next] = rk4(dyn,t,s,param,dt)
k1 = dt * dyn(t,s,param);
k2 = dt * dyn(t+dt/2,s+k1/2,param);
k3 = dt * dyn(t+dt/2,s+k2/2,param);
k4 = dt * dyn(t+dt,s+k3,param);
s_next = s + 1/6*(k1+k2+k3+k4);
t_next = t + dt;
end |
% function to process single recording and build i-vectors for each channel
% to compare the channels to each other. much like how you would compare x
% speakers against each other, we're going to compare each channel against
% the other channels.
function set_c = processEDF(file_name, channels, segments, mel_window, ... |
clear
clc
A = [2 5 7 1 3 4];
odds = 1:2:length(A);
disp('odd values of A using predefined indices')
A(odds)
disp('odd values of A using anonymous indices')
A(1:2:end)
disp('put evens into odd values in a new array')
B(odds) = A(2:2:end)
disp('set the even values in B to 99')
B(2:2:end) = 99
disp('find the small values... |
% Copyright 2019-2019 The MathWorks, Inc.
function tests = rulesTest()
% Rules Test tests expected behavoir of .env config
% See https://github.com/motdotla/dotenv#rules
tests = functiontests(localfunctions);
end
function testTopComment(testCase)
% Tests that lines starting with # are skipped
% specifically tests fir... |
function alldatz = fwdvsrev_pfc_new(thisdir,label)
load(thisdir,[label '_replay_singlebothjoint'],[label '_Cand_sig_modu_include'], ...
[label '_PFCreplayspikes_binned'],[label '_PFCreplayspikes_list'],[label '_replay_shuffle_p']...
,[label '_replay_corr'],[label '_replay_dirbias'],[label '_replay_stnd']... |
function [rabbit] = RabbitPosition(rabbit, scene, config)
% Determine the direct distance the rabbit will travel
differenceX = scene.BURROW(1) - scene.RABBIT_START(1);
differenceY = scene.BURROW(2) - scene.RABBIT_START(2);
distanceEuclid = sqrt(differenceX^2 + differenceY^2);
if(config.SPEED_DECAY)
... |
% pub.m ------------------------------------------------------------
%
% All the other plt examples in the demo folder use plotting formats appropriate
% for data exploration (the main design goal of plt). However plt can also use
% formats appropriate for creating plots for publication. This script demonstrates
% this... |
function [ Data, pips ] = GetDataSet( iPair,iSet )
if iPair == 1
if iSet == 1
Data = load('EURUSD_15.csv');
pips = 0.0001;
elseif iSet == 2
Data = load('EURUSD_60.csv');
pips = 0.0001;
elseif iSet == 3
Data = load('EURUSD_D.csv');
pips = 0.0001;
end
elseif iPair ... |
function MakeParameterFile();
% Make parameter file to assess affect of integration time using incoherent distractors.
Name='IncohEffofIntTime';
% simulation parameters
sp.nSamplesFinal=10000;
sp.nSamplesInit=2000;
sp.DefaultStartSeperation=pi;
sp.dt=1;
sp.method='gdec';
sp.FFTcutfreq=500;
sp.nSpatialbins=8;
%Inp... |
function rfanalysis
normalize_plot = 0;
filename = 'C:\Users\Julia\work\data\140513\sn3.rec';
channels = [1:16];
refchan = 6;
for channo = channels
chans = readTrodesFileChannels(filename,channo);
refchannel = readTrodesFileChannels(filename,refchan);
chans.channelData = chans.channelData-refchannel.chann... |
function [counts, binCenters] = myhistcounts(x, numBins)
% MYHISTCOUNTS Returns bin centers not edges
if nargin < 2
[counts, bins] = histcounts(x);
else
[counts, bins] = histcounts(x, numBins);
end
binCenters = bins(1:end-1) + (bins(2)-bins(1))/2; |
function y = ds_mod(c,x)
%DSSS扩频 扩频序列_行=ds_mod(c=伪随机序列_行, x=输入信号_行)
%*************************************************************************************
% c ---> user code (列向量)
% x ---> input signal (行向量)
% y ---> temp = c*x, y = tmp(:) (直接扩频序列,列向量)
% 输入信号每一位和扩频序列相乘构成一列,再按照列输出矩阵~
%********... |
% This function concatenates two structures
function s=catstruct(s1, s2)
f2=fieldnames(s2);
for i=1:length(f2);
s1.(f2{i})=s2.(f2{i});
end
s=s1; |
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR
% Autores: Gonzalo Pajares y Jesús Manuel de la Cruz
% Copyright RA-MA, 2007
% Ejercicio 5.6: Suavizado y Realzado: media aritmética
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 5.11.2 Suavizado: filtros de medias
%%%%%%%%%%%%%%%%%... |
function [Amplitudes,Real,Imag,Phases,VoltageCell]=Get_Spice_Measurements(N,skipcurr,skipvolt,f,RESADC,fSample,subjectfile,Electrode_pos,Circuit_Electrodes,electrode_size,deskpath,Noise,NofSinePeriods,VADC,casetest,getcell,show_transient)
switch casetest
case 'Thoracic'
%confirm electrode size chars
... |
function R = octave_rescale(A)
a = 0.0;
b = 1.0;
inputMin = min(A(:));
inputMax = max(A(:));
% Regularize constant values to return lowerbound of output range
constReg = (inputMin == inputMax);
sigma = max(min(0,inputMax),inputMin);
inputMin = inputMin - sigma;
inputMax = inputMax - sigma;
e1 = nextpow2(max(abs(inpu... |
function [matrix] = dhtmtx(N)
%DHTMTX Summary of this function goes here
% Detailed explanation goes here
[k, n] = meshgrid(0 : N-1);
matrix = sqrt(1/N) * ( cos(2*pi/N*n.*k) + sin(2*pi/N*n.*k) );
end |
function handles = init_frame_imu(handles,collect_time)
%Tells the frame IMU to start recording data. Initiates a reset and self
%check on the IMU upon running. %Accepted times are 10 sec, 15 sec, 30 sec, 45 sec, 60 sec, 2 min, 5 min,
%and 10 minutes.
%Inputs:
%
% collect_time ---- the amount of time to collec... |
close all
clear;
addpath('lambda_dropout')
%rtype = 'img4doc';
p4 = importdata(['cufsf7_collect-4.txt']);
p5 = importdata(['cufsf7_collect-5.txt']);
p6 = importdata(['cufsf7_collect-6.txt']);
rec = linspace(0.1,1,10);
figure,
plot(rec,p4(:,1),'-o',...
rec,p4(:,2),'-*',...
rec,p5(:,1),'-+',...
rec,p5(:,2)... |
function save_annot_as_csv( annot_file, labels, skeleton_annotation )
%save_annot_as_csv( annot_file, labels, skeleton_annotation )
% Convert the annotations of Univ. Texas to csv, and write them to
% annot_file
%
%skeleton_annotation is an array whose lines are:
%Frame ID Body part ID Uncertain flag Left Top Widt... |
% 力矩AMS汇总
% 电机顺序为从右前方顺时针计数依次为1 2 3 4
clear
clc
figure_configuration_IEEE_standard
%% log中电机故障的序号具体查看README文档,日志是在飞行过程中直接记录的,不包括起飞的状态,只记录了故障过程中的数据
% 控制器中的耦合项补偿使用的是A_2(omega-omega_d)的形式
% 机体模型数据
c = (0.0166);
l = (0.125);
M = ([ 1 1 1 1;
-0.7071*l -0.7071*l 0.7071*l 0.7071*l;
... |
classdef MinimizationGradientMethod < handle
properties (SetAccess = private, Hidden = true)
funND % class function with expected methods
% funND.eval(x)
% funND.grad(x)
% funND.hessian(x) (UNUSED)
linesearch % quasi minimizzation with expected method
... |
function height = get_height_from_delay (delay, elev)
%GET_HEIGHT_FROM_DELAY: Get equivalent reflector height.
% Input:
% delay [meters]
% elev [degrees]
% Output:
% height_equiv [meters]
% vertwavenum [degrees per meter]
%height = gradient(delay, 2*sind(elev));
height = gradient_all(delay, 2*sind(elev));
e... |
function energyatend=midandreconstruct(Cellsin,numtoreconstruct)
h = evalin('base', 'h');
impulsesize=100;
[m,n]=size(Cellsin{numtoreconstruct+1});
Cellsin{numtoreconstruct+1}(m/2,n/2)=impulsesize;
outputcells=pydec(Cellsin,h);
[m1,n1]=size(outputcells);
energyatend=sum(outputcells{n1}(:).^2);
end |
clear all; close all; clc;
%% MBFY – 19.11. 2019
% Detect Cell Using Edge Detection and Morphology
% https://www.mathworks.com/help/images/detecting-a-cell-using-image-segmentation.html
I = imread('MSC-CMFDA-migrace-6h-23-1-2018.lif_Series011_t03_z2_ch00.tif');
imshow(I)
title('Original Image');
I = im2dou... |
%% Setup constants
data_path = 'E:\MEA Data\20170710_400_2-extra\';
file_num = [15, 47:52];
file_labels = {'No Stim', '2.5 V', 'No Stim', '0.9 V', 'No Stim', '0.3 V', 'No Stim'};
electrodes = [57]
%% Create Labels
labels = zeros(length(file_num), 100);
f = 1;
e = 1;
% for f = 1:length(file_num)
decimator = 10;
f_... |
function A = e_greedy(epsilon,Q_tab,S)
[r,c] = size(Q_tab);
options = zeros(1,c);
for i = 1:c
options(i) = i;
end
rng shuffle;
x = rand;
[argvalue, argmax] = max(Q_tab(S,:));
if x < epsilon
A = argmax;
else
options(argmax) = [];
rng shuffle;
y = rand;
index = floor(y*(c-1))+1;
A = options(i... |
function y=nextX(x)
y=x;
end |
%Polar Manchester
%If bit == 1 then y(from:mid) = +amplitude; y(mid+1:to) = -amplitude
%If bit == 0 then y(from:mid) = -amplitude; y(mid+1:to) = +amplitude
clc;
bits = [1 1 0 0 1 0 1 0 0 1 0];
bitrate = 1;
amplitude = 2;
%Encoding
T = length(bits)/bitrate; %total time to transmit all bit
n = 1000; %number of sam... |
function peaks = obtainPeaksLocation(y,class, parameter, Fs, pre)
if(pre) %Loads the sample used to detect packet boundaries
sample_variable = strcat('sampleC', num2str(class), "Text");
load('samples.mat', sample_variable);
overlap = 10000*12;
window = Fs*12;
else
overla... |
function y = universal_background_model( class,threshold,vaSet1,vaSet2,vaSet3,vaSet4,vaSet5,vaSet6,vaSet7,vaSet8,vaSet9,vaSet10,oT,mT,cT,oI,mI,cI )
%UNIVERSAL_BACKGROUND_MODEL Summary of this function goes here
% Detailed explanation goes here
disp('came here') ;
v11=vaSet1(1:71,:);
v12=vaSet1(72:153,:);
v13=vaSet1(... |
function [J, grad] = linearRegCostFunction(X, y, theta, lambda)
%LINEARREGCOSTFUNCTION Compute cost and gradient for regularized linear
%regression with multiple variables
% [J, grad] = LINEARREGCOSTFUNCTION(X, y, theta, lambda) computes the
% cost of using theta as the parameter for linear regression to fit the ... |
% % training SVM (using video 2)
run('BubbleExistanceClaasifier2.m');
run('BubbleTransitionClassifier.m');
close all;
vidNo = 3;
% detection
run('XCORR_detector_matrix_multiplication.m');
% tracking
[glo_cmdout,total_acc_bub_list_n] = XCORR_Algorithm1_LZhang( total_acc_bub_list,Wa,Ba,Wt,Bt );
% making video and l... |
% DECOMPOSEESSENTIALMATRIX - Given an essential matrix, compute the camera motion, i.e., R and T such
% that E ~ T_x R
%
% Input:
% - E(3,3) : Essential matrix
%
% Output:
% - R(3,3,2) : the two possible rotations
% - u3(3,1) : a vector with the translation information
function [R,u3] = decompose... |
%% Parameters
theta = 0.3;
n = 100;
m = 40000;
iterations = 200;
%% Algorithm
TRIALS = 5;
% NOISY: 0.2
times = zeros(TRIALS, 1);
errors = zeros(TRIALS, 1);
for t = 1:TRIALS
Q = randU(n);
X = randn(n, m).*(rand(n, m) <= theta);
Y = Q*X + 0.2 * randn(n, m);
tic
Q_hat = mspAlgorithm(Y, iteratio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.