text stringlengths 8 6.12M |
|---|
function meas = gen_meas(model,truth,uav)
%variables
meas.Z = cell(truth.K,1);
for k=1:truth.K
if truth.N(k) > 0
try
meas.Z{k} = gen_observation_fn(model,truth.X{k},truth.X_freq{k},'noise',uav); %single target observations if detected ... |
function [ quad_cost ] = compute_quadratic_control_cost(x_stream, u_stream, Ts, Q1, Q12, Q2)
quad_cost = 0;
for i = 1:numel(u_stream)
x = x_stream(i,:)';
u = u_stream(i,:)';
% Calculate the quadratic cost of a control system
P1 = x' * Q1 * x;
if Q12 ~= 0
P2 = 2 * x' * Q12 * u;
else
P2 = 0;
end
P3 = u... |
function writeParameters(configFile, param)
%TODO: keep origin informations
fp = fopen(configFile,'w');
fieldList = fieldnames(param);
for m = 1:length(fieldList)
fprintf(fp, '%s : %s\r\n', fieldList{m}, getfield(param, fieldList{m}));
end
fclose(fp);
end |
fsiRelaxationFactorMin = fixedPtRelax;
fsiRelaxationFactor = fsiRelaxationFactorMin;
nOuterCorr = nOuterCorrMax;
|
function [FF,AA,PDb] = qplot(QFile,D,Range,varargin)
% qplot {Obsolete and scheduled for removal] Quick report.
%
% Obsolete IRIS function.
% No help provided.
% -IRIS Macroeconomic Modeling Toolbox.
% -Copyright (c) 2007-2017 IRIS Solutions Team.
%-----------------------------------------------------------... |
clear
clc
format short
%APARTADO A
b=zeros(19,1);
for k=1:19
b(k)=-0.25*sin(pi*k*0.05);
end
v=zeros(19,1);
for i=1:19
v(i)=2;
end
A=diag(v)-diag(ones(18,1),1)-diag(ones(18,1),-1);
%APARTADO B
spy(A);
%APARTADO C
condeu=cond(A);
fprintf('Condicion de norma euclídea: %f',condeu);
%APARTADO D
I=eye(19);
D=diag(v);
... |
classdef SykTrack < handle
%BaseTrack Basic Coordinate Tracking class
% Bayesian Tracking with Filters
% Peter Relich June 2016, UNM
% Mark J. Olah (mjo@cs.unm.edu) 2015, UNM
properties (Constant=true, Hidden=true)
MAX_BIRTHS = 15000; %More than this many births and we start to h... |
function S = randf(mu, kappa, varargin)
% RANDF Returns unit vectors (pure quaternions) distributed on the sphere
% according to a Fisher distribution (a special case of the more general
% von Mises-Fisher distributions). See also RANDVMF for the 4-sphere case.
%
% The first parameter must be a pure quaternion, defin... |
function train_ocsvm( obj , varargin )
if ( nargin > 0 )
opts = struct( ...
'name' , [] , ...
'classes' , [] ) ;
[ opts ] = parseOpts( opts , varargin ) ;
opts2var
classlength = zeros( size( classes , 1 ) , 1 ... |
function R = rotationMatrices(theta,image)
vectorizedSize = size(image,1)*size(image,2);
R = zeros(vectorizedSize,vectorizedSize,length(theta));
for i = theta
R(:,:,i) = rotationMatrix(i,image);
end
end |
function Hinv=pseudoinverse(H,lambda)
% compute pseudoinverse of matrix H
% Usage:
% Hinv=pseudoinverse(H);
% Hinv=pseudoinverse(H,lambda);
% H: matrix
% lambda: scalar, the parameter to reach stable result and avoid
% singularity, its value should be very large, i.e. 2^32.
% Hinv, the pseudoinverse of H
% Yif... |
function write_PK_tumour_features_to_textfile(PK_Features, Patient_Data_Struct, varargin)
% Select which fields to write
if length(varargin) && ~isempty(varargin{1})
fields_to_write = varargin{1};
if ~iscell(fields_to_write)
fields_to_write = {fields_to_write};
end
else
fields_to_write = [];
% Loo... |
function [] = PCA_make_data_new( task, size_of_vector, selected_channels, Size_of_subject )
%==========================================
%Author: Uladzislau Barayeu
%Github: @UladzislauBarayeu
%Email: uladzislau.barayeu@ist.ac.at
%==========================================
if strcmp(selected_channels{1},'64_channels')
... |
% RUN Lee-Ramirez bioreactor optimal control
clear all;
% Case 1: Step-wise control interpolation
cprintf('*[1,0.5,0]','\n\n ---> Solving Park-Ramirez bioreactor optimal control problem with 20 STEPS- CONTROL INTERPOLATION');
LRbioreactor % Calls the script with the inputs:
... |
function [signal_means_out, signal_sds_out, varargout] = ...
compute_mean_erp_all(input_dir, output_dir, cond_sufix, sub_prefix, ...
output_prefix, sub_ROI_chs)
% function signals_out = view_hipp_erp_all
%
% Function to gather all the Hippocampal (or MTL) ROI signals across
% conditions for all patients.
%
% ... |
function [h3, flist, vlist] = supertri_3rd_edge( h1, h2, tris, sibhes) %#codegen
% SUPERTRI_3RD_EDGE
% Given two halfedges, determine whether they bound a super-triangle.
% If so, return the halfedge of the third halfedge of the super-triangle.
%
% [H3, FLIST, VLIST] = SUPERTRI_3RD_EDGE( H1, H2, TRIS, SIBHES)
%
% A "... |
%AdLIF Forward Euler
%by Jonathan Gornet and DLevenstein
%Last update: 9/13/2017
%INPUTS
% PopParams a structure that gives all the parameters of the population
% .EPopNum Number of excitatory neurons
% .IPopNum Number of inhibitory neurons
% .E_L Reversal potential of the leak current ... |
function varargout = detectionGUI(varargin)
% DETECTIONGUI MATLAB code for detectionGUI.fig
% DETECTIONGUI, by itself, creates a new DETECTIONGUI or raises the existing
% singleton*.
%
% H = DETECTIONGUI returns the handle to a new DETECTIONGUI or the handle to
% the existing singleton*.
%
% DE... |
% Performs a Sine-Sweep on a System with the Given Dynamic Parameters of
% Mass, m, Stiffness, k, and Damping, c (or their rotational equivalents)
% between frequencies f_min and f_max [Hz] for a forcing function with
% amplitude F0.
%
% Produces the FRF plot using N sample points between f_min and f_max.
% If not gi... |
function CreateRunTimePreprocess(ProgramPath)
FileName='CompilePreprocess';
%List
PreprocessMethod=GetPreprocessMethod([ProgramPath, '\FeatureAlgorithm\Preprocess']);
%Create Preprocess compile file
FileContent=[{'%Force compile preprocess method'}; {' '}];
for i=1:length(PreprocessMethod)
TempStr=['%#fu... |
function q_rand = RandomConfig()
% returns random coordinates of joints.
% x1 = randi([0, x_max]);
% x2 = randi([0, x_max]);
% x3 = randi([0, x_max]);
%
% y1 = randi([0, y_max]);
% y2 = randi([0, y_max]);
% y3 = randi([0, y_max]);
theta1 = 0 + (2*pi)*rand();
theta2 = 0 + (2*pi)*rand();
theta3 = 0 + (2*pi)*rand();
... |
function out = phiprime(a,d,x)
% Return the scalar value of the derivative of the objective function at (x+alpha*d)
% with respect to alpha
% a = alpha
% d = direction vector
% x = starting point vector
% phi'(alpha) = (d2-d1)/2 * exp((x2-x1)/2)exp((d2-d1)*a/2) - (5/4)
out = ((d(2)-d(1))/2) * ( (exp( (x(2)-x(1))/2... |
% SB1_ESTIMATE Estimate parameters in a sparse Bayesian model
%
% [W,USED,ML,A,B,G] = SB1_ESTIMATE(PHI,T,A,B,MAXITS,MONITS)
%
% OUTPUT ARGUMENTS:
%
% W Estimated weights (subset of full model)
% USED Indices of relevant basis vectors
% ML Marginal likelihood of final model
% ... |
load('data_m_sweep.mat');
ideal_current = 1e-6;
figure;
hold on;
scatter(m,(nmosirefsweep));
scatter(m,(pmosirefsweep));
plot([1 1.1],[ideal_current ideal_current],'k--');
xlim([1 1.1]);
legend('NMOS','PMOS','1 \mu A');
xlabel('m');
ylabel('I_{OUT}');
figure;
hold on;
NMOS_percentage_error = 100*abs(nmosirefsweep ... |
% function drawCoordinateAxes(H, label)
function drawCoordinateAxes(H, label)
% pull out a translation vector
p = H(1:3,4);
text(p(1), p(2), p(3), label);
length = 0.2;
ux = H*[length;0;0;1];
uy = H*[0;length;0;1];
uz = H*[0;0;length;1];
withds = 1.5;
line([p(1),ux(1)],[p(2),ux(2)],... |
function create_dummy_folder_structure()
maps = dsp2.process.format.find_reprocessed_picto_files();
all_raw_full = maps.raw.full_paths;
all_raw_file = maps.raw.file_names;
shared_raw_full = maps.raw.full_paths(maps.raw.shared_index);
shared_raw_file = maps.raw.file_names(maps.raw.shared_index);
shared_rep_full = maps... |
function X = uq_lhs(nsamples, nvar, simple, iterations)
% S = UQ_LHS(NVAR, NSAMPLES) performs latin hypercube sampling of NVAR variables.
% NSAMPLES samples are collected. Matlab's builtin LHSDESIGN is used if the
% Statistics_Toolbox license is available, otherwise it is substituted by a simple version.
if ~exist('... |
%AUTOCROSS AERO ON/OFF
%Non Aero run
lataccelNA=NonAeroAutox(:,3);
longaccelNA=NonAeroAutox(:,2);
speedNA=NonAeroAutox(:,7);
timeNA=NonAeroAutox(:,1);
%Aero run
lataccelA=AeroAutox(:,3);
longaccelA=AeroAutox(:,2);
speedA=AeroAutox(:,7);
timeA=AeroAutox(:,1);
% Create fi... |
%function CC_compile_dist
if isempty(which('fs_read_surf'))
addpath(genpath('/usr/pubsw/packages/MMPS/MMPS_238/matlab/'))
end
%% import data
rootdir = '/home/bqrosen/projects/CC/';
subjs = ls([rootdir '/out/CC*/*correg_surf_data.mat']);
subjs = regexp(subjs,'\n','split');
subjs(end) = [];
subjs = cellfun(@(x) regexp... |
function [errorCode, errorMsg,entrustNo] = PlaceEntrust(connection,token,combiNo,marketNo,stockCode,entrustDirection,entrustPrice,entrustAmount)
import com.hundsun.esb.* com.hundsun.esb.data.*;
[errorCode, errorMsg,packet] = CallService(connection,MakeRequestPacket(token,combiNo,marketNo,stockCode,entrustDire... |
function N=eval_interpolator_c(tip, eps);
% Eval_interpolator - determine how quickly a polynomial converges Interpolation
% Tip - 1 lagrange
% 2 newton
% 3 linear spline
% 4 natural
% 5 cubic spline
% 6 fourrier
% Eps - accepted tolerance for... |
function [M] = ssfp_diff_signal_Freed_Pulsed(G,tau,TR,alpha,D,T1,T2,shortpulse)
% function [M] = ssfp_diff_signal_Freed(G,tau,TR,alpha[,D,T1,T2])
%
% calculates steady-state magnetization with diffusion weighting
% for monopolar diffusion gradient based on the Freed model.
%
% input:
% G = strength of diffusion grad... |
%% PROBLEM 1:
figure(1);clf;
smithchart([1, 0, 0], 1);
set(gca, 'xdir', 'reverse');
hax = axes();
smithchart();
p1 = 50 * [.2 - j*0.5];
h = plotz(p1, 'o');
set(h, 'markersize', 12, 'linewidth', 2)
p1e = 50 * [.2 + 1j*2];
h = plotz(p1e, 'x');
set(h, 'markersize', 12, 'linewidth', 2)
%% PROBLEM 2:
figure(1);clf;
smit... |
%% parameters
% tic;
%
% mat = zeros(100,401);
% range = -2:0.01:2;
%
% %% create neurons
% for n=1:100
% %% for random (even) distribution
% r = floor(rand()*401)+1;
% mat(n,:) = neuron(range(r));
%
% %% for purely uniform distribution
% %testx=[-2:0.04:1.96];
% %neuron(testx(n))
% end
%... |
classdef (Abstract) BidimensionalDigitalModulation < DigitalModulation
% Una classe di utilità per raggruppare i metodi comuni alle due
% digital modulation bidimensionali viste a lezione, in particolare la
% possibilità di rappresentarle facilmente su un grafico 2D.
methods
function drawM... |
opts = detectImportOptions('2012_test');
state_data = readtable('2012_test',opts);
tv = 99; % 1-N: sets the number of voters
Ny = 1; % N+1 : Sets the number of election cycles not including the first election
win = 2; % 1-2: sets the initial party in power for all agents
good_econ = 0.8; %how much of the econo... |
function A = annotationsGetByFilename(annotStruct,file_images, filterIgnore)
if ~exist('filterIgnore','var') || isempty(filterIgnore)
filterIgnore = 0;
end
if ~exist('file_images','var') || isempty(file_images)
file_images = [];
elseif isnumeric(file_images)
numIDs = numel(file_images);
tmp = cell(1,n... |
function [messL, psnr, T, N] = main(messL, D_T, gray, cover, PER, PEB, pred_R, pred_B, cost)
% messL=140000;
% D_T=20;%%%%%失真门限 baboon 时候 D_T=50 其余 =20
for T = 0:1:10^10
if length(find(cost <= T)) > messL
break;
end
if length(find(cost <= T)) >= length(cost)
... |
function test_error = predictTestData(test_X, test_t, W)
m = length(test_X);
% Add code - Calculate the prediction y
y = [];
for i = 1:m
y = [y,W(2)*test_X(i)+W(1)];
end
% Add code - Calculate test error function
test_error = 0;
for i = 1:m
test_error = test_err... |
clear
close all
root = fileparts(fileparts(mfilename('fullpath')));
cfg_folder = fullfile(root,'config');
cfg = fullfile(cfg_folder,'210E_joined.xml');
cfg_frmode = fullfile(cfg_folder,'210E_joined_frmode.xml');
fr_demand_file = fullfile(cfg_folder,'fr_demands.xml');
cfg_frmode_beats = fullfile(cfg_folder,'210E_joine... |
% Calculate inertial parameters regressor of inverse dynamics cutting torque vector with Newton-Euler for
% %RN%
% Use Code from Maple symbolic Code Generation
%
% Input:
% %INPUT_QJ%
% %INPUT_QJD%
% %INPUT_QJDD%
% g [3x1]
% gravitation vector in mdh base frame [m/s^2]
% %INPUT_PKIN%
%
% Output:
% m_new_reg [(3*%NL%)... |
function [data] = tracking(data_FFT, pilot_pattern, nr_car,length_cpre)
% OFDM_inv uses modulated data and demodulates it
% INPUT:
%
% data_OFDM modulated data
% N total number of carriers we use
% L length of cyclic prefix
% M length of cy... |
function [C,R] = LinearPNP(X, x, K)
%Perspective n point
numpts = size(x,1);
if isempty(X) || isempty(x)
disp('problem');
end
if size(x,2) == 2
x = [x, ones(size(x,1),1)];
end
if size(X,2) == 3
X = [X, ones(size(X,1),1)];
end
vec2skew = @(v) [0, -v(3), v(2); v(3), 0, -v(1); -v(2), v(1), 0];
Xdiag = zeros(3... |
function ascend_mt_doom()
%% ---------- Constants ---------- %%
% docker run --net=host -e ROS_HOSTNAME=localhost -e HOST=192.168.16.## -it paulruvolo/neato_docker:qea
d = 0.265; %formerly .2445 % Wheelbase of robot (m)
step = 0.05; % Length of robot straight line step(m... |
function y=ftest1(x)
% funzione da approssimare
% definita in [-1,1]
if (nargin==0)
y(1)=-1.0;
y(2)=1.0;
else
y=exp(x) .* sin(2*pi*x);
end |
function [fbpupil,fbs,xp,yp,cp]= fbspupil(npix, nmodes, lambda, error, rnphot)
%% Fourier Mode Generator
[fbs,xp,yp,cp]=makefbs(npix,nmodes);
mask=zernike(0,0,npix);
fbs=fbs.*mask;
%% Normalize fourier modes
fsz=size(fbs);
for i=1:fsz(3)
fbs(:,:,i)=fbs(:,:,i).*sqrt(1/sum(sum(fbs(:,:,i).*fbs(:,:,i))));% normalize
en... |
classdef CounterHTJG < handle
%COUNTERHTGJ 今古科技的柜台,登陆的信息
% ----------------------------------------------
% 朱江,20170322,柜台基本功能:login,logout,printInfo
%% 柜台连接成功后的核心,无须外部看到
properties(SetAccess = 'private', Hidden = true , GetAccess = 'public')
counterId = 0; % 柜台编号
... |
function multiRunOptions
global algs tdalabStatus MCTimes;
global XSpread YSpread backGroundColor lFontSize defaultFontName ;
Width=120*XSpread;
Height=30*YSpread;
fmainMultiRun=figure('Units','Characters','Resize','on','toolbar','none','menu','none',...
'Position',[0,0,Width,Height],'Windowstyle','modal','numbert... |
clear all
close all
fName = ''; % enter file name to be opened between ''
chipNum = ; %enter chip number after =
controlNeg = [] %enter the negative control number between []
sizeBloque = 96;
fileName = ''; % enter file name to be saved between ''
ChipCOVID_GitHub_batch % calls the script for individual analys... |
% Reindexes whole cell simulation.
%
% Author: Jonathan Karr, jkarr@stanford.edu
% Affilitation: Covert Lab, Department of Bioengineering, Stanford University
% Last updated: 6/30/2011
function runReindexing(outputDirectory)
setWarnings();
setPath();
setPreferences();
import edu.stanford.covert.cell.sim.util... |
% Written by Patrick Strassmann
function [] = plotSEMLines(xValues,dataCell)
for i=1:numel(xValues)
currData = dataCell{i};
line([xValues(i) xValues(i)], [nanmean(currData)+sem(noNans(currData)) nanmean(currData)- sem(noNans(currData))], 'Color','k');
hold on;
end
end
|
% Generamos una grafica 3D para ver la distribución de los minimos
puntosa=linspace(a1,a2,pa+1);
puntosb=linspace(b1,b2,pb+1);
for i=1:length(puntosb)
A3D(i,:)=puntosa;
end
for j=1:length(puntosa)
B3D(:,j)=puntosb;
end
figure(2)
surfc(A3D,B3D,FS3D)
title('Funcion fitness ','FontName','Arial','F... |
%Monte Carlo De-noising for Binary Images
%Read noisy image data
rng(0);
format long
X = textread('stripes-noise.txt');
%Read true pixel values
I = textread('stripes.txt');
%Initialize best parameters
WP = 11;
WL = 14;
%Initialize denoised value of pixels
Y = X;
%Store the samples
collectMAE = [];
Yestimateorig = z... |
function Solution = DispatchLoop(Date,Forecast,LastSolution)
%% calculate optimal dispatch over the forecast horizon
global Plant CurrentState %% loaded by GUI & load generators
dt = (Date(2:end) - Date(1:end-1))*24;
nG = length(Plant.Generator);
nS = length(Date)-1;
scaleCost = updateGeneratorCost(Date(2:end),Plant.... |
function [hessmat, tval] = monhess(x, Wfd, basiscell)
%MONHESS evaluates the second derivative of monotone fn. wrt coefficients
% The function is of the form h(x) = (D^{-1} exp Wfd)(x)
% where D^{-1} means taking the indefinite integral.
% The interval over which the integration takes places is defined in
% t... |
function genEgmFileC(fname, C, S)
fid = fopen(fname, 'w');
fprintf(fid, '\ndouble egmc[]={\n');
kk = 1;
for k=1:length(C)
for j=1:k
fprintf(fid, '%.16e,', C(k,j));
if mod(kk,10)==0, fprintf(fid, '\n'); end
kk=kk+1;
end
end
fprintf(fid, '\n};\n'... |
function s=sum3and5muls(n)
a = [3:3:n];
b = [5:5:n];
s=sum(unique([a b]));
%s = sum(3:3:n) + sum(5:5:n) - sum(15:15:n); |
function [weight] = rs_create_posecell_weights(dim, var)
% [WEIGHT] = rs_create_posecell_weights(DIM, VAR)
% Creates a 3D normalised distributio of size dim^3 with a
% variance of var.
% Copyright (C) 2008 David Ball (d.ball@uq.edu.au) (MATLAB version)
% Michael Milford (m.milford1@uq.edu.au) & Go... |
%=========================================================================
% Compute the values of sigma0_es and g_0es
% (Data are organized in terms of source and are based on the
% files generated in Step9)
%
function calcSigesAl
fig = figure;
set(fig, 'Position', [412 313 915 632]);
%
% Assumed constan... |
function PACK_highlight_archs_with(archs,results,i)
global params
PLOT_FLAGS = [1 1 1 1 1 1 1 1];
UTILITIES = isfield(results,'utilities');
PARETO =isfield(results,'pareto_rankings');
DC =isfield(results,'data_continuities');
sciences = results.sciences;
costs = results.costs;
programmatic_risks = results.programmati... |
addpath(genpath('./MALSAR-master/MALSAR/functions/')); % load function
addpath('./MALSAR-master/MALSAR/utils/'); % load utilities
addpath('./functions/'); % load utilities
addpath('./cvx/'); % load utilities
rng(2);
r = 10;% # region
n = 30;% # sample size in each region
dl = 10; % # local feature
dr = 8; % # r... |
figure
x = [1 2];
y = [1 2];
h = animatedline(x,y,'Color','r','LineWidth',3); |
function ret = out
ret = 0;
end |
clc;clear;
close all;
tspan=[0 86400];
h=1;
t=tspan(1):h:tspan(2);
x0=[75*10^-4 %[NADP+]
112*10^-4 %[ADP]
200*10^-6 %[RuBP]
1.34*10^-2 %[Ci]
200*10^-6 %[PGA]
200*10^-6 %[DPGA]
200*10^-6 %[PGAld]
0]; %[sugar]
p1=[10^8
10^0
10^0
... |
close all;
clear all;
clc;
Ra= 2.7;
La = 0.004;
J = 0.0001;
Kaphi = 0.105;
B = 0.0000093;
Amat = [-Ra/La -Kaphi/La; Kaphi/J -B/J];
Bmat = [1/La;0];
Cmat = [0 1];
Dmat = [0];
step(Amat,Bmat,Cmat,Dmat)
system = ss(Amat,Bmat,Cmat,Dmat);
x0 = [5;80];
figure
initial(system,x0);
% op =[];X=[0;0];U = 220;der=[];
% for t=0:0.0... |
fileID = fopen('recv1.txt','a');
expectedSeqNo = 1;
%fclose(fileID);
while 1
[packetStructure isPacketOK] = MAC_receivePacket(radioConfigs);
if (isPacketOK == 1)
packetStructure
if (packetStructure.type == 'D')
MAC_sendPacket(tx, 'A', 0, packetStructure.seqNo, packetStruct... |
% Kaja Coraor
% Comp 590
% Assignment 4
% Part 1
clear all
close all
%{
Hand: click (e.g. ginput in matlab) on points and use the
techniques from lecture to find correspondences, then map
the images on top of each other and use techniques from
assignment 2 for blending. Remeber to do mean subtraction
and no... |
function [ranking, scores] = calc_scores(method, residuals)
load metadata.mat
switch method
case 'none' % no weighting; a simple sum
sum = zeros(1,numcontigs);
for i = 1:numcontigs
res = residuals{i};
[~,n] = size(res);
for j = 1:n
sum(i) = s... |
clear; close all; clc;
simulationData = importdata('SimulationData.mat');
% X (meters), Y (meters), ID, Time (Seconds), Species
simulationData = simulationData(:, [2 3 4 5 11]);
% Get cattle data
isCattle = strcmp(table2array(simulationData(:, 5)), 'C');
cattleData = simulationData(isCattle, :);
% Order by time
[tim... |
close all
clear all
pkg load image
#selecionando imagem e pegando o nome dela
[fileName, pathName] = uigetfile({'*.jpg'});
imagem = strcat(pathName, fileName);
#colocando a imagem lida em uma variavel
img = imread(imagem);
img_gray = rgb2gray(img);
#size(img_gray);
#mostrar canal red, ficou mei... |
% Build features
addpath("/home/valentin/Working/phd_project/build_dataset/scripts");
load("filenames.mat");
pkg load signal;
% Select parameters
n_max_files = 2420;
v_files = all_files(1 : n_max_files);
fs = 16000;
frame_ms = 100;
frame_inc_ms = 50;
frame_ms_vad... |
dt = [];
clear at lt
for n = 1:numel(data);
dt = [dt, [data(n).Aquadopps(3).Timestamp{:}]-[data(n).Aquadopps(3).LoggerTime{:}]];
at(n,:) = [data(n).Aquadopps(3).Timestamp{:}];
lt(n,:) = [data(n).Aquadopps(3).LoggerTime{:}];
end
at = at';
lt = lt';
figure(1);clf
subplot(3,1,1)
plot(dt)
subplot(3,1,2)
plot(... |
classdef KernelTransformer < Transformer
properties
kernelType;
kernelParams;
basis;
end
%% Main methods
methods
function obj = KernelTransformer(kernelType, kernelParams)
if nargin == 0
kernelType = 'rbf'; kernelParams =... |
function Fi = izracunRegKoefTih(Sc, Sr, alpha)
% Vrne regulaacijske koeficjente, ki jih dobimo pri regularizaciji
% tihonovega
vecSc = diag(Sc);
vecSr = diag(Sr);
Fi = vecSc * vecSr';
Fi = Fi .^2 ./ (Fi .^2 + alpha^2);
|
clear;
clc;
filename = '1ZoneEvapCooler.idf';
original_file = textread(filename,'%s','delimiter', '\n');
original_data = GetSingleInput(filename);
fake_data = zeros(1000,15);
for i = [1,5,9,10,11,12]
fake_data(:,i) = original_data(i) * (0.5 + rand(1,1000));
end
for i = setdiff(1:15,[1,5,9,10,11,12])
... |
x = linspace(-5,5,200)'
meanfunc = [];
hyp.mean = [];
%meanfunc = {@meanSum, {@meanLinear, @meanConst}}; hyp.mean = [0.5; 1];
covfunc = {@covProd, {@covPeriodic, @covSEiso}};
hyp.cov = [-0.5 0 0 2 0];
likfunc = @likGauss;
hyp.lik = 0;
n = 200;
%x = gpml_randn(0.3, n, 1);
K = feval(covfunc{:}, hyp.cov, x)... |
classdef PackageQueue < Queue
methods (Access = protected)
function package = last(obj)
if obj.isempty
error('ILLEAGAL OPERATION');
else
package = obj.X{obj.prev(obj.tail)};
end
end
end
methods
function push(obj... |
function nc = count_visible(R, t, verts, f)
vp = R*verts + repmat(t, 1, size(verts, 2));
vp = vp ./ repmat(vp(3, :), 3, 1);
vp = vp*f + repmat([f/2; f/2; 0], 1, size(verts, 2));
good_inds = (vp(1, :) > 0) & (vp(1, :) < f) & (vp(2, :) > 0) & (vp(2, :) < f);
nc = length(find(good_inds));
end |
function draw_result( x, box1_springs, box2_springs )
% the function draws the result of the optimization
% x is a vector with the optimization result
% box1_springs is the uncompressed spring shape data from box1
% box2_springs is the uncompressed spring shape data from box2
% Modify the height of the shape based on ... |
function f = fft3d(F,dir)
% Perform fft or ifft in 3d
Nx = size(F,1);
Ny = size(F,2);
Nz = size(F,3);
if dir==1
f = fft(fft(fft(F,Nx,1),Ny,2),Nz,3);
f(floor(Nx/2)+1,:,:) = zeros(Ny,Nz);
f(:,floor(Ny/2)+1,:) = zeros(Nx,Nz);
f(:,:,floor(Nz/2)+1) = zeros(Nx,Ny);
else
f = ifft(ifft(ifft(F,Nz,3),Ny,2),... |
function [ xstar, fval, exitflag, output ] = uq_ceo(fun, x0, sigma0, lb, ub, options)
%
% UQ_CEO : Cross-entropy optimization implementation following:
% Cite here that Kroese guy
% UQ_CEO attempts to solve problems of the following form:
% Xstar = argmin F(X) where: lb <= X <= ub
% X
%
%
% Xstar = UQ_CEO(FU... |
function doallsubs(root,navg,points, iscomplex)
%function doallsubs(root,navg,points [,iscomplex])
%
% Do all subtractions for a series of AST images
% Assumes the files are AST pairs, wher the the control is the first image
% and all others are tags of different duration
%
% The first pair is skipped in every set o... |
function splot_xy(mymesh, FF);
% TODO - z argument
Nz0 = mymesh.Nz0;
Nr = mymesh.Nr;
Np = mymesh.Np;
R = mymesh.R;
A = reshape(FF(Nz0,:,:),Nr,Np+1);
x = reshape(mymesh.xxx(Nz0,:,:),Nr,Np+1);
y = reshape(mymesh.yyy(Nz0,:,:),Nr,Np+1);
surface(x,y,A, 'EdgeAlpha', 0.2);
xlim([-R R]... |
function r = init_KBEOSS2(params,WATCH)
%% Java path
% Add path
% javaaddpath('C:\Documents and Settings\Dani\My Documents\software\Jess71p2\lib\jess.jar');
% javaaddpath('C:\Documents and Settings\Dani\My Documents\NetBeansProjects\EOLanguage\dist\EOLanguage.jar')
% javaaddpath('C:\Documents and Settings\Dani\My Docum... |
%FELIPE ESCALLON PORTILLA
%11/AGO/2004
%MATLAB:TTL'S
%EJERCICIO CON ARREGLOS:ver cuaderno
t=1:10; %default: paso=1--->t=1:1:10
x=t.*sin(t);
y=(t-1)./(t+1);
z=sin(t.^2)./t.^2;
disp(' x y z')
disp([x;y;z]')
%el equivalente sin vectores
pause(2)
%t=0;
for t=1:10
%t=t+1;
... |
function seg = segBkLong(seg0, nTh)
% Breaking long segment into smaller segments.
%
% Input
% seg0 - original segmentation
% nTh - thershold for breaking
%
% Output
% seg - new segmentation
%
% History
% create - Feng Zhou (zhfe99@gmail.com), 11-03-2009
% modify - Feng Zhou (zhfe99@gmail... |
classdef Moebius < parameter.rization
properties (SetObservable=true, AbortSet=true)
xpoints
ypoints
end
properties (SetAccess=private, Hidden=true)
% coefficients that determines the transformation
% f(x) = (a*x+b)/(c*x+d)
a
b
c
d
end
%% pr... |
function [pMap] = mbs_saliency(img)
% This is a matlab implementation of the method described in:
%
% "Minimum Barrier Salient Object Detection at 80 FPS", Jianming Zhang,
% Stan Sclaroff, Zhe Lin, Xiaohui Shen, Brian Price, Radomir Mech, ICCV, 2015
%
% Contact: jimmie33@gmail.com
%
% Prerequisite: OpenCV 2.4+
%
... |
function [jacobian]=forwardJacobianOneLayerNet(net,netState,ind)
dnet1=delta .* (1-netState.outs .* netState.outs);
gradient.weights1=dnet1*netState.hiddens';
gradient.bias1=sum(dnet1,2); %sum(dnet1')'
dInputs=net.weights1'*delta;
|
function [fit_cft,rmse,lambda,yhat]=Lasso_Fit(x,y)
% Using lasso for timeseries modeling (01/27/2013)
% Auto Trends and Seasonal Fit between breaks
% INPUTS:
% x - Julian day [1; 2; 3];
% y - predicted reflectances [0.1; 0.2; 0.3];
%
% OUTPUTS:
% fit_cft - fitted coefficients;
% General model TSModel:
% f(x) = a0 + b0... |
function a = rightRotate(a,r)
nValues=size(a,2);
temp=zeros(1,r);
j=r;
for i=nValues:-1:nValues-r+1
temp(j)=a(i);
j=j-1;
end
for k=1:r
for i=nValues-r+k:-1:1+k
a(i)=a(i-1);
end
end
for i=1:r
a(i)=temp(i);
end
end |
function stimout = CutShortStim(stimin,dtmin)
dt = diff(stimin(2,:));
badi = find(dt < dtmin);
goodi = setdiff(1:size(stimin,2),badi);
stimout = stimin(:,goodi);
|
%% HYBRID LEARNING
% dati x,y,pts
nit = 100;
st = 20;
fig = figure(1);
fig.WindowState = 'maximized';
tiledlayout(3,3)
nexttile([2 3]);
surf(x,y,f(x,y),f(x,y),'FaceAlpha',0.4)
nexttile(9)
h = animatedline('Marker','o');
h2 = animatedline('Marker','*','Color','red');
figure(1)
t = f(x,y);
prec_err = ... |
clear
clc
global alpha
global count
count = 0;
%change these
t0 = 0;
tfin = 100;
h = 1;
yinit = 0.5;
alpha = 0;
epsilson = 0.005;
hraise = 1.1;
hcut = 1.1;
hbig = 10;
hsmall = 0.1;
%don't change these
p0 = yinit;
P = p0;
T = t0;
while T+h <= tfin
error_approx = error_approximation(T,P,yhigh,ylow,h);
if err... |
function [NewRotAxis,NewTranslation] = CalculateNewRotTrans(NewParameters)
% These parameters are perturbed one at a time and the new translation and
% rotation vectors use the perturbed values as output
NewRotAxis(1)=NewParameters(6);
NewRotAxis(2)=NewParameters(7);
NewRotAxis(3)=NewParameters(8);
NewTranslation(1)=Ne... |
function [cr]=variance(i)
v1=i;
%v2=i(:,2);
%v3=i(:,3);
[m n]=size(v1);
vr=(sum(v1));
vr=(sum(vr));
%vg=sum(v2);
%vg=sum(vg);
%vb=sum(v3);
%vb=sum(vb);
v1=double(v1);
%v3=double(v3);
%v2=double(v2);
v1=power(v1,2);
%v2=power(v2,2);
%v3=power(v3,2);
Vr=sum(v1);
Vr=sum(Vr);
%Vg=sum(v2);
%Vg=sum(Vg);... |
function [ centroids] = KMean( dataset , K )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
% Exercise 7.1
% 3 data points.
% loop parent.
% compare value with all centroids and assign it to the closest one.
% calculate mean for all k's.
firstTime = 1;
centroids = 0;
a=1;
colors = rand(... |
function path = getOneDrivePath
%GETONEDRIVEPATH Returns path to my OneDrive folder on different computers
if exist('C:\Users\Ture\OneDrive - University Of Cambridge\','dir')
path = 'C:\Users\Ture\OneDrive - University Of Cambridge\';
elseif exist('C:\Users\tfh26\OneDrive - University Of Cambridge\','dir')
pat... |
function [area,nmach_a] = zabors(MK,tol)
% Syntax: [area,nmach_a] = zabors(MK,tol)
%
% Purpose: Find the coherent machine groups using the
% clustering algorithm by John Zaborszky.
% (IEEE Trans. CAS, vol. 29, pp. 747-757, 1982.)
%
% Input: MK - the linearized -inv(M)*K matrix, where M is
% ... |
function [W, Error] = LVQ(Data, W, cluster)
% intializing parameters
Examples = length(Data(:,1));
MisclassifiedCount = 0;
Epoches = 20;
learnrate = 0.01;
previous_error = 0;
constant_error_rate_counter = 0;
% loop epoches
for epoch=1:Epoches
MisclassifiedCount = 0;
% iterate over the datapoints
for idx=1:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.