text stringlengths 8 6.12M |
|---|
function [performanceArray] = multiEpochAnalyser( imdb, epochOutNetLocation )
%multiNetworkAnalyser: This function analyses multiple Epochs of a network
%based on test data in the IMDB to determine the point where overfitting
%sets in
% This function takes in the address of a file location where by multiple
% epoch... |
function [b,c] = Potegowa(x,y) %do zad4.m
z=log(y);
u=log(x);
[a1,a2]=Liniowa(u,z);
b=exp(a2);
c=a1;
end
|
function bad_days = dsp__get_days_with_unequal_outcomes( obj, within, outcomes )
if ( nargin < 3 ), outcomes = { 'self', 'both', 'other', 'none'}; end;
days = obj.enumerate( 'days' );
bad_days = {};
for i = 1:numel(days)
day = days{i};
objs = day.enumerate( within );
for k = 1:numel(objs)
curr_obj = objs{k};
... |
% Close all open figures and clear everything except breakpoints
if ~strcmp(Verbosity,'None')
display('-I- Closing figures and cleaning...');
end
close all;
current_break_points = dbstatus;
save('myBreakpoints.mat', 'current_break_points');
% Clearing
%clear all;
clear functions;
clear global;
clear import;
clea... |
#include "com_codename1_ui_animations_Motion.h"
const struct clazz *base_interfaces_for_com_codename1_ui_animations_Motion[] = {};
struct clazz class__com_codename1_ui_animations_Motion = {
DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_com_codename1_ui_animations_Motion ,0 , &__GC_MARK_com_c... |
%% Get data
clear
PlotData = 0;
Npts = 26000;
tmon = (0:131071)/97656.25;
TimeString = 'yyyy-mm-dd HH:MM:SS.FFF';
WaveCounterLast = getpvonline('ztec13:Inp1WaveCount');
for j = 1:100000
SaveFlag = 0;
[Iref, ~, IrefTs] = getpvonline('BR1:QD:RAMPSET', 0, 'int32');
IrefTs = labca2datenum(IrefTs);
f... |
function elem=atM66(fname,varargin)
%ATM66 Create an element applying an arbitrary 6x6 transfer matrix
%
%FAMNAME family name
%M66 transfer matrix, defaults to Identity(6)]
%PASSMETHOD tracking function, defaults to 'Matrix66Pass'
%
%ATM66(FAMNAME,ATSTRUCT,PASSMETHOD)
% atM66 will generate the matrix by calli... |
%%
function threads=init_threads(threads)
warning('off','parallel:convenience:RunningJobsExist')
warning('off','parallel:job:DestructionOfUnavailableJob')
[~,vers]=version;
versN=datenum(vers);
switch sign(versN-datenum('2014','yyyy'))
case -1
oldCase(threads)
case 1
... |
%% bulid in
% matrix(:) -> colum
% mean / var / cov
% norm ( Euclidean norm) /
% efficiency, delete variables,
smse = 1e4;
sssim = 1e7;
len = 256;
cref = im2double(imread('1.png'));
cref = imresize(cref,[len,len]);
gref = rgb2gray(cref); % must use im2double
[row,col] = size(gref);
seed = 120;
rng(s... |
% Name: ConstructTrainTestMatrices.m
% Description: Divide the data into training and testing trials
% Authors: Meena AbdelMaseeh, Tsu-Wei Chen, and Daniel Stashuk
% Data: March 23, 2015
function [TestingGestureTrialMatrix,TrainingGestureTrialMatrix] = ConstructTrainTestMatrices(RawGestureTrialMatrix)
NumOfGestures ... |
% Analiza el registro donde se inyectan los fallos
%
% Para ello, muestra en pantalla la media y desviacion de todos los bits
% que se seleccionaron para analizar y representa una grafica media/bit
switch chosen_index
case 1
media=mean(error.data((1:cicle),1)-error.data((cicle+1:cicle*2),1... |
clear
clc
close all
sampleCt = 3;
viewlim = [1e-4 1e-1];
%%
% Glycerol
data = load('/Users/jaredking/Documents/Classes/Chemistry/Research/Summer2016/TradSSET2_M212Samples_23_28June2016/TradSSET2_M212_9months_Overnight_23June2016/1/ILTs/TradSSET2_M212_Overnight_23June2016.out');
lowlim = 1e-4;
hilim = 1e-1;
... |
% Writes/reads a large set of images into/from multiple directories.
%
% This is useful since certain OS handle very large directories (of say
% >20K images) rather poorly (I'm talking to you Bill). Thus, can take
% 100K images, and write into 5 separate directories, then read them back
% in.
%
% USAGE
% I = imwrite2... |
function [u] = hank(B,jkrm,u)
n=size(u,2);
m=fftshift(-n/2:n/2-1);
u=fft(B*u,[],2);
for j=1:size(jkrm,3)
u(:,j)=jkrm(:,:,j)*u(:,j);
end
u=ifft(u*diag(1i.^m),[],2);
end |
function [globalImg directImg] = separateGlobalDirect(dirname)
imglist = dir(sprintf('%s/*.png', dirname));
img = double(imread(sprintf('%s/%s', dirname, imglist(1).name)))/255;
[m n] = size(img);
minImg = img;
maxImg = img;
assert(numel(imglist)>=2);
for i = 2:numel(imglist)
[path imgname dummy] = fileparts(im... |
%=========================================================================
%
% Finite sample properties of the Bai and Ng (2004) of the PANIC model
%
%=========================================================================
function lfac_panic( )
clear all
clc
RandStream.setDefaultStream( RandStream... |
function s=getWatchedStatesP2XInact2noallo(y)
s=[y(:,1),y(:,2),y(:,4),y(:,6),y(:,8),y(:,10),y(:,11),y(:,12),y(:,13),y(:,14),y(:,15),y(:,16),y(:,17),y(:,30),y(:,31),y(:,32),y(:,33),y(:,34)];
end |
close all
clear all
%% Inicialização dos Dados
tic;
dado = load('dados_4.txt'); %matriz de caracteristicas
dim = size(dado); %dimensoes da matriz
N_Lin = dim(1); %numero de vetores de caracteristicas
N_Col = dim(2); ... |
function L = cotmatrix_intrinsic(l,F,nvert)
% COTMATRIX_INTRINSIC Compute cotangent Laplacian using edge lengths (not
% vertex positions).
%
% L = cotmatrix(l,F,nvert)
%
% Inputs:
% l #F by 3, array of edge lengths of edges opposite each face in F
% F #F by 3, list of indices of triangle c... |
function g2 = IPpyr_recon(g,J,sigma)
width = size(g, 2);
f = zeros(width, width);
startRow = 0
for i=0:(J-2)
startRow = startRow + width*power(0.5, i);
end
fJ = g(startRow + 1:end, ((width-width * power(0.5, J-1))/2):((width+width * power(0.5, J-1))/2)-1);%smallest image
for j = (J-1):-1:1
residual = ... |
function [ rho,u,p,M ] = sub( x,~,pb,p0,f )
%Function "sub"
% Computes an exact solution at an x-location for a subsonic,
% isentropic flow through a Q1D nozzle.
% -------
% Inputs: sub(x,~,pb,p0,f)
% x :: Vector of x-locations where solution is desired
% pb :: Nozzle back pre... |
function d = distanc(p1,p2)
% Eucliden distance between points
% rows: different points
% columns: value of each dimension
%
%
% MatSprings: Matlab 3D spring truss simulator
%
% Copyright (C) 2008 Daniel Lobo (dlobo@geb.uma.es)
%
% This file is part of MatSprings.
%
% MatSprings is free software: you ... |
Traces=DenoisedTraces(idx_components+1,:);
figure;imagesc(zscore(Traces,1,2),[-0.5 4]);colormap hot;
ROI_temp=ROIs(:,idx_components+1);
ROI_temp=reshape(full(ROI_temp),[size(Correlation_image) length(idx_components)]);
figure;imagesc(squeeze(sum(ROI_temp,3)));
ROI_GPU=gpuArray(ROI_temp);
ROI_centroid=zeros(size(ROI_t... |
function output = Student(varargin)
% This is a Student class constructor
if nargin == 0
output.id=0;
output.name='';
output.preference=[];
output = class(output,'Student');
elseif nargin == 1 & isa( varargin{1}, 'Student' )
output = varargin{1};
elseif nargin==3
outp... |
p1=[1,2,4,0,5];
p2=[1,2];
p3=[1,2,3];
p=conv(p2,p3);
p=p1+[0,p];disp(p);
x=roots(p);disp(x);
A=[-1,1.2,-1.4;0.75,2,3.5;0,5,2.5];
y1=polyval(p,A);disp(y1);
y2=polyvalm(p,A);disp(y2);
|
function [U, V, D] = render_model_matlab(centers, blocks, radii, tangent_points, W, H, P, p)
% D = -1.5 * ones(H, W);
% while true
% n = randi([1, W], 1, 1);
% m = randi([1, H], 1, 1);
% d = P * [n; m; 1];
% d = d / norm(d);
%
% i = ray_model_intersection(centers, blocks, radii, tangent_points, p, ... |
function order_check(path, N_values, suffix_name)
%
%
%
%
% Copyright (c) 2019, Alexander D. Kaiser
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are met:
% ... |
%% RasterPlots
load('A')
RasterPlot=false(max(A(:,2))+1,A(end,1)-A(1,1)+1);
RasterPlot(sub2ind(size(RasterPlot),A(:,2)+1,A(:,1)-A(1,1)+1))=1;
B=RasterPlot;
figure('units','normalized')
[y,x]=find(B(:,1:10000));
Title='Before Injury';
h1=axes('position',[.13 .4 .77 .48]);
scatter(x(y<601)/5000,y(y<601),'marker'... |
function D = dmatrix(P)
% Distance Matrix (Eucledean distance)
%
% A simple function to calculate the distances of all pairs of points in a
% given group, as rows of a matrix P. The advantage of this method is that it
% exhibits a small computational cost.
%
% Created by Dr. Zacharias Voulgaris, 2009
N = size(P,1... |
%+++ Import data;
clear;
load DM2;
np=randperm(96);
Xtrain=Xcal(np(1:60),:);
ytrain=ycal(np(1:60));
Xtest=Xcal(np(61:96),:);
ytest=ycal(np(61:96));
%+++ Cross validation
A=6;
K=5;
method='autoscaling';
%+++ Build a PLS-LDA model
nLV=3;
LDA=plslda(Xtrain,ytrain,nLV);
[ScoresTest]=plsldaproj(LDA,Xtest)... |
function m = melinv(f)
m = 700*(exp(f/1125)-1);
m;
|
% File: ExampleB_04.m for Example B-4
clear;
clf
% Try various values for m and sigma to give the results
% shown in Fig. B-5
sigma = 0.25;
m = 1.25;
x = -1:0.01:3.5;
for (i = 1:1:length(x))
f(i) = (1/(sqrt(2*pi)*sigma))*exp(-((x(i)-m)^2)/(2*sigma^2));
F(i) = 1-Q((x(i)-m)/sigma);
end;
subplot(211)
plot(x,F)... |
function mu=XuGetAtten(s,density,energy)
%mu=XuGetAtten(s,density,energy)
%s is the string of the atten file
%density is in g/cm^3
%enegy is in keV
%output unit: cm^{-1}
data=importdata([s,'_atten.txt']);
energy_MeV=energy/1000;
if min(energy_MeV)<min(data(:,1)) || max(energy_MeV)>max(data(:,1))
error('Energy out... |
function z = generateSimulatedBouncingPath(iterationNum, roundTimes)
% This function generates the Z-coordinate path for the center of heart.
% by Xin Zhao
% Feb 14, 2008
% define the z path of the center of ball for rountTimes of bouncing along z-axis
if nargin < 2
roundTimes = 3;
end
if nargin < 1
... |
%% calculate the precision and recall for SE detector
clear all
clc
% read the groundtruth
load cougar
precision_opt = [];
recall_opt = [];
for k=1:1:5
G = groundTruth(k); % select the groundtruth
% calculate the precision and recall for each threshold
[thrs,cntR,sumR,cntP,sumP,V] = edgesEvalImg(E,G); % E is the edg... |
function [ U_cellVar,V_cellVar,U_aP_sumMat,V_aP_sumMat ] = MomentumEq(veloRelax,m, pGradMat,mu_faceVar,faceVelocity,U_old,V_old,U_BC,V_BC,rho,ALGORITHM_TYPE )
%MOMENTUMEQ Summary of this function goes here
% Detailed explanation goes here
% Discretization of the diffusive term
Mdiff = diffusionTerm(mu_faceVar);
% D... |
figure
% 任务模式作图
subplot(221)
data = ENUM_FlightTaskMode(SL.OUT_TASKMODE.flightTaskMode);
plotEnum(data);
legend('flightTaskMode')
% 控制模式
subplot(222)
data = ENUM_ControlMode(SL.OUT_TASKMODE.AutoManualMode);
plotEnum(data);
legend('autoManual')
% 飞机模式
subplot(223)
data = ENUM_UAVMode(SL.OUT_TASKMODE.uavMode);
plotEnum(d... |
close all
clear all
xgrid=-10:.01:10;
mu=2; sigma=2;
y=normpdf(xgrid,mu,sigma);
plot(xgrid,y,'linewidth',2)
|
function [seq_iv,decoded_z] = DecSeqDetectZ(cfg_in,P)
% function [seq_iv,decoded_z] = DecSeqDetectZ(cfg_in,P)
%
% detects intervals containing sequences of decoded locations
%
% INPUTS:
%
% P: tsd containing decoded posterior - output of DecodeZ()
%
% OUTPUTS:
%
% seq_iv: iv with start and end times of detected sequenc... |
% YOUR SCRIPT NAME HERE
% ---------------------
% This is a template for an imlook4d script that runs your code and works in EXISTING imlook4d window.
% For documentation: a) imlook4d menu "/HELP/Help", or
% b) type in matlab: open('Scripting-imlook4d.pdf')
%
% 1) Edit your own code, and sav... |
%% ak7213_ipm_v11
% Matlab based Interior Point Method to solve a Linear Program
% v[1][1] indicates the following
% [1] - Same Arrival Time, Same Deadlines Problem
% [1] - No block elimination carried out on the KKT system
% Author: Anand Kasture (ak7213@ic.ac.uk)
% Date: 12 Feb 2017
%% Notation
% m: scalar numb... |
function springs_setup()
dir_solver = fullfile('.','springs_solver') ;
dir_solver_obj = fullfile(dir_solver,'obj') ;
if ~exist(dir_solver_obj)
mkdir(dir_solver_obj)
end
system(sprintf('make -C %s clean',dir_solver)) ;
system(sprintf('make -C %s',dir_solver)) ;
end |
variables_to_load = {'all_wavelengths', 'all_flux', 'all_noise_variance', ...
'all_pixel_mask', 'all_sigma_pixel'};
load(sprintf('%s/preloaded_qsos_%s', processed_directory('dr12'), ...
training_set_name), variables_to_load{:});
pltQSO(this_flux, this_wavelengths, c4_muL2, c4_muL1, ind_zoomL2, ind_zoomL... |
%% OCR Detection Function
%This function takes image and video both as the input and will return a
%single number in the given image or video
%In order to run this function, the only input required is the complete
%image path
function ocr_pred = detectNum(filename,varargin)
numvarargs = length(varargin);
if n... |
% This is a function file: GeneratorCOPT(G,PR,A)
% This calculates the 'Outage Probability' for a single Power SGeneratorCOPTMatrixion
% G stands for number of generating unit
% PR stands for Power Ratings of each unit (in Array form)
% A stands for Availability of each unit (in Array form)
%
%
% By: Abhishek C... |
% ESTIMATE IRFs and FEVDs from LARGE TVP VAR MODEL using QBLL Methods.
N=9;
dimB=N*(1+N*LL);
%%
% GENERATE STORAGE MATRICES AND INCLUDE SOME PRELIMINARIES
HO=21; %IRF Horizon, Also use this for FEVD horizon.
% If problems saving 5D data will split into 4D where we separate matrices
% by number of shocks. When ... |
function [ BETA ] = limiter_DGlimiter_detector(DGcoeffs,DGpast,data)
%2D Limiter
DGcoeffs_limited = NaN(data.thetaT,data.Nv1,data.Nv2);
%Step 0
%DG_ghosts = problem_boundaryconditions_psi(DGcoeffs,data);
%Step 1
q_max = zeros(data.Neqns,data.Nv1,data.Nv2);
q_min = zeros(data.Neqns,data.Nv1,data.Nv2);
q_ave = zeros(da... |
function [r_eci, v_eci] = OE2ECI(a, e, i, RAAN, w, anom, mu)
% OE2ECI Converts orbital elements to r, v in inertial frame
%
% Notes:
% In cases of equatorial and/or circular orbits, it is assumed
% that valid orbital elements are provided as inputs (ie. there is
% no back-end validation)
%
... |
clear; clc; close all;
%% PASSO 1: importa a musica e mostra seu espectro
[sinal, Fs] = audioread('sinal_questao4.wav');
%% PASSO 2: plota espectro (caso voce queira ver)
numero_amostras_sinal = length(sinal);
eixo_n = (0:numero_amostras_sinal-1);
eixo_tempo = eixo_n*(1/Fs) ;
espectro_sinal = fft(sinal);
eixo_fre... |
#include "com_codename1_ui_TextField_CommandHandler.h"
const struct clazz *base_interfaces_for_com_codename1_ui_TextField_CommandHandler[] = {};
struct clazz class__com_codename1_ui_TextField_CommandHandler = {
DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_com_codename1_ui_TextField_CommandH... |
function [S, SX, SY] = getBatchRsqs(fitobjs, modelName, takeMedian)
if nargin < 3
takeMedian = false;
end
if isfield(fitobjs, 'snr')
fieldnm = 'snr';
else
fieldnm = 'baselineRate';
end
SX = [fitobjs.(fieldnm)];
SY = [fitobjs.ntrials];
Z = cellfun(@(x) {x.(modelName)}, {fitobjs.fits}, 'uni', 0);
Z = cellfu... |
load('.\results\ALGM.mat')
% subplot(2,2,1)
% length = [Line500kvTotalLength_RC Line230kvTotalLength_RC Line115kvbelowTotalLength_RC;...
% Line500kvTotalLength_noRC Line230kvTotalLength_noRC Line115kvbelowTotalLength_noRC];
% bar(length','hist')
% title('')
%
% subplot(2,1,1)
% length1 = ... |
function [F,V]=subQuad(F,V,n)
%%
if size(V,2)==2
V(:,3)=0;
end
for qIter=1:1:n
numV=size(V,1);
X=V(:,1); Y=V(:,2); Z=V(:,3);
%% DERIVE EDGE INDICES AND FACE-EDGE INDEX MATRIX
%Format of column index in F
EColumnInd=[(1:size(F,2)); (1:size(F,2))];
EColumnInd=[ECo... |
%%%%% Matrice adjacente du graphe orienté présenté dans l'exemple du .lyx
M=[0 1 0 0 0 0 0 0;
0 0 1 0 0 0 0 0;
0 0 0 1 0 0 0 0;
0 0 0 0 1 0 1 0;
0 0 0 0 0 1 0 0;
1 0 0 0 0 0 1 0;
0 0 0 0 1 0 0 1;
1 0 0 0 0 0 0 0];
%% Voisins de +1/+2/-1 évènement
M|M^2|M'
%% Cycles de taille 1
eye(8,8)&M
%% Cycl... |
snitt = []
avvik = []
skew = []
kurtos = []
%%%%%%%%
teller = 0;
m = find(Uniq.MatRatio == 30/365)
Unik = unique(Uniq.Date(m))
for n = 1:100%length(Unik)
%PREPARING MATRIX FOR EACH UNIQUE SETTLEMENT TIME
clear B C D E F
B = Uniq(m,:); %Table with only 30 days to maturity
j = find(contains(B.Da... |
function [ sum ] = pip( x )
%pip Finds the pip value
% This function calculates the pip value of player/computer
sum = 0;
for i=1:25
if i==1 % bar
sum = sum + 25*x(i);
else
sum = sum + (26-i)*x(i);
end
end
end
|
% CT torso
imageFilename = '/home/rothhr/Code/CADLab-GitHub/Data/ISBI2015_data/TorsoCT001.nii.gz' % please specifiy
output_dir = '/tmp/TorsoCT001' % please specifiy
% Pancreas
imageFilename = '/home/rothhr/Code/CADLab-GitHub/Data/ISBI2015_data/1002.nii.gz' % please specifiy
output_dir = '/tmp/1002' % please specifiy
%... |
% https://www.nature.com/articles/nmeth.2645#s1
% page 24.
load examgrades.mat
% x=X(1:10,1:20);
% gm2 = @(x) exp(sum(log(x))/numel(x));
% sf=nanmedian(x./nangeomean(x,2));
% sf1=median(x./geomean(x,2));
% sf2=median(x./geomean(x,2));
% x_n=x./sf;
x=X;
xn0=x;
xn0(xn0==0)=nan;
sf=nanmedian(xn0./n... |
%% Plot BGOnly
% make sure that the output from Simulink
% are in the TimeSeries format
clc;
tic;
threshold = 0.6; % 0.6 is default
f_sampl = 1/0.1;
FontSize = 14;
warning('OFF')
sim('BGOnly.slx',[])
fprintf('Model Simulated \n')
figure;
h = waitbar(0,'Wait...');
for nn = 1:5
%% Subplot
subplot(5,1,nn);
hold... |
function [ num ] = salientNumCnt( filesDir, totalNum )
%SALIENTNUMCNT Summary of this function goes here
% Detailed explanation goes here
allPoints = zeros(1,totalNum);
fileExt = '*.txt';
files = dir(fullfile(filesDir,fileExt));
for i=0:length(files)-1
fileCnt = num2str(i... |
% Examples 2.4 and 2.5
% from Parameter Estimation and Inverse Problems, 3rd edition, 2018
% by R. Aster, B. Borchers, C. Thurber
%make sure we have a clean environment
clear;
rand('state',0);
randn('state',0);
%
% The code that generated the data.
%
%beta0 = 10;
%beta1 = 100;
%beta2 = 9.8;
%for t=1:10
%x(t,1)=t;
%s... |
function y=plyinterpolate(x, c, n, wezly)
[rzad, kolumna] = size(x)
y = [];
for i=1:rzad
for j=1:kolumna
qs = [];
for k=0:n
qs(k+1) = q(k, x(i,j), wezly);
end
y(i,j) = sum(c.*qs);
end
end
end |
clear;clc;
g=9.8;
m=0.217;
eB_P=[0 0 1];
IB_B=[102 24 9;24 318 0;9 0 414]*10^(-5);
IB_P=diag([0 0 1.5])*10^(-5);
rB_P=[0.17;0;0];
KB_d=diag([0.55 0.55 1.1])*10^(-4);
K_tau=1.1*10^(-7);
K_f=-6.41*10^(-6);
%Hover equations
% syms a1 a2 a3 OMG
% omgB_BE=[a1;a2;a3];
% omgB_B_PB=[0;0;OMG];
omgB_BE=[6.16885093222700;-2.851... |
function [tn,xn,xcn] = pacemakerModelRun(t0,x0,xc0,increment,lightArray)
% PACEMAKERMODELRUN runs the LRC's version of the circadian pacemaker
% model (based on Kronauer's 1999 paper) using the given light data.
%
% Input:
% t0: The initial relative time of the data in seconds (0.0<=t0<86400)
% x0: P... |
% This code implemented a comparison between “k-means” and “mean-shift”
% Teste methods are:
% Kmeans segmentation using (color) only
% Kmeans segmentation using (color + spatial)
% Mean Shift segmentation using (color) only
% Mean Shift segmentation using (color + spatial)
% an implementation by "Bryan Feldman" is us... |
% Task 3: Negative three ways, and colour swapping
% Method 1
% First, letís load and display an image. Any image will do; letís use the peppers image that
% comes with Matlab.
I = imread('peppers.png');
imshow(I);
% As you learned in lecture, a negative of an image can be easily achieved by simply as
J = 255 - I;
figu... |
function varargout = drawSphere(varargin)
%DRAWSPHERE Draw a sphere as a mesh.
%
% drawSphere(SPHERE)
% Where SPHERE = [XC YC ZC R], draw the sphere centered on the point with
% coordinates [XC YC ZC] and with radius R, using a quad mesh.
%
% drawSphere(CENTER, R)
% Where CENTER = [XC YC ZC], specifie... |
function barerror (X,Y,E,width,color)
if mean([size(X,1),size(Y,1),size(E,1)]) ~= length(X) error ('Imput vectors are of different lengths'); return; end
if size(Y,2) ~= size(E,2) error ('Data and Error vectors have different number of columns'); return; end
colors= ['k';'w';'r';'g';'b';'c';'m';'y'];
hold on
n... |
function C = p4(w, X)
% Function p4 performs two labels liner classification
% Inputs X - the n*d samples,
% w - vector of weights (d+1)*1
% Outputs vector C (size n × 1) stores the class assigned to the samples in X
% ====================== My IMPLEMENTATION HERE ===========================
%combine a ... |
function [movingRegistered, transform] = register2D_intensity_multiscale_affine(im1,im2, initial_transform, initialise, downsample_factor, mode, iterations, type, min_I)
% iterate through the downsampling:
n_scales = length(downsample_factor);
% set up the basic registration settings
[optimizer, ... |
function R = checkstopcrit(v,pars,R)
if R.stop
% in this case, something outside says
% that we should stop, so assign output
% and exit with best found point so far:
R.sol.v = v;
R.sol.xopt = v.x / v.tau;
R.sol.sopt = v.s / v.tau;
R.sol.yopt = v.y / v.tau;
v.k = v.k + 1;
R = g... |
%% ME EN 6230 Lab 2 Ryan Dalby
% Controller Comparison
% close all;
set(groot, 'DefaultTextInterpreter', 'none') % Prevents underscore from becoming subscript
% errors are in degrees
% PD Controller
pd_slow_rms = [0.532 0.417];
pd_slow_max = [1.57 1.1];
pd_fast_rms = [1.57 0.722];
pd_fast_max = [5.23 1.44];... |
function dy = MBSolvers_inversion(t,y,pump,g_par,Efield,Pfield,field_t)
E = interp1(field_t,Efield,t);
P = interp1(field_t,Pfield,t);
%Note: The 'pump' is assumed to be uniform here
dy = g_par*(pump - y) - g_par*imag(E*conj(P));
end |
function BER_vs_SNR_OFDM_with_BPSK(varargin)
% Plot the relationship between the bit-error-rate (BER) and
% signal-to-noise ratio (SNR) for OFDM system with BPSK modulation method
% BER_vs_SNR_OFDM_with_BPSK(ParameterName1, ParameterValue1,...
% ParameterName2, ParameterValue2,...)
% Parameter... |
function plot_sol( dirname, fig );
figure(fig);
S = load( [ dirname, '/sol.dat' ] );
x = S(:,1); y = S(:,2); z = S(:,3);
v = S(:,4) + 1i*S(:,5);
n = round( length(x)^(1/3) );
x = x(1:n);
%[X,Y,Z] = meshgrid(x,x,x);
v = reshape( v, [n,n,n] );
slice( x, x, x, abs(v), [-0.4 0 0.4], [], [] ); |
function [ data] = task_control( data, t )
%% Espacio de Estados
sys = ss(data.A,data.B,data.C,data.D);
%% ONE-SHOT KALMAN
% calculo de las matrices de la dinamica del sistema en t
[fi, T ]= c2d(sys.A,sys.B,t);
%% Ubicacion de los polos
%**************************************************************************
%Acke... |
% This script is to perform tracking on flies in courtship.
% Run AnnotateVideo.m first before runing this.
% Select annotated .mat files
allfiles_ori = uigetfile('*.mat','MultiSelect','on');
if ~ischar(allfiles_ori) %Multiple files, class(allfiles_ori) = cell
allfiles = cell2struct(allfiles_ori,'name');
else %... |
function [roughTrans, roughTrans_count, all] = calcTransmission(inputimg, A, fileNames)
% Calculate valid transmission
[height, width, nch] = size(inputimg);
trans(1:height,1:width) = -1;
trans_count(1:height,1:width, 1:4) = 0;
all_trans(1:height, 1:width, 1) = 1;
all_trans(1:height, 1:width, 2:3) ... |
%
% SOLUTION OF LYAPUNOV EQUATION BY THE LRCF-ADI METHOD (AND GENERATION
% OF ADI PARAMETERS)
%
% This demo program shows how the routines 'lp_para' (computation of
% ADI shift parameters) and 'lp_lradi' (LRCF-ADI iteration for the
% solution of the Lyapunov equation F*X+X*F'=-G*G') work. Also, the
% us... |
ssh = ncread('/project/expeditions/eddies_project_data/ssh_data/data/h/dt_ref_global_merged_msla_h_qd_19930106_19930106_20100503.nc', 'Grid_0001');
lat = ncread('/project/expeditions/eddies_project_data/ssh_data/data/h/dt_ref_global_merged_msla_h_qd_19930106_19930106_20100503.nc', 'NbLatitudes');
lon = ncread('/project... |
% MJLBGFC.M
% Use b2, g2 & f2 for Bloch Equa calc
% Called by mjljm
% First check replot ****************************
if mjlreplv == 1 ; % Re-Plot turned on; turn off
set(mjluirepl,'Visible','off') ;
set(mjlreplb,'Visible','off') ;
mjlreplv = 0 ;
end ;
% Do calcs ***************************************
mjlbgfv ... |
function error = calError2(A1,A2,y)
sig1 = A1\y;
sig2 = A2\y;
[error,~] = calError(sig1', sig2'); |
function nene = fun3(x)
nene = 1./x;
endfunction
|
function conts_2k = get_side_contacts(verts_2v,per_side)
x_v = verts_2v(1,:);
y_v = verts_2v(2,:);
x_k = unifcontacts(x_v,per_side);
y_k = unifcontacts(y_v,per_side);
conts_2k = [x_k;y_k];
end
function out = unifcontacts(vs,per_side)
out = catmap2(@(i)...
remove_endpts(linspace(vs(i),vs(mod(i,numel(vs))+1),per_s... |
% Script to execute a Logistic Regression with regularization
% Load data
data = load('ex2data2.txt');
x = data(:, 1:2);
y = data(:, 3);
% Plot data
plot = 0;
if (plot == 1)
plotData(x, y);
hold on;
% Labels and Legend
xlabel('Microchip Test 1')
ylabel('Microchip Test 2')
% Specified in plo... |
function v = lininterp3( V,INDEX_LIST3D_1,INDEX_LIST3D_2,INDEX_LIST3D_3,INDEX_LIST3D_4,INDEX_LIST3D_5,INDEX_LIST3D_6,INDEX_LIST3D_7,INDEX_LIST3D_8,slopex,slopey,slopez)
% linear interpolation, given set of X, Y, Z, and V values, and an x, y, z query
% assumes X, Y, and Z values are in strictly increasing order
%
% Diff... |
clc; clear;
% % motor specs
% Km = 0.0487;
% Kb = Km;
% La = 0.64*(10^-3);
% Ra = 0.27;
%
% % Robot specs
% r =0.085;
% m =18.8;
% L =0.43;
% I =m*(L^2)/6;
% beta=0.4;%Surface friction
%
% h1 = tf(Km,[La Ra]);
% h1.u='e1'; h1.y='taum1';
%
% h2=tf(1,[(r^2)*m 0]);
% h2.u='x1'; h2.y='vhat1';
%
% h3=tf(L^2,[2*(r^2)*I ... |
function [FN, FE, FS, FW] = face_fluxes(f,g,Nx_N,Ny_N,Nx_E,Ny_E,Nx_S,Ny_S,Nx_W,Ny_W,Ny,Nx,D_north,D_west,D_east,D_south,u_ups,a,rho_ups,p_ups,v_ups,u,rho,p,gamma,R,v)
F_ew = zeros(Ny-1,Nx,4); %fluxes in east and west faces
G_ew = zeros(Ny-1,Nx,4); %fluxes in east and west faces
F_sn = zeros(Ny,Nx-1,4); %fluxe... |
clear; close all
t0=0; % initial time
tfinal=4000; % final time
h=1; % integration interval
t=t0:h:tfinal; % time vector
% initial conditions
x0=[3; 2; 1]; % h1, h2, w3
% initialization
x=[x0 zeros(length(x0),length(t)-1)];
% step
u=[zeros(round(length(t)*0.25),1);1*ones(round(length(t)*0.75),1)];
% u=[zeros(leng... |
function LatexPattern(d, A, support)
% LatexPattern(d, A, support) outputs matrix A in LaTeX form, showing a
% pattern for degree d B-splines, with support given.
rows = (d + ceil(support/2))*2 + 5;
cols = 2*d + 6;
[m, n] = size(A);
disp(' \left[');
disp([' \begin{array}{*{' num2str(d+3) '}{r}\at{\,}r\at{\,}*{' ...... |
function [ LabelExpanded ] = labelExpand( LabelEvents, FeatureCell )
%labelExpand Transforms a vector of labels corresponding to events to a
%vector of labels corresponding to timeslices within events
% Detailed explanation goes here
% organize labels for each time slice of each event into a vector
LabelExpanded = c... |
function wfs = newWfs(config)
% start wave front capability for naomi
% if HASO128 is used startACE() must have been executed before
global naomiGlobalWfs;
if ~exist('naomiGlobalWfs','var') || isempty(naomiGlobalWfs)
switch config.wfsModel
case 'haso128'
naomi... |
function v = nlconst(z,p,points)
global index
%NLCONST Summary of this function goes here
% Detailed explanation goes here
% variables z = [ab,dotbeta,ds,x,y,theta,v,beta,s,braketemp]
[splx,sply] = casadiDynamicBSPLINE(z(index.s),points);
wantedpos = [splx;sply];
realPos = z([index.x,index.y]);
%not yet used here
err... |
% set globals (used by ODE solver)
global tspan;
global Vv;
global RR;
global L;
% Set B and C for the plots
R = 5;
L = 10;
% set signal parameters
endtime = 8*pi;
stepsize = (1/10)*pi;
% build X and Y
[x,y_an,y_num] = RLCircuitResponse(endtime,stepsize,R,L);
% set liblength for plotting
liblength = length(x);
%% ... |
classdef InputSelector < pipeline.AtomicPipelineStep
%INPUTSELECTOR Summary of this class goes here
% Detailed explanation goes here
properties
ObjectiveFunction
Children
Pipeline
end
methods
function obj = InputSelector(children, objectiveFunction)
... |
#Configuració
plotResults=true;
#Constants
Fm3=48e3;
nr=3;
Fm4=Fm3*nr;
tf = 2;
v0=-1;
v1=1;
if(plotResults)
figure();
endif
i = 1;
for n = [13]
p=ceil(tf*Fm3/(2^n - 1));
N=(2^n - 1) * p;
x3=LFSRs(n, N);
[X3, F]=f_TF(x3, Fm3);
if(plotResults)
subplot(3,1,i)
plot(F, abs(X3));
xlabel(... |
%% DEFINE LIBRARY
Library.Name_of_function='HL';
Library.Promoters={'Plac1','Plac2','Plac3','Plac4','Plambda','Ptet1','Ptet2','ParaC'}; % list of promoters
Library.Transcripts={'tetR','lacI','cI','araC'}; % list of protein conding regions
Library.Prom_tf={'lacI','lacI','lacI','lacI','cI','tetR','tetR','araC... |
close all;
clear;
[I,map,transparency] = imread('catheter_example.png'); % read images
I = I(:,:,1); % pick only one layer (???)
J = imadjust(I,[0,0.3],[0,1]); % adjust intensity values (increases contrast)
imshow(J); % display image
mtd_arr = {'Sobel','Prewitt','Roberts','log','zerocross','Canny','approxcanny'};
% ... |
function result = f_parse(x,labels)
% - parse matrix to structure
%
% USAGE: result = f_parse(x,labels);
%
% x = input matrix (rows = obs, col = variables)
% labels = cell array of variable labels
% e.g., labels = {'sal' 'tmp' 'elev'};
% -----Notes:-----
% labels cannot begin with a number
% -----Aut... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2010 - 2015 Moon Express, Inc.
% All Rights Reserved.
%
% PROPRIETARY DATA NOTICE:
% The data herein include Proprietary Data and are restricted under the
% Data Rights provisions of Lunar CATALYST Space Act Agreement
% No. SAAM ID#... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.