text stringlengths 8 6.12M |
|---|
function x = fn_normalize(x,dim,flag)
% function x = fn_normalize(x,dim,flag)
%---
% Input:
% - x array
% - dim dimensions on which to operate (can be a cell array for
% multiple actions)
% - action 'div'[default], 'sub', 'std' (can be a cell array for
% multiple actions), 'detrend'
% Th... |
%% Stelling 10
%
% Gegeven is dat in het onderstaande voorbeeld
% het code commentaar (aangegeven met het '%' teken)
% aangeeft wat er moet gebeuren.
%
% In dit code voorbeeld zit geen syntaxfout:
% ... |
% Generates the structure that contains all the training data needed for
% Component Contribution.
%
% Input:
% formation_weight - the relative weight to give the formation energies (Alberty's data)
% compared to the reaction measurements (TECRDB)
function training_data = loadTrainingData(use_cac... |
function [points] = getRandomPoints(I, alpha)
% Generates random points in the image
% Input:
% I: grayscale image
% alpha: random points
% Output:
% points: point locations
%
% -----fill in your implementation here --------
points = zeros(alpha,2);
... |
function [ options ] = cvhci_process_options(args, varargin)
%CVHCI_PROCESS_OPTIONS parses varargin options
% OPT = CVHCI_PROCESS_OPTIONS(ARGS, DEFAULT_OPTS) expects a cell array or struct
% ARGS. If ARGS is a cell array, it parses 'OptionName1', OptionValue1, ...
% pairs. If ARGS is a struct, field names ar... |
function res=LPir(y,nLags,nHorizon,NWlags,deltai,errorBands)
% computes IRFs using local projection method (Jorda 2005)
%
% Y_{t+h}=a_{h}+B_{1}^{h+1}y_{t-1}+...+B_{p}^{h+1}y_{t-p}+u_{t+h}
% IRF(t,h,d_{i})=E(y_{t+h}|u_t=d_{i})-E(y_{t+h}|u_t=0)=B_{1}^{h}d_{i} h=1:H
%
% inputs:
% y=[Txn] matrix of data
% nLags=number o... |
%% main.m is the script that calls the rest of the functions.
% Inputs: none
% Outputs: A set of features &/or time course plots of these features.
% Group 11 - MoleScope
% Last Modified: 10/5/2016
% test
%% Acquire Image
close all; clc; clear all;
% I = AcquireImage('http://172.16.1.70/download/44C2EE37-1D44-... |
function [direction] = MoveDirection(Move, Path)
%UNTITLED7 Summary of this function goes here
% Detailed explanation goes here
%_3_|_2_|_1_
%_4_|_*_|_8_
% 5 | 6 | 7
if Move(1) == 1 && Move(2) == 1
direction = 1;
fprintf('Going right forward!\n');
elseif Move(1) == 1 && Move(2) == ... |
W=[];
%[U,G]=tucker(fx,[4 4 4 -1]);
iall=(1:12)'*(ones(1,numel(subj)));
fpr_target=0.01;
itest=1:numel(subj);
dim=4;
Q=[];r=[];rr=[];F=[];rt=[];rti=[];rtf=[];Rind=[];
for si=itest
eval(['X=cat(dim,' subj{si} '_fiEEG,' subj{si} '_friEEG);'])
X=X(iall(:,si),:,:,:);
% y=tprod(U{1},[-1 1],X,[-1 2 3 4]);
... |
function [geo, cros] = calc_direct_geo(c_wn,cros,c_alt,wn,gasvec,afile,sza,altgrid)
% earth radius
re = 6377.64;
sza = deg2rad(sza);
% solve geometry
geo = calc_direct_lengths(sza,re,altgrid);
geo.center_alts = calc_center_alts(altgrid);
% interpolate cros sections
cros = interpolate_cross(c_alt,c_wn,cros,geo.cent... |
function [c] = spectrum_method(fc, v, Ts, Ns, kc)
% This function generates samples of the fading channel
% using the spectrum method.
% Inputs:
% fc = Carrier freq. [Hz]
% v = Relative speed [m/s]
% Ts = Sample interval [s]
% N = Length of filter [samples]
% Ns = Number of simulated samples (Ns... |
% CMPU250 - Professor Eric Aaron
% HW2 - Kyle Patterson
% April 2018
% ####################################################################
% ### ###
% # ... |
function switch_prob = simulate_evan_nolearn(b,w,dis)
%epsilon = .1;
%w = .44;
switch_prob = zeros(1,4);
% reward revaluation
door_state{1} = [0,1,1; 1,0,1];
door_state{2} = [0,1,1; 1,0,1];
% rewards in each terminal state
rewards{1} = [15, 30, 0];
rewards{2} = [45, 30, 0];
switch_prob(1) = compute_switch_prob_sm(b,d... |
function [outputfile] = EDB2readac(CADfile,outputfile,planecornerstype,checkgeom)
% EDB2readac - Reads a file of type .AC (made by e.g. Invis AC3D) and saves all the geometry data in a mat-file.
%
% Input parameters:
% CADfile (optional) The input file, with or without the .AC extension.
% If this file is no... |
function [h] = hline(y, linetype)
if nargin < 2
linetype={'r:'};
end
xlims = get(gca,'xlim');
count = length(y);
xs = repmat(xlims, count, 1);
ys = repmat(y(:), 1, 2);
h = plot(xs', ys', linetype{:});
end
|
% pitchAutoCorr.m
% Dan Hirlinger
% 11/6/2020
clear;clc;
[x,Fs] = audioread('testSignal.wav');
bufferSize = 512;
overlapPct = .5;
overlap = bufferSize*overlapPct;
N = length(x);
% use correlation in each buffer to determine the pitch for that buffer
numSegs = floor(length(x)/overlap);
pitch = zeros(numSegs,1);
for ... |
clc
clear all
close all
x=0:1:500;
y=exp(-(x/200).^2);
subplot(121)
plot(x,y);
grid on
xlabel('会员信誉值','fontsize',20);
ylabel('定价变化敏感度','fontsize',20);
y1=-1/100*(exp(-(x/200).^2));
subplot(122)
plot(x,y1);
grid on
xlabel('会员信誉值','fontsize',20);
ylabel('定价变化敏感度变化率','fontsize',20);
|
function [A1,A2]=kspin(n,rin,rout)
% Generates spin rings for the spin selection rules on the FFT
% [A1,A2]=kspin(n,r1,r2)
% n = size of the matrix
% rin = inner radius
% rout = outer radius
A1=zeros(n);
c=(n+1)/2;
% First spin component
for i=1:n,
for j=1:n,
d=sqrt((i-c)^2+(j-c)^2) ;
... |
function x = holiday( m,d )
x= (m==1 && d==1) || (m==7 && d==4)||(m==12 && d==25)||(m==12 && d==31);
end |
clear
%set parameters
bird_number = 899;
cmap = jet;
linecolor = 'white';
bkgndcolor = [0.85 0.85 0.85];
%Directories & files
cache_directory = ['d:\mlspezio\matlab\scripts\physiol_analysis\' num2str(bird_number) 'analysis\' ...
num2str(bird_number) '_cache\'];
hrtf_directory = ['d:\mlspezio\HRTF_files\... |
% clear all
close all
clc
Rball = 0.1;
G = dss([0 0 1 0;0 0 0 1;0 -75.58 0 0;0 34.16 0 0],[0;0;25.64;-6.46],[1 0 0 0;0 1 0 0],[0;0],[]);
G = LTIsys(balreal(G));
WS = LTIsys(Weight.LF(-10,0.5,1));
MS = LTIsys(Weight.DC(6));
WU = LTIsys(Weight.HF(-30,10,1));
lti_begin
signal th_ref
u = G.in;
th = G.ou... |
%Clear all to start
clc
clear variables
close all
%Choose directory with images
|
function [e] = energiadis(t,a)
ab=(abs(a).^2);
e=sum(ab);
gratdd3(t,a)
end
|
function [probes, rotors] = readOutputs(filesIO,probes,rotors)
%readOutputs reads the output files from STAR-CCM+
% Detailed explanation goes here
%% PROBES velocity X: read/process the file header
fid = fopen(filesIO.fileOut_probesX, 'r');
header = fgetl(fid);
fclose(fid);
cols = strspli... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% EE 569 Homework #1
% Date: Sept. 20, 2015
% Name: Faiyadh Shahid
% ID: 4054-4699-70
% e-mail: fshahid@usc.edu
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [ Channel_out ] = eqHist( Channel,cumu_Channel,row,col )
N = (row*col)/256;
... |
function data = commonAverageReferenceEachBank(imec, data, chIds, timeIdx, extraArg) %#ok<INUSL>
if nargin < 5
extraArg = struct();
end
chanMaskGood = ismember(chIds, imec.goodChannels);
% subtract median of each channel over time
data(chanMaskGood, :) = bsxfun(@minus, data(chanMaskGoo... |
% cprob.m: function to compute the choice probability as a function of x for a
% normal continuous mixing distribution for the random coefficient beta in
% a binary logit model, so theta(1) is the alpha parameter of the logit,
% p(1|x,alpha,beta)=1/(1+exp(alpha+x*beta), and theta(2),theta(3... |
set(0,'DefaultFigureWindowStyle','docked'); % makes figures dock into the same window
set(0,'DefaultFigureWindowStyle','docked'); % makes figures dock into the same window
set(0,'defaultAxesFontSize',14)
set(0,'defaultLineLineWidth',2)
% Recording output
outputFolder = 'PD_results_s2';
outputPath = ['C:\Users\bastien... |
% Enum for the type of trajectory workspace condition
%
% Author : Paul Cheng
% Created : 2019
% Description :
classdef TrajectoryConditionType
enumeration
WRENCH_CLOSURE
CABLE_INTERFERENCE_FREE
end
end |
function expr = mat2math(A, varargin)
% Converts a 2-D matrix to a string that will be read as a matrix
% (tensor) in Mathematica
%
% @author ayonga @date 2016-11-23
%
% Copyright (c) 2016, AMBER Lab
% All right reserved.
%
% Redistribution and use in source and binary forms, with or... |
function plot_states(this)
h3 = figure('Name','States');
numstates = size(this.states,2);
numsupls = ceil(sqrt(numstates));
for it = 1:numstates
subplot(numsupls,numsupls,it)
val = this.states(it).val;
plot_hist(this,this.time, val, 'xlab', 'ylab', 'red');
end |
function M_segment = divide_segments(M, line, ref_pts, voxel_size)
[v1,v2,v3,~] = axis_on_line(line, ref_pts);
temp = sqrt(sum ( (line(2:end,:)-line(1:end-1,:)).^2 , 2));
line_length = zeros(size(line,1),1);
for i=2:size(line_length)
line_length(i) = sum(temp(1:i-1));
end
[... |
classdef NdgSWEHorizNoneDiffSolver
%NDGSWEHORIZNONEDIFFSOLVER 此处显示有关此类的摘要
% 此处显示详细说明
properties
end
methods
function obj = NdgSWEHorizNoneDiffSolver(~)
end
function matEvaluateDiffRHS(obj, ~, ~)
%doing nothing
end
... |
%Forest harvesting - MATLAB linprog
ANPV=diag(Area)*NPV;
vht=diag(Area)*Vol;
ANPV_vec = ANPV(:);
vht_vec = vht(:);
%parameters for linprog function
f = (-1) * ANPV_vec.*ones(N*T,1);
Aeq = zeros(N*T,N);
Beq = ones(N,1);
for i = 1:N
Aeq(i*T-(T-1):i*T,i) = ones(T,1);
end;
|
function within = isWithinTolerance(num1,num2,tolerance)
if abs(num1 - num2) < tolerance
within = true
else
within = false
endif
endfunction
|
function cps_summary_tb(gNo)
% Table with summary stats for cps data
% ---------------------------------------
cS = const_data_so1(gNo);
varS = param_so1.var_numbers;
dirS = cS.dirS;
% Notation
ageStr = cS.symS.retrieve('age', false);
sStr = cS.symS.retrieve('sIndex', false);
cohSchoolStr = cS.symS.retrieve('cohSchoo... |
%{
September 9, 2019
Compute equations of motion of a "falling rolling disk" with an offset
center of mass (CM) relative to the disk center. Ignore moment of inertia
%}
close all
clear all
addpath('./helper_functions')
% true if parameters defined symbolically
isSymbolic = false;
cone_params = cone_parameters(isS... |
function ndx = sub2ind_v(siz,varargin)
%SUB2IND Linear index from multiple subscripts.
% SUB2IND is used to determine the equivalent single index
% corresponding to a given set of subscript values.
%
% IND = SUB2IND(SIZ,I,J) returns the linear index equivalent to the
% row and column subscripts in the arrays I ... |
function F=h2state(A,B,C,D,E,option,tol)
%H2STATE Continuous-time H2 Control Using the ATEA Approach
%
% F = h2state(A,B,C,D,E[,option])
%
% generates a state feedback gain law u = F x, which solves
% H2 suboptimal control problem for the following system:
% .
% ... |
global x x_star t R comb gamma target_num drone_num t_future t_middle x_initial host_class;
%% ----------- COMPUTATION START ----------- %%
fmin = 10000000000000;
host = ini_host;
drone_num = drone_num - 1;
x_star = [];
while isempty(x_star) == 1
drone_num = drone_num + 1
if host_class(drone_num) == 0
... |
function rawls2cl(filename)
% RAWLS2CL removes reflections and noise from impulse response (HRTF_RAW -> HRTF)
% Klaus Hartung (hartung@aea.ruhr-uni-bochum.de)
% Lehrstuhl fuer allg. Elektrotechnik und Akustik
% Ruhr-Universitaet Bochum
% 44780 Bochum
% removal of dc part has to be included
disp('Load Fil... |
addpath ../Rajeev_Code
Datapath = '../ForContextSwitchProject/DoubleCueDatabase/SOMCre/DualModalityCue/';
%%
CMI = @(X,Y) (X-Y)./(X+Y);
goodT = @(X) find(~cellfun(@isempty,X));
bin = 0.01;
filtWidth = 0.05;
pre = 0.2;
post = 1.8;
%%
ExptDates = {'2017-12-15','2017-12-16','2017-12-17','2017-12-18','2017-12-20','... |
function [sync_data] = get_stim_sync_data(datafolder,metadata_info,trials_from_whisk, whisk_buffer, baseline_moving_window)
% function [sync_data] = get_stim_sync_data(DATAFOLDER,EVENTS_CHANS,TRIALS_FROM_WHISK, WHISK_BUFFER, BASELINE_MOVING_WINDOW)
% OR
% function [sync_data] = get_stim_sync_data(DATAFOLDER,METADATA_IN... |
% exercício 8.14 Levine
clc
s = [1, 2, 3, 4, 5, 6, 20]
mu_amostra = mean(s)
s_amostra = std(s)
[no n_amostra] = size(s)
alpha = 0.05
tinf = tinv(alpha/2,n_amostra-1)
tsup = tinv(1-(alpha/2),n_amostra-1)
xis_inf = mu_amostra + (tinf * (s_amostra / sqrt(n_amostra)))
xis_sup = mu_amostra + (tsup * (s_amostra / sqrt(n_a... |
y =rand(5,1);
bar(y,'r');
set(gca,'yticklabel',0:0.1:1)
title('bar graph of five random values'); |
function [big_matrix,big_matrix_id] = add_filtered_features(big_matrix,big_matrix_id,new_features,new_id);
pre_inds = size(big_matrix,1);
new_inds = size(new_features,1);
big_matrix(pre_inds+1:pre_inds+new_inds,:) = new_features;
if iscell(new_id)==1
big_matrix_id(pre_inds+1:pre_inds+new_inds) = new_id;
else
... |
function y_d = interpolate(x_d,x1,x2,y1,y2)
%%% This function linearly interpolates between the points y1 and y2 for
%%% known values of x
%%% y_d = y desired, the value between y1 and y2 as a linear function of x
slope = (y2-y1)/(x2-x1);
x_difference = x_d - x1;
y_d = slope*x_difference + y1;
end |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Implementation of matched filter %
% Not very efficient way to implement this, %
% but it works :) %
% %
% Author: Bezborodov Grigoriy %
% Github: somenewacc ... |
function Put_template_bar(i, C, Col, ang)
%%
%{
figure
%base img
BG = zeros(320,320);
imshow(BG);
roi = 1:10;
C = randi([1,320], 10,2);
ang = rand(10,1) * pi;
%}
W = 4;
L = 30;
%for i = roi
X = [C(1,i) - L/2 * cos(ang(i)), C(1,i) + L/2 * cos(ang(i))];
Y = [C(2,i) + L/2 * sin(ang(i)), C(2,i) - L/2 * sin(ang(i))];... |
function [ status ] = mdsput( node, expression, varargin)
% MDSPUT put data into MDSplus tree node
% This routine invokes treeput(node, expression, ...)
status = mdsvalue(sprintf('treeput($, $%s)', repmat(', $', 1, nargin - 2)), node, expression, varargin{:});
|
function [ D ] = Create_monomial_basis( num,dof,x_max )
x1_max = x_max;
x1 = linspace(-x1_max, x1_max, num);
dx1 = 2 * x1_max /(num - 1);
x2_max = x_max;
x2 = linspace(-x2_max, x2_max, num);
dx2 = 2 * x2_max /(num - 1);
x3_max = x_max;
x3 = linspace(-x3_max, x3_max, num);
... |
%% PHILIPSDICOMENTRIES Return a structure of information for Philips DICOM entries
%
% [PHILIPS] = PHILIPSDICOMENTRIES
%
% PHILIPS is a structure containing definitions for the PARDEF and IMGDEF
% portions of a Philips PAR header file including the information for the
% associated DICOM entries in an en... |
%% Opdracht 2
% In de onderstaande code staan fouten. Los de foutmelding op.
% Let op! Bij het oplossen mag je geen variabele verwijderen of index
% veranderen. De tangentieleVersnelling moet 4 worden.
t = 1:0.01:10;
hoekKogelSlingeraar= sin(t);
if length(hoekKogelSlingeraar)== length(t)
tangentieleVersnelling=4; ... |
function plot_all_skeletons(path_input_pcl, path_input_skel, whichpcl, path_output)
%{
Save the pngs of all the skeletons for every person and action.
Inputs:
- path_input_pcl: input path of the point clouds.
- path_input_skel: input path of the predicted skeletons.
- whichpcl: character choosing t... |
%********************************************************************
%Damage Evolution code based on non-linear damage evolution model by
%Chaboche and Lemaitre
%Author: Shruti Motiwale
%Code Status -
%Please update the code status and specify modifications
%No Approximations
%****************************************... |
function [Model, Info] = linear_sparse_seq(X,Y,Model,parm)
% Estimate linear weight matrix for input-output mapping
% Automatic Relevance Prior for each input dimension
% is imposed to get sparse weight matrix
% Sequential iterative algorithm to increase parameters one by one
%
% Notice !!
% Delay... |
% run DATCOM program %
system('Phoenix50Seat.dcm &');
% wait until csv file is ready %
while ~isfile('Phoenix50Seat.out')
pause(0.1)
end
while ~isfile('Phoenix50Seat.csv')
pause(0.1)
end
%%% read Data %%%
alldata = datcomimport('Phoenix50Seat.out', true, 0);
%%% read csv file %%%
csvData = readtable('Phoenix5... |
function [dp,note] = Limit01Bag(arr,r)
% w(i)=v(i)=arr(i)
[dp,note] = DP01bag(arr,arr,r);
end
function [dp,note] = DP01bag(w,v,b)
% w=weight, v=value, b=max_weight
n = length(w);
% WARNING: 1~b+1 col mark 0~b weight_limitation
dp = zeros(n,b+1);
note = zeros(n,b+1);
for y = 0:b
if y >= w(1)
... |
function varargout = TPA_DataAlignmentCheck(varargin)
% TPA_DATAALIGNMENTCHECK MATLAB code for TPA_DataAlignmentCheck.fig
% TPA_DATAALIGNMENTCHECK, by itself, creates a new TPA_DATAALIGNMENTCHECK or raises the existing
% singleton*.
%
% H = TPA_DATAALIGNMENTCHECK returns the handle to a new TPA_DATAALIGN... |
input_path = '/home/qiang/QiangLi/Python_Utils_Functional/FixaTons/WECSF/mit1003/smaps/';
save_path = '/home/qiang/QiangLi/Python_Utils_Functional/FixaTons/WECSF/mit1003/enhanced';
[ smap ] = wecsf(copy_to_path1, save_path)
function [ smap ] = wecsf(input_path, save_path )
%system('call_wecsf.sh');
srcFil... |
% int = simpsonComposita(f, a, b, n)
% Formula di Simpson composita per l'approssimazione dell'integrale
% definito di una funzione.
%
% Input:
% -f: la funzione di cui si vuol calcolare l'integrale;
% -a: estremo sinistro dell'intervallo di integrazione;
% -b: estremo destro dell'intervallo di integrazione;
% ... |
%% MOC PLOTTER
% Nautilus runs 6.6666km resolution
% Option 1 = Run 1
% Option 2 = Alltopo test
% Option 3 = Flat bottom
% Optopn 4 = Alltopo Av Scheme 7
function [TS]=MOCplot6km(start,stop,Plot,option)
fprintf('dx set to 6666.666m')
close all
%clear all
global dx
global Z;
global Y;
global lm;
global V;
t=5;
dx=6666... |
function params = f_get_params_from_listflie(fname)
%[f_get_params_from_listflie] reads scan parameters from .LIST file.
%
% USAGE:
% params = f_get_params_from_listflie(fname)
%
% INPUT:
% fname: Raw data name, e.g. 'raw_006'
%
%
% Last modified
% 2012.07.23.
% Read scan parameters from .LIST file. This is gene... |
function call_glmnet_behav_orchestra_binomial(base)
load([base 'behav_response.mat'])
load([base 'big_matrix.mat'])
load([base 'big_matrix_ids.mat'])
load([base 'fold_ids.mat'])
threshold = 0.015;
response = behav_response>threshold;
lsfid = str2num(getenv('LSB_JOBINDEX'));
cel = lsfid;
features = 1:size(big_matrix,... |
clearvars; close all
%% test twodConv function
% read an image
I = imread("assignment01_images/cameraman.tif");
% if RGB image
if size(I,3)==3
T = rgb1gray(I);
end
% change image to double
I = double(I);
% show the image
figure;imshow(I,[]);
% prepare a conv kernel
% box filter
w1 = 1/81.* ones(9);
% sobel fil... |
classdef ChannelInfo
% CHANNELINFO Specify info about image channels (dye, color, ...)
% This class contains basic information about the color channels of an
% image. It is mostly used to display info, as well as to plot the
% image using the same colors used by ZEN or other visualization tools.
%
% A... |
function x0=merge_sensors(x1,x2,fact)
if nargin<3
fact=5;
end
x0=nan(size(x1));
for i=1:length(x1)
if (x2(i)>fact*x1(i) || x1(i)>fact*x2(i))
x0(i)=min( [x1(i),x2(i)]);
else
x0(i)=mean([x1(i),x2(i)]);
end
end
end |
clear
clc
global alpha %#ok<NUSED>
global count %#ok<NUSED>
%reads in data, orders computation and printing done
[alpha, h, yinit, tfin] = textread('fixed.dat', '%f %f %f %f',1);
fixed_solver(h,yinit,tfin);
%actual computational work
function [Tvector,Pvector] = fixed_solver(h,yinit,tfin)
global count
count = 0;
%p... |
function [model, bvhStruct, frameLength] = bvhLoadResult(dataSet, number)
% BVHLOADRESULT Load a previously saved result.
[bvhStruct, channels, frameLength] = bvhLoadData(dataSet);
dataSet(1) = upper(dataSet(1));
load(['dem' dataSet num2str(number)])
model = ivmReconstruct(kern, noise, ivmInfo, X, channels);
|
lc = 2;
lp = 2;
W = 100;
Tmin= (W * lc * lp)/ (0.3*(lp^(2) -0.3^(2))^(1/2));
d=0.3:0.1:1.8;
T1= (W * lc * lp)./ (d.*(lp^(2) -d.^(2)).^(1/2));
plot(d,T1);
xlabel('distance');
ylabel('T');
for dis=0.3:0.1:1.8
T2 = (W * lc * lp)/ (dis*(lp^(2) - dis^(2))^(1/2));
if Tmin > T2
Tmin = T2;
... |
function [n_test_score] = evaluate(test_data)
training_data = xlsread('darshan healthy stats.xls');
end
|
%% (0)
%target_im = im2double(imread('data/hard/14b999d49e77c6205a72ca87c2c2e5df.jpg'));
%target_im = im2double(imread('data/easy/0013729928e6111451103c.jpg'));
%target_im = im2double(imread('data/me-small.jpg'));
target_im = im2double(imread('data/hard/jennifer_xmen.jpg'));
%target_im = im2double(imread('data/ha... |
function Hd = low_pass_filter_window(Fs,Fc)
%LOW_PASS_FILTER_WINDOW Returns a discrete-time filter object.
% MATLAB Code
% Generated by MATLAB(R) 9.8 and DSP System Toolbox 9.10.
% Generated on: 27-Apr-2021 16:39:00
% FIR Window Lowpass filter designed using the FIR1 function.
% All frequency values are in Hz.
%Fs =... |
function switch_prob = e_simulate_evan_nolearn(e,w,dis)
%epsilon = .1;
%w = .44;
switch_prob = zeros(1,4);
% door state: 1 means a door is open, 0 means it is closed
% {1} is training phase, {2} is retraining phase
% row 1 is state 2, row 2 is state 3
% column is door 1, 2, and 3 - so in action space it correspond... |
function plotSigVsGradients(sigTable,row2plot,sig,varargin)
%% input argument validation
p=inputParser;
p.CaseSensitive=true;
p.FunctionName='plotAllSignals';
errorStr='Table is not properly formatted';
valTableFcn=@(x) assert(istable(x) && checkTableFormat(x),errorStr);
p.addRequired('sigTable',valTableFcn);
fun... |
function [J,b,DATA] = Jmin_bmin_calc(SNAPfNW,weigE,DATA,DATA_CUBATURE)
% Construction of matrix J and vector b
% --------------------------------------
%dbstop('5')
if nargin == 0
load('tmp1.mat')
end
nsnap = size(SNAPfNW,2);
INTexac = zeros(1,nsnap) ;
M = size(SNAPfNW,1) ;
INTexac = SNAPfNW'*weigE ;
% Total
V = ... |
function [M_PER,M_PEG,M_PEB]=embed(PER,PEG,PEB,Mess,OBJ_ori,OBJ_emb,T)
L=length(Mess);
M_PER=PER;
M_PEG=PEG;
M_PEB=PEB;
for i=1:L
% M_PER=PER;
% M_PEG=PEG;
% M_PEB=PEB;
[M_PER(i),M_PEG(i),M_PEB(i)]=embedonebit(PER(i),PEG(i),PEB(i),Mess(i),OBJ_ori,OBJ_emb,T);
end
end |
% Creates a prediction using an already trained closed NARX
%X = tonndata(InputT5,false,false);
%T = tonndata(OutputT5,false,false);
load ('netcbest')
load('netbest')
% Number of delays
delay=2;
%% Drive Cycle 1
% ---open loop narx---
X2open=TestInput2(1:116);
T2open=TestOutput2(1:116);
[x,xi,ai,t] = prepa... |
# Euler mejorado
printf('Metodo de euler mejorado\n');
n = input('n: ');
x(1) = input('x(1): ');
x(n+1) = input('x(a): ');
y(1) = input('y(1): ');
h = abs(x(n+1) - x(1)) / n;
for i = [2:n]
x(i) = x(1) + (i-1)*h;
end
for i = [1:n]
y(i+1) = y(i) + h*(sin(x(i)) - log(y(i))); # Prediccion inicial
# Y mejorado
... |
%{
vis2p.OriGroup (computed) #
-> vis2p.VisStims
---
uni_ori : mediumint unsigned #
total_trials : mediumint unsigned # i) the orientation shown in this trial
%}
classdef OriGroup < dj.Relvar & dj.AutoPopulate
properties
popRel = vis2p.VisStims('exp_type ... |
% SIMPLETRI return simple triangulation for square datasets
% TRI = SIMPLETRI(N) returns a matrix containing indexes to the
% vertices of triangles fitted onto a square grid of size NxN.
%
% See also TERNSURF
% Method:
% Author Carl Sandrock 20031006
% To do
% Modifications
% Modifiers
% (CS) Carl Sand... |
function varargout = wtc_spiht_3d(option,varargin)
%WTC_SPIHT Main program for WTC_SPIHT encoding.
%
% VARARGOUT = WTC_SPIHT_3D(OPTION,VARARGIN)
%
% WTC_SPIHT_3D('encode', ... )
% WTC_SPIHT_3D('decode', ... )
% WTC_SPIHT_3D('save', ... )
% WTC_SPIHT_3D('load', ... )
% M. Misiti, Y. Misiti, G. Oppenheim, J.... |
function [Xcp_Barrowman, Xcp_Planform, Ssm_Barrowman] = Xcp_Barrowman_f( DTF )
%Calculate Xcp according to Barrowman for documentation
%% Rocket Dimensions
L = DTF.Length;
L_cone = DTF.Cone_L;
L_cyl = L - L_cone;
D_cyl = DTF.D;
R_cyl = D_cyl/2;
% Fin geometry
fin.n=DTF.fin_n;
fin... |
% $Header: svn://.../trunk/AMIGO2R2016/Kernel/AMIGO_set_theta_index.m 1896 2014-10-30 08:58:29Z davidh $
% AMIGO_set_theta_index: computes vectors of indexes for estimation
%
%******************************************************************************
% AMIGO2: dynamic modeling, optimization and control of biologica... |
% Class to compute whether a pose (dynamics) is within the wrench-closure
% workspace (WCW)
%
% Author : Jonathan EDEN
% Created : 2015
% Description :
classdef WrenchClosureRayCondition < WorkspaceRayConditionBase
properties (SetAccess = protected, GetAccess = protected)
% Fixed constants
... |
function pc_rmse(Xtr,Xfe,oer,st,ed,titin,fil)
siz=size(Xfe);
en=siz(2);
%-------------estimate rmse-------------
se=zeros(siz);
for n=1:en
se(:,n,:)=(squeeze(Xfe(:,n,:))-Xtr).^2;
end
% ----
rmse=zeros(siz(1),siz(3));
for i=1:siz(3)
rmse(1,i)=(mean(se(1,:,i))).^.5;
rmse(2,i)=(mean(se(2,:,i))).^.5;
rmse(3,i)... |
function [ Out ] = SizeAdjust( In )
%% Description
%%
[r,c,~] = size(In);
r = max(r,c);
if r > 800
if r > c
Out = imresize(In,800/r);
else
Out = imresize(In,800/c);
end
else
Out = In;
end
end |
function [ ] = setup( az,el,sessionRate,voltage)
%UNTITLED6 Summary of this function goes here
% Detailed explanation goes here
global root;
devices = daq.getDevices;
try
root.configuration.s = daq.createSession(devices.Vendor.ID);
device_found = 1;
catch
%message = [cellstr('problem with session, possibly no de... |
function M = unvectorize(v)
%UNVECTORIZE convert edges into square matrix
%
% M = UNVECTORIZE(E) converts edges E into square symmetric network matrix
% M. Diagonal entries will be zero.
if size(v,2)>1,
for m = size(v,2):-1:1,
M(:,:,m) = ROInets.unvectorize(v(:,m));
end%for
return
en... |
clear
close all
%% Define parameters
x=10;y=10;
xSpacing = 1; ySpacing = 1;
%% Create optimization problem and solve
groundStructure = GeoGroundStructure;
groundStructure.createCustomizedNodeGrid(0, 0, x, y, xSpacing, ySpacing);
groundStructure.createMemberListFromNodeGrid();
groundStructure.createNodesFromGrid();
lo... |
% Starter code prepared by James Hays
%This feature is inspired by the simple tiny images used as features in
% 80 million tiny images: a large dataset for non-parametric object and
% scene recognition. A. Torralba, R. Fergus, W. T. Freeman. IEEE
% Transactions on Pattern Analysis and Machine Intelligence, vo... |
classdef GeneralLearningCurve < handle
properties(Access = public)
class
datafiles
predt
postdt
chid
ftid
targets
testthr=0.10;
Mtests=5;
xvalsequential
Ntrains
prc
testid
end
methods(Acces... |
function yy=polyeval(x,c,xx)
%计算多项式的值,该多项式是由牛顿或hermit插值所得
% 多项式:c(1)+c(2)(t-x(1))+c(3)(t-x(1))(t-x(2))+...+c(n+1)(x-x(1))...(x-x(n))
%输入: x,c:多项式的系数及节点
% xx:需求值的点
% 输出: 多项式在xx上的值
n=length(x)-1;
yy=c(n+1)*ones(size(xx));
for k=n:-1:1
yy=yy.*(xx-x(k))+c(k);
end;
return; |
function J_toe = J_toe(in1)
%J_TOE
% J_TOE = J_TOE(IN1)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 25-Jul-2020 23:15:55
q_t1 = in1(:,1);
q_t2 = in1(:,2);
q_t3 = in1(:,3);
q_t4 = in1(:,4);
q_t5 = in1(:,5);
q_t6 = in1(:,6);
t2 = q_t1+q_t2;
t11 = atan(4.031084689959317e-1);
t12 = ... |
function call3 = FRETui
btn = uicontrol('Style', 'pushbutton', 'String', 'Next',...
'Position', [20 20 50 20],...
'UserData', 10 ,'Callback', @buttonCallback);
btn2 = uicontrol('Style', 'pushbutton', 'String', 'Save Trace',...
'Position', [80 20 70 20],...
... |
function [hzc,icl_z]=coarsening_icl_fortran(dx,dy,dz,params)
% call fortran version
[hzc,icl_z]=coarsening_icl(dx,dy,dz,params)
if params.test_fortran
disp('testing if coarsening_icl_test same result in fortran')
exe = './fortran/coarsening_icl_test.exe';
if exist(exe,'file')
%Writing all arrays ... |
clear all;
close_serial = instrfind; %close open serial connections
if(close_serial ~= 0)
fclose(close_serial);
end
s = serial('COM5');
set(s, 'BaudRate', 115200); %match baud rate with arduino setting
set(s, 'DataBits', 8);
set(s, 'StopBits', 1);
set(s, 'Parity', 'none');
fopen(s); ... |
%% Alonso Lucas, Sara; Errasti Odriozola, Jon;
%% Sarabia Vargas, Alejandro; Terreros Sanchez, Carlos
% Este codigo calcula la aerodinamica estacionaria incompresible para un
% ala con una geometria dada mediante el metodo Vortex-Lattice. El codigo
% esta predeterminado para calcular las graficas de los coeficie... |
function [polar, angleChange] = DLC_angles2bodypart(DLC_data, reference_pos)
% input 2 matrices (col1,col2 -> x,y, rows = time) of a target body part and another pivot body part you want to
% analyse the rotation around.
% reference_pos = position number of the DLC labelled bodypart to use as
% the reference point i.e... |
function [rem,noise,noisemag] = remove_common_mode(sig, fs,goodband, varargin)
opt.order = 9;
opt.clip = 10;
opt = parsevarargin(opt, varargin, 2);
[z,p,k] = butter(opt.order,goodband/(fs/2), 'stop');
[sos,g] = zp2sos(z,p,k);
nchan = size(sig,2);
noise = filtfilt(sos,g, sig);
isclip = abs(sig) >= opt.clip;
noise(is... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.