text stringlengths 8 6.12M |
|---|
d=dir('*.fig'); % capture everything in the directory with FIG extension
allNames={d.name}; % extract names of all FIG-files
close all; % close any open figures
for i=1:length(allNames)
open(allNames{i}); % open the FIG-file
base=strtok(allNames{i},'.'); % chop off the extension (".fig")
print('... |
% Function to construct a Q matrix for a given stationary state distribution
% Pi, the code assumes that Pi has no zero entries
function [Q, P, Pi] = setQMx(nState, statdistr, inpQ)
% Assumptions and modifications
% - assumes symmetric IPP and bimodal models only
% - inpQ is an input that controls the Q formulat... |
clear
clc
close all
%
% data = load('data2D.dat');
fileid = fopen('GlyerolWaterGd.pt2');
% owner = fread(fileid,4,'int8=>char');
% format = fread(fileid,4,'int8=>char');
% nrSubplotRows = fread(fileid,1,'int16');
% nrSubplotCols = fread(fileid,1,'int16');
% version = fread(fileid,4,'int8=>char');
%
% % fseek(f... |
figure()
plot(p(:,1), p(:,2))
title({strrep(modelName, '_', ' '), 'Trajectory'});
figure()
subplot(3, 1, 1)
plot(t, rad2deg(psi)); hold on; plot(t, rad2deg(psi_d)); plot(t, rad2deg(psi-psi_d))
legend('\psi', '\psi_d', '\psi error'); ylabel('Heading Angle (deg)')
title({strrep(modelName, '_', ' '), '\Psi, r and \delta_... |
function [d1,X1,Y1,f1,NFFT1,d2,g1] = FFT_MultiFrequency_update(s1,s2)
Fs = 31; % Sampling frequency
T = 1/Fs; % Sample time
L = 512; % Length of signal
t = (0:L-1)*T; % Time vector
% % Sum of a 50 Hz sinusoid and a 120 Hz sinusoid
% x ... |
n = -10:10;
x1 = mod(n,5);
x2 = sin((0.1).*pi.*n).^2;
[n3,x3] = operarFunciones(n,x1,n,x2,'MULTI');
stem(n3,x3);
|
function Yint=ntrp6c(f,Xint,x,y,yp,Fmid,varargin)
%NTRP6C New interpolation helper function for BVP6C.
% YINT = NTRP6C(F,XINT,SOL) interpolates the bvp6c solution SOL
% of ode system F to give solution values at new points XINT.
% Note, it is not necessary to pass F if the slope values SOL.YP
% and SOL.YP... |
function [pq] = priorityPrepare()
% This function returns a vector pq of structs with fields key and cost
pq = repmat(struct('key',[],'cost',[]),0,1);
end |
% (filename: triangle.m)
% The triangle function is a function of time 't'.
%
% triangle (t) = 1 - |t|, if |t| < 1
% triangle (t) = 0, if |t| > 1
% Usage y = triangle(t)
% t - must be real-valued and can be a vector or matrix
function y = triangle(t)
y = (1 - abs(t)).*(t >= -1).*(t < 1);
end |
clc;
clear;
close all;
format long;
%% Input Data
histflag = 1;
nvalsarr = [32,48,64,72,80,100]; ngraft = 64;
free_energy = zeros(10,2);
diff_energy = zeros(length(nvalsarr),4);
err_energy = zeros(length(nvalsarr),4);
green = [0 0.5 0.0]; gold = [0.9 0.75 0]; orange = [0.91 0.41 0.17]; brown=[0.6 0.2 0];
pclr = {'m',b... |
function [Xsep,Msep,Mstsep]=core2sep(distfil,xsep,ysep);
% [Xsep,Msep,Mstsep]=core2sep(distfil,xsep,ysep);
%
% Calculates steam quality(Xsep), total flow (Msep),
% and steam flow (Mstsep) for each separator for a given.
% POLCA distribution file
%
% Input:
% distfil - distribution file from POLCA
% xsep - ... |
function e = errorNormResidualEig(problem, y, dummy) %#ok
%ERRORNORMRESIDUAL Eigenvalue residual norm.
% E=ERRORNORMRESIDUAL(PROBLEM,Y) computes the scaled L2 eigenvalue
% residual norm of an approximate solution Y=[X;LAMBDA] of the eigenvalue
% problem PROBLEM (A*X=LAMBDA*B*X).
%
% See also: PROBLEM, LPN... |
function contourevidence = mia_groupsegments(segin)
% mia_groupsegments groups the contour segments.
% Synopsis
% contourevidence = mia_groupsegments(segin)
% Description
% combines the contour segments that belgone to the same objects.
% Inputs
% - segin contour segments
% Output... |
directoryname = 'MatFiles';
basename = 'ThreePopL500Samp500';
for Bxy = [0.01 0.1 0.5]
for Byx = [0.01 0.1 0.5]
for Byz = [0.01 0.1 0.5]
for Bzy =[0.01 0.1 0.5]
for Bzx = [0.01 0.1 0.5]
for Bxz =[0.01 0.1 0.5]
for iter = [1:1:10]
if( Bxy == 0.01 )
... |
clc;
clear;
close all;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This script is for combining all subjects' features into one mat file
% and can be used for train one net to overcome the unbalanced
% subdataset.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function [Jac,metr,N] = jactrans(coord,Fperm,ref_SBP)
% Description: computes the Jacobian transformation info and the normal
% components of the facets. These info are used to transform from the ref
% SBP to the physical SBP.
dim = 2;
nnode = size(coord,1);
nnodef = size(ref_SBP.b,1);
nface = size(Fperm,2);
Jacv = ... |
function U = blackbox(L,H,Nx,Ny,Y,d,v)
disp('---------------------IN BLACK BOX!---------------------')
%num of KL expansion terms per field
nu = length(d);
%stochastic input for lambda and mu
eta_lambda = Y(1:nu)';
eta_mu = Y(nu+1:end)';
%realization of fields
G_lambda = v * (eta_lambda.*sqrt(d));
G_mu = v * (eta_mu... |
function I=intsimpson(a,b,n)
k=[0:n];
h=(b-a)/(n);
x=[a:h:b];
aux1=sum(mod(k,2).*f(x));
aux2=sum((1-mod(k,2)).*f(x));
I=h/3.*(2*aux2+4*aux1-f(a)-f(b));
endfunction |
function predict_house_normal ()
theta=normalEqn();
str = inputdlg('Enter size of the house and the number of bedrooms separated by spaces or commas');
numbers = str2num(str{1});
x=reshape(numbers,[1,2]);
x=[1,x];
price = x*theta;
fprintf('Predicted price=$%f\n', round(price,2));
end
|
function yp = unforced1(t,y)
global c m k
yp = [y(2);(-((c./m).*y(2))-((k./m).*y(1)))]; |
function [hs, ps, leaf_ids] = forestApplyFnMemory( treeData, forest, maxDepth, minCount, best, precompute )
% Apply learned forest classifier.
%
% USAGE
% [hs,ps] = forestApplyFnMemory( treeData, forest, [maxDepth], [minCount], [best], [precompute] )
%
% INPUTS
% treeData - structure as generated from matrixTo... |
function result = f(values,ranking,prospect_values,sd,upper,lower,interval,current_layer,total_layers)
X = [];
if current_layer == total_layers
X = lower:interval:upper;
else
X = values(1,1):interval:upper;
end
%disp(current_layer)
%disp(X)
if current_layer == 1
Y = arrayfun(@(x) f_bottom([x... |
function [ellipse_level] = compute_covering_ellipses( local_max_ind,local_min_ind, DT)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
ellipse_level=[];
%DTy=max(DT);
step=1;
for i=1:1:size(local_max_ind,1)
if(i==size(local_max_ind,1))
max_after=100000000000... |
function rgb=i_rgb2rgb(rgb, Src, Dst, varargin)
%I_RGB2RGB Convert from one RGB space into another.
% ARGB=RGB2RGB(RGB,SRCTYPE, DSTTYPE) with size(RGB)=[M 3]
% returns matrix ARGB with same size.
%
% SRCTYPE asn DSTTYPE are one of the predefined RGB types or a conforming
% struct, see RGBS. If omitted or ... |
function CutterOption_CompareAverageWaveforms(self)
% plots average waveforms of only shows
%
% INPUTS
%
% OUTPUTS
%
% NONE
% ADR 2013
%
% Status: PROMOTED (Release version)
% See documentation for copyright (owned by original authors) and warranties (none!).
% This code released as part of MClust 3.0.
% Version con... |
function x = rk4step(f,t,x0,dt)
k1 = dt*feval(f,t,x0);
k2 = dt*feval(f,t,x0 + k1/2);
k3 = dt*feval(f,t,x0 + k2/2);
k4 = dt*feval(f,t,x0 + k3);
x = x0 + (k1 + 2*k2 + 2*k3 + k4)/6;
end |
function [var_exist]=persistent_var_exist(app,file_name)
retry_save=1;
while(retry_save==1)
try
var_exist=exist(file_name,'file');
retry_save=0;
catch
retry_save=1;
pause(1)
end
end
end |
function [f_polca_list,ppf,frad,fax]=case_stat(s1,s2,s3,s4,s5)
%case_stat('f1');
%casse_stat('f1','f3');
%
%etc.
% listar PPF, FRAD, och FAX för Polcafiler i case_list.txt för resp. block
% VDB 2001-01-26
if nargin==0
error('Give plant-identifier as input')
end
% [tmp,MATLAB_HOME]=unix('echo $MATLAB_HOME');
%... |
% Suha Kwak, Inria-Paris, WILLOW Project
overwrite = false;
name_experiment = 'VOC2007_6x2';
% ----------------------------------------------------------------------
% configuration
root_result = './results/';
if isempty(dir(root_result))
mkdir(root_result);
end
% set paths
set_path;
conf.path... |
close all;clear all;clc;
N=1E6; %No. of bits(Block length)
X=floor(2*rand(1,N)); %Information bit generation
Interleaver=randperm(N); %Interleaver(random permutation of first N integers)
SNRdB=0:0.5:9; %SNR in dB
SNR=10.^(SNRdB/10); %SNR in linear scal... |
function Xc = calculateMassCenter(dust)
%dust - dust cloud matrix
Xc = zeros(1,3);
for i = 1:3
Xc(1, i) = sum(dust(:,i));%calculate mass weight
end
end |
datadir = 'D:\Git\Data\Experiments\20161114\EZ\Corner15\';
plotdir = 'D:\Git\Sonar Experiments Report\plots\20161114\EZ Corner 15\';
%% plot individiual - EZ Corner
f1 = figure;
for i = 1:10
trial = csvread(strcat(datadir, int2str(i), '.txt'));
subplot(2,5,i);
plot(trial(:,2))
title(strcat('File No.', i... |
function yp = testKSNR(model,xp)
K = kernelmatrix('rbf',xp',model.x',model.sigma);
yp = K * model.alpha; |
clear all
addpath(genpath('/home/atam/quarantaine/niak-boss-0.12.18'));
path_data = '/home/atam/database/';
files_in = niak_grab_region_growing([path_data 'adnet/region_growing_20141210/rois/']);
%%%%%%%%%%%%%%%%%%%%%
files_in.infos = [path_data 'adnet/models/admci_model_group_20141210.csv']; % A file of comma-s... |
% Code from Monfared & Durstewitz (2020), Proceedings of the 37th International
% Conference on Machine Learning
%%
clear all
close all
%%
load ReproVanDerPol.mat
%-----------------------------------------------
T=1000;
M=length(h);
Z=zeros(M,T);
%-------------- discrete-time system ------------
Z(:,1)=mu... |
classdef norm_features
methods(Static)
function model = fit(mat,params)
type = params.type;
model.type = type;
switch type
case 'NORM_1'
case 'MEAN_0_STD_1'
dim = size(mat,1);
model.means = mean(mat,2);
cmat = bsxfun(@minus,mat,model.means);
model.stds = std(cmat,1,2);
... |
clear all; close all; clc;
%% Include
addpath(genpath('../support/'));
settings;
%% Simulated AR(p) process
rep = 100; % repetitions for accuracy measurement
T = 8000; % time series length
r = 0.5; % noise type
n = 10; % dimensionality
%% Settings
pVals = 1:12;
NOISE_TYPE = NOISE_SWING;
%NOISE_TYPE = NOI... |
clearvars; close all; clc
data40 = importdata('va_over_eta_40.txt')
data100 = importdata('va_over_eta_100.txt')
data400 = importdata('va_over_eta_400.txt')
data40 = data40.data;
data100 = data100.data;
data400 = data400.data;
figure(1)
plot(data40(:,2),data40(:,1),'.')
hold on
plot(data100(:,2),data100(:,1),'-')
hol... |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
% Numerical Experiments for SPSOreini.
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
close all;
%% set experimental parameters
ALGO = 'SPSOreini';
FHD = str2func('cec17_func');
TOTAL_... |
% random task generation
function set = random_task_generator(Phi, Rhi, C_lo_max, T_max)
% Phi = 0.7;
% Rhi = 4;
% C_lo_max = 10;
% T_max = 50;
set = [];
for j = 1:4
for i = 1:2
random_number = rand;
if random_number < Phi
tao.L(i) = 1; % HI
else
tao.L(i) = 0; % LO... |
% Unsupervised Object Discovery and Localization in the Wild
% http://www.di.ens.fr/willow/research/objectdiscovery
%
% written by Minsu Cho and Suha Kwak, Inria - WILLOW , 2015
% * Before running this script, see README.txt
% Set paths to libraries and data
set_path;
% Prepare dataset: copy images, a... |
function VEAS_Comparison(AFull,bVE,bAS,minIndex)
if size(bVE,2) ~= size(bAS,2)
disp('variable-exchange and active-set solution size mismatch');
else
%FA_VE = zeros(size(AFull,1),1);
%FA_AS = zeros(size(AFull,1),1);
%for iDx = 1:size(bVE,2)
FA_VE = AFull*(bVE(1:8,minIndex));
FA_AS = ... |
function [sigma_id, K_id]=generate_HIW_g_delta_identity_cell(g, cliques, delta)
% inputs: 1. g, the p x p symmetric matrix with
% respect to an original ordering v_1, ..., v_p
% 2. cliques, a 1 x t cell array of a perfect sequence of
% (nonempty) cliques of g,
% such as from chordal_to_ripcliques_cell.m
% output:... |
function [ ps ,ks ] = generatePs( fdiff, skew, ar,centerdeviation, numps,projective,silent,cdev_diff, WIDTH,HEIGHT,differentframes )
%if fdiff is 1 then all Fs will be different, if 0 otehrwise,
%skew is just the max skew allowed, if its zero them all skews is zero
%ar is the aspect ratio
% centerdeviation is how m... |
function Y=convolution_gabor(I,vparametres)
% calcul la réponse obtenue en chaque point par l'application d'une série
% de filtre de Gabor à l'image 3D
% entrées : I image lxhx1xp, vparametres parametres des filtres n*4 (sur
% chaque ligne : sigma,a,b,c)
% sorties : J 'image' l-2rxh-2rxp-2rxn
rayon=3;
function ... |
%% create_regions_from_linked_candidates.m
%
% TODO: write short description of function
%
%% Help
%
% *USE*
%
% TODO: write longer description of function
%
% *INPUT VARIABLES*
%
% * |trans|: TODO: write description and info on variable
% * |linked_candidates|: TODO: write description and info on variable
%
% *OUTPUT ... |
% Animation of two link downhill walker
% Inputs:
% t_sol: Array of time obtained from multi-step simulation
% x_sol: Array of states obtained from multi-step simulation
% x_sol(j, :)' is the state at time t_sol(j)
% gamma : Ground slope used for simulation
% t_I : End of step indices into the time array.
%... |
function [bic, like, pen] = BIC_skew_S(data, S_hat, xi_hat, lambda_hat, mem, t, rho, cdf)
% computes the BIC of a Skew-RES distribution with Schwarz Penalty Term
%
% Inputs:
% data - (N, r+1) (:,1) labels, (:,2:end) data
% xi_hat - (r, ll) estimated "mean" values
% S_hat - (r, r, ll) estimated Scat... |
function t=bdwht(im, M)
%bdwht - block discrete Walsh Hadamard transform of image
%------------------------------------------------------------------------------
%SYNOPSIS t = bdwht(im, [M N])
% Perform blockwise Walsh Hadamard transform on image im,
% using blocks of size MxN. The resulting transfor... |
function G = myLinearize(BlockData)
%Copyright 2013 The MathWorks, Inc.
% assignin('base','BlockData',BlockData)
[x,u] = findop(BlockData.Parameters.Value,'snapshot',2,ones(1000,1));
G = linearize(BlockData.Parameters.Value,u,x);
end
|
%% ME EN 6230 Problem Set 5 Ryan Dalby
%%
close all;
%% System Description
Gp = tf(.539, [0.004015 0.01519 0.067]);
PD = tf([0.27 14.21], 1);
PID = tf([7.67 372.76 4529.06], [1 0]);
%%
% Send data for PD controller to workspace, then execute this cell
PD_step_response_data = out.ScopeData;
%%
% Send data... |
function [outY, theta] = MVMC(singleTrainFeaL, singleTrainFeaU, singleTestFea, ...
trainLabelsL, trainLabelsU, testLabels, set, option, para)
% -------------------------------------------------------------------------
% Multiview matrix completion
% ------------------------------------------------------------------... |
% just testing
initParamsEtc()
runAgent() |
% You need to run mbuild -setup before running this script for the first time!
cd ../../algorithm
% Compile the programs
% -m creates a standalone C command line application
% -R specifies matlab runtime arguments
% -N removes all toolbox paths
% -p readds a toolbox path
% -I includes a folder while compiling (does n... |
function value = calc_height(velocity,angle)
value = ((velocity*sind(angle))^2)/(2*9.8);
end |
classdef void_quiz < handle
%
% class:
% plotters.void_quiz
%
% Controls the GUI
%{
GUI Tags:
---------
next_button
back_button
plot_panel
TODO:
--------
outline of plan:
load all of the data files and save them as matlab objects in a
c... |
% Pairing Function
function addr = pairing(N_depth, ite_input_count)
addr = (N_depth + (ite_input_count + 1))*(N_depth + (ite_input_count + 1) + 1) / 2 + ite_input_count + 1; %K=iter+1 [1, ...], N=[0,...]
end |
function content = CSVread( filename )
%% Open file in write mod
% Open
fileID = fopen( filename , 'r' );
if fileID == -1
error('could not open file')
end
% Read file as single char of string
fileContent = fread(fileID,'*char')';
fclose(fileID);
%% Parse the file
% Parse the file to fetch ther marker lines
... |
cd E:\data_for_Russ
savenames = {'ec_01.set','eo_01.set'};
for st=1:length(savenames)
eeg = pop_loadset(savenames{st});
eeg = pop_chanedit(eeg,'lookup','C:\eeglab10_0_0_0b\plugins\dipfit2.2\standard_BESA\standard-10-5-cap385.elp') ;
tmsevents = find(strcmpi('TMS',{eeg.urevent.type}));
lats = cell2mat({eeg.urev... |
function [ p ] = struct2params( s )
%STRUCT2PARAMETERS Summary of this function goes here
% Detailed explanation goes here
fs = fieldnames(s);
p = cell(1,2*numel(fs));
p(1:2:end) = fs(:);
for k=1:numel(fs)
p{2*k} = s.(fs{k});
end
end
|
%function to select flights that have similar rate of change per variable
function ind_res = selectNormalFlights_manual(rates)
[K, N] = size(rates);
ind = true(K, N);
edges = 0:100;
figure;
for i=1:K
D = rates(i,:);
%find a mode of histogram
n = histc(D, edges);
bar(edges, n, 'histc')... |
function hdl = create_axis(layout,width,varargin)
%
% CREATE_AXIS(layout,width,'option',value,...)
% OPTIONS
% TopMargin - 0
% BottomMargin - 0.1
% LeftMargin - 0.1
% RightMargin - 0
% InnerXMargin - 0.025
% InnerYMargin - 0.025
%
top = 0;
bot = 0.1;
lft = 0.1;
rgt = 0;
inx = 0.025;
iny = ... |
%% split the folders from the folder 'labeled' 'detected'
% into 100 identities of labeled_testsets & detected_testsets
% get the names of folder
rootsource = 'train';
dirFolders = dir(rootsource);
foldernames = extractfield(dirFolders, 'name');
% eliminate dotted folder names . ..
foldernames = foldernames(strcmp(fo... |
close all;
clc;
clear all;
addpath('C:\Users\liuya\Desktop\research\codes\eigtool');
mat=load('fort.665');
rmat=mat(:,1);
imat=mat(:,2);
Z = reshape(rmat,500,500)+1i*reshape(imat,500,500);
opts.levels=-4:0;
% opts.ax=[-100 100 -100 100];
eigtool(Z,opts)
eigs(Z,4) |
%this script randomly adds NaN at different rows for each features, thereby
%creating a missing feature data set.
d = size(data,2) - 1;
N = size(data,1);
for i=1:d
data(randsample(N, 100), i) = NaN;
end
|
function [ g ] = computeGradLR( tY, tX, beta )
%COMPUTEGRADLR Summary of this function goes here
% Detailed explanation goes here
N = size(tX,1);
g = 1./N * tX' * (sigmoid(tX*beta) - tY);
end
|
clear all;
close all;
clc;
%The circuit diagram is as shown.
I=zeros(1,3);
disp('Enter the three current sources I1,I2,I3:');
for i=1:3
I(i)=input('');
end
R=zeros(1,6);
disp('Enter the six resistors R1,R2,R3,R4,R5,R6:');
for i=1:6
R(i)=input('');
end
disp('Let the node 5 be grounded.');
disp('Applying KCL to t... |
function [phiX, stanX, M, max_phi] = dictionary_quadratic(U, SizeOfBurst, a, b)
%% Documentation
% Goal: Construct the quadratic dictionary matrix phiX containing
% all multivariate monomials up to degree two for the Lorenz 96 system
% Input: U = [x1(t1) x2(t1) .... xn(t1)
% x1(t2) x2(t2) .... xn(t2)
% ... |
classdef IsMemberFilter < DataFilter
properties(SetAccess=protected)
values
end
methods(Static)
function keywords = getKeywords()
keywords = {'ismember'};
end
end
methods
function filt = IsMemberFilter(varargin)
filt = filt@DataFilter(vararg... |
obj.RF_Amp = 0;
obj.RF_Freq = 2.88e9;
obj.RF = Drivers.SMIQ03B.instance;
obj.RF.reset
obj.RF.Amplitude = obj.RF_Amp;
obj.RF.Frequency = obj.RF_Freq;
% obj.RF.FrequencyMode = 'FIX';
obj.RF.setAmplitude();
obj.RF.setFrequencyModeCW();
obj.RF.setFrequency();
obj.RF.setRFOn();
%% Setup Pulse Sequence to cahracterize del... |
function [fig] = figurefull
% Create and return and empty figure that fills the whole screen
% Create the figure with the specified measures
fig = figure('units','normalized','position',[0 0 1 1]);
% In newer matlab versions, turn off auto update of legends
try set(fig,'defaultLegendAutoUpd... |
function [ p ] = opt_dual_update( g, s, y, Ac, AcT )
%DUAL_PPAP Summary of this function goes here
% Detailed explanation goes here
global order
p = g * 0;
p(order) = lbfgs_split_update(-1.0 * g, s, y, Ac, AcT);
p_mod = lcp_solve(p, 20, 0.5);
p_new = p + p_mod;
check = g' * (p_new);
if check <= 0
p = ... |
% MXsparseQuadrature.m Help file for sparse Quadrature MEX-file.
%
% [Q,W,sort] = MXsparseQuadrature(q,dim,type,Quad,w/CpFun);
%
% INPUT:
% q maximum level in the sparse grid quadrature
% dim dimension of the sparse grid quadrature
% type either 'HC' for hyperbolic cross, 'TD' for total degree
% ... |
% sp10A.m
clear all
close all
clc
g = 9.81;
d = 1;
dt = 0.02;
a = g*sind(45);
ax = a*cosd(45);
ay = -a*sind(45);
tMax = 2.0;
N = 600;
sx = zeros(N,1);
sy = zeros(N,1);
vx = zeros(N,1);
vy = zeros(N,1);
t = zeros(N,1);
sy(1) = d;
flagA = 0;
c = 1;
while flagA < d
t(c+1) = t(c) + dt;
vx(c+1) = vx(1) + ax*... |
function [flag]=adjacency(a,p)
for i=1:p
for j=1:p
if(i==j)
a(i,j)=0;
end
end
end
for i=1:p
flag=1;
for j=1:p
if(a(i,j)~=0)
flag=0; break;
end
end
if(flag==1)
disp('Not connected')
flag=2;
break;
end
end
end
|
clear;
ORG=imread('lumel.jpg');
ORG = rgb2gray(ORG); colormap(gray);
imagesc(ORG); axis image;
pause;
% 2階調画像の生成
IMG = ORG>128;
imagesc(IMG); colormap(gray); colorbar; axis image;
pause;
% 4階調画像の生成
IMG0 = ORG>64;
IMG1 = ORG>128;
IMG2 = ORG>192;
IMG = IMG0 + IMG1 + IMG2;
imagesc(IMG); colormap(gray); ... |
% Desired position of the foot, specified via Bezier waypoints
load('pts.mat');
pts_foot = pts;
%Set to the actual parameters
p = example_parameters;
angle1_init = 0;
angle2_init = -pi/2;
trajectory_time = 4;%0.5;
buffer_time = 2;
mappingWorkspace = 1;
reset_learning = 1;
learning_rate = .5;
duty_max = .6;
... |
function [] = Project_Two()
%Main Function
clear;
Read_File();
[eta2,dw2,w02] = SGD_Synthetic();
[w2, mu2, M2, Sigma2,lambda2, trainInd2, validInd2, trainPer2, validPer2] = Synthetic_Data();
[eta1,dw1,w01] = SGD_Real();
[w1, mu1, M1, Sigma1,lambda1, trainInd1, validInd1, trainPer1, validPer1] = Real_Data();
save pro... |
save_on = 1; % Set to nonzero if you want to run the solver, set
% to 0 if you want to plot
periodic = 0; % set to nonzero to run periodic solver (no BCs need)
% set to 0 to run solver with time-dependent BCs
check_IC = 0; % Set to 1 to only plot ICs
plot_on = 0; % Set to 1 ... |
function create_randomization_sequences(n_trials, n_randomizations)
%n_randomizations = 4;
%n_trials = 120;
%% Order of butterfly presentation
butterflies = [1:4, 1:4];
for r = 0:(n_randomizations-1)
butterfly_sequence = [];
for times = 1:ceil((n_trials+50) / length(butterflies)) % Needed for training and p... |
classdef OrbitCorrector < handle
% OrbitCorrector class
%
% Properties:
% name
% length
% field
% aperture
%
% Methods:
% Track
% TrackSpin
% GetBField
properties
name = ''; % string
length = 0; % dipole length, in metres
... |
function y = f1(x)
%排污
global PD car L
y = 2;
l = floor(x(end));
[~,s] = sort(x(1:L));
% 第一台设备
y1 = car(s(1),1) + car(s(1),3);
for i = 2:l
if y1 < car(s(i),1) %如果上一辆车的完成时间早于下辆车的到达时间
t = car(s(i),1) - y1;
y1 = car(s(i),1) + car(s(i),3);
if t < ... |
function [ model ] = modelRPCA_MlIALM( model, params )
%% Sets methods and their parameters for ML-IALM
%
% Author: Vahan Hovhannisyan, 2017.
model.restriction.L = @restrictMatrixRight;
model.operatorParams.L.prolongCoeff = 2;
model.operatorParams.L.restrictCoeff = 1;
model.operatorParams.L.normPColumns = false;
mo... |
run('Q1.m');
iterations = 200;
freq_list = linspace(1000000,10000000,iterations);
impedance(antena_transmissora,freq_list)
z_list = impedance(antena_transmissora,freq_list);
index_resso = 0;
index_crit = 0;
prev =0;
for n = z_list
a = imag(n);
if prev <= 0 && a >= 0
index_ress = find(z_list(:,:)== ... |
function [xx,X,Y]=update_reservior_states(X0,Y0,Input,z,h,NumberOfLayer,delayOfLayer,deltaOfLayer,betaOfLayer,kappaOfLayer,bOfLayer,Input_Mask,Nv)
% 此处显示有关此函数的摘要
% 此处显示详细说明
%---------------------------
%---------------------------
xx=zeros(sum(Nv),1);
% yy=zeros(NumberOfLayer*Nv,1);
X=zeros(fix(sum(delayOfLayer)... |
function dhi_sub = Jacobian_output_function_for_marker_position(in1,in2)
%JACOBIAN_OUTPUT_FUNCTION_FOR_MARKER_POSITION
% DHI_SUB = JACOBIAN_OUTPUT_FUNCTION_FOR_MARKER_POSITION(IN1,IN2)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 23-Mar-2020 10:54:17
X_sym4 = in1(4,:);
X_... |
function [newX, meanValue] = subtractMean(input)
meanValue = mean(input);
[row, col] = size(input)
newX(:,1:col) = input(:,1:col) - meanValue(1,1:col);
return;
end
|
CleanUp1D;
clc
clear all
close all
model = 'SWE';
gravity = 1.0;
test_name = 'Dambreak';
depth_IC =@(x) 3*(x<0.0) + 1*(x>=0.0);
velocity_IC =@(x) 0*x;
bnd_l = -3.0;
bnd_r = 3.0;
mesh_pert = 0.0;
bc_cond = {'N',0.0,'N',0.0;
'N',0.0,'N',0.0}; % For conserved variables
FinalTime =... |
function [ output ] = select_bat( bats,inx,r)
[m,n]=size(bats);
bat=bats(1,:);
op=[];
for i=1:r
k=inx-i;
if k<1
k=m+k;
end
op=[op;bats(k,:)];
k=inx+i;
if k>m
k=k-m;
end
op=[op;bats(k,:)];
end
[m,n]=size(op);
mi=min(op(:,n));
for i=1:m
if op(i,n)==mi
... |
function register_functional_feat(check,adjust,session_dir,subject,func)
% Registers functional runs in feat to freesurfer anatomical
%
% Usage:
% register_functional_feat(session_dir,subject,func,SUBJECTS_DIR)
%
% e.g. register_functional_feat(1,0,'~/data/ASB'),'ASB')
%
% Defaults:
% check = 0; do not chec... |
% Charger les donnees
load('Chap17_Data')
% Preparer une figure
figure
% permettre la superposition de plusieurs graphiques dans la meme figure
hold on
% Donner un label à l'axe des x
xlabel('Temp (sec)');
% Donner un label à l'axe des y
ylabel('Essai #')
% Ajuster les limites de l'axe des y
ylim([0 length(spike)])
... |
function RelativeLuftfeuchtTeilC04 = importfile1(filename, dataLines)
%IMPORTFILE1 Import data from a text file
% RELATIVELUFTFEUCHTTEILC04 = IMPORTFILE1(FILENAME) reads data from
% text file FILENAME for the default selection. Returns the data as a
% table.
%
% RELATIVELUFTFEUCHTTEILC04 = IMPORTFILE1(FILE, DATALI... |
clear all; close all;
tic;
days=365; % Number of days
tstep = 60; % desired timestep for attitude file
q_fname=strcat('q_save_',num2str(days),'days.mat'); % File name of quaternions save
t_fname=strcat('t_save_',num2str(days),'days.mat'); % Filename of time save
q_downsamp=cell2mat(struct2cell(load(q_fn... |
function J = phantom_jacobian(q1, q2, q3)
l1 = 0.209550;
l2 = 0.169545;
% l3 = 0.031750;
J = zeros(3,3);
s1 = sin(q1);
s2 = sin(q2);
s3 = sin(q3);
c1 = cos(q1);
c2 = cos(q2);
c3 = cos(q3);
J(1, 1) = -s1 * (l1 * c2 + l2 * s3);
J(1, 2) = -l1 * c1 * s2;
J(1, 3) = l2 * c1 * c3;
J(2, 1) = c1 * (l1 * c2 + l2 * s3);
J(2, 2) =... |
%%
% CellShapeAnalysis.
% Copyright (C) 2020 J. Stegmaier
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicabl... |
function [all_benign_textons,all_malignant_textons]=gland_texton_medians_glandwise3fold(flag,set_number)
if(flag==0)
path_textons_benign=sprintf('Z:\\Hassaan\\HE_Scanner\\Standard_Normal\\Testing_LM_comparison_stained_unstained\\stained_core_bigger_dataset\\Texton_separate_valandtrain\\train%d\\Benign\\',set_number);
p... |
% Einstellungen für Test der komb. Synthese für 2T0R-Aufgabenredundanz
% Moritz Schappler, moritz.schappler@imes.uni-hannover.de, 2021-02
% (C) Institut für Mechatronische Systeme, Leibniz Universität Hannover
clc
clear
DoF = [1 1 0 0 0 0]; % Aufgaben-FG
% Starte die Maßsynthese einmal mit Debug-Option für Redundan... |
%load B
x=zeros(28,1);
y=zeros(28,1);
average=zeros(28,1);
for i=1:28
average(i)=mean(Febob(1440*(i-1)+1:1440*i));
x(i)=min(find(Febob(1440*(i-1)+1:1440*i)>=average(i)));
y(i)=max(find(Febob(1440*(i-1)+1:1440*i)>=average(i)));
end
|
function [mask, clustmean] = matchSTRFclust(STRFmaskREF,STRFmaskCOMP, strfCOMP)
%Generates new mask for second input to match the cluster labels to the
%first input.
%
%Inputs:n (all from calcSTRFcluster.m)
% STRFmaskREF = cluster mask with unique integer labels for each cluster
% STRFmaskCOMP = cluster mask with u... |
function [cp]=Insertionsort(a,k)
cp=0;
for j=2:k
i=j-1;
% cp=cp+2;
temp=a(j);
cp=cp+2;
while(temp<a(i))
% cp=cp+2;
a(i+1)=a(i);
i=i-1;cp=cp+1;
if(i==0)
break;
end
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.