text stringlengths 8 6.12M |
|---|
%% PEB
%% Collate DCMs into a GCM file
cd 'C:\Users\rji4\Desktop\MATLAB\DCM\fMRI Tutorial on DCM & PEB\'
dm = load('design_matrix.mat')
X = dm.X;
X_labels = dm.labels;
% Load GCM
GCM=load('C:\Users\rji4\Desktop\MATLAB\DCM\fMRI Tutorial on DCM & PEB\analyses\GCM_two_models_pre_estimated.mat');
GCM=GCM.GCM;
%%
% % F... |
function rAll = plotPairWise(carlson, mUpdated, method)
rAll=[];
d1 = pdist(carlson, method);
d2 = pdist(mUpdated, method);
rAll = [d1; d2]';
return
for i=1:size(carlson,1)
for j=i+1:size(carlson,1)
r1 = pdist([carlson(i,:); carlson(j,:)],method);
r2 = pdist([mUp... |
markers = ['?','*','&','@','!','+','/','#','$','%','=','|'];
pass = ['a','A','b','B','c','C','d','D','e','E','f','F','g','G','h','H','i','I','j','J','k','K','l','L','m','M','n','N','o','O','p','P','q','Q','r','R','s','S','t','T','u','U','v','V','w','W','x','X','y','Y','z','Z','0','1','2','3','4','5','6','7','8','9'];
... |
% Calculates the pairwise distance distribution and
% power spectrum of data 'filteredI' which is usually CK
% filtered intensity data
% stepSize is the size of the bins in the pairwise distance histogram
function [Istep_axis, power_spectrum]=powerSpectrum(filteredI,stepSize, showOutput)
PwD=pdist(filteredI);
... |
clear;clc;
load('ex6data3.mat');
C = [0.01 0.03 0.1 0.3 1 3 10 30];
sigma = [0.01 0.03 0.1 0.3 1 3 10 30];
error = zeros((size(C,2) * size(sigma,2)),3);
for i = 1 : size(C,2)
for j = 1 : size(sigma,2)
model= svmTrain(X, y, C(i), @(x1, x2) gaussianKernel(x1, x2, sigma(j)));
a = C(i);
b = sigma(j);
erro... |
clc;
clear all;
close all;
s=tf('s');
t=0:0.01:5;
sys1=1.05/(s*s+s+1)/(0.5*s+1)/(0.125*s+1)*(0.150*s+1);
sys2=1.05/(s*s+s+1)/(0.5*s+1);
y1=step(sys1,t);
y2=step(sys2,t);
[a,b,c,d,e,f,g1]=value(y1,t(2)-t(1));
[a,b,c,d,e,f,g2]=value(y2,t(2)-t(1));
plot(t,y1,'b',t,y2,'r--');
legend(g1,g2,4);
% title('G(s)=1.0... |
% Copyright (c) 2012 Howard Hughes Medical Institute.
% All rights reserved.
% Use is subject to Janelia Farm Research Campus Software Copyright 1.1 license terms.
% http://license.janelia.org/license/jfrc_copyright_1_1.html
function addSymphonyFramework()
if isempty(which('NET.convertArray'))
%... |
function [results] = CompareSolversRun(varargin)
% alg1,alg2,numAnchors,blPlot,blSavePlot,blUWBnoise,blPlotClean,blDuration
close all;
clc;
%% Parse varargin
% Test for right input
minargin = 3;
maxargin = (minargin+5)*2;
if nargin < minargin
error([ mfilename ':Needs at minimum' num2str(minargin) ' argument(s) ']... |
%Phu Tran
%Homework #4
%AMATH 481
%11/19/15
clc; close all;
%setup
L = 10;
n = 64;
dx = 2*L/n;
dy = dx;
x = -L:dx:L;
x = x(1:n);
y = x;
dt = 0.5;
tEnd = 4;
tSpan = 0:dt:tEnd;
%Make A
e1 = ones(n,1);
subA = spdiags([-4*e1 e1 e1 e1 e1], [0 -1 1 -(n-1) (n-1)], n, n);
e2 = ones(n^2,1);
A = spdiags([... |
% Script to remove interferance bars from a stack of images.
function [DataOut] = RemoveBars(DataOut, Dir)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
disp('Removing bars...');
% Calculate master pro... |
function [res] = evaluate_jump(llcoord,grid,params,tria_index,local_vertex_index)
%Function evaluating jump of VECTORIAL basis function at internal boundary of grid.
%The basis functions are to be created as row vectors. Output is column vector
face_index = local_vertex_index;
basis = ldg_evaluate_basis(llocal2local(gr... |
function [ header ] = ffawrite( filename, header, data )
%
% function [ header ] = ffawrite( filename, header, data )
%
% Writes out an the specified data to a .ffa file.
%
% The return header will contain the raw header string written
% and the numvoxels field will indicate the number actually written
... |
function [Spec_cat,Trials, Subject, AnalParams, CondParams] = grab_data(subject, conditions, cue, epoch)
% returns channels x trials x time x frequency
% global DUKEDIR;
% DUKEDIR= 'c:/matlab/data';
AnalParams.Tapers = [.5,10];
AnalParams.fk = [0 250];
AnalParams.Reference = 'Grand average';
AnalParams.ArtifactT... |
function options = surfoptions
%SURFOPTIONS Default options for SURF interest point calculation
%
% OPTIONS = SURFOPTIONS returns a structure with fields initialized to
% default values.
%
% Parameters are directly passed into OpenCV. If not present,
% OpenCV's default vaules are used.
%
% See also SURFP... |
function firmware = s88x_getFirmware()
%s88x_getFirmware: gets firmware version information for S88X. Useful to
%'ping' the S88X host. -Adam C. Snyder adam@adamcsnyder.com
global lib cmd
msgPtr = libpointer('voidPtr',uint8(cmd.acknowledge));
resp = uint16(zeros(1,6));
respPtr = libpointer('voidPtr',resp);
callli... |
function [dee, dI]=g_extractor(x)
xname=ls(['*ens',num2str(x),'*.txt']);
xname(isspace(xname))=[];
dash_place=find(xname=='_');
xdot=find(xname=='.');
dee=str2double(xname(dash_place(2)+1:dash_place(3)-1));
dI=str2double(xname(dash_place(4)+3:xdot-1));
|
clc; close all; clear all;
% Select mesh
meshopts = {'heatsink4_h105_gmf005','heatsink4_h205_gmf005','heatsink8_h105_gmf005','heatsink8_h205_gmf005'};
[Selection, status] = listdlg('PromptString','Select mesh',...
'SelectionMode','single',...
'ListString',meshopts);
% Load the mesh
dir_name = strcat('../../Mes... |
function [sout,char_table]=load_alpha()
% take alpha.txt and make it a cell array
% had to add 'x' delimiters
% Copyright 2002-2010 The MathWorks, Inc.
fid = fopen('alpha.txt','rt');
s=fscanf(fid,'%s \n'); % one big long string
sout = {}; % cell array
k=finds... |
clear; clc;
Player1 = [26
16
33
8
5
46
12
47
39
27
50
10
34
20
23
11
43
14
18
1
48
28
31
38
41];
Player2 = [45
7
9
4
15
19
49
3
36
25
24
2
21
37
35
44
29
13
32
22
17
30
42
40
6];
lengthPlayer1 = length(Player1);
lengthPlayer2 = length(Player2);
%%
i = 0;
while 1
i = i + 1
playCard1 = Player1(1);
play... |
function [cues,R,dsnd] = findauditbydepth(tag,stype,depth,dive)
%
% [cues,R,dsnd] = findauditbydepth(tag,stype,depth,dive)
% Find all entries in the audit of tag with sound type stype and that
% occur at a depth deeper than 'depth'.
%
% [cues,R,dsnd] = findauditbydepth(tag,stype,depth,'dive')
% Fin... |
mex udists_MEX.c
mex ISI_MEX.c
mex SPIKEpico_MEX.c
mex realtimeSPIKEpico_MEX.c
mex futureSPIKEpico_MEX.c
mex SPIKE_MEX.c
mex realtimeSPIKE_MEX.c
mex futureSPIKE_MEX.c
|
%LatGasDiff.m: Nanoparticle swelling/energy transfer/exciton diffusion
%simulation based on lattice gas model -LCG 02/03/2014
%Summary: Random walk model simulating exciton motion in a cubic
%nanoparticle. Accounts for changes in chromophore density as
%solvent quality shifts, where excitons hop from one
%available ch... |
cd('D:\Research_CfA\FTS\')
addpath(genpath('C:\Users\Kang Sun\Dropbox\matlab functions'))
setup_nctoolbox
%%
% define when the forecast was run
year_run = '2016';
month_run = '07';
day_run = '26';
hour_run = '18';
% define the forecast time, should be ~noon of the measurement day
hour_ahead = [18 21 24 27];
year_foreca... |
function [xx,yy,data] = visual2d_scatter(x,y,s,color,repeat)
%VISUAL2D_SCATTER Plot 2D array with scattered position
% x,y - the 2D array for coordinates x and y
% s - the data, 2D array
switch nargin
case 3
color = 1;
repeat = [2,2];
case 4
repeat = [2,2];
end
% rep... |
function [R,M,k] = circumcenter(A,B,C)
% Center and radius of the circumscribed circle for the triangle ABC
% A,B,C 3D coordinate vectors for the triangle corners
% R Radius
% M 3D coordinate vector for the center
% k Vector of length 1/R in the direction from A towards M
% (Curvature ... |
function test_suite = test_intersectLineSphere
%TESTINTERSECTLINESPHERE One-line description here, please.
%
% output = testIntersectLineSphere(input)
%
% Example
% testIntersectLineSphere
%
% See also
%
%
% ------
% Author: David Legland
% e-mail: david.legland@grignon.inra.fr
% Created: 2011-06... |
function [out1,out2,out3,out4,out5,out6] = divideint(in1,varargin)
%DIVIDEINT Partition indices into three sets using interleaved indices.
%
% [trainInd,valInd,testInd] = <a href="matlab:doc divideint">divideint</a>(Q,trainRatio,valRatio,testRatio)
% takes a number of samples Q and divides up the sample indices 1:Q
% b... |
function [ out ] = pseudosim( input_args )
v=0;D=0.1; pp=0.4; alp=1.9;
pseudo=@(s) 0.1*s.^alp+50*(exp(-pp*s)-1+pp*s)-v*s+D*s.^2; %+10*(exp(-2*pp*s)-1+2*pp*s)+70*(exp(-(1.5)*pp*s)-1+(1.5)*pp*s)
nx=2000;
dt=0.0005;
TFin=1;
BC=4;
%% setup
x=linspace(0,1,nx)';
dx=x(2)-x(1);
M=PseudoOpmatrixwithBC(BC,pseudo,nx,dx,1);
... |
function fetchPretrainedModel(modelDir, modelName)
%FETCHPRETRAINEDMODEL downloads a pretrained network
% FETCHPRETRAINEDMODEL(modelDir, modelName) downloads a
% model named `modelName` and stores it in the directory
% `modelDir`
switch modelName
case 'alexnet_imagenet'
url = 'http://www.vlfeat.or... |
% Helper Classes for mUnit Test Suite
%
% TestCase Subclasses
% BadFixture - Contains setUp method that throws exception
% FailingTestCase - Contains one test method that throws exception
% LoggingTestCase - Logs calls to setUp, tearDown, and test method
% NoTestMethods - TestCase subclass that contains n... |
%%
%ITERACION DE PICARD O ITERACION DE PUNTO FIJO
clear
% funcion x^3+4x^2-10 sobre intervalo [a,b] = [1,2]
f = @(x) x^3+4*x^2-10;
a = 1; b = 2; ancho = b-a;
fa = f(a); fb = f(b);
% raiz exacta
x = 1/3*(-4 + (71 - 3*sqrt(105))^(1/3) + (71 + 3*sqrt(105))^(1/3));
% funciones gj
g{1} = @(x) x-x.^3-4*x.^2+10;
g{2} = @(x... |
run('robot-9.10/rvctools/startup_rvc.m');
mdl_wam
wam
n = wam.n
k = 100;
Q = zeros(k, n);
BigQ = [];
JAMatrix = JMatFixedWam;
% JAMatrix = JMatBodyWam;
for i=1:size(JAMatrix, 1)-1
q0 = JAMatrix(i, :);
qf = JAMatrix(i+1, :);
for j = 1:n
Q(:,j) = linspace(q0(j), qf(j), k);
end
BigQ = [BigQ... |
function ShowSoundField(r, z, tl, tlmin, tlmax, casename, interface)
disp('plot the transmission loss field!');
figure;
pcolor( r, z, tl); hold on;
plot(r, interface*ones(length(r)), 'k--', 'Linewidth', 1.5);
title(casename);
caxis([tlmin tlmax]);
colormap(flipud(jet));
shading flat;... |
function [ A,b,partition,lambda ] = GenerateRandomGroupLassoDataSet( m,K,density )% density default value should be 100
partition = int32(randi(175, [K 1]));% per Boyd example
n = int32(sum(partition)); % number of features
p = single(density/single(n)); % sparsity density
x = single(zeros(n,1));
start_... |
function varargout = manualedit(fitarray,stackid,cntarray,sd)
if ischar(stackid)
% file name
file = load(stackid);
stack = file.stack;
config = get(stack,'config'); %#ok<NODEF>
elseif isstruct(stackid)
% config struct
config = stackid;
stack = imageseque... |
function dataGen(data, labels, varargin)
% DATAGEN(data, labels, 'name', 'file_name') creates .dat, .lab, and .meta
% files based on the data, labels and additional options provided.
%
% DO NOT CHANGE THIS FILE, COPY IT INSTEAD AND CHANGE THE VERSION
% load the default values
a = defaults;
a.observa... |
function a=SimMechanics1Event(x)
a=[x.states(1,1); x.states(2,1);...
x.states(1,end); x.states(2,end)];
|
function stastruct=sta_onetrace(itrace,otrace,thresh,plotflag,dt,pulselength,saveCopyDir,filename,startframe,endframe)
%stimulus triggered averaging
%one trial
%uses mseq pulselength from meta.mat *important to have filled out*
if nargin<6
saveCopyDir='/Users/skato/Desktop/Dropbox/MATLAB/Chron/Output/Yifan';
en... |
function [distance_matrix] = rbf_kernel(X, Y, gamma)
if nargin < 3
gamma = 1 / size(X, 2);
end
X_shape = size(X);
Y_shape = size(Y);
distance_matrix = zeros(X_shape(1), Y_shape(1));
for i = 1:X_shape(1)
for j = 1:Y_shape(1)
distance_matrix(i, j) = exp(-gamma * norm(X(i, :) - Y(j, :)) ^ 2);
end
end
... |
classdef SPX_Statistics < handle
methods(Static)
function [ statistic ] = compute_statistic_per_vector(...
receivedSequence, N, statisticFunc)
%COMPUTE_STATISTIC_PER_VECTOR Computes a statistic for each vector
% Detailed explanation goes here
% Number of ... |
% calculate clusters diversity
% find all clusters and p(cluster)
% find mean pitch, FM, entropy, duration for each cluster
% normalize them according to SAP scale
% for each pair of clusters: find accoustic distance, and multiply by pi pj
% usage: first export table from mySQL WorkBench
% usage: [results, diversity]=... |
% script_calculateRatSummaries
% calculate the following kinematic parameters:
% 1. max velocity, by reach type
% 2. average trajectory for a session, by reach time
% 3. deviation from that trajectory for a session
% 4. distance between trajectories
% 5. closest distance paw to pellet
% 6. minimum z, by type
% 7. numb... |
%% Rocky
I1 = imread('v1.jpg');
I2 = imread('v2.jpg');
I3 = imread('v3.jpg');
I12 = my_mosaic(I2, I1);
I123 = my_mosaic(I12, I3);
%% mountain
%{
I1 = imread('m1.jpg');
I2 = imread('m2.jpg');
I3 = imread('m3.jpg');
I12 = my_mosaic(I2, I1);
I123 = my_mosaic(I12, I3);
%}
%% modlab
%{
I1 = imread('modlab1.jpg');
I2 = i... |
function [f, g] = deorbit_shoot(x)
% objective function and EI equality constraints
% input
% x(1) = current value of maneuver true anomaly (radians)
% x(2) = x-component of deorbit delta-v vector (kilometers/second)
% x(3) = y-component of deorbit delta-v vector (kilometers/second)
% x(4) = z-component... |
clear, clf
% Introducerea nodurilor dupa o functie definita
x=0:0.01:5;
y=-3+2.*x-0.7.*x.^2;
% Introducerea unei valori eronate
y(100)=4;
% Reprezentarea nodurilor considerate
figure(1)
plot(x,y,'b')
% Calcularea valorii medii si a abaterii standard
medie=mean(y)
abat_std=std... |
close all;
clc;
%wmask = [-1 0; 0 1];
w1 = [-1 -2 -1; 0 0 0; 1 2 1];
w2 = [-1 0 1; -2 0 2; -1 0 1];
r = imread('child2.jpg');
gr = rgb2gray(r);
figure(1);
subplot(1,2,1); imshow(gr); title('Original Image');
%w = gr(1:4,1:4);
[H,W] = size(gr);
new = zeros(H,W);
R=H+2;
C=W+2;
temp = zeros(R,C);
for i=2:R-1
... |
function runSimSCFDE()
SP.FFTsize = 512;
SP.CPsize = 20;
SP.SNR = [0:2:30];
SP.numRun = 10^4;
% TS 25.104
pedAchannel = [1 10^(-9.7/20) 10^(-22.8/20)];
pedAchannel = pedAchannel/sqrt(sum(pedAchannel.^2));
vehAchannel = [1 0 10^(-1/20) 0 10^(-9/20) 10^(-10/20) 0 0 0 10^(-15/20) 0 0 0 10^(-20/20)];
vehAcha... |
function [X, y] = readXyFromFile(fileName)
data = load(fileName);
X = [ones(size(data, 1), 1), data(:, 1:end - 1)]; % Add a column of ones to x
y = data(:, end:end);
end
|
%
% Constructs a stationary covariance matrix from the stationary
% covariance representation cs (see make_band_cov_oper) for application to
% vectors of dimensionality n. The form of the covariance depends on the
% choice of the periodic boundary conditions (bc_func).
%
% note: this is just a convenience functi... |
function [] = linearSeparability()
% 10 Data Blocks
D = cell(10, 1);
% 10 Label Blocks
L = cell(10, 1);
% Initialize blocks.
for i = 1:10
dataFileName = strcat('data/data', strcat(int2str(i), '.csv'));
labelsFileName = strcat('data/labels', strcat(int2str(i), '.csv'));
D{i} = csvread(dataFileName);
L{i} = csvr... |
function MemToolbox2DSimDistrRadial(nIter)
% MemToolbox2DSimDistrRadial(nIter)
% simulation with a radial bias towards a distractor on each trial, with bias correction
% also compares the bias correction to a misbinding model fitting
%
% requires the following functions from matlib:
% makeSubplotScalesEqual(), n... |
clear;
%% Alignment를 읽어 저장하는 프로그램
genenum = 11;
name = cell(genenum,1);
tempiden = zeros(genenum,genenum,2);
tempidenscore = zeros(genenum,genenum,2);
tempgap = zeros(genenum,genenum,2);
tempgapscore = zeros(genenum,genenum,2);
BLASTiden = zeros(genenum,genenum);
BLASTgap = zeros(genenum,genenum);
BLASTiden... |
function I = template6(N)
% generate template half circle/ half ellipse
I=zeros(N,2);
theta=zeros(N,1);
%implemet I0
for i=1:N/2
theta(i) = (i-1)*2.0*pi/N;
I(i,1)=3.*cos(theta(i));
I(i,2)=3.*sin(theta(i))-1;
end;
for i=(N/2+1):N
theta(i,1) = (i-1)*2.0*pi/N;
I(i,1)=3.*cos(theta(i));
... |
function varargout = UpdateEmployee(varargin)
% UPDATEEMPLOYEE MATLAB code for UpdateEmployee.fig
% UPDATEEMPLOYEE, by itself, creates a new UPDATEEMPLOYEE or raises the existing
% singleton*.
%
% H = UPDATEEMPLOYEE returns the handle to a new UPDATEEMPLOYEE or the handle to
% the existing singleton... |
% Input: robot -> A 2-DOF robot encapsulated in a MATLAB cell with fields:
% robot.link1, robot.link2, robot.pivot1, robot.pivot2
% See description in hw2_cspace and demo code in C1.
% q -> 2x1 vector denoting the configuration to convert to polygons
% Output: poly1 -> A polys... |
function [q_pos, p_vel, pPRIME_acc, gamma_packet_width, eta_packet_momentum, etaPRIME_acc] = ...
initialize_morse_CPL(simulation_steps, q_0, gamma_0)
% position
q_pos = zeros(1, simulation_steps);
q_pos(1, 1) = q_0;
% velocity
p_vel = zeros(1, simulation_steps);
% acceleration
... |
function [ AngleNew ] = wrapTo360Fun( Angle )
AngleNew = Angle;
idx = find(Angle < 0 );
AngleNew(idx) = AngleNew(idx) + 360;
end
|
function [r, c, A, A_t] = hough2d(img1, p1, img2, p2, binsize, thres);
% Ευρεση της εικονας img1 μεσα στην img2
%Yπολογισμος διαστασεων εικονων
r1 = size(img1,1); c1 = size(img1,2);
r2 = size(img2,1); c2 = size(img2,2);
%Kατασκευη accumulator με καταλληλο μεγεθος
A = zeros(r1+r2-1,c1+c2-1);
%Kατασκευη ... |
function[]=plot_phi(num)
sphi="phi_test"+num2str(num)+".dat";
snbv="nbv_test"+num2str(num)+".dat";
phi=fftomatlab_vector(sphi);
nbv=fftomatlab_vector(snbv);
loglog(nbv,phi,'-*')
legend("phi")
xlabel("number of vertices in the mesh")
ylabel("value of phi")
title("variation of phi with adaptmesh") |
Gdot = tf([q(1) q(2) q(3) q(4) q(5)], [1 q(6)],62/1000,'variable','z^-1');
%Step Function input
% input_signal = [zeros(1,100),ones(1,100)];
input_signal = in;
%Simulate data with discrete transfer function
y=lsim(Gdot,input_signal);
% figure(8)
% plot(y,'r')
% hold on
% plot(input_signal,'b')
% axis([ 0 200 -4 8])
... |
clc;clear;close all
free = 4.543;
data = load('CFD_ground.txt');
baseline = data(1,2);
distance = data(1:end,1)/1;F = data(1:end,2)/baseline;
plot(distance,F,'LineWidth',1);hold on
data = load('CFD_ceiling.txt');
baseline = data(1,2);
distance = data(1:end,1)/1;F = data(1:end,2)/baseline;
plot(distance,F,'LineWidth',... |
% SAVENAME='initialG_flat2800_precession_stats.mat'
r_avg=r_avg';
SAVENAME
save(SAVENAME,'mHe','ZHe','omega_crash','alphas_kappa','alphas_lambda','r_avg','q_avg','phidot_avg','omega_ntm32_avg','omega_ntm43_avg','omega_ae_avg','omega_ik_avg',...
'omega_psi_avg','omega_precess_avg','omega_r_avg','delta_r_avg','r_vp... |
function OverSall
initialise
sleep(60)
DR='/scratch/uni/ifmto/u300065/FINAL/smAor/';
Fnows={'iq2';'iq6';'iq6dl';'iq6dlMr';'iq6dlMrIc';'iq8';'iq4';'ch'};
Dnows=cellfun(@(c) ['data' c],Fnows,'uniformoutput',false);
dbstop if error
Rdata=[DR 'dataC/'];
%%
for ii=1:numel(Fnows)
... |
function varargout = gui3dPtSelector(varargin)
% GUI3DPTSELECTOR M-file for gui3dPtSelector.fig
% GUI3DPTSELECTOR, by itself, creates a new GUI3DPTSELECTOR or raises the existing
% singleton*.
%
% H = GUI3DPTSELECTOR returns the handle to a new GUI3DPTSELECTOR or the handle to
% the existing singlet... |
function draw_cells2scale(V, myAxes, color_border, width_border, ...
txt_cell, cells2draw, color_face, nomcellsize, wksp)
if numel(myAxes)
axes(myAxes); hold on;
end
if (nargin <= 5) || (numel(cells2draw) == 0)
cells2draw = 1:size(V, 1);
end
if width_border > 0
for m = cells2draw
if (nargin <= 7)
rect_posn ... |
function RedrawAxes(self, ~, ~)
MCS = MClust.GetSettings();
% Something has changed in the control window, redraw as necessary...
if self.get_redrawStatus()
% window for display
if isempty(self.CC_displayWindow) || ~ishandle(self.CC_displayWindow)
% create new drawing figure
self.CC_disp... |
%Good Guess
%gradient = (Vol(NodesX,NodesT)-Vol(1,NodesT))/(exp(x(NodesX))-exp(x(1)));
%for i = 1:NodesT
% for j = 1:NodesX
% Vol(j,i) = Vol(1,NodesT) + (exp(x(j))-exp(x(1)))*gradient;
% end
%end
%firstguess = Vol;
%Lambda = 0.5*lambda*ones(NodesT,1);
Lambda = 0.3*lambda*ones(NodesT,1);
|
function [casename, Nw, Nb, cpmax, freq, zs, zr, rmax, dr, interface, ...
bottom, dz, Lowerboundary, tlmin, tlmax, depw, cw, rhow, alphaw, ...
depb, cb, rhob, alphab] = ReadEnvParameter(env_file)
fid = fopen(env_file);
casename = fgetl(fid);
Nw = fscanf(fid, '%d', 1);
... |
function circpendulum(t0,y0,w,r,l);
% CIRCPENDULUM - integrate the equations of motion for a pendulum
% travelling on a vertical circular track and simulate for given initial
% conditions.
%
% circpendulum(t0,y0,w,r,l) where t0 is the time array [tmin tmax], y0 is
% the initial conditions [theta_init, theta_dot_init], ... |
% You should install in your path the following directories:
%
% WaveLab
% WaveLab/Browsers/One-D
% WaveLab/Datasets
% WaveLab/DeNoising
% WaveLab/FastAlgorithms
% WaveLab/Interpolating
% WaveLab/Orthogonal
% WaveLab/Packets
% WaveLab/Packets2
% WaveLab/Papers
% WaveLab/Papers/Adapt
%... |
function save_trace(indices, x, y, z, filename)
n = size(x, 1);
xx = reshape(x, [n*n, 1]);
yy = reshape(y, [n*n, 1]);
zz = reshape(z, [n*n, 1]);
pointcloud = [xx, zz, yy];
pointcloud = pointcloud(indices, :);
f_id = fopen(filename, 'w');
fprintf(f_id, 'union {\n');
c1 = 1;
c2 = 0;
c3 = 0;
for id = 1 : size(pointcloud, ... |
close all; clc; clear;
figure; hold on;
c1 = 0.02;
alpha = 0;
beta = 0;
shift = [0; 0; 0];
right_circular_cone('c', c1, alpha, beta, shift);
c2 = 0.006;
alpha = 0;
beta = pi/4;
shift = [0; -2; 0];
right_circular_cone('y', c2, alpha, beta, shift);
|
%read data values
dataV = dlmread('kV.dat');
%Calculate basic statistics
meanV = mean(dataV);
stdV = std(dataV);
diaspV = stdV^2;
%The significance level
alevelV = 0.95;
alphaV = 1-alevelV;
nfreeV = length(dataV)-1; %Degrees of fredom
%The left and right values of chi2 in that significance level
leftchi2V = chi2in... |
%%%%%%%%%%%%%%%%%%%%%% GUI Initialisation and standard headers %%%%%%%%%%%%%%%%%%%%%%%%
function varargout = part4_gui(varargin)
% PART4_GUI MATLAB code for part4_gui.fig
% PART4_GUI, by itself, creates a new PART4_GUI or raises the existing
% singleton*.
%
% H = PART4_GUI returns the handle to a new PA... |
function [ g, Gbar ] = erlang_dist(k, lam, x)
%
g=(lam^k .* x.^(k-1) .* exp(-lam.*x)) / (factorial(k-1));
Gbar=zeros(1,length(x));
for kk=0:(k-1)
Gbar=Gbar+((lam*x).^kk .* exp(-lam .* x))/(factorial(kk));
end
g(isnan(g))=0;
Gbar(isnan(Gbar))=0;
end |
function a = gmmClassify_3(M, epsi, S)
dir_test = '/u/cs401/speechdata/Testing';
gmm_location = '~/csc401/a3/21gmm.mat';
gmms = gmmTrain_sp('/u/cs401/speechdata/Training', 1000, epsi, M, S)
%load(gmm_location);
DD = dir( [ dir_test, filesep, '*', 'mfcc' ] );
dir_length = length(DD);
%disp(dir_length);
for iFile=1:d... |
%% Explanation
% This is my code generated using appdesigner to create a GUI for pitch
% shifting and time stretching. In the GUI the user will be able to specify
% variables and subsequently press buttons to plot and play the sound of
% the original signal, the time stretched signal and the pitch shifted
% signal. I... |
function [C,label]=rpcl(Dw)
% MATLAB implementation of Rival-Penalized Competitive Learning (RPCL)
% Source:
% L. Xu, A. Krzyzak and E. Oja 1993, "Rival penalized competitive
% learning for clustering analysis, RBF net, and curve detection,"
% IEEE Trans. Neural Networks, vol. 4, no. 4, p. 636--648.... |
function [U,E,J] = slice_triangles(V,F,plane,varargin)
% SLICE_TRIANGLES
%
% Inputs:
% V #V by 3 list of vertex positions
% F #F by 3 list of triangles indices into V
% plane 4-long plane equation [nx ny nz -d]
% Outputs:
% U #U by 3 list of vertex positions
% E #E by 2 list of edge in... |
function h = rrcfilter(nf,n,b,s)
% Root raised cosine filter
% INPUT
% nf : length of total x axis
% n : number of samples for filtering
% b : number of samples for roll off
% s : starting point
h = zeros([1,nf]);
t1 = 1:nf;
h(1+s:s+n) = ones([1,n]);
h(1+s:s+b) = (-cos(2*pi*t1(1:b)/(2*b))+1)*0.5;
h... |
function f = Fx(x,u)
%FX State transition function
%
% x = [ px , py , theta , kappa , v , s]'
%
% px'(t) = v(t)cos(theta(t))
% py'(t) = v(t)sin(theta(t))
% theta'(t) = kappa(t)
% kappa'(t) = u1
% v'(t) = u2
% s'(t) = v(t)
f = zeros(6,1);
f(1) = x(5)*cos(x(3));
f(2) = x(5)*sin(x(3));
f(3) = x(4);
f(4) ... |
% 10.1
disp('10.1')
p = [1 2 5];
disp(roots(p));
% 10.2
disp('10.2')
p = [ 1 -6 11 6 ];
disp(roots(p));
% 10.3
disp('10.3')
p = [ 1 0 -14 0 49 0 -36 0 ];
disp(roots(p));
% 10.4
disp('10.4')
p = [ 1 2 3 -26 -2 72 -104 0 ];
disp(roots(p)); |
%MIT License
%Copyright (c) 2020 Sherman Lo
classdef DefectDetectSubRoiTiFilterDeg30Gpu < DefectDetectSubRoiTiFilterDeg30
methods (Access = public)
function this = DefectDetectSubRoiTiFilterDeg30Gpu()
this@DefectDetectSubRoiTiFilterDeg30();
end
end
methods (Access = protected)
... |
function [i,j] = find(x)
%FIND Find indices of nonzero elements.
% [I,J] = FIND(X) returns the row and column indices of nonzero elements
% of the distributed matrix X.
% NOTE: Currently supports only [i,j] = find(x) calling convention.
% Only works on 2D arrays.
%
% Author: Nadya Travinin
%g... |
function [S,R] = Metropolis(S1,S2,D,T)
%% 输入
% S1: 当前解
% S2: 新解
% D: 距离矩阵(两两城市的之间的距离)
% T: 当前温度
%% 输出
% S: 下一个当前解
% R: 下一个当前解的路线距离
R1 = PathLength(D,S1); %计算路线长度
N = length(S1); %得到城市的个数
R2 = PathLength(D,S2); %计算路线长度
dC = R2 - R1; %计算能力之差
if dC < 0 %如果能力降低 接受新路线
S =... |
function [alpha, beta, gamma, loglik, xiSum] = forwardbackward(prior, a_ij, B)
%% Iniz.
[M, T] = size(B);
scale = ones(1, T);
loglik = 0;
alpha = zeros(M, T);
beta = zeros(M, T);
gamma = zeros(M, T);
xiSum = zeros(M, M);
%% Forwards
t = 1;
alpha(:, 1) = prior .* B(:,t);
[alpha(:, t), scale(t)] = normalise(alpha(:, t... |
%INCLINING21 Inclining Experiment data for Example 7.1.
% Data taken from Hansen (1985), `An analytical treatment of the accuracy of the
% results of the inclining experiment', Naval Engineers Journal, Vol. 97, No.4,
% May, pp. 97-115.
% Format is [ moment tangent ], initial units [ ft-tons - ]
% Companion file ... |
function save_surface_maps(session_dir,hemi,func,rr,srcind)
seedSig = .5:.5:10;
distmat = load(fullfile(session_dir,[hemi '.V1.dists.mat']));
trgdists = distmat.allDistances;
V1 = load_nifti(fullfile(session_dir,[hemi '.areas.nii.gz']));
trgind = V1.vol<=1 & V1.vol >=-1;
load([hemi '.' func '.cfs.mat']);
% Load ecc and... |
%function vec=mgrp2vec(mangrpfile)
function vec=mgrp2vec(mangrpfile)
fid=fopen(mangrpfile,'r');
while 1
rad=fgetl(fid);
if rad==-1,break;end
if strcmp('MANGRP',rad(1:6))
i=find(rad=='=');
j=find(rad==',');
ll=length(rad);
m=remblank(rad(8:i-1));
j=[i j length(rad)+1];
for k=2:length(j)
... |
function h = erx(p1, p2)
% h = erx(p1, p2)
%
% Implements Edge Recombination Crossover (ERX) of permutations
% p1 and p2.
% M. Valenzuela
% 5/16/2002
global edges lengths
lengths = [];
n = length(p1);
CreateEdgeTable(p1,p2);
prevCity = 0;
for i=1:n
h(i) = FindMinCity(prevCity);
% fprintf('i = %d\n', i)
... |
function [C, sigma] = dataset3Params(X, y, Xval, yval)
%DATASET3PARAMS returns your choice of C and sigma for Part 3 of the exercise
%where you select the optimal (C, sigma) learning parameters to use for SVM
%with RBF kernel
% [C, sigma] = DATASET3PARAMS(X, y, Xval, yval) returns your choice of C and
% sigma. You... |
function po = knossos_efpl_plot(output_path, pdata,o,p)
if ~isfolder(output_path)
mkdir(output_path)
end
useColorOrder = ~verLessThan('matlab','8.4');
% remove really small internode distances that are just from dropping nodes right next to each other
minPL = 10^(p.plx(1)-p.dplx(1)/2);
po = struct;
ndatasets ... |
function y=negativo(x)
%Function to make values negative
y=-x; |
clear all
close all
clc
format SHORTE
m = 11;
x = linspace(0,1,m);
x = x(:);
data = fliplr(vander(x));
% noisy data
thetas = zeros(m,m);
c = zeros(m,1);
mmse = zeros(m,1);
y = x.^2 + .01 * randn(length(x),1);
x1 = linspace(0,1);
y1 = x1.^2;
figure
plot(x,y,'o')
hold on
plot(x1,y1)
hold off
for i = 1:m
X = ... |
%Creating the comparison for it
%Use a structure with different vector lengths
%Source for songs: http://www.stonewallbrigadeband.com/UnisonSongsTrumpet.pdf
%structure is named SongLibrary
%Fields:
% Name >> The name of the song (A string)
% PrimTune >> A vector which can be compared to neutralTune
function Tune... |
function Goda
v = 16;
a=1.;
% number of grid points in space (not counting the point at x=1, which is the same as the point at x=0, due to the periodicity)
N=50;
% spatial step
h =(1./(N));
% safety constant for stability (should be smaller than 1)
cfl=.8;
% CFl timestep limit for t... |
function plotFig1c(save_fig)
%PLOTFIG1C Plots single threshold-direction map for example L2/3 PC,
%monophasic TMS pulse
%
% AUTHOR : Aman Aberra
if nargin == 0
save_fig = 0;
end
mat_dir = addPaths;
nrn_model_ver = 'maxH';
tms_mode = 1; % monophasic
cell_id = 6; % 'L23_PC_cADpyr229_1'
model_prefix = sprintf('... |
function dnn = f_dnn(dis,bnd,dat)
% - distance-based Nearest Neighbor Graph from 2-D spatial coordinates
%
% USAGE: dnn = f_dnn(dis,bnd,{dat})
%
% dis = symmetric distance matrix
% bnd = col vector specifying upper/lower bounds (e.g., bnd = [0 0.25])
% dat = optional Euclidean coordinates of objects corresponding to ... |
%% Scientific computing Project
clc
clear
%Iterations where delta_x = delta_y
Nx = 10;
Ny = 10;
nt = 5;
%Paramiter
D = 1;
%Domain
ax = 0;
ay = ax;
bx = 2*pi;
by = bx;
%Steps
dx = (bx-ax)/(Nx-1);
dy = (by-ay)/(Ny-1);
dt = (min([dx,dy])^(2)/4);
x= 0:dx:(bx-ax);
y= 0:dy:(by-ay);
x =... |
function posi = TrouverImageVirtuelle(poso, omega, distance)
% Omega est la direction initiale du rayon.
posi = poso + omega * distance;
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.