text stringlengths 8 6.12M |
|---|
function y = perform_thresholding(x, t, type, options)
% perform_thresholding - perform hard or soft thresholding
%
% y = perform_thresholding(x, t, type, options);
%
% t is the threshold
% type is either 'hard' or 'soft' or 'semisoft' or 'strict' or 'block'.
%
% works also for complex data, and for cell array... |
clear
close all
warning('off','all')
%%% Valeurs à choisir
% Critères d'arrêts de l'algorithme d'optimisation
eps = [0.001;0.0000001;0.0000001];
%eps = [0.01;0;0]; % A essayer si GradL final est trop grand et k<kmax
% Nombre d'itérations maximales pour l'optimiseur
kmax = 200;
% Choix de la formule de calcul de la ... |
%*************************导波光学-矩形波导_Homework3**********************
%*********************************by曹晓峰 ********************************
clear;
close all;
syms Kx Ky X Y;
%初始参数
n1=1.4549; %矩形中心折射率
n2=1.444; %上侧折射率
n3=1.444; %下侧
n4=1.444; %左侧
n5=1.444; %右侧
a=4e-6; %矩形长度
b=4e-6; ... |
function [testError] = misclassError(y,y_hat,thresh)
%MISCLASSERROR Compute 0/1 misclassification error for a 2-class problem
% misclassError [out] = MISCLASSERROR(in) computes the 0/1
% misclassification error given predicted and actual output.
%
% Input:
% y = actual class
% y_hat = predicted class
% thresh = probabi... |
%% optimal gait generating with contact invarient method
% states to solve: q, c (contact indicator)
clear;
clc;
modelName='human_7';
addpath dyn/
addpath obj/
addpath gaitCon/
addpath plotRobot/
addpath (['../',modelName,'/robotGen/'])
addpath (['../',modelName,'/robotGen/grad/'])
addpath (['../',modelName,'/robotGen/... |
function writeline(s)
%simple function to write something on the screen, with newline
fprintf('\n');
fprintf(s);
%fflush produces an error in matlab but needed in octave:
try; fflush(stdout); catch; end
|
% This code is shared for research only. Please cite the following paper:
%Z. Yang, Y. Xiang, K. Xie, and Y. Lai, "Adaptive method for nonsmooth nonnegative matrix factorization," IEEE Trans. Neural Networks and Learning Systems, vol. 28, no. 4, pp. 948-960, Apr. 2017.
clear
m=6;
r=3;
N=20;
eps=1e-9;
rand('state',1000... |
clear;
[y, fs] = auread('humpbackWhaleCleanShortDs.au');
subplot(2,1,1);
plot(y);
xlim([0 2*1e5]);
nwnd = 512;
nov = nwnd/2;
nfft = 1024;
[S, F, T, P] = spectrogram(y, nwnd, nov, fs);
subplot(2,1,2);
PdB = 10*log10(P);
imagesc([T(1) T(end)], [F(1), F(end)], PdB);
axis xy;
xlabel('Time [s]');
ylabel('Frequency [Hz]')... |
function [ outputFileName, F11, F21, F33, F34, RXP_scatAngles ] = ...
MieToRXP( mieOutput, outputModelName, outputDir, varargin)
%MieToRXP Convert the Results of Meerhoff Mie Code into the format
% RXP can understand
%
% Optional Inputs:
% (1) Description - Cell Array of String... |
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR
% Autores: Gonzalo Pajares y Jesús Manuel de la Cruz
% Copyright RA-MA, 2007
% Ejercicio 9.6: Clasificación: redes neuronales y máquinas de vectores
% soporte
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 9.9.1 El perceptrón simple ... |
function f = initPolicy(p, policy, inputs, targets)
%initPolicy Function that computes the the difference between the output of
% a given policy and a set of targets. Used for initializing the
% hyperparemeters of a policy.
%
% Input arguments:
% p: parameters of the policy
% policy: structure
% inputs: query points to... |
function newState = createHadamardState_t(n)
qc = qregister(n);
for qubitNum = 0:n-1
qc = hGate(qc,qubitNum);
end
newState = qc.getState();
end
|
clear all;
a1 = 4; %powierzchnia Z1
a2 = 5; %powierzchnia Z2
A1 = 2; %wspolczynnik przy h1
A2 = 4; %wspolczynnik przy h2
g = 10;
u0max = 3;
tabu0 = [0 0.5*u0max 0.9*u0max];
du = 0.1*u0max;
czas_skoku = 2;
for i = 1:3;
figure;
u0 = tabu0(i);
h10 = u0/a1;
h20 = u0/a2;
sim('sim8');
subplot(2,1,1)... |
trackingData = load('C:\Tornado2.2\data\B2WData4.txt');
% trackingData = load('C:\Tornado2.2\B2WData.txt');
errorDataCoarseStage = trackingData(:,8:14);
errorDataFineStage = trackingData(:,54:59);
accDataCoarseStage = trackingData(:,46:47);
accDataFineStage = trackingData(:,82:83);
DADataCoarseStage = trackingData(:,15... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% EE 569 Homework #1
% Date: Sept. 20, 2015
% Name: Faiyadh Shahid
% ID: 4054-4699-70
% e-mail: fshahid@usc.edu
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function channel_out = quantizedChannel(channel,x_val,avg_1,avg_2,avg_3,avg_4)
[row ... |
function log_wishpdf = log_wishart_pdf(V_not,v_not,Delta,D)
%Delta is a DxD inverse variance-covariance matrix
%this is the log of the un-normalized wishard pdf
%there is no built-in Wishart PDF in matlab
log_wishpdf = (-v_not/2)*log(det(V_not))+((v_not-D-1)/2)*log(det(Delta))-(1/2)*trace(V_not\eye(D)*Delta);
end |
%% convert_mach_struct2mtx.m
% reverse of 'convert_mach_mtx2struct.m'
% convert our individual matrices in a population struct to population
% arrays (rows of the matrix) to quickly calculate makespan, as more
% efficient at everything else except makespan calculation.
% Each row represents individual i of the populat... |
clear
addpath('../MatlabTools')
load ControlExperiment
load ControlTrialProperties
nr_trials=length(control_experiment);
for t=1:nr_trials
control_experiment(t).hallway_states=2:9;
control_experiment(t).leafs=10:17;
control_experiment(t).parent_by_state={[],[1],[1],[1],[1],[2],[3],[4],...
[5],[6]... |
%% Part A Assignment
%% /a/ at 120Hz for various Filter Orders
[data_2, G_2] = LP('a_120.wav', 2); %Filter Order = 2
[data_4, G_4] = LP('a_120.wav', 4); %Filter Order = 4
[data_6, G_6] = LP('a_120.wav', 6); %Filter Order = 6
[data_8, G_8] = LP('a_120.wav', 8); %Filter Order = 8
[data_10, G_10] = LP('a_120.wav',... |
function[KinkCST,Xt_r,Xl_r,Xt_k,Xl_k,Xt_t,Xl_t,Xt_85,Xl_85] = AFinterp(RootCST,TipCST,J)
A_root = RootCST;
A_tip = TipCST;
M = 12;
M_break=M/2;
X_vect = linspace(0,1,101)'; %points for evaluation along x-axis
[Xt_root,Xl_root]=D_airfoil2(A_root(1:M_break),A_root(1+M_break:end),X_vect);
... |
function [RLFall, n1, SPLx, RLFm] = plot_Mc2srcA(spikes_trial, SPLseq1, RLFall, n1, repnum);
% function [RLFall, n1, SPLx, RLFm] = plot_Mc2srcA(spikes_trial, SPLseq1, RLFall, n1, repnum);
%
% plots RLFs rep-by-rep for Mc2src
%
% argin: spikestrial: list of spiketimes for this trial (msec)
% SPLseq1... |
%% Understanding Philips B1 normalization
%% Check definition of Bplus - cropped
% Philips
dirname =uigetdir();
coilb1 = zeros(120,90,386,8);
parfor k=1:8
coilb1_plus(:,:,:,k)= df_read(fullfile(dirname,['multix_coil',num2str(k),'_bplus.df']));
% coilb1(:,:,k) = squeeze(s(:,:,193));
end
Bx= df_read(fullfile(dirnam... |
bank = 1;
care = 2;
commerce = 3;
elec = 4;
energy = 5;
food = 6;
mat = 7;
preto = 8;
property = 9;
tech = 10;
tran = 11;
sector = input('Choosen a sector : ');
fprintf('\n');
if sector == 1
bankX = xlsread('C:\Users\asus10\Desktop\sectorTrain\bank\bank_data.csv');
bankY = xlsread('C:\Users\asus10\Desktop\se... |
function [spectre_C]= spectre(s,N,Nfft )
spectre = fft(s, Nfft)/N;
spectre_ampl = abs(spectre);
spectre_C = fftshift(spectre_ampl);
end
|
%% ITF
IM = rgb2gray(imread('castle.jpg'));
subplot(2, 2, 1);
imshow(IM);
title('original');
subplot(2, 2, 2);
imshow(applyITF(IM, window(220, 20)));
title('window ITF');
subplot(2, 2, 3);
imshow(applyITF(IM, gammaITF(0.5)));
title('gamma ITF');
subplot(2, 2, 4);
imshow(applyITF(IM, sigmoidITF(100, 20)));
title('si... |
if count(py.sys.path,'') == 0
insert(py.sys.path,int32(0),'');
end
configPath=".\configs\cocostuff164k.yaml";
modelPath="C:\Users\ponce\Desktop\CarlosSetUpFilesHere\CompressionPaperReviewResponse\resources\deeplab-pytorch-master\data\models\coco\deeplabv1_resnet101\caffemodel\deeplabv2_resnet101_msc-cocostuff... |
function Correct_percent = Percentage_Samples_Correct(Solution)
correct = find(Solution == 1);
incorrect = find(Solution == 0);
total_samples = length(correct) + length(incorrect);
Correct_percent = (length(correct)/total_samples)*100;
end |
function [promedio,maximo] = algoritmoGenetico(tamanoPoblacion,probabilidadMutacion,probabilidadCruza,numeroDeGeneraciones)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
poblacionInicial=round(rand(tamanoPoblacion,20));
for i=1:tamanoPoblacion
genotipo_x1=num2str(poblacionInicia... |
function [cost,grad,features] = sparseAutoencoderLinearCost(theta, visibleSize, hiddenSize, ...
lambda, sparsityParam, beta, data)
% -------------------- YOUR CODE HERE --------------------
% Instructions:
% Copy sparseAutoencoderCost in sparseAutoencoderCos... |
function graphics_label(title_, xLabel,yLabel,fontSize)
xlabel(xLabel);
ylabel(yLabel);
title(title_);
set(get(gca,'XLabel'),'FontSize',fontSize,'Vertical','top');
set(get(gca,'YLabel'),'FontSize',fontSize,'Vertical','middle');
set(get(gca,'Title'),'FontSize',fontSize);
end
|
function vocab = build_vocabulary( image_paths, vocab_size )
% The inputs are images, a N x 1 cell array of image paths and the size of
% the vocabulary.
total_descriptors = [];
% Sample random permutation of images
sample_size = length(image_paths);
disp(sample_size);
perm = randperm(length... |
function c = covariog(X,maxtau);
% COVARIOG Covariograms
%
% Usage:
% c = covariog(X,maxtau)
%
% Note: calculates the covariogram for each column of the Txn matrix X where
%
% c(tau,:)=cov( X(t,:), X(t-tau,:) ), tau=-maxtau,...,maxtau
%
% The ith column of c is the covariogram for the ith column ... |
% Arnold Lab, University of Michigan
% Melissa Lemke, PhD Candidate
% Last edit: October 11th, 2021
%% disclaimer: this simulation may take around 30 hours to complete
% shorten the boosts vector or the number of rand_trials to run a shorter test
% Simulate IgG1 concentration and affinity to FcR boosts in all
% v... |
%%integPr
%%arr 07/28/2008
%..........................................................................
% Integrates vector of mixing ratios (cm-3) above pressureSurface as function of pressure (hPa)
% to get vertical column densities (cm-2). Computes piecewise in layers between two pressures.
% Assumes exponential var... |
clear all
close all
I = imread('hallway.jpg');
imshow(I,[]);
E = edge(I, 'canny');
figure, imshow(E);
[H, theta, rho] = hough(E);
peaks = houghpeaks(H, 10);
% Use Matlab's Hough lines
lines = houghlines(E, theta, rho, peaks);
figure, imshow(E);
for k = 1:length(lines)
xy = [lines(k).point1; lines... |
function [retval] = struct2ascii(struct_var,output_file);
% [retval] = struct2ascii(struct_var,output_file);
% Exports a structured variable as tab-delimited text-file
%
% INPUTS:
% struct_var - 1xN structured variable where N represents
% cases (rows). Subfields of structured variable
% will be output as co... |
clear;
%generate toy data files with fewer training images, for testing
d=2;
N = 28;
SAMPLE_NO = 60000;
fIn = sprintf('data/training_data_N=%i_d=%i_samples=%i', N, d, SAMPLE_NO);
load(fIn); clearvars fIn;
SAMPLE_NO = 1000;
training_images(SAMPLE_NO+1:end) = [];
training_labels(SAMPLE_NO+1:end) =[];
Phi(SAMPLE_NO+1... |
%% Choose and load a data file:
[filename pathname] = uigetfile()
%load data
load(fullfile(pathname,filename))
%%
maxlag=120;
frameDur = sessionInfo.expInfo.frameDur;
t=linspace(-maxlag*frameDur,maxlag*frameDur,maxlag*2+1);
figure(101)
clf
figure(102)
clf
nCond = length(sessionInfo.conditionInfo);
for iCond = 1:nCond,... |
function img = coo2im(coo,Nx,Ny)
maxX = max(coo(:,1));
maxY = max(coo(:,2));
img = zeros(Nx,Ny);
% for i = 1:size(coo,1)
% img( Ny - round((Ny-1)*(coo(i,2)+maxY)/(2*maxY)), round((Nx-1)*(coo(i,1)+maxX)/(2*maxX)) + 1 ) = 1;
% end
for i = 1:size(coo,1)
img( Ny - round((Ny-1)*(coo(i,2)+maxY)/(2*maxY)), round((... |
function [Xrr, Xss] = nmpcf_weight(Xabs,Yabs,L,div_segf, Kw, Kr, alpha ,lamR_0, lamR_1, lamW, C)
%
%
% Objetive: The purpose of this function is to add weight into the NMPCF
% decomposition. This allows to enhance the quality of the WS
% by removing the RS that implicitly appear in the hum... |
%This application implements the system MultiSpot proposed by Shi at al.
%("Wireless Power Hotspot that Charges All of Your Devices") but using a
%totally accurated Y matrix instead of estimations based on current
%measurements
classdef omniMultiSpot_tx < powerTXApplication
properties
%for the regular operation
... |
mat = [ 1 3 4 5 ; 8 1 2 3 ; 7 2 3 7];
sortedmat = sortrows(mat, 4);
display(sortedmat); |
close all; clc; clear;
set(0,'DefaultFigureWindowStyle','docked') %'normal' 'docked'
addpath(genpath('./arrow3d'))
set(0,'defaultfigurecolor',[1 1 1])
% [x,y,z] = meshgrid(-2:1:2,-2:1:2,-2:1:2);
% x = x(:);
% y = y(:);
% z = z(:);
%
figure; hold on;
V=rand(3,20);
Vb=[
0.4189 0.8640 0.0708 0.1529 0.95... |
function [percent] = mape(demand,predictedValue)
% NOTE: should pass parameters in ORDER to avoid NOT A NUMBER.
n = length(demand);
error = zeros(n,1);
for i = 1:n
error(i) = abs(demand(i) - predictedValue(i))/demand(i)*100;
end
percent = mean(error);
|
function [out] = larval_loc_batch(genotype,sec,iteration)
files = glob(['Data\',genotype,'*']); %find genotypes named in GUI in data folder
distances = [];
for n = 1:numel(files)
try %this try loop should prevent rogue videos from disrupting the whole information flow
distance = larval_loc_func_2(files{n},sec)... |
function Xmodel = KalmanX2model(Xactual,sigmaVis,sigmaSpeed,sigmaAcc,latcorrection,es,Tsmth_win, wintype,numBins)
sampleRate = mean(1./es.sampleSize);
dt = mean(es.sampleSize);
Xactual = circshift(Xactual,[round(latcorrection/(1000/sampleRate)) 0]);
if sum(sigmaVis) == 0 && sigmaSpeed == 0
Xmodel = Xactual;
else
%... |
% Test which sensitvity parameters have an influence on the expected total
% infectiousnessover the infectivity profile. SymptomMean has a large
% effect, IncubationMean has a small effect.
cfgHyper = InitHyperConfigs;
cfgRandom = InitRandomConfigs(cfgHyper,2);
strs = {'IncubationMean','SymptomMean'};
reps = 20;
r... |
%% Load dataset
[imageTr, ~] = cifarLoader('extend', 1);
%% Whitening, SVD
[Z, U, SIG, MU] = whitening(imageTr, 'svd');
%% RICA analysis
nBasis = 60 * 60;
Mdl = rica(Z, nBasis, 'IterationLimit', 5e3, 'VerbosityLevel', 1, 'GradientTolerance', 1e-4, 'StepTolerance', 1e-4);
%% Visualization
W = Mdl.TransformWeight... |
function WordSequence= CellArray2Sequence( Word )
%STRUCT2SEQUENCE Summary of this function goes here
% Detailed explanation goes here
WordSequence = [];
for i=1:size(Word,2)
temp = Word{i};
WordSequence = [WordSequence;Inf,Inf;temp];
end
WordSequence = WordSequence(2:end,:);
end
|
function[f] = zpad(u,n);
%ZPAD - pad variable u with n zeros on each dimension
s = size(u);
if nargin==1
n = min(s);
end
sz = s + 2*n;
f = zeros(sz);
if ndims(u)==2
f(n+1:s(1)+n,n+1:s(2)+n) = u;
elseif ndims(u)==3
f(n+1:s(1)+n,n+1:s(2)+n,n+1:s(3)+n) = u;
else
error('code only handles ... |
function [datosSap2000] = importDataSap2000
% Guardar en una archivo .mat los datos de extraidos de un excel sacado de
% sap2000
%% Abrir un excel previamente exportado de sap2000
[nombreArchivo, pathArchivo] = uigetfile({'*.xlsx'},'seleccione archivo Excel');
%direccion completa como nombre de archivo leido
nom... |
function net = multiple_sample_train(net, train_samples, alpha, beta, nIteration, method)
% Trainiert Netzwerk für verschiedene Trainingsamples, welche mit
% generate_train_samples erzeugt wurden. Dh. ein Datensatz wurde in
% verschiedene Teilstücke zerlegt welche nun zum Training genutz werden. Es
% kann weiter... |
% Run script for solving Darcy's system (multiscale) with mixed
% finite volume method (TPFA) for the fine scale approximation
% Modified version of Panayot's method, more favourable for parallelism
% Use SVD to screen out the linear independency in the trace
% Extend the trace so that the basis has piecewise constan... |
function y = flip_matrix(A)
%input: matrix A to be flipped upside down
%output: matrix y, which is -A plus max value of A
%create correction matrix, to keep values in defined area;
corrector = double(max(max(A)))*ones(size(A));
%cast corrector matrix to type of A for addition
y = cast(corrector,class(A));
%dif... |
params
dny = 1;
dnx = 1;
LLx = Lx;
LLy = Ly;
ddir = [meshpth,'grid/'];
ffnx = load([ddir, 'N1x.dat']);
ffny = load([ddir, 'N1y.dat']);
xG = importdata([ddir, 'xG.dat' ], ' ', 1);
yG = importdata([ddir, 'yG.dat' ], ' ', 1);
ZtbG = importdata([ddir, 'ZtbG.dat'], ' ', 1);
sfbG = importdata([ddir, 'sfbG.dat'], '... |
function [C, U, obj_Fcn] = new_fcm(data, cluster_n, class_n, m, max_iter, min_impro)
obj_Fcn = zeros(max_iter, 1); % Array for objective function
%U = new_initfcm(cluster_n, class_n, data, center, m); % Initial fuzzy partition
U = rand(cluster_n,class_n);
U=U./repmat(sum(U),cluster_n,1);
%C = rand(3,4);
% M... |
% NEITZINFERIORMONKEY XYREGISTRATION
%
% The current setup for XY alignment does not support an update to
% existing registration. So for now, to change the registration
viewMode = true;
saveMode = false;
[~, S] = xyRegigistration('i', [1284 1305], viewMode);
updateRegistration('i', S, saveMode);
branchRegistratio... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (C) 2013 by Jerome Maye %
% jerome.maye@gmail.com %
% ... |
% General Settings
basedir = 'C:\Users\luigi\Home\Work\EC\ABIDE_EC\DCM_359_van.tar\DCM_359\';
subjdir = fullfile(basedir, 'Sub_359/');
jobdir = fullfile(basedir, 'JOBS');
spmfold = 'RESULTS';
outputdir = fullfile(basedir, 'CSVs/timeseries');
% Experimental Settings
[subjlist, nsub] = getsubjectlist(subjdir);... |
clear all
clc;clf;
%设置时域
dt=pi/8000;
t=-30*pi:dt:30*pi;
%设置采样参数
T=pi/320;
ws=2*pi/T;
tmin=-1000*T;tmax=1000*T;
wc=pi/T;
t1=tmin:T:tmax;
%频率设置
w0=300;w1=2;w2=3;
%幅度设置
p0=1;p1=2;p2=3;
%基带信号
ai=p1*cos(w1*t1);
bi=p2*sin(w2*t1);
%已调信号
x=ai.*p0.*cos(w0.*t1)+bi.*p0.*sin(w0.*t1);
%希尔伯特变换
y=hilbert(x);
%%参数估计%%
a=abs(y);%包... |
function H = forward_kuka(joint, myrobot)
% initialize Anonymous Function H
H_templete = @(theta,alpha,a,d)[cos(theta) -sin(theta)*cos(alpha) sin(theta)*sin(alpha) a*cos(theta);
sin(theta) cos(theta)*cos(alpha) -cos(theta)*sin(alpha) a*sin(theta);
0 sin(alpha) cos(alpha) d;
0 0 0 1];
% compute inte... |
classdef Scor6Axis < matlab.mixin.SetGet
% Scor6Axis handle class for establishing communication with Scor6AxisSim
% obj = Scor6Axis creates a Scor6Axis object to establish
% communication with Scor6AxisSim.
%
% Scor6Axis Methods
% writePos - Sends array of positions to Scor6AxisSim to move to... |
function [valfitness,gp,ypredval] = csrSelectPareto(gp)
% this function is called after each generation to identify the current
% pareto optimal set.
[valfitness,gp,ypredval] = Csr.getInstance.updateParetoSet(gp);
end |
%% Stelling 6
%
% Bij een bestaande vector v=[ 7 1 2 9] krijg je
% bij de aanroep:
%
% v(2:end)
%
% de waardes 7 1 2 als resultaat terug.
%
Antwoord... |
function conneted_region = ...
Connected_component_region_2d( seed_point, image_slice )
%The performs a region growing algorthm to find the connected region. The
%connected regions is dertermined by a seed. - We assume a 4 neigbourhood
%array.
%The inputs are the seed point in 1 by 2 and the image image slic... |
% Plot the figure of R_m versus alpha
alpha = linspace(-pi/2,pi/2,80);
l = 4e-6;
theta = 1*pi/3;
R = 1e-6;
R_m = -(l/2-R*cos(alpha))./cos(-alpha+theta);
plot(alpha*180/pi,R_m)
xlabel('alpha (degree)')
ylabel('R_m')
title('Relationship between R_m and alpha')
xlim([-90,90])
shg
|
clc; clear; close all;
n0 = 0;
n1 = -20;
n2 = 20;
[x,n] = impseq(n0,n1,n2);
figure
stem(n,x)
hold on
n0 = 4;
n1 = -20;
n2 = 20;
[x,n] = impseq(n0,n1,n2);
stem(n,x)
hold on
n0 = -8;
n1 = -20;
n2 = 20;
[x,n] = impseq(n0,n1,n2);
stem(n,x)
%------------------------------------------------------... |
function createEigenfacesPCA(db)
% Step 1: Create variables
[rows, cols] = size(db); % db or image
n = 300 * 400; % Facial image dimension
M = cols; % Number of traning images in db, M << n
K = cols; % Number of Eigenfaces used, K <= M
xiSum = 0;
xiVec = zeros(n,M);
% Loop over... |
function second_layer_clustering(info)
datadir = info.datapath
dur = 's4/';
all_files = dir(datadir);
subjs = {};
for i = 3: size(all_files,1)
subjs{i-2} = all_files(i).name;
end
for subj_= subjs%{'subj6','subj7'}
subj = subj_{1};
load([d... |
%FELIPE ESCALLON PORTILLA
%11/AGO/2004
%MATLAB:TTL'S
%CICLOS O ANILLOS
for x=1:5
%x esta en radianes ojo---->>>>para grados hago x*180/pi
y=sin(x);
z=cos(x);
%disp==desplegar
disp([x;y;z]')%':transpuesta
end
%ojo:el ; es para que no muestre los datos u operaciones
%GRAFICA de... |
function [x_i_temp, g_i, f_i, predicted_obj,d,lam] = SQP(x_i,cu,cl,lbound, ubound, v)
% This function performs one iteration of SLP.
% evaluate the objective and the constraints at the current trial point
[f_i, g_i] = amplfunc(x_i,0);
[nabla_f_i, nabla_g_i] = amplfunc(x_i,1);
W = amplfunc(-v);
% evaluate and define th... |
% Made by Ryan R. Rich in Partial Fulfillment of the Requirements for the
% Degree of Bachelor of Arts with Honors in Psychology from the University of Michigan, 2021
% Mentor: Thad Polk, Graduate Student Mentor: Pia Lalwani, Additional
% thanks: Nathan Brown
% Contact Ryan: ryrich@umich.edu
%% All the fun ... |
function playbackCheck(settings)
%
% Copyright 2017 Yulin Wu, University of Science and Technology of China
% mail4ywu@gmail.com/mail4ywu@icloud.com
% TODO
end |
classdef TestTensor < matlab.unittest.TestCase
% TestTensor - Unit tests for tensors.
properties
tol = 1e-12
end
methods (TestClassSetup)
function classSetup(tc)
orig = Options.CacheEnabled;
Options.CacheEnabled(false);
tc.addTeardown(@Option... |
function [aM_GWSA, aM_GESA, aM_WMV, aM_GMV, aM_GI, aM_WF] = ...
brain_data(varargin)
%
% NAME
%
% function [aM_GWSA, aM_GESA, aM_WMV, aM_GMV, aM_GI, aM_WF] = ...
% brain_data(<a_summaryCol>)
%
% ARGUMENTS
% input
%
% optional
% a_summaryCol int column index to display in
% summary data
% out... |
function [answer]=ask_recursively(question)
reply = input(question,'s');
if strcmp(reply,'yes')
answer=1;
elseif strcmp(reply,'no')
answer=0;
else
fprintf('please answer "yes" or "no"\n')
answer=ask_recursively(question);
end
end |
function display_fn(img1, img2, img3)
figure;
if nargin == 2
subplot(1,2,1);
imshow(img1);
subplot(1,2,2);
imshow(img2);
end
if nargin == 3
subplot(2,2,1);
imshow(img1);
subplot(2,2,2);
imshow(img2);
subplot(2,2,3);
imshow(img3);
end |
%optimization homwork 9
clear; close all; clc;
%% Problem 1
% [x,y] = meshgrid(-10:1:10);
%
% for i = 1: 12;
% % mesh(x,y,-5.*x+y+(x-1).^2)
% % figure();
% subplot(1,2,1);
% mesh(x,y,-5.*x+y-i.*(x-1).^2)
% % contour(x,y,-5.*x+y+(x-1).^2); hold on; scatter(1,0);
% % figure()
% subplot(1,2,2)
% contour(x,y,-5.*x+... |
function net = initializeCNN(m1,m2,m3)
f=1/100 ;
net.layers = {} ;
net.layers{end+1} = struct('type', 'conv', ...
'filters', f*randn(5,5,3,m1, 'single'), ...
'biases', zeros(1, m1, 'single'), ...
'stride', 1, ...
... |
% CreatePaperPlots
% ================
% Script to create plots and figures used in the paper. (CAVEAT: Takes long!)
% Create Error vs. MissingPixels Plot
% Requires parameters saved in a parameters.mat file
load('start_params.mat');
main_path = pwd;
% Generate strategy plots
global debug_threshold_plot_number;
fprin... |
% Computes Arabidopsis circadian clock model global parametric sensitivities and
% rank or parameters
clear all;
cprintf('*[1,0.5,0]','\n\n --->Computing global sensitivities, this may take a while...');
Arabidopsis_circadian_rank % Calls the script with the inputs:
% Model
... |
%% Proposed ALGORITHM: Gauss Mapped Variable Neighbourhood Particle Swarm Optimization (GM_VNPSO)
%% Developers:
% Kartik S. Pandya, Professor, Dept. of Electrical Engineering, CSPIT,
% CHARUSAT, Gujarat, INDIA
% Jigar Sarda, Asst. Professor, Dept. of Electrical Engineering, CSPIT,
% CHARUSAT, Gujarat, INDIA
% Margi S... |
function [] = FunctionValidationTests(RunL1, RunL2, RunL3)
%This is a funtion to run the various functions relating to the wind
%turbine design with the variable values form the validation data to check
%that they function correctly.
%RUN THE LEVEL 1 INDUCED CALCULATIONS CODE IF DESIRED
if RunL1 == 1
[a, adash, p... |
function [Deployment_roomcat_save_temp,numpaired] = prox_gps_check(Deployment_roomcat_save,bname,numpaired,psname)
%Prox_gps_check by Evan Coffey
% Creates plots to visualize the proximity timeseries(in meters)and GPS classification (1 = in and 0 = away)
% Also shows a breakdown of the percentage of time monitored... |
%% FCpD - Model fitting
% (1) Fit different perceptual/response models
%% load data
pathDat = ''; %path
Dat = '.mat'; %dataset
load(strcat(pathDat, Dat))
load('info.mat');
%% (1) Fit different perceptual/response models
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (a) ch... |
function test_suite = test_PolygonArrayPca
%TEST_POLYGONARRAYPCA Test case for the file PolygonArrayPca
%
% Test case for the file PolygonArrayPca
% Example
% test_PolygonArrayPca
%
% See also
%
% ------
% Author: David Legland
% e-mail: david.legland@nantes.inra.fr
% Created: 2018-03-27, using Matlab 8.6... |
% DSP Project 2
% Part 1: The Encoder
% Cole Lewis, Macky McWhirter, Braydon Westmoreland
% 11/15/19
clear all;
close all;
clc;
% Fahrenheit 451
[y,fs] = audioread("SpeechFile.wav");
%% Original Signal Analysis
% Original Amplitude Response
N = length(y);
xlimit = N/fs;
dt = 1/fs;
t = 0:dt:(N*d... |
close all;
clear;
clc
% TASK: Check if system is stable, unstable or maginally stable
% block one gs
nume1 = [507];
denom1 = [1 3 10 30 169];
printsys(nume1,denom1)
% feedback gain
fbnum = [1];
fbdenom = [1 0];
printsys(fbnum,fbdenom)
% solve feedback
[numgs, denomgs] = feedback(nume1,denom1, fbnum, fbdenom,-1);
pr... |
function disp(this)
% disp Display method for model objects.
%
% Backend IRIS function.
% No help provided.
% -IRIS Macroeconomic Modeling Toolbox.
% -Copyright (c) 2007-2017 IRIS Solutions Team.
STR_VARIANT = 'parameter variant';
%--------------------------------------------------------------------------
isEmpty ... |
%% the following block of code is for user input questions
prompt1 = ['Please enter the path to the folder like so '...
'(/Users/saranya/wherever the folder is ...), not including the '...
'folder name at the end'];
folder_path = input(prompt1, 's');
disp(strcat("You entered ", folder_path));
if ~exist(fold... |
log1=importdata('log1.txt');
current = log1(0.5e5:end,1);
voltage = log1(0.5e5:end,2);
diff_voltage=diff(voltage)
arc=log1(0.5e5:end,3);
figure(1)
plot(current, '.')
figure(11)
plot(voltage)
figure(12)
plotyy(1:length(current),current, 1:length(voltage),voltage)
figure(13)
plotyy(1:length(voltage), voltage, 1:length(a... |
classdef RobustDetector < handle
properties
BGR = [] % if static background
B = []
im0 = []
im00 = []
im000 = []
noise_t = [0.06 0.06 0.06]
noise = 5/255
maxAllowedExp = 1.5
Size = []
Size_r = []
scale_factor = 1
counter = 0
frame0 = []
gm = 2.2
score_th = 0.4
corr_th = 0.95
hs_th = 0... |
function [ fx ] = remove_line_noise(x, template , sampling_frequency, line_frequency)
template_len = numel(template);
template = [template ; template(1)];
f_template_len = sampling_frequency / line_frequency;
template_step = f_template_len / template_len;
tx = 1:template_step:(f_template_len + 1);
... |
clear all;
close all;
v_max = 50;
carrier = 9.55e9;
series_name = 'barker';
plot_title = 'Barker, 13 elements';
phase = [ 0 0 0 0 0 1 1 0 0 1 0 1 0] * pi;
phase = kron(phase, ones(1,50));
f_points = 100;
impulse_response = [];
tau = 15e-6;
fs = 2e8;
signal = makesignal([], phase, [], tau, fs);
[delay v the_af] = a... |
im = imread('sol.jpg');
imshow(im);
irgb= rgb2gray(im);
imshow(irgb);
up = [0 0 0; 0 0 0; 0 1 0];
right = [0 0 0; 1 0 0; 0 0 0];
left = [0 0 0; 0 0 1; 0 0 0];
down = [0 1 0; 0 0 0; 0 1 0];
blur1 = [0 0 0; 0 0 1; 0 1 0];
blur2 = [0 1 0; 1 0 1; 0 1 0];
blur3 = [1 4 7 4 1; 4 16 26 16 4; 7 26 41 26 7; 4 16 26 16 4; 1 4 7... |
function matCoDCN = DCN_Organ(msiDataOrgan_Exp, msiDataOrgan_Ctr, alpha)
nOrgan = length(msiDataOrgan_Exp);
nIon = size(msiDataOrgan_Exp{1},2);
matCoDCN = zeros(nOrgan,(nIon)*(nIon-1)/2);
for i=1:nOrgan
[matTC1,matP] = corr(msiDataOrgan_Ctr{i});
matTC1(matP>alpha) = 0;
nFC = size(msiDataOrgan_Ctr{i... |
function Output=EarlyReflection(Input,Fe,ChoixUser,Tr,d)
%Input est le son entrant
%GainUser est le gain final de la piste EarlyReflection
%Choixuser est le choix de l'algo utilisé : bathroom, hall ou cathedrale
%Tr est le TR60 qui correspond au temps de reverberation ( cb de temps elle dure )
%d est la distance... |
load simplecluster_dataset
net = patternnet(20);
net = train(net, simpleclusterInputs, simpleclusterTargets);
simpleclusterOutputs = sim(net, simpleclusterInputs);
plotroc(simpleclusterTargets, simpleclusterOutputs); |
function [in, current_element] = localFind(current_point, current_element)
%% Local Find
% This function streamlines the global find by only testing elements
% immediately adjacent to the current/previous element.
% A future update of this will take into consideration the paths'
% trajectory and eliminate the ele... |
function [ cost, grad ] = stackedAECost(theta, inputSize, hiddenSize, ...
numClasses, netconfig, ...
lambda, data, labels)
% stackedAECost: Takes a trained softmaxTheta and a training da... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.