text stringlengths 8 6.12M |
|---|
%% Stelling 8
%
% Met de standaard functie numel() vraag je het
% aantal elementen van een vector of matrix op.
%
Antwoord = 1;
|
% reads cluster count and points from input files
function [NC points] = read_input_data(file_params, file_points)
points = [];
NC = load(file_params);
load(file_points, 'points');
%disp(points);
%disp(NC);
end
|
function omega = objectivePlot(x)
rho = 997;
I = (1/12)*0.85*0.5*0.5;
omega(1) = 0;
t(1) = 0;
alpha(1) = 0;
f_total(1) = 0;
j=1;
Kn = 1;
while sum(omega)==0 || round(omega(j),5) ~= round(omega(j-1),5)
total = 0;
for i = 1:x(2)
force = Kn*(rho*pi/(2*x(... |
function rmse=rmse96(Xfm,Xt)
% Dimension of Xfm (ensemble mean): (vari,time)
% Dimension of Xt (Truth): (vari,time)
nvar=size(Xt,1);
err= Xfm - Xt;
rmse=(sum(err.^2,1)/nvar).^0.5;
|
% Batch mode scripts for running spm5 in TRC
% Created by Ze Wang, 08-05-2004
% zewang@mail.med.upenn.edu
% This file is included here for reference, but is not used as part of the asltbx gear.
% Parameters are instead provided by the gear.
function PAR = par()
fprintf('\r%s\n',repmat(sprintf('-'),1,30))
fpri... |
function [R, t] = bruteforce(lprojs, projs)
Xs = zeros(3, size(lprojs, 2));
Xe = zeros(3, size(lprojs, 2));
xs = zeros(2, size(lprojs, 2));
xe = zeros(2, size(lprojs, 2));
for i = 1:size(lprojs, 2)
[X1, X2] = resolve_line(eye(3), zeros(3,1), eye(3), [1;0;0], lprojs(:, i, 1), lprojs(:... |
numFactors = 30;
linkWt = 10^-2;
reg = 10^3;
fracEdgesToRemove = .3;
beta = 0.5;
numIterations = 3;
% Get baseline
katz3AffFile = [graph.Constants.DATA_PATH, 'katz3Aff.mat'];
% % save(katz3AffFile , 'A', 'targetEdgeSet', 'numPredictions', 'precisionKatz', 'completenessKatz', 'numTargetEdges', '-v7.3');
%
dataFile... |
function Latcorrection = getOptLatParams(EXP)
global DIRS
nProbe = numel(unique(EXP.CellInfo.Probe));
Latcorrection = zeros(1,nProbe);
paramsfilename = 'decoderLatParams';%['decoderSpdParams_' model];
if ~iscell(EXP.series)
paramsfilepath = [DIRS.multichanspikes filesep EXP.animal filesep EXP.series filesep paramsf... |
function [ ds ] = thecannon_load_dataset_simple( thecannon_dataset_path )
% Written by: Bo Zhang (NAOC, bozhang@nao.cas.cn)
% Last modified: 13-Jun-2016
%
% Aim:
% - load TheCannon.dataset.Dataset file
% Example:
% - [ ds ] = thecannon_load_dataset( thecannon_dataset_path )
% -
% INPUT:
% - thecannon_da... |
function [ outSeq ] = dndn( inSeq )
% MV.DNDN 计算moving 连续下跌的步数,window没有意义
% 输入:
% inSeq : N*1 简单向量
% 输出:
% outSeq : N*1 简单向量,1:window为nan
% ----------------------------------------------------
% Cheng,Gang; 20130723
%% pre-process
% seq 是简单序列
%% main
N = length(inSeq);
outSeq = nan(N,1);
dif = dif... |
%A)
a0 = 0;
w0 = pi/2;
Np = 2^5;
T = 4;
Ts = T/Np;
x = zeros(1,Np);
t = zeros(1,Np);
Nh = 2;
a = zeros(1,Nh);
for n=1:Np
t(n) = Ts*n;
x(n) = a0/2;
for k=1:Nh
a(k) = (4/n*pi)*sin(n*(pi/2));
x(n) = x(n) + a(k)*cos((2*k-1)*w0*t(n));
end
end
plot(t,x);
figure;... |
function [cone] = cone_kernel(fsize, from, to, radius1, radius2, center)
cone = zeros(fsize);
[a, b] = size(cone);
if nargin < 6
center = round([a, b] ./ 2);
end;
if nargin < 4
radius1 = min(min([a, b], abs([a, b] - center)));
radius2 = radius1 + 1;
end;
if nargin < 5
radius2 = radius1;
radius1... |
clc;
faceDetector = vision.CascadeObjectDetector; % Default: finds faces
I = imread('visionteam.jpg');
bboxes = step(faceDetector, I); % Detect faces
% Annotate detected faces
IFaces = insertObjectAnnotation(I, 'rectangle', bboxes, 'Face');
figure, imshow(IFaces), title('Detected faces'); |
function [Kw] = windowConstant(hv,powerRating)
if powerRating <= 50
Kw = (8) ./ (30 + hv);
elseif powerRating <= 200
if powerRating > 50
Kw = (10) ./ (30 + hv);
end
elseif powerRating <= 1000
if powerRating > 200
Kw = (12) ./ (30 + hv);
end
end
end
|
function [index,model]=Gaussian_mixture_model(feature, number_of_clusters)
%% path
addpath('../Kmean/');
addpath('../../Ressources/');
% variables
loop=10; % by default
max_iter=100;
% [n,m]=size(feature);
% become to initialize GMM with k-means
[index,mu]=kmean(feature,number_of... |
function tone = play_aversive(amplitude,duration)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Plays a white noise stimulus of specified duration and amplitude.
% Note that the amplitude is relative to current speaker settings.
%
% Moritz Gruber, May 2018
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function PDW_T10_correction_struct = generate_PDW_T10_correction_struct(PDW_flip_angle, DCE_flip_angle, TR, varargin)
PDW_T10_correction_struct = [];
if length(varargin)
if isvector(varargin{1}) && length(varargin{1}) == 2
true_T10_lims = varargin{1};
else
disp(sprintf('%s: optional T10 lims argument should be... |
% Using the matrix transpose function
function S=isdirected(graph)
S = true;
if graph==transpose(graph); S = false; end
% one-liner alternative: S=not(issymmetric(adj)); |
%% определение карты
map = false(10);
% добавление препятствия
map (1:5, 6) = true;
start_coords = [6, 2];
dest_coords = [8, 9];
%%
[route, numExpanded] = DijkstraGrid(map, start_coords, dest_coords, true);
|
function [ theta, losses, stop_point ] = sgd_nn( funObj, theta, maxIters, X, y, ei, batchSize, X_val, y_val )
%sgd Performs stochastic gradient descent (mini-batch if desired)
fprintf('Iter\tLearning Rate\tLoss\tAvg Loss\tVal Loss\tAvg Val Loss\n');
alpha=ei.alpha;
oldG = zeros(size(theta));
avgLoss = 0;
oldAvgLoss =... |
function [etasq,rsq]=getetasqfromf(F,dfnum,dfden)
% etasq=getetasqfromf(F,dfnum,dfden)
etasq=F.*dfnum./((F.*dfnum)+dfden);
rsq=F.*dfnum./((F.*dfnum)+(dfnum+1)*dfden);
|
function [a]=gra_eq(pq,Ain,lpq,n,Ybus,V,A,S,Sb,lpq1,tem,bus_spec,cpv)
a=zeros(n-1+lpq);
R=real(Ybus);I=imag(Ybus);P=real(S);Q=imag(S);Pd=real(Sb);Qd=imag(Sb);
%% P
for k=1:n-1
b=Ain(k);
for l=1:n-1%%%%%%Ang
c=Ain(l);
if (b==c)
a(k,l)=-Q(b)-V(b)^2*I(b,b);
else
... |
#!/usr/bin/octave -qf
# Plots floor function for a given range
function [x, y] = sqrtAndSquare(a)
x = sqrt(a)
y = a^2
endfunction
[x,y] = sqrtAndSquare(64);
y/x
|
function y=drunge(x)
% derivata prima della funzione di runge (per interpolare
% i valori della derivata)
y=-2.*x./((1.+x.^2).^2);
|
function save_to_ply( t, filename, color, coordinates )
% save_to_ply(t, filename, color, coordinates)
%
% t: GAIO-Tree
% filename: e.g. myTree.ply
% color: eigenvector of the discretized Perron-Frobenius operator, e.g. max(log10(abs(V(:,1)))+20,0)
% coordinates: 3-D coordinates of the box covering, e.g. [1 2 3]
%
% ... |
%******************************************************************************
% University of Sharjah
% Department of Nuclear Engineering
% 24.536 Reactor Experiments and 407.403 Advanced Nuclear Lab, Spring 2016
% HW #7: “Reactivity Measurements Techniques” Post-lab Exercises
% Problem #5
%... |
function cellFrame = Global_EMD(cellFrame, matFrame, algOptions)
%%%%%%%%%%%%%%%%%%%%%%%%% initialization %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
numFrame = numel(matFrame);
[dimx, dimy] = size(matFrame{1}.Mat);
bodyRatio = algOptions.bodyRatio;
searchDepth = algOptions.searchDepth;
candiRadiusK = algOptions.candiRadiusK;
se=... |
% naive implementation of PCA
function [evec,reduced,d] = unsupervised_pca(x, n)
a = cov(x);
[evec,eval] = eigs(a, n);
d = diag(eval);
reduced = transpose(evec)*x';
end |
function [dfiles_oc dfile_atx]=getoc(prename1,atxname,year,month,day,nd,tp,path,pathexe)
%
% Function getoc
% ==============
%
% This function was created to download orbit and clock files from
% IGS ftp server. Later it was extended to also download the antenna
% (ANTEX) file
%
% Input
% ==... |
tic;
profile on;
env = PaperRaceEnv('PALYA3.bmp', 99, 'GG1.bmp', [
350, 60,350,100;...
360, 60,360,100;...
539,116,517,137;...
348,354,348,326;...
35,200, 70,200;...
349, 60,349,100]);
N_hidden = [80 50]; %Number of neurons in each hidde... |
% MOVIE
clear all
close all
global Ms hs
f = @(x) cos(x/16) .* (1 + sin(x/16));
L = 32*pi;
Ms = 128; %number of points in reference sol.
hs = L/Ms;
y = 0:hs:L-hs;
N = 10000;
k = 0.1;
T = k*N;
y0 = f(y);
options = odeset('AbsTol', 1e-12, 'RelTol', 1e-12);
[~,yy] = ode15s('funcKS', 0:k:T, y0, options);
figure
for ... |
function [yhat,xhatfilt,xhatpred,P,Q] = kalman_phase(y,F,G,H,R1,R2,phase,freq_off,Q0,backward)
x0=[phase;freq_off];
K=size(y,1);
xhatpred=zeros(size(x0,1),K);
Q=zeros(size(Q0,1),size(Q0,2),length(y));
P=zeros(size(Q0,1),size(Q0,2),length(y));
yhat=zeros(size(R2,1),K);
xhatfilt=zeros(size(x0,1),K);
xhatpred(:,1)... |
function [trajStart] = find_traj_startingpointsNEW(times)
temp = 1;
tempStart = times(1,1);
trajStart = 1;
for i=2:size(times, 1)
% 30 min per trajectory
if((i - temp) > 2 && times(i,1)-tempStart > (1/48))
trajStart = [trajStart;i];
tempStart = times(i,1);
... |
%%% fc-network-ex
% DYANMIC NETWORK SCRIPT EXAMPLE
addpath(genpath('Toolboxes/chronux_2_12'))
addpath(genpath('Toolboxes/mgh'))
%%% 1. LOAD DATA
model.patient_name ='pBECTS007';
model.data = [data_left; data_right];
pc = patient_coordinates_007;
%%% 2. LOAD MODEL PARAMETERS
model.sampling_frequency = 2035;
model.... |
% % Based off of code from
% % https://nirmalthapa.wordpress.com/2012/06/03/multiclass-svm/
% % http://www.mathworks.com/help/stats/svmtrain.html
% % http://www.mathworks.com/help/stats/svmclassify.html
s_datasets = {'ATNTFaceImages400','HandWrittenLetters'};
s_file_types = {'txt','csv'};
s_file_names = {'trainD... |
function showFourier(toShow)
% SHOW FOURIER - show images/series and their fourier transforms
% toShow - a cell array of images or timeseires
if ndims(toShow{1}) == 1
figure;
for ii = 1:length(toShow)
subplot(3, length(toShow), ii);
plot(toShow{ii}, []);
subplo... |
function [log_pE_given_PK_params, log_pE_given_PK_params_and_MP_T10, MP_T10] = compute_log_pE_given_PK_params(E, time_vec, flip_angle, TR, TE, ...
CA_dose, is_pre_injection_volume, r1, r2, ...
PK_parameter... |
function [] = lettercircle( center, radius, window, labels, color)
for label = 1:length(labels)
pos = [center(1) + sin((label - 1)/length(labels)*2*pi())*radius,...
center(2) - cos((label - 1)/length(labels)*2*pi())*radius];
DrawFormattedText(window, labels(label), 'center', 'center',...
color, [],[]... |
function [K,taud] = mimicParameters(Cycles)
%% Mimic digital filter parameters
% This function computes the parameters needed by the digital mimic filter.
% The mimic filter filter the exponential decay presented in current
% signals during a fault.
% This function has input:
% Cycles - time constant in cycles
% This f... |
function [fid filename] = constructFile(prefix)
% Creates and opens a new file with the date and time as the name
% File created is a text file, new data appended if file already exists
% inputs:
% prefix: string to add in front of date and time (use '' for nothing)
% outputs:
% fid: file handle
% filename: stri... |
% problem6.m
clear, clc
disp('Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.')
tic
sumOfSquares = sum((1 : 100) .^ 2);
squareOfSum = sum(1 : 100) ^ 2;
squareOfSum - sumOfSquares %#ok<NOPTS,MNEFF>
toc |
function [CT, CR, BT] = one_point_line(x1, x2x, x3x, is_4)
CT = zeros(9,3);
CR = zeros(9,9);
BT = zeros(9, 1);
for j = 1:3
r_mat = zeros(3, 9);
pinds = [1 2 3];
r_mat(1, pinds) = x3x(:, j);
r_mat(2, pinds+3) = x3x(:, j);
r_mat(3, pinds+6) = x3x(:, j);
% x... |
function []=myPrintPDF(fig_h,leg_h,filename)
% Prints a PDF of a figure, with the correct Fonts/LineWidth etc.
% h = handle of the figure
hAxes=get(fig_h,'CurrentAxes');
set(get(hAxes,'xlabel'),'Interpreter','Latex','Fontsize',14)
set(get(hAxes,'ylabel'),'Interpreter','Latex','Fontsize',14)
set(get(hAxes,'title'),'... |
%$
function [htext] = label(h,textString,varargin)
%LABEL places a label next to your data.
%
% This function provides an option between the legend and text or annotation commands
% for labeling data that you plot. Edward Tufte
% says that data shouldn't stray far from its label, because
% the viewer of a graph s... |
%% fn_add
%% Syntax
% y = fn_add(u,v)
%% Description
% tool to add matrices and vectors
% ex: y = fn_add(rand(4,5),(1:4)')
% y = fn_add(1:5,(1:4)')
%
% See also fn_mult
%% Source
% Thomas Deneux
%
% Copyright 2002-2012
%
|
function medline = segmentMedlineCirc(bscan, params)
% SEGMENTMEDLINECIRC Finds a line in the middle of the ONL to split the
% circular scan into an inner and outer segment.
%
% PARAMS: Parameter struct for the automated segmentation
% In this function, the following parameters are currently used:
% - See findmedli... |
function varargout = test1(varargin)
% TEST1 MATLAB code for test1.fig
% TEST1, by itself, creates a new TEST1 or raises the existing
% singleton*.
%
% H = TEST1 returns the handle to a new TEST1 or the handle to
% the existing singleton*.
%
% TEST1('CALLBACK',hObject,eventData,handles,...) cal... |
function [kclass, hitbtwidx] = judgeGrayLevel(Ln, Rn, k)
%JUDGEGRAYLEVEL gives the description of a gray level value for the GLG algorithm to calculate the
%transformation function
% Ln is the left limit of each gray bin
% Rn is the right limit of each gray bin
% k is the tested gray level value
% kclass ... |
function [ frec, x, X] = SBQ_NKKT(pars, options,mopt)
% Using "Null-Space" method to solve the KKT condition arising from applying
% newton methood to max_eig problem (See page 531 of N&W book).
% For more info refer to the following papers
%[HO]: "The spectral bundle method with second-order information",
% C. Helmb... |
close all;
clear;
clc
class_idx = input('please input class_idx:','s');%'class2';
class = ['class',class_idx];
curt_dir = fileparts(fileparts(mfilename('fullpath')));
cd (curt_dir);
%% only for debug
save_result = 1;
% show_refine_boxes = 1;
% show_refine_image = 1;
%%
run(fullfile(fileparts(fileparts(mfilename('ful... |
[num,txt]=xlsread('data.xlsx');
[a,b] = size(num);
num = num([1,3:a],:);
num = num(:,1:2:b);
data = num(2:end,:);
data = data(:,1:end-1);
date = txt(3:end,1);
[a,b] = size(data);
data = data';
Y = zeros(b,a);
z = zeros(1,a-13+1);
parfor i = 13:a
[y, z(i)] = weight_mix(data(:,1:i-1),2,0,1);
Y(:,i) =... |
% more_carriers
%this code just adds two more carriers in order to demonstrate the
%nonlinear fiber properties.
spacing=param.spacing;
decorrelate=samples_symbol*20;
% Carriers generation
s_optl_1=sin(2*pi*(param.f_ocs-spacing)*t);
s_optl_2=sin(2*pi*(param.f_ocs-spacing*2)*t);
s_optl_3=sin(2*pi*(param.f_o... |
% #############################################################################################
% ######### YOU SHOULD MAINTAIN THE RETURN TYPE AND SHAPE AS PROVIDED IN STARTER CODE ######
% #############################################################################################
function [output] = pooling_lay... |
function [modularity] = runCpp(filename,communities)
if communities == 0
% cd ..
% cd ([pwd '\ComboCode'])
if ispc
modularity = system([fileparts(pwd) filesep 'ComboCode' filesep 'COMBO.exe' ' ' '..' filesep 'ComboCode' filesep filename '.net > modularity.txt']);
elseif isunix
... |
function Hd = high_pass_filter(Fs,Fstop,Fpass)
%HIGH_PASS_FILTER Returns a discrete-time filter object.
% MATLAB Code
% Generated by MATLAB(R) 9.8 and DSP System Toolbox 9.10.
% Generated on: 21-Feb-2021 20:28:36
% Equiripple Highpass filter designed using the FIRPM function.
% All frequency values are in Hz.
%Fs = ... |
% First frontalization tests - Vito
%% Init stuff
function [warped_surface, fid_XY, landmarked_img, frontal_raw,hardsym_images]=demoVito(X,detector,filename,faceSize,Model3D,dlibdetector,dlibpredictor,dlibmodule)
% load model
%clear all
%addpath(genpath('/Users/abharati/Desktop/HassnerS-Frontalization/frontali... |
A = zeros(8,25);
y=zeros(8,1);
X = zeros(5,5);
%Assumig that the length of a cell side is 1 (and all sides equale). -> y=A*X(:);%y=A*vec(X);
% y(1,1)= 5->1 (from source 5 to reciver 1)
% y(2,1)= 2->2
% y(3,1)= 6->2
% y(4,1)= 3->3
% y(5,1)= 7->3
% y(6,1)= 2->4
% y(7,1)= 1->5
% y(8,1)= 4->5
[Dx, Dy] = CreateDeriva... |
function [s gamma_pre] = Generation_s (leng_u,number_input,M_generator, p1, Poncture,number_output,Memory)
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
% M=zeros(number_input, Memory);
% vect=(1:size(M,2));
% for j=1:number_input
% for i=1:number_output
% M(j,:)=sign(M(j,... |
function [group_p, point_candidate_t] = same_group(xc, yc, point_candidate, point_num, x1)
group_p = []; k =0;
for i = 1:length(x1)
if i~= point_num
xp = point_candidate{i,1};
yp = point_candidate{i,2};
[a,b] = find(xp == xc & yp == yc);
if length(a) > 0
k = k + 1;
... |
function SEL_assert_test_architectures_EOS()
jess unwatch all;
jess watch rules;
jess reset;
%% ENUMERATION
% Architectures to be considered
% % examples of given architectures
arch.type = 'selection';
arch.seq = [];
arch.instruments = 'AIRS HSB AMSU-A SEAWINDS GLAS DORIS ALT-SSALT TMR MLS';% ok 590
assert_architectur... |
function imm = zeropad(im,blocksize);
% ZEROPAD completes with zeros till the size of the image
% is multiple of blocksize
%
% im2 = zeropad(im,blocksize);
%
s = size(im);
r = s(1);
c = s(2);
modr = mod(r,blocksize);
modc = mod(c,blocksize);
if length(s)==2
imm = zeros(r+modr,c+modc);
imm(1:... |
function [result] = util_make_raster_colormap(type)
%UTIL_MAKE_RASTER_COLORMAP Generate the colormap for RASTER PLOT
% Usually, this function is used with UTIL_PLOT_RASTER_IMAGE.
%
% Input:
% type: 'hot', 'hot-modified' or 'gray', you may want to adjust it manually later.
% 'esa' / 'fren... |
function y = innprodW(X,W)
% INNPRODW(W,X) - computes <X,W> where the matrices X and W are assumed to
% be given in factorized form
%
%
% Input:
%
% Output:
%
% Author: T.Strohmer (strohmer@math.ucdavis.edu)
%
if iscell(W) == 1;
epsilon = W{4};
y = 1/epsilon*(norm(X,'fro')^2... |
function chunked_data = createChunks(data, numChunks)
% get LogLikelihood Ratio for speaker verification
% Input: data : 2D array of data points (MxN)
% numChunks : number of chunks to create (K)
% Output: chunked_data : 3d array with data chunks (Kx(M/K)xN)
%count = length(data)-m... |
clear ; close all; clc
fprintf('Loading and Visualizing Data ...\n');
input_layer_size = 400;
hidden_layer_size = 25; % 25 hidden units
num_labels = 10; % 10 labels, from 1 to 10
fprintf('Loading and Visualizing Data ...\n')
load('ex4data1.mat');
m = size(X, 1);
% Randomly select 100 data points to di... |
function S = demodQAM_nthPower(S,M)
%% Demodulate
if M == 16
% 4th Power Demod:
S = abs(S).*exp(1j*angle(S)*4);
% pi Rotation:
S = S*exp(1j*pi);
% nth Power Demod:
c = 2*pi/(pi-4*atan(1/3));
S = abs(S).*exp(1j*angle(S)*c);
end
% case 'recenter'
% S = A.A;
% ... |
function varargout = fPANLST3(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} = Inf;
otherwise
error('invalid input opt... |
function [coherency fs] = get_coherency(encoding_neuron)
% [coherency fs] = get_coherency(encoding_neuron)
%
% Returns array of spike-field coherences for a bunch of frequencies.
match = regexp(encoding_neuron, '-', 'split');
session = match{1};
neuron = str2num(match{2});
cd('~/Science/wallis/data')
[SpikeInfo, ... |
t(1) = 8 + 0.796943;
phy_rx_Control_valid(1) = 0;
phy_rx_Payload_valid(1) = 0;
phy_rx_EVM(1) = 10.672972;
phy_rx_RSSI(1) = -58.937988;
phy_rx_CFO(1) = 0.033298;
phy_rx_num_syms(1) = 0;
phy_rx_mod_scheme(1) = 0;
phy_rx_BPS(1) = 0;
phy_rx_fec0(1) = 0;
phy_rx_fec1(1) = 0;
phy_rx_numSubcarriers(1) = 64;
phy_rx_cp_len(1) =... |
%
%
% Optimize the expected improvement for the test funcion (see test_function.m) using the minimize function
%
%
function test_max_ei_minimize()
clear all
close all
clc
addpath ('/home/alessio/Documents/elasticTest/ICSE-2014-with-Antonio/code/workspace/iter/src/main/resources/gpml');
startup
% Define the interpola... |
function [Sigs,HR,time]=DriverBasicME(data,INDMAP,Opt_pars,k,pt,figureson)
%% Get nominal parameter values
pars = load_globalOpt(data,INDMAP);
%% Solve model with nominal parameters
pars(INDMAP)=log(Opt_pars(k,:));
[HR,~,~,Outputs] = model_solOpt(pars,data);
time = Outputs(:,1);
T_s = Outputs(:,3);
T_pb = Outpu... |
function setTemperature(self, T)
% SETTEMPERATURE - set the mixture temperature
%
mixturemethods(5, mix_hndl(self), T);
|
%
% Usage: Y =mexSort(X);
%
% Name: mexSort
%
% Description: sort the elements of X using quicksort
%
% Inputs: X: double vector of size n
%
% Output: Y: double vector of size n
%
% Author: Julien Mairal, 2010
|
function dFs_heel_c1_12 = dFs_heel_c1_12(in1,in2,us,ud)
%DFS_HEEL_C1_12
% DFS_HEEL_C1_12 = DFS_HEEL_C1_12(IN1,IN2,S_HEEL,US,UD)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 24-Jun-2020 13:54:03
q1 = in1(:,1);
q2 = in1(:,2);
q3 = in1(:,3);
q4 = in1(:,4);
q5 = in1(:,5);
q6 = in1(:,... |
Je gebruik de functie dlmwrite() om csv bestanden
te lezen. |
% polynomial kernel
function kx = mykernel(x1,x2,type,order)
switch type
case 'linear'
kx = x1*x2';
case 'poly'
kx = (1 +dot(x1,x2))^order;
case 'rbf'
kx = exp(-order*(norm(x1-x2))^2);
end
end |
clear all, close all, clc
original = 2.^((0:11)/12);
N = 13;
custom = 2.^((0:N-1)/N);
%% Plot custom note scale and original note scale
figure(1)
grid on
hold on
scatter(original, 0.4 * ones(1,12), 'x', 'LineWidth', 1.5)
scatter(custom, 0.6*ones(1,N), 'x', 'LineWidth', 1.5)
axis([1 2 0 1])
title(sprintf(... |
function [residual, evec_n, evec_reg, eval, eval_reg] = modal_residuals_reg(vec, mics, order, winsize, alpha, b, gamma, delta)
% modal residuals - find residuals from modal decomposition with regularization
% performs a regularized linear regression and computes residual vector
% [residual, evec, eval] = modal_re... |
function whoami()
%
% --- whoami - version 1.0 ---
%
% This function needs to be run at the start of each function/script to
% obtain the mpirank and mpisize as set by setmpistuff.m
%
% Copyright 2013 Jeroen Engelberts, SURFsara
%
mpisize = evalin('base','mpisize');
mpirank = evalin('base','mpirank');
assignin('calle... |
function [CORR, OUT] = CorrUnbalanced(DATA,labels)
% =======================================================================
% Compute correlation of a panel of time series DATA (with T
% observations and N variables) using rows with no missing values in
% column i or j.
%
% note: for each pair of columns, th... |
function ardDispBright()
CLEARBUFF = hex2dec('00');
FLIPBUFF = hex2dec('01');
ardDispOff();
ardI2Cecho(CLEARBUFF,1,0,0,0);
ardI2Cecho(FLIPBUFF,0,0,0,0);
|
% Highpass filtering
close all;
figure()
f = imread('figures/FigProb4.16(original).jpg');
subplot(1,4,1)
imshow(f, [ ])
title("a) original image")
PQ = paddedsize(size(f));
D0 = 30;
H = hpfilter('gaussian', PQ(1), PQ(2), D0);
%% 1 10 100
iter = [1 10 100];
for i = 1:size(iter, 2)
g = dftfilt(f, H);
for j = ... |
% SYNC update one struct with another
%
% SYNC(s1, s2) populates every field from `s2` into `s1`, overwriting the
% values in `s1` when there is a conflict, and returns `s1`.
%
% SYNC(s1, s2, 'soft') does not overwrite existing values in `s1`.
%
% SYNC(s1, s2, 'top') is non-recursive. Fields of class `struct` a... |
% q0(t,q0init,q1traj,q2traj)
% t time vector
% q0init inital q0 position
% q1 vector of q1 corresponding to time vector
% q2 vector of q2 corresponding to time vector
function q0traj = q0_4(t,q0init,q1,q2,q3)
%input validation
if or(or(length(q1)~=length(t),length(q2)~=length(t)),length(q3)~=... |
% MECH 568 HW 2 Problem 6.8
% Author: Thomas Andreano
% Version 1: 10/17/2019
%-----------------------------------------------------------------------
% Solution to the one-dimensional linear convection equation using
% 4th-order (noncompact) difference in space and RK4 time marching.
clc;
clear all;
close al... |
function Weight=lstm_setup(layers)
n=length(layers)-1;%lstm+tanh�IJ���
Weight=cell(n,1);
for i1=1:n-1
M=layers(i1);
N=layers(i1+1);
% input gates
Weight{i1}.w_i=1/M*[normrnd(0,0.1,[M,N]);zeros(1,N)];
Weight{i1}.r_i=1/N*normrnd(0,0.1,[N,N]);
Weight{i1}.p_i=zeros(1,N);
% forget gates
Weight... |
classdef DoseVolumeHistogram
% DOSEVOLUMEHISTOGRAM converts the data of a VolumeOfInterest clipped dose Image to a sampled
% DoseVolumeHistogram
%
% CONSTRUCTOR
% this = DoseVolumeHistogram(image, binsize) samples an image object with the size of binsize
%
% See also: VOLUMEOFINTEREST, CALCULATEDVHD, CALCULATEDVHV, C... |
function [scores] = bigpred_primal(X,y,opt)
% bigpred_primal(X,y,opt)
% computes the predictions of the linear classifier stored in opt.rls.W
% on the samples passed in the X matrix.
%
% INPUTS:
% -X: input data bigarray
% -y: labels bigarray
% -OPT: structure of options with the following fields (and subfields):
% ... |
% print success rates
d=100;
T=100000;
opoFHT=load(sprintf('opoFHT_allR1-50_d%dT%d.mat',d,T));
opo=load(sprintf('opo_allR1-50_d%dT%d.mat',d,T));
rmhcFHT=load(sprintf('rmhcFHT_allR1-50_d%dT%d.mat',d,T));
rmhc=load(sprintf('rmhc_allR1-50_d%dT%d.mat',d,T));
hitting{4}=rmhc.outputOpt;
hitting{3}=rmhcFHT.outputOpt;
hitting... |
% Course - Matlab programming for numerical computation
% Module 1: Practice Problems
T = 398;
pSat = steamPressure(T); |
% load training set and testing set
clear all;
train_set = loadMNISTImages('train-images.idx3-ubyte')';
train_label = loadMNISTLabels('train-labels.idx1-ubyte');
test_set = loadMNISTImages('t10k-images.idx3-ubyte')';
test_label = loadMNISTLabels('t10k-labels.idx1-ubyte');
% cliassify the testing set
train_scale = siz... |
function compro=compr()
e=getappdata(0,'ent');
file=getappdata(0,'file');
M=uint16(dlmread(file,'_'));
[m,n]=size(M);
f=0;
for i=1:m
if isequal(M(i,1:n),e)
compro=i;
f=1;
end
end
if f~=1
compro=0;
end
%clearvars e ent
%setappdata(0,'compro',compro);
return; |
function y = load_signal(name, n, options)
% load_signal - load a 1D signal
%
% y = load_signal(name, n, options);
%
% name is a string that can be :
% 'regular' (options.alpha gives regularity)
% 'step', 'rand',
% 'gaussiannoise' (options.sigma gives width of filtering in pixels),
% [natural signa... |
%time varying system is bbox2
subplot(2,1,1)
hold on
t = -1:0.1:5;
x1 = (t>=0);
x2 = (t>=0.5);
x3 = (t>=1);
plot(t, x1)
plot(t, x2)
plot(t, x3)
title('u[t], u[t - 0.5], u[t - 1]')
xlabel('t')
ylabel('fxns')
subplot(2,1,2)
hold on
y1 = bbox2(x1);
y2 = bbox2(x2);
y3 = bbox2(x3);
plot(t, y1)
plot(t, y2)
plot(t, y3)
title... |
function plot_echo_waveform(signal, name,fsample,figure_num)
% function plot_echo_waveform(signal, fsample, figure_num)
% Input arguments (parameters) are:
% signal: an array representing a sampled signal
% fsample: the sampling rate at which the signal
% is sampled at.
% figure_num: the number to... |
% demo code to use the edge detection models --
% no thining and NMS are applied to the outputs
clc; clear all;
%
conv_cache = ['./cachedir/demo_results/edges/'];
if(~isdir(conv_cache))
mkdir(conv_cache);
end
% initialize caffe
NET_FILE_PATH = ['./experiments/demo/demo_edges/'];
net_file = [NET_FILE_PATH,... |
clc;
clear all;
close all;
%% Reading and displaying the first image
img = imread('elaine.512.tiff');
figure;
subplot(1,2,1);
imshow(uint8(img));
title('Original Image');
subplot(1,2,2);
%% Applying histogram equalization and displaying original image and it's histogram
imhist(img);
title('Oiginal Image Histogram'... |
L0 = 0.3;
L1 = 0.2;
L2 = 0.1;
t0 = 0.4;
t1 = 0.6;
t2 = 1.2;
t0d = rad2deg(t0);
t1d = rad2deg(t1);
t2d = rad2deg(t2);
R1 = [cosd(t0d) -sind(t0d) 0 0;
sind(t0d) cosd(t0d) 0 0;
0 0 1 0;
0 0 0 1];
R2 = [cosd(t1d) -sind(t1d) 0 0;
sind(t1d) cosd(t1d) 0... |
function res = LineIntersection(x11,y11,z11,x12,y12,z12,x21,y21,z21,x22,y22,z22)
m1 = [x12-x11,y12-y11,z12-z11];
m2 = [x22-x21,y22-y21,z22-z21];
m = cross(m1,m2);
d2 = (y21 - y11);
d1 = (x21 - x11);
my1 = (y12 - y11);
my2 = (y22 - y21);
mx1 = (x12 - x11);
mx2 = (x22 - x21);
... |
function [harrCorn, poi, ptsStr] = harris_detector(img, qual, radius, method, disp)
if isinteger(img)
img = im2double(img);
end
if length(size(img)) == 3
img = rgb2gray(img); %should i maybe use ycbcr
end
dx = [-1 0 1];
dy = dx';
Ix = conv2(img, dx, 'same'); % Im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.