text stringlengths 8 6.12M |
|---|
function [enz_pro_stress_comp,enz_pro_stress_tot]=cal_enz_pro_stress(monomer_mic_complex_matrix,eff_mic_surface,par_ss)
%usage
%compute enzyme production stress
%
%Input arguments
%monomer_complex_matrix: the monomer binding matrix, nomonmers x nmicrobes
%eff_mic_surface: effective transporter surface to adsorb monomer... |
classdef TrajectoryHelper < handle & matlab.mixin.Copyable
%TRAJECTORY Encapsulates trajectory functionality
% Detailed explanation goes here
properties
end
methods
% Constructor
% Initializes the trajectory from a timeseries
function obj = TrajectoryHel... |
%Excercise_116%
%Date: 09/17/2012
%Author: Jason Hsu
%%%%%%%%%%%
%Variables%
%%%%%%%%%%%
trachea_radius=1.0;
trachea_airflow=110;
bronchi_radius=0.45;
bronchi_airflow=11;
air_density=1.29;
massfraction_oxygen=0.21;
massfraction_nitrogen=0.79;
viscosity=1.84e-4;
molarmass_o2=32;
molarmass_n2=28;
pi=3.14159265359;
%%%%... |
function [dy] = f_funcionesRepaso(x,y)
%UNTITLED5 Summary of this function goes here
% Ecuacion Diferencial
dy = [y(2); y(3); y(4); y(5); 2*y(5)-14*y(4)+3*y(3)-8*y(2)+y(1)+x];
end
|
function [p,asset_n,mu,rvar,pvar] = compute_stats(price_file,st_row,end_row,priceFreq)
% this function reads and returns prices from st_row to end_row for each asset,
%computes the (continuosly compounded) returns and returns their first two moments
A= load_matrix(price_file,',');
asset_n = length(A(1,:));
rvar=0... |
% Perceptron para resolver treinar portas lógicas
% laranjas e tangerinas
clear;close all;clc;
% Padrão de entradas
bias = -1;
x = [0 0 bias; ...
0 1 bias; ...
1 0 bias; ...
1 1 bias];
% Desejado
d = [0 ... % Teste com AND
0 ... %
0 ... %
1]; %
eta = 0.05;
w = rand(3,1);
u = zero... |
function idx2=get_full_idx(indice)
temp=0;
app=[];
test=[];
for j=1:length(indice{1})
app=[];
test=[];
temp=0;
for i=1:length(indice)
tapp=indice{i}(j).app ;
ttest=indice{i}(j).test;
app=[app;tapp+temp];
test=[test;ttest+temp];
temp=max(temp,max(app));
... |
function SetDisturbances( tController )
% get the initial condition for the optimization problem from the server.
% In thiss simple version these are set to see if the optimization
% problem is solved correctly.
%
try %
%
%------------------------------------------------------------------
% preliminary oper... |
function [ bands ] = fft_critical_bands( version )
%[ bands ] = critical_bands( version )
% version is either 'basic' or 'advanced'
% ITU-R BS.1387-1 Section 2.1.5
% Can be used to generate the frequency tables shown in Table 6 and 7
global debug_var
if debug_var
disp(' Critical Bands')
end
f_low = 80;
f_hi... |
% Leslie T Rose
% Rankine Body Solver for Exam
fun = @rankineSolver; % create an anonymous function for
x0 = [0.1,0.1]; % initial guesses for the solver
x = fsolve(fun,x0) % calll fsolve and solve for Gamma and a
function [F] = rankineSolver(x)
%rankineSolver(x) used to find gamma and a of rankine body
% x(1) = a... |
%% compare all repeats of each experiment or each separately
clear all
%Path = '/Users/julia/Google Drive jf565/comp MS2/OnOff/';
MetaFile = '';
MetaFile = ' enhprom';
%MetaFile = ' ecNICD';
MetaFile = ' mutBG';
%MetaFile = ' margherita';
%MetaFile = ' 2c';
%MetaFile = ' other';
Path = ['/Users/julia/Google Drive ... |
base = '/Users/scholl/geo_uzh/';
dataPath = 'data/KantonAargau/LeafOff/';
file = '628000_268000';
fileLAS = [base dataPath file '.las'];
matFile = [file '_leaf_off.mat'];
dtmPath = [base dataPath 'DTM_628000_268000.tif'];
rasStatPath = [base 'data/KantonAargau/Mat_Files_Statistics/raster_statistics/' file '_comb_ras.ma... |
function [FileList_raw, BasePath_raw] = ReadRawImgInfo(FilePath_Raw, DefaultFileSpec_Raw)
DefaultPath = '.';
[FileList_raw, BasePath_raw] = LFFindFilesRecursive( FilePath_Raw, DefaultFileSpec_Raw , DefaultPath );
fprintf('Found :\n'); disp(FileList_raw);
end |
function fact=fact_murphy(temp,enz_par)
%enz_par(:,1)
%enz_par(:,2)
%enz_par(:,3)
x3=-46.0+30.*(1-1.54.*enz_par(:,1).^(-0.268)).*enz_par(:,3);
fact=1./(1+exp(-enz_par(:,1).*(enz_par(:,2)-...
18.1.*temp+x3.*(temp-373.6-temp.*log(temp./385.2)))./(8.314.*temp)));
end |
% % ---------------------------------------------------------------------- %
% % OCR: Features
% % Author: Atul Dhingra
% % dhingra[dot]atul92[at]gmail.com
% % Last Editted: 25 Nov 2015
% % ---------------------------------------------------------------------- %
% %% Ideas:
% %Each digit is 28x28 pixels, and each face/... |
function [xd,xdd,phi,phit] = posizionamento_iniziale(Qdes,Q0,t)% Q0 è la posizione iniziale che è quella allineata
p_finale=[35, 25];
p_iniziale=[53, 0];
ti=0;
tf=5;
A=[ti^3 ti^2 ti 1;
tf^3 tf^2 tf 1;
3*ti^2 2*ti 1 0;
3*tf^2 2*tf 1 0];
B= [0 ;norm(p_finale-p_in... |
%% Function to import stress-strain data
function [strain, stress]=importSTR(pname)
data = importdata([pname '\STR_STR.OUT']);
strain = data.data(:,1);
stress = data.data(:,2);
|
function bpmreading = bpm_process(bpmorbit,rel,tel,trand)
%BPM_PROCESS Compute BPM readings from the closed orbit
%
%BPM_READING=BPM_PROCESS(BPM_ORBIT,REL,TEL,TRAND)
%
%This function returns BPM readings from particle coordinates and transformation
%matrices generated by BPM_MATRICES
%
%INPUTS:
%BPM_ORBIT: 2xN arra... |
% GLG
%
% Files
% compute_moments1D - Compute moments of noise free wavelet coefficients
% compute_moments2D - Compute moments of noiseless wavelet coefficients
% EM_root - The EM algorithm for the top level of the GLG model for 1D signals
% EM_root_exact - The EM algorithm... |
%%
cd C:\Users\Cedric\Documents\SD.git\trunk\user_sandbox\Cedric\Simulation\BPSK_controller_Modulator
%%
clc; clear;
FILE = 'TXData.txt';
delimiterIn = '\t';
headerlinesIn = 1;
TX = importdata(FILE,delimiterIn,headerlinesIn);
clear delimiterIn; clear headerlinesIn;
%%
figure(1)
clf;
plot(TX.data(:,2), TX.d... |
function [scoreArray] = score(normalizedSpectraLocal, correctedSpectraScoreLocal, xScaleLocal)
[xGrid, yGrid, zGrid] = size(correctedSpectraScoreLocal);
% Construct score array
scoreArray = zeros(xGrid, yGrid);
scoreContributions = zeros(zGrid, 1);
lowerFingerprint = 1300;
lowerMidFingerprint = 2300;
upperMidFingerpr... |
clear all;
close all;
R1 = 4;
R2 = 2;
R3 = 3;
L = 1.6;
C = 0.25; |
% Task 1: training on 22*8, testing on the final 9. Performance evaluated
% using log2(p)
% decide which dataset to take
dataSelection = 1;
if dataSelection == 1
%AFL:
load matchOutcomeAFL;
matchOutcome = matchOutcomeAFL;
elseif dataSelection == 2
load matchOutcomeHalo;
matchOutcome = m... |
function firFig = FIR_plot(means, SEMs, ROI, condition, hemi, func, subj_name, runNums, xlims,ylims,xTick,xLabels)
% firFig = FIR_plot(means, SEMs, ROI, condition, hemi, func, subj_name, runNums, ...
% xlims,ylims,xTick,xLabels)
%
% Plots FIR.
%
%
%
% Input arguments:
% ================
%
% means : means values to p... |
run(global_var_file);
for indm=1:length(all_sc_m)
sc_m=all_sc_m(indm);
sc_n=sc_m-1;
% here the length scale adopts a=2.46A = 1
tbh_filename_here = ['TwBLG_BZscan_',num2str(sc_m),'_',num2str(sc_n),'_' interlayer_model '-inter'];
kp_filename_here = ['TwBLG_EffKP_',num2str(sc_m),'_',num2str(sc_n),'_... |
function [v a Ter] = ezDiffusion(Pc, VRT, MRT, s)
%EZDIFFUSION returns the 3 paramaters of the ez Diffusion model:
% drift rate (v), boundary seperation (a), and non-decision time (Ter)
% 3 required inputs:
% Pc, percentage correct
% VRT, variance of response time
% MRT, mean response time
% s(optional), defaults to ... |
function model = fnc_jointCoord_TibiaR (model,DoF_Types)
% Bone Mesh Female Toolkit
% Licensed under the zlib license. See LICENSE for more details.
talocrural_r_pointMedial = ...
model(8).vertices_global(model(8).LandmarkIndices(3),:);
talocrural_r_pointLateral = ...
model(10).vertices_global(model(10).Landm... |
%% 20180115, 23340, (2d76923)
Params1 = linspace(0.1, 800, 51) * 1e-6; %Ax1
Params2 = linspace(0.1, 400, 51) * 1e-6; %Ax2
Params3 = linspace(0.1, 400, 51) * 1e-6; %Ax3
clear o;
o(1).Params = Params1;
o(1).ParamName = 'TCsRaman1';
o(1).ParamUnits = 'us';
o(1).PlotScale = 1e-6;
o(2).Params = Params2;
o(3).Params = Pa... |
function hF = showTif(d,c)
if nargin < 2 || isempty(c)
c = [min(min(min(d))) max(max(max(d)))];
end
imPos = [.05 .05 .9 .9];
barPos = [imPos(1) 0 imPos(3) .05];
hF = figure;
hA = axes('Units','normalized','Position',imPos);
[H,W,T] = size(d);
imagesc(d(:,:,1),c);
hA.XTick = [];
hA.YTick = [];
hA.NextPlot = 'replac... |
%% Dradown in the aquifer - one single storativity.
% This demonstrates the interpretation of a Drawdown in the aquifer
% with well-bore storage effect with Papadopulos and Cooper (1967) solution
%
% MIT License
% Copyright (c) 2017 Philippe Renard - University of Neuchâtel (CHYN)
%% Data preparation
% The data set ... |
function [pathExist] = advancedReactionManager(reactionOfInterest,stoichiometricMatrix,speciesReference,includedReactionPool,targetNode)
pathExist=0;
nReactions=size(stoichiometricMatrix,2); % number of reactions in the problem
nSpecies=size(stoichiometricMatrix,1); % number of species in the problem
r... |
disp('Velcome to 02421')
format compact
warning off
if strcmp(computer,'GLNX86'),
disp('Linux environment')
path('.',path);
path(path,'/home/nkp/matlab/ctrl');
path('/home/nkp/matlab/pol',path);
path('/home/nkp/matlab/vec',path);
path('/home/nkp/matlab/sys',path);
path('/home/nkp/matlab/sig',path);
p... |
function e = jacobi_ijk_nd( ndim, p, alpha, beta)
%
% jacobi_ijk_nd.m - Evaluate the inner product of n-dimensional
% Jacobi-chaos triplets
%
% Syntax e = jacobi_ijk_nd( ndim, p, alpha, beta)
%
% Input: ndim = dimensionality of the Jacobi-chaos
% p = order of the Jacobi-chaos
% ... |
% MC estimate of pi
clear; clc; clf;
n = 1000 ; % change to 100000
x = -1 + 2*rand([1 n]);
y = -1 + 2*rand([1 n]);
figure(1)
plot(x, y, 'r+')'
c = 0;
s = 0;
for i = 1:n
s = s+1;
if x(i)^2 + y(i)^2 <=1
c = c+1;
figure(2);
plot(x(i), y(i), 'r+')';
hold on
else
figur... |
%% Create list with catchment attributes per year
% goal: 3-d matrix with annual attributes (flow and climate) for complete
% water years
clc
clear all
% close all
%% load and analyse CAMELS data
file1 = strcat("C:\Users\sg16200\Local Documents\Camels\camels_attributes_v2.0\camels_attributes_v2.0\camels_hy... |
% Copyright 2018-2020, by the California Institute of Technology. ALL RIGHTS
% RESERVED. United States Government Sponsorship acknowledged. Any
% commercial use must be negotiated with the Office of Technology Transfer
% at the California Institute of Technology.
% ------------------------------------------------------... |
function hOut = TextLocation(textString,varargin)
l = legend(textString,varargin{:});
t = annotation('textbox');
t.String = textString;
t.Position = l.Position;
delete(l);
t.LineStyle = 'None';
if nargout
hOut = t;
end
end |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%% Affichage des résultats %%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%
%clf;
global IM
figure(1)
% axis([0 8 0 6]);
% hold on
%imagesc(0... |
function [q, kmat, fac_mat] = poly_sequence(ndim, p)
%
% poly_sequence.m -- returns the order matrix for multi-dimensional
% polynomials.
%
% Syntax: q = poly_sequence(ndim,p)
% [q, kmat] = poly_sequence(ndim,p)
%
% Input: ndim - dimensionality
% p - highest order
%
% Output: q -... |
function [img1] = myImageFilter(img0, h)
[m, n] = size(img0);
pad_w = (size(h, 1) + 1) / 2 - 1;
pad_h = (size(h, 2) + 1) / 2 - 1;
% Pad the img to the request: pixels lying outside the image boundary have
% the same intensity value as the nearest pixel that lies inside the image.
pad = [ones(pa... |
function [cycleBounds, NREMsegments, REMsegments] = getNREMcyc(sleep, win)
% Stephanie Greer and Jared Saletin
% Walker Lab, UC Berekeley 11/22/2010
%
% cycleBounds = getNREMcyc(sleep, win)
%
% Inputs:
% sleep = sleep data starting with the onset of sleep and ending with the
% epoch before the final awakening (i.e. SPT... |
function [p_value, t_value, df] = icatb_ttest(x, tail)
%% Compute one sample t-test of sample x
%
% Inputs:
% 1. x - Sample
% 2. tail - Options are 0 (two_tailed), 1 (right tailed) or -1 (left
% tailed)
%
% Outputs:
% 1. p_value - P value
% 2. t_value - T value
% 3. df - Degrees of freedom
% Convert x to column vector... |
function col = findQdecVar(Qdec,name)
% col = findQdecVar(Qdec,name)
%
% Gives the column of a variable in a Freesurfer's Qdec table that was read
% into the two dimensional cell string array Qdec. Returns empty if the
% variable is not in the Qdec table.
%
% Input
% Qdec: Two dimensional cell string array of Qdec da... |
function status = DAQmxSetAnlgEdgeStartTrigHyst(taskHandle, hysteresis)
[status]=calllib('mynidaqmx','DAQmxSetAnlgEdgeStartTrigHyst',taskHandle, hysteresis);
|
pwd
Ei200_uvw100_at110TPmod2Peaks();
Ei200_uvw110_at110TPmod2Peaks();
Ei200_uvw111_at110TPmod2Peaks();
% Ei400_uvw100_at110TPmod2Peaks();
% Ei400_uvw110_at110TPmod2Peaks();
% Ei400_uvw111_at110TPmod2Peaks();
|
function [ ] = fGeneratePowerValuesOneWavelength( X, Freq, Scale, IRef )
%f = figure;
MaxS = 8;
%PowerVals = zeros(MaxS + 1);
%PowerVals = {};
%Offset = 0:MaxS;
%TableVals = [];
fprintf('\nPower Values for One Wavelength\n');
for S = 0:MaxS
Ret = CalcRetOffset(X, S, Freq, Scale);
ModulatedReturn = IRef .* Re... |
clear all;
close all;
Nb = 240; %Número de bits, precisa ser múltiplo de 3 e de 8
numSamplesPerSymbol = 16; % Fator de superamostragem 16/amostra
span = 10; ... |
clc
close all
clear
%% ILT from data
[aq,sp1,sp2,sp3] = readTecmag('C:\Users\benjamin\Documents\Data\Diffusion\glycerol_liquid_n32_19June2014.tnt');
sp1 = real(sp1);
sp1 = reshape(sp1,32,256);
sp1 = sp1(1:size(sp1,1)-5,1:256);
specSum = sum(sp1);
specSum = specSum(5:end);
alpha = 5e8;% 5e8 for DI water, ... |
%% Visualize how the classifier works
load bag;
load trainedClassifier;
%[filename, pathname] = uigetfile('*.jpg;*.bmp', 'Pick an Image file');
%if isequal(filename,0) || isequal(pathname,0)
% warndlg('User pressed cancel');
% return;
%else
%disp(['User selected ', fullfile(pathname, filename)]);
... |
function [NC,A] = read_input_data (file_name_1, file_name_2)
file_1 = fopen(file_name_1,"r");
file_2 = fopen(file_name_2, "r");
NC = fscanf(file_1, "%d");
A = dlmread(file_name_2,' ',5,0);
fclose(file_1);
fclose(file_2);
endfunction
|
%problem 6
%preamble
clear all; close all; clc;
data=rand(1,10);
for i=1:length(data)
if data(i)<0.3
fprintf('The number :%.2f ',data(i))
disp('is small')
elseif data(i)>0.3 && data(i)<0.6
fprintf('The number :%.2f ',data(i))
disp('is average')
else
... |
%Cody opgaver from Lesson1
%% defining string vector
eVec = 'Hello';
%%defining a 5x3 matix with random characters in interval from(-3,3)
fMat = randi([-3,3],5,3);
%% Scalar Equation
a = 10;
b = 2.5*10^23;
c = exp(2*pi/3);
z = (log(c/b^a)*sin(a*pi/3))/abs(c-a)
%% Vector Equations//transpose of aVec
aVec = [3.14 15 ... |
% Initializes the parameters for the partial physics model and calls it
function [ spl_mic] = PartialPhysics(par_U, pos_vec, param)
[r,~] = size(pos_vec);
spl_mic = zeros(r,1);
for i = 1:r
param.pos_vec = pos_vec(i,:);
U0 = par_U(i,:);
% Calling the monopole_sim function to generate the press... |
function [mec] = campoDifractadoen(z,e,Bpsv,B_sh,m,f,N,mtrcs)
egammaN = zeros(f.nmax+1);
egammaP = egammaN;
enuN = egammaN;
enuP = egammaN;
coeffsPSV = zeros(4,f.nmax+1);
coeffs_SH = zeros(2,f.nmax+1);
alf = m(e).alfa;
bet = m(e).beta;
gam =((ome/alf)^2 - k2).^0.5;
nu = ((ome/bet)^2 - k2).^0.5;
[found] = find(ima... |
%% EECE 380 Motor Model
% Brad MacNeil 01/04/2015
% This document details all the parameters that were measured to model the
% motor that was built of EECE 380. The tests used to measure the given
% parameters are detailed in MotorTesting.m The parameters measured include:
% Armature Resistance, Armature Inductance, ... |
function idxClosest=ClosestPoint(PointCloud,ReferencePoint)
for i=1:length(ReferencePoint)
squareDiff=@(a,b) (a-b).^2;
SquareddistOnComponents(:,i)=bsxfun(squareDiff,PointCloud(:,i),ReferencePoint(i));
end
distToReferencePoint=nan(size(SquareddistOnComponents,1),1);
for j=1:size(SquareddistOnCompo... |
%this code studies the convergence to levy distribution for \mu = 1
row = 1e3;column = 1e2;
G = zeros(row,column);
for kk=1:row
Y = abs(cauc(b,column));
for jj=2:column
G(kk, jj) = Y(jj-1) + G(kk, jj-1);
end
end
G_mean = mean(G,1);
s = @(x) x.*log(x);
t = [0:column-1];
figure;plot([0:column-1],G_mea... |
function TTNspincorr2(L,w,tL,tR,groundL,groundR,fname)
% Two-Point spin Correlation function for tree tensor network
% input: Tree tensor network w, tensors below each leg tL & tR, which
% tensor connects to the ground on left or right groundL & groundR, file
% name fname.
% output: correlator corr, number of tensors i... |
function cellX = flipudCell(cellX)
% does flipud for every element of in the cell.
% SYNTAX:
% cellOut = flipudCell(cellIn)
%
% INPUT:
% "cellIn" is cell array containing elements to be flipped
%
% OUTPUT:
% "cellX" is the averaged array.
% by Weiguang (Gavin) Ding, September 2013
for i = 1 : numel... |
function [ output_args ] = getPatchIndices( m )
%GETPATCHINDICES Summary of this function goes here
% m - patchsize
end
|
function [retinalConeActivations, visualConeActivations, ...
withinConeAperturesRetinalConeImage, ...
withinConeAperturesVisualConeImage, withinConeAperturesGrid] = integrateConeImageWithinConeAperturesForDeconvolution(...
retinalConeImage, visualConeImage, coneMask, conePosDegs, coneAperturesDegs, thePSFsu... |
paths = ['common:', genpath('libs')];
addpath(paths);
run('vlfeat/toolbox/vl_setup');
if exist('matlabpool','file') && matlabpool('size') == 0
matlabpool open
end
% rng(1);
rows = 50;
n_space = 5;
cluster_size = 20;
subspace_dim = 10;
tic;
A = gen_depmultivar_data(rows, subspace_dim, cluster_size, n_space, 0.1... |
function expo = read_EXPO_NEV(expo,nev,valid,sync_channel,ns2)
%function expo = read_EXPO_NEV(expo,nev,sync_channel,ns2)
%
% read_EXPO_NEV takes expo and nev file data and produces a
% matlab structure with EVENTS and CHANNEL numbers. If a ns2 struct
% (from read_NS2) is passed, that is converted as well
%
%Example:
%... |
load mnist_49_3000
% Data preparation
n_x=x';
x_new=[ones(3000,1),n_x];
train_data=x_new(1:2000,:);
test_data=x_new(2001:3000,:);
y_trn=y';
for i=1:3000
if y_trn(i,1)==-1
y_trn(i,1)=0;
end
end
y_train=y_trn(1:2000,:);
y_test=y_trn(2001:3000,:);
size_train=size(train_data);
m=size_train(1);
n=size_trai... |
% load demo data
load('Data-R037-2003-09-04-TT07-CorticalCells.mat','T','WV','ClusterSpikes')
% create feature space
Fet = Create_FeatureSpace(WV);
% Show clusters and quality
figure('Name','Cluster Quality Demo')
plot(Fet(:,1),Fet(:,2),'.k','MarkerSize',1);
xlabel('Energy on channel 1'); ylabel('Energy on channel 2... |
function [ SUCCESS , ExperimentID, SubjectID, Phase, Box, MatlabStartDate,...
Duration, TSdata, Notes, Weight, Program, FileReportedUnits ]...
= TSload2ColWithHeader (filename,delimiter)
%
% Syntax: [ SUCCESS , ExperimentID, SubjectID, Phase, Box, MatlabStartDate,...
% Duration, TSdata, Notes, Weight, Prog... |
function [specCentroid] = mySpectralCentroid(xb, fs)
%% Audio Feature: Spectral Centroid
% This function extracts the spectral centroid for each block of audio
% in the input matrix xb.
% input:
% xb: (blockSize x numBlocks) float matrix, where numBlocks is
% the number of blocks
% output:
... |
function C = crosscorr(a, b)
if nargin == 1
a = (a - mean(a(:))) / std(a(:), 1);
b = a;
else
a = (a - mean(b(:))) / std(b(:), 1);
b = (b - mean(b(:))) / std(b(:), 1);
end
[Ma, Na] = size(a);
[Mb, Nb] = size(b);
m = [1:Mb, repmat(Mb, 1, Ma-Mb-1), Mb:-1:1];
n = [1:Nb, repmat(Nb, 1, Na-Nb-1), Nb:-1:1];
N ... |
% minimax: uses play_getChildStates and play_checkWin to find the best
% possible move according to the minimax strategy going n levels down
% returns the best possible move, given as index of the child states
% returned by play_getChildStates, and min and max values.
% returns 0 if there are no legal moves.
% va... |
% Copyright (C) 2012 Quan Wang <wangq10@rpi.edu>,
% Signal Analysis and Machine Perception Laboratory,
% Department of Electrical, Computer, and Systems Engineering,
% Rensselaer Polytechnic Institute, Troy, NY 12180, USA
%
% You are free to use this software for academic purposes if you cite our paper:
% Qu... |
function Z = interpolate( this_grid, this_grid_index, other_grid, other_grid_data, interpolation_method )
%INTERPOLATE (other_grid_data given on other_grid) on this_grid_index
%points given by flat indexing on this_grid.
assert( all( size(this_grid) >= size(other_grid) ), ...
'interpolation grid must have same or hi... |
function [] = trimmedTest()
%set seed for repeatability
rng('default');
rng(1);
data = [randn(100,2);randn(10,2)+repmat([-5,5],10,1)];
steps = 50;
m = zeros(steps);
med = zeros(steps);
trim = zeros(steps);
thres = zeros(steps);
stu = zeros(steps);
for x = 1:steps
x
for y = 1:steps
p = 2*[x/steps-0.... |
XY1 = load('datos.txt');
XY2 = load('Perfil_inf.txt');
X1 = XY1(:,1);
sz = size(X1);
l = sz(1);
spline = ReturnSpline(XY1);
spline2 = ReturnSpline(XY2);
title('Spline')
hold on
for i = 1:(l-1),
range = X1(i) : 0.1 : X1(i + 1);
graph = EvalSpline(spline, i, X1, range);
graph2 = EvalSpline(spline2, i, X1, ran... |
function [] = testFile(dataIn, titleName)
%% rate vs table's size analisys
rates = [];
for tableSize = 2.^(11:16)
[compressed_bits, rate] = compressionTestLZW(dataIn, tableSize);
rates = [rates rate];
ilzw = decompressionTestLZW(compressed_bits, tableSize);
error = sum(abs(i... |
function obj = loadobj(s)
% Create an MoDT object based on a struct created by saveobj()
% obj = loadobj(s)
%
% This method is called by MATLAB when loading an object from a .mat
% file, but you can also use this for your own serialization purposes.
% See also: MoDT/saveobj
% Get a list of all of the fieldnames
stru... |
function rho12=rho12(h)
sldata;
limitpoints;
slopes;
rho12=rho1*(T12(h)/T1)^-(1+(g/(m12*R))); |
function newring=scalesext(ring,sextfam,scale)
%newring=scalesext(ring,sextfam,scale)
newring=ring;
ind=findcells(newring,'FamName',sextfam);
for j=1:length(ind)
newring{ind(j)}.PolynomB(3)= newring{ind(j)}.PolynomB(3)*scale;
end |
%%skewtIGRA
%Function to plot a skewT-logP diagram for a given sounding from a
%soundings data structure. For a general skew-T plotter, use skewT.
%
%General form: [] = skewtIGRA(snum,soundStruct)
%
%Inputs:
%snum: the index of the desired sounding (use findsnd to locate a
%sounding inde... |
% finds function evaluation for model below, used in veg_model_hom.m:
% periodic boundary conditions
% Zachary Singer, University of Minnesota - Twin Cities, 8/16/17
% b_t = b_xx + w*b^2 - b
% w_t = - w*b^2 + b + cw_x
% (matrix form)
% 0 = D2*b + w .* b.^2 - b;
% 0 = - w .* b.^2 + b + c*D1*w;
% Differen... |
function fig = spikesort(filenames,blockSize)
% This is the machine-generated representation of a Handle Graphics object
% and its children. Note that handle values may change when these objects
% are re-created. This may cause problems with any callbacks written to
% depend on the value of the handle at the time the ... |
function x = sor_fun(a, b, n, x0, e, w)
% a:系数矩阵
% b:右边向量
% x0:初始向量(列向量)
% e:精度
% w:松弛因子
% 最大迭代次数M
M = 100000;
m = 0;
x = zeros(n, 1);
while m <= M
m = m + 1;
for i = 1:n
sum_ax = 0;
for j = 1:i-1
sum_ax = sum_ax + a(i, j) * x(j);
end
for j = i+1:n
s... |
% front end to sub-object's select method
function vargargout=edit(object,index)
end |
function StdP10(AM,BM,alpha)
nCount = length(AM(1,:));%get the number of countries
pCIs = zeros(nCount,2);
npCIs = zeros(nCount,2);
mpCIs = zeros(nCount,1);
mnpCIs = zeros(nCount,1);
for i=1:nCount
[pCIs(i,:), npCIs(i,:)] = stdCIs(AM(:,i),BM(:,i),alpha);
end
mpCIs = ... |
function MouseMoveCallback(obj, event)
%function MouseMoveCallback(obj, event, S_TRG)
% F. Andrianasy, Ven13Aug2010, 22h25
global TRG_SCALE
global S_TRG
global A
global B
global UserData
%debug
%disp(sprintf('.. inside %s', mfilename))
% -----------------------------------------------
... |
function [X_best_rec, result] = capped_tensor_tnnr(M, omega, opts)
%--------------------------------------------------------------------------
% main loop of tensor completion based on truncated nuclear norm
%
% min_X ||X||_* - max tr(A * X * B') s.t. (X)_Omega = (M)_Omega
%
% Input:
% M - n1 x ... |
% Tow Thomas Bandpass Filter - Worst-Case Analysis (RSS, EVA, FMCA)
% File: c:\M_files\short_updates\TowThomaswca.m
% updated 11/16/06
clear;clc;
K=1e3;uF=1e-6; % Unit suffixes
% Component values
R1=200*K;R2=10*K;R3=20*K;R4=10*K;R5=20*K;R6=20*K;
C1=0.0159*uF;C2=C1;
%
Nom=[R1 R2 R3 R4 R5 R6 C1 C2]; % Place comp... |
% Calculates BICs for one model with more groups
% k is a scalar with the number of parameter in the model
% varargin are cell arrays with models to compare,
% the first one is the simulated value, the second is the experimental
% example usage:
% BIC = WCSTcalculateBIC(8,{WCST_indivStats,WCST_SIM_ALL_indivStats});
% ... |
function [D] = rf_ecc(E,visual_area)
% Calculates the receptive field size in degrees of visual angle for a
% given eccentricity (E), for a visual area (V1, V2, V3).
%
% Usage:
% [D] = rf_ecc(E,visual_area)
%
% D = degrees of visual angle
% E = eccentricty in degrees
% visual_area = 'V1' <defau... |
function translatedprotein = dna2protein(dnaseq,frame)
% Input a dna sequence and a reading frame and returns the corresponding
% protein sequence.
codondata = readtable('codons.csv');
aminoacid = table2array(codondata(:,1))'; %where amino acid sequences are in the table.
codon = table2array(codondata(:,2))'; ... |
THREE = 3;
EIGHT = 8;
% load data
d = load('data.mat');
x = d.data.train.x;
y = d.data.train.y;
test_x = d.data.test.x;
test_y = d.data.test.y;
% ********** Depth 1 **********
% train the Decision Tree and get the best feature
best_f = DT(x, y);
% apply this rule to the test set
NO = [];
YES = [];
NO_label = [];
YES... |
function docStr = documentclassmethods( Info, isDropdown )
%DOCUMENTCLASSMETHODS Return string vector of class method documentation
arguments
Info struct ;
isDropdown {valid.mustBeBoolean} = true;
end
% assert( strcmp(Info.mType, "classdef"), 'mFile is not a class' ) ;
docStr = [ "---" ; "## M... |
function cel = far2cel(far)
%FAR2CEL Convert temperature from fahrenheit to celsius
%
% cel = FAR2CEL(far) converts temperature from fahrenheit to celsius.
%
% See also CEL2FAR, FAR2RANK, FAR2KEL.
cel = (far - 32) / 1.8;
|
function y = real_to_fixpt(x,a,b)
%a=1;
% if nargin < 1
% a = 0;
% end
% if isempty(a)
% a = 0;
% end
%b=15;
% if nargin < 1
% b = 16;
% end
% if isempty(b)
% b = 16;
% end
% total bits
N = a + b;
y = [];
%S = 0;
for i = 1:length(x)
if x(i)>=0
d = dec2bin((x(i)*2^b),N);
else
... |
function [B,L,N,P] = gp_bwboundaries(BW,CONN)
% GP_BWBOUNDARIES Find boundaries of regions and holes in a logical image
%
% B = gp_bwboundaries(BW)
% [B,L,N] = gp_bwboundaries(BW,CONN)
%
% Inputs:
% BW h by w logical BWage
% Outputs:
% B cell array containing where each element B{b} contains a #... |
function [z_estim, dz, chi2_P, dev, a_lat] = fit_fpi_mpi_PQ_BK(search,myestim,parm)
addpath /Users/luigi/Work/lib/Matlab
global lec lec_flag out_flag onlyren Nf finV fpi_exp_FSE nnlo assumemaxtwist
%%% SCALE (only enters at higher orders)
r0_fm=0.454; % fm
m_rho_phys_ifm=770 / 197.3; % fm^-1
%%%%%%%%%%%%%%%%%% CHOOSE... |
function srsave(Flag)
%SRSAVE - Saves the storage ring setpoints and monitors to a file (same as getmachineconfig('Golden'))
%
% see help getmachineconfig for details
if nargin < 1
getmachineconfig('golden');
else
getmachineconfig(Flag);
end
|
%%
fieldSED = dlmread('sed.rpt','',23,0);
fieldFLVEL = dlmread('flvel.rpt','',23,0);
%%
surf = 'p';
if surf == 'p'
nodes = dlmread('periN.txt', '', 23,0);
coord = csvread('periCoord.txt');
else
nodes = dlmread('endN.txt', '', 23,0);
coord = csvread('endoCoord.txt');
end
%%
valsSED = zeros(length(no... |
function [r] = test_problem1(emax)
r = zeros(emax,3);
for i=1:1:emax
e = 0.1^i;
A = [0,e;-e,0];
B = [1-e,1;1,1+e];
r(i,1) = e;
r(i,2) = cond(A);
r(i,3) = cond(B);
end
|
function [Tree , decoupled_paths] = fast_dRRT(Qi,Qf,G,H,valid_indices)
connected = false;
Tree(1) = Node(Qi,ones(size(Qi,1),1));
V_last = 1;
%figure;hold on;
goal_idx = zeros(size(Qf,1),1);
for i = 1:size(Qf,1)
goal_idx(i) = Query_State(G{i},Qf(i,:));
... |
%(a)
m=5;
%i discover that the interval of t will cause different graph to be
%represented so i choose h= 0.1 to draw a clear and simple graph without
%missing any infoemation.
for t=0:0.1:50
v=-20*exp(-0.01*t.^2)*sin(20*pi*t+2*pi/5);
subplot(2,1,1);
xlabel('(a)');
plot(t,v,'.');
hold on;... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.