text stringlengths 8 6.12M |
|---|
function [cost,grad,features] = sparseAutoencoderLinearCost(theta, visibleSize, hiddenSize, ...
lambda, sparsityParam, beta, data)
% -------------------- YOUR CODE HERE --------------------
% Instructions:
% Copy sparseAutoencoderCost in sparseAutoencoderCos... |
function fout = fMany(~, y, params)
S=y(1);
numStrains=(length(y)-1)/2;
B_TC=y(2:numStrains+1);
B_WT=y(numStrains+2:end);
uStot=0;
dB=zeros(1, numStrains);
%For plasmid-bearing (TC)
for i=1:numStrains
uSi=uS(S, params.Vs(i), params.Ks(i));
uStot=uStot+uSi*B_TC(i); %R... |
% tt = 0:0.01*pi:pi;
% f=inline('-y+sin(t)', 't', 'y')
% % true value
% ye = 1.5 * exp(-tt) + 0.5 * sin(tt) - 0.5*cos(tt);
% a = 0;
% b = 3;
% ya = 1;
% h = 0.25;
% M = (b-a)/h;
% R = c9_rk4(f, a, b, ya, M)
% plot(R(:,1), R(:,2), 'r-o', tt, ye, 'LineWidth', 3, 'markerSize', 12);
tt = 0:0.01:2;
f = @(t, y)t*t-y;
% tru... |
function w = subsasgn(w, S, val)
% Supported calls:
%
% w.field = val (Builtin function)
%
% w{j} = tab where j scans all subbands from fine scale to coarse
% w{j,m} = tab where j scans the scale and m the subbands
% w{j}{m} = tab idem
depth = length(S);
if numel(w) > 1
error('WAVELETClass:subsref... |
function [mean_1D,sd_1D,marg1D,marg2D]=sobol_resampling(models,misfit,ndin,rangein,scales,dx1,dx2,nsobol)
% sobol resampling
sobol=NA_sobol(ndin,nsobol,0);
for i=1:length(misfit)
models_sca(:,i)=transform2sca(models(:,i),ndin,rangein,scales);
end
IDX = knnsearch(models_sca',sobol');
prob = exp(-misfit(IDX));
sobol_mo... |
function [Cn, Nd] = generateCnAndNdList(self, structure)
memberNum = size(structure, 1);
nodes = [structure(:, 1:3); structure(:, 4:6)];
[Nd, ~, map] = unique(nodes, 'rows');
Cn = [map(1:memberNum, 1), map(memberNum+1:end, 1), abs(structure(:, end))];
end
|
function feedback( seconds )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
if nargin < 1 || isempty(seconds)
seconds = 2;
end
masking = audioread('noise.wav');
player = audioplayer(masking, 28000);
play(player);
pause(0.5);
Audapter('deviceName', 'AudioBox');
Audapter(3, 'srate', 1... |
function pathCost_static = calc_cost(grid, path0)
N=length(path0);
for n=1:N-1
n1=path0(n);
n2=path0(n+1);
pathCost_static(n)=grid(n1,n2);
end
end
|
%% test coupling
Config();
format shorte
clear all; close all;% clc
Sys.HBharms = 1:2:3;
Sys.freq = 1;
Mtrl = GetMtrlParamsFFT(Sys);
E = 1e3*ones(Mtrl.nHarms,1);
a = 10;
b = 1;
%%% generic implementation
Mtrl.func = @(x)(a+b*x.^2);
Field.E = 1e3*ones(Mtrl.nHarms,1);
Field.Sin = sin(2*pi*Sys.freq*Sys... |
function howtousenoiseletcode_v1
% uses original Romberg C code
addpath '..\noiselet'
N = 256;
disp(' ');
fprintf(1,'\nrunning C code version of noiselets, N = %d',N);
s = RandStream('mt19937ar','Seed', 1234);
RandStream.setDefaultStream(s);
X = rand (N); % input image
X = X(:);
M = N^2/4; % number ... |
% starts the analysis
%nota bene: does not include artifacts of
%-cell movement
%np = length(int)/npic; % number of pixels of laserized selection per picture
%!!! there is different number of pixels for various time points???!!!
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% exclu... |
aa = [6;7];
qq=find(aa==6)
|
%1. Find the current location of the vehicle in the global coordinate
%system (xvehicle, yvehicle) (lat,long)
clc;
stateX = 0;
stateY =0;
state.x =0;
state.y =0;
state.v =0;
state.yaw = 0;
lfc = 1;
k = 0.1;
kp = 1;
L = 2.9; %d b/w frontaxle and rear axle
dt = 0.1;
target_speed = 10.0 / 3.6;
T = 100;
... |
Omega=linspace(0,pi,10001); %Set up vector of Omega
z=exp(i*Omega); %Define z on unit circle
H=(z.^2)./(z.^2-1.8*z+0.82); %Calculate the values of H on the unit circle
% Create the frequency response plots for linear Omega (discrete-time
% frequency) with the magnitude (unitless) and pha... |
clear;clc
A = [5 nan 3 8 6 2] %nan表沒東東
mean(A) %平均值
nanmean(A) %平均值
sum(A) %總和
nansum(A) %總和
B = [1 3 4;5 2 6;9 7 4]
mean(B)
mean(B(:))
B(:)
B2 = [1 3 4;5 nan 6;9 7 4]
mean(B2)
mean(B2(:))
B2(:)
B3 = [1 3 nan;5 nan 6;9 7 4]
nanmean(B3)
nanmean(B3(:))
B3(:) |
function S = constr_sigma(it0, itf, N)
% Given position values in 3D, we are constructing the matrix Sigma that
% gives the probability of a tracer being at j given that it was previously at i.
% The 3D space is discretized as a cube with sides N, and i and j are the
% indices representing each one of the N³ cells of... |
function plotcelllocations (locs)
figure
pos=getposition (2:63);
plot(pos(:,1),pos(:,2),'k+',locs(:,1),locs(:,2),'o');
num=1:size(locs,1);
for i=1:max(num)
text(locs(i,1)+0.01,locs(i,2),num2str(num(i)+1));
end
%patch ([0 0.9 2.6 3.5 2.6 0.9 0],[1 2 2 1 0 0 1],[0.6 0.8 0.8]);
%line ([1.75 1.75 0.7],[1,1.2 2.25],'Color'... |
%% BME 790.01F13: Engineeering Programming and Signal Processing
%% Homework 1 Kanishk Asthana ka112@duke.edu
%% Problem 1:
clf;
clear;
%Defining time vector:
dt=0.01;
t=-10:dt:10;
%Initializing x(t)
xt=zeros(1,length(t));
%Changing x(t) piecewise:
xt(t>=-1 & t<0)=t(t>=-1 & t<0)-1;
xt(t>=0 & t<1)=t(t>=0 & t<1);
xt(t>... |
function xxxLipidFamilyDraw(~,~,fig,man)
%xxxLipidFamilyDraw - make the plots to show the world
% Get the user data
dpn = guidata(fig.fig);
if isempty(dpn)
return
end
% Check that we have annotations
if ~isfield(dpn.d1,'anno')
return
end
% Determine the lipid family
families = get(man.family,'String');
val =... |
function [pitemp] = STOOPT(Yem,Dt,n,N)
pitemp = (1/gamma)*(((omega^(-1))*delta)*alphatemp - a*((delta'*omega^(-1)*delta)*((N-n)*Dt*alphatemp - 0.25*trace(A*omega)*((N-n)*Dt)^2)));
end |
function DHflecha(titai, di, ai, alfai)
DH(titai, di, ai, alfai);
vectitai = Rot('Z',titai);
vecdi = Tras2('Z',di);
vecai = Tras2('X',ai);
vecalfai = Rot('X',alfai);
result = vectitai * vecdi * vecai * vecalfai;
x = result(1,1:3);
y = result(2,1:3);
z = result(3,1:3... |
function [NO_production] = getNO_Production_v2(t,ii,NO_mult)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
addpath('C:\Users\wdh130\Documents\NO-Modeling-Data\Vasomotion\WGN_NO_production')
time = [0:0.01:20];
NO_production_est = zeros(1,length(time));
NO_production_est... |
% look into all folders and plot the results. designed to plot the sharcnet
% results
clearvars
clc
baseSourceFolder = 'D:\results\IOC\IOC10_modelRL2D_qVB\';
nowStr = datestr(now, 'yyyymmddHHMMSS');
basePath_array = {};
basePathPlot_array = {};
basePathMasterPlot_array = {};
baseP... |
classdef LQR_RollingDirection < handle
%QP_MPC_ROLLINGDIRECTION Summary of this class goes here
% Detailed explanation goes here
properties
targetDestination
horizon
omega
cableLinearVelocity
cableMinLength
cableMaxLength
actuationMode %... |
function [vbl,respMade,rt] = PresentDiscriminationPeriod(text, window, vbl, ifi, Duration1, Duration2, tStart, PreviousRespMade, rt, rectCenter)
%Plays a blank gray screen with text until the target responds. Will generate a vbl if no vbl is given. Has ability to receive user input in form of key press or rt. Works by
... |
function [c, ceq] = constraintFunctionDFD(X, trajParams, windShear)
X = X';
if strcmp(windShear, 'same')
N = (length(X)-1)/3;
VR = trajParams.VR;
else
N = (length(X)-2)/3;
VR = X(3*N+2);
end
T = X(3*N+1);
diffFac = 2*pi/T;
D = trajParams.D; DD = trajParam... |
clear;
inVid = '../../example_video/fil_cat.avi';
imHeight = 128;
imWidth = 96;
nFrames = 150;
in_dat = double(readVideo_rs(inVid, imHeight, imWidth, nFrames));
fps = 10;
noiseTh = 0.009;
decimationFactor = [10 10];
scaleFactor = 5;
picFrame = 40;
opticFlow = opticalFlowLK('NoiseThreshold',noiseTh);
for ii = 1:n... |
function [ out_events ] = aggregateRows( events, names, procid_fields )
% aggregateRows uses the procid_fields as unique identifiers and
% aggregate data base on unique values.
% if procid_fields is specified as '*', then aggregate all the rows
% together.
out_events = events;
if (size(events, 1) == 0... |
% clear; clc; close all;
% gpuDevice(1)
T = 100;
err = zeros(T, 1);
ave = 0;
for t = 1:T
N = 512;
height = 14;
width = 14;
nchannel = 64;
batch_size = 3;
kernel_size =5;
P = height*width*batch_size;
M = kernel_size^2 * nchannel;
lambda = 0.01;
stride = 2;
A = gpuArray((randn(M, N, 'single')));
% A(A<0) = 0;
A = resh... |
function [pl,ql,pr,qr] = pdebc(yl,ul,yr,ur,t)
pl = [ul(1)-13; ul(2)-1];
ql = [0; 0];
pr = [ur(1)-13; ur(2)-1];
qr = [0; 0];
end |
function setAxProp(axs, nm, val)
% Set properties of current axes.
%
% Input
% box - bounding box, d x 2
% parAx - parameter
% set - setting flag, {'y'} | 'n'
% grid - grid on flag, 'y' | {'n'}
% eq - axis equal flag, 'y' | {'n'}
% sq - axis square flag, 'y' | {'n'}
% ... |
function [ssResponses,ssRTs,savedResponsesFile] = runFuncEventRelated(ScanName,params,savedTrialsDir)
% General script to run an event-related fMRI experiment.
% Allows you to adjust the block length and stimulus length by
% adjusting the first few parameters. The stimuli should be saved in a
% separate directory for... |
function [scores, min_fea_rank] = extract_feature_from_PCA(ims, fea_rank, type)
%EXTRACT_FEATURE_FROM_PCA Summary of this function goes here
% Detailed explanation goes here
tic;
[coeff, score, latent, tsquare] = princomp(zscore(ims));
t_PCA = toc;
disp(['PCA took ', num2str(t_PCA), ' seconds']);
... |
% Method III, The FvCB model is used here:
function [f,error]=myfunc(parameter)
R=8.314;
O=21;
T0=273.15
global t % leaf temperature in oC
global pho % Observed photosynthesis rate
global ci %Observed CO2 concentration in the intercellular airspace
T=T0+t; ... |
% NAME: run_spatialPDR.m
%
% AUTHOR: A Cvitanovich (incorporates some code by K Keller, L Whitchurch, K Hartung, and ADS Bala)
%
% CREATED: July 2012
%
% DESCRIPTION: Adapted from run_lizpdr_virt for a spatial adaptation pdr
% project. For presentation of a sequence of test probes with an adapting stimulus.
% Both the ... |
% DEMOFGPLVMSTEP2 Model steps of human using an RBF kernel, dynamics, and
% several sequences.
clear
skel = acclaimReadSkel('07.asf');
[channels_01, skel] = acclaimLoadChannels('07_01.amc', skel);
[channels_04, skel] = acclaimLoadChannels('07_04.amc', skel);
[channels_05, skel] = acclaimLoadChannels('07_05.amc', s... |
function [x] = virtualPlayerOptimalControl(x, x_other, x_ref, n, type)
global vd dt_MPC rp rv x0
global xa xb current_type current_player
current_type = type;
current_player = n;
vd(type) = x_ref;
x0(type, 1) = x(1);
x0(type, 2) = x(2);
rp(type) = x_other(1) +... |
% 1a: x1(n) = 2delta(n+3) -e^0.2n[u(n+2) -u(n)], -20 <= n <= 20
clc;
n1 = [-20:20];
x1 = 2*impseq(-3,-20,20) - exp(0.2*n1).*(stepseq(-2,-20,20) - stepseq(0,-20,20));
Hf_1 = figure; set(Hf_1, 'NumberTitle', 'off', 'name', 'quiz 1a');
Hs = stem(n1, x1, 'filled'); set(Hs, 'makersize', 3);
axis([min(n1) - 1], max(n1) + 1... |
function LocalDataDir = LocalDataDir()
%hardcoded for archived version
disp('Set complete path of parent directory here, then comment out this line')
PATH = '';
%then the root of the data file system is:
LocalDataDir = [PATH,'/data/'];
return
|
function[AL AR] = bestcurv(X,pins,lam,plotflag)
%FIBERAPPROX - approximate a fiber, represented by Xpts, with a series of 3
%nodes, using the interpolation functions in Bathe79.
%
%X = (nx3) matrix of nodal positions
%pins = a set of indices, indicating which X vertices are fixed
%lam = regularization constant
%plotf... |
function [hFigRelayGain, meta] = plotRelayGain( ...
simState, simConfigs, mapType, flagVisible, ...
flagShowFSPL, refFsplVs)
%PLOTCOVERAGERATIOGAIN Plot the coverage ratio gain according to the the
%empirical CDF for the path loss map.
%
% Inputs:
% - simState
% The struct for the simulation results. We n... |
[fName,pName] = uigetfile('*.txt','Choose files to load:','MultiSelect','on');
if pName == 0, return; end
%files_in_this_folder=dir;
nFiles=length(fName);
idx=1;
for idx =1:nFiles
filename=[fName,pName];
if strcmpi(filename(end-4:end),'.txt')
end
end
A=load(fName);
plot(A);
%% ... |
function [queryset1,queryset2,target,j1,j2,x1,x2] = dataset2queriesInvar(dataset1,dataset2,x,nq0,nq1,sd)
%
% Create a set of queries.
% the number of samples given in the datasets must be at least nq0+2*nq1
%
rng(sd); % randomization seed
m=size(dataset1,1);
n=size(dataset1,2);
if (n<(nq0+2*... |
close all;
clc;
load('data_5_1.mat');
%1.) Scatter Plot:
figure;
plot(LOS_train(1,:), LOS_train(2,:), 'r o');
hold on;
plot(NLOS_train(1,:), NLOS_train(2,:), 'b o');
legend('LOS', 'NLOS');
title('Scatter Plot of training data');
xlabel('x1');
ylabel('x2');
%%
% 2.) Max Likelyhood estimation
x1NLOS = NLOS_train(... |
function varargout = zDelay(varargin)
% measures the syncronization of Z pulse
%
% <_o_> = zDelay('zQubit',_c|o_,'xyQubit',_c|o_,'zAmp',[_f_],'zLn',<_i_>,'zDelay',[_i_],...
% 'notes',<_c_>,'gui',<_b_>,'save',<_b_>)
% _f_: float
% _i_: integer
% _c_: char or char string
% _b_: boolean
% _o_: object
% a|b: default... |
classdef COptTriangularElementMaster < OptObjectMaster
properties
facet
yieldConstraints
nullTensorConstraints
sigmaMax
densityVariable
densityCoefficient
isVonMises = true
thickness
end
methods
function obj = COptTriangularElem... |
% Test Cases:
[out1] = garfield(st1);
[out1_soln] = garfield_soln(st1);
% out1 => Structure array should be identical to that produced by solution file
%
[out2] = garfield(st2);
[out2_soln] = garfield_soln(st2);
% out2 => Structure array should be identical to that produced by solution file
%
[out3] = garfield(st... |
function Normalization(Max_range,Min_range,Vector)
% Normalize Vector
nomalized_image = (Vector - min(Vector(:)))*...
(Max_range - Min_range)/(max(Vector(:)) - min(Vector(:))) + Min_range;
end |
function ri = bakupri
ri = [];
|
%% ROI data extraction for sodium leg images
%
% Dependencies:
% SPM12
% gunzip, gzip (via system call)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Info needed from XNAT
% ROI file, which was manually created and is the ROI_IMAGE resource of the
% 1H_FFE_mDixon scan
roi_ful... |
function [allParam, allLlk, allMle]=Exp3_trainFreeFit(allResp,allTarg,center,envrad)
%% Fit free recall trials of experiment 3
% 4.17.2015-Created
%% Files
foldName='E3_freeFits';
fName='Session';
if ~exist(foldName)
mkdir(foldName)
end
%% Run Gibbs sampler
numAnalyze=size(allResp,2);
numBurn=200;
numSamps=1000;
... |
% CSTF for Hyperspectral image and multispectral image fusion, Version 2.0
% Copyright(c) 2018 Renwei Dian
% All Rights Reserved.
%
% ----------------------------------------------------------------------
% Permission to use, copy, or modify this software and its documentation
% for educational and research purposes on... |
function centroids = initCentroids(X, k)
# centroids = initCentroids(X, k) initializes the centroids using the ElAgha algorithm
# for the initialization of the centroids
# The ElAgha algorithm finds the diagonal traversing the volume occupied by the data
# and generates k random points randomly perturbed from k equall... |
sprintf('Test file: Syncing to Github directly using matlab')
sprintf('Test file: Adding another comment to test commit again')
|
function error_euler
yfun = dsolve('Dy = t+y','y(0) = 0', 't');
f = @(t,y)t+y;
t0 = 0;
w0 = 0;
for i = 1:6
a(i) = 0;
w1(i) = 0;
h(i) = 0;
end
for k = 0:5
h(k+1) = h(k+1) + 0.1*2^-k;
t = h(k+1);
a(k+1) = a(k+1) + eval(yfun);
w1(k+1) = w1(k+1) + w0 + h(k+1)*f(t0,w0);
end
loglog(h, abs(a-w1)... |
% check_whisk_resp_baseline
%% File I/O settings
expt_folder = '/Volumes/Akermanlab/Joram/In_vivo_mouse_data/2019_04_02/RBSN_2019-04-02_15-25-26_14';
q_reload = 1; % Set to 0 once the data are loaded to save reloading time
%% Visualisation settings
bin_size = [0.001]; % For PSTH
stim_ty... |
function out = RC4Psudono( k, I )
%generating M*N RC4 pseudo random numbers
s = zeros(1,256);
t = zeros(1,256);
%Encryption
for i=0:255
%initiating s
s(i+1)=i+1;
t(i+1)=k(mod(i,numel(k))+1);
end
j=0;
for i=1:256
%permutation
j=mod((j+s(i)+t(i)),256);
if(j~=0)
[s(i) , s(j)] = swap(s(i), ... |
function m = ift3(data,varargin)
%[ift3] does 3-D IFFT.
%
% USAGE:
% m = ift3(data,varargin)
%
% INPUT:
% data : 3-D k-space data.
% varargin{1} : nROWS for output data
% varargin{2} : nCOLS for output data
% varargin{3} : nPAGES for output data
%
% See also, ift1 ift2
%
% Last modified
% 2012.02.01.
% Gen... |
% Testing of the system bodies model cables
%
% Author : Jonathan EDEN
% Created : 2016
% Description :
classdef SystemModelBodiesTest < matlab.unittest.TestCase
% Create different models for class
properties (ClassSetupParameter)
model_config_type = struct('SCDM', 'test_SCDM... |
clear all
close all
% clc
measurementType = 'fa';
subjectType = 'nc';
pdf = readTbiPdf(measurementType, subjectType);
mu = mean(pdf,2);
zmPdf = pdf - repmat(mu,[1 size(pdf,2)]);
for i=1:size(pdf,1)
[Lilliefors(i,1), Lilliefors(i,2)] = lillietest(pdf(i,:),'Alpha',0.05);
tt(i,1) = ttest(zmPdf(i,:));
end
find... |
function build(Calibration)
% We will notify the user (and write to the log) some information about
% which types of calibration we will be using. To determine which we will
% be using we check to see if each type of fits object is populated (or
% empty).
mtalk('\n\nBEGINNING CALIBRATION BUILD');
mtalk('\n... |
[FileName,PathName,FilterIndex] = uigetfile('*.mat','Select registration file',[results_folder '/reg_results.mat']);
r = load([PathName FileName]);
channel = 1;
r = r.results;
r = r(:,channel);
reg_r = cell2mat(r);
frameMaster.frameMeanMaster = reshape([reg_r.frameMean],size(reg_r(1,1).frameMean,1),size(reg_r(1,1).... |
clear;
close all;
const;
MEM0_w = 0 : 400 : 2000;
for MEM_0 = MEM0_w
sim('model2_2_2c.slx');
CPU_c = ans.CPU;
MEM_c = ans.MEM;
sim('model2_2_2.slx');
CPU_d = ans.CPU;
MEM_d = ans.MEM;
fig = figure;
tiledlayout(2,1);
nexttile;
plot(CPU_c.time, CPU_c.signals.val... |
function [M_s0,f_s0] = autoGen_dynamics_s0(th0,th1,phi0,dth0,dth1,dphi0,u0,u1,uHip,fx,fy,qc0,rc0,ddp0c_x,ddp0c_y,g,l,c,m,I,Ifoot,b)
%AUTOGEN_DYNAMICS_S0
% [M_S0,F_S0] = AUTOGEN_DYNAMICS_S0(TH0,TH1,PHI0,DTH0,DTH1,DPHI0,U0,U1,UHIP,FX,FY,QC0,RC0,DDP0C_X,DDP0C_Y,G,L,C,M,I,IFOOT,B)
% This function was generated by th... |
% XXXXXXXXXXXXXXXXXXXXXXXXXXX sus_move XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
%
% Author : Susanti
% Date : Aug 1 2014
% Function : Compute the points based on move_ratio
% Syntax : sus_move(fuzzy_number, move_ratio)
%
% fuzzy_number - It has 3 points
%
% XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX... |
function [ADC_Data, ADC_Info, ADC_desc] = compute_ADC_map(DWI_filepath, ROIs_by_slice)
%
DWI_Struct = load(DWI_filepath, 'Data', 'Info');
DWI_Info = DWI_Struct.Info;
num_b_values = length(DWI_Info);
MR_volume_size = size(DWI_Struct.Data{1});
num_slices = size(DWI_Struct.Data{1},3);
%
if isempty(ROIs_by_slice)
f... |
function update(self, newWeights, newBias)
% update updates the weights and biases with the changes calculated during
% backpropagation
for i = 1:length(self.weights)
self.weights{i} = newWeights{i};
self.bias(i) = newBias(i);
end
end
|
classdef MixtureModel < LatentVarModel
properties
fitEng;
mixtureComps;
mixingDist;
dof;
ndimensions;
ndimsLatent;
end
methods
function model = MixtureModel(varargin)
if nargin == 0; return; end
args = {'-nmixtures',2,'-template',[]... |
function [cell_k_patches] = mqSplitImg2PatchesV2(k_images, patch_size, overlap)
global VISUALS;
%% loop images
for k = 1 : size(k_images)
im = k_images{k};
num_patches = size(im, 1) * size(im, 2);
patches = cell(num_patches, 1);
patches_counter = 1;
... |
function [EqualityConstraintOperators] = getEqualityConstraintOperators()
EqualityConstraintOperators.Cval=@(u,z) Cval(u,z);
EqualityConstraintOperators.C_u=@(u,z,du) C_u(u,z,du);
EqualityConstraintOperators.C_z=@(u,z,dz) C_z(u,z,dz);
EqualityConstraintOperators.adjC_u=@(u,z,lambda) adjC_u(u,z,lambda);
EqualityConstrai... |
% stretch test
Display = DisplaySettings(1);
% ScaledWidth = Display.Rect(3)*(Display.ScreenDimensions(1)/Display.Dimensions(1));
% DestRect = CenterRect([0 0 ScaledWidth Display.Rect(4)],Display.Rect);
Display.Rect = Screen('Rect',Display.ScreenID);
Display.Background = 125;
[Display.win, Display.Rect] = Screen('O... |
function hexa_plot(X1,X2,K)
% hexa_plot(X,K)
% plot matrix K on nodes X
% in
% X1 size (3,m), node coordinates
% X2 size (3,n), node coordinates
% K size (m,n), matrix
h = ishold;
[~,m]=size(X1);
[~,n]=size(X2);
if any([m,n]~=size(K))
error('wrong sizes')
end
ml=8;
tol=1e-6;
symm = false;
if m==n,
symm... |
function error_value = compute_PK_params_and_T10_error_func(params_vec, enhancement_vec, time_vec, flip_angle, TR, TE, Gd_dose, PK_Params_Prior, T10_Prior, Noise_Prior)
error_value = [];
PK_Params.probs = 1;
PK_Params.x = [params_vec(1:2)];
PK_Params.PK_parameterisation = PK_Params_Prior.PK_parameterisation;
T10.... |
classdef quantity < double
properties (SetAccess = immutable)
average % first moment = trap(x,y)/trap(x)
variance % second moment = trap(x,y^2 - average^2)/trap(x)
stdev % standard deviation = sqrt(variance)
relative % relative standard deviation = standard deviation / average
... |
function centroid= compute_distance_centroid(data,C)
nof_centroid = size(C,1);
x = zeros(nof_centroid,1);
for c=1:nof_centroid
x(c,:) = sum(abs(data-C(c,:)));
end
[~,centroid] = min(x);
end
|
%Open excel file
fn='Times New Roman';fs=10; fontsize = 10;
[d,s,r] = xlsread('1235rpm_3brb');
freq=xlsread('1235rpm_hlthy',2);
%%Import Data
Time = d(:,1);
Vph = d(:,2);
Iph = d(:,3);
%%define Fourier transform discrete points
N=size(d,1);
%%Sample period and Frequency
Ts = mean(diff(Time));
Fs... |
data = importdata('cube_data.dat',' ');
N = size(data,2);
Nt = size(data,1)/N^2/5;
u_all = zeros(N,N,N,Nt*5);
j = 0;
for t = 1:5*Nt
for k = 1:N
for i = 1:N
j = j+1;
u_all(i,:,k,t) = data(j,:);
end
end
end |
%In this script an elman network is trained and tested in order to
%model a so called hammerstein model. The system is described like this:
% x(t+1) = 0.6x(t-1) + sin(u(t))
% y(t) = x(t);
% Elman network should be able to understand the relation between output
% y(t) and input u(t). x(t) is a latent variable represen... |
function [quan]= quantize(im,QP)
%Q matrix
Q=[16 11 10 16 24 40 51 61;
12 12 14 19 26 58 60 55;
14 13 16 24 40 57 69 56;
14 17 22 29 51 87 80 62;
18 22 37 56 68 109 103 77;
24 35 55 64 81 104 113 92;
49 64 78 87 103 121 120 101;
72 92 95 98 112 100 103 99;];
%Decide S value according to Q... |
function [ u ] = LineGS_Div( u, r, N, L, D, iter )
% using iter-step symmetric line gauss-seidel iterative method
% as the smoother of v-cycle precoditioner solving "Au=r",
% where
% | D L 0 0 0 |
% | L D L 0 0 |
% A=| 0 L D L 0 |
% | 0 0 L D L |
% | 0 0 0 L D |
% and D, ... |
% test normalized hrtfs (to determine largest possible rms value)
clear all
cd /Users/cvitanovich/Documents/MATLAB/tak-lab/HRTFs/Matlab_V6
fnames={'924AD_eq_ABLequal_normed.mat','925AD_eq_ABLequal_normed.mat', ...
'1073AC_eq_ABLequal_normed.mat'};
mx=[]; R=[]; t=[];
nLocs=613;
nStates=16; tot=nStates*length(fnames)... |
clear all;
close all;
fs=1000;
f=200;
mida=0.01;
n=0:fs*mida;
y=sin(2*pi*n*f/fs);
stem(n,y);
xlabel('n'); ylabel('yd'); grid; |
%% Sparse deconvolution
%load signal
load('all_traces_padded.mat');
data=data_pad';
%load the template
load('EPSC_templates.mat');
model_T=fast_EPSC';
% smooth signal
s_data=smooth(data-mean(data));
% main function for deconvolving
[deconv_s,cost]=sparse_deconv(data,kernel,lam,nit);
%Plot results
figure;
plot(deconv_s)... |
function v = lineimage(x0, y0, angle, s)
% generate a line in the image of size s
% create a line y = k*x + (y0-k*x0)
% v - Return a vector of line coordinates in the image (coordinates are
% linearized)
if (abs(tan(angle)) > 1e015) % vertical line
a(1,:) = repmat(x0,s(1),1)';
a(2,:) = [1:s(1)];
els... |
g=981;
SR = 43;
SS = 30/sqrt(2*g*9.84);
xbar=9.84;
ubar=30;
vbar=0;
A = -g*SS/(SR*sqrt(2*g*xbar));
Bu = 1/SR;
Bv = -sqrt(2*g*xbar)/SR;
C = 1;
D = [0,0];
syms s
myG = eval(C*(s-A)^-1*Bu)
SYS = ss(A,[Bu,Bv],C,D);
[numG,denG] = ss2tf(A,[Bu,Bv],C,D,1)
[numH,denH] = ss2tf(A,[Bu,Bv],C,D,2)
SYSG = tf(numG, denG)
SYSH = ... |
%% Gyroid_Mesh_Script
a = 1; % Periodicity
gyroid_dimensions = [3 3 3];
too_long = a/4; % Maximum mesh edge length
res = 0.05;
% X,Y,Z centred at origin
X = -gyroid_dimensions(1)/2:res:gyroid_dimensions(1)/2;
Y = -gyroid_dimensions(2)/2:res:gyroid_dimensions(2)/2;
Z = -gyroid_dimensions(3)/2:res:gyroid_dimensions(... |
close all
clear all
clc
path_full = pwd;
pathBEL = extractBefore(path_full,'\Others');
addpath([pathBEL '\GlobalFunctions']);
rng(0);
%% Producing the data :
l_true = 3;
h_true = 7.5;
M_true = 40;
time = (10:1:120)';
Y_true = ForwardPendulum(time,[l_true h_true M_true]);
% Adding noise to the data:
Y_true = Y_tru... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% reference paper: [kong14lr] Lattice reduction aided transceiver design for MU MIMO downlink transmissions
% precoding using Block diagonalization (BD) with joint transceiver design. See details in paper [kong14lr]
%
% Written by: Yiming Kong
% Date: 3/10/2014
%%%%%%%... |
%% BJ model
% For a system represented by:
% y(t)=[ B(q)/F(q) ]* u(t-nk)+[ C(z)/D(z) ]e(t)
% where y(t) is the output, u(t) is the input and e(t) is the error.
run('identification_init');
%% OPTIMAL VAL VALUE
nb=17;
nf=15;
nc=13;
nd=9;
show_plot=true;
[model, order, fit, aic_value, mag,wout ] = fun_BJ_model(nb,nf,nc,n... |
list = [...
110824 4;
110908 7;
110908 10;
120619 4;
120620 12;
120624 4;
120625 3;
120707 11;
120709 5;
120729 3;
120808 3];
for num = [1:length(list)]
fileName = ['C:\Users\aman\Dropbox\Work\Data\E-I-LFP-fromBH\Anesth_Cclamp_Vm\' 'M' num2str(list(num,1)) '_' num2s... |
%子函数:对测试数据分类,测试数据是硬标签
%输入:TestData-某一个测试数据,1*(P+1)行向量,P-属性数目
% Classifier_rules--分类器中的规则,行数是规则数目,列数是P+3
% Classifier_default--默认类(数),表示类别集中的哪一个类
% Class_set--1*M胞元,每个胞元存储的一个可能的类
% K--1*P行向量,每个属性下的模糊划分点的数目,不包括两侧的边界点;
% PointSets--cell(1,P),每个胞元是一个行向量,存储在每个属性下的划分点,维数与K(i)大小相同
% Num_cl... |
function ps = tasapainoPsw(T)
%Veden h�yrynpaine Pascalin kaavasta
ps = exp(77.34491296 - 7235.424651 ./ T - 8.2*log(T) + 0.0057113*T);
end |
% ************************************ %
% ***** User Changable Variables ***** %
pop = 40; % population size
gen = 200; % number of generations
pcntsel = .5; % fraction of candidates selected for next generation
breed_method = 'uniform'; ... |
load ResultFile;
load ChanList;
NumChans=length(Result);
NumTrials=length(Result(2).WarpedSpikeTimes);
gaussFilter = gausswin(12)
gaussFilter = gaussFilter / sum(gaussFilter);
writerObj = VideoWriter('ChanbyChanCorrMovie.avi')
open(writerObj);
for k = 2:sum(ChanList(:,2))+1; %Ch. 8 in my tests;
for i=1:NumT... |
clc
clear all
verbose = 0;
cds = [1 3];
link_mesh = [3 4];
switch_nodes = [3];
capacity = 1;
replicability = 1;
p_b_multi_replicability_percent = zeros(length(p_b_th),1);
tic
for i = 1:length(p_b_th)
for j = 1:1
seed = RandStream.create('mcg16807','Seed',100*sum(clock));
RandStream.setDef... |
function [V,c,s] = imgdwt(n,img)
%% IMGDWT
% Calcula la DWT de una imagen.
w='haar';
[c,s] = wavedec2(img,n,w);
V=[];
for i=n:-1:1;
LL = appcoef2(c,s,w,i);
[HL,LH,HH] = detcoef2('all',c,s,i);
if i==n
V=[LL,HL;LH,HH];
end
if i~=n
V=cat(1,cat(2,V,HL),cat(2,LH,HH));
end
end
end
|
function [] = fUpdate(obj,k,ksub,gp,i_best)
evalstr = tree2evalstr(obj.pareto_fstr{i_best},gp); % get decoded function string
obj.ypred_train(:,k,ksub) = obj.predictDataTM(evalstr,gp.userdata.xtrain);
obj.ypred_test(:,k,ksub) = obj.predictDataTM(evalstr,gp.userdata.xtest);
obj.ypred_val(:,k,ksub) = obj.predictData... |
%Ejercicio 3 - test
tipo = 0;
xval = [-20:0.1:20];
matriz_conjuntos = [-20 -20 -10 -5; -10 -5 -5 -2; -5 -2 -2 0; -2 0 0 2; 0 2 2 5; 2 5 5 10; 5 10 20 20];
%matriz_conjuntos = [-7 -5 -5 -3 ; -5 -3 -3 -1;-3 -1 -1 0; -1 0 0 1;0 1 1 3; 1 3 3 5; 3 5 5 7];
%matriz_conjuntos = [-20 8; -10 5; -4 5; 0 3; 4 5; 10 5; 20 8]; tip... |
[y,f] = teltone_NA(12345);
fs = 5000;
ttotal = length(y)/fs;
t = 1/fs:1/fs:ttotal;
x = y ~= 0;
sw = 0;
cont = 1;
for i=1:length(y)-25
if (x(i:i+25) == 0)
if (sw == 1)
termino(cont) = i;
sinal{cont} = y(inicio(cont):termino(cont));
sigfft{cont} = fft(si... |
% - Is proportional control stable?
% - Can you, given the matrix of a system or its computed eigen values and
% eigen vectors, perturb the values of the system to try and find the
% nearest small change that makes the system stable?
% - Can you quantify how stable? By my checks below, the system is as stable
% as its ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.