text stringlengths 8 6.12M |
|---|
function [] = mustBeString( A )
%% MUSTBESTRING Validate value is a string
%
% MUSTBESTRING is a validation function which issues an error if the
% input argument is not a string
%
% Usage
%
% [] = MUSTBESTRING( A )
%
% ### References ###
%
% See also
%
% <https://www.mathworks.com/help/matlab/matlab_prog/argument... |
function choiceProbability = predictionBrusovansky(valuesA, valuesB, cuesA, cuesB, validity, strategy)
% function choiceProbability = predictionBrusovansky(valuesA, valuesB, cuesA, cuesB, validity, strategy)
% implemented strategies are
% ttb: take-the-best on cue version of values
% tally: tally sum of number of ... |
close all; clear;
load('netTransfer-smallNetV4.mat');
net = netTransfer;
net.Layers
layer = 2;
name = net.Layers(layer).Name;
channels = 1:8;
I = deepDreamImage(net,layer,channels,'PyramidLevels',5);
%I = deepDreamImage(net,layer,channels);
figure
I = imtile(I,'ThumbnailSize',[128 128]);
imshow(rgb2gray(I))
titl... |
function [ aafInputs, ...
afOutput ] = ...
TransformSignals( ...
tEstimator, ...
tAirInletValveOpeningSignal, ...
tAirInletTemperatureSignal, ...
tAirInletCO2Signal, ...
tCentralVentilationPumpOpeningPercentage, ...
tRoomCO2Sig... |
%
% Classe de base pour les figures
%
% classdef CBasePourFigure < handle
%
% METHODS
% delete(tO) % DESTRUCTOR
% figFocus(tO)
% setFigModal(tO)
% setFigNormal(tO)
%
classdef CBasePourFigure < handle
%---------
properties
fig =[]... |
function [SMI_out, wSMI_out, PE] = SMI_and_wSMI(signal,sym_prob,kernel)
% ---------------------------------------------------------------------
% Data should be on the symbolic space
% - signal should be a matrix of (channels x samples)
% - sym_prob is the probability of the symbols in each channel
% should be a mat... |
function Yi = qinterp1(x,Y,xi,methodflag)
% Performs fast interpolation compared to interp1
%
% qinterp1 provides a speedup over interp1 but requires an evenly spaced
% x array. As x and y increase in length, the run-time for interp1 increases
% linearly, but the run-time for
% qinterp1 stays constant. For small-leng... |
function [ADJToCS] = AdjacancyToCS(CofDest,B)
row=0;
column=0;
for i=0:7
if ((CofDest(1,1)>=i*60)&(CofDest(1,1)<=(i+1)*60))
for j=0:7
if ((CofDest(1,2)>=j*60)&(CofDest(1,2)<=(j+1)*60))
row=j+1;
column=i+1;
end
end
e... |
%% remove table from image
function result_file = extractTableFast(filename,results_dir)
%% params
t_body = -200; %HU
rTable = 3;
%% RUN
fprintf('Remove table with t_body > %g...\n', t_body)
if ~isdir(results_dir)
mkdir(results_dir);
end
[~,case_name] = fileparts(filename);
case_name = strrep(case_name,'.nii',''... |
% Agilent_9000.m
% Stand-alone program template for taking data with Agilent 9000 Oscilloscope
% 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
scope_address = 'USB0::0x0957::0x900A::MY52370... |
function IV(model)
ramp=struct();
ramp.conditions={10,20,20};
ramp.globals.A=100e-6;
ramp.globals.J=0;
% cf(3);[e0,ef]=plotIVCurve(ramp,model);
% subplot(1,2,1);
%
% xlim([-60e-3,-20e-3]);
% ylims=ylim();
% line(xlim(),[0,0],'LineStyle',':')
%
%
% xrev=x_to_norm(e0,ef);
% ynot=y_to_norm(0,0);
%
% annotation('arro... |
function [bm, b] = lhist(y,m,labels)
%LHIST labelled histogram.
% [BM, B] = LHIST(Y,M,LABELS) plots the histogram for the elements in Y
% grouping them in M bins. In addition, this function accounts for the
% different elements that are present in each bin grouping them by
% LABELS. The data for the stacke... |
function [LCV,status]=LeastCoreVertices(clv,tol)
% LEASTCOREVERTICES computes the vertices of the least core of game v.
%
% Usage: [crv,fmin,status]=clv.LeastCoreVertices(tol)
%
% Define variables:
% output:
% Fields of LCV:
%
% crv -- Matrix of core vertices. Output is numeric.
% crst -- The core con... |
clc
clear all
close all
%% Get the desired position from user input
% Des_pose = zeros(3,1);
% Des_pose = input("Please input the desired position:\n");
%% The ode set point simulation of the model
%Consider our desired position is x,y,z = [3,1,2]
Des_x = 3;
Des_y = 1;
Des_z = 2;
Qi = zeros(1,3);
% Check wether the in... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
%
%
% Problem 8- Response of an ideal low pass filter to x(t)=2sin(30t)/(pi*t);
syms t w
td=.05;
B= 10;
H=exp(-j*w*td)*(heaviside(w+B)-heaviside(w-B));
w1=-50:.1:50;... |
function [limita_inf, limita_sup] = LimiteValProprii(d, s)
%Intrari:
% d = diagonala princiapal a matricei tridiagonale simterice
% s = supradiagonala matricei tridiagonale simetrice
%Iesiri: limitele radacinilor reale
%Fiind simetrica de forma oarecare (fiind matrice tridiagonala simterice putem sa aplicam teor... |
function varargout = colorcoding(varargin)
% COLORCODING M-file for colorcoding.fig
% COLORCODING, by itself, creates a new COLORCODING or raises the existing
% singleton*.
%
% H = COLORCODING returns the handle to a new COLORCODING or the handle to
% the existing singleton*.
%
% COLORC... |
function mid = binarysearch(x, A, left, right)
% Binary Search Algorithm
while left <= right
mid = round((left + right) / 2);
if A(mid) < x
left = mid + 1;
elseif A(mid) > x
right = mid - 1;
else
return;
end
end
mid = round((left + right) / 2);
end
|
function [dK, Jinv] = fittune2(newtunes, quadfam1, quadfam2, varargin);
%FITTUNE2 fits linear tunes of THERING using 2 quadrupole families
% FITTUNE2(NEWTUNES,QUADFAMILY1,QUADFAMILY2)
% [dK, Jinv] = FITTUNE2(NEWTUNES,QUADFAMILY1,QUADFAMILY2)
% Must declare THERING as global in order for the function to modify quadrup... |
function c = foo(a, b) %#codegen
% Copyright 2013 MathWorks, Inc.
c = a * b;
end
|
classdef Steffensen<handle
%INTERFACE Summary of this class goes here
% Detailed explanation goes here
properties
h = 'x(i) x(i+1) Error\n';
i = 1;
root;
gx;
iterations = 0;
maxIterations = 50;
eps = 0.00001;
fina... |
function incl = inclination(A,M,fc)
% incl = inclination(A,M,[fc])
% Estimate the local magnetic field vector inclination angle directly from
% acceleration and magnetic field measurements.
%
% Inputs:
% A is the accelerometer signal matrix, A=[ax,ay,az] in any consistent unit
% (e.g., in g or m/... |
function lambda = wave_length(voltage)
lambda = 12.2643/sqrt(voltage*10^3*(1+0.978476*10^-6*voltage*10^3));
end |
%0/1 Knapsack problem using Dynamic programming
n=5;
W=11;
clc;
w=[1 2 5 6 7];
v=[1 6 18 22 28];
j=1;
for i=1:n
V(i,j)=0;
end
for i=1:n
for j=2:W+1
if(w(i)==j||i-1==0)
if(w(i)==j&&i-1==0)
V(i,j)=v(i);
elseif(w(i)==j&&i-1~=0)
V(i,... |
%% 生成数据
clear
N = 40; %重伤人数
n = 320; %轻伤及未受伤人数
A=[]; %重伤群众情况
B=[]; %轻伤及未受伤群众情况
for i = 1:N
fg = false; %生成零矩阵
c = randi(3); % 产生不同受伤群众
if c<=1
%耗时范围
s=randi(2); %产生[1h,2h]之间的随机准备时间
m=1;
t = s+2 + randi(3); %... |
function [ wave ] = note2wave01( pitch, duration, fs )
wave = [];
for i = 1 : size(pitch,2)
f = 440*2^((pitch(i)-69)/12);
t = (0:duration(i)*fs-1)/fs;
if(size(wave,1) == 0)
wave = sin(2*pi*f*t);
else
wave = waveConcat(wave, sin(2*pi*f*t));
end
end
end
|
%% Softconstraint function test
syms z p f(z,p);
f(z,p) = (1 - tanh(z./p*3));
df = diff(f,z);
ddf = diff(f,z,2);
x = linspace(0,10000);
x_th = 2500;
subplot(3,1,1);
plot(x,f(x,x_th));grid on;
title('f');
subplot(3,1,2);
plot(x,df(x,x_th));grid on;
title('df');
subplot(3,1,3);
plot(x,ddf(x,x_th));grid on;
title('ddf'... |
function g = gconstImpact(xVec,parms)
[n,m]=size(xVec);
if n<m
xVec=xVec';
end
xSeg_minus = xVec( (1:parms.nVarSeg)+ (parms.totalKnotNumber-1)*parms.nVarSeg, 1);
xSeg_plus = xVec((1:parms.nVarSeg), 1);
gMat = zeros(2,parms.totalVarNumber);
gImpactPlus = gImpactPlusWraper(x... |
%% Problem Setup
clear all;
close all;
clc;
N=50; % Nodes
[A,B,C,E,D]=HB(N); % Setup heat bar
p.A = A; % 1x1 struct containing A and B
p.B = B;
x_start = zeros(N,1); % initial conditions
t_start = 0; % start time
t_stop = 1; % stop time
timestep = 1e-4; % time step
dt1=0.0001; % variable time step f... |
%computes modulation index
clear; close all; clc;
%load testing data
load('phase_amp.mat');
amp = double(amp);
phase = double(phase);
edges = linspace(-pi,pi,21);
%shifts = eegFS:10:7*eegFS; %circular shifts for surrogates
shifts = 0;
%MI = raw modulation index
%MInorm = normalized modulation index
[MI, MInorm] = ... |
% this file is to illustrate successful recovery for signal with
% s frequency compoents, the Hankel matrix has fixed dimension N by N
%
%
% J. Yi on 10/10/2017, jirong-yi@uiowa.edu
% n: # of times instance considered
% t: time instances considered
% nc: dimension of Hankel matrix
% m: # of samples
% s: # of exponen... |
function qstatt( )
%QSTATT Summary of this function goes here
% Detailed explanation goes here
%check if qstat command is missing
if system('command -v qstat -u \* >/dev/null 2>&1')
system('ssh shaggy "qstat"');
else
system('qstat -u \*');
end
end
|
% Puts the dataset in the workspace
function D = get_dataset()
D = load('..\..\CaliforniaHousingDataSet.txt');
for column = 1:size(D, 2)
D(:, column) = (D(:, column) - mean(D(:, column))) / std(D(:, column));
end
end |
function [xd,xdd,phi,phit]=planner_TOAD(punto, tempo, phi, t, circonferenza1, circonferenza2)
%[xd,xdd,phi,phit]=planner_TOAD(punto, tempo, phi, t, circonferenza1, circonferenza2)
%FUNZIONE UTILIZZATA PER IL MAIN PER OTTIMIZZARE I LINK
%mi definisco i parametri da utilizzare per la pianificazione della
... |
%% Test 1
clear all; close all; clc;
figure(1) %track of the motion of the shining point
%camera1
load('cam1_1.mat');
vidFrames1_1=vidFrames1_1(211:370,301:360,:,:);
[m,n,p,t]=size(vidFrames1_1);
for j=1:t
grayFrames1_1=rgb2gray(vidFrames1_1(:,:,:,j));
[I,J] = find(grayFrames1_1>253);
X1_1(j)=21... |
%
%Written by:
%Jonathan Lareau - Rochester Insititute of Technology - 2006
%programming@jonlareau.com
clear;
tic;
func = @JL_GET_FEATS; %Default function to use to generate features
funcArgs = [];
TrainDirs = [];
TestDirs = [];
VerDirs = [];
%Should we normalize the features...no real reason t... |
x = dlmread('.VFunctionEjeY.txt');
y = dlmread('.VFunctionEjeY.txt');
z = dlmread('.VFunctionEjeZ.txt');
h = plot3(x,y,z,"k-.");
waitfor(h); |
%--------------------------------------------------------------------------
%
% TEST CASE FOR RUNNING JB2008
%
% Last modified: 2018/01/27 M. Mahooti
%
%--------------------------------------------------------------------------
clc
clear
format long g
global const PC
SAT_Const
constants
load DE430Coeff.mat
P... |
function tableWithBacktestingES = ...
bcktstingexepshrtfall2pnl(ret, prices, ...
Var, tailvar, model, p, folder)
% this function obtains a table with the results
% from a ES's backtesting:
% we calculate the test2 following the Acerbi Paper:
% https://www.msci.com/documents/10199/22aa9922-f874-4060-b77a... |
function [g, h] = constraints(x)
g(1) = 10 - sqrt((x(1)+5)^2 + (x(2)-10)^2);
g(2) = 10 - sqrt((x(1)-5)^2 + x(2)^2);
h = [];
end |
% This function returns the affinity of a set of points towards clusters
function affinity = nnaffinity(points,clusters,err)
dim = size(points,2);
k = size(clusters,1);
n = size(points,1);
if size(clusters,2) ~= dim
error('Points and Cluster centers must be in same dimensions.');
end
numsamples = round(d... |
function raw2h5(basenm, ifr, varargin)
% @author M.Moriche
% @brief Function to transform one old frame to a
% hdf5 format frame
%
% @date 29-12-2013 by M.Moriche \n
% Documented
%
% @details
%
% NO OUTPUT
%
% MANDATORY ARGUMENTS
% - basenm:
% - ifr:
%
% OPTIONAL ARGUMENTS
% - path: path where the old fra... |
function printTrainBatch(data, params)
if params.isBi
printSent(2, data.input(1, 1:data.srcMaxLen-1), params.srcVocab, ' src input 1: ');
fprintf(2, ' src mask: %s\n', num2str(data.srcMask(1, :)));
end
printSent(2, data.input(1, data.srcMaxLen:end), params.tgtVocab, ' tgt input 1: ');
printSent(2,... |
clc
clear all;
global n Y_n_a Y_n_r Y_line_net reply voltage M M1 P_d_k ...
P_k_Max P_k_Min Q_d_k Q_k_Max Q_k_Min G_conn c2 c1 V_k_M V_k_m lcount
t0=tic;
n=input('Please Enter the particular IEEE Test Case You wish to run this Simulation for\nby indicating the number of buses.\nWarning:Valid Test Cases consist... |
function runAgainUnfinished(experiment, timebound)
% Function runs again instances of 'experiment' which did not successfully
% ended (according to png file) setting up time boundary 'timebound'
if nargin < 1
fprintf('ID of experiment has to be set!\n')
help runAgainUnfinished
return
end
if nargin < ... |
function [J grad] = nnCostFunction(nn_params, ...
input_layer_size, ...
hidden_layer_size, ...
num_labels, ...
X, y, lambda)
%NNCOSTFUNCTION Implements the neural network cost func... |
% Routine that evaluates the variation penalty.
%
% Author: RS
function pen = TV_penalty_eval(f)
beta = 1e-5;
diffv = sqrt( (f(2:end) - f(1:end-1)).^2 + beta );
pen = sum(diffv);
end |
function cpoints = axunits2figunits(points)
%convert points in current axis units into figure units in [0,1].
P = length(points);
axo = get(get(gcf,'CurrentAxes'),'Position');%get axes position on the figure.
xs = axo(1); ys = axo(2); xl = axo(3); yl = axo(4);
xls = get(gca, 'xlim');
yls = get(gca, 'ylim');
xu = xl/ab... |
function [Phi_Phi,Phi_F,Phi_R,A_e, B_e,C_e,BarRs]=mpcgain(Ap,Bp,Cp,Nc,Np)
%Augemented model (Ae,Be,Ce) from state space (Ap,Bp,Cp) model
[m1,n1]=size(Cp);
[n1,n_in]=size(Bp);
A_e=eye(n1+m1,n1+m1);
A_e(1:n1,1:n1)=Ap;
A_e(n1+1:n1+m1,1:n1)=Cp*Ap;
B_e=zeros(n1+m1,n_in);
B_e(1:n1,:)=Bp;
B_e(n1+1:n1+m1,:)=Cp*Bp;
... |
function [height length width heightSnPrn wl wr ... %wynikowe długości
heightP lengthP widthP heightSnPrnP wlP wrP... %prawdopodobieństwa
sex vaildDist validPt] = ...
noseDistances(prn, nasion, sn, lal, ral)
%Na podstawie informacji o punktach oblicza wymiary nosa wraz z
%prawdopodobi... |
function cap5ex6a()
printf(":::::::::::::::: CAPITULO 5 :: EXERCICIO 6 A ::::::::::::::::\n")
xI = 0
xF = pi/2
n = 2;
h = (xF-xI)/n;
x = xI : h : xF;
y = cos(x);
xPlot = xI : h*0.01 : xF;
yExato = cos(xPlot);
yPn = fGregoryNewton(n,x, y, xPlot);
erro = abs(yPn - yExato);
... |
function [ paths ] = randomPaths( s,t,s_list,g_list, path_count,invalid_nodes )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
paths = [];
valid_paths = 0;
invalid_paths = 0;
perc_valid = 0;
for i=1:path_count
rand_start = s_list(randi(length(s_list)));
% rand_goal = t_list(ran... |
function [ matches, scores ] = thresMatch( descriptors1, descriptors2, fraction )
% This funtion inputs two sets of descriptors. For each descriptor d1 in
% descriptors1, we calculate the Euclidean distances between all descriptors in
% descritptors2. Then, we compute the mean distance of d1.
% We match the d1 to the ... |
function varargout = TIEMPO_REAL(varargin)
%==========================================================================
% By: Frank Maldonado
% Juan Pablo Ramón
%==========================================================================
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_... |
function [channel,rx,a,noise_vector]=add_channel_muti_effect(channel,rx,signal_sequence,P);
%信道影响函数,并且能够找到信道增益与噪声方差2倍的比值,以便执行功率分配
global signal;
%channel.attenuation.d=1/(channel.attenuation.distance^2);%pass loss is constant for the whole transmittion
%switch channel.attenuation.pattern
% case 'no' %no fading at... |
%XOR Dataset overload
% $Id: xor.m,v 1.2 2006/03/08 22:06:58 duin Exp $
function c = xor(a,b)
prtrace(mfilename,2);
if isa(a,'dataset') & ~isa(b,'dataset')
c = a;
d = xor(a.data,b);
elseif ~isa(a,'dataset') & isa(b,'dataset')
c = b;
d = xor(a,b.data);
else
c = a;
d = xor(a.data,b.data);
end
c = set... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This file tests our method for image inpainting
clear; close all;
load LearnDict;
% Dl_lam_08 is a pre-learned dict
n = size(Dl_lam_08,1);
D = [ones(n,1),Dl_lam_08];
load boatmat.mat;
K = size(D,2);
[N1,N2] = size(X);
n1 = 8; n2 = 8;
m = round(0.50*N1*N2);
StPt = [1 1; 1 ... |
function help()
%CV.HELP display help information for the OpenCV Toolbox
%
% Calling:
% >> cv.help();
%
% is equivalent to calling:
% >> help cv;
%
% It displays high-level usage information about the OpenCV toolbox
% along with resources to find out more information.
%
% See also: cv.buildInformation
h... |
% Calculate the gravitational potential everywhere
% RhoAv = mean(Rho(:));
% DeltaX = (Rho - RhoAv)/RhoAv; % over-density in position space
DeltaX = Rho - 1;
global OmegaM; % IS THIS THE RIGHT OMEGA FOR THE GREEN FUNCTION?
global scalefactor;
% Determine the Green's function array for calculating phi
for l = 0:grid... |
function [] = Set_Parallel_Processing( Sim_Struct, Verbosity )
% Do not display warning regarding attaching files that were attached before
warning('off','parallel:lang:pool:IgnoringAlreadyAttachedFiles')
tic;
if ~strcmp(Verbosity,'None')
display('-I- Setting Parallel Processing parameters...');
end
% Enable p... |
function trackers=configTrackers
trackersVIVID={struct('name','CCOT','namePaper','CCOT'),...%gray-25%
struct('name','CFNet','namePaper','CFNet'),...%dark red
struct('name','CREST','namePaper','CREST'),...%Turquoise
struct('name','TADT','namePaper','TADT'),...%orange
struct('name','MCPF','namePaper','MC... |
function [d, R] = RealEigen(A, tolerance)
%REALEIGEN Computes the eigenvalues and eigenvectors of a real symmetric matrix A.
% Computes the eigenvalues and eigenvectors of a real symmetric matrix A to within some specified
% tolerance.
% Args:
% A (ndarray): Real n x n symetric matrix
% tolerance (float): th... |
% -------------------------------------------------------------------------
% Odvozeno z CSE QRS TESTER:
% VÍTEK, M.; KOZUMPLÍK, J.: CSE QRS TESTER; Software pro testování
% detektorů QRS na databázi CSE. Ústav biomedicínského inženýrství Vysoké
% učení technické v Brně Kolejní 2906/4 612 ... |
function [ ] = BS_AUG_RMP_main(PROCESS_NUMBER,N_PROCESS)
%%BS_AUG_RMP_main Determines the magnetic field of RMP field
% MAIN FILE
% Script to determine field of coils in AUG. Can store field of each coil seperately in RMP_map-struct.
% calls BS_AUG_RMP_load_coils to load in all coils from data in folder
% define ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% VIRTUAL EARTHQUAKES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% this script constucts the fundamental mode of surface wavesmakes virtual
% earthquakes from the ambient noise green
% te... |
% Question 3
% Part a %
%m = 5; % number of rows
%n = 3; % number of columns
%A = zeros(m,n); % initiate A as an m*n sparse matrix
%A(:,1) = ones(5,1);
%A(1,2) = 1; A(1,3) = 1; A(3,3) = 1;
for j = 1:n
for i = j+1:m
Q = eye(m, m);
theta = TD_angle([A(j,j), A(i,j... |
%simulator script to generate parameters and data for HSMM
clear variables;
clc;
%unique ID
ID = 50;
%number of observation symbols
Nobs = 6;
%% =============== TRUE PARAMETERS ========================================
%number of hidden states
Nhid_true = 3;
%maximum possible duration
Dmax_true = 5;
%minimum pos... |
function [ scribbles ] = freehand_scribble( scan, mask_gt,varargin)
%Manual scribbles
%Inputs
erode = true;
if nargin > 2; patient_num = varargin{1}(1); else; patient_num = -1; end
if nargin > 3; frame_num = varargin{2}(1); else; frame_num = -1; end
if nargin > 4; erode = false; mask_scribble = varargin{3}(1); end;
... |
function [ f ] = f19( D, params, noisy )
%F19 Composite Griewank-Rosenbrock Function F8F2
%
if nargin < 1
D = 2;
end
if nargin < 2
params = default_params(D);
end
if nargin < 3
noisy = 0;
end
f_opt = params{2};
R = params{3};
function [... |
vector = [1,2,3,4];
% Esto esta muy guapo lo de git
sum = 1 + 2; |
function dump_features(input_path)
% Load mat files
load('face_p99.mat')
load([input_path '/intermediate_results/facemap.mat']);
% Initialize variables
number_of_nodes = size(facemap,2);
appearance_features = cell(number_of_nodes, 1);
model.thresh = min(-0.65, model.thresh);
... |
function [T,I,Y]=naivePerfusionResponseIVomarP2X4(ton,toff,Ttot)
ode=modelODEomarP2X4(ton,toff);
naive=getNaiveomarP2X4();
setAuxiliaryomarP2X4(naive);
[T,Y]=ode15s(ode,[0 Ttot],naive,odeset('NonNegative',1:21,'MaxStep',0.01));
I=getTotalCurrentomarP2X4(Y);
end |
%Christoffel Symbol Attempt
% Define the metric and inverse metric:
g = [-(1-rs/r) 0 0 0 ; 0 (1-rs/r)^(-1) 0 0 ; 0 0 r^2 0 ; 0 0 0 r^2*sin(theta)^2]
ginv = g^(-1)
% Define the coordinates
coords = [t ; r ; theta ; phi]
G = zeros
for i = 1:4
for j = 1:4
for k = 1:4
for l = 1:4
G(i... |
function dcval = dSSE_proc_dc(coefs,bvals,pars,more)
if ~isfield(more,'more')
more.more = [];
end
m = size(bvals.bvals,2);
n = size(coefs,2);
devals = bvals.bvals *coefs;
ddevals = bvals.dbvals*coefs;
if isfield(more,'whichobs')
whichobs = more.whichobs;
else
whichobs = [];
end
if isfield(m... |
function [] = exportToSimpleWare(image3d)
%exportToSimpleWare a 3-D binary image to .bmp images for inputs in Simpleware and COMSOL
% Input Argument
% - image3D : a (ny*nx*nz) uint8 matrix, 3-D binary image of
% pore space (0 = pore, 1 = grain)
% Output Argument
% - [] : bmp ... |
function [D,g,SMM_struct] = SMM_dist_ehail(param, C, true_mom, Q, PI, U, eta, Perm, flag, print_flag)
cd C:\Users\jerem\Documents\MATLAB\ehail_model
load ehail_SMM.mat
beta = 1;
e = 1;
i = 0;
K = size(Perm,1)/4;
LL = [ll];
MU = [mu];
N_S = size(Q,1); % number of states
PP = zeros(N_S,73,7,4); % array t... |
cd(fileparts(mfilename('fullpath')));
close all hidden; clear; clc;
%% Enter Parameters
% Enter initial model parameters here
I=struct; % Initialization options
I.S.nSteps=80; % Number of Simulation Steps
% World Settings
I.W.houseIndex = 200; % Initial ... |
% MASTERFILE FOR TVP VAR MODELS TO GET IRFs, FEVDs and network connections
% from REGIONAL MODELS
% MODEL CONTAINS
% REGIONAL RETURNS (MW, NE, S, W) ILLIQ MEASURES (MW, NE, S, W), y, pi, r,
% u ,w, morg_r, hous_st, market_return, mkt_ILLIQ, EPU.
% Sample from 1985M1:2018M12 ALL DATA ARE MONTHLY
addpath('Res... |
% Script to implement the second order Taylor series method and explicit
% Euler to solve the model problem, namely the initial value problem
% y' = l*y, y(0) = y0
% 20/01/2019 Thulasi Mylvaganam
close all;
clear all;
%% DEFINE PROBLEM
l = -1; % l corresponds to lambda in the lectures
y0 = 1; % The initial v... |
function dataStructCell = loadSimDataStructCell(dataStructPath)
%加载模拟数据的的DataStructCells
dataStructCell = load(dataStructPath);
dataStructCell = dataStructCell.simulationDataStruct;
end
|
function varargout = hist(this,dataname,fields,nbins, hf)
% Check argins
DEFAULT_DRAW_OPTIONS = struct(...
'FaceAlpha', 0.5);
MAX_HIST_COLORS = 5;
HIST_COLORS = jet(MAX_HIST_COLORS);
if nargin < 5 || isempty(hf) || ~ishandle(hf)
% Prepare figure
... |
function [fdcomm_op, radar_op, cov_op] = tsp_DL_subgradient(fdcomm, radar_comm, radar, cov, jj, k)
%------------------Algorithm 1 (WMMMSE minimization)-------------------------------------------
%% initialization
J = fdcomm.DL_num;
td_max = fdcomm.td_max;
P_B_max = fdcomm.BS_power;
t = 1;
R_DL = fdcomm.R_DL; %... |
%% script to generate resting-state subtypes on prevent-ad scores
% regress out age, gender, mean_fd_scrubbed prior to subtyping
clear all
%% set up paths
path_data = '/home/atam/scratch/preventad_data/';
path_out = '/home/atam/scratch/adsf/rsfmri_subtypes_20160822/';
path_scores = '/home/atam/scratch/preventad_data/... |
function [is1, is2] = circleIntersection(A,B,ra,rb)
% A = [0 0]; %# center of the first circle
% B = [1 0]; %# center of the second circle
% ra = 0.7; %# radius of the SECOND circle
% rb = 0.9; %# radius of the FIRST circle
c = norm(A-B); %# distance between circles
cosAlpha = (rb^2+c^2-ra^2)/(2*rb*c);
u_AB = (B - A... |
function [] = pull2(paout,vaout,uout,tout,tplot)
global l
%work out heigts of the flow along
pmin=min(min(paout));
pmax=max(max(paout));
x=[pmin-10:0.01:pmax+10];
[e,~]=size(paout);
i=1:e;
tol=0.001;
m=ismembertol(tout,tplot,tol);
j=i(m)
for i=j
pall1=paout(i,:);
pall1=pall1(~isnan(pall1));
p=pall1(pa... |
function Hd = lowpass(Fs)
%LOWPASS Returns a discrete-time filter object.
% MATLAB Code
% Generated by MATLAB(R) 9.2 and the DSP System Toolbox 9.4.
% Generated on: 20-Dec-2018 09:48:21
% Butterworth Lowpass filter designed using FDESIGN.LOWPASS.
% All frequency values are in Hz.
%Fs = 48000; % Sampling Frequency
... |
% MATLAB implementation of a local SOM-based RBF time series predictor.
%
% Based on the prediction method described in the following paper:
%
% Barreto, G.A. and Souza, L.G.M. (2006).
% "Adaptive filtering with the self-organizing map: A performance
% comparison", vol. 19, pp. 785-798.
%
% Author: Gui... |
clear;
% Read round.png
RGB = imread('round.png');
% Convert to grayscale and black and white images
I = rgb2gray(RGB);
bw = imbinarize(I);
% Remove small objects < 30px from B&W image
bw = bwareaopen(bw, 30);
% Create morphological structuring element and close the image
se = strel('disk', 2);
bw = imclose(bw, se)... |
%% %%%%% Load data
load('simu_fig2_2sub_data1')
%% %%%%% Plot results of experiment 1 but only 2 subject
n=n/2;
subplot(5,2,1)
colors=[repmat([0.9,0.5,0.1],n,1);repmat([0.5,0.9,0.1],n,1)];
scatter(O(:,1),O(:,2),8,colors,'filled')
title('Scatter Plot of Samples')
xlim([-10 10])
ylim([-10 10])
subplot(5,2,3)
[f,xi]=ksde... |
function[x, cant,lamda ] = jacobi (A, b, xo, tol, maxit)
error=inf;
cant=0;
%Calcular D (matriz que contiene la diagonal de A)
D=diag(diag(A));
%Calcular L (matríz diagonal inferior, sin la diagonal)
L=-tril(A, -1); %La opc -1 elimina la diagonal
%Calcular U (matríz diagonal superior, sin la diagonal)
U=-triu(A... |
% 根据聚类结果向量clsVector,对每一类随机挑选5张进行显示
function randomShowClsVector(clsVector,imgData)
for j = 1:10
%显示clsVectorL1第j类中的的5张图片
%取出分类为j的图片的index
clsIndex = find(clsVector==j);
% 从clsIndex中随机选取5个index值
randIndex = randchoose(clsIndex,5);
for i = 1:5
%在j=6的时候新打开一个figur... |
function viewPreprocessedMovCellArray(movCellArray,clip_num,RF_size, start_RF_h, ...
end_RF_h, start_RF_w, end_RF_w, clip_length)
if nargin<2
clip_num=5;
end
if nargin<3
RF_size = 20;
clip_length = 8; %frames in each clip
start_RF_h = 55;
end_RF_h = 170;
start_R... |
%%This script allows you to find the center of mass of a grayscale
%%image. You need to enter the path of the image in the first line of code.
%%The program will then ask you to select the part of the image whose
%%center of mass is to be found.
%% The algorithm first finds the point of maximmum intensity for each ce... |
function set_ST(trans_obj,ST)
block_len=get_block_len(100,'cpu');
trans_obj.Data.replace_sub_data_v2('singletarget',-999,[],[]);
if ~isempty(ST)&&~isempty(ST.Ping_number)
[~,np]=trans_obj.get_pulse_Teff(ST.Ping_number);
idx_r=nanmin(ST.idx_r-nanmax(np)):nanmax(ST.idx_r+nanmax(np));
idx_r(idx_r<1)=1;
... |
%Iegustam attelu
clear
img=imread('ainava.jpg');
siz=size(img);
%no YCBR panem spilgtuma koef
R=img(:,:,1);
V=img(:,:,2);
B=img(:,:,3);
img_R(:,:,1)=R;
img_V(:,:,2)=V;
img_B(:,:,3)=B;
Y = 0.299*R+0.587*V+0.114*B;
img_Y(:,:,1) = Y;
img_grey=img_Y(:,:,1);
sizx=siz(1);
sizy=siz(2);
figure(5)
... |
function [ tau ] = torque( input_args )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
end
|
function [Weight_matrix, connection_count]=weight_equal(Weight_type, N,Percent_negative, Connect_strength, no_cluster)
% weight_type should be either one of these (random, uniform, chain, ring,
% small_world)
% NOTE: this function generates network with different no. of connections.
% Bridging connections... |
# Assembly of the projection problem
source "../tools/utilities/geometry_helpers_2d.m"
source "./total_least_squares_indices.m"
# camera matrix
#{
global K=[150,0,320;
0, 150,240;
0, 0, 1];
#}
global K=[150, 0 ; 0, 150];
# image_size
global image_rows=480;
global image_cols=540;
# dimension of projection... |
function [f]=trapecio(n,a,b,w)%w es un arreglo q dan, w(0)=0; w(1)=130;...
h=(b-a)/6;
s1=0;
for i=2:1:n-1
s1=s1+w(i)*(60-((i-1)*10));
end
f=10^3*9.8*(h/2)*(122*60+2*s1+0);
%w=[122,130,135,160,175,190,200];
%trapecio(7,0,60,w);
end |
function [score_train,score_test,numpc,coeff_train] = pca_getpc(train_x,test_x)
% input: original X for training and testing
% output: PCAed X for training and testing, number of PCs that you
% selected
[coeff_train, latent] = pcacov(train_x'*train_x);%covirance matrix?
score_train = train_x * coeff_train;
sco... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.