text stringlengths 8 6.12M |
|---|
function convergenceDriver()
d = dir('/home/thomas/Work/Projects/rSN/code/out/save_2d_lowrank_vs_fullrank_CB/run2/20*');
chooseall = true;
close all
rhosCB = {};
if not(chooseall)
% choose the last simulation
folder = d(end-1).name
prefix = strcat('../out/', folder);
rhosCB{end+1} = visualizeOneFolder(... |
orbit = get_constellation_orbit(800,'SSO','AM','SSO',1,1);
mission_set{1} = create_test_mission('test',{'CERES','CERES-B'},params.startdate,params.lifetime,orbit);
orbit = get_constellation_orbit(800,'SSO','AM','SSO',1,1);
mission_set{2} = create_test_mission('test',{'CERES-C','MODIS'},params.startdate,params.lifetime,... |
function homework3()
% Sean Burke
% Econometrics 2
% Homework 3
% Clear variables and terminal
clc;
clear
% Format output to avoid scientific notation
format shortG;
% Full sample procedures
% Input and find log returns
tempAdjClose = xlsread('spdaily.xlsx'... |
function obj = removeHolonomicConstraint(obj, name)
% Remove holonomic constraints defined for the system
%
% Parameters:
% name: the name of the constraint @type cellstr
assert(ischar(name) || iscellstr(name), ...
'The name must be a character vector or cellstr.');
if ischar(name),... |
function output = nb_spectrum(filename, preemph_flag)
% Load data
[data, samp_freq] = audioread(filename);
%Pre emphasis filter
if preemph_flag == 1
alpha = 0.95;
data_filtered = data - alpha*[0; data(1:(end-1))];
else
data_filtered = data;
end
%Choosing values from approx middle
dur = 30e-3;... |
function [b,sb,a,sa]=slope(x,y)
i_fin=find(isfinite(y));
x=x(i_fin);
y=y(i_fin);
%n=length(x);
%b=(n*sum(x.*y)-sum(x)*sum(y)) ./ (n*sum(x.^2)-sum(x)^2);
whichstats={'beta','covb'};
stats=regstats(y,x,'linear',whichstats);
b0=stats.beta;
covb=stats.covb;
... |
function [ initVecT ] = cInitVecT( Nx, Ny )
%CINITT Create vector with inithial condidions
initVecT = ones(Nx*Ny, 1);
end
|
function [ Bout ] = Rectangular_B_field( x,y,z,x0,y0,z0,n0,I,W,L,T )
% Calculates the magnetic field due to a rectangular pair of coils
% XYZ - point of calculation
% x0y0z0 - coil pair center
% n0 - pair orientation
% I - current
% WL - width and length
% T - thickness
Itot=I*T/3.6; %Current mult... |
% Stochastic PTM version of the model. Produces the figures for the PTM
% violin plots in Figure 3.
%
%
% Corresponding ODE model:
% da/dt = (Et*(k1*k2*r2*a.^2 + k1*r1*tau2*a + r0*tau1*tau2))./(k1*k2*a.^2 + k1*tau2*a + tau1*tau2) +loopRate;
% Model Parameters
k1 = .003; % Rate of conversion from state 0 to state 1.... |
function [J_val,grad] = RGCFnonR(theta,x,y)
%RGCFNONR Summary of this function goes here
% Detailed explanation goes here
m = length(y);
hx = Sigmoid(x * theta);
J_val = -(y' * log(hx) + (1 - y)' * log(1-hx)) / m;
grad = (hx-y)'*x ./ m;
end
|
function R = rand_rot_mtx(max_angle)
%first part gets a random val from -1 to 1, second
degs = max_angle;
v1 = 2*(rand-0.5) * degs * (pi/180);
v2 = 2*(rand-0.5) * degs * (pi/180);
v3 = 2*(rand-0.5) * degs * (pi/180);
R = [cos(v1) sin(v1) 0; -sin(v1) cos(v1) 0; 0 0 1];
R = R * [cos(v2) 0 sin(v2);0 1 0;-sin(v2) 0 cos(v... |
function out = load_images(fpaths)
%LOAD_IMAGES Loads images into an matrix
%Inputs:
% fpaths (cell ?x1): cell array containing image paths
%Outputs:
% out: array containing images with 3rd dimension indexing color channels
% and 4th dimension indexing images
wb = waitbar(0,'Please wait...');
n = length(fpaths); ... |
%% Using the datafeed toolbnox
% Can use: Yahoo, Factset, Bloomberg, (all I know so far).
% The above will create objects that can be used as handles within
% functions such as 'fetch(s,t)' which contains source, ticker.
fetch(yahoo, 'AAPL')
% This will return an object containing information on Apple from yahoo.
|
% PI_V_PARAM
%
% Sluzi na vypocet parametrov PI regulatora pomocou vybranej analytickej
% metody
% Copyright is with the following author(s):
%
% (c) 2012 Juraj Oravec, Slovak University of Technology in Bratislava,
% juraj.oravec@stuba.sk
% (c) 2012 Monika Bakosova, Slovak University of Technology in Bratislava,
... |
%Written by Patrick Strassmann
function [corrXvaluesForPETH, smoothedPETH] = makeSmoothedPETH(eventMatrixStack, slidingWindowSize, alpha, forAlignedYesNo,tossUnengagedTrials,doubleSmooth, doubleSmoothWindow,trimStackYN)
if nargin<8
trimStackYN = 1;
end
if nargin<7
doubleSmoothWindow = 299;
end
if ... |
data.trial = data.xsims_gl;
close all
X = [data.trial{:}];
shift = std(X(:))*6;
for i =1:size(data.labels,2)
plot(data.time,data.trial{1}(i,:) - ((i-1).*shift))
hold on
end
legend(data.labels) |
% Global Global simulation object.
%
% Backend IRIS class.
% No help provided.
% -IRIS Macroeconomic Modeling Toolbox.
% -Copyright (c) 2007-2017 IRIS Solutions Team.
classdef Global < handle
properties
Quantity
Equation
Pairing
X % Data matrix including parameters.
... |
% function [stateSeq INDS Nr] = sample_r(data_struct,dist_struct,theta,stateSeq,INDS)
% Sample the sequence of measurement noise mixture component assignments
% given the observation sequence (y_t - C*x_t) and the dynamic parameters.
function [stateSeq INDS Nr] = sample_r(data_struct,dist_struct,theta,stateSeq,INDS)
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Implemetation of the tracker described in paper
% "MEEM: Robust Tracking via Multiple Experts using Entropy Minimization",
% Jianming Zhang, Shugao Ma, Stan Sclaroff, ECCV, 2014
%
% Copyright (C) 2014 Jianming Zhang
%
% This program is f... |
function [ trial_data, trial_time ] = run_trial_wind_jump_TO( trial_idx, task, run_obj, scanimage_client, trial_core_name )
%%% for testing wind jump in EB
%%% Tatsuo Okubo
%%% 2018/01/19
global s
disp(['About to start trial task: ' task]);
% Setup data structures for read / write on the daq board
s = daq.createSess... |
function I_rec = baseline1(I, mask)
% Baseline 1: Perform linear inpainting of the image
% INPUT
% I: (n x n) masked image
% mask: (n x n) the mask hidding image information
%
% OUTPUT
% I_rec = Reconstructed image
global U;
% Parameters
rc_min = 0.01; % rc_min: minimal residual correlation before sto... |
function [xz,y,z] = Ionosphere(arg1,arg2)
if nargin == 0
dx = 1/8;
[x,y] = meshgrid(0:dx:10);
elseif nargin == 1
if length(arg1) == 1
[x,y] = meshgrid(linspace(0,10,arg1));
else
[x,y] = meshgrid(arg1,arg1);
end
else
x = arg1; y = ... |
%{
Copyright (c) 2017 Raghvendra V. Cowlagi. All rights reserved.
Copyright notice:
=================
No part of this work may be reproduced without the written permission of
the copyright holder, except for non-profit and educational purposes under
the provisions of Title 17, USC Section 107 of the United States Cop... |
function kdata = sim_signal( loc , k , object, fov)
% function kdata = sim_signal( xyz_locations , k-trajectory , object_density, fov)
%
% (integrate the signals from all the voxels)
% xyx_locations - Nx3 matrix
% k-trajectory - Mx3 matrix
% object - 3D matrix with densities matching the locations
% fov ... |
% Task 4 Exercise 11
% the following function has two minima and two maxima in the range
% [ 0 5]
% find them using the function handles
% f(x) = exp(-sqrt(x)) + 0.1*sin(3x)
function y = f1(x)
y = exp(-sqrt(x)) + 0.1 * sin(3*x);
end
% .. fplot(@f1,[0 5 ] )
% x1 = fminsearch (@f1,1 )
% x1 =
... |
clear all;
clc;
%task 1
disp('Taks 1');
x1 = vm([0 0 1 0 1 0 0 1]);
x2 = vm([0 0 0 0 0 1 0 0]);
x3 = vm([0 1 1 0 0 1 0 1]);
n = length(x1);
x = [x1;x2;x3];
w = x' * x;
%update
x1 = sgn(x * w);
disp('update_x - x :');
x1-x
%task 2
disp('Taks 2');
xd1 = vm([1 0 1 0 1 0 0 1]);
xd2 = vm([1 1 0 0 0 1 0 0]);
xd3 = vm([1 1... |
% PTG_STRING_0
%
% ptv_str=ptg_string_0(ptv_str_cat,ptv_str_num)
%
% ptv_str = output string
% ptv_str_cat = input category of string
% ptv_str_num = input number of string
%
% GUI function PTG_STRING_0 is called from PTF_STRING
% PTG_STRING_0 returns required string for GUI figures and uicontrol
% object... |
function [con_data, sim_data]=Con_CueMatchImVsOtherRoomsPredictabilityRSA_AcrossSubCorrel(ResultsCueImSimOnlyNum,ResultsBetaSerConnectivityOnlyNum,reg_con,reg_sim,acc,closePrev,onlyConContrasts)
%to select voxels for the similarity analysis:
%currently reported in the appeal:
%load('/Volumes/data/Bein/TickyReanalysis/... |
%test_dir='/home/ben/Dropbox/projects/IS2_ATBD/Combined_corr_test_data_Jul_25_2017/';
test_dir='/home/ben/Dropbox/projects/IS2_ATBD/Combined_corr_test_data/Nov_6_2017_all_SNR/';
[~,files]=unix(sprintf('ls %s/D3/Rough*07.h5', test_dir));
files=strsplit(deblank(files));
clear D
for k=1:length(files);
temp=regexp(fi... |
function visualize_errorcurves_combined(error_fro_rel,alg_name,varargin)
if nargin == 3
problem = 'RobustPCA';
nr_outliers = varargin{1};
elseif nargin > 3
problem = [];
titlestring = varargin{2};
else
problem = [];
titlestring = 'Relative error vs. iteration count';
end
warning('off','MATLAB:Handle... |
% Add the user's current working directory and all subfolders to the path
addpath(pwd)
allfiles = dir
folders = allfiles([allfiles.isdir])
for i = 1:size(folders,1)
f = folders(i)
fname = f.name
if fname(1) ~= '.'
fpath = [pwd filesep fname]
addpath(fpath)
end
end |
function [ p, weights ] = interfere( p, weights )
%interfere simulates intereference during delay cycles
%%
% flag for calc_act_fast to indicate that we're using the learning rate for
% interference cycles
interefere = 1;
%%
for layer = 1:max(p.numLayers)
for grid = 1:p.nGrids(layer),
w = squeez... |
% MTC_surfASE.m
%
% OBSOLETE
%
% Generates a 2D surface of ASE datasets along 2 chosen variables, based on
% MTC_qASE.m, requires qASE_model.m and updateParams.m
%
%
% Copyright (C) University of Oxford, 2016-2018
%
%
% Created by MT Cherukara, 2016
%
% CHANGELOG:
%
% 2018-12-05 (MTC). Superceded by xSimulateGr... |
function Kprime = K_Policy(K,alpha,beta,delta)
%This function computes the capital policy rule.
%% Initialization
eps = 1e-6;
del = 1e-4;
max_it = 1e6;
ini_Jac = eye(length(K));
ini_val = K;
func = @(Kprime)((beta*(1+alpha*Kprime.^(alpha-1)-delta)).^(1/alpha).*K-Kprime);
stop_crit ... |
function [Der, DerC] = CDerivative(type, X, Y)
% Derivatives of Complex-valued activation functions.
% Der = w.r.t variable x, and DerC = w.r.t. conjugate of x
% Refer to the paper for notations and explantions.
switch type
case 'splitTanh'
DR = 1 - real(Y).^2;
DI = 1 - imag(Y... |
function cellsort = sbxPullSignalsCoreCheckNeuropilCorrelation(cellsort)
% if the neuropil signal and the raw signal are highly correlated then instead of subtracting
% the neuropil and getting no signal - just use the raw
threshold = 0.99;
ROI_use_raw = [];
for i = 1:length(cellsort)
correlation = ... |
function var = press_deriv(fieldin,psfc,press)
% compute the pressure derivative of fieldin
%
% fieldin variable which will be differentiated
% psfc surface pressure at a single point
% press vertical array of pressure
%
% levi silvers april 2019
%
%---------------------------------------------
va... |
eval('Model');
functions = Functions;
data=functions.pipeline_import('BAG2',2.2180);
beta0 = [0 0 0 0 0 0 0];
% betaA = [0.1818 0.2009 0.1682 -2.6178 3.2854 1.0292 -0.1589];
% beta0 = [0.1648 0.0188 0.1036 -2.1840 3.6191 1.1319]; % Trans then Rot
% beta1 = [0.0736 0.3127 0.2715 -2.... |
function [Result,OnLine,OffLine,MinMaxMeanAdapt,BestofStep]=LocalPsoProcessByCircle(SwarmSize,ParticleSize,ParticleScope,InitFunc,StepFindFunc,AdaptFunc,IsStep,IsDraw,LoopCount,IsPlot)
% 功能描述:一个循环n次的局部PSO算法完整过程,返回这次运行的最小与最大的平均适应度,以及在线性能与离线性能
%[Result,OnLine,OffLine,MinMaxMeanAdapt]=PsoProcess(SwarmSize,ParticleSize... |
function [a,index,aeq] = Amat2acoef(A,dt,Ai)
%AMAT2ACOEF Convert from matrix to vector form for optimizer
%
% a = kal.Amat2acoef(A,dt,Ai);
% [a,index,aeq] = kal.Amat2acoef(A,dt,Ai);
%
% Inputs
% A - Matrix form of prediction matrix for channel rates
% dt - Timestep term
% Ai - Indexing matrix that specifies order... |
function ret = get_db_pack(varargin)
persistent db_pack
if(isempty(db_pack))
if(nargin==0)
db_pack = java.util.HashMap;
else
load(varargin{1});
end
end
ret = db_pack;
end
|
function DDP(A,B, AB)
A = sort(A);
B = sort(B);
A = cumsum(A);
B = cumsum(B);
C = [A B];
C = sort(unique(C));
sort_C = C;
C = diff(C);
diff_C = C;
C = sort(C);
disp(['Mapa pozic A: ' num2str([0 A])])
disp(['Mapa pozic B: ' num2str([0 B])])
disp(['Intervalová pozice: ' num2str([0 sort_C])])
disp(['... |
%%%%%%% this is a test code is for the real surface trap %%%%%%%%%%%%%%%%
clc,clear
%%%%%%%%%%%%%%%%%%% add all of the funciton in this folder include sub-folders %%%%%%%%%%%%%%%%%%%%%%%%%%
root_folder='E:\zhaowending\BEM-zhao\trap_design_tiqc\BEM\';
addpath(genpath(root_folder));% addpath(genpath('c:/matlab/myfil... |
% ciclos o anillos
for x=1:0.5:5; %x varia de 1 a 5 en pasos de 1
y=sin(x);
disp([x,y]) % despliega valores de X y Y
end
pause(10)
disp('*******************************************') % renglon vacio
x=0;
while x<5
x=x+1;
y=sin(x);
disp([x,y])
end |
%%
function w = opt_CholeraDual( varargin )
opts = optimset ('DerivativeCheck','off','Display','off','TolX',1e-3, ...
'TolFun',1e-6,'Diagnostics','off','MaxIter',200,'LargeScale','on');
% option settings for optimization algorithm
tStart = tic;
lb_w = [0.0110
0.0077
0.6600
0.6600
0.6600
0.6600... |
%% Clean-up Workspace
clc;
clear all;
%% Load Model Parameter
% 1 - ETHZ
% 2 - Twente
% 3 - Group
Parameter_flag = 1;
syms phi_z phi_z_dot phi_x phi_x_dot phi_y phi_y_dot theta_z theta_z_dot theta_x theta_x_dot theta_y theta_y_dot T_x T_y T_z T_f
if Parameter_flag == 1
Parameters_ETHZ
elseif Parameter_flag == ... |
% Parameter t: a syms variable used in the symbolic math (Matlab doesn't
% allow symbolic variables to be defined inside a function with a nested
% function).
function CrossBridgeOfDeath(t)
% Parameters
d = 10.025*.0254; % wheel base (meters)
lastEncoderVal = [0,0];
lastSampleTime = 0;
vl_real = 0;
... |
function [c,ceq,gradc,gradceq] = five_link_nonlcon(x,p)
% x = gpuArray(x);
[c1,gradc1]=yposCon(x);
[c2,gradc2]=headPosCon(x,p);
c = [c1;c2];
gradc=[gradc1,gradc2];
[ceq1,gradceq1]=dynConst(x,p);
%[ceq2,gradceq2]=gaitLenCon(x,p);
[ceq3,gradceq3]=initYPosCons(x,p);
[ceq4,gradceq4]=hipCon(x,p);
% [c,ceq1,gradc,gradce... |
function S = PMSAFinit(w0,mu,N,L,H,F,alpha,delta)
% PMSAFinit Initialize Parameter Structure for the PMSAF Algorithm
%
% Psuedo-QMF CMFB is Used by default, H and F are used otherwise
% Arguments:
% w0 Coefficients of FIR filter at start
% mu Step size
% N ... |
classdef LumMeter_CS100A < LumMeter
properties (GetAccess=public, SetAccess=private)
serialObj = [];
end
properties (GetAccess=public, SetAccess=public)
serialPort = 'COM2';
serialArgs = { ...
'BaudRate', 4800, ...
'DataBits', 7, ...
'Parity', 'even', ...
'StopBits', 2, ...
... |
clc
clear all
x = ecg(500);
n = randn(1,500);
plot(n,'b');
title('Random Noise output')
xlabel('Time Index');
ylabel('Amplitude (mV)');
grid on; |
function ana2(file)
% ANA2 analysis of HRTF
% Klaus Hartung (hartung@aea.ruhr-uni-bochum.de)
% Lehrstuhl fuer allg. Elektrotechnik und Akustik
% Ruhr-Universitaet Bochum
% 44780 Bochum
%
% Klaus Hartung
% Dec. 95
filename=[file 'mic'];
eval([' load ' filename]);
[m,n] = size(HRTF);
% [mi,ni] ... |
elec_locations_file = 'curry_sphrad1_n35.ced';
if exist(elec_locations_file, 'file'), %through this and pre-steps, we lose connection to "urchanlocs"
chanlocs = readlocs(elec_locations_file);
if ~isempty(strmatch('HEO',{EEG.chanlocs.labels},'exact')),
chanlocs(strmatch('HEOG',{chanlocs.labels},'exac... |
global tlCamera
global serialNumber
global tlCameraSDK
global gainRange
% if ishandle(s)
% delete(s)
% delete(findall(findall(gcf,'Type','axe'),'Type','text'))
% end
button = questdlg('Is inspection lamp off?');
if strcmp(button,'Yes')
expos=str2num(get(fexposureString,'String'));
gain=str2num(get(... |
classdef rlFeatureSet < handle % < rlModel
properties
% subject specific data
subjectParam = [];
algorithmParam = [];
model;
dt;
% performing inverse kinematics
measurement_labels = []; % this may be alphabetical, or in sensor order
m... |
%% Terrain Analysis
% This script analyzes the surface geometry and creates a SWE model based
% on terrain parameters. Extrapolates SWE based on a stepwise linear regression and regression tree.
%inputs:
% dem in geotiff format with equal X,Y,Z units, like a UTM or Alberts
% coordinate system
% extent geotiff ... |
% from BCFormation.m
% UNUSED CODE
%{
function [ maxSolLG , sg2P ] = CalcMaxSolLG( obj , ch4Quantity , pressure , gasDensity , gasBulkSolubility )
n = numel(pressure);
tempSg2P = zeros(n, 1);
tempSolLG2P = zeros(n, 1);
eps = 1e-3;
... |
function pdf = plackett_pdf(u,v,k)
% function pdf = plackett_pdf(u,v,k)
%
% Computes the value of the Plackett copula pdf at a specified point
%
% INPUTS: U, a Tx1 vector (or a scalar) of F(X[t])
% V, a Tx1 vector (or a scalat) of G(Y[t])
% K, a Tx1 vector (or a scalar) of kappas
%
% Thursday, 24 May, 2... |
%Written by Patrick Strassmann
function [eventMatrixStack, eventTimesStack] = tossUnengagedTrials(eventMatrixStack, eventTimesStack)
unengagedTrials = sum(eventTimesStack>0,2)<10;
eventTimesStack(unengagedTrials,:)=[];
eventMatrixStack(unengagedTrials,:)=[];
end |
%% Opdracht 5
% Gebruik een for-lus om de getallen van 2 tot en met 16 af
% te drukken in het Command Window.
for i = 2:16
i;%de puntkomma mag er in jouw uitwerking niet bij zitten.
end |
function [X,Xtime] = whnoise(minfreq,maxfreq,Fs,t,J)
%A script to produce noise with a flat spectrum between specified frequencies.
%Usage: [freq domain, time domain] = whnoise(min frequency, max frequency,Fs,t,seed)
%t is specified time in seconds;
%Borrowed from Kip Keller w_rnd.m
if nargin < 3 | isempty(Fs) F... |
function [ out ] = contractW_Phi( W, Phi, l_pos)
[N, ~] = size(W);
out = cell(N,N);
%CORNERS
if l_pos(1) == 1 && l_pos(2) == 1
out{1,1} = Contract({W{1,1}, reshape(Phi(1, 1, :), 2, 1) }, {[-1, -2, 1, -3], [ 1]});
else
out{1,1} = Contract({W{1,1}, reshape(Phi(1, 1, :), 2, 1) }... |
%C_T = coefficient of thrust
%rho = density of air [slug/ft^3]
%Omega = rotational speed of rotor [rad/sec]
%R = rotor radius [ft]
function [disk_loading]=getdisk_loading(C_T,rho,omega,R)
disk_loading = C_T*rho*(omega*R).^2;
end |
function [endpoint, integrand] = cost_gpops_with_endpoint(sol)
global CONSTANTS;
bounds = CONSTANTS.bounds;
x0_d = CONSTANTS.x0; % Desired initial conditions
xf_d = CONSTANTS.xf; % Desired terminus conditions
Q = eye(12);
R = eye(6);
S = diag([10;10;10;10;10;10;1;1;1;1;1;1]);
tau0 = sol.initial.time... |
function resOutFileName = findFreqs_parallel(subbands, band, Adrive);
tooCloseCutoffFrequencyMHz = 0.2;
if nargin < 1
subbands = [63];
end
if nargin < 2
band = 2;
else
band = band;
end
Off(band);
if nargin < 3
Adrive = 9; % a bit lower for parallel
end
rootPath = [getSM... |
function [c] = config_getbest(dataset, extended)
if nargin < 1
dataset = 1;
end
if nargin < 2
extended = 1;
end
cfg = load('config/best_mean.mat');
c = cfg.best_config;
c.drawSimMat = extended;
c.memory_efficient = ~extended;
c.compute_confs = extended;
c.dataset = dataset;
end
|
function appendStratigraphyData(obj,prevTopoLow,postTopoLow)
% prevTopoLow: the matrix
% obj.stratigraphyData{i}{j}{k} where
% i: indexed stratigraphy row (not actual row of domain)
% j: 1-actual row, 2-channel body start/end data
% k: column index with channel body data
R = obj.currentRiverMatrix;
stratD... |
function xy = xymean2 (x, y, t)
% Inputs: x, y, t - vectors of dimensions n x 1
% Output: xy - mean of xy
% Assumptions: x, y, t are all of the same size
% delta t is not constant
% Checks
if (length (x) ~= length (y));
error ('x and y do not have the same size')
end
if (length (x) ~= leng... |
%% Ejemplo de uso de FromControlCenter.
% IMPORTANTE: ./private/BinaryFileToArray debe estar la carpeta del script.
% Mostrar en hexadeximal
% previousFormat = get(0, 'format');
%format 'hex';
% Importar y mostrar datos %
% uint16p32 representa n�meros de 16 bits SIN signo, rellenados hasta tener
% 32 bits
%a = From... |
% AMIGO_uinterp_delay: interpretes the inputs u for simulation & sens
% computation - with delay
%
%******************************************************************************
% AMIGO2: dynamic modeling, optimization and control of biological systems %
% Code development: Eva Balsa-Canto ... |
function [eul]=quat2eul(q);
% function [eul]=quat2eul(q);
%
% this function converts a quaternion into
% an euler angle vector, defined as [yaw pitch roll]'
% Angles are in radians
qo = q(1);
q1 = -q(2);
q2 = -q(3);
q3 = -q(4);
theta = asin(-2*(q1*q3 + qo*q2)); % extract pitch
if (abs(cos(theta))>1e-4),
psi = as... |
function [char_array,restored_image]=dct_naive_decode(accode,dccode,width,height,QTAB,ACTAB,DCTAB,pos_vect,L)
%L为信息char长度
quantized_coef=huffman_decode(accode,dccode,width,height,QTAB,ACTAB,DCTAB);
bit_array=zeros(1,8*L);
curr_bit_index=1;
restored_image=dequan_dct_coef(quantized_coef,width,height,QTAB);
for i=1:size(q... |
%a = readtable('../../data/kuw/biocore/wlku/Keji/scwbc_rc_52798_242_mat.txt','ReadVariableNames',0,'delimiter',',');
a = readtable('../../data/temp/Figure2/scwbc_rc_52798_242_mat.txt','ReadVariableNames',0,'delimiter',',');
b1 = table2array(a(:,2:243));
a2 = readtable('../../data/temp/Figure2/ff.txt','ReadVariableName... |
function [cvN_new,PC_ensemble,PC_ensemble_shuff,popDists_ensemble,popDists_centroid,settings]=decode_detect_demo(pathName,ensemble_size)
% Predict whether a whisker was deflected or not on each trial
% Decoder works as a one vs all decoder trained with logistic regression
% using kfold cross validation
%% Prepare dat... |
%% VoLAre Example 3b: Full-span F-16
%
% Anthony Ricciardi
% August 2017
% https://github.com/vtpasquale/VoLAre
%
% Modified from a publicly-available F-16 aeroelastic model (F16MA41)
% published by ZONA Technology, Inc. [1]
%
% ZAERO Version 9.2 Applications Manual Vol. 1. Section 2.5 Case 5: F-16
% Aircr... |
function [output] = erwtima_2
maxNumCompThreads(1);
i=1;
time_all = zeros(4,4); %sthn prwth grammh tou pinaka
particular_time = zeros(10); %times_all apothikeuontai oi times
n=2.^[7:10]; %gia tin sunarthsh lu sthn deuterh gia
%tin qr ko... |
%{
Build a mating pool.
Must have: Mating factor. (Raffle tickets)
Must return: Indexes of the corrseponding
chosen parents... Not entire copies.
%}
function [Y] = buildMatingPool(X)
%We normalize the Data again.
X = X./max(X);
%First create Mating factor:
MF = 10;
%Implement Mating factor to population.
... |
% Aysar Khalid
% Problem 2: Playing with Color
% The following function implements task (2)
% bins represents how many ranges in the histogram
% plotting = 1 or 0, whether you want to plot graphs or not
function [ new_histogram ] = p2(image_path, histogram, bins, plotting)
% p2('images/2x2.png',zeros(30), 29, 1)
... |
%% pendulum_unforced_A05.m
% Purpose: a matlab script that solves the forced motion of a pendulum.
%% define function & constants
function pendulum_forced_A05
% initial condition
theta0 = 0.2; % theta0 = theta(0)
dtheta0 = 0 ; % v = dtheta(0)/dt
v = [theta0 dtheta0];
% time series of theta and dtheta
[dynamicallist1,... |
function [delta, delay, u_meas_nodelay, y_nd, u_meas, y] = ...
generate_measurements(Param, Grid, TrueProfiles)
% Given a set of parameters and a testcase, and previously generated true
% electric profiles, generate mesurement data for estimation
%
% Args:
% Param: struct of parameters
% Grid: struct of testcas... |
%This function opens *.raw volume images.
%im_name=image name (string). Image is assumed to be 16bit unsigned or 32bit float (look at code to see which one is used)
%im_size=image size
function im=open_raw(im_name, im_size)
fp = fopen(im_name,'r','l'); %little endian byte order
im = fread(fp,inf,'float32'); ... |
function handles = plotData(ToPlot,handlesIN) % PLOT DATA IN REAL TIME
global Axes1 Axes2
handles = handlesIN ;
% Computing Frequency Vector
nScans = length(ToPlot.Time) ;
ToPlot.f = (0:nScans-1)/nScans*handles.Session.Rate ;
if (~isempty(ToPlot.Data))
for ax = [Axes1 Axes... |
function Success = VoiceFeedback(myString)
% e.g. VoiceFeedback('Holy shit. I'm awesome. . . I'm so awesome')
if IsWin
a = actxserver('SAPI.SpVoice.1');
try
voicestr = 'Name = LH Michael'; % Default voice for Windows XP
a.Voice = a.GetVoices(voicestr).Item(0);
catc... |
function [C, sigma] = dataset3Params(X, y, Xval, yval)
%DATASET3PARAMS returns your choice of C and sigma for Part 3 of the exercise
%where you select the optimal (C, sigma) learning parameters to use for SVM
%with RBF kernel
% [C, sigma] = DATASET3PARAMS(X, y, Xval, yval) returns your choice of C and
% sigma. You... |
%% Midterm Project Rizvi, Due Wed March 9 1400h
%% A bolus dose of 1000mg was injected IV into a subject. Plasma concentrations were recorded at specific times
% Create vectors containing time points
clear all
close all
clc
T = [0 0.5 1 2 4 6 8 12];
C_obs = [866.67 382.23 173.10 167.35 58.79 21.58 6.11 1.07];
... |
function [] = showImage( name )
image = load(['image_' name '.mat']);
image = image.image;
if (size(image.data, 1) > 2)
figure(1);
imagesc(image.data);
axis equal;
axis tight;
colorbar;
colormap(hot)
else
figure(3);
subplot(2, 1, 1);
... |
% Name: Zheng Wen
% USC ID: 7112807212
% USC Email: zwen1423@usc.edu
% Submission Date 2/11/2020
addpath('basicOperations');
img = readraw('E:\Chrome Download\EE569\Week2\HW2\Problem2\LightHouse.raw');
img = raw22D(img, 750, 500);
img = matTranspose(img);
img = im2double(uint8(img));
FS = (1/16)*[0 0 0... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This is the sub-function for calculating the distribution for the
% transformed theta by considering their distribution that is assumed to
% be satisfied
%
% Input:
% theta: The transformed theta
% ... |
%FILLIN - Fills in missing joystick values using the preceding neighbor.
%
% The Linux joystick driver only outputs a joystick value when it differs from
% the previous value. This leads to irregular intervals between joystick data
% points. The fft algorithm requires regularly sampled data, so fillin creates
% an arra... |
clc;clear;close all;
%----------- load -----------%
load('c_Area_ap_a_rawdata');
load('c_Area_ap_b_rawdata');
load('c_Area_ap_c_rawdata');
%-------- gauss filter-------%
ap_a_guassfilter = Gaussianfilter(c_Area_ap_a_rawdata);
ap_b_guassfilter = Gaussianfilter(c_Area_ap_b_rawdata);
ap_c_guassfilter = Gaussianfilter(c_A... |
function d = fdelta(n0, idx1, idx2)
% n0: parameter such that we have Delt[n-n0], where Delt is the delta
% function
%
% idx1: first nonzero index of signal
%
% idx2: last nonzero index of signal
l = idx2 - idx1 + 1;
d = zeros(1,l);
d(n0) = 1; |
%photo = imread('photo.jpg');
%size(photo)
%[lin, col] = size(photo)
%imshow(photo);
%photo2 = imread('photo2.jpg');
%imshow(photo);
%%
%figure;
%subplot(1, 2, 1); % 1 linha, 2 colunas, pos 1
%imshow(photo);
%subplot(1, 2, 2); % 1 linha, 2 colunas, pos 2
%imshow(photo2);
%%
%figure;
%subplot(2, 1, 1);
%imshow(ph... |
function PlotErrorEffectiveIntegration(igausEFF,error_INTEGRATION_nz)
if nargin == 0
load('tmp.mat')
end
figure(1789)
hold on
% error_INTEGRATION_nz = error_INTEGRATION_nz(error_INTEGRATION_nz>0) ;
ngausEFF = max(igausEFF) ;
errorPLOT = zeros(ngausEFF,1) ;
for i=1:ngausEFF
igg = find(igausEFF==i) ;
if ~... |
function OPTIM4(Params)
% Taxing Human Capital
% @Author: Wenlan Luo
% Solve optimal tax code using fmincon. Tau2N is used to balance government budget.
EqResult = [];
WarmUpEqX0 = Params.BEqX0;
function Welfare = ComputeWelfare(Tau)
NewParams = Params;
% overwrite moments to params
NewPar... |
function linear_hom=main(ima1,ima2)
global fitfn resfn degenfn psize numpar
fitfn = 'homography_fit'; %fit function
resfn = 'homography_res';
degenfn = 'homography_degen';
psize = 4;
numpar = 9;
M = 500; % Number of hypotheses for RANSAC.
thr = 0.1; % RANSAC threshold.
scale = 0.25; % Scale of in... |
function C2_X = PROC_GetC2Representation_BoxGlobal(savename,S2Root,objname);
%fuction C2_X = PROC_GetC2Representation_BoxGlobal(savename,S2Root,objname);
%
%S2Root = '/cbcl/scratch01/bileschi/PrecomputedFeatures/StreetScenes/c2/NaturalS2Centroids_70x5';
HelpTextInfo = GetHelpTextInfo;
stillMore = 1;
partNum = 1;
while... |
function [root,fx,ea,iter] = fixedPoint(func,func2,xi,es,varargin)
% Estimates the root of a given function.
% Inputs:
% func= Name f(x)
% func2= Name of f'(x)
% xl= Inital guess
% es= Relative error (Default is 0.01%)
% p1,p2,...= Any aditional parameters uesed by the function
% Outputs:
% root= estimated root locati... |
classdef ResonatorAcousticData
properties(SetObservable)
path = '';
Frequency = [];
QFactor = [];
Angle = [];
Temperature = [];
Amplitude = [];
DecreaseTime = [];
DecreaseFit = [];
Discr = [];
R_fft_data = [];
ln = 0;
Fs = 0;
step = 0.0001;
FreqDiap = [4000 5000];
AngleStep = 9; % degree
... |
% Solves
% arg min_{R, S} nuclear_norm(S) s.t. w_ti = R_t s_ti, R_t R_t' = I
%
% [structure, rotations] = nrsfm_constrained_nuclear_norm(projections,
% structure, rotations, rho1, rho2, tau, rho_max, tol, max_iter)
%
% Parameters:
% projections -- 2 x P x F
% structure -- 3 x P x F
% rotations -- 2 x 3 x F
%
%... |
classdef QAM < BidimensionalDigitalModulation
methods
function obj = QAM(M, averageEnergy)
obj.M = M;
obj.averageEnergy = averageEnergy;
end
function signals = signalCoords(obj)
[width, height, widthEnergy, heightEnergy] = obj.getSizes();
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.