text stringlengths 8 6.12M |
|---|
clear; close all; clc
%%
%
% Joćo Araśjo 2018/2019
%
% Neighbourhood structure Script for the Traveling Santa 2018 contest
%
%
%%
Data = csvread('cities.csv',1);
%% Define the number of candidates for each node
numberOfNodes = 55;
%% Get candidate structure for each node
kdt = KDTreeSearcher(D... |
function [ cc ] = prod_coef(x,y)
% Calcul du produit des coefficients des fonctions d'Hermites
cc = 1/(sqrt((2^x)*factorial(x)*(2^y)*factorial(y)*pi));
% pour ne pas que Matlab calcul deux racines de pi --> erreurs
% d'arrondis.
end
|
clear; close;
array=[-2 0 0; -1 0 0; 0 0 0; 1 0 0; 2 0 0];
azimuth = 0: 180;
elevation = 0;
directions = [30 0; 35 0; 90 0];
dirTarget = directions(3, :);
gainWh = 1;
% additive uncorrelated isotropic noise, SNR = 40 dB
varNoise = 1e-4;
%% Array pattern plot
% only determined by array; best direction is 90 Azimuth
patt... |
function [spinImgs selIxs] = buildAndStoreDescriptor(pts, filePath, ...
noOfSpinImgs, distance, ...
alfaBins, betaBins, alfaAxes, betaAxes)
%Tworzy deskryptor i zapisuje go do pliku o ile
%plik jeszcze nie istnieje.
[spinImgs selIxs] = getDescriptor(pts, filePath, ...
noOfSpinImgs, distance, ...
... |
%% Project : Logistic Regression
% Clear command window
clear;
close all;
warning("off","all");
%% Setup initial parameters
num_inputs = 358; % nubmer of inputs to the logistic regression algorithm.
vector_length = 34; % length of output vector or theta. The length represents the... |
function FigureHandles = ffanalepu(Sector, GeVnum, DirStr, EPUmode)
% function FigureHandles = ffanalepu(Sector, GeV, Directory, EPUmode)
% or
% function FigureHandles = ffanalepu
%
% This function plots various information about the EPU longitudinal feed forward tables.
%
% Sector = the storage rin... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Autor: Prof. Alexandre Zaghetto %
% E-mail: zaghetto@image.unb.br %
% Disciplina: Sinais e Sistemas %
% Departamento: Ciência da Computação %
% Universiade de Brasília %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
close all
clc
%%%%%%%... |
%%
clear;clc
%! Prepare GRAM and ORIGINAL folders first !%
root_dir = 'D:\Datasets\SVHN\all';
feat_name = 'cnn';
mix_num = 100;
vars = all_vars_func(root_dir, feat_name, mix_num);
write_config(vars);
%% ---------------------- GMM/HMM Training ------------------------
%% Init Train
% prepare wdnet
pr... |
close all;
clear,clc;
T = [20.5 26 32.7 40 51 61 73 80 88 95.7];
R = [765,790,826,850,873,910,942,980,1010,1032];
[p] = size(T);
N = p(2);
figure
plot(T,R,'--gs','LineWidth',2,'MarkerSize',10,'MarkerEdgeColor','b','MarkerFaceColor',[0.5,0.5,0.5]);
%_________________________________
%t = T(i);
%tt = T(i)^2;
%tz = T(... |
% plot network_conv.mat
load '../results/network_conv.mat'
figure,
hold on;
plot(baseline{1}.*100, 'LineWidth', 2);
plot(data_94{1}.*100, 'LineWidth', 2);
plot(data_62{1}.*100, 'LineWidth', 2);
plot(data_62_16{1}.*100, 'LineWidth', 2);
hold off;
ylabel('Evaluation Accuracy %')
xlabel('Epoch')
legend('baseline', 'set... |
%Start acquiring some frames and get a snapshot
stop(vid);
% Configure the object for manual trigger mode.
triggerconfig(vid, 'manual');
disp('starting acquisition. Please wait...');
start(vid); % start video
N = 10;
for i=1:80
tmpsnapshot = getsnapshot(vid);
end
% Flip the image Up-Down
snapshot = imflipud( tmps... |
function B = strainDisplacementMatrix(N)
%Make B a part of the basis function structure?
% Preallocate
B = sym(zeros(6,6));
val = diff(N,symvar(N)); %compute diff once
B(2,1) = val;
B(3,2) = val;
B(1,3) = val;
B(3,4) = N;
B(4,4) = val;
B(2,5) = -N;
B(5,5) = val;
B(6,6) = val;
end
|
clc; close all;
numJoints = 4;
jointTypes = ['RRRE'];
linkLengths = [1 1 1];
zAxis(:,:,1) = [0 0 1]';zAxis(:,1,2) = [0 0 1]';zAxis(:,1,3) = [0 0 1]';zAxis(:,1,4) = [0 0 1]';
linkDir(:,1,1) = [1 0 0]';linkDir(:,1,2) = [1 0 0]';linkDir(:,1,3) = [1 0 0]';
q_mins = [-90 -60 -45];
q_maxes = [90 60 45];
workspace(num... |
classdef iledSine < nih.squirrellab.shared.protocols.SquirrelLabProtocol
% LED sine that also triigers 2P imaging
% LED is turned off after the set of epochs is completed.
% Not using electrophysiology amplififer
% Collects frame timing and temperature
properties
led % Out... |
function coordsForOtherObjs=convertRawCoordsToRelative(distsToBedsTwoNearestEdges,distComps,distCompsWallCenter,thisRefBedClosSd, xMin,xMax,yMin,yMax,C)
% 1 for along wall and 2 for center
l=0;
% minPoint=C{thisBedIdxInC}{3};
% maxPoint=C{thisBedIdxInC}{4};
% yMin=minPoint(2)+yOffset;yMax=maxPoint(2)+yOffset;xMin=... |
function [W, TE, Fcalc, R2] = TEMINQP(F,S)
% Tracking Error Minimization with QUADPROG
%
% INPUTS:
% F... vector of fund return times series
% S... matrix of style returntime series
%
% OUTPUTS:
% W... vector of optimal style index weights
% TE... tracking error between calculated and actual fund
% Fcalc... v... |
function [arm, mass, torque_limit] = full7DOF(x,mount)
% arm = offset3link_full(x,qlimMin,qlimMax)
% *******
% LENGTHS
% *******
qlimMin = [0, -pi/2, -pi/1.3, -pi/1.3, -pi, -pi/2, -pi];
qlimMax = [1.5, pi/2, pi/1.3, pi/1.3, pi, pi/2, pi];
% Note: the base frame is oriented such that the x direction is towards the
% ... |
function varargout = px_rmpath(d)
% see spm_rmpath
varargout = {};
if ~nargin
% Get the actual SPM directory
try d = px_toolbox_root;
catch, return; end
end
% Recursively remove directories in the MATLAB path
p = textscan(path,'%s','delimiter',pathsep); p = p{1};
i = strncmp(d,p,length(d)); P = p(i); p(... |
%FUNCTION: unit_test_record
%Record and display the results of unit tests.
%
%unit_test_record(arg1)
% When a single argument is given, it must be either 'reset' or 'show'.
% arg1= 'reset' zeros the pass and fail counters.
% arg1= 'show' displays the results of all of the unit
% tests since the last reset
%... |
%Single State Model-- wash out trials
A = 0.99;
B = 0.013;
p = 800
k = 0.290461513759037 %80th value of initial learning
for wot = 1:300
for i = 1:p + wot
if (i >= 0) && (i <50)
f = 0;
elseif (i >= 50) && (i <401) || ((i >= 431+wot) && (i < 801+wot))
f = 1;
elseif (i >= 401) && (i... |
% Utilities for scientific computing.
% OREN MATLAB Toolbox Version 6 28-Jun-2004
%
% Display and miscellaneous functions.
% cellmatrix2matrix - Convert a cell matrix to a matrix
% D - Display a 2D array "as on a paper"
% divide - Integer division into almost-even parts
... |
% phy = phytreeread('Data\MTGenome_30.dnd');
% phy = phytreeread('Data\ReferenceTree\tree_59.nwk');
% phy = phytreeread('Data\PhyloTree\z100_w5_sp0.dnd');
phy = phytreeread('Data\PhyloTree\z100_w14_sp30.dnd');
% phy = phytreeread('Data\PhyloTree\59MTGenome\z100_w10_sp30.dnd');
phytreeviewer(phy); |
figure(3);
plot(signal_v);
title('Original Signal');
%xlim([135 165]);
xlabel('Event Number');
%set(gca, 'xtick', 130:2:200);
ylabel('Mean Signal, pA');
%set(gca, 'ytick', 40:5:75);
grid on;
saveas(3, 'original.png');
fd = wden(signal_v, 'sqtwolog', 'h', 'one', 1, 'haar');
fe = wden(signal_v, 'sqtwolog', '... |
%ISOPENFG Framegrabber grabbing image function.
%
%SYNTAX isopenfg('alias')
%
%DESCRIPTION This function will let the user check whether
%the framegrabber device has been opened or not. It will
%return an integer acting like a boolean.
%
%INPUT The alias (alias) of the framegrabber device.
%
%REMARKS It wi... |
function [testData, testLabel] = create_testing_data(numMvm)
% use attibutes extraction to create test dataSet
% input : numMvm - number of movements
% output : testData - attributes set of examples
% testLabel - label of examples
% ----------------------------------------------------------------------... |
function rr=counter_current_PRO(cd0,qd0,cf0,qf0,dP,aa,bb,ss,area)
format long;
%rr=zeros(2,1);
global c_d0 c_f0 volume_ratio delta_h_p q_f0 q_d0 fai modePRO A B S Am c_f_f v_f_f c_d_f v_d_f c_os;
A=aa;
B=bb;
S=ss;
c_os=73.45/100;
c_d0=cd0;
q_d0=qd0;
c_f0=cf0;
q_f0=qf0;
... |
clc;
clear all;
close all;
%Displaying the image.
im1 = imread('Image.bmp');
figure(1)
imshow(im1)
title('Input Image');
%Histogram plot generation
[m,n] = size(im1);
histo = [zeros(1,256)];
pixval = im1;
for m1 = 1:1:m
for n1 = 1:1:n
histo(pixval(m1,n1)) = histo(pixval(m1,n1)) + 1;
end
end
figure(2)
p... |
function lvls = samples2lvls(samples, N_sig, sig_lvls, lvl0)
N_samples = length(samples);
N_lvls = length(sig_lvls);
lvls_step = [sig_lvls(2:end) - sig_lvls(1:end-1), sig_lvls(end) - sig_lvls(end-1)];
lvls = zeros(1, N_sig);
curr_lvl = lvl0;
curr_time = 1;
... |
fid = fopen('tools/_values_reference'); Ar = fscanf(fid, '%g %g',[2 10]);fclose(fid);
fid = fopen('_values_current'); Ac = fscanf(fid, '%g %g',[2 10]);fclose(fid);
diff_max=max(max(abs(Ar-Ac)./(Ar+Ac)));
fid = fopen('_value_diff','w');fprintf(fid, '%g', diff_max);fclose(fid);
|
function sTrueDetStruct = CollectBaselineDetections(options)
% function sTrueDetStruct = CollectBaselineDetections(options)
%
% returns a set of objects in a list of street scenes images. Each object is annotated
% with its type, the source image, and its bounding box
if(nargin < 1), options = [];, end
% Set Defaul... |
function [Xv, Zv] = readFromFile(filename)
fd = fopen(filename, 'r');
num_srs = fscanf(fd ,'NumSensors: %d', 1);
fgetl(fd);
num_lms = fscanf(fd ,'NumLandmarks: %d', 1);
fgetl(fd);
Xv = []; Zv = [];
for i=1:num_srs
[x, z, fd] = readSensors(fd);
Xv = [Xv; x];
Zv = [Zv; z];
end
[x, fd] = readLandmarks(fd, num_lms... |
function createPlots(turbFlow,spillFlow,inFlow,price,s0,C2A,n)
% Copyright (c) 2012, MathWorks, Inc.
%% Calculations for Plots
totStor = zeros(n+1,1); % Total storage in the reservoir
totStor(1) = s0; % Initial Storage
% Use the time history data to compute the reservoir storage at each step
for ii = 2:length... |
function [Sigmahat, bhat, Ahat, Offsethat, r, yhat] = beam_fit_gaussian(x, y)
PlotFlag = 1;
MaxIter = 4;
if nargin < 2
A = 2.1234;
Sigma = .25;
b = 3.1;
Offset = .01;
x = (0:.01:7)';
y = A * exp(-1*(x-b).^2 / (2*Sigma^2)) + Offset;
end
% ln(y-Offset) = ln A - (x-b)^2 /(2 sigma^2)
% ln(y-Offse... |
%stimspecfmri.m requires that epoch_fmri is run previous.
% gets the stimulus specific activations maps.
% needs the variable fimgs to be set
clear allstims ;
tcounts = ones(6,1);
for trial=1:size(allparams,2) ;
for s=1:size(trtimes,1)
allstims(allparams(1,trial,s),tcounts(allparams(1,tr... |
function [ ] = run_accelerometer_test( testname )
% Compare the accelerometer's estimation of the pitch and roll against
% the actual angles graphically.
% testname is the name of a model/tests folder.
[date_time, ~, fake_accel, ~, real_accel, angles] = import_test(testname);
[af_pitch, af_roll] = accel_pr(fake_accel... |
function CreateRGBObjectDetectionIMDB1()
% This script to prepare IMDB for object detection
% The imdb will have train:validation ratio same as in VOC 2012 dataset
clear;
close all ;
run RGBObjectDetectionSetUp;
opts = struct;
opts.dataDir=['data' filesep 'VOC2012'];
opts.target_file = ['data' filesep 'rgb_obj... |
%% Predicting bandlimited singals
clear, clc, close all
% Believe it or not this generates a real, zero-mean, and approximately
% band-limited Gaussian noise. The maximum frequency of the PSD of x is pi/2.
N = 1000;
fc = 0.7;
X = randn(1, fc*N) + 1j*rand(1, fc*N);
x = ifft(ifftshift([zeros(1, round((1-fc)*N)) conj(X(... |
%%% Example script for booleanization with RefBool
% prerequisites:
%
% 1. get the RefBool code
%
% $git clone https://github.com/saschajung/RefBool.git
%
% 2. Download the TPM background distribution from:
%
% https://webdav-r3lab.uni.lu/public/cbg/RefBool_ReferenceDistributions/
%
% You can use:
%
% $wget -r -nH --c... |
%* Permutation Matrix
%*
%* References:
%* [1] K.J. Kim et al., "Low-Density Parity-Check Codes for ATSC 3.0",
%* IEEE Transactions on Broadcasting, Vol. 59, No. 1, Mar. 2016
%*
%* Author: T.J. Cheng, 2016
%*
%* 2016-11-20: It works fine.
%*
function Q = perm_gen_Q(M, L, q)
Q = spa... |
function projectStats2Surf(featDir)
%% Projects sentence and localizer volumetric data to the cortical surface
%
% Usage:
% project_stats_to_surf(session_dir,subject_name,sentDirName,locDirName,sentNum,locNum,sentOutDir,locOutDir)
%session_dir = '/Users/Shared/ClusterCopy/Data/AMMet/102MM/M091515M'
% subject_name ... |
function fh = plotpbdist(fh, dist, p, pmatched)
% Plots the distances from one set of points to another set of points
%
% This function does not calculate the distances.
% -------------------------------------------------------------------------
% USE:
%
% H = plotpbdist(D, P, PM) plots a colourful figure shows the di... |
% bayersampling samples pixel value associated bayer color filter array
%
% raw = bayersampling( rgb, pattern )
%
%
%Output parameter:
% raw: raw data of tye bayer CFA
%
%
%Input parameter:
% rgb: rgb full color image
% pattern: bayer pattern 'rggb', 'bggr', 'grbg', or 'gbrg'
%
%Example:
% rgb = imread('i... |
function [ctrlNew, knotsNew] = BsplineSplitting( degree, ctrl, knots, curveParameter )
% split the bspline by the curve parameters.
% after knot insert the multiplicity of each curve parameter will be p,
% where p is the degree of the bspline curve.
% input:
% degree, degree of the bspline curve before splitting.
% ... |
clear,clc
map=zeros(1,6);
map(2:5,4)=-1;
y=[3,2];
map(3,2)=0;
z=[3,5];
path=floodfillmex(map,y,z) |
close all;
clear all;
clc;
parameters_longitudal_autopilot; % get parameters
d = 0*deg2rad;
t_end = 100;
i = 1;
Legend = {};
figure(1);
for chi_c = [-5, 10, 15]*deg2rad
model = 'lateral_autopilot.slx';
load_system(model);
simOut = sim(model);
subplot(211)
plot(chi.time,chi.signals.values.*ra... |
%Title: Data Files List Ver 2
%Author: Timothy Sheerman-Chase
%Date: 15 Feb 2001
%Description: This searches through the Workspace foler for images to transform
%
%
%Arguments:
function [Files_to_open,Files_colspace] = data_list_ver2(file_type,data_set,out_ex,Files_to_open,Files_colspace,file_root,file_type2)
... |
function [F E T]= imageDCT(A)
A=imread(A);
siz=size(A);
dctinput=A(1:4,1:4);
F=dct2(dctinput);
dctinput=A(1:8,1:8);
E=dct2(dctinput);
dctinput=A(1:32,1:32);
T=dct2(dctinput);
dctin1=dct2(F);
dctin2=dct2(E);
dctin3=dct2(T);
figure;
imshow(int8(dctin1));
figure;
imshow(int8(dctin2));
figure;
imshow(int8(dctin3));
disp... |
function y = creerEcho(x, tempsRetard, freqEch)
zeros = [];
zeros(1:tempsRetard*freqEch) = 0;
y = [zeros x];
end
|
function [auc]=plot_roc_and_det( dec_values, scale_label )
[X,Y,T,AUC] =perfcurve(scale_label,dec_values,'1');
%[X,Y,T,AUC] = perfcurve(labels,scores,posclass,'param1', val1,'param2',val2,...)
%labels:目标标签 scores:决策值 posclass:正类标签
%'param'和val可以定义X和Y的输出值,具体可以看函数帮助,默认是定义X轴为FPR,Y轴为TPR
auc=AUC;
hol... |
%%% Modeler
clear all;
close all;
clc;
loc = 'T'; % [ D , S , T ]
switch loc
case 'D'
load('denver_co.mat');
Data_full = Data;
case 'S'
load('saltlakecity_ut.mat');
Data_full = Data;
case 'T'
load('tucson_az.mat');
Data_full = Data;
end
Data_Train = flipud(... |
function PredictR = contentbased()
iter=0;
load('matlab1.mat');
maxIter=190;
l = 0.01;
a = 0.00001;
m = 1682;
%W = zeros(943,19);
cnt = 1;
while iter<maxIter
% for i = 1:943
% if(mod(cnt,20))==0
cost = (norm((W*transpose(X) - T).^2))/2 - norm((l*(W.^2)))/2;
plot(iter,cost,'rx');
... |
function imdb_new = TY_do_hard_negtive_test(conf, model_stage, imdb, roidb, ignore_cache)
if ~exist('ignore_cache', 'var')
ignore_cache = false;
end
imdb_new{1} = TY_hard_negtive_test(conf, imdb{1}, roidb, ...
'net_def_file', ... |
% stim = genStimuli(1, 10, 100000, 1);
% resp = response(1, stim, 1, 1);
close all;
conSamples = sort(exprnd(1, 1, 500));
conspace = logspace(log10(min(conSamples)), log10(max(conSamples)+0.1), 8);
conHist = [-inf, conspace(2:end-1), inf];
conProb = histc(conSamples, conHist);
conProb = conProb / 500;
oriSamples = so... |
%packet forwarding machenism
%packet transmission strategy
clear all
clc
% set(0,'DefaultFigureWindowStyle','docked');
%--------------------------------------------------------------------------
%generation of random topology
Sx=randi(100,1,30); %define WMSN node x locations. Generate a random 10 x location from 1 upt... |
% plotBlockTrajectories Plot cursor trajectories for a single experimental
% block.
%
% Usage:
% plotBlockTrajectories(D)
%
% Inputs:
% D A single element of the structure array returned by
% processTrialData
%
% @ Alan Degenhart -- alan.degenhart@gmail.com
function plotBlockTrajectories(D)
% Get color i... |
9%%
% CellShapeAnalysis.
% Copyright (C) 2020 J. Stegmaier
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicab... |
function [failed] = checkTrajectory_informative(x,U,Xobs)
%checkTrajectory_informative A better and more informative version
% of the checkTrajectory function (with plots!)
% Input
% x : FULL State (Nx6) (0.01s discretizations)
% Official Traj via forwardIntegrateControllerIinput.m
% U : In... |
%% A simple tree data structure in a MATLAB class.
% This script serves as a basic documentation or tutorial for the |@tree|
% class. We duplicate some of the information that can be found in the help
% sections of methods, so that you can find almost everything here, in one
% place.
%
% But here is a short primer: the... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Function Shape_Function
%
%Input: p_1=polynomial degree in direction 1
% p_2=polynomial degree in direction 2
% xi_1=shape coordinate of the quadrature point in direction 1
% xi_2=shape coordinate of the quadrature point in direction 2
%... |
% This is material illustrating the methods from the book
% Financial Modelling - Theory, Implementation and Practice with Matlab
% source
% Wiley Finance Series
% ISBN 978-0-470-74489-5
%
% Date: 02.05.2012
%
% Authors: Joerg Kienitz
% Daniel Wetterau
%
% Please send comments, suggestions, bugs,... |
function result = genotype_sc(ind1)
count = 0;
result(1:length(ind1)/2) = 0;
g11 = 1;
g12 = 2;
g22 = 3;
g00 = 4;
for i = 1:2:length(ind1)
count = count + 1;
if( ind1(i) == 0 && ind1(i+1) == 0 )
result(count) = g00;
end
if( ind1(i) == 1 && ind1(i+1) == 2 )
result(count) = g12;
end
... |
function varargout = background_color_ex(varargin)
% BACKGROUND_COLOR_EX MATLAB code for background_color_ex.fig
% BACKGROUND_COLOR_EX, by itself, creates a new BACKGROUND_COLOR_EX or raises the existing
% singleton*.
%
% H = BACKGROUND_COLOR_EX returns the handle to a new BACKGROUND_COLOR_EX or the hand... |
clear all;
clc;
close all;
x=linspace(-3,3,6);
y=x.^3+2*x.^2;
xi=linspace(-3,3,20);
disp('czas trwania naszego algorytmu interpolacji:');
tic
yi = lagrange(x,y,xi);
toc
plot(x,y,'o',xi,yi);
title('x^3+2*x^2');
xlabel('x');
ylabel('y');
function yi = lagrange(x,y,xi)
yi = zeros(size(xi));
for i = 1:length(x)... |
% Figure 7.44 Feedback Control of Dynamic Systems, 6e
% Franklin, Powell, Emami
%
% script to generate Fig. 7.44
clf;
f=[-10 1 0;-16 0 1;0 0 0];
g=[0 0 10]';
h=[1 0 0];
j=0;
a=[-f' -h'*h;0*f f];
b=[0*g;g];
c=[g' 0*h];
d=0;
rlocus(a,b,c,d);
axis([-12, 12, -6, 6]);
grid;
title... |
function [M,eval]=VaryOperater(M1,pm,eval1,pop_size,CurrentGenNum)
%%
%变异算子
%以概率pm选择变异个体
rand2=rand(1,pop_size)<pm;
%ordinal为待变异个体序号
ordinal=find(rand2);
num=length(ordinal);
global max_gen;
M=M1;
eval=eval1;
for j=1:num
ind1=M(ordinal(j),:);
ind2=vary(ind1,CurrentGenNum,max_gen);
eval2=penalty(ind2);
M... |
clear all;
close all;
%parameters
n1 = 20;
n = 6;
m = 5;
k = 5;
%calculates the databases
%determine_KPPVcenters('app.tif', n, m);
%determine_centers('app.tif', n1);
img = imread('test.tif');
%get the rectangles
all_properties = get_numbers_properties(img);
s = size(all_properties);
%get random number
zone = all_p... |
function [xfit,yfit,coeffs,resid,J,mse,ci,se] = T1fit(xdata,ydata,guesses,CI)
% fitting routine and plotting
[beta,resid,J,COVB,mse] = nlinfit(xdata,ydata,@T1_recovery,guesses);
%output: beta is coefficients
% resid is residuals
% J is Jacobian, COVB is covariance matrix, mse is mean squared error
alpha = 1 - CI/100... |
function [L, Bb, Lb, Nb, Ab, rp, idxs] = enforce_ECS(L)
%%% create connected ECS mask
% load the labelimage
% [L, Lclass] = get_labelimage(conf);
% initialize ECS mask
M = L==0;
% % remove border components (NOT BW = imclearborder(BW, 4));
% borderlabels = [];
% borderlabels = cat(1, borderlabels, unique(L(1:end,1))... |
function [nmsgs, date_freq, author] = analyse_whatsapp(doc, author)
nmsgs = 0;
search_string = ['] ',author,':'];
k_msgs = strfind(doc,search_string);
nmsgs = size(k_msgs,2);
for i = 1 : size(k_msgs,2)
flag = false;
id = 1;
slash_cnt = 0;
while(~flag)
ch = doc(k_msgs(i)-id);
if ch == '... |
function Vf = MovingRamp(AngleTS,tstep_units)
% The idea is to create a time series of the velocity of a block
% sliding down a frictionless ramp at varying angles with the Earth.
%
% AngleTS - time series of angles a each time step unit
% tstep_units - the seconds in each time step (e.g. 0.1, 0.5, 10, etc)
%
% For exa... |
function c = customconv(a, b)
% a is speech vector
% b is kernel
% Want same as length a
len = length(a);
lenb = length(b);
zp = length(b)-1;
a = [zeros(zp,1);a;zeros(zp,1)];
for i = zp+1:length(a)
sum(a(i-lenb-1:i)*
end
|
% ******************************
% ONE CYCLE
% This script file performs one cycle, of any
% drive cycle of N points with any vehicle and
% for lead acid or NiCad batteries.
% All the appropriate variables must be set
% by the calling program.
%% *******************************
% driving_cycle;
% N=length(V);
% DoD=zer... |
function analyse(c, d)
%read in data and call calc stats on the data.
% then plot data.
scatter(c,d);
title=('Scatter plots for data sets provided');
% regression stats
fprintf('Regression statistics for data sets provided:\n');
mdl = fitlm(c,d)
%function calcStatsReg()
%function plotModel()
|
function Ei800_uvw100_at020TPmod2Peaks(varargin)
root_folder = pwd;
this_fldr = fileparts(root_folder);
data_source= fullfile(this_fldr,'sqw','Data','Fe_ei787.sqw');
bragg = [0,2,0];
dE = 5;
dK = 0.1;
repPoints1= [ -0.575 -0.175 0 0.175 0.525;
275 85 0 85 310];
r... |
function [ans] = Q22d10phase(x,y)
zNT = numerictype(1,32,10);
xyNT = numerictype(1,32,10);
xout = fi(x,xyNT);
yout = fi(y,xyNT);
zout = fi(0,zNT);
inpLUT = fi(atan(2.^(-(0:9))),zNT);
[xout, yout, zout] = cordic_kernel_MagPhase(xout,yout,zout,inpLUT);
z0 = fi(180/pi,zNT);
F = fimath('ProductMode','SpecifyPr... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
%
%
%
% problem 3 - u'(t)=dirac(t)
syms r t
int(dirac(r),r,-inf,t)
|
function Lgy = Lgy_gen(in1)
%LGY_GEN
% LGY = LGY_GEN(IN1)
% This function was generated by the Symbolic Math Toolbox version 8.3.
% 20-Oct-2019 13:56:53
Lgy = reshape([0.0,0.0,0.0,0.0],[2,2]);
|
function covariance = average_covariance(imacov_vec)
%--------------------------------------------------------------------------
c11 = mean(imacov_vec(:, 1));
c21 = mean(imacov_vec(:, 2));
c31 = mean(imacov_vec(:, 3));
c12 = mean(imacov_vec(:, 4));
c22 = mean(imacov_vec(:, 5));
c32 = mean(imacov_vec(:, 6));
c13 = me... |
function [sigLogPower,sigAngle] = logFeatureExtraction(sig,NFFT,HopSize_or_HopPercent)
if nargin<3,HopSize_or_HopPercent = 0.5;end
if nargin<2,NFFT = 256;end
sigf= stft(sig, NFFT, NFFT, HopSize_or_HopPercent);
sigLogPower = log(abs(sigf).^2);
sigAngle = angle(sigf); |
clear;
clf;
% Define boundaries and other paremeters
lb = [-5 -5];
ub = [5 5];
V = 2; % number of traits
M = 1; % number of objective
% Choose benchmark; use 1 and 2 in this setup
bm = 2;
% Use your implementation of GA
population = myGA(@(x) benchmark1d(bm,x),V,M,lb,ub);
% Show local and global opt... |
%________________________________________________________________________%
%1a
%________________________________________________________________________%
%Plots output voltage for an R-2R network and analyzes to see if the
%desired number of bits is possible given the resistor tolerance
Vref = 1; %reference voltag... |
function RGS = local_shank(MLP,MMP,MM,LM)
t1 = 0.5* (MLP + MMP);
t2 = 0.5* (MM + LM);
x = (t1-t2);
y = cross(x, (MMP-MLP));
z = cross(x,y);
ex = x/norm(x);
ey = y/norm(y);
ez = z/norm(z);
%% calculate orientation matrix Rg-t
RGS = [ex,ey,ez];
end |
%this file Simulate the model.
%Inputs: None
%Outputs: None.
function [ret]=Simmdl(Model_Name)
try
simOut = sim(Model_Name) % Error code generation
disp('Model Simulation completed successfully')
ret = 0;
exit(0);
catch
disp('Error While simulating the model')
ret = 1;
exit... |
function [label, S] = q4_predict_svm_primal(X, w, b)
% Predict the labels of the given examples, given the learned parameters for the
% primal SVN formulation.
%
% INPUT:
% X: [m x n] matrix, where each row is an n-dimensional input example
% w: [n x 1] vector, containing the learned model parameters (coefficients o... |
%%Eren GÜL PhD thesis 3DOF building model simulation and determining modal
%parameters from acceleration data from each floor
bCol=0.1; %damping coefficient of columns
colM=1e-4; %graphical representation of columns with negligble weight
%%Running the 3 DOF building model
%%
sim('ndof_4_col_w_damper',10.0... |
clc;
close all;
clearvars;
SNRDB=0:.5:8;
Nsim=20000;
BER_AVG=zeros(1,17);
for t=1:1
SUM=0;
SNRLN=10^(5/10);
sigma2=1/SNRLN;
sigma=sqrt(sigma2);
for Ksim=1:Nsim
%%ENCODER by linear shift invariant
k=500;
K=3;
u_tmp=randi(2,1,k)-1; %only when P(X=1)=P(X=0)=0.5 and u_tmp is... |
function admnode = H2__admissible_nodelist(htree, near, far)
% For each cluster i at kth level, find admissible node list containing
% node j if it satisfies either of the following conditions
% 1. j is at kth level and i*j is an admissible pair <= one pair of
% ancestors of i and j are in the 'f... |
function newImArray = reconstructIm(patches, belief, nbXp, nbYp)
sizeXp = size(patches,2);
sizeYp = size(patches,3);
nbP = nbXp*nbYp;
newImArray = zeros(nbXp*sizeXp,nbYp*sizeYp,3);
for i=1:nbP
[~,I]=max(belief(i,:));
[rowNum, colNum] = getRowCol(i, nbYp);
newImArray((rowNum-1)*sizeXp+1:rowNum*sizeXp,(colNum... |
% ballDiameter = 34e-3; % RF ball has 34e-3m
% dielectricThickness = 1e-3; % to be determined, nominally 1e-3 m
% centreOffsetFraction = 0.0; % works in range [-.95, .95]
%close all
frameNo = 0;
clear movieFrames
%% Add Frame
colorbar off
title ' '
figure(9)
frameNo = frameNo +1;
movieFrames(frameNo) = getframe... |
% FaceRot3DMap.m
% Based on gasussian model fitting
clear all;
%%
cd /Users/tancy/fMRIData_RIKEN/AnalyData/Chisato_130215_01/modFit/
Filename1 = 'Chisato_critData2fit_r2_008.mat'; %
load(Filename1)
Filename2 = 'Chisato_volMdData008_1_4s.mat'; %
load(Filename2)
%% plot 3D images
ModelType = 'GaussAnal'; %'Gau... |
function vizCompareGraphs(g1,g2)
if size(g1)~=size(g1)
fprintf('ERROR vizCompareGraphs: the two input graphs are not the same size!\n');
end
for i=1:size(g1,1)
fprintf( [mat2str(g1(i,:),3), '\t', mat2str(g2(i,:),3), '\n'] );
end
|
function [val,label] = ImageEvaluate(x,function_params)
% Evaluate the untargeted attack
% Yuchen Lou 2020.8
c2 = function_params.c;
S = function_params.S;
for i = 1:length(S)
c2(S(i)) = c2(S(i)) + x(i);
end
I2 = waverec2(c2,function_params.shape,'db9');
I2 = I2*255;
[label,scores] = classify(function... |
function board = designboard(file)
%
% This program allows you to draw a board, based on some image (file). Each
% territory is drawn by clicking the coordinates of its vertices. On
% clicking the first vertex again, the patch is closed. To finish the
% territory, click again somewhere in the middle. This determ... |
function resTbl=SASP_Albedo(whichYear)
% SASP script for albedo values
assert(whichYear>=2005 && whichYear<=2014,...
'only years 2005 to 2014 are available')
% w = [400 2700; 700 2700]; % wavelengths of clear and red Eppley
w = [305 2800; 780 2800]; %wavelengths of Kipp and Zonen CM21
% variables for thi... |
function chonglian()
global ys;
global handles1;
try
disp('连接调度服务......');
fname='连接调度服务......';
set(handles1.statetext,'String',fname);
pause(1);
fclose(ys);
fopen(ys);
disp('调度服务连接成功');
fname='调度服务连接成功';
set(handles1.statetext,'String',fname);
catch
disp('连接调度服务失败');
fn... |
function [dFitNN, acf,lags,deltaT] = dlsAutocorrNNTrainAndFitMem(mTS,bS,eS,sS,index1,index2,istep,autocorrLags,fs,dispMode,trainNNFlag,nnHidden, trainFcn)
%-------------------------------------------------------------------------------
% Version 20171223, Silviu Rei
% function [dFitNN, acf,lags,deltaT] = dlsAutocorrNNT... |
function dispLine()
disp('---------------------------------------'); |
clc;
A = imread('C:\Users\hpl\Desktop\lena.jpg');
A=double(A);
[m,n]=size(A);
for i=1:m
for j=1:n
A(i,j)=log10(1+A(i,j));
end
end;
A=mat2gray(A);
smin=min(min(A));
smax=max(max(A));
imshow(A);
%imshow(uint8(B)); |
function V = block_krylov_3p(B,C,F,k,A)
%BLOCK_KRYLOV_3P Orthogonal basis for generalized block Krylov subspace
%
% V = BLOCK_KRYLOV_3P(B,C,F,k,A) returns orthogonal basis for the
% generalized block subspace, where
%
% k=1 : V = Lin(F, B1*F, C1*F)
% k=2 : V = Lin(F, B1*F, C1*F, B1^2*F, B1*C1*F, C1*B1*F, C1^2*F),... |
function [CFDMeanSpeeds,CFDPeakSpeeds,CFDMeanBearings,relativeDistances,latLongElev] = flightPathWindPrediction(flightPath,numPathDivisions,date,time,isAM,gx)
% Date=char(datetime('now','format','yyyy-MM-dd')); % Date Placeholder (Format: YYYY-MM-DD)
% Date = '2021-01-27';
%flightPath = [43.65446663461646, -79.37821... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.