text stringlengths 8 6.12M |
|---|
% tic
d_results = dir('./SSResults');
% allParses=cell(0);
% for i=1:(length(d_results)-2)
% i;
% if isempty(strfind(d_results(i+2).name,'.mat')) % || i==o%isequal(d_results(i+2).name,'uiuc245_parse.mat')
% continue;
% end
% allParses{end+1}{1}=d_results(i+2).name;
% clear parse
... |
function [ vectors ] = transformVector( vectors,T )
%transform3D Apply a 4x4 rigid body transformation matrix to directions.
vectors = T * [vectors'; zeros(1,size(vectors,1))];
vectors = vectors(1:3,:)';
end
|
function [ output_args ] = exploreVideo( fileName )
%EXPLOREVIDEO Summary of this function goes here
% Detailed explanation goes here
filePath = strcat('data/', fileName);
videoReader = VideoReader(filePath);
% calculate ROI of first frame (to determinen size)
firstFrame = read(videoReader, 1);
firstRoi = getROI(fi... |
clear;clc
startup_rvc
mdl_twolink
xdot0=[-2,0,0];
x0=[sqrt(3),0,1];
qi=inverseKin(twolink,sqrt(3),1,1);
dq=[0.5 0];
xdotf=[0,0,0];
xf=[-0.25,0,0.25];
qf=inverseKin(twolink,xf(1),xf(3),2);
qf=wrapToPi(qf(1,:));
A=[];
b=[];
Aeq=[];
beq=[];
lb=ones(20,2)*(-pi);
ub=ones(20,2)*pi;
% q0=[wrapToPi(linspace(qi(1),wrapTo2... |
function [sigma_i]=InitSigmaI(hypers,Eq,times,clickTimes)
%INITSIGMAI Initialize sigma_i^2
%Konstantinos Panagiotis Panousis
%Gatsby Computational Neuroscience Unit
%University College London
%9 June 2015
%Inputs: hypers: The hyperparameters of the GP. Should have size 6.
% seq: the struct containing the posteri... |
%
% LONGPASS Filter short distances by means of a lowpass FIR filter
%
% X = LONGPASS(t,S)
% Applies a lowpass filter to the signal (S) with a N-point time axis (t) to
% suppress any distances below 1.5nm.
%
% X = LONGPASS(t,S,rpass)
% Applies a lowpass filter to the signal (S) with a N-point time axis (t) ... |
S = @(a,b,c,theta) a*cos(theta)+sqrt(b*b-(a*sin(theta)-c)^2);
a=1;
b=1.5;
c=0.3;
y=1:1:360;
theta= 1:1:360;
for i= 1:1:360
y=S(a,b,c,i);
end
title('theta vs y')
plot(theta,y)
|
clc
clear all
tmp = load('strongfilter16(3).mat');
H = tmp.H;
alpha = tmp.alpha;
H_threshold = tmp.H_threshold;
alpha_count = tmp.alpha_count - 1;
f_num = 11818;
nonf_num = 45356;
n = 16;
data_face = read_sample('newface16/face16_', f_num, n);
data_noface = read_sample('nonface16/nonface16_', nonf_num, n);
c_num = 34... |
% Reconstruct RGB image from RGGB Bayer pattern using linear interpolation
function [ reconstructed ] = demosaic(mosaic)
[rows, cols] = size(mosaic);
reconstructed = zeros(rows, cols, 3);
for i = 1:rows
for j = 1:cols
reconstructed(i, j, 1) = getRed(mosaic, i, j);
reconstructed(i, j, 2) = getG... |
function [U,Z] = dictionary_learning(X)
% Implements an onlne learning algorithm based on the paper: Online Dictionary Learning for Sparse Coding
% by Julien Mairal Francis Bach Jean Ponce and Guillermo Sapiro
% INPUTS
% X: (d x n) data matrix (samples as columns)
%
% OUTPUTS
% U: (d x l) dictionary
% Z: sparse coding... |
function Par2Fig(P,ParNames,Stage,xPos,yPos)
% Appends parameter name value pairs to currently active figure
% P is table with all parameter values for each Stage
% ParNames lists parameters to be added
% xPos, yPos: normalized coords of text
% Get and format the Parameter name value pairs
TextCell = [ParNames; table2... |
function T = calculateThrust_using_interpolants(rho_interp,Ey_interp,r_e,r_c,meshdomain,collector_bot_fun,collector_top_fun,emitter_bot_fun,emitter_top_fun)
%% calculates the thrust by computing the double integral from the numerical result
%% get integrand
fun = @(x,y) rho_interp(x,y).*Ey_interp(x,y);
%% first inte... |
function H_f=BP_Bayes(result,S)
global C c Max_Trav Min_Trav size_p size_v W lambda_glob;
sigma=75*10^-12;
coef_c=2.4;
coef_d=20;
step=1;
H=PD(result,S,sigma,coef_c,coef_d,step);
H_f=Filter(H);
%»É¢µãͼ
% F=find(H_f);
% [X,Y,Z]=ind2sub(size(H_f),F);
% V=H_f(F);
% scatter3(X,Y,Z,20,V,'filled'); ... |
function out = quad_spline_interpolation( x, y )
N = length(x)-1;
V = [0;zeros(2*N,1);zeros(N-1,1)];
Z = zeros(length(V),length(V));
j=1;
f=1;
for i=2:2:2*N
Z(i,f:f+2) = [x(j)^2 x(j) 1];
V(i) = y(j);
j = j+1;
Z(i+1,f:f+2) = [x(j)^2... |
function Ps = polyDiag2polySquare(P)
dX = diff(P.X) ;
dY = diff(P.Y) ;
Ps.X = [] ;
Ps.Y = [] ;
if numel(P.X) == 1
Ps.X = P.X + [-.5 -.5 .5 .5 -.5] ;
Ps.Y = P.Y + [-.5 .5 .5 -.5 -.5] ;
else
for ii = 1:numel(P.X)-1
n = abs(dX(ii)) ;
if dX(ii)>0 & dY(ii)==0
Ps.X = [Ps.X P.X(ii)-.5 P.X(ii+1)+.5] ;
... |
%% ========================================================================
% main program (example4)
% RDO problem
% save history for every iterations
% data name
% - Exact : resultE
% - Direct approach w/SLS : resultD# (#th-order GPCE)
% - Direct approach w/partitioned DMORPH : resultDDM# (#th-order GPCE)
... |
function [edges, maxEdgeIdx] = getGlobalEdges( p, segCubeIdx )
%GETGLOBALEDGES Load edges for the global segment IDs.
% INPUT p: Segmentation parameter struct.
% segCubeIdx: (Optional) Integer vector of segmentation cube linear
% indices for which the edge list is loaded.
% (De... |
function result = saveTempFile(p, saveAll)
%function result = saveTempFile(p, saveAll)
% save the data from a single Trial to a .TEMP file
% Only saves contents of p.trial to temp file by default,
% set optional input [saveAll] to save the entire PLDAPS object
% instead of only p.trial
% - trial temp files are saved as... |
function [spkdens, spkbinned, kernel,pks,trs] = mkspkdens(spkvec,tvec,thresh,sigma,plotyn)
% This function creates a spike density using a Gaussian kernel density
% estimator.
%
% [spkdens spkbinned kernel] = mkspkdens(spkvec,tvec,thresh,sigma,plotyn)
%
% spkdens = spike density
% spkbinned = binned spike times (1=spik... |
%========================================================================
%
% Puts given vector (v) onto the main diagonal of a square matrix (x)
% Reproduces the GAUSS command diagrv
%
%========================================================================
function y = diagrv(x,v)
y = x - diag(diag(x)) + diag(v... |
addpath ../xml;
addpath ../../3rd_party/color;
addpath ../../3rd_party/LabelMeToolbox;
addpath ../histogram;
imgInfo = readStructFromXML('/nfs/hn01/jlalonde/results/colorStatistics/testDataSemantic/testDataSemantic/img_4657_generated.xml');
imDest = imread(fullfile('/usr1/projects/labelme/Images', imgInfo.image.orig... |
%FDMPOSSITION5
% Solve the Poisson problem u_{xx} + u_{yy} = f(x,y) on [0,1] x [0,1].
% The 5-point Laplacian is used at interior grid points.
% This system of equations is then solved using backslash.
clear
%% example 1
f = @(x, y) (5 / 4) * exp(x + (y / 2));
ue = @(x, y) exp(x + (y / 2));
%% Spatial disper... |
%% Backprojection backhoe example
% Created by: Lee A. Harrison
% On: 5/1/2019
%
% Copyright (C) 2019 Artech House (artech@artechhouse.com)
% This file is part of Introduction to Radar Using Python and MATLAB
% and can not be copied and/or distributed without the express permission of Artech House.
clear, clc
% Speed... |
%This program plots the solutions for various numerical techniques against
%the analytical solution for the spring equation
%It also plots the convergence rate for the various methods
set(0,'DefaultAxesFontSize',18,'defaultlinelinewidth',2);set(gca,'FontSize',18);close(gcf);
%Define parameters
clear
m = 4; %mass
k = 16... |
function fh = mycursors(varargin)
% MYCURSORS - Create as many cursors as you want on an axes
% FH = MYCURSORS(VARARGIN) add cursor on an axes.
%
% VARARGIN can contain 0, 1 or 2 elements:
% 1) First input is the handle of the axes on which you want to create the
% cursor.
% Default valu... |
% This is material illustrating the methods from the book
% Financial Modelling - Theory, Implementation and Practice with Matlab
% source
% Wiley Finance Series
% ISBN 978-0-470-74489-5
%
% Date: 02.05.2012
%
% Authors: Joerg Kienitz
% Daniel Wetterau
%
% Please send comments, suggestions, bugs,... |
function [vp vp_vec]=veto_rich_players(clv);
% VETO_RICH_PLAYERS returns a list of veto players for the TU-game v.
%
% Source: J. Arin and V. Feltkamp. The nucleolus and kernel of veto-rich transferable
% utility games." Int J of Game Theory, 26:61-73, 1997.
%
% Define variables:
% output:
% vp -- The ... |
tic;
files = dir("isolated_digits_ti_train/**/*.wav");
for i = length(files):-1:1
filePath = fullfile(files(i).folder, files(i).name);
label = files(i).name(1); % first char is the class label
refSet(i) = processFile(filePath,label);
end
save("refSet.mat","refSet");
toc;
% calculates MFCCs and returns a st... |
%% EXPLORATION OF THE TAYLOR EXPANSION OF y(x) = sqrt(1+x)
x = linspace(-1,1,601)';
% The actual function.
y = sqrt(1+x);
% The taylor expansion coefficients.
coef = @(n) (-1).^n.*factorial(2*n)./((1-2.*n).*factorial(n).^2.*4.^n);
% the highest order approximation to be calculated
order = 15;
Y = zeros(length(x),or... |
function java_decrease_u235(imax,jmax)
global cs;
cs.decrease_u235(imax,jmax);
end
|
n = 19 ; % Filter Length
k = (n-1)/2; % k = 9
m = k+2; % Local Maximum points = 11
edge = 0.4; % bandband edge
fs = 2500;
ts =0.38; % Transition starts
te = 0.42; % Transition ends
ws = 0.6;
wp = 1;
delta = 1/fs;
s = [0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.43 0.45 0.5]; % Location of extremas & Initial Guess
r... |
function [ x,k,rp,rd,mu ] = MPI( Q, A, b, c,sigma ,tol)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
[m,n]=size(A);
e=ones(n,1);
maxiter=100;
k=0;
x=ones(n,1);
s=ones(n,1);
mu=(x'*s)/n;
lambda=ones(m,1);
xinv=1./x;
Xinv=diag(xinv);
S=diag(s);
rp=A*x-b... |
function h = plotNaiveResponsepotentP2X4block2(experiment)
setParams([]);
[T, I, Y] = naivePerfusionResponse(experiment.conditions{:});
subplot(2,1,1);
h=plot(experiment.data(:,1),experiment.data(:,2),'-r');
set(h,'linewidth',2);
hold on;
h=plot(T,I);
set(h,'linewidth',2);
hold off;
labelPlot('','Current (p... |
function combine_features(matFile)
% matFile = 'EEG_Mat/AH04_1.mat';
winSize = 20;
keepmet = [1:7 11 14:20 22:30 32:35];
keepmet = setdiff(keepmet,[4 13 19]);
% load the number of electrodes from the original mat file
load(matFile, 'electrodes', 'epochFeats', 'metricsMat', 'epochFeatsICA', 'metricsMatICA');
%... |
function [x] = cor2rad(cor_vec)
%Function to convert coordinates in degrees[vector] to radians[scalar]
% Detailed explanation goes here
x=deg2rad(cor_vec(1)+cor_vec(2)/60+cor_vec(3)/3600);
end
|
%% Computer Vision Homework 3: Problem 4
% ----------------------------------------- %
% Affine Structural from Motion
% The implementation of tracking is in asm.m
% ----------------------------------------- %
load('tracked_points.mat');
[K,X,A] = asm(Xs,Ys);
figure, plot3(X(1,:),X(2,:),X(3,:),'r.');
title('3... |
//
// MoonPerch.m
// MoonHerder
//
// Created by Roger Engelbert on 10/9/12.
// Copyright Done With Computers 2012. All rights reserved.
//
#import "MoonPerch.h"
// MoonPerch implementation
@implementation MoonPerch
- (void) dealloc {
[super dealloc];
}
-(id) initWithGame:(Game *)game andPosition:(CGPoint)... |
function robotica_base
Robo=Criar_Robo([],[300 300 1],5,10);
Robo=Criar_Robo(Robo,[500 400 1],5,10);
Robo=Criar_Robo(Robo,[700 300 1],5,10);
Robo=Criar_Robo(Robo,[300 700 1],5,10);
Robo=Criar_Robo(Robo,[500 600 1],5,10);
Robo=Criar_Robo(Robo,[700 700 1],5,10);
Alvo=Criar_Robo([],[500 100 0],0,0);
Alv... |
function [ W ] = CalcWerk( To, Tf, mixVec)
%CalcWerk [Matt]
% This function calculates intensive work over a device from
% two temperature states as the difference of the
% total enthalpies at each state (generated from the
% function hMix)
% W in J/kg
%
% cpCo2 = @(t) cpHMix(t,'co2');
% cpH2o = @(t) cpHMix... |
%% Extract and define necessary variables from setParams function
allParams=setParams;
load(allParams.camParamFile);
cameraParams=cameraParams_box1;
K = cameraParams_box1.IntrinsicMatrix;
points_per_board = prod(allParams.boardSize-1);
numBoards = size(allParams.ROIs,1) - 1;
P = eye(4,3);
% Create output directorie... |
energy_dist=f_D_energy_percentage(1,:).*energy_D_range*energy_bin_size;
cum_pdf=energy_dist;
for n=2:length(f_D_energy_percentage(1,:))
cum_pdf(n)=energy_dist(n)+cum_pdf(n-1);
end
% plot(energy_D_range,cum_pdf)
plot(energy_D_range,energy_dist) |
more off;
close all;
%%%%%% Screen Init %%%%%%%
PsychDefaultSetup(2);
Screen('Preference','SkipSyncTests', 1);
Screen('Preference','VisualDebugLevel', 0);
screens = Screen('Screens');
endSc = max(screens);
global white = 1;
global black = 0;
global windowRect
global window
[window, windowRect] = PsychImaging('OpenWindo... |
function [split_group_assignments] = compute_split_group_assignments(...
split_camera_trees)
split_group_assignments = zeros(1, size(split_camera_trees{1},1));
num_trees = length(split_camera_trees);
for tree_idx = 1:num_trees
[num_groups, group_assignments] = graphconncomp(...
split_camera_trees{tree... |
function qdd = FDcrb( model, q, qd, tau, f_ext )
% FDcrb Forward Dynamics via Composite-Rigid-Body Algorithm
% FDcrb(model,q,qd,tau,f_ext) calculates the forward dynamics of a
% kinematic tree via the composite-rigid-body algorithm. q, qd and tau are
% vectors of joint position, velocity and force variables; and t... |
% File: Example2_07.m for Example 2-7
clear;
f = -10:0.1:10;
T = 1;
x = pi*T*f+0.001;
W = T*(SA(x)).^2;
subplot(311);
plot(f,W);
xlabel('f');
ylabel('W(f)');
grid;
B = log(W);
WdB = (20/log(10))*real(B);
Theta = (180/pi)*imag(B);
subplot(312);
plot(f,WdB);
xlabel('f');
ylabel('W(f) in dB');
grid;
subplot(313);
... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
%
%
% Laplace Transform properties
% Complex frequency shifting
x=t^3;
s0=2;
f=x*exp(s0*t);
L=laplace(f,s)
X=laplace(x,s);
R=subs(X,s,s-2)
|
%% compare between MDC and MVC algorithm
clear all
% generate true W, H, V
sampleNum = 900;
noiseLevel = 0.2;
bandNum = 4;
endNum = 4;
% compare several times
HTrue = abs( randn( endNum, bandNum ) );
V = create4(sampleNum, HTrue);
% run Nfindr
indxNfindr = nFindr(V,... |
%%%
% quick check of calcium data
roi_times{1}=roi_times{1}-min(roi_times{1});
left_edge=max(find(roi_times{1}<.2));
right_edge=min(find(roi_times{1}>max(roi_times{1})-.7));
motif_selection=2;
mu1=mean(zscore(roi_data{1}(left_edge:right_edge,:,roi_motifs{1}==motif_selection)),3);
[~,idx]=max(mu1);
[~,idx2]=sort(idx)... |
function [jno,djndn1,djndn2,djnddv]=a_jn(h,un,n1,n2,dv)
%compute terms so division by zero is avoided
%if abs(dv)<1e-10
% evn=1-dv;
% tn=-1;
% ttn=n2;
%else
% evn=exp(-dv);
% tn=dv./(evn-1);
% ttn=(n2.*evn-n1)./(evn-1);
%end
z=(abs(dv)<1.e-10);
x=(abs(dv)>=1.e-10);
evn(z)=1-dv(z);
tn(z)=-1;
ttn(z)=n2... |
clear;clc;
CUB_path = '/ais/gobi4/rjliao/Dataset/CUB_200_2011';
CUB_img_path = fullfile(CUB_path, 'images');
CUB_img_list_name = fullfile(CUB_path, 'images.txt');
fid = fopen(CUB_img_list_name, 'r');
file_name = textscan(fid,'%d %s');
fclose(fid);
file_name = file_name{2};
num_imgs = numel(file_name);
[idx_i, idx_j]... |
%{
You should sample a graph from some model with some size, number of
vertices, and some clusters
compute likelihood for same model with true number of clusters
compute likelihood for same model with some other number of clusters
report on the results (pictures, words, code)
%}
% sample
n=100;
p=0.21;
A=rand(n)<... |
function [] = bh(m,n)
% Black-hole, excision method
if nargin<2
n=m;
end
% Homotopy Analysis Method
maxits=30;
tol=3e-10;
h=-1;
% Simulation parameters
L=20; % Plot window
a0=1; % Throat
p=0.5; % Momentum
% Differential operators
[Dx,x]=chebD(m);
[Dy,y]=chebD(n); y=y';
A1=diag((x+1).^2)*Dx*Dx;
A2=diag(1-y.^... |
function [distance] = varOfInfoSoft(mMembership1, mMembership2)
%
% Computes the variation of information for external cluster comparison.
%
% mMembership1 - vector of membership (each element is 1..K, where K is the
% number of clusters in clustering set 1)
% mMembership2 - vector of membership (each element is 1..K',... |
%% This is a demo processing of DiSpect for phantom I:
load PhantomI;
%% Displacement encoded echo seperation from 4-step phase cycling
PhaseCyclingMat4=[-1, -1i, +1, 1i; ...
-1, 1i, +1, -1i; ...
+1, +1, +1, +1];
APDispEncoded_ksp=PhantomI.APDispEnc_ksp;
LRDispEncoded_ks... |
function [ utility ] = caldUtility(targets,sensors,dists,k)
for i = 1:length(sensors)
tDi =[];
for j = 1:length(sensors)
if sum(abs(sensors(:,i)-sensors(:,j))) <= k
tDi = [tDi ; dists(j,:)];
end
end
end |
function [aOpt, xOpt, fEval, niter, timeperiter] = ak7213_linp(m, l, s, AP, IP, N, nj, tau, n, na, xd)
%% Function Argument Definitions
% m: scalar number of processors
% l: scalar number of speed levels
% s: column vector of speed levels [1xl]
% AP: column vector of active power datas corresponding to each spe... |
%% loading a trainign set
source_root = 'M:/attialex/seg_dataTraining/';
source_name = 'set_1';
load([source_root source_name]);
%% list of variables we want to use
varlist = {''};
X=[];
Y=[];
%% training a tree
nTrees= 50;
oobpred = 'on';
oobvarimp = 'on';
minleaf = 1;
b = TreeBagger(nTrees,X,Y,'Method','classificat... |
function installQL()
%% This function installs the paths
% ------------------------------------------------------------------------
% Authors: Pooyan Jamshidi (pooyan.jamshidi@gmail.com)
% The code is released under the FreeBSD License.
% Copyright (C) 2016 Pooyan Jamshidi, Imperial College London
% The scripts impleme... |
function X=plotFig6
%Function to plot the means and standard deviations of the polarization
%over 100 simulations for each (N,N_a) pair with N=10, 50, 100 and 200 and
%N_a from 0 to N.
load PolarNF
PolarN=PolarNF;
N=[10,50,100,200];
i=1;
pN=(0:N(1,i))/N(1,i);
Polar=PolarN{1,i};
Y=Polar(:,:... |
k = 100;
sumError = 0;
parfor ii = 1:k
trackErrorNorm = run(1)
sumError = sumError + trackErrorNorm;
end
sumError = sumError/k;
disp('ERROR:')
disp(sumError)
disp('====== two =======')
sumError = 0;
parfor ii = 1:k
trackErrorNorm = run(2)
sumError = sumError + trackErrorNorm;
end
sumError = sumError/k;
... |
%contrasts = {'PosIntr','PosWill','NegWill'};
contrasts = {'NegWill'};
subs = [301:307,311:322, 324:326, 328, 329];
%subs = [302:307,311:313];
%subs = [326, 328:329];
datadir = '/Users/CNDM/Dropbox/SaTCPrivacyGrant/SaTC3/fMRIAnalyses/fMRI_Data/ReconScans/'
ppi_contrasts = {[1,2,1],[2,2,1],[3,2,1]};
idx = 1;
for s = su... |
function [intersects, edgeIndices] = intersectLinePolyline(line, poly, varargin)
%INTERSECTLINEPOLYLINE Intersection points between a line and a polyline.
%
% P = intersectLinePolyline(LINE, POLY)
% Returns the intersection points of the lines LINE with polyline POLY.
% LINE is a 1-by-4 row vector containin... |
function urnfsolve7par
t0=clock; % poczatek obliczen
fd =fopen('urnfsolve7parOUT.m','wt');
fprintf(fd,'\n Uklad rownan zdefiniowny w funkcji f=urn7par(x,p1,p2,p3,p4,p5,p6,p7)');
fprintf(fd,'\n f(1)=a* x(1)^2 + b*x(2)^2 +c*x(3)^2-4;');
fprintf(fd,'\n f(2)=d*x(1)*x(2)-1;');
fprintf(fd,'\n f(3)=e*x(1)*x(2)+f*x(1)*x(3)+g... |
function fns = FindFiles(globfn, varargin)
% fns = FindFiles(globfn, parameters)
%
% Finds all files that match a wildcard input globfn.
% Based on matlab's dir function.
% Searches all directories under the current directory.
%
% INPUTS
% globfn -- filename to search for (you can use '*',
% but no... |
inputMaskPath = '/net/store/nbp/projects/phasesim/databases/Bastian_DTI/masks/';
inputcomplFSPath = '/net/store/nbp/projects/phasesim/workdir/Arushi/20150727Allsubjecttracking/';
removeOverlapping = false;
outputPath = ['/net/store/nbp/projects/phasesim/workdir/Arushi/' num2str(yyyymmdd(datetime)) '_voxelByIndFS/'];
... |
function [inf_bits_cnt, inf_bit_errs, inf_bit_errs2, raw_bits_cnt, raw_bit_errs] = single_packet(sim_options)
% Generate channel impulse response
cir = get_channel_ir(sim_options);
% Generate tx signal, returns also information bits and raw bits
[txsignal, tx_inf_bits, tx_raw_bits] = transmitter(sim_options);
% Cha... |
function DCrnTable=calcDecernabilityMatrix(table)
DCrnTable={};
[row, col]=size(table);
for i=1:row%for creating the row of the dcrn matrix
for j=1:row %for creating the columns of the dcrn matrix
temp_set=[];
if table(i,col)~=table(j,col)
l=1;
... |
%% Maximum detection range example
% Created by: Lee A. Harrison
% On: 7/1/2018
%
% Copyright (C) 2019 Artech House (artech@artechhouse.com)
% This file is part of Introduction to Radar Using Python and MATLAB
% and can not be copied and/or distributed without the express permission of Artech House.
clear, clc
% Syst... |
%% solution of optimal control problem
clear all;
close all;
clc;
%% CT system
Ac = [0 1; 6.31 -15.48];
Bc = [0; 10]; % Bc_1
% Bc = [0; 1000]; % Bc_2
[ra, ca] = size(Ac);
[rb, cb] = size(Bc);
Cc = eye(ca);
Dc = zeros(rb, cb);
%% sampling interval and delay
h = 10e-3; % 10ms
delay = 4e-3; % 4ms
%% system disc... |
% single phase flow in fractured reservoir
% dependent variables: pressure
% Prepared for educational purposes by Ali Akbar Eftekhari
% DTU, a cold Friday afternoon
% Does not work well
% Written by Ali A. Eftekhari
% Last checked: June 2021
clc; clear;
%% define the geometry
Nx = 50; % number of cells in x direction
N... |
% selMdSelect.m
%
% purpose: select the best fitting models
% after GaussFitMain.m selMdStat2.m
% 1. set crit for r2
% 2. compare AICc
%
% Tancy 140820 wrote
%% load Data
clear all;clc;
%% load mod
cd /Users/tancy/fMRIData_RIKEN/AnalyData/Chisato_131025_01/modFit/
Filename = 'Chisato_FitStatCrt01_1_4s.mat'; %
... |
function data = readcheckerfile(FileName)
if nargin < 1
FileName = 'gsr1113.mch';
end
fid = fopen(FileName, 'r');
data.ChannelName = [];
data.Ext = [];
for i = 1:Inf
tline = fgetl(fid);
if ~ischar(tline), break, end
ChannelName = sscanf(tline, '%c', 16);
tline(1:16) = [];
% Convert blanks ... |
function [L,F,l] = intrinsic_delaunay_cotmatrix(V,F,varargin)
% INTRINSIC_DELAUNAY_COTMATRIX Construct the intrinsic Delaunay Laplacian,
% given a mesh (V,F) or (l,F) according to "A discrete Laplace-Beltrami
% operator for simplicial surfaces" [Bobenko & Springborn 2005] following "An
% Algorithm for the Const... |
clear all
close all
load_data;
logistic = @(x)(1./(1+exp(-x)));
logit = @(p)(log10(p./(1-p)));
%% plot n-way histograms
for T = [1:2]
figure();
imagesc(log10(p10x{T}), [-3 -0.5]), colormap gray;
title(sprintf('%s', names{T}));
hold on;
plot([5.5 5.5], [0.5 10.5], 'm-', 'LineWidth', 2);
plot... |
function [populasyon]=populasyon_olustur(n,d)
populasyon=zeros(n,d);
for i=1:n
populasyon(i,:)=randperm(d);
end
end |
% Matriz con entradas complejas 4x4
J1 = [i 0 0 0;
0 i 0 0;
0 0 i 0;
0 0 0 i];
% Matriz con entradas reales 4x4
V3 = sqrt(3)
J2 = [0 1 1 -V3;
1 0 V3 -1;
1 -V3 0 1;
V3 -1 1 0]; |
classdef (Sealed) UTestBatchLoader < graph.GraphFixture
%UTestBatchLoader Unit test BatchLoader
% This class includes unit tests of Class BatchLoader building and
% loading operations.
%=========================== PROPERTIES ==============================
properties (Constant, GetAccess = p... |
function [ptsDensity] = estimatePtsDensity ...
(pts, noOfTestPts, referenceDistance)
%function [ptsDensity] = estimatePtsDensity(pts, noOfTestPts, referenceDistance)
%
%Estymuje średnią gestość powierzchniową punktów.
%Parametry:
% pts - punkty modelu.
% noOfTestPts - liczba punktów na k... |
function [bDL, bDT] = EPG_diffusion_weights(G,tau,D,Nvals)
% function [bDL bDT] = EPG_diffusion_weights(G,tau,D,Nvals)
%
% Computes array of diffusion weighting values exp(-bD)
% Inputs:
% - G = gradient amplitude(s) mT/m - can be one or more
% - tau = duration of gradients ms - same leng... |
function [nx,ny,nz2,nz_tot,nproc,z_i,L_x,L_y,L_z,dx,dy,dz,u_star,nu_molec]=getParams( param_file_name )
% Reads in simulation parameters from lesgo_param.out
% Uses regular expressions
lesgoParam = fileread(param_file_name);
tokens = regexp(lesgoParam, 'nx, ny, nz, nz_tot :\s*([^]+)', 'tokens');
params = sscanf( to... |
%/**
% Данный скрипт предназначен для расчета показателя beta, определяющего
% потенциальную точность оценки задержки
%*/
clear
close all
clc
path_to_ro = [pwd '/ro'];
path_to_results = [pwd '/results/beta'];
n8max = 80;
m8max = 80;
% Signals_L1; % Параметры приемлимых сигналов
% Beta_BoCsin = nan(m8max, n8max);... |
function Ei200_uvw111_at101TpMod2P(varargin)
root = fileparts(pwd);
data_source= fullfile(root ,'sqw','Data','Fe_ei200.sqw');
bragg = [1,0,1];
dE =5;
dK =0.05;
pefP1 = [-0.24,-0.09,0,0.09,0.29;
65,10,0,10,80];
pefP2 = [-0.24,-0.1,0,0.11,0.29;
60,10,0,10,85];
pefP3 = [-0.24,-0.09,0,0.1,0.29;
60,10,0,10,... |
% Set parameters (n and d)
n=2000;
%n=floor(exp(exp(linspace(1.9,log(log(40000)),20))));
p=size(n,2);
sigmasq = exp(-35.85);
%sigmasq = exp(linspace(-35.7,-36.2,20));
sigma = sqrt(sigmasq);
m=size(sigma,2);
%n = [60 120 240 480 960];
%sigmasq=.01:.07:.4;
%p = size(n,2); % number of sample sizes
%m = size(sigma,2); % nu... |
function [Diffusion_coeff_matrix] = DiffusionCoeff(Norm_grad_scaled)
[ny, nx] = size(Norm_grad_scaled);
mean_image = mode(reshape(Norm_grad_scaled, [nx*ny, 1]));
var_image = var(reshape(Norm_grad_scaled, [nx*ny, 1]));
sd_image = sqrt(var_image);
threshold = mean_image + sd_image;
%Diffusio... |
%% Script to read in 2D array of grade data
% Also provides column names
dataN = csvread('DataClass.csv');
strColumns = {'LabQuiz', 'zyBooks', ...
'Labs', 'Homeworks', ...
'MidtermI', 'MidtermII', 'Final', ...
'ExamAverage', 'Grade'};
% Line styles
strLineStyles = {'--b', ':b'... |
function [ I,z, z_ft, HASH, OFFSET] = outer_1( n, L, x, G, B, W, d, k )
%outer_1 この関数の概要をここに記述
% 詳細説明をここに記述
I = zeors(n, L);
for i = 1:L
[ z, z_ft, I_r, hash, offset ] = Inner_Loop(n, x, G, B, W, d, k);
for j = 1:numel(I_r)
I(I_r(j),i) = 1;
end
HASH(i) = hash;
OFFSET(i) = offset
end
en... |
%Aaron Krauss
%This script prints out 4 graphs of the step function from -1 to 1, and
%they compare the interpolated functions with 8 and 12 points of data and
%the spline graphs with 8 and 12 points of data
%determine base step function for 201 points
x = linspace(-1,1,201);
for i = 1:201
if(x(i) < 0)
... |
function idx = findClosestCentroids(X, centroids)
%FINDCLOSESTCENTROIDS computes the centroid memberships for every example
% idx = FINDCLOSESTCENTROIDS (X, centroids) returns the closest centroids
% in idx for a dataset X where each row is a single example. idx = m x 1
% vector of centroid assignments (i.e. eac... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Created: 01-Dec-2014 11:53:50
% Computer: GLNXA64
% Matlab: 8.1
% Author: NK
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% wait for license
function Yout = fourierFit_WaitForLicense(varargin)
success = false;
timeStamp = now;
% while ~success
% try
You... |
function result=jainsfair(data)
n=length(data);
result=sum(data)^2/n/sum(data.^2);
end |
function [sock,s, remotet0, localt0] = udpConnect(selfip,selfport,remoteip,remoteport)
% [sock,s, remotet0, localt0] = udpConnect(selfip,selfport,remoteip,remoteport)
%
% SPIKESERVERCONNECT opens a udp connection with the plexon rig
remotet0 = 0;
localt0 = 0;
% pnet('closeall');
sock=pnet('udpsocket',selfport);
i... |
%% Not used. This is the comparison of matrix windows and sparse matrix windows.
fs = 44100;
length = 512;
ERB_factor = 6;
lpstopbin = 133;
banding = 101;
Aw_compact = make_Aw_compact(fs, length, ERB_factor, lpstopbin, banding);
Aw = make_Aw(fs, length, ERB_factor);
figure('Name', 'Comparison of original and sparse-ma... |
function J = build_jacobian_torus(torus)
%
% Builds the Jacobian for the current index and parameter values
%
% Input
% leaflet Current parameter values
%
% Output
% J Jacobian of difference equations
% Copyright (c) 2019, Alexander D. Kaiser
% All... |
load('refSet.mat');
rng(0); %set seed for reproducibility of randsample()
files = dir("isolated_digits_ti_test/**/*.wav");
numTestFiles = length(files);
testFiles = randsample(files,numTestFiles);
labels = {'O','Z','1','2','3','4','5','6','7','8','9'};
confMat = zeros(length(labels));
% recognize numTestFiles digits ... |
function [perf,ROCXY,th,p_RP,p_list] = kyu_LR_perftest(data,num_nodes,b,patientID,RPratio)
wrongpts = [];
acc = 0;
lst = [0 0 0 0];
p_RP = [];
num_val = size(data,2);
p_list = zeros(num_val,3);
for j = 1:num_val
[acc_inc,lst_inc,pRP] = kyu_LR_classify(data(:,j),b,RPratio);
if acc_inc ==0 wrongpts = [wrongpts ... |
function drawBoard(h,b)
[rb, cb] = find(b<0); % Neg is black
[rw, cw] = find(b>0); % Pos is white
for p = [rb cb]'
y = p(1); x = p(2);
xoff = (x-1)/h.n;
yoff = (y-1)/h.n;
h.occupied(x,y) = ...
patch(xoff+h.xcirc,yoff+h.ycirc,'black');
% se... |
function fv=f(z);
x=z(1); y=z(2);
%fv=-exp(x+y); Dirichlet and Neumann
%%%%%%%%fv=(x^2-x)*(y^2-y)-2*(x^2+y^2-x-y); Homogenous dirichlet
%fv=0;
fv=0; |
function varargout = DPABISurf(varargin)
% DPABISURF MATLAB code for DPABISurf.fig
% DPABISURF, by itself, creates a new DPABISURF or raises the existing
% singleton*.
%
% H = DPABISURF returns the handle to a new DPABISURF or the handle to
% the existing singleton*.
%
% DPABISURF('CALL... |
function [order,ayy,array_angle,array_angle_amp] = fuction_baoluopu( vdata,pdata,Fs,order_max,numpr,threshold )
array_time_amp=vdata;
pluse=pdata;
N=length(array_time_amp);
t=(0:N-1)/Fs;
Num_pluse1=1;
for temp2=1:length(pluse)-1;
if abs(pluse(temp2))<threshold&&abs(pluse(temp2+1))>=threshold
... |
clear
clc
fid=fopen('grades.dat','r');
t1=fscanf(fid,'%d',1);
t2=fscanf(fid,'%s',13);
t3=fscanf(fid,'%s',1)
t4=fscanf(fid,'%s',1)
t5=fscanf(fid,'%s',1)
t7=fscanf(fid,'%d',10)
for i=1:28
for j=1:13
data(i,j)={fscanf(fid,'%s',1)};
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.