text stringlengths 8 6.12M |
|---|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Variables de entrada:
% t: vector tamanio s
% u: vector columna de tamanio 2s
%
% Variables de salida:
% y: vector columna de tamanio 2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function y = f_pvi_1_3_1(t,u)
s = len... |
%Connect_Arduino();
stepsPerRev = 32 * 16.032;
thisStepper = Stepper(a, stepsPerRev, 'D8', 'D9', 'D10', 'D11');
MoveClockWise(thisStepper,100,513);
MoveCounterClockWise(thisStepper,100,513); |
function [G,Am_wing,a]=fast_steady_wing(x,y,z,xcol,zcol,n,dl_x,dly,Nx,Ny,u,alpha,Lam,dih,b)
% genrating the wake for a steady flight
% finding the steady solution with the panel method
% original code to do only wing
Awing=zeros(2*Nx*Ny,2*Nx*Ny);
Awake=zeros(2*Nx*Ny,2*Nx*Ny);
for i=1:2*Nx*Ny
index1col=ceil(i... |
reset_data_analysis_environment
close all
load('initial_NBI60keV_D_pre_collapse_all.mat')
load('initial_NBI60keV_D_precession_stats_all.mat')
psi_pos_q1=interp1(psi_scale,1:Nradial,psi_q1)
EKIN_INF=1*1e3
% PART_POP=find(((alphas_pos_x-X_axis)>0.15).*((alphas_pos_x-X_axis)<0.6).*(alphas_pos_z<0.25).*(alphas_pos_z>-0... |
% RHS of nonlinear model
% no control, no noise
function dxdt = rhs_burger_lqg(t,x,Lc,Uc,A1,A2,d1,d2,D1,H,A,B,K,L,N,nu,us,ws)
dxdt = zeros(2*N,1);
u = - K*x(N+1:2*N);
for i = 1:N
dxdt(i,1) = -x(1:N)'*D1{i}*x(1:N) ...
- (nu*A1(i,:) + us*A2(i,:) + ws(2:N+1)*(D1{i} + D1{i}'))*x(1:N);
... |
function exercisePCA2D
X=[ [ 1.3 1.6 2.8]' [4.3, -1.4, 5.8]' [-0.6,3.7,0.7]' [-0.4,3.2,5.8]' [3.3,-0.4,4.3]' [-0.4,3.1,0.9]']
disp('mean c=:')
c=mean(X,2)
disp('covaricance S=:')
S=X*X'/6-c*c'
disp('eigen decomposition:')
[V D]=eig(S)
e1=V(:,3); e2=V(:,2);
disp('two dim representations:')
for n=1:6; disp([e... |
function Q = qlearn()
% create map
x = 10; y = 10;
% actions -- up; down; left; right
A = [-1; 1; -y; y];
% initial state
S = 1;
% reward matrix, utility matrix, and learning variables
R = zeros(x,y); R(end) = 100; Q = zeros(x*y,size(A,1));
alpha = 0.2; gamma = 0.2; epsilon = 0; episodes = 1000;
... |
function [Spec,Freq,Tijd] = pa_sweep2spec(Sweep,Wav,chan,NFFT,NSweep,Fs,GraphFlag)
% [SPEC,FREQ,TIME] = SWEEP2SPEC(SWEEP,WAV,CHAN,NFFT,NSWEEP,CHAN)
%
% See also READHRTF, GENSWEEP
%% Initialization
if nargin<3
chan = 1;
end
if nargin<4
NFFT = 1024;
end
if nargin<5
NSweep = 18;
end
if nargin<6
... |
function my_cameradd_function(src,event,data)
uiresume(data.f)
% Callback function for "Add Camera" (eh2_camera_add)
prompt = {'Field of View [deg]:','Range [length unit]:', 'Price [-]'};
dlg_title = 'Add Camera';
dims = [1 50];
defaultans = {'120','30','5'};
answer = inputdlg(prompt,dlg_title,dims,defaultans);... |
function [] = plot_T_storage( tank, Load, load_types, fignum, line_specs, Celcius, varargin)
% PLOT THE STORAGE TEMPERATURES ON THE T-S DIAGRAM.
% Use the tank structure to obtain the storage temperatures at the desired
% points. The Load structure is used to obtain the index iL of the load
% period which is to be plot... |
function varargout = communicate(varargin)
%COMMUNICATE access to COM port
% ID = COMMUNICATE('open', S) initializes the interface to the W32SERIAL routines
% and returns ID, a unique integer ID corresponding to the open com port
% configurated by S. The MATLAB M-file W32SERIAL/FOPEN should be u... |
%@(#) readcost.m 1.2 94/08/12 12:15:35
%
%function [buntot,batchcost]=readcost(costfil)
function [buntot,batchcost]=readcost(costfil)
fid=fopen(costfil,'r');
for i=1:1000,
ord=fgetl(fid);
if length(ord)>5,
if strcmp(upper(ord(1:6)),'BUNTYP'), break;end
end
end
for i=1:1000,
ord=fscanf(fid,'%s',1);
... |
set(0,'DefaultAxesFontName', 'Arial');
set(0,'DefaultAxesFontSize', 12);
% Change default text fonts.
set(0,'DefaultTextFontname', 'Arial');
set(0,'DefaultTextFontSize', 12);
%FS blockade
spikes_data = load('activity_final_FSblockade50.csv');
min_time = 10;
max_time =500;
start_index = find (spikes_data(... |
function f = computeObjective(model)
%COMPUTEOBJECTIVE f = computeObjective(model)
% Compute the total objective value
%
% 16/10/13
% Trung Nguyen
f = 0;
for userId = 1:model.num_users
if ~any(model.T(:,1) == userId), continue, end;
u = getUserParams(userId, model);
fu = nLogLikelihood(u, userId, model);
... |
function [g bv lv]=Anti_Gap(v)
% Anti_GAP computes the anti-gap function from game v.
%
% Usage: [g bv lv]=Anti_Gap(v)
% Define variables:
% output:
% g -- The anti-gap function of game v. A vector of length 2^n-1.
% bv -- The anti-upper vector/payoff of game v.
% lv -- The anti-lower/concession ... |
function [] = DirichletEllipse(a,b,N,M)
% Solves Dirichlet BVP over an elliptical region
f=sqrt(a^2-b^2);
xi0=acosh(a/f);
[Dx,x]=chebD(2*N-1); x=xi0*x; Dx=Dx/xi0; Dxx=Dx*Dx;
[Dyy,y]=fourD2(M);
[xx,yy]=ndgrid(x,y);
zz=xx+1i*yy;
ww=f*cosh(zz);
uu=real(ww);
vv=imag(ww);
J=abs(f*sinh(zz)).^2;
% Boundary conditions
bc=[co... |
function varargout = BBA_bts(varargin)
% BBA_bts M-file for BBA_bts.fig
% BBA_bts, by itself, creates a new BBA_bts or raises the existing
% singleton*.
%
% H = BBA_bts returns the handle to a new BBA_bts or the handle to
% the existing singleton*.
%
% BBA_bts('CALLBACK',hObject,eventData,handl... |
function [diag, d, l, u]=diagonally_dominant(a, n)
d=[];
u=[];
l=[];
diag=true;
for i=1:n
sum=0;
for j=1:i-1
d(i, j)=0;
u(i, j)=0;
l(i, j)=a(i, j);
sum=sum+abs(a(i, j));
end
d(i, i)=a(i, i);
u(i, i)=0;
l(i, i)=0;
for j=i+1:n
d(i, j)=0;
u(i, j)=... |
function h = animated_trisurf(F,X,Y,Z)
% ANIMATED_TRISURF animated, interactive trisurf plot
%
% h = animated_trisurf(F,X,Y,Z)
%
% Inputs:
% F #F by 3 by {#frames | 1} list of triangle indices
% V #V by dim by #{frames | 1} list of vertex positions
% or
% X #V by #{frames | 1} list of X p... |
function xdot=f(x)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Matlab M-file Author: Xuyang Lou, Yuchun Li
%
% Project: Simulation of a hybrid system
%
% Name: f.m
%
% Description: Flow map
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
classdef LiveMutation < emi.decs.DecoratedMutator
%DEADBLOCKDELETESTRATEGY Summary of this class goes here
% Detailed explanation goes here
properties
% skip mutation op if filter returns true.
% key: mut_op_id, val: lambda
mutop_skip = containers.Map(...
);
... |
function D = droplet(height,width)
% DROPLET 2D Gaussian
% D = droplet(height,width)
[x,y] = ndgrid(-1:(2/(width-1)):1);
D = height*exp(-5*(x.^2+y.^2));
end |
function [centers, betas, weights] = RBF(X_train, y_train, centers_per_category)
%get the number of unique categories in the dataset
unique_categories = size(unique(y_train), 1);
%set the number of data points
data_points = size(X_train, 1);
centers = [];
betas = [];
for (c = 1:u... |
% Incarcarea vectorilor cu coordonatele varfurilor
% celor trei dreptunghiuri care vor forma poliedrul spatial
x1=[0,1,1,0]; y1=[0,0,-1,-1]; z1=[0,0,0,0];
x2=[1,1,1,1]; y2=[0,0,-1,-1]; z2=[0,1,1,0];
x3=[0,1,1,0]; y3=[0,0,-1,-1]; z3=[1,1,1,1];
% Comanda formata din trei unitati, fiecare desemnand
% c... |
function [RMat] = regu_grid(dipPts,MinMLat,MaxMLat,MinMLon,MaxMLon)
% change obsPts dipole points
%Regularisation matrix grid
% [X,rho,eta,F] = pcgls(A,L,W,b,k,reorth,sm)
%addpath /Users/annamittelholz/ownCloud/MagRoutines/make_icosahedron
%make a regularisation grid
RMARS = 3930;
% find midpoints of triangle... |
% N -- population size
% i0 -- number of infected individuals at t = 0
% beta -- average contact rate
% kappa -- average incubation rate
% gamma -- average recovery rate
N = 100;
i0 = 1;
% Time unit is weeks
tspan = [0, 30];
params = struct(...
'beta', 0.8, ...
'kappa', 1.12, ...
'gamma', 0.4 .... |
% Tidal Model Driver (TMD)
% Output harmonic constants and predict tides
%
close all; clear all;
w=what('TMD');funcdir=[w.path '/FUNCTIONS'];
path(path,funcdir);
fprintf('Welcome to TMD: Tidal Model Driver!\n');
fprintf('\n');
fprintf('TMD FILE NAME/FORMAT CONVENTION (MUST follow!):\n');
fprintf('1. TMD supports format... |
function trialok=prepTrial(visual,coor,tr,ntr,task)
% prepare trial
% clear screen
Screen('FillRect',visual.main,[0 0 0],[]);
Screen('Flip',visual.main);
% pause recording eye position
Eyelink('SetOfflineMode');
WaitSecs(0.2);
% drawings on operator screen, NB! eyetracker has to be offline!
Eyelink('Command','clear_... |
%演示五个控制点的两段B样条曲线生成
%五个控制点C=[C1 C2 C3 C4 C5]
C=[0 1 2 3 4 %控制点X方向坐标
0 1 0 1 0]; %控制点Y方向坐标
%参数s为归一化位移0≤s≤1
s=0:0.01:1;
%
f1s=(1-s).^3/6;
f2s=(3*s.^3-6*s.^2+4)/6;
f3s=(-3*s.^3+3*s.^2+3*s+1)/6;
f4s=s.^3/6;
%
P1s=C(:,1)*f1s+C(:,2)*f2s+C(:,3)*f3s+C(:,4)*f4s;
P2s=C(:,2)*f1s+C(:,3)*f2s+C(:,4)*f3s+C(:,5)*f4s;
%绘制... |
% Test function to draw the L*a*b* cube (a slice along the L axis)
addpath ../../3rd_party/color;
L = 100;
[a, b] = meshgrid(-100:100, -100:100);
labImg = [reshape(repmat(L, size(a)), numel(a), 1), reshape(a, numel(a), 1), reshape(b, numel(b), 1)];
nbBins = 16;
nbDivsAB = (200 / nbBins);
nbDivsL = (100 / nbBins);
... |
% written by Rabiul Haque Biswas (biswasrabiul@gmail.com)
% this code estimates the var-NCF (estimate for initial sensitivity change)
clear all; close all; clc;
file = xlsread('MBTP_NCF');
rawdata = file(2:end-1, 2:end);
for i=1:size(rawdata,2)
TL1=rawdata(:,1:2:end);
TL2=rawdata(:,2:2:end);
rati... |
function err = ErreurApproximation(signal1,signal2)
% Cette fonction génère l'erreur d'approximation d'un
% signal 1 par un signal 2
%
% Syntaxe: err = ErreurApproximation(signal1,signal2)
% signal1: (vecteur, longueur N) un signal
% signal2: (vecteur, longueur N) un signal
% err (scalaire, positif) l'erreur d'appro... |
function bypass_ind=find_bypass_ind(distnace_other_from_self,tracking_ind)
% Defined by change from tracking to being tracked
%a. find where distance change signs:
distnace_other_from_self_shifted_plus=[0; distnace_other_from_self];
distnace_other_from_self_shifted_minus=[distnace_other_from_self; 0];
distance... |
clear all
clc
global param;
InitParams();
Downrange = 720000;
Crossrange = 0;
[thetaf phif] = finalposition(param.theta0, param.phi0, param.psi0, Downrange, Crossrange, param.r_eq);
param.thetaf = thetaf;
param.phif = phif;
state = [];
results = [];
P = [0.3,0.6,0.9];
for i = 0.7:0.1:0.9
P(1) = i;
[t, y] = ... |
% Understand a Weibull function
weibull1 = @(intensity, lambda, k) 1 - exp(-(intensity / lambda).^k);
rescale1 = @(y) y.*0.99 + 0.005;
% re-parametrized Weibull
% g : performance expected at chance
% t : threshold
% a : performance level that defines the threshold
% b : slope of the Weibull function
savePth = '/Vo... |
NumView = 9;
scale = 3 ; bins = 64;
filepath_input = '../00 input/Buddha/'; %% input EPI image address
filepath_output = 'output/Buddha/'; %% output
%main_bcm(filepath_input,filepath_output,NumView);
main_compass(filepath_input,filepath_output, scale, bins);
|
function C = p3(X_train, Y_train, X_test, k)
% Function p3 performs kN N classification
% Inputs X_train - the training samples,
% Y_train - the true class of training samples, and
% X_test - the test samples
% k - parameter for kNN classifier
% Outputs vector C stores the classes a... |
function [type, highcard] = final_type(card_codes)
% FINAL_TYPE Compute the hand category in the showdown
%
% [type, highcard] = final_type(card_codes)
% [type, ~] = final_type(card_codes)
%
% card_codes - an array of card codes e.g. [0 4 5 32 27 -1 15 12] (-1s are ignored)
% type - best hand category (0... |
% "I discussed this homework problem with Tim Gong.
% I certify that the assignment I am submitting represents my own work. Tien Li Shen"
% Tien-Li Shen, 03/6/2018, HW5, ID:30930512
%The get_limit function caused my a lot of confusion but I eventually got my
%code to work, although at some places I lost track of... |
clear all;
clc;
disp('NR method for 3bus system');
%defining the ybus elements
Y11=7.5; Y12=2.5; Y13=5;
Y21=2.5; Y22=5.8; Y23=3.33;
Y31=5; Y32=3.33; Y33=8.33;
t11=-pi/2; t12=pi/2; t13=pi/2;
t21=pi/2; t22=-pi/2; t23=pi/2;
t31=pi/2; t32=pi/2; t33=-pi/2;
%defining the known states
d1=0; v1=1.0; v3=1.01;
%Defining the pow... |
clc
clear
load LONG_20110518;
load LAT_20110518;
load Dust_301;
data = Dust_301;
data(isnan(data)) = 0;
x = LONG(1,:);
y = (flipud(LAT(:,1)))';
cLimLow = min(min(data));
cLimHigh = max(max(data));
altitude = 800;
alphaMatrix = ones(size(data))*0.75;
alphaMatrix(data==0) = 0;
kmlFileName = 'Dust... |
function [PointOfNearest,MinDistIndex] = Nearest(V,PointOfRand)
%UNTITLED2 此处显示有关此函数的摘要
% 此处显示详细说明
% 输入:当前图信息,顶点(2D)、采样点1*3
% 输出:列表当中和采样点最接近的点
global step;
X(1,:)=PointOfRand(1:2);
%提取V的列长
RowSizeOfV=size(V,1);
%初始化最小距离及索引
MinDist=step;MinDistIndex=RowSizeOfV;
for i=1:RowSizeOfV
X(2,:)=V(i,1:2);
% MinDist... |
function [masks,keepLocs] = maskGaussians( siz, M, width, offset, show )
% Divides a volume into softly overlapping gaussian windows.
%
% Return M^nd masks each of size siz. Each mask represents a symmetric
% gaussian window, the locations are evenly spaced throughout the array of
% size siz. For example, if M=2, the... |
% SVM_STRUCT_LEARN Calls the SVM-struct solver
% MODEL = SVM_STRUCT_LEARN(ARGS, PARM) runs SVM-struct solver with
% parameters ARGS on the problem PARM. See [1-6] for the
% theory. SPARM is a structure of with the fields
%
% PATTERNS:: patterns (X)
% A cell array of patterns. The entries can have any n... |
function problem8(mu, hw, part)
% Random data A is n by n by k tensor, X is n by n, b is k by 1
% rng(2018)
% A = randn(n,n,k);
% n = 2;
% k= 4;
% A = cat(3,[1 0 ; 0 0],[0 1; 0 0], [0 0 ;1 0], [0 0 ;0 1]);
% truth = rand(2,2);
% truth = truth' * truth;
% b = randn(k,1);
% Set up A and b
a1 = [1;... |
function SaTC3_Funcprepro(s)
%Accepts subject number as input. Conducts slice timing, realignment, and
%coregistration for SaTC.3 functionals
% Adapted from ETS Scripts written by Crystal Reeck
% Composed by Anthony Resnick 6/08/2017
% Test Data: Epi tests, and sub990 scans
% Subject Data: Our subjects to be ... |
% author: Nicolas Chenouard, nicolas.chenouard@epfl.ch
% part of the monogenicTk
function [maskHP maskLP] = halfSizeEllipsoidalMask(w,h,d)
c0 = [ceil((w+1)/2), ceil((h+1)/2), ceil((d+1)/2)];
yramp = [(1:c0(1))-1 (w:-1:(c0(1)+1))-c0(1)].^2;
xramp = [(1:c0(2))-1 (h:-1:(c0(2)+1))-c0(2)].^2;
zramp = [(1:c0(3))-1 (d:-1:(... |
function img = max_proj_maker(mov_nm,varargin)
if nargin == 1
write = false;
else
write = varargin{1};
end
filename = [mov_nm(1:end-4) '_max_proj.tif'];
mov_sz = [size(imread(mov_nm)), length(imfinfo(mov_nm))];
sum_img = zeros(mov_sz(1:2));
if exist(filename,'file'), delete(filename); end
for fr = 1:m... |
function [error] = Error(arr)
a=1;
b=0;
z=1;
for i=2:length(arr)
if(arr(i)==a)
if(arr(i-1)~=b)
err(z)=i;
end
elseif(arr(i)==b)
if(arr(i-1)~=a)
err(z)=i;
end
end
z=z+1;
end
z=1;
for n=1:length(err)
if(err(n)~=0)
error(z)=err(n);
... |
function number = matching(DB,Query,q)
%単純マッチング関数(関数Mファイル)
%クエリ画像XとDBの画像をピクセル毎に比較し、二乗誤差が最も小さい人物を出力する
X = Query(:,:,q);
dblX = double(X);
for i=1:200
A = DB(:,:,i);
dblA = double(A);
D = (dblX-dblA).^2;
distance(i) = sum(sum(D));
end
[minimum, index] = min(distance);
number = ceil(index/10)-1;
%sprint... |
%% function to plot the frequency spectrum of some property with time...
function pfreq(p)
clear all
p = 4; % choose the thing to look at eg. max(abs(u,v,p)) for 4,5,6
% load data
A=load('TIME');
% find moment of impact (max vert velocity)
[a,b] = max(A(:,5));
A(1:b,:) = [];
b
% take the fft of the property A(:,p)... |
function [w,ib,wE_A,wE_B,wE_C]=WeightMap1(A,B,C)
%Each value represents a member of {region,color}
R=linspace(1,9,9);
%Calculates weight
for i=1:length(R)
for j=1:length(R)
delR=0;delCol=0;
if i==j %if same region and color
delR=1;delCol=1;
%if same c... |
function value = estimator_EX(probes)
size = length(probes);
value = sum(probes)./size;
end |
%Function finds index of start and end points of sample given prespecified start and end dates
%Dates has to be on format yyyyMMdd
%SampleDates must be of format double and must be datetime object
%If Start date is only a month, nDigits = 2
function [StartIndex, EndIndex] = findStartAndEndIndex(SampleDates, Desir... |
function [] = plot_result(Mrange,Fopt,title_plot)
% Draw a plot of muscle forces against joint torque
figure % start new figure
plot(Mrange,Fopt,'LineWidth',2)
set(gca,'Fontsize',20,'LineWidth',2)
xlabel('Joint torque [Nm]')
ylabel('Muscle force [N]')
title(title_plot)
legend('F1','F2','F3','location','northwes... |
function [isLooping,solusi] = termination(populasi)
[best_solution,~] = final_selection(populasi);
clc
best_solution.gen
if best_solution.fitness > 82.9
isLooping = false;
else
isLooping = true;
end
solusi = best_solution;
end |
function figurearchivify(figname)
%% figurearchivify(figname)
system('mkdir -p archive');
sprintf('figure creation archiving is on ...\n');
tmpcommand = sprintf('cp %s.pdf archive/%s-%s.pdf;',figname,figname,datestr(now,'yyyy-mm-dd-HH-MM-SS'));
fprintf(1,'archiving figure ...\n');
system(tmpcommand);
|
%@(#) findefph.m 1.2 94/08/12 12:15:05
%
function [efph,cycles]=findefph(unit)
if nargin<1,
reakdir=findreakdir;
else
reakdir=['/cm/',lower(unit),'/'];
end
|
function [imp_vert,crst,ip_vol,P]=CddAntiImputationSimplexVertices(v)
% CDDANTIIMPUTATIONSIMPLEXVERTICES computes all vertices of the anti-imputation set of game v,
% whenever the anti-imputation set is essential. Projection method is simplex.
% The cdd-library by Komei Fukuda is needed.
% http://www.cs.mcgill.ca/~f... |
function show(coordinates,elements,uh)
subplot(1,2,1)
trisurf(elements,coordinates(:,1),coordinates(:,2),uh','facecolor','interp')
% subplot(1,2,2)
% trisurf(elements,coordinates(:,1),coordinates(:,2),u','facecolor','interp')
|
function varargout = select_channels(varargin)
% SELECT_CHANNELS MATLAB code for select_channels.fig
% SELECT_CHANNELS, by itself, creates a new SELECT_CHANNELS or raises the existing
% singleton*.
%
% H = SELECT_CHANNELS returns the handle to a new SELECT_CHANNELS or the handle to
% the existing si... |
function S = randsym(n,varargin)
% Random Symmetric matrices
S = rand(n)-0.5;
S = (S +S')/2;
if nargin == 2
c = varargin{1};
else
c = 5;
end
S = c*rand(1)*S; |
% This script experiments with sensitivity to ISI jitter with varying correlations
% in firing time.
% Correlation is varied in the following ways:
% 1) Epoch-based correlation is varied via the ratio of firing rate to
% epoch rate.
% 2) Template-based correlation is varied via the threshold.
% 3) Epoch-based a... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Description: plot Change of CC from the training to the test session (figure 4 in the manuscript)
%% Author: Xuelian Zang
%% Contact: zangxuelian@gmail.com or lianlian81821@126.com
%% Date: 15/10/2013
%%%%%%%%%%%%... |
function [m,other] = esvm_update_dfun(m)
%% Perform Distance Function learning for a single exemplar model. We
% assume that the exemplar has a set of detections loaded in
% m.model.svxs and m.model.svbbs.
% Returns: model [m] with updated classifier
% If no arguments are given returns the suffix '-dfun' and
% classi... |
%*************************************************************************%
% Main
%
% NOTE describe variables (especially SHOCKS) in dataset
%
% last change 8/17/2018
%
% Code by Brianti, Marco e Cormun, Vito
%*************************************************************************%
clear
close all
%Read main datas... |
function [y]=fun(k,x)
A=k(1);
t2=k(2);
y=A.*(exp(-x./t2)); |
function [bestcoordinates, bestsolution, bestCosts, rows, cols] = ...
positionsOfComponents_SA(components, ...
areaCosts,fR2D, applicationDigraph, eta, weightArea, ...
weightCommunication, maxIterations, initalTemperature, cooling, ...
output, useSDP, progress, progressPerStep, cheat, manualPlan)
cheat... |
%%precipfilter
%Function to filter a warm nose soundings data structure to only
%include the soundings from days where precipitation occurred.
%THIS IS A VERY ROUGH FILTER. This filter is set to be fairly lenient because
%Mesowest data does not always accurately represent precipitation
%start/end ti... |
clear all;
close all;
%% Spectrum & Phase modification - Pulse Shaping
%% Pulse obtention from OSA
% Se tiene que añadir función!!!
%% Input pulse from mode-locked laser
[temp_pulse,specrum,lambda,T,L] = input_pulse;
fwhm = ((max(T)-min(T))/length(T))*fwhm(temp_pulse);
%% Parameters
%% General
c0 = 3e8;
lc = 1550e-9; ... |
function [A] = sig_thre(B,T)
[s,v,d] = svd(B,'econ') ;
% v(v<T) = 0 ;
% A = s*v*d' ;
A = s*soft_thre(v,T)*d' ;
end |
%clear;clc;
%word='PortlandALL3000';
%word='RESCUE10000';
word='PortlandSTREET2000simu200to400';
load(strcat(word,'.mat'));
w=-2;
K0=.8;
theta=[0 0 0 .1]';
intercept=-5;
vars=zeros(7,1);
vars(1)=intercept;
vars(2)=K0;
vars(3)=w;
vars(4:7)=theta;
Top =50;
%Top = 15;
%limi = 14;
%endt = 26;
limi = 200;
endt = 400;
log... |
% Create trainingset
startingfolder='C:\Users\taavi\Dropbox\kool2\kool\2015sygis\deep learning\SUSig\VisualSubCorpus\';
[ fullFileNames ] = getfullFilenames( startingfolder );
ShowSig=0;
folder='C:\Users\taavi\Dropbox\kool2\kool\2015sygis\deep_learning\SUSig\images\';
trainingSet=[];
trainingSetLabels={};
trainingSetCo... |
function saida = mscost231(distancia, frequencia, hte, hre, ws, wb, hb, zona)
%
% FUNÇÃO PARA PREVISÃO DA PERDA DEVIDO À EXISTÊNCIA DE EDIFICIOS MULTIPLOS,
% DESDE O TERMINAL FIXO, ATÉ AO TERMINAL MÓVEL.
% USA O MODELO "COST 231-Walfich/Ikegami".
%
% Fonte bibliográfica: Principles and Applications of GSM
% ... |
function [stddevs, noisinessMatrix] = MarkNoisyData(patientnr, nightnr)
% AddPaths;
% eeglab;
% clearvars -except patientnr nightnr;
fprintf('*** Java memory is %f\n', java.lang.Runtime.getRuntime.maxMemory / (2^30));
LoadFolderNames;
LoadParams;
% load or generate std dev... |
% Calculated weighted P-wave velocity
function Vp = get_weighted_Vp(W, n, ...
rho_bulk, ...
rho1, V1, C1,...
rho2, V2, C2,...
rho3, V3, C3,...
rho4, V4, C4,...
phi, Sh)
... |
function fname = makefname(tag,type,chip,SILENT,ndigits)
%
% fname = makefname(tag,type,[chip,SILENT,ndigits])
% Generate a standard filename for a given tag deployment
% and file type. Optional chip number is used for SWV, AUDIO,
% GTX and LOG files.
% Valid file types are:
% RAW,CAL,PRH,AUDI... |
% surrogate clusters
%% Calculate surrogate clusterings and assess cluster quality
%define the proportion of the data set to use
prop_data = 0.9;
%define the number of surrogates
num_surr = 20;
%fourier cluster?
four_clu = 0;
%allocate memory to store the indexes of the surrogates selected, the GMMs
%,the idx_clu of... |
function [mImageNew] = updateProjGradDescImage(mAdj, mImage, mMembership, fObjective)
%
% Updates mImage according to a projected gradient descent update rule.
%
%
% @author: Jeffrey Chan, 2013
%
% start off roughly in the scale of [0,1] for M
alpha = (size(mImage,1) / size(mAdj,1))^2;
beta = 0.1;
... |
function stimuli = selectStimForBubbles(folderName,numBestStim,genNum)
getPaths;
load([stimPath '/' folderName '_tempColFit.mat']);
m1 = mean(collatedRespLin1,3); s1 = std(collatedRespLin1,[],3);
m2 = mean(collatedRespLin2,3); s2 = std(collatedRespLin2,[],3);
[mb,sb] = getBlankResp(folderName,... |
function layout_obj = clwindcon_9_turb()
%CLWINDCON_9_TURB Summary of this class goes here
% Detailed explanation goes here
DTU10mwTurbType = dtu10mw;
D = 2*DTU10mwTurbType.rotorRadius;
locIf = {[19, 10.0];
[14, 10.0];
[9, 10.0];
[19, 5.0];
[14, 5.0];
[9, ... |
clear; close all; clc;
compare = true;
hmodel = true;
data_root = 'E:/Data/';
data_sequence = 'hmodel-matlab-data/figure_13_energy_terms/';
date_path = [data_root, data_sequence];
half_window_size = 15;
start_offset = 20;
end_offset = 80;
line_width = 1;
figure_size = [0.3, 0.3, 0.4, 0.4];
figure_borders = [0.05 0.0... |
function xplus = g(x)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Matlab M-file Author: Torstein Ingebrigtsen Bø
%
% Project: Simulation of a hybrid system (bouncing ball)
%
% Description: Jump map
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function dist = Heuristic(src,targ)
dxy = abs(src-targ);
dist = min(dxy(:,2),dxy(:,1))*1.414+abs(dxy(:,2)-dxy(:,1));
end
|
%/**
% Данный скрипт рассчитывает коэффициенты спектрального разделения между
% сигналами полного выборочного множества и сигналами системы GPS при том
% условии, что фронтенд настроен на прием наших сигналов (полоса фронтенда
% равна полосе сигнала по нулям в теории; на практике в данном скрипте
% фильтр максимально... |
classdef TreeCutter < handle
properties
% mesh variables - initially the original mesh's, and get updated
% during the cutting.
V; %the vertices of the mesh
T; %the triangles
pathPairs; %seams.
cutIndsToUncutInds;
uncutIndsToCutInds;
%cut... |
%% |cmocean| documentation
% The |cmocean| function returns perceptually-uniform colormaps generated by Kristen Thyng. A
% detailed description of the cmocean project is available at <http://matplotlib.org/cmocean>.
%
%% Syntax
%
% cmap = cmocean('ColormapName')
% cmap = cmocean('-ColormapName')
% cmap = cmoc... |
function d = distance(v1, v2)
sum = 0;
for i = 1:length(v1)
sum += (v2(i) - v1(i))^2;
endfor
d = sqrt(sum);
end
|
clear all
close all
clc
warning off
%%
% We load original tensor field:
load T.mat
%Subsampling factor:
inc=2;
[I,J,F,C]=size(T);
train_dat=zeros(I,J,F,C);
%Grid size or patch size, max_grid must be an even number:
max_grid=10;tam_grid=max_grid/inc;Ndatos=tam_grid^2;
desp=0;desp2=0;
%Training field:
... |
%% Introduction
% EXEM: EXEM
% EXEM on GZSL: EXEM_GZSL
%% EXEM Demo for 'AWA'
datasets = {'AWA', 'CUB', 'SUN', 'AWA1_SS', 'AWA1_PS', 'AWA2_SS', 'AWA2_PS', 'CUB_SS', 'CUB_PS', 'SUN_SS', 'SUN_PS'};
i = 5;
%% Path
cd ./EXEM/codes
%% Parameters setting
test_type = 'acc_seu'; % or 'acc_eu'
if i > 3
opt.C = 2 .^ (-5 ... |
function Aposta = AIRandom(Variavel)
Result = sum(randi([0 1],1,8));
if Result == 4
Aposta = 0;
elseif Result == 3 || Result == 5
Aposta = Variavel.Call;
elseif Result == 2 || Result == 6
Aposta = Variavel.Call + Variavel.ApostaMinima;
elseif Result == 1 || Result == 7
Aposta = min([ Variavel.Call+4*V... |
P_initial_profile=PTOT_profile_interp_ini;
load('NBI_Phot_data.mat')
Bavg=Bphi0
% Bphi0=Bavg;
Te_profile=TE_profile_interp_ini*eV;
Ne_profile=NE_profile_interp_ini;
Ne0=NE_profile_interp_ini(1)
Te0=TE_profile_interp_ini(1)*eV
r_value_q1_mean=interp1(q_initial_profile,radial_r_value_flux,1)
%
Btot_PR_map=sqrt(BX_PR_m... |
function distHist2(dist1,dis)
|
function selectFlyThermalInds(thermalCam)
disp('time to label those pixels! woo WOO')
metaData.thermCalc = [.0051 -75.5];
thermalFrame = getsnapshot(thermalCam);
sizeFrame = size(thermalFrame);
temps_C = double((thermalFrame*metaData.thermCalc(1)) + metaData.thermCalc(2));
i... |
% Adapted from the code available here (Yoann Ladroit):
% https://github.com/kakearney/cptcmap-pkg/tree/master/cptcmap licence
% under
% The MIT License (MIT)
%
% Copyright (c) 2015 Kelly Kearney
%
% Permission is hereby granted, free of charge, to any person obtaining a copy of
% this software and associated docum... |
function Ia = faultDetectedParameterMachine(Va,Suns,TaC)
k = 1.38e-23; % Boltzmann constant [J/K]
q = 1.60e-19; % Elementary charge [C]
n = 1.2; % Quality factor for the diode []. n=2 for crystaline, <2 for amorphous
Vg = 1.12; % Voltage of the Crystaline Silicon [eV], 1.75eV for Amorphous Sili... |
function [bestc,bestg,best_fold,bestcv] = svm(X,Xt,Y,Yt,fold_range)
% INPUTS:
% X num_samples-by-genes matrix
% Y column vector of length num-samples containing data labels- healthy =
% 0, disease = 1
% Extract important information
labelList = unique(Y);
NClass = length(labelList);
[N D] = size(X);
% normalize distr... |
function [v] = dXd(t)
global R deltaR f phi
t = t + phi;
r1 = 20*pi*f*deltaR*cos(20*pi*f*t);
r2 = (R + deltaR*sin(20*pi*f*t));
v = [ r1.*cos(2*pi*f*t) - 2*pi*f*r2.*sin(2*pi*f*t)
r1.*sin(2*pi*f*t) + 2*pi*f*r2.*cos(2*pi*f*t) ];
%v = [ -2*pi*f*R.*sin(2*pi*f*(t + phi))
% 2*pi*f*R.*cos(2*pi*f*(t... |
function [ ] = test2( vis, compressIndex, totalNum )
%TEST2 Summary of this function goes here
% Detailed explanation goes here
row = zeros(1, totalNum);
for i=1:length(vis)
row(1, vis(i)+1) = 1;
end
column = zeros(totalNum, 1);
for i=1:length(compressIndex)
column(compressI... |
function [EM,EL]=addmout(L,evens)
% addmout.m returns spherical harmonic degree and order indexing arrays.
% For arrays where m=-l:l
%
% INPUT:
%
% L Maximal degree of the expansion (bandwidth)
% evens 0 For all degrees [default]
% 1 Only do the even degrees
%
% OUTPUT:
%
% EM Vector of orders ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.