text stringlengths 8 6.12M |
|---|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ENGR 112 Sections 512 %
% Harland Ashby %
% Ahmad Al Kawam %
% 04/04/16 %
% Week 19 ... |
%% Task 1: Sine function approximation
% The task is the simple way to study MATLAB Neural Network Start module
% (nnstart) as a part of Deep Learning Toolbox
%
% The task deals with sin(x) approximation. The main question is how well
% an ANN in data interpoltion and extrapolation.
%
% For this task, you will need... |
Installation
exerciceFunction = @(actualDate, maturityDate, stepSize) true(size(actualDate));
barrier = @(subyacentPrice) true(size(subyacentPrice)).*-1;
payoff = @(subyacentPrice, actualDate, maturityDate) max(subyacentPrice - 10, 0);
path = [10, 15, 9, 17];
stepDatetimeArray = [datetime(2021, 04, 10), datetime(... |
function []=declass()
clc; clear; close all;
x = deq;
x.f = @myde;
x.tspan = [0, 10];
x.y0 = [0,1];
[t, y] = x.sol;
plot(t,y(:,1));
axis([0 10 0 10]);
end
function dydt = myde(t,y)
%f = 0.4*y*(1-y/10);
dydt(1) = y(1)+y(2)*exp(-t);
dydt(2) = -y(1)*y... |
function [data] = mvpa_datapartition(cfg,prepdata)
% This function takes the output from the mvpa_dataprep and partitions the data
% for further cross-validation procedure.
% For each partition fold a feature reduction step is performed:
% The feature Selection Step performs a One-way ANOVA for each feature.
% Only in... |
function h = Heisenberg(Jx, Jy, Jz, hz)
% Construct the spin-1 Heisenberg Hamiltonian for given couplings.
%
% Parameters
% ----------
% Jx : float
% Coupling strength in x direction
% Jy : float
% Coupling strength in y direction
% Jy : float
% Coupling strength in z direct... |
function argStruct = nameValuePairToStruct(defaults, varargin)
%NAMEVALUEPAIRTOSTRUCT Converts name/value pairs to a struct.
%
% ARGSTRUCT = NAMEVALUEPAIRTOSTRUCT(DEFAULTS, VARARGIN) converts
% name/value pairs to a struct, with defaults. The function expects an
% even number of arguments to VARARGIN, alternating NAM... |
function tests = graphTest( )
tests = functiontests( localfunctions );
end
function testStem(this)
d = struct( );
d.a = tseries(qq(2001,1:40), @rand);
d.b = tseries(qq(2001,1:40), @rand);
x = report.new( );
x.figure('');
x.graph('');
x.series('a', d.a, 'PlotFunc', @stem);
x.publish('te... |
function [panoImg] = imageStitching_noClip(img1, img2, H2to1)
%
% input
% Warps img2 into img1 reference frame using the provided warpH() function
% H2to1 - a 3 x 3 matrix encoding the homography that best matches the linear equation
%
% output
% Blends img1 and warped img2 and outputs the panorama image
%
% To prevent... |
function denoised = denoise_bcg(EEG)
% expects EEG with a sampling rate of 500Hz
eeg2 = EEG ;
srate = eeg2.srate ;
% get the peaks within a long sliding window(2 seconds) for the correlation
% function
clear maxinds hrepochs hrepochs2
peakdata = eeg2.data(32,:) ;
winlength1 = eeg2.srate*2 ; maxinds = zero... |
%% Set paths to other GEMINI repos
cwd = fileparts(mfilename('fullpath'));
gemini_root = [cwd, filesep, '../../../GEMINI'];
addpath([gemini_root, filesep, 'script_utils'])
addpath([gemini_root, filesep, 'setup/gridgen'])
addpath([gemini_root, filesep, '../GEMINI-scripts/setup/gridgen'])
addpath([gemini_root, filesep, '... |
x1=[-5.01, -5.43, 1.08, 0.86, -2.67, 4.94, -2.51, -2.25, 5.56, 1.03;
-0.91 1.30, -7.75, -5.47, 6.14, 3.60, 5.37, 7.18, -7.39, -7.50;
5.35, 5.12, -1.34, 4.48, 7.11, 7.17, 5.75, 0.77, 0.90, 3.52];
x2=[-8.12, -3.48, -5.52, -3.78, 0.63, 3.29, 2.09, -2.13, 2.86, -3.33;
-0.18,-2.06, -4.54, 0.50, 5.72, 1.26, -4.6... |
clear all
close all
f = double(imread('cameraman.tif'));
%f = rgb2gray(RGB);
%[g_cropped, g, h_toep] = convolve_prod(f, 2.5, 7);
%f_est = tik_deconv(y, h_toep, 0.0001, size(f, 1), size(f, 2));
[g_cropped, g, h_size] = convolve_standard(f, 2.5, 7);
[f_est, h_est] = blind_dconv(g, 100, h_size(1), 0.001, g_cropped, size(... |
function names = fieldnames(s)
%FIELDNAMES Get mutable structure field names.
% names = fieldnames(s) returns a cell array of strings containing the
% structure field names associated with the mutable structure s.
%
% See also GETFIELD, SETFIELD, RMFIELD, ISFIELD.
% Written by Tom Minka
% (c) Microsoft Corpor... |
function dispforProgress(indd, minmaxinds, msgstep, msgcode)
% DISPFORPROGRESS(indd, minmaxinds, msgstep, msgcode)
%
% inputs
% - indd: iteration dummy index.
% - minmaxinds: 1x2 vector with the first and
% last indices of the loop.
% - msgstep: iteration step to display progress... |
%function [x_near, y_near, z_near, x_near_parent, y_near_parent, z_near_parent] = Nearest(states_array, x_sample, y_sample, z_sample, x_init_direction, y_init_direction, z_init_direction)
function [x_near, y_near, x_near_parent, y_near_parent] = Nearest(states_array, x_sample, y_sample, x_init_direction, y_init_direct... |
function message = selectAndSaveParents(folderName,genNum,nStim)
getPaths;
logger(mfilename,folderName,'Parents are being selected.');
load([stimPath '/' folderName '_tempColFit.mat']);
[mb,sb] = getBlankResp(folderName,genNum);
totalStim = size(collatedRespLin1,1);
currStimIds = {};
fo... |
function [orgarray] = arrayReplace(arr1,arr2,anum)
% Inputs (3): arr1 = (double) A MxN array
% arr2 = (double) A MxN array
% anum = (double) A number
% Outputs (1): orgarray = (double) The original array with the replacements made
arr1(arr1==anum(:))= arr2(arr1==anum(:));
%use the logi... |
function listenDispUnderBot(src,listdata,main_figure)
main_menu=getappdata(main_figure,'main_menu');
set(main_menu.disp_under_bot,'checked',listdata.AffectedObject.DispUnderBottom);
switch listdata.AffectedObject.DispUnderBottom
case 'off'
main_figure.Alphamap(2)=1-listdata.AffectedObject.UnderBotTranspare... |
fprintf('........................................................\n')
fprintf('Virtual time of simluation is %f\n',time)
fprintf('Time consuming of simluation is %f\n',cputime-cpu_time)
fprintf('........................................................\n')
fprintf('Number of loop in the simulation is %d\n',loop_count)
f... |
function ccol=CustomColors(ct1)
%This is a function to create some easy to differentiate colors, very
%useful when plotting many things in the same graphic
%The RGB coordinates and names where taken from the following page:
%http://web.njit.edu/~kevin/rgb.txt.html
%
%Examples:
%for ccc=1:15
%plot(ccc*ones(1,10)... |
function [ ] = test( )
%TEST Summary of this function goes here
% Detailed explanation goes here
clc;
res1 = getres(1);
len = length(res1(1, : , :));
lenresult = getreslen();
outStr = '';
w{4,1,len} = [];
k1 = 0; k2 = 0; k3 = 0;
pr = getpr();
for j = 1:pr
for k = 1:lenresult
res = getres(k);
k1 ... |
data_path = 'E:\collage_research_work\DATA\binarization dataset\dibco\Dataset_19\Dataset\';
gt_path = 'E:\collage_research_work\DATA\binarization dataset\dibco\Dataset_19\GT\';
% finalmetric = [];
% finalmetric_extra = [];
time = [];
for i = 1:20
i
imgin = strcat(num2str(i), '.bmp');
img... |
function[E]=kp_4bands_Luttinger_Rosencher_f(k_list, g1, g2, g3)
% Emmanuel Rosencher
% "Optoelectronics"
% Complement to Chapter 5C: "Kane’s k · p method", page 239
% https://www.cambridge.org/core/books/optoelectronics/86B6621671230A798D5BFBE24266EE3F
% https://www.amazon.fr/Optoelectronics-Emmanuel-Rosencher/d... |
% phase_calc_max(x,Ts) plots the phase of the signal x
% Ts = time (in seconds) between adjacent samples in x
function [phase ssf] = phase_calc_max(x,Ts)
N=length(x); % length of the signal x
t=Ts*(1:N); % define a time vector
ssf=(ceil(-N/2):ceil(N/2)-1... |
classdef SVMClassifier < modular.classification.AbstractClassifier
%SVMCLASSIFIER Summary of this class goes here
% Detailed explanation goes here
properties
model
end
methods
function train(this, data, labels)
this.model = fitcsvm(data, labels);
... |
%This code is used to collect image data for training. It takes an image,
%writes it as a jpg file and numbers it automatically
clear
close all
clc
folder_content=dir;
i=1;
while i<length(folder_content)
if folder_content(i).name((length(folder_content(i).name-3):end))~='jpg'
i=i+1;
else
... |
function saveTightFigure(h,outfilename)
% SAVETIGHTFIGURE(H,OUTFILENAME) Saves figure H in file OUTFILENAME without
% the white space around it.
%
% by ``a grad student"
% http://tipstrickshowtos.blogspot.com/2010/08/how-to-get-rid-of-white-margin-in.html
% get the current axes
ax = get(h, 'CurrentAxes');
% make i... |
function [para] = px_spm8_preprocess_smooth(para,data,op)
%FORMAT px_spm8_preprocess_smooth(data,para)
% Usage Call the spm8 for smoothing.
% Input
% data - full path of the data files. Cell format for input,
% with one run in one brace. e.g., {{run1};{run2}}
% para.fwhm - the full... |
function xout = msd(x)
% MSD -- function for calculating the mean square displacement in 1D:
% If "x" is an array of positions at different times, then
% dx(t,tau) = x(t+tau) - x(t);
% and
% then <dx> = ave(dx)
% where the ave is over all t values, weighted by the number of values in
% each sum, and
% <dx^2> = ave(dx... |
% ********************************************
% least-mean-squares FIR design algorithm
% Markus Nentwig, 2010-2011
% release 2011/8/22
% ********************************************
function LMSFIR()
close all;
h1 = demo1('basic'); compareDemo1WithRemez(h1);
% h1 = demo1('basicLMS'); dis... |
function bypassPowerToBoxdBm = readPowerToBoxdBm(power_meter)
% last calibrated by JDW, 2018-05-10. Right input fiber, transmission.
% power_measured_on_power_meter_W = 5.51e-5; % in W
% bypass_power_measured_on_handheld = -1.42; % in dBm
% WTJ, 20180512:
power_measured_on_power_meter_W = 1.9632e-05; % in... |
global MPI_COMM_WORLD;
load 'OctMPI/MPI_COMM_WORLD.mat';
MPI_COMM_WORLD.rank = 4;
PruebaOctaveMPI;
|
function transmissor(fich, info)
infoFinal = "";
for i=1:length(info)
infoFinal = strcat(infoFinal,info(i),"*");
end
transmissorBLE(fich, infoFinal);
end |
%% EEG 00 Processing Variables
if exist('/home/knight/','dir');root_dir='/home/knight/';ft_dir=[root_dir 'PRJ_Error_eeg/Apps/fieldtrip/'];
elseif exist('/Users/sheilasteiner/','dir'); root_dir='/Users/sheilasteiner/Desktop/Knight_Lab/';ft_dir='/Users/sheilasteiner/Downloads/fieldtrip-master/';
else root_dir='/Volumes/h... |
% Calculates the fitness given output from a chromosome and reference values
function fitness = EvaluateIndividual(values, inputs)
tmp = (values' - inputs(:,2)) .^ 2;
tmp = sum(tmp);
e = sqrt(tmp / (length(values)));
fitness = 1 / e;
end
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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#... |
function [] = get_img2re_crop_img(varargin)
opts.im_in_dir = '/data/img_align_celeba';
opts.im_out_dir = '/data/img_align_celeba_crop';
opts.img_format = 'jpg';
opts.jpg_quality = 100;
opts.scale_factor = 1/2;
opts.crop_start = [25 13];
opts.crop_size = [64 64];
opts = vl_argparse(opts, varargin);
if ~exist(opts.im... |
function [residual, g1, g2, g3] = impact_zlb_df_dynamic(y, x, params, steady_state, it_)
%
% Status : Computes dynamic model for Dynare
%
% Inputs :
% y [#dynamic variables by 1] double vector of endogenous variables in the order stored
% in M_.lead_lag_incid... |
function [agt, new]=breed(agt,cn)
%breeding function for class RABBIT
%agt=rabbit object
%cn - current agent number
%new - contains new agent object if created, otherwise empty
global PARAM IT_STATS N_IT ENV_DATA
%N_IT is current iteration number
%IT_STATS is data structure containing statistics on model at each
%it... |
clear paramsAll;
clear params;
params.Gridjob.runLocal = false;
params.Gridjob.requiremf = 5000;
params.Gridjob.wc_host = '!(*thalia*|*erato*)';%'ananke|calvin|carpo|daphne|elara|erato|fred|hobbes|isonoe|jupiter|klio|kore|leda|mars|melete|mneme|neptune|saturn|shaggy|thebe|urania|velma|venus'; %|sinope
params.Gridjob.j... |
%Computes the objective to be minimized (for fmincon)
%In this case, it is basically the norm of the control inputs
%xu contains the states x for N points (3*N points) and control input 'u'
%for each point except the last (N-1 points)
function obj = BDTobjective(xalpha, beta, N)
%Computing the control inputs as a li... |
function [h] = getImageFeatures_IDF(wordMap, dictionarySize, IDF)
% Convert an wordMap to its feature vector. In this case, it is a histogram
% of the visual words
% Input:
% wordMap: an H * W matrix with integer values between 1 and K
% dictionarySize: the total number of words in the dictionar... |
function [ ] = DendV5(Filename, StartTime, EndTime)
%DENDV Render a dendrite's electrical properties
% DendV visualizes the various current flow within a dendrite compartment
% Including: Axonal, NMDA, K+, Na+, Leak, Transmembrane
% DendV was built using MATLAB
% For any issues or questions, please cont... |
clear all
addpath(genpath('/gs/project/gsf-624-aa/quarantaine/niak-boss-0.13.4/'))
path_fmri = '/gs/project/gsf-624-aa/database2/preventad/rsn_preprocess_20150831/fmri/';
path_folder_out = '/gs/project/gsf-624-aa/database2/preventad/results/preventad_scores_20160222_s007_run1/';
files_in.part = '/gs/project/gsf-624-... |
close all;
person = 'Oprah_Winfrey';
%person = 'Hillary_Clinton';
%person = 'Benedict_Cumberbatch';
%person = 'Donald_Trump';
%person = 'George_W_Bush';
%person = 'Zhang_Ziyi';
%person = 'Andy_Lau';
path = sprintf('/home/phg/Storage/Data/InternetRecon2/%s/crop', person);
person = 'yaoming';
path = sprintf('/home/phg/... |
%%--------------------------------------------------------------------
%%-- Miniskybot Class
%%-- (c) Juan Gonzalez-Gomez (Obijuan) juan@iearobotics.com
%%-- May, 2012. Robotics and Cybernetics group. UPM
%%----------------------------------------------------------------------
%%-- Released under the GPL license
%%... |
function [P s u cp cv h c] = Helmholtz(t,d)
%#
%% INTORDUCTION
%==========================================================================
% Calculates CO2 properties using the residual and ideal gas portions of
% the Helmholtz Energy at a given temperature and density normalized to the
% critical point temperature an... |
function outstruct = ODMR(x,y,varargin)
%ODMR Fit an NV single-sided ODMR model to frequency and normalized intensity data
% Will fit N14 and/or N15 models with optional C13 splittings. If a
% parallel pool is avaiable, it will be used (but not created).
% *********************************************************... |
% This code pertains to Figure 2.2 in thesis manuscript
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Input:
% T: Scalar value greater than zero
%
% Output
% Figures:
% 1) characteristic function \chi_{[-1,1]}(x)
% 2) laplacian of gaussian kernel
% 3) convolution of 1) and 2)
%
% Notes:
% Example: weback1(0.3)
% Origi... |
function x=fhtnat(data)
% The function implement the 1D natural(Hadamard) ordered fast Hadamard transform,
% wchich can be used in signal processing, pattern recongnition and Genetic alogorithms.
% This algorithm uses a Cooley-Tukey type signal flow graph and is implemented in N log2 N
% additions and subtractions.... |
function plotData(X,y)
figure;
hold on;
%positive examples
%find() returns the indexes specified by the condition
%in the argument
pos = find(y == 1);
neg = find(y == 0);
%plot positive examples in black crosses
plot(X(pos,1), X(pos,2), 'k+', 'LineWidth', 2, 'MarkerSize', 7);
... |
function [e, s] = testTemplate
%unit testing function
e = 0;
s = 0;
[e, s] = test(val, errormsg, e, s);
|
clc;
clear;
close all;
i=imread('rose.png');
a=imresize(i,[320 256]);
%speration of 3 Primary colors
r=a(:,:,1); %Here colon ':' means taking all row col position matrix values
g=a(:,:,2);
b=a(:,:,3);
%Reading the speration color
R(:,:,1)=r;
R(:,:,2)=0;
R(:,:,3)=0;
%figure to show only red color's image
figure, imshow... |
% algorithm:
% * at 3AM there is somebody => shift accordingly
% * if we find a negative value, then it means that somebody that entered has
% not been detected => increase of +"negative_value" from the last time we saw
% somebody (or, from 9.00AM if there are no '+1' before)
% * from 6PM put the occupancy to 0
%... |
%@(#) crtyp.m 1.3 06/03/21 08:01:41
%
%function t=crtyp(typfil,distfil)
function t=crtyp(typfil,distfil)
[a,b,c,d]=textread(typfil,'%s%s%s%s');
[crid,mminj]=readdist7(distfil,'crid');
for i=1:size(crid,1)
for j=1:size(b,1)
if strcmp(remblank(crid(i,:)),cell2mat(b(j)));
switch cell2mat(d(j))
c... |
function u=osc(n)
%Usage: u=osc(n)
%
%Generates a sequence (length n) of ones with
%changing sign.
% Programmed by Niels K. Poulsen
% Department of Mathematical Modelling,
% Technical University of Denmark
u=ones(n,1);
i=2:2:n;
u(i)=-1;
|
% outputs a matlab variable from the CSV file from ROS
% INPUTS: filename_csv: name of the CSV file
% OUTPUTS: data: matlab variable with the GPS data
filename= 'GPS_message.csv';
data_csv= csvimport(filename);
file_size= size(data_csv);
data= inf*ones(file_size(1)-1,16);
data(:,1)= 2019;
data(:,2)= 8;
data(... |
function [ DGprediction,auxiliary,speedmaxF] = predictor_NewtonIteration_1D(DGpast,auxiliary,data)
speedmaxF = 0;
deltar = -data.r_param:data.r_param;
thetaT = data.thetaT;
Nv1 = data.Nv1;
solverinfo.thetaT = data.thetaT;
solverinfo.cells_per_region = data.cells_per_region;
solverinfo.region_per_dimension = data.reg... |
function s = setupFunctions(system)
%G = removeCells( cartGrid([3,2]), 2);
s = struct();
G = system.G;
rock = system.rock;
W = system.W;
nc = G.cells.num;
nf = G.faces.num;
%---PoreVolume function--
pv_r = poreVolume(G, rock);
s.pv = @(p) pv_r .* exp(rock.cr * (p - rock.pr));
%--half,and full transmissibilities---
... |
% ECE 403 Lab 1: MNIST Handwritten digit classification with PCA
% Training Script
clear all;
close all;
clc;
% load training data
load X1600.mat
q = 29;
classes = 10;
[d,m] = size(X1600);
samples_per_class = m / classes;
%preallocate mean and eigenvector matrices
class_means = zeros(d, classes);
class_components ... |
function output=readContinuousBag(PalpBag)
psm_cur_topic = select(PalpBag,'Topic','/dvrk/PSM2/position_cartesian_current','Time', [PalpBag.StartTime PalpBag.EndTime]);
psm_des_topic = select(PalpBag,'Topic','/dvrk/PSM2/position_cartesian_desired','Time', [PalpBag.StartTime PalpBag.EndTime]);
ft_topic = ... |
[v1,v2,v3]=vehicle; global veh; veh=v2;
x0=[zeros(6,1);3;zeros(5,1)];
u0=[zeros(8,1);416;zeros(17,1)];
[A,B,C,D]=linmod('xtrlmod',x0,u0);
[a,b,c,d]=ssselect(A,B,C,D,1:8,4:6,[4:12]);
Q=diag([20 20 20 ones(1,6)]);
R=eye(size(b,2));
K=lqr(a,b,Q,R);
save abcdk a b c d K |
function [n,m]=makelmidx(lmax)
%% makelmidx: Generate indices for Mie scattering coefficients, (n,m)
n=zeros(lmax^2-1,1);m=zeros(lmax^2-1,1);
for i1=1:lmax
n(i1^2:(i1+1)^2-1)=i1;
m(i1^2:(i1+1)^2-1)=(-i1:1:i1)';
end
end |
function [theta, ll] = EM_tree( theta, w_parent, w_child, level, direction, N, max_itr, noise_dev, conv_thres, conv )
% The EM algorithm for the tree of the GLG model
% Performs one expectation and one maximization step in the EM algorithm
% for a 2D wavelet tree.
%
% Syntax:
% [theta, ll] = EM_tree( theta, w_p, w_c... |
function Answer = isradiationon
%ISRADIATIONON - 1 if a radiation passmethod is found
%
% See also setradiation, getcavity, setcavity
% Written by Greg Portmann
global THERING
Answer = 0;
localindex = findcells(THERING,'PassMethod','StrMPoleSymplectic4RadPass');
if ~isempty(localindex)
Answer = 1;
retur... |
%% Using 8k dataset
DatasetPath = fullfile('/Users/liuyuxuan/Downloads/228dataset/Sound8K/');
wave = imageDatastore(DatasetPath,...
'ReadFcn',@wav2mfcc2,...
'FileExtensions', '.wav',...
'IncludeSubfolders',true, ...
'LabelSource','foldernames');
%% Specify Training and Validation Sets
percentage_sepa... |
%% Comments
%This program need MATLAB 2017b, early versions of MATLAB may run into certain errors due to new functions are used
%This program relay on natsortfiles() function based on natsorfiles.m
%This program may take up to 15 secs,depending on your CPU
%% begins
clear all;
%count elapsed time
tic
%Global variables
... |
function [MIdxs CXs Sims] = FindKepBATgAIF(DataToFit,SAIF,SHConvd,Keps1I)
% BAT Kep Vp Ktrans Calculation
%% Initiate variables
% Number of representing voxels to fit
nToFit=size(DataToFit,1);
% Number of possible keps
nKeps1=size(SHConvd,2);
% Number of possible shift in time (delta T's)
nTDif=size(SAIF,1);
% RMSs... |
function [acapewod] = acapewod(X,alpha)
% ACAPE Canonical Correlation Analysis (CCA) Without Data.
%Computes the interrelationships between two sets of variables made on the same objects.
%The canonical correlation is the maximum correlation between linear functions of the two
%vector variables. Linearity is import... |
function [ band_matrix ] = band_matrix( image_spatial,row,col)
%UNTITLED5 Summary of this function goes here
% Detailed explanation goes here
T = dctmtx(8);
dct = @(block_struct) T * block_struct.data * T';
dct_image = blockproc(image_spatial,[8 8],dct);
%dct_image = bdct2(image_spatial,8);
[len,wid] =... |
%zihang zhou
%861090400
%may 16, 2015
%cs 171
%ps 4
function s = sigma(a)
%sigma of a vector
s = 1 ./ (1 + exp(-1 .* a));
|
function varargout=shpath(MM,ri,ci,rf,cf)
% SHPATH - shortest path with obstacle avoidance
%
% USAGE:
%
% [r,c] = shpath(M,ri,ci,rf,cf)
% [r,c,da] = shpath(M,ri,ci,rf,cf)
%
% VARIABLES:
%
% M = terrain grid matrix of ones and zeros, where ones represent
% grid squares containing obstacles,... |
classdef SPX_Display
methods(Static)
function [ figH ] = display_gram_matrix( Phi )
%DISPLAYGRAMMATRIX Displays the Gram matrix of a given matrix
G = Phi' * Phi;
absG = abs(G);
% Let us set all the diagonal elements to zero
absG(logical(eye(size(... |
clear all;
clc;
% The code is used for 1p-2s design series-series WPT
% Input and power, Output power and load, Quality factor of seconder side
% ( without effect of mutual inductance)
% We keep our modules
%% FILL INFORMATION BELOW
Vin=16; %V (rms) % smaller coefficient
P_o=16; %W
Qs=4; % unitless
f=40... |
function RLEDecompression(h1,h2,h3,h4,h5)
%[fileName,filePath]=uigetfile('.txt');
%dir=[filePath,fileName];
dir='compText.txt';
fileID = fopen(dir,'rt');%Open for read.
sourceData = textscan(fileID,'%s *[^\n]');
str=cell2mat(sourceData{1,1});
set(h5,'String',str);
index=1;
num=0;
output='';
strr='';
while index<length(... |
function imdb = fromPatchesAndLabelsFiles(path, set_partitions)
%FROMPATCHESANDLABELS Read all .mat files in path and convert the contained patches and labels variables returned from
%"CreatePatchesData" into an IMDB struct (i.e. used by MatConvNet)
%
% @Author: Christoph Baur
% Gain access to all methods of t... |
function Population = Create_BM_MS(GenomeLength, FitnessFcn, options)
global s;
rng('shuffle')
Population = zeros(options.PopulationSize,length(s));
for i = 1:options.PopulationSize
Population(i,:) = s(randperm(length(s)))';
end
|
function [T,I,Y]=perfusionResponseP2X4StackDeMix6(y0,ton,toff,Ttot)
ode=modelODEP2X4StackDeMix6(ton,toff);
[T,Y]=ode15s(ode,[0 Ttot],y0,odeset('NonNegative',1:33));
I=getTotalCurrentP2X4StackDeMix6(Y);
end |
function [cuts,fitpar,enq_gs]= fit_Q_cuts(sqw_file,fitpar)
% Load sequence of cuts, corresponding to different Brillouin zones and
% different reciprocal lattice directions and fit these peaks with the
% scattering function defined by the spin-wave Hamiltonian specified.
%
%
data_source = 'd:\Users\abuts\Data\Fe\June20... |
function samples = rand_semialg(h,box,N,x)
%create random numbers in R^n that lie in msspoly semialegraic sets
%input: h n-by-1 msspoly of polynomials defining sets (h{i}(x)>0) or cell
% array of function handles
% box n-by-2 box to generate random numbers in (this should be larger
% than 0 super... |
numberoftask_distance_it15=zeros(length(member_lat),1);
for i=1:length(member_lat)
numberoftask_distance_it15(i)=length(find(lat_long_distance(:,i)<15));
end
|
function [ graded_layers ] = material_interp_T_dep( n, exponent, graded_properties )
%MATERIAL_INTERP creates linear interpolation of layer properties
% Forms N layers that interpolate between material properties given.
% Extract parameters
modulus = graded_properties.modulus;
nu = graded_properties.nu;
strai... |
%% EXAMPLES
%
% Classical optimization problems & values etc.
%
% BIBLIOGRAPHY:
%
% - DEB, Kalyanmoy. "Multi-Objective optimization using evolutionary
% algorithms". John Wiley & Sons, LTD. Kanpur, India. 2004.
%
% - BACK, Thomas. "Evolutionary algorithms in theory and practice". Oxford
% University Press.... |
% this file implements an APL method for solving %
% 1/2 * ||A*x - b||^2
clear;
% load n4000m3000r1
% load n8000m4000r1;
% load n8000m4000gaussian;
% load n4000m3000gaussian;
% % load Bdata2062x2062_1;
% load Bdata2062x4124_3;
% data.A=Bdata.A;
% data.b=Bdata.rhs;
% test_x=Bdata.sol;
data.A =rand... |
function findxmltype(path,outpth,type)
if ~exist(outpth,'dir')
mkdir(outpth);
end
list = dir(fullfile(path,'*.xml'));
for ii = 1: length(list)
fname = fullfile(path,list(ii).name);
% [diag,diag_orig] = musereaddiag(fname);
[diag,~] = musereaddiag(fname);
diag_str = [];
for kk = 1:length(diag)
... |
% =========================================================================
% Simple demo codes for image super-resolution via sparse representation
%
% Reference
% J. Yang et al. Image super-resolution as sparse representation of raw
% image patches. CVPR 2008.
% J. Yang et al. Image super-resolution via sparse ... |
function y = Dicho_MultiVar_Function(x1,x2)
y = (x1+1)^2 + (x2+2)^2;
end |
clear;
%folderpath = '~/Videos/lab4/';
%folderpath = '/Volumes/pi/Videos/lab4/';
%folderpath = '//run/user/1000/gvfs/smb-share:server=10.22.223.81,share=pi/Videos/lab4/';
%[file, path] = uigetfile(join([folderpath,'*.mat']));
[file, path] = uigetfile(join(['*.mat']));
path = join([path,file]);
load(path);
interpRatio =... |
clear;
clc;
close all;
load camden;
x1=camden(6001:6800);
x2=camden(6002:6801);
x3=camden(6003:6802);
x4=camden(6004:6803);
x5=camden(6005:6804);
x6=camden(6006:6805);
x7=camden(6007:6806);
[cor5,lags5]=crosscorr(x1,x6);
cor5=cor5(lags5==0);
[cor4,lags4]=crosscorr(x2,x6);
cor4=cor4(lags4==0);
[cor3,lags3]=crosscorr(x... |
classdef (SharedTestFixtures={matlab.unittest.fixtures.PathFixture(...
fileparts(pwd))}) ...
AirtimeCalculatorTest < matlab.unittest.TestCase
properties
Calculator
Modem
Packet
end
methods(TestMethodSetup)
function initializeSut(testCase)
... |
function [J21a,J21b,J21c,J21d,H21uva,H21uvb] = create_warps(qgth)
er = 1e-5;
t= 1e-3;
nC = 40;
J21a = zeros(size(I2u)); J21b = J21a; J21c=J21a; J21d = J21a;
% calculate Eta_21 derivatives using schwarzian warps
for i = 1:size(I2u,1)
q1 = qgth(1:2,:); q2 = qgth(2*(i-1)+1:2*(i-1)+2,:);
umin = min([q2(1,:),q1(1,... |
function [ y ] = sumOfSquaresDx(X, Y )
% Calcola la derivata della funzione somma dei quadrati sugli input X e Y
y = X-Y;
end
|
function f = Jacobi_expand_nd(x, coef, alpha, beta, norder)
%
% Jacobi_expand_nd.m - Compute all multi-dimensional Jacobi polynomials
% with a given order at given coordinates in arbitrary dimension.
%
% Syntax: f = Jacobi_expand_nd(x, ndim, norder, alpha, beta);
%
% Input : x = (npt,ndim) array containin... |
#include "com_codename1_contacts_Contact.h"
const struct clazz *base_interfaces_for_com_codename1_contacts_Contact[] = {};
struct clazz class__com_codename1_contacts_Contact = {
DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_com_codename1_contacts_Contact ,0 , &__GC_MARK_com_codename1_contact... |
function u_fch = FCT(u)
% x--Fourier y--Chebyshev
%
Nx = size(u,1);
Ny = size(u,2)-1;
u_f = fft(u,[],1)/Nx; % FCT and iFCT use ' /Nx ,*Nx'
u_fch = chyfft(u_f);
end
|
% testy
maxit=200;
e0=1e-3;
par = 0
global a
global zad
global rodz_grad
rodz_grad=1;
zad = 5
a = 10
for i=0:3
x0=[-3;4];
par = i;
granad;
end
%% Funkcja kwadratowa
% Między metodami 1,2,3 nie było różnicy w przebiegu. Wzory wyznaczały
% dokładnie te same kierunki. Jest to zgodne z rozumowaniem przeprowad... |
n = 10000;
dcv = 50;
delta = 0.05;
a = homework_4_generalization_error_ex_2_vc(n, dcv, delta);
b = homework_4_generalization_error_ex_2_rademacher(n, dcv, delta);
c = homework_4_generalization_error_ex_2_parrondo(n, dcv, delta);
d = homework_4_generalization_error_ex_2_devroye(n, dcv, delta);
fprintf('a (N:%i): %f\n'... |
clear params;
params.Gridjob.runLocal = false;
params.Gridjob.jobname = 'layer1CovManySamples2';
params.Gridjob.requiremf = 13000;
params.FeatureCovariance.inActFolder = 'layer1ActRectified';
params.FeatureCovariance.inActFilenames = 'act.*.mat';
params.FeatureCovariance.fileid = [];
params.FeatureCovariance.outCovFold... |
clear all;
a = 0;
b = 1;
fibarr = [a;b];
for i=3:10
c = a + b;
a = b;
b = c;
fibarr = [fibarr ; c];
end
disp(fibarr); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.