text stringlengths 8 6.12M |
|---|
% Figure 10.04 Feedback Control of Dynamic Systems, 5e
% Franklin, Powell, Emami
%
% fig10_04.m is a script to generate Fig. 10.4
% the frequency responses of the open-loop
% satellite position control, non-colocated case
clf;
% satellite system matrices
f =[0 1.0000 ... |
% calc_echo_spacing_philips_mod.m
%
% Formula from http://www.spinozacentre.nl/wiki/index.php/NeuroWiki:Current_developments#B0_correction
% modified after suggestions from Pieter Buur and Nikolaus Weiskopf; also thanks to Lawrie MacKay.
% Please check results carefully, if possible with physicist of the Philips scan... |
function varargout = specplot_motor_gui(varargin)
% SPECPLOT_MOTOR_GUI M-file for specplot_motor_gui.fig
% SPECPLOT_MOTOR_GUI, by itself, creates a new SPECPLOT_MOTOR_GUI or raises the existing
% singleton*.
%
% H = SPECPLOT_MOTOR_GUI returns the handle to a new SPECPLOT_MOTOR_GUI or the handle to
... |
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Relevant Vector Regression 1D Example %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 1) Load 1D Regression Datasets %%
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function y=zuisuxiajiang()
clc;
clear;
syms x_1 x_2 x_3 x_4;
fun=(x_1-1)^2+(x_3-1)^2+100*(x_2-x_1^2)^2+100*(x_4-x_3^2)^2;
x=[-1.2;1;-1.2;1];
epsilon=0.001;
count=0;
g=gra(fun,x(1),x(2),x(3),x(4));
flag=norm(g);
while (flag>=epsilon)
Mini=lamb(fun,x(1),x(2),x(3),x(4));
a=x-Mini*g;
f2=subs(fun,[x_1,x_2,x_3,x_... |
function varargout = index_interp1d(varargin)
%INDEX_INTERP1D
%
% double = INDEX_INTERP1D([double] x, double xq, bool equidistant)
%
%
[varargout{1:nargout}] = casadiMEX(264, varargin{:});
end
|
close all
clear
%%
m_ini=60; %num of initial address
m_tol=600; %num of total target address
nxt_avil_addr = m_ini+1;
n=10; %num of identity
%%
average_input = 2;
average_output = 1;
shadow_probablity = 0.99;
pub_to_group_ratio = 1000;
auto_getnewaddress_p = 0.3;
do_nothing_p = 0.3;
%%
address=1:m_tol;
identities=1:... |
function [centroids]=getSeedPoints(differenceMatrix,PreprocessedImage,gtr,row,col)
sumall=sum(differenceMatrix,"all");
N = nnz(differenceMatrix);
threshold=sumall/N;
invNoiseless=255-PreprocessedImage;
invNoiseless=adapthisteq(invNoiseless);
subplot(2,5,6);imshow(invNoiseless)
binar=invNoiseless<threshold;
subp... |
function SF_current_loop
% This function maintains the current output of the SF supply (since the control hardware is bypassed)
% June 9, 2010 C.Steier and T.Scarvie
% scale = -1/3.8/10; %-3.8 is the slope of the voltage-to-current vectors below; 10 basically sets the speed of the loop response
scale = -1/3.8/10*10/... |
function [path,cluster] = extend_set(path,cluster,batchsize)
% extend the set for exactly divisible by batchsize
num = length(path);
extra_num = batchsize - mod(num,batchsize);
for k = 1:extra_num
extra_path{k} = path{num};
extra_cluster(k) = cluster(num);
end
path = [path,extra... |
function report_mosek_error(r,res)
% REPORT_MOSEK_ERROR issue warning or error on return values from running
% mosekopt
%
% [r,res] = report_mosek_error(r,res)
%
% Example:
% [r,res]=mosekopt('minimize echo(0)',prob,param);
% [r,res] = report_mosek_error(r,res)
%
% check for mosek error
if(r ... |
function [ getgoal ] = Getgoal( Pos_A,Goal_A )
GOALX=Goal_A(1)- Pos_A(1);
GOALY=Goal_A(2)- Pos_A(2);
distance= sqrt(GOALX^2+GOALY^2);
if (distance >= 0) && (distance < 3)
getgoal = 1;
else
getgoal = 0;
end
end
|
%% Symbol Generator
% This code creates a symbol table, analyzes it,
% and write it to the screen.
%
% To execute, run the script
% run_symbol_table
%
% The default configuration creates a 256x3 symbol table and prints it to
% the screen. It then calculates the peak side lobe level to see if it is a
% reasonable set ... |
w=pi;
t = 0:.0001:pi;
i = [1,2,3,5,25];
wn = (sqrt(20));
figure(1)
for n = 1:length(i)
z = i(n);
f = 0;
while z > 0;
f = (0.06/(pi*(z)))*sin((z)*w*t)+f;
z = z-1;
end
hold on
plot(t,f)
hold off
end
xlabel('Time (s)')
ylabel('Amplitude (m)')
title... |
function [vertices, faces] = removeInvalidBorderFaces(varargin)
%REMOVEINVALIDBORDERFACES Remove faces whose edges are connected to 3, 3, and 1 faces.
%
% [V2, F2] = removeInvalidBorderFaces(V, F)
%
% Example
% removeInvalidBorderFaces
%
% See also
% isManifoldMesh, collapseEdgesWithManyFaces
% ------
% A... |
function [CDspkisi, spkisivec, spkbinned, spkisihista, spkisihistb] = findspkisi(spkvec,tvec,thresh,plotyn)
% This function creates a spike density using a Gaussian kernel density
% estimator.
%
% [CDspkisi spkieivec spkbinned spkisihista spkisihistb] = findspkisi(spkvec,tvec,thresh,plotyn)
%
% CDspkisi = coefficient o... |
function res = precoder_linear_ofdm_sim(varargin)
% =========================================================================
% Simulator for "Linear precoding with low-resolution DACs for massive
% MU-MIMO-OFDM downlink"
% -------------------------------------------------------------------------
% Revision history:
%... |
clear
close all
clc
addpath(genpath('Z:\TKM\'));
%% Mortar layers Matlab
maindir = 'C:\Users\bmfortman\Documents\Data\';
dir1 = 'C:\Users\bmfortman\Documents\Data\Layers\Anchoring\3';
dir2 = 'C:\Users\bmfortman\Documents\Data\Layers\QuickSet\1';
cd(maindir)
%% loading data
cd(dir1)
aData = load('Anchor... |
N=10;sigma=0.1;
x = 2*rand(1,N)-1;
wTrue=[4 0 -2 0]; % set true parameter vector
v = zeros(1,N); % set noise
for i=1:N
v(i) = normrnd(0,sigma);
end
input = zeros(4,N); % set input of polynomial function
for i=1:N
input(:,i)=[x(:,i)^3,x(:,i)^2,x(:,i),1];
end
y=wTrue*input+v;
index=0;
steps=(-... |
% Updated: 8/25/2014
% For data that contains force sensor but not Bayesian filtered EMG
clear; clc; close all
% Load file with force and emg data
[file, pathname, filterindex] = uigetfile('*.dat', ...
'Select emg file with force data');
data = importdata(strcat(pathname, filesep, file));
nameParts = regexp(file... |
function T = ZXZ(phi, theta, chi)
phi = deg2rad(phi);
theta = deg2rad(theta);
chi = deg2rad(chi);
Rx = [1 0 0; 0 cos(theta) -sin(theta); 0 sin(theta) cos(theta)];
Rz1 = [cos(phi) sin(phi) 0;-sin(phi) cos(phi) 0; 0 0 1];
Rz2 = [cos(chi) sin(chi) 0;-sin(chi) cos(chi) 0; 0 0 1];
T = R... |
function [CAp,CAo] = UpdateCA(CAp,CAo,Newp,Newo,MaxSize)
% Update CA
%--------------------------------------------------------------------------
% The copyright of the PlatEMO belongs to the BIMK Group. You are free to
% use the PlatEMO for research purposes. All publications which use this
% platform or any code in t... |
function [ out ] = EjercicioI( )
%f = @(x) x^3+4*x^2-10+x;
%f = @(x) (4*x^2 - 10)/ (x*x);
f = @(x) sqrt(10-x^3)/4;
%f = @(x) (10-x^3)/4*x;
out = ripf(f, (-1.3), 1e-5,1000);
end
|
function Out=ExtendStruct(Src, Full)
% function Out=ExtendStruct(Src, Full)
F=fieldnames(Src);
ToAdd=union(setdiff(fieldnames(Full)',fieldnames(Src)'),F(gIsEmpty(struct2cell(Src))));
ToAdd=ToAdd(:)';
Out=Src;
for i=ToAdd
Out.(i{1})=Full.(i{1});
end |
function [nowTimeUTC,nowTimeOffset] = getTime
%GETTIME Summary of this function goes here
% Detailed explanation goes here
nowTimeUTC = java.lang.System.currentTimeMillis/1000;
javaTimeZoneObj = java.util.TimeZone.getDefault;
javaTimeZoneStr = matlab.unittest.diagnostics.ConstraintDiagnostic.getDisplayableString(ja... |
function [] = display_energies(history, mode)
switch mode
case 'fitting'
names = {'1', '2', '3', '4', '5', '6', '7'};
case 'tracking'
names = {'data-model', 'ARAP', 'collisions', 'joint-limits', 'silhouette', 'shape-existence'};
case 'IK'
names = {'data-model', 'joint-limits'};
end
... |
function [AREA] = InitConds(APC,IDEPTH,SBVARS)
%INITIAL CONDITIONS; Initializes domain for the SoB model
% This function initializes the domain for the SoB model
%
%
%The MIT License (MIT)
%Copyright (c) 2016 Evan B. Goldstein
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
XMAX=SBVARS.XMAX;... |
function [D]=dtube(n,m)
%DTUBE - Calculate tube diameter for given chirality in nanometers
a=.144*sqrt(3);
D=a*sqrt(m^2+m*n+n^2)/pi; |
function [ds,pv,itr_flag,rab,pvrab,itr_flagrab,consout]=validate_trans(data_type,D,V,coln,td1,td2,rnd,rnde,thrvp,ctrig,rab2,abst)
% General process to extract the conditions (data matrices) where the cluster(s) are
% present and to compute their corresponding significance (by computing a
% p-value)
% Input (Mandatory)
... |
StartDate = 'Jan-1-2016';
EndDate = 'jan-1-2018';
Basis = 1;
Compounding = -1;
Rates = 0.00001;
RateSpec = intenvset('ValuationDate',StartDate,'StartDate',StartDate,'EndDate',EndDate, ...
'Rates',Rates,'Basis',Basis,'Compounding',Compounding);
AssetPrice = 125;
Volatility = 0.14;
StockSpec = stockspec(Volatility,As... |
function [ordering, distances]=sortDataByDistance(DataPoints,Archetypes)
% 1. Data points is the values of different traits (e.g. expression
% level of genes) - each sample is a row, each trait (gene) is a column
% 2. Archetypes is a matrix with different archetypes in rows
%initializing
distances = zeros(size... |
function [maskarea,fmask]=distforfrachan(file_in_tree,file_in_grass)
%Function to calculate a mask for forested area based on FPC in a LPJ-GUESS
%simulation and a minimum coverage of 25% forest cover based on Hansen et al. (2013) (with 50%
%canopy coverage in 1km gridcell being the basis for assessing forest coverage).... |
% File: Example2_20.m for Example 2-20
clear;
% Using the DFT, calculate the spectrum for a rectangular pulse.
% Let tend be the end of the step.
M = 7;
N = 2^M;
n = 0:1:N-1;
tend = 1;
T = 10;
dt = T/N;
t = n*dt;
% Creating time waveform
w = zeros(length(t),1);
for (i = 1:1:length(w))
if (t(i) <= tend)
w(i... |
T = 20;
T1_ex2_p1_Rotaru_Adrian(0:0.002:T,1) % 2ms = 0.002s
T1_ex2_p1_Rotaru_Adrian(0:0.02:T,2) % 20ms = 0.02s
T1_ex2_p1_Rotaru_Adrian(0:0.2:T,3) % 200ms = 0.2s |
function [dx,dy,A]=findmacro(ti,tj,oi,oj,k,ftwo,fone)
sizeone=size(fone);
sizetwo=size(ftwo);
sizeoi=size(oi);
sizeoj=size(oj);
sizeti=size(ti);
macros=sizeti(2);
minimum=256*macros*macros;
count=0;
for i=1:sizeoi(2)-macros-1
for j=1:sizeoj(2)-macros-1
count=count+1;
if((sum(sum(ftwo(ti,tj)-fone(oi... |
clc
clear all
close all
k = 1/2;
N = [3, 5, 7, 9, 11, 13];
max_max_delta = [];
for j = 1:length(N)
% delta_additional = readData(k , N(j));
% span = 11;
% max_delta = max(abs(delta_additional(1:span)));
% for i=1:2*N-1
% max_delta = [max_delta, max(abs(delta_additional((i*span):(i+1)*span)))... |
% Demos the use of project_depth_map.m
% The location of the RAW dataset.
CLIPS_DIR = '[]';
% The path to the labeled dataset.
LABELED_DATASET_PATH = '[]';
load(LABELED_DATASET_PATH, 'rawDepthFilenames', 'rawRgbFilenames');
%% Load a pair of frames and align them.
imgRgb = imread(sprintf('%s/%s', CLIPS_DIR, rawRgbF... |
function [TC_leftM,TC_rightM] = GetMatchedFields(cfg_in,TC_left,TC_right)
% function [TC_leftM,TC_rightM] = GetMatchedFields(cfg_in,TC_left,TC_right)
%
% returns pair of tuning curve sets (left, right) with same number of cells
%
% algorithm: each cell in smallest set gets greedily matched to the cell in
% the largest ... |
% Copyright 2017 ETH Zurich and University of Bologna.
% Copyright and related rights are licensed under the Solderpad Hardware
% License, Version 0.51 (the “License”); you may not use this file except in
% compliance with the License. You may obtain a copy of the License at
% http://solderpad.org/licenses/SHL-0.51. U... |
clear;
clc;
disp('Question i');
disp(' ');
q = [3,0,0]'; s = [0,0,1]; h = 2;
disp('The screw axis corresponding to q, s, h is')
disp(ScrewToAxis(q,s,h));
disp('Question ii');
disp(' ');
S =[0, 1/sqrt(2), 1/sqrt(2), 1,2,3]'*1;
disp('The T matrix corresponding to the screw axis S and theta = 1 is');
disp(MatrixExp6(S)... |
%% Simulation Study: HATS VS SCM
% 1. Set parameters to simulate the data, simulation and optimization settings
% 2. Plot true covariance, model function and example of realizations from this parametric setting
% 3. Inference: For different number of realizations (num_real_vec),
% repeat num_sim simulations where ... |
% MFLMCLRC.M
% Script to clear menu figure
% Reset menu offset incr
mmgmincr = mmgmincr - 1 ;
% Get rid of local variables
clear mflang ...
mfluipsc mflangl mfluirsc ...
mflb mfluisb mflbnam mfluiuintp ...
mfldtmu mfluiunofi m... |
%%Processamento de imagens
%%Ismael Ramos de Oliveira - 1512130077
%%Nathalia Felix da Rocha – 1512130116
function [imagem_quantizada] = quantizar(imagem, niveis)
A = imagem; %%Atribui à variável A a imagem passada pelo usuário
N = niveis; %%Atribui à variável N o nível para quantizar, passado pelo usuário
I = r... |
%Inputs
x0 = 18;
x1 = 9;
x2 = -8
%weights
wxh = -0.1;
whh = 0.5;
why = .25;
%biases
hbias = 0.4;
ybias = 0.0;
%targets at t-timestep
t0 = 0.1;
t1 = -0.1;
t2 = -0.2;
%computations
z0 = wxh*x0 + hbias;
%hidden unit value at t0
h0 = 1 / (1+exp(-z0));
%output unit value at t0
y0 = why*h0 + ybias;
%error at t0
e0 = .5*... |
function [featureMatrix] = getFeatures(x, blockSize, hopSize, fs, numberOfPartials)
%% get feature matrix give audio file
% featureMatrix: (numberOfPartials+2) * 8
% block audio
[xb, ~] = myBlockAudio(x,blockSize,hopSize,fs);
f0 = myPitchTrackMod2(xb, fs);
% Apply window functions
[~, numBlocks] = size(xb);
window = ... |
% FINAL PROJECT
% load MSCI indices returns from excel file
filename = 'C:\Users\likeb\Documents\Columbia Documents\Spring 2020\Multi-asset Portfolio Management\Final Project\Final_Project.xlsx';
[data,txt] = xlsread(filename, 'MARKOV_REGIME_SWITCHING_MODEL', 'M2:W498');
returns.header = txt(1,2:end);
returns.da... |
function g = sinc(r)
%SINC Sinc kernel.
% G(R) = SIN(R)/R.
%r = x-y;
g = sin(r)./r;
g(abs(r) <= eps) = 1;
|
function x0 = m_x0_from_dump( str_main , str_name , str_name_out )
% x0 = m_x0_from_dump( str_main , str_name )
%write an x0 file in lammps input format
%--------------------------------------------------------------------------
if exist( strcat(str_main,str_name_out) , 'file' )
str_cmd = ['rm ' str_main str_name_out... |
function [prototypes] = batchNG(Data, n, epochs, xdim, ydim)
% Batch Neural Gas
% Data contains data,
Data = load ('data/checkerboard.mat');
%portotypes = load ('clusterCentroids.mat')
% n is the number of clusters,
% epoch the number of iterations,
% xdim and ydim are the dimensions to be plotted, default xdi... |
classdef (Enumeration, Sealed) CoarseningState < int8
%COARSENINGTYPE Coarsening strategy type.
% This is an enumeration of MULTILEVELSETUP coarsening states used
% during the setup phase.
%
% See also: COARSENINGSTRATEGY, MULTILEVELSETUP.
%======================== CONSTANTS =========... |
addpath('../general_functions')
addpath('../../generally_applicable_code')
T_iter=linspace(0.01,40,200);
w_range=linspace(0,200,10^5);
d_iter=2:5;
lam=0.9;
[alpha, A] = hyperexponential_init_alphaA( 1, 9, 1/2 );
Gbar = 1-hyperexponential_cdf( alpha, A, w_range );
g=hyperexponential_pdf(alpha, A, w_range);
A=-1;
tol1=1... |
%script used to determine density fluctuations in Fig. 4.6 (collective behavior of twitching rods)
close all
clear all
P = {'0.1', '0.3', '0.6', '1'}
Trev = {'1000'};
cov = {'0.05', '0.1', '0.15', '0.2', '0.25', '0.3'};
intervals = {'50000'}%,'20000','30000','40000','50000'};
thresholds = {'24'} ;
listindex = 0;
s... |
function dz = dz_dw(w,p,z,param)
%LINKDIST.DZ_DW Derivative of weighted input with respect to weight
% Copyright 2012-2015 The MathWorks, Inc.
[R,Q] = size(p);
dz = zeros(R,Q,'like',w);
end
|
function eql_plot_res_ex2(varargin)
%% *SET-UP*
inp = varargin{1};
out = varargin{2};
set(0,'defaultaxescolororder',[1 0 0;0 0 1]);
%
xlm.thv = [0,50];
[xtk.thv,~] = get_axis_tick(xlm.thv,xlm.thv,5,1);
ylm.thv = [-0.060;0.060];
ytk.thv = -0.060:0.03:0.060;
%
xlm.fsv = [1e-1;2... |
function output = func(i,j,h)
if ((i >= -h && i <= h) && (j >= -h && j <= h))
output = 1;
else
output = 0;
end |
function cmap = myredblue_sharpcenter()
cyan = [0 1 1];
blue = [0 0 1];
red = [1 0 0];
darkblue = [0 0 0.5];
darkred = [0.5 0 0];
lightblue = [0.6 0.6 1];
lightred = [1 0.6 0.6];
white = [1 1 1];
coral = [1 0.488 0.3137];
gold = [1.0000 0.8431 0];
tomato = [1 0.3882 0.2784];
green = [0 1 0];
black = [0.2 0... |
function [rmse_smos,rmse_smap,rmse_argo,std_smap_argo]=...
basic_triple_point_collocation(start_date,months)
% Triple Point Collocation Analysis for satellite (SMAP,SMOS) Level 3 and
% gridded Argo data
% 1. SMOS data is from CATDS CEC-Locean L3 Debiased V4, temporal sampling
% is 4 days, spatial resolution of 25... |
%% 读取FS和C组成的output file中的注量率分布图
% 读取完成后可使用plotfluxmap形成图片
close all;clear;
%% 手动输入参数
outputFileName = '1';
param.TIMEAXIS = [1]; % 单位:s total列填任意数字即可
param.withTotalCol = 0; % 有没有total列
% param.HRZAXIS = 0:10:100;
% param.VERAXIS = -130:10:100;
param.HRZAXIS = 0:15;
param.VERAXIS = -19:8;
%% 生成参数
fileName... |
function [FP_out] = ErreurFp( t_des , x_des , y_des , ynonlineaire , tsim)
% Calculation of the Performance factor
% param: t_des - desired input time
% param: x_des - desired input x
% param: y_des - desired input y
% param: ynonlineaire - output of the simulation
% param: ... |
BasePSub='\\fmri-t9\users\Moran\DCE\DataBase\SmVl_20120930\';
BasePFull='\\fmri-t9\users\Moran\DCE\DataBase\GB-HTR\SMOLIAR_VLADIMIR\SmVl_20120930\';
FA=loadniidata([BasePFull 'AutoArtBAT\F1v0.nii']);
FB=loadniidata([BasePSub 'AutoArtBAT\F1v0.nii']);
RMS=loadniidata([BasePFull 'AutoArtBAT\RSS0.nii']);
FThresh=0.990;
FMs... |
function freq_item_set_table = generate_freq_item(cur_freq_item_set_table, Table, cur_attributes, thres)
%support = find_support(Table,attributes);
%freq_item = cur_freq_item_set;
freq_item_set_table = cur_freq_item_set_table;
num_att = size(Table,2);
if size(cur_attributes,2) == 0
min_att_... |
function fcnMLPlot(in)
% input: structure to be ploted with members: X,Y,Z as cells
% in.Xcell - X vector for each pair
% in.Ycell - Y vector for each pair
% in.Zcell - z matrix for each pair
% in.CplotRangeCell - sensitivity calculation grid resolution
% in.XlabelCell
% in.YlabelCell
% in.MaxSubPlot
%... |
%This script implements the sequential forward feature selection
% n is the nth feature under consideration
% m variable controls the depth of the sequential forward selection tree
% structure. Maximum of m is 10 in our case.
% f is a combination of n features.
% q is the most accurate feature combination for n - 1t... |
function p = run(p)
%run run a new experiment for a previuously created pldaps class
% p = run(p)
% PLDAPS (Plexon Datapixx PsychToolbox) version 4.2
% run is a wrapper for calling PLDAPS package files
% It opens the PsychImaging pipeline and initializes datapixx for
% dual color lookup tab... |
%% Intervalo onde o sinal está definido
m_max =1;
m_min =-1;
%% frequência de amostragem
fs = 10e3;
%% tempo de amostragem ts
ts = 1/fs;
%% tempo de simulação 1 s
tsim = 1;
%% instantes de amostragem
t = [0:ts:tsim];
%% Cálculo do sinal de entrada
x_in = (3*cos(40*pi*t) + 2*sin(240*pi*t))*(1/4.902);
%% Nº de bits... |
clear all;
close all;
clc;
%% 载入数据
rawdata = load('example_distances.dat');
% rawdata = load('matdata\Aggregation0.8.txt.mat');
label=length(rawdata)
if label~=1
data=rawdata;
else
data=rawdata.data;
end
%采样数据
% total_n=length(data);
% sample=rand(total_n,1);
% ratio=0.90;
% tidx=find(sample<ra... |
clear;clc
data = xlsread('D:\干活\20180807.csv');
[row,col] = size(data);
date = datetime('2018-08-07');
% 获取时刻变量
time = data(:,1);
time = days(time);
time.Format = 'hh:mm:ss';
% 获取各通道的值
channel2_412 = data(:,3);
channel3_500 = data(:,4);
channel5_675 = data(:,6);
channel6_862 = data(:,7);
channel8_1024 = da... |
function [Y] = processImage(X)
Y = X;
[n, d] = size(X);
w = 28;
for i = 1:n
A = reshape(X(i, :), w, w);
A = imgaussfilt(A);
Y(i, :) = reshape(A, 1, w*w);
end
end |
clear all;
close all;
cd('/Users/Nandana/Dropbox/Place_Pulse_Opt_Code')
% safety votes data
load('Cold.mat')
ids = readtable('image_id_by_city.csv');
nyc = table2array(ids((1:height(ids)), 1));
bos = table2array(ids((1: 1237), 2));
linz = table2array(ids((1: 650), 3));
salz = table2array(ids((1:544), 4));
Cn... |
clc, clear all;
m= 1.177;
M= 0.192;
l= 0.05;
I= 0.0029;
g= 9.81;
r= 0.04;
%%
A1= (M+m)*m*g*l/((M+m)*I+M*m*l^2);
B1= m*l/((M+m)*I+M*m*l^2);
A2= m^2*l^2*g/((M+m)*I+M*m*l^2);
B2= (I+ m*l^2)/ ((M+m)*I+M*m*l^2);
A= [0 1 0 0; A1 0 0 0; 0 0 0 1; -A2 0 0 0];
B= [0 -B1 0 B2]';
C= [1 0 0 0; 0 0 1 0];
%% Commande LQR
Q= [200 ... |
% Minimum variance dipole fitting
%
function [dipoles, L, moments, rv, state] = dipole_fit(data,K,vertices,state)
nDipoles = 1;
% check inputs
nChan = size(data,1);
nTimes = size(data,2);
if ~any(size(vertices)==3)
error('Vertices must be a 3 x nVert matrix')
elseif size(vertices,2)==3
vertices = vertices';
e... |
function varargout = REST(varargin)
% REST MATLAB code for REST.fig
%
% REST(opts) starts the Real-time EEG Source-mapping Toolbox.
% - OPTS is a structure with 2 possible fields:
% - chanlocs (possibly required): EEGALAB channel locations
% structure. This information could also be pre... |
%--------------------------------------------------------------------------
% VARIABLE/MATRIX INITIALIZATION
%--------------------------------------------------------------------------
numberOfSongs = 150;
numberOfSongsInFolder = 25;
numberOfGenres = 6;
%IMPORTANT: Matlab must be operating in ... |
function [MIOut, CIEOut] = MIarray_kyu(MatrixIn, class)
% by Karl Kuschner, College of William and Mary, Dept. of Physics, 2009.
% edited by Sangkyu Lee 2015
%
% MIarray finds MI of each column of a data set with a separate vector
%
% Sangkyu's edit includes:
% 1) handling of extreme class imbalance (one example in one... |
function pw = plane_wave_parameters(frequency, relative_permittivity, relative_permeability, conductivity)
%% Calculate the parameters from Table 2.2.
% :param frequency: The operating frequency (Hz).
% :param relative_permittivity: The relative permittivity.
% :param relative_permeability: The relative permeability.
%... |
function crankfinal
xO=0;
xL=2;
yO=0;
yL=1;
n=11; %n - mesh for x (in matrices for column,j)
m=5; %m - mesh for y (in matrices for row,i )
dx=(xL-xO)/(n+1);
dy=(yL-yO)/(m+1);
%%
%Matrix A
for i=1:n*m
A(i,i)=-2*(1/dx^2+1/dy^2);
end
for i=1:n
end
for i=1:n-1
%to construct lower an... |
clear;
fid=fopen('probe.txt','wt');
img_dir='/home/scw4750/github/IJCB2017/liangjie/zip/multipie_augment_90_pose/baseline_multipie/probe';
img_struct=dir(img_dir);
img_struct=img_struct(3:end);
for i=1:length(img_struct)
class=str2num(img_struct(i).name);
sub_img_struct=dir([img_dir filesep img_struct(i).name ... |
% Parzen window
% According to the datasets, P(w1) = P(w2) = P(w3)
clc,clear;
load ch4.mat;
testd = [0.5 1.0 0.0; 0.31 1.51 -0.5; -0.3 0.44 -0.1];
% h = 1
c1 = which(testd(1, :), w1, w2, w3, 1);
c2 = which(testd(2, :), w1, w2, w3, 1);
c3 = which(testd(3, :), w1, w2, w3, 1);
% h = 0.1
cc1 = which(testd(1, :), w1, w2... |
function unity(n)
% Creates a unity elementary signal.
%
% Parameters:
% n - The number which will be used for
% the range of the signal.
% A sequence with numbers from -n to n will
% have 2 * n + 1 number of elements.
signal = zeros(1, 2 * n + 1);
% To make all positive numbers 1, the numbers... |
function nArmedBanditTestbed
epsilon=[0,0.01,0.1];
numberOfEpsilons=length(epsilon);
n=10; % no. of possible actions/arms of the bandit
nSteps=1000; %no. of steps in one play
nRuns=2000;
for optimistIndex=0:0
for epsilonIndex=1:numberOfEpsilons
QStar=zeros(n,1); %actual value of each action
Q=z... |
% EnergyMAX.m
% Stand-alone program template for taking data with Coherent EnergyMAX meters
% Tom Galvin - University of Illinois at Urbana-Champaign - 2016
% v1.0
%% Meter and Scan Parameters
% If you wanted to turn this into a function, make these the inputs
METERS.address = {'ASRL24::INSTR','ASRL23::INSTR'... |
function [ts_step, data_step]=find_steps(ts, data)
ts_step=ts;
data_step=data; |
function se = RPMobj_ll(betagamma, breaking, P, X)
m = size(breaking, 1);
beta = betagamma(1:size(betagamma,2)-1);
gamma = betagamma(end);
se = 0;
E = (reweight(P,gamma)*X);
number_of_questions = size(E,2)/size(beta,2);
new_beta = zeros(1,number_of_questions*size(beta,2));
for i = 1:number_of_questions
n... |
classdef GridWorld < rl.env.AbstractMDP
%GridWorld Creates a grid world
% env = rl.env.GridWorld(m,n)
%
% Copyright 2018-2019 The MathWorks, Inc.
properties (SetAccess = immutable)
% GridSize
% [m,n] vector where m and n are the number of rows and columns of
... |
clear;clc
img_dir = 'D:\Datasets\SVHN\all\images\train';
im_ext = 'png';
img_list = get_image_list(img_dir, im_ext); |
% MLESIM - simulate Morris-Lecar equations
% Needs a column vector pml of params:
% pml=[gca, gk, gl, vca, vk, vl, phi, v1, v2, v3, v4, v5, v6, C, vic, wic]'
% For meaning of parameters, see Rinzel and Ermentrout.
% and a column vector iext describing the external current
% iext = [iampl, tstart, tstop]'
% which are... |
function circles2d(varargin)
%CIRCLES2D Description of functions operating on circles.
%
% Circles are represented by their center and their radius:
% C = [xc yc r];
% One sometimes considers orientation of circle, by adding an extra
% boolean value in 4-th position, with value TRUE for direct (i.e.
% ... |
%------------------------------------------------------------------
%--------- Bayes Classifier with Gaussian pdf---------------------
%------------------------------------------------------------------
function [AverCorr, ConfMat, lowCL, upCL]=BayesClassMVGaussPDFs(...
Patterns, Targets, PercTest, ErrorEstMetho... |
function sim3()
%% Goal
% Make histogram animation for the enclave size of human survivers
close all
fromFile = true;
file = 'data/enclavesScan2Power2Edges.mat';
nAlphaValues = 30 + 1;
alphaValues = linspace(0, 0.54, nAlphaValues);
edges = [0 2.^(0:8)];
if fromFile
inp = load(file);
enclaves = inp.enclaves;... |
function [F] = TriScatteredInterpVector(V,D)
% TRISCATTEREDINTERPVECTOR simple extension of TriScatteredInterp to handle
% vector values at each data point
%
% [F] = TriScatteredInterpVector(V,D)
%
% Inputs:
% V #V by 2 list of data positions
% D #V by m list of data vectors
% Outputs:
% A ... |
% SpinDemo -- Show Cycle Spin Figs with Point & Click Interface
% To run, just type SpinDemo.
header = 'Cycle Spin Figures';
labels = ['Change Settings' ; 'Run All Scripts' ; ...
'Run One Script ' ; 'Clean Up '];
callbacks = ['CSFig(89)'; 'CSFig(90)'; ...
'CSFig(91)'; 'CSCleanup'];
global... |
function z = euclidean_classifier(m , X) % m is the mean vector
[l,c] = size(m); % dimnesionality
[l, N] = size(X); % number of data vectors
for i=1:N
for j=1:c
t(j) = sqrt((X(:,i) - m(:,j))'*(X(:,i) - m(:,j)));
end
[num, z(i)] = min(t);
end
end |
function varargout = FUN_PLOTTER(varargin)
% FUN_PLOTTER MATLAB code for FUN_PLOTTER.fig
% FUN_PLOTTER, by itself, creates a new FUN_PLOTTER or raises the existing
% singleton*.
%
% H = FUN_PLOTTER returns the handle to a new FUN_PLOTTER or the handle to
% the existing singleton*.
%
% FUN_PLOTT... |
clear all
lata=[1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014];
powiat=[26970 28578 29007 30847 32300 35902 38945 43007 45095 52320 55182 58923 64103 67469 72590 77818];
miasto=[175980 187909 208970 220600 229987 239870 267990 277020 280456 292030 303761 314061 331292 341172 352848 ... |
% Serie de Fourier usando
% f(t) = sum cn*exp(j*2*pi*n/T*t) (desde -Inf hasta +Inf)
%
% Ejemplo para un tren de impulsos periodo DT
%
% Comparar con implementacion en EjemploSerieFourier.m
%
% D.Mery, PUC-DCC, Oct. 2011
%
close all
K = 20;
N = 8;
t = 0:0.05:K;
DT = 2;
j = sqrt(-1);
% para n = 0;
f = DT*ones(size(t)... |
function proj_visuals
%Task 1
data = load('task1/results_gobackn_twomc');
data(:, 1) = log2(data(:, 1));
generate_single_plot(data, 'Transfer Time (sec) vs Window Size (log scale) (Go Back N)',...
'Window Size (log scale)', 'Transfer Time (sec)',...
{'Time... |
function c = cllr(tar_llrs, nontar_llrs, prior);
lp = logit(prior);
% target trials
c1 = mean(neglogsigmoid(tar_llrs+lp))/log(2);
% non_target trials
c2 = mean(neglogsigmoid(-nontar_llrs-lp))/log(2);
% Cllr
c = prior*c1+(1-prior)*c2;
|
function plot__banded_power_across_outcomes(power_struct)
means = power_struct.means;
errors = power_struct.errors;
bands = power_struct.bands;
if ( ~any(strcmp( fieldnames(power_struct), 'subfolder' )) )
subfolder = 'test';
else subfolder = power_struct.subfolder;
end
epoch = char( unique( means('epochs') ) );
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 [X,Y,S,T,R,P,bpmerrors]=GetExistingErrors(THERING,varargin)
% this function retrives 6 vectors, for x, y,s misalignments,
% Tilts (rot about s), Roll (rot about x) and Pinch (rot about y)
%
% the vectors are length of THERING or of the optional second input
%
% in future also bpm errors and girder errors will ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.