text stringlengths 8 6.12M |
|---|
function dpsi = dmpsi(x, fun, hfun, gfun, dfun, dhfun, dgfun, mu, lambda, sigma)
he = feval(hfun, x); gi = feval(gfun, x);
dhe = feval(dhfun, x); dgi = feval(dgfun, x);
dpsi = feval(dfun, x) + (sigma*he - mu) * dhe + (sigma*gi - lambda) * dgi;
|
classdef (Sealed) HebiPoseFilter
%HebiPoseFilter is a simple filter that uses accel and gyro measurements to estimate the pose
%
% This api is highly experimental and may change at any time.
%
% HebiPoseFilter Methods:
% setMaxAccelNormDev - max deviation from the norm
% ... |
function display_feeder_network(W,X,LOCATIONS)
total_locations = size(W,1);
try
load('LOCATIONS_IMG_XY');
% location_IDs, locations_XY;
catch ME
ME.stack;
error('Could not find coordinates file');
end
%
% try
% imshow('wytham_map.jpg');
% catch ME
% ME.stack;
% error('Could not find wytham... |
function [ rtn ] = getAP( i )
%GETAP retrieve latest apf107.dat
persistent JYs JMNs JDs iiaps IAPDAs IRs F107Ds F107_81s F365s ...
IYBEG IYEND IDEND IMEND s;
if isempty(JYs)
s = 'ftp://spdf.gsfc.nasa.gov/pub/models/iri/iri2012/apf107.dat';
fmt = '%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%.1f%.1f%.1f';
... |
function Exp4_plotParamFits(params)
%% Plot Experiment 4 parameters
paramMean=squeeze(mean(params,2)); % Session x parameter
paramStd=squeeze(std(params,[],2));
%% Plot random noise
figure('Position', [100, 100, 1249, 895])
set(gcf,'color','w');
hold on
lineStyle={':','--','-'};
markerStyle={'s','d','o'};
handles=[]... |
function Runge_Kutta_4to_orden
fprintf('\n \tMetodo RUNGE-KUTTA de ORDEN 4\n')
f=input('\n Ingrese la ecuacion diferencial\n','s');
x0=input('\n Ingrese el primer punto x0:\n'); %condici?n x inicial
x1=input('\n Ingrese el segundo punto x1:\n'); %condici?n x final
y0=input('\n Ingrese la condicion inicial y(x):\n');%co... |
close all;
clearvars;
%% set up simulation and rate constants
ints = linspace(0.1,1000,5);
for I=ints
ks = aj_constants_fun(I);
dydt = aj_simple_model(I, ks);
tspan = [0,1];
y0 = [0;0;0];
[ts, ys] = ode15s(dydt, tspan, y0);
%% Plot results
subplot(3,1,1)
plot(ts(:), ys(:,1))
hol... |
%{
pupil.EpochVonMisesSet (computed) # von mises tuning conditioned on
-> reso.TrialTraceSet
-> pupil.EpochTrialSet
-----
ndirs : tinyint # number of directions
nshuffles=10000 : int # numbger of shuffles for p-value computation
%}
classdef EpochVonMisesSet < dj.Relvar & dj.AutoPopulate
proper... |
% Calculate inertia matrix for parallel robot
% %RN%
% Use Code from Maple symbolic Code Generation
%
% Input:
% %INPUT_XP%
% %INPUT_QJ_P%
% %INPUT_LEGFRAME%
% %INPUT_KOPPEL%
% %INPUT_PKIN%
% %INPUT_M_P%
% %INPUT_MR_P%
% %INPUT_IF_P%
%
% Output:
% MA [%N_LEGS%x%N_LEGS%]
% inertia matrix in actuated joint coordinates
... |
function [gsd, answer, resp_time] = cued_approach(window, xCenter, yCenter, pahandle, go_inds, item, gsd)
inc_time = 0.017;
dec_time = 0.05;
should_ans = any(go_inds==item);
temp = imread(['./images/' num2str(item) '.png']);
temp=imresize(temp,0.5);
tex_temp=Screen('MakeTexture', window, temp);
tempLoc=[xCenter-size... |
function phcltp(varargin);
% phcltp( [...] );
% Temps Pump
h = timeplot({'IPMtT','IPmpT'}, ...
'Temps Pump', ...
'Pump', ...
{'IPMtT','IPmpT'}, ...
varargin{:} );
|
function [vector, state] = get_vector(obj, index)
% Returns the vector of an element of "track"
% check if index is valid
state = valid_index(obj, index);
% get vector
if state
vector = obj.track(index).get_vector();
return;
end % get vector
% function failed
vector =... |
function ret = cosTaylor(x, tol, kmax)
ret = 0;
k = 0;
while true
newTerm = taylorTerm(x, k);
ret = ret + newTerm;
if abs(newTerm) < tol || k > kmax
break;
end
k = k + 1;
end
end
function ret = taylorTerm(x, k)
ret = (-1)^k * x^(2*k) / factorial(2*k);
end |
function data_object = dataobject_AFNI_preprocess(data_object,nslices,order,ii)
% DATAOBJECT_AFNI_PREPROCESS
% Uses AFNI to pre-process DICOM files
%
% data_object = preprocess_Siemens(data_object,nslices,...)
%
% nslices is number of slices
%
% ... is AFNI parameters, which are optional
% order, ii
%
% Extract data
i... |
%% Artificial Neural Networks and other Learning Systems - Lab 2
%%
% 6 Function Approximation for Noisy Data
set(0, 'DefaultFigurePosition', get(0,'screensize'));
%% Setup and Loading
% Setup
clear;
rng(3); % 3 or 4 don't lead to a big dead unit
plotinit;
%%
% Load data and visualize it:
% * x(:,1) are angles
% * x... |
function c = correlation_report(c, av_correlation)
%
% NAME
%
% function c = correlation_report(c, av_correlation)
%
% ARGUMENTS
% INPUT
% c class basac_process class
% av_correlation vector vector of per-slice correlations
%
% OPTIONAL
%
% OUTPUT
% c class basac_process class
%
% DESCRIPTION
%
% ... |
%PLOT Feld
%Farboption
%MAP_0 = [0 0 1; 0 1 0; 1 0 0];
%Farboption
%MAP_1 = zeros (n,3);
%MAP_1 (1:n,1) = 1 - (1:n)/n;
%MAP_1 (1:n,2) = 1 - (1:n)/n;
%MAP_1 (1:n,3) = 1 - (1:n)/n;
%Farboption
%MAP_2 = zeros (n,3);
%MAP_2 (1:n,1) = 1 - (1:n)/n;
%MAP_2 (1:n,2) = 1 - (1:n)/n;
%MAP_2 (1:n,3) = 1 - (1:n)/n;
figure(1);
... |
function stimExpt = createStimTasks(stimExpt)
%% Delete tasks if previously existed
deleteStimTasks,
%% Set parameters
sHz = stimExpt.sHz;
stimBoardID = 'ExtGalvoUSB';
ctrChanID = 0;
frameClockSrcTerm = 'PFI0';
dividedClockOutTerm = 'PFI1'; % leave empty if exported signal is not needed
stimBoard2 = 'si4-2';
divid... |
function struct2var(S,varargin)
% This function takes struct 'S' and creates variables using its field names and field values
% Optional argument: workspace name in which the variables are assigned to.
if nargin==1
wspace = 'base';
else
wspace = varargin{1};
end
names = fieldnames(S);
for ind1=1:leng... |
function [p,w] = int2d_radon7()
% function [p,w] = int2d_radon7()
%
% Returns the points (p) and weights (w) of J. Radon's 7-point
% integration formula for the triangle with vertices (0,0), (1,0), (0,1).
% This formula is exact for polynomials up to degree 5.
% Points are the rows of p.
%
% Reference: J. Radon, Zur me... |
function [ ] = plot_on_ace_clim_latlev_pcolor( climdata_in, title_in )
%A function to plot the climatology data for ACE. The function uses
%'pcolor'.
%
% *INPUT*
% climdata_in: ARRAY - the data to be plotted. It should be on a
% grid that matches the lat x alt grid of the climatology data
% ... |
% This script explores two different transfer functions in Matlab.
% The tf() function and the zpk() function. We use different example
% functions to demonstrate the difference between the two.
clc;
clear;
num1 = [30 -180];
den1 = [1 4 13 7];
G1s = tf(num1, den1)
zpk(G1s)
num2 = [1 0 1 1];
den2 = [1 1 0 6];
G2s = t... |
function value = lambda_sampling_2(k, n_folds, n_iter)
lambdas = zeros(1, n_iter);
for i = 1 : n_iter
Ind_perm = randperm(k.n_el);
val_temp = fminbnd(@(lambda) cross_validation(lambda, ...
k.pots(:, k.image), k.K_pot, n_folds, Ind_perm), 0, 1, ...
optimset('TolX',1e-12));
... |
%
% Linear space-time receptive field
%
cd /home/brian/book/05retina/fig/subStReceptiveField
x = [1:128];
x = x - length(x)/2;
center = mkGaussKernel(size(x),[1 4]);
surround = mkGaussKernel(size(x), [1 24]);
dog = center - .5*surround;
dog = dog / mmax(dog);
%
% Now make the model receptive field output for linear a... |
function stimExpt = genExpt(StimROIs,trials,repeats,ITI)
% Function to generate a stimulation experiment from
%
% stimExpt = genExpt(StimROIs,trials,repeats,ITI)
%
% StimROIs is the output of roiSelector GUI
% trials is a 1xn structure of trial structures
% repeats is a positive number indicating number of stim trials ... |
% Process the output data of Leap C++ project.
% LI ZHEN, March 17th, 2014.
% fid = fopen('toolResult1.csv', 'w');
% fprintf(fid, 'id, mean, totalTime(us)\n');
for i = 10:12
filename = sprintf('FingerMove%d.csv', i);
% time id1 x1 y1 z1 id2 x2 y2 z2 id3 x3 y3 z3
mat = csvread(filename, 1, 0);
% figure... |
function orionlyanalysis_SU_allcells
animalid = '150916';
block = 3;
lcol = 'r';
onlymod = 0;
printyn = 0;
sfc = 1;
basepath = ['C:\Users\Julia\work\data\' animalid '\'];
supath = [basepath 'singleunits\'];
basename = [animalid '_block' int2str(block) '_tet'];
if printyn
% if ~exist([basepath, 'pdfs/'],'dir'),... |
function fig = ghclqclistat(varargin);
% ghclqclistat(...)
% QCL Istat
ffig = ne_group(varargin,'QCL Istat','phclqclistatsn','phclqclistats','phclqclistaterr','phclqclistatfifodep','phclqclistatflash','phclqclistatmode','phclqclistatrw','phclqclistatstatus','phclqclistatskip');
if nargout > 0 fig = ffig; end
|
clear all
%% Read Image from Website
% url = 'http://heritage.stsci.edu/2007/14/images/p0714aa.jpg';
% rgb = webread(url);
% whos rgb
% rgb = imresize(rgb,0.4);
% imshow(rgb)
%% Read Data from Web Service API
% api = 'http://climatedataapi.worldbank.org/climateweb/rest/v1/';
% url = [api 'country/cru/tas/year/USA'];... |
# Octave 6.2.0, Thu May 06 17:57:34 2021 GMT <unknown@DESKTOP-0RPDSAD>
n = [-0.4 -0.2 0 0.2 0.4 0.6 0.8]
x = [1 3 2 2 2 1 0]
h = [0 1 0 -1 1 -1 0]
conv(x,h)
stem(ans)
n2 = linspace(-0.6, 2.2, 13)
stem(n2, ans)
|
function [multitimes,multiindx]= Multiindex (hmain,g,sortchannels,mchidx);
% nfiles=size(g.spikefiles,2);
nfiles = size(g.snipfiles, 2);
%Load in spike times
sptimes=cell(1); sptimes{1}=cell(1,nfiles);
for fnum=1:nfiles;
% [sptimes{1}{fnum},hdr]=LoadSnipTimes(g.spikefiles{fnum},sortchannels(1));
[~, sptimes{1}{fnu... |
function[] = im3write(im3,fname,imtype)
%IM3WRITE - stores a 3d image as a set of 2d images
if nargin<3
imtype = 'tif';
end
for i=1:size(im3,1)
im = squeeze(uint8(im3(i,:,:)));
if i==1
writemode = 'overwrite';
else
writemode = 'append';
end
imwrite(im,fname,imtype,'WriteMode',wr... |
%{
MIT License
Copyright (c) [2016] [Mallory Ann Jensen, jensenma@alum.mit.edu]
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... |
function newP=randPoint(currentP,stepSizeHorizen,stepSizeVertical,oldP)
alpha = 2*pi*rand;
newP = currentP + [stepSizeHorizen*cos(alpha),stepSizeHorizen*sin(alpha), 0];
if rand<0.7
newP(:,3) = oldP(:,3);
else
deltaH = (2*rand-1) * stepSizeVertical;
newP(:,3) = oldP(:,3) + deltaH;
end
|
function Z =epe(N,V) %this function computes the ENERGY PACKING EFFICIENCY
Ndiag=zeros(1,N);
Nw=0;
Dw=0;
for i=1:N
Ndiag(i)=V(i,i);
end
Ndiag_max=max(Ndiag);
for i=1:N
Dw=Dw+Ndiag(i);
if(Ndiag(i)>0.05*Ndiag_max)
Nw=Nw+Ndiag(i);
end
end
Z=Nw/Dw;
end
|
%% get_n
% get number of entries in taxa
%%
function [n_taxa, taxa] = get_n(taxa)
% created 2021/08/13 by Bas Kooijman
%% Syntax
% [n_taxa, taxa] = <../get_n.m *get_#*>(taxa)
%% Description
% Writes html table with number of AmP entries
%
% Input:
%
% * taxa: cell string of names of entries
%
% Output:
%
% * n_taxa:... |
function measure = FMT( data,name,sm,rdm,target_data,ratio)
% preprocess target data
[Xt,Yt,~,~] = preprocess_target(target_data,rdm,ratio);
source_metric = sm;
source_data = data;
source_name = name;
% feature selection for source data
source_data = FeatureSelection(source_data,source_name,source_metric);
% no... |
clear; clc; close all;
%% 预分配内存
PRE_RECEIVE = zeros(816, 27 * MacroDefine.DATAPACK_NUM);
PRE_DATAPACK = zeros(816, 1);
PRE_XYZPOINTS = zeros(6400, 3 * MacroDefine.DATAPACK_NUM);
PCDPLAYER = pcplayer(MacroDefine.PCD_PLAYER_X, MacroDefine.PCD_PLAYER_Y, MacroDefine.PCD_PLAYER_Z);
gridStep = 0.01;
%% UDP初始化
obj_ce30 = udp_... |
img=imread('TP05I01.bmp');
img=rgb2gray(img);
imshow(img); |
% Image Processor Class: IPEpitheliumSurface < SYObject.
% Written by Satoshi Yamashita.
classdef IPEpitheliumSurface < SYObject
properties(Constant)
rodRadius = 1;
end
methods(Static)
function result = epitheliumSurface(image,normal,cellDiameter, ...
threshold,direction)
% Class method to draw a depth m... |
cla, close all
M = 0.5;
m = 0.2;
b = 0.1;
I = 0.006;
g = 9.8;
l = 0.3;
p = I*(M+m)+M*m*l^2; %denominator for the A and B matrices
A = [0 1 0 0;
0 -(I+m*l^2)*b/p (m^2*g*l^2)/p 0;
0 0 0 1;
0 -(m*l*b)/p m*g*l*(M+m)/p 0];
B = [ 0;
(... |
function [cellmap] = createObjMap(inputImages,varargin)
% Creates a cellmap from a ZxXxY input matrix of input images.
% Biafra Ahanonu
% started: 2013.10.12
% inputs
%
% outputs
%
[cellmap] = ciapkg.image.createObjMap(inputImages,'passArgs', varargin);
end |
% 以轨道根数elem为初值,按照二体运动绘制一个轨道周期的三维诡计
function rv = plotorbit(elem)
Color=rand(1,3);
while all(Color>0.4)
Color=rand(1,3);
end
rv = zeros(361,6);
for M = 0:1:360
elem(6) = M*rad;
rv(M+1,1:6) = kepler2cart(elem);
end
plot3(rv(:,1),rv(:,2),rv(:,3),'color','k'),grid on,hold on; |
function [ avgDelay ] = getAvgDelay( K, gamma, p )
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
avgDelay = 0;
for k = 1:K
if gamma(k) > 0
avgDelay = avgDelay + p(k) * ceil(1/gamma(k));
else
% avgDelay = avgDelay + p(k) * D;
end
end
end
|
function result = FWalg (A)
%FWalg: This function implements the Floyd-Warshall Algorithm.
% It takes an adjacency matrix A, representing the network G.
% It outputs the matrix D, which is a matrix of the shortest path
% between the nodes of G.
% The original/inputted matrix is just the matrix of
% distances... |
%% variable info that contains all the information about
% (1) structure on the dataset
% (2) default model parameters
%% information on study
info.nG = 4; %number of groups
info.nrawS = 128; %number of subjects tested
info.nOut = 4; ... |
function [S,Pn_Fs,SNR_out,noise] = setSNR(S,SNR,Fs,Rs)
% Last Update: 08/11/2019
%% Input Parser
if isnumeric(SNR)
SNR_tmp.SNRout_dB = SNR;
SNR = SNR_tmp;
end
if ~isfield(SNR,'SNRin_dB')
SNR.SNRin_dB = Inf;
end
%% Input Parameters
[nPol,nSamples] = size(S);
SNRout = 10.^(SNR.SNRout_dB/10);
SNRin = 10^(S... |
for i = 1:38
CheckChrom = Dec2Bin(NewChrom(i,:),M,N);
spy(reshape(CheckChrom,10,10));pause
end
|
function output=grayrela(x0)
%参考因子与比较因子共同存储在一个矩阵x0中,参考因子位于第一列
%斜率序列
x1=zeros(size(x0));
for i=2:length(x0(:,1))
x1(i,:)=x0(i,:)-x0(i-1,:);
end
%标准化
x2=zeros(size(x0));
m=length(x1(1,:));
for i=1:m
x2(:,i)=x1(:,i)/std(x1(:,i));
end
%排序
[~,pos]=sort(x2(:,1));
x2_sorted=x2(pos,:);
% 判定关联性... |
%[2015]-"The ant lion optimizer"
% (9/12/2020)
function ALO = jAntLionOptimizer(feat,label,opts)
% Parameters
lb = 0;
ub = 1;
thres = 0.5;
if isfield(opts,'T'), max_Iter = opts.T; end
if isfield(opts,'N'), N = opts.N; end
if isfield(opts,'thres'), thres = opts.thres; end
% Objective function
... |
function new_vect = feature_operation_joined_binary_with_interaction(Y1, Y2)
%Y1 and Y2 expected to be nx1, with values ranging from 1 to 10
%new_vect = is Nx(10+10+100)
%eg if Y1(1) = 4 and Y2(1) = 7, indices 4, 17, and 67 (20+30+6+1 = 57) new_vect
new_vect = sparse(numel(Y1),120);
for n = 1:numel(Y1)
new_vect(n,Y... |
function con2 = NMI_norm (con)
% function con2 = NMI_norm (con)
% function for normalizing the NMI blocks
[m, n] = size (con);
mean_c = mean (con, 1);
mean_r = mean (con, 2);
std_c = std (con, 0, 1);
std_r = std (con, 0, 2);
mean_r = repmat (mean_r, [1, n]);
mean_c = repmat (mean_c, [m, 1]);
std_c = repmat (std_c, [... |
function [skin_mu, skin_sig, nonskin_mu, nonskin_sig, theta, skin_test, nonskin_test] = TrainSkinClassifier()
skin_d = load('skin_pixel_data.mat');
nonskin_d = load('nonskin_pixel_data.mat');
% cast all data to double and divide by 255.0
skin_train = double(skin_d.skin_pixs_train) / 255.0;
skin_val = double(skin_d.sk... |
clc;clear;close all;
% Shivani Dhok
% Date: January 10, 2019
% Digital Image Processing
% Program for: Read an Image and perform compression by Bit Slicing by
% using CompressBitSlicing_SGD();
I = imread('lena2.png');
DispAll = 1; % Want to display the images
% DispAll = 0; ... |
function extend(A,Nr,Nl)
end |
function Y = uq_runge( X )
% UQ_RUNGE is an implementation of the Runge Function. Simple function that
% is used for testing 1D metamodelling.
%
% See also: UQ_KRIGING_TEST_EXPDESIGNS, UQ_KRIGING_TEST_TRENDTYPES
I = ones(size(X)) ;
Y = (I + 25* X.^2).^(-1) ;
|
function s = waveout(str,field)
% WAVEOUT produces output waveguide coordinates for AWG structure
% FIELD='A','X' or 'Y' for angles, x coordinates or y coordinates, respectively
% SF, April 27 2007
if nargin < 2
field = 'A';
end
s = [];
switch field
case 'A'
N = length(str.calc.outang);
if N > 0
... |
function [antphc antphc1 antphc2]= ...
antphasecenter(apc,recxyz,recllh,satxyz,elvang,cst,prn)
%
% Function atphasecenter
% ======================
%
% Computes the antenna phase center offset/variation correction
%
% Sintax
% ======
%
% antphc=antphasecenter(apc,recxyz,satxyz,elvang)
%
% In... |
a=[3;4;5;7];
b=3*ones(size(a));
a==b; |
function plot_mat = Data_extraction(cell_data, sen_id)
%UNTITLED18 此处显示有关此函数的摘要
% 此处显示详细说明
[c_row, c_col] = size(cell_data);
[m_row, m_col] = size(cell_data{1,1});
[s_row, s_col] = size(sen_id);
dim_vec = c_row * m_row;
% x_coor = [1:dim_vec]; This should be the time
plot_mat = zeros(s_row,dim_vec);
for i = 1:1:... |
clear
res = load('results.mat');
results = struct();
results.results = res.results(3);
sx = size(results.results);
hrs = 501;
samp = 501;
Tsamp = 1;
slt = .84;
Ce = zeros(sx(2), hrs);
Ca = zeros(sx(2), hrs);
Cz = zeros(sx(2), hrs);
D = zeros(sx(2), samp);
T11 = zeros(sx(2), samp);
T12 = zeros(sx(2), samp);
T21 = ze... |
function [] = monitor(data, mode)
size = length(data);
results(1) = 0;
resultsindex = 1;
flag = false;
oneslength = 0;
for i = 1:1:size
if data(i) == mode
flag=true;
oneslength = oneslength + 1 ;
else
if flag==true
flag=false;
results(resultsindex) = oneslength;
... |
function [x] = tema22 (w,Ts,M)
t = 0:M;
xa = sin(w*t);
for i = 1 : M
x(i) = xa(i * Ts);
end
end
% ESANTIONARE = discretizarea variatiei in timp a semnalului
% x[n] = xa (nT)
% unde x[n] este semnalul discret obtinut prin retinerea valorilor
% semnalului analogic xa(t) la fiecare T secunde.
% Intervalul de timp T... |
function output = mysinc (input)
% The mysinc function computes the sinc function.
% sinc(input) returns a matrix with elements that are the sinc of input
% Initialize the output to all ones
output = ones(size(input));
% Find the indices of all the elements in input
index = find(in... |
function Inew = img_shift(I, dx, dy)
% This function performs 2D shifting of a periodic signal first by shifting
% the coordinates in the x direction, followed by shifting the coordinates
% in the y direction.
[m, n] = size(I);
for i = 1:m
I(i,:) = shift_scale(I(i,:),dx,1);
end
for j = 1:n
I(:,j) = shift_sc... |
function [scale,gravity,bias] = ...
estimateScale(A,b,scale0,gravity0,bias0,t)
% Estimation is performed in the frequency domain
fprintf('%s', repmat('-', 1, 60));
fprintf('\nFinal estimation in the frequency domain\n');
tic;
% Select valid range of frequencies [0Hz - 1.2Hz]
N = length(t);
fmax = 1.2;
... |
%
clear;close;clc;
img = imread('coins.png');
imshow(img);
improfile(); |
function [nodes, cells] = HexMesh(l, h)
%% HexMesh
% Use: Creates a regular hexahedral mesh in 3 dimensions.
%
% Syntax: [nodes, cells] = HexMesh(l, h)
%
% Input:
% l - The edge size, format: [1 x 1]
% h - The mesh spacing, format: [1 x 1]
%
% Output:
% nodes - Node coordinates, format: [n x 3] where n the number... |
%% NMPC SOLVER SETUP
% nmpc_setup: This function generates an NMPC solver using Acado
%
% Solver setup of NMPC for Fixed-Wing Airborne Wind Energy
% Generates C code of the RTI-scheme solver.
%
% Manuel Dangel, ETH Zurich, 2018
%
% Copyright: This is published under BSD licence
clear all
acadoSet('problemname', 'awe_... |
%#codegen
function [ ] = Serial_println( str_Text)
coder.allowpcode('plain')
tempStr = coder.opaque('char*','(char*)calloc(sizeof(char*),17)');
str = coder.opaque('char*','"%-16s"');
str2 = coder.opaque('char*',['"' str_Text '"']);
coder.ceval('sprintf',tempStr,str,str2);
coder.ceval('Serial.pri... |
classdef Np755GlmDirectorDecorator < mlanalysis.Np755GlmDirectorComponent
%% NP755GLMDIRECTORDECORATOR maintains a reference to a component object,
% forwarding requests to the component object.
% Maintains an interface consistent with the component's interface.
% Subclasses may optionally perform a... |
function Hd = Butter(bottom,top)
%RANDOMBUTTER1 Returns a discrete-time filter object.
% MATLAB Code
% Generated by MATLAB(R) 9.4 and DSP System Toolbox 9.6.
% Generated on: 11-Jul-2019 20:19:43
% Butterworth Bandpass filter designed using FDESIGN.BANDPASS.
% All frequency values are in Hz.
Fs = 16000; % Sampling F... |
function MatrixResults = doQNRindsSens0FR(imageDataFile,FRRestImage)
% the obtained results are quantitatively evaluated using QNR measures.
% and stores the results in a .mat file into ../Sensors/results folder.%
% input arguments:
% imageDataFile mat filename with the ME and Pan
% ... |
clc, clear all, close all
tau_0 = 10;
sigma = 2;
x = linspace(-1,1,100);
p = (1-exp(-tau_0./(1+x.^2*sigma)))./(tau_0./(1+x.^2*sigma));
plot(x,p) |
global br;
global pr;
br = 0;
pr = 10;
[a,b] = untitled (1,2);
global cr;
cr+20 |
%% fits wo figure
'unnomilized fits'
clear
load data
%for k=1:size(names,1)
nc=length(names);
[ma,m1,ea,eb,ec,da,db,dc,p_val1,p_val2,tlag,tlag2,tlag3,c,h0,h1,i1]=deal(zeros(nc,3));
parfor j=1:length(names)
for jj=1:nor
odr=squeeze(od(j,jj,:));
if max(odr)>lower_bound && max(odr)<upper_bound %some... |
function [ gradx grady ] = gradient( Im )
%GRADIENT calcule le gradient (discret) d'une image
gradx = dx(Im);
grady = dy(Im);
end
|
%Practice 3.8
x = load('salesfigs.dat')
x1=x(1,:)
x2=x(2,:)
plot(x1,'ko');
hold on
plot(x2,'k*');
hold off
legend('Division A','Division B'); |
function [] = makeDiagnosticTrackingPlots(masterData)
outPath = uigetdir()
% i = colony index
% j = day index
% k = trial index
for i = 1:numel(masterData) %Loop across colonies
colDat = masterData(i).colonyData;
for j = 1:numel(colDat) %loop across days
trialDat = colDat(j).trackingData... |
function result=my_funct_9(x)
if ind_a=find(mod(x,10)==0)
fprintf('%d 是10的倍數 \n',x)
else
fprintf('%d 不是10的倍數 \n',x)
end |
function [sigma_new,hvar_new,aux_var] = rmapfi_danio_plasdp (eps_new,hvar_old,Eprop,ce,e_VG)
%******************************************************************************************
%* RETTURN-MAPPING PARA COMPUTO DE FUERZA INTERNA: PLANE STRAIN - 3D *
%* MODELO DE: ... |
function [data] = first_structure(files)
addpath 'C:\Users\ortegauriol\Dropbox\PhD\Past Data and Codes\Marjolein\Trial and data'
if ~exist('data', 'var')
fid = ('pptr01115');
else
fid = files;
end
Nmus=8; %ncond=12; % ntrials=5; nbins=4;
NSyn = 7;
sfreq= 1000;
Data = load (fid);
Emg = Data.data.Data.DAQ_DATA.b... |
clear all
graphicsON = 1; % flag for graphics
tstart = tic;
A = 0.1; % parameters from Shadden 2005 Physica D
eps = 0.25;
omega = 2*pi/10; % frequency of gyre oscillations
%% Part 1 - Initialize grid of particles through vector field
dx = .025;
xvec = 0:dx:2;
yvec = 0:dx:1;
[x0,y0] = meshgrid(xvec,yvec); % grid... |
function [centroides, idx] = kMeans(X, K)
% [Esta funcion no solo sirve para imagenes: fijese que de ahora en adelante en los comentarios
% se habla de "elementos" y no de "pixeles"]
% Recibe X que es una matriz que en cada FILA tiene un vector que representa uno de los elementos que se quiere segmentar
% Tambien recib... |
function phase_portraits()
close all
clc
tspan = [0 100];
figure()
ylabel('Xdot')
xlabel('x')
hold on
for x0 = -100:10:100
for xdot0 = -100:10:100
xinitial = [x0;xdot0];
[tout, stateout] = ode45(@Derivatives, tspan, xinitial);
%% Plotting with respect to time
%plot(tout,stateout)
... |
function visualize
global tdalabStatus XSpread YSpread algs;
global Y Ycap MCSIRs NumOfMode backGroundColor lFontSize defaultFontName;
global MCfit MCelapsedTime;
if ~tdalabStatus.decomposed
errordlg('Please run tensor decomposition algorithm first.','No input','modal');
return;
end
plotFuncstr={'plot3','plot... |
size = 1000000;
figure('Name','DVB');
Data_Z = zeros(1,size);
Data_DVB_Z = scramblerDVB(Data_Z);
subplot(3,2,1)
monitor(Data_DVB_Z,0)
subplot(3,2,2)
monitor(Data_DVB_Z,1)
Data_1 = ones(1,size);
Data_DVB_1 = scramblerDVB(Data_1);
subplot(3,2,3)
monitor(Data_DVB_1,0)
subplot(3,2,4)
monitor(Data_DVB_1,1)
Data_R = randb... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Copyright (C) 2016 N. Eamon Gaffney
%%
%% This program is free software; you can resdistribute and/or modify it under
%% the terms of the MIT license, a copy of which should have been included with
%% this program at https://github.com/... |
function I = boxCategories(I,C)
colors = prism(numel(I));
hold on
imagesc(I)
for i = 1:numel(C)
c = C{i};
% data = regionprops(c, 'boundingbox');
for j = 1:numel(c)
% bb = data(j).BoundingBox;
[y x] = ind2sub(size(I),c{j});
... |
clear
clc
%% Load data
% load front- and backprices and ticker names separately
data = readtable('CountryFuts.xlsx');
ticker_data = readtable('CountryFuts.xlsx','Sheet','Sheet2');
% make necessary adjustments
front_prices = str2double(table2cell(data(6 : end, 2 : 13)));
back_prices = str2double(t... |
clear all; close all
global g_useIOPort
g_useIOPort = 0;
PR650Init(1)
% check it
CMCheckInit
% load stored file
cal = LoadCalFile('3T_Back_Bore_800x600_4_23_08');
% do it
whichMeterType = 1;
blankOtherScreen = 0;
UserPrompt = [];
cal = CalibrateMonDrvr(cal, UserPrompt, whichMeterType, blankOtherScreen)... |
load('../tf_snn/output/cifar10_cnn.mat');
conv1_nz = conv1(conv1(:) > 0);
[N,X] = hist(conv1_nz, 100);
set(gca, 'YScale' ,'log');
conv1_sort = sort(conv1_nz);
conv1_len = length(conv1_sort);
conv1_pscale = conv1_sort(floor(conv1_len * 0.999));
clf;hold on;
N(N < 1) = 1;
bar(X, log(N) / log(10));
logyts = get(gca, 'YT... |
function [w, R] = solve_weight(Z, y)
M = Z*Z';
b = Z*y;
w = linear_solve(M, b);
R = (w'*Z-y')*(w'*Z-y')';
end |
%***********************************
% Get the U value of opennings except windows
%***********************************
function [U,C] = getU_opening(surface_id,opening_id)
% Get U value of each opening. Doors and windows are different
global Infor_surface Num_cons Infor_cons
if strcmp(Infor_sur... |
while(1)
%zumoPose
zumoSensors
pause(1)
end |
clear q
sbfiles=rdir('**/sbefore.*');
for i=1:6
q{i}=load(sbfiles(i).name);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SB={q{1}.v.data q{2}.v.data q{3}.v.data q{4}.v.data q{5}.v.data q{6}.v.data};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear q
devfiles=rdir('**/deviants.*');
for i=1:6
q{i}=load(devfiles(i).name);
end
%%%%%%%%... |
function checkFiles(actiFile,dimeFile,bedTimes,wakeTimes)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
saveDir = 'C:\Users\jonesg5\Desktop\NIDA\checkFigs';
[aTime,aActivity,subject] = importActiwatch(actiFile);
% check if daysimeter file exists and import
if exist(dimeFile,'file') =... |
NDD_scenario_generate;
save('NDD_scenario_set31.mat','NDD_scenario_set');
NDD_scenario_generate;
save('NDD_scenario_set32.mat','NDD_scenario_set');
NDD_scenario_generate;
save('NDD_scenario_set33.mat','NDD_scenario_set');
NDD_scenario_generate;
save('NDD_scenario_set34.mat','NDD_scenario_set');
NDD_scenario_generate;
s... |
clear all
load('net1.mat');
load('net2.mat');
filename = uigetfile;
char1 = imread(filename);
% Binarize image
char1BW = im2bw(char1, 0.4);
[ I, J] = find(char1BW==0);
x1 = 1;
if(min(I)-1 > 1)
x1 = min(I)-1;
end
x2 = 1;
if(min(I) +1 < length(I) )
x2 = max(I) +1;
end
y1 = 1;
... |
% Block Householder QR
% Copyright (c) 2016 by Pranay Seshadri
% Golub and Van Loan (page 250 ed. 4)
% Coded July 5th 2016
function [Q, R] = qr_BlockHouseholder(A, r)
[m,n] = size(A);
Q = eye(m);
lambda = 1;
k = 0;
while lambda <= n
tau = min(lambda+r-1, n);
k = k + 1;
% Now we upper triangularize A(l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.