text stringlengths 8 6.12M |
|---|
function output = find_h(x)
% This function solves the steady state value of the housing ratio
% distributed among households and entrepreneurs.
global epsilon v gamma beta paramj m_star_st
%find the steady state value of h
output= (1-gamma-m_star_st*beta*(1-gamma/beta))*paramj*(1+(1-v)*(epsilon-1))*x/(1-beta)/((ep... |
function [type,confInfo]=init_ConfigurationVar(fileName)
fid=fopen(fileName);
C1=textscan(fid,'%s');
% variables
type=cell2mat(C1{1}(1));
confInfo.commonInfoFile=cell2mat(C1{1}(2));
confInfo.geometryInfoFile=cell2mat(C1{1}(3));
confInfo.mathInfoFile=cell2mat(C1{1}(4));
confInfo.domainApplyTypeInfoFile=cell2mat(C1{1}(5... |
function out = plus(ina,inb)
if isa(ina,'hderiv') && isa(inb,'hderiv')
out = mder_mder(ina,inb);
elseif isa(ina,'hderiv')
out = mder_mvar(ina,inb);
else
out = mder_mvar(inb,ina);
end
out = class(out,'hderiv');
function out = mder_mder(ina,inb)
out = struct('value',[],'dV',[],'ddV',[],'nzx',[... |
clc
clear all
image = double( imread( 'data/images/lena.tif' ) );
[ height width dimension ] = size( image );
for k = 1 : dimension
for j = 1 : height
for i = 1 : width - 1
error ( j, i, k ) = image( j, i+1, k ) - image( j, i, k );
end
end
end
pmf = hist( error( : ), -255 : 255 );... |
run /home/als/physbase/machine/ALS/StorageRing/setpathals_storagering
% epbitest3;
disp(' ');
disp(' ');
disp(' GUI is not ready yet for EPBI test3, so you''ll have to run it from a Matlab script.');
disp(' ');
disp(' ');
edit epbitest3script
|
function showaligned(condition,filenb)
aligneddir='/Users/Frank/Desktop/monkeylab/data/processed/aligned/';
mstart=1000;
mstop=500;
fsigma=12;
[mainsacalgndirfiles rewardalgndirfiles stopsignalgndirfiles]= ...
listprocessedfiles(aligneddir);
msunderscores=strfind(mainsacalgndirfiles,'_');
rewunderscores=strfind(... |
function moon = CentralBodyMoon_init;
%% Build Moon Structure:
moon.title = 'Lunar Moon Model';
moon.units = 'METRIC';
moon.a = 1738140.0; % [m] Semi-major Axis
% (Equatorial Radius)
moon.b = 1735970.0; % [m] ... |
%% Analyzing Investment Strategies with CVaR Portfolio Optimization in MATLAB - Generate Scenarios
%
% Robert Taylor
% The MathWorks, Inc.
% Copyright (C) 2012 The MathWorks, Inc.
%% Introduction
% This script generates scenarios for a covered-call strategy with a portfolio of stocks. The stocks
% are assu... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2010 - 2015 Moon Express, Inc.
% All Rights Reserved.
%
% PROPRIETARY DATA NOTICE:
% The data herein include Proprietary Data and are restricted under the
% Data Rights provisions of Lunar CATALYST Space Act Agreement
% No. SAAM ID#... |
%% ground truth values of each marker in world frame
p1_gnd = [10.563 2.483];
p2_gnd = [0 14.5];
p3_gnd = [-11.655 8.741];
p4_gnd = [0 -14.5];
%% direction vectors of each point
p1_dir = p1_gnd/norm(p1_gnd);
p2_dir = p2_gnd/norm(p2_gnd);
p3_dir = p3_gnd/norm(p3_gnd);
p4_dir = p4_gnd/norm(p4_gnd);
%% absol... |
function total=saving(p, r, n, mode)
% load: 根據每月應附金額,計算期終總值(或期初總值)
%
% Usage: total=saving(p, r, n, mode)
% p: 每月投入金額
% r: 年利率
% n: 總年數
% mode: 'initial' for 期初總金額, 'final' for 期末總金額
% total: 總金額,分期初或期末
%
% Description:
% saving is the inverse function of loan:
% saving(loan(total, r, n), r, n, 'in... |
function [phiR] = relaxF(phi, phi0, omega)
% Relaxes field by omega factor
%
% [N, NRHS] = relaxM(M, RHS, omega)
%
% phi: update field value
% phi0: previous step field value
% omega: relaxation factor
phiR = omega*phi.internal + (1 - omega)*phi0.internal;
end
|
function scoot_axes( scoot, h )
% function scoot_axes( scoot, h )
%
% Adjust the axes position. Default is current axes or move the axes with
% the handle h.
% scoot = [left bottom width height]
%
% KIM 09/08
% if no axes specified, add to current axes
if nargin<2
h = gca;
end
posi = get( h , 'position');
p... |
clear all;
T=20;
for i=1:10
lambda = binornd(1, 1);
t = 0;
I = 0;
S = [];
while t<=T
I = I +1;
S = [S t];
u = rand();
t
t = t - (1/lambda)*log(u);
end
stairs([0 S T], [0:I+1], 'Linewidth', 1)
hold on
end
x = linspace(0,T,1000);
plot(x, x, 'r', 'Linewidth', 2)
hold on |
function showclass(hfig,evnt) %#ok
gd=guidata(hfig);
if get(gd.check3,'value')
set(gd.p1,'visible','on');
else
set(gd.p1,'visible','off')
end
if get(gd.check2,'value')
set(gd.p2,'visible','on');
else
set(gd.p2,'visible','off')
end |
function varargout = sleepSMG(varargin)
%% Stephanie Greer and Jared Saletin
% Walker Lab, UC Berekeley 2011
%
% SLEEPSMG M-file for sleepSMG.fig
% SLEEPSMG, by itself, creates a new SLEEPSMG or raises the existing
% singleton*.
%
% H = SLEEPSMG returns the handle to a new SLEEPSMG or the handle to
% ... |
function s_Wishart = KN_s_Wishart(alpha,beta)
% function s_Wishart = KN_s_Wishart(alpha,beta)
%
% Code by Shira Kritchman and Boaz Nadler
% 2008, Weizmann Institute of Science
% --------------------------------------------
% DESCRIPTION:
% This function computes an approximate inverse of the
% TW (Tracy-Widom) dis... |
function pr_goodbye
global exp
if strcmp(exp.data.language, 'English')
m1 = 'Thank you!';
m2 = 'You have done a great job!';
m3 = 'The next task will start soon.';
else
m1 = 'Vielen Dank!';
m2 = 'Du hast sehr gut gespielt!';
m3 = 'Deine nächste Aufgabe wird gleich beginnen.';
end
... |
img1 = 'car1.jpg';
img2 = 'car2.jpg';
img3 = 'car3.jpg';
imds = imageDatastore({img1, img2, img3});
tforms(3) = eye(3);
% Find corresponding points
% points1 = click_image(img1,10);
% save('p1.mat','points1');
% points2 = click_image(img2,10);
% save('p2.mat','points2');
% points3 = click_image(img3,10);
%... |
%% A MATLAB tutorial for seizure prediction
% The tutorial is built upon a winning solution from a previous Kaggle
% Competition (https://www.kaggle.com/c/seizure-prediction).
% The code is prepared by:
% -Arunesh Mittal, Department of Biomedical Engineering, Columbia University, New York, NY 10027, and
% -Jia... |
function w_dot_ = propagation_w_dot_P(w_dot, rotation_matrix)
w_dot_ = rotation_matrix * w_dot;
end |
%
% Basic command/response example using MATLAB, .NET and the UD driver.
%
% support@labjack.com
%
try
L.ljasm = NET.addAssembly('LJUDDotNet'); %Make the UD .NET assembly visible in MATLAB
L.ljudObj = LabJack.LabJackUD.LJUD;
%Used for casting a value to a CHANNEL enum
L.chanType = LabJack.LabJackUD.CHANNEL.LO... |
function class= newNormalClass(M, D)
% new class creation
% n – kol-vo priznakov
% N – kol-vo elementov
% M – vector mat ojidaniy
% D – vector dispersiyy
N=100;
n=2;
class = randn(N,n);
% mashtabirovanie
class(:,1) = round(M(1) + D(1)*(class(:,1)-0.5));
class(:,2) = round(M(2) + D(2)*(class(:,2)-0.5));
end |
function [x, y, sensitive, training, test] = oppositeSignMistreatment(L)
if nargin<1
L = 2500;
end
x = [mvnrnd([2 0], [5, 1; 1, 5], L); mvnrnd([2, 3], [5, 1; 1, 5], L); ...
mvnrnd([-1, -3], [5, 1; 1, 5], L); mvnrnd([-1, 0], [5, 1; 1, 5], L)...
];
sensitive = [zeros(L,1); ones... |
function [xyz da vol] = spiral(D,dx)
A = 4*pi*(D/2)^2; % area of the sphere carcase
N = round(A/dx^2);
k=1:N;
h = -1+ 2*(k-1)/(N-1);
theta = acos(h);
k=1;
nextphi = @(oldphi,hk) mod(oldphi + 3.6/(sqrt(N)*sqrt(1-hk^2)),2*pi);
phi(1) = 0;
for k=2:N-1
phi(k) = nextphi(phi(k-1), h(k));
end
phi(N) = 2*pi;
r = ones(s... |
%IF_Live plotter
clearvars;
close all;
file2.slashtype = '/';
codedir = cd;
cleandirname = strfind(codedir, file2.slashtype);
file2.codeparent = codedir(1:cleandirname(end))
addpath([file2.codeparent 'ExchangeTools' file2.slashtype 'plot3k']);
addpath([file2.codeparent 'ExchangeTools' file2.slashtype 'DrosteEffect-Bre... |
load data
figure;
plot(xp2, yp2,....
'.',....
'MarkerSize', 10);
DT = DelaunayTri(xp2, yp2);
figure;
triplot(DT,xp2,yp2);
DT2 = delaunay(xp2, yp2);
figure;
triplot(DT2,xp2,yp2); |
function d = duplicated(x)
%DUPLICATED Find duplicated rows.
% DUPLICATED(x) returns a vector d such that d(i) = 1 if x(i,:) is a
% duplicate of an earlier row.
%
% Examples:
% duplicated([2 7 8 7 1 2 8]') = [0 0 0 1 0 1 1]'
% duplicated([0 0 1 1 0; 0 1 0 1 1]') = [0 0 0 0 1]'
% duplicated(eye(100))
% dupli... |
function Elem=rbend2(fname,L,A,A1,A2,K,gap, method)
%RBEND2 Creates rectangular bend with dipole fringe field in old AT versions (Obsolete)
%
% RBEND2('FAMILYNAME', Length[m], BendingAngle[rad], EntranceAngle[rad],
% ExitAngle[rad], K, 'METHOD')
%
% INPUTS
% 1. fname - family name
% 2. L - Length of... |
clear ;
clc ;
close all;
% bwdist, imfill helper functions
% n = 200; % size of the image
%
% name = 'brain.jpg';
% M = imread(name);
% imagesc(M)
n = 200; % size of the image
% load a distance function
% load an image
name = 'brain';
D0 = compute_levelset_shape('square', n);
I = rescale(sum(load_image(name, n), 3) ... |
clearvars *
% the directory with the time series of interest is identified
timelapsefile = fopen('/Users/eisenlab/Desktop/Imaging/TimeLapseInstructions_notRun_trial15.txt','r');
timelapseinfo = textscan(timelapsefile, '%s %s %s %s %s %s %s %s %s %s %s');
fclose(timelapsefile);
for w = 1:length(timelapseinfo{1})
star... |
function [ Line_2_GPS_point ] = GetLine_near_GPS_By_Grid( GPS_ID )
%% GetLine_near_GPS_By_Grid function description:
% Imput: GPS_ID
% Output:
% Line_near_GPS: Line ID Set
% parameters:
%
% Example
% [ Line_near_GPS ] = GetLine_near_GPS_By_Grid( 2 )
% Revision Notes:
% ... |
[targetFileName1, numberOfTokens] = stringTokenizer( targetFile1, '\\ /');
[targetFileName2, numberOfTokens] = stringTokenizer( targetFile2, '\\ /');
fprintf('Image 1 : %s\n', char(targetFileName1(end)));
fprintf('Image 2 : %s\n', char(targetFileName2(end)));
fprintf('\n\nReconstruction of Image 1:\n');
%% P... |
function [dmin,zout] = lp_find_dmin3(zstep,zatt,zmin,amin,Amax,NIN)
%
% Finds the minimum distances to the specification for a stopband filter.
% Also the z-frequencies are found.
% zstep = vector containing the step frequencies
% zatt = vector containing the attenuation poles
% zmin = vector containing the ar... |
close all;
%%%%% TP2_exo_1.m %%%%%
addpath('matlab_bgl'); %load graph libraries
addpath('matlab_tpgraphe'); %load tp ressources
% load TPgraphe.mat; %load data
%%%%%%%%%%%%%%%%%%%%%% INIT %%%%%%%%%%%%%%%%%%%%%%%%%%%%
G=sparse(D);
%%% EXO SPT %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%0)Choose arbitra... |
function [t, q, dq, ddq, normF, normdF, normddF] = baumgart(q0, tK, s, m, I)
t0 = 0;
dq0 = zeros(size(q0, 1), 1);
Y0 = [q0; dq0];
[t, Y] = ode45(@(t, Y) H(t, Y, s, m, I), [t0 tK], Y0);
temp = zeros(size(Y,1), size(Y,2));
for iter=1:size(Y,1)
temp(iter, :) = H(t(iter), Y(iter,:)', s, m,... |
classdef SincGriddingKernel < GriddingKernel
properties
kernel_width;
overgrid_factor;
end
methods
% Constructor
function obj = SincGriddingKernel(kernWidth, overgridFactor, verbose)
% Call super constructor to build obj
obj = obj@GriddingKernel(verbose);
% Store properties
obj.kernel_width... |
sum_series = 0;
TOL = 1E-12;
x=input('Input value of x to calculate sin(x):');
x=mod(x,2*pi);
n = 1;
continue_calculation = 1;
while continue_calculation
nth_term = (-1)^(n-1).*(x^(2*n-1))./factorial(2*n-1);
sum_series = sum_series + nth_term;
if abs(nth_term/sum_series) <= TOL
continue_calculation = 0;
else
... |
classdef Features
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This class computed the features table %
% to train %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
properties
matriz_alfa;
end
methods
function obj = Features()
... |
function [c,S,E,flag] = convexness(V,F,n)
% [c,S,E,flag] = convexness(V,F,n) Give a score of "how convex" a shape (V,F)
% is on a scale of 0 to 1. "Weak Convex Decomposition by Lines-of-sight"
% [Asafi et al. 2013]
%
% Inputs:
% V #V by 3 list of mesh vertex positions
% F #F by 3 list of mesh face i... |
%MIT License
%Copyright (c) 2019 Sherman Lo
%ALL NULL GAUSSIAN SCRIPT
%Filters a image
%Shows the image before and after filtering
%Shows the empirical null mean and std image
%Plots the p values of the post filter greyvalues
clearvars;
close all;
imageSize = 256;
%=====ALL NULL GAUSSIAN=====%
randStream = RandStre... |
function [data] = load_completely(filename)
cfg = [];
cfg.trialfun = 'ft_trialfun_general';
cfg.dataset = filename;
cfg.trialdef.triallength = Inf;
cfg = ft_definetrial(cfg);
data = ... |
function [ y ] = my_hardlim( n )
%MY_HARDLIM hard limt function
y = n >= 0;
end
|
%Sound15
clear;
syms mel y t f kf ka;
fi = sym('f',[3,1]);
infi = sym('f',[3,1]);
AmpR = sym('AmpR',[3,1]);
% f =sym('700*exp(mel/1127-1)');
f =sym('700*(10^(mel/2595)-1)');
f = subs(f,mel,sym('100+y*1200'));
AudioSampleRate = 48000;
TimeSound = 3;
NumSumPoint = round(TimeSound*AudioSampleRate);
... |
classdef GridCollection < handle
%GridCollection manages a collection of Regular2Grids used for
%antialiasing.
properties (SetAccess = immutable)
G % the combined grid
N % number of included grids
Grids % cell array of included grids
bfx, bfy % blow factors, i.e. with what fact... |
clear;
NN = 10000;
thrs = [1.5/7 2/7 3/7 4/7 5/7 6/7];
PC = zeros(length(thrs),1);
PCU = zeros(length(thrs),1);
DT = zeros(length(thrs),1);
DTU = zeros(length(thrs),1);
for jjj = 1:length(thrs)
count = 0;
countu = 0;
timecount = 0;
timecountu = 0;
for jj = 1:NN
%Initializing the length of time for ... |
y = -log(1-rand(1,1000));
x = linspace(0,10);
histogram(y,30,'Normalization','pdf')
hold on
plot(x,exp(-x)) |
function change_T_to_Z_decon
%% Change t to Z planes for deconvolved data
% User defined parameters
Data_Folder = '/Users/seetha/Desktop/Michelle_OB_Thunder/Data/';
Result_Folder_Name = '/Users/seetha/Desktop/Michelle_OB_Thunder/Data/'; %Result Folder name
Stim = {'3ugHAS'};
num_z = 27;
num_t = 121;
%Loop through a... |
function [X] = slow_dct(x)
% Computes the discrete cosine transform (DCT-II) of vector x directly from the definition
N = size(x,2);
theta = pi/N;
W = ones(N,N);
for i = 1:N
for j = 2:N
W(i,j) = cos(theta*((i-0.5)*(j-1)));
end
end
X = x*W;
end |
clear
clc
prefix = {'/media/pzhang/My Book/dune_shape/small/1/'};
fname = {'test_mvbed_c_'};
num = 1:1019;
index = 800;
for i = 1:numel(num)
name = strcat(prefix,fname,num2str(num(i),'%04d'),'.h5');
nx = h5read(char(name),char('/Nx'));
ny = h5read(char(name),char('/Ny'));
v = h5read(char(name),char('/Ve... |
function Rotation = ZYXeuler(in1)
%ZYXEULER
% ROTATION = ZYXEULER(IN1)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 04-Mar-2020 13:42:13
X1 = in1(1);
X2 = in1(2);
X3 = in1(3);
t2 = cos(X1);
t3 = cos(X2);
t4 = cos(X3);
t5 = sin(X1);
t6 = sin(X2);
t7 = sin(X3);
Rota... |
function to_fit = Gaussian(t,mean,var,amplitude)
to_fit = amplitude * (1/sqrt(2*pi*(var))).*exp(- ( (t - mean).^2 / (2*var) ) );
end
|
function paths = installed_nnet(nnet_root)
% Copyright 2013 The MathWorks, Inc.
if nargin < 1, nnet_root = nnpath.nnet_root; end
% /toolbox/nnet/*
nnet_toolbox = fullfile(nnet_root,'toolbox','nnet');
paths = toolboxDirs(nnet_toolbox);
% /TOOLS
tools_path = fullfile(nnpath.nnet_root,'TOOLS');
if exist(tools_path,'di... |
function [features, count_circles, centers, separation12] = findcircles(input)
% GENERAL PURPOSE: To provide an example of feature-extraction in a binary image.
% This example could be adapted for other specific requirements.
%
% NOTE: Requires IMCIRCLE.M, also provided in the MATLAB ... |
function subtasks = getErrorSummary(job)
% Function will return indices of tasks that thre an error
errorCell = {job.Tasks(:).Error};
stateCell = {job.Tasks(:).State};
workerCell = cellfun(@(x)x.Host, {job.Tasks(:).Worker}, 'uni', 0);
idxError = find(~cellfun(@isempty, errorCell) | ~cellfun(@(x)strcmp(... |
function [axis] = CustomFloorHeatmap(dataArray, indicateRx)
% Created by Kalin Norman
% This heatmap uses a custom background that is "zoomed in" when compared
% to the original blueprint that was used in the FloorplanHeatmap function.
% The first parameter is the array that needs to be plotted (generally this
% parame... |
close all; clear;
angle = [150:-10:30];
voltage = [ ...
1170, 1410, 1690, 1960, 2250, 2530, 2805, 3070, 3350, 3610, 3865, 3950, 3962];
figure;
plot(voltage, angle, '-o', 'LineWidth', 3);
xlabel('Voltage', 'FontSize', 20);
ylabel('Angle', 'FontSize', 20);
% Safety range = 150 ~ 50d, 1170 ~ 3865
% y = mx + b
m =... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Title: PWLD Main Generation Function
%
% Author: Michael W. Hackemack
% Institution: Texas A&M University
% Year: 2016
%
% Description: MATLAB script to produce the elementary volume and
% ... |
clc; clear; close all;
img = im2double(imread('Test_00.ppm'));
% img = rgb2gray(img);
Red = img(:, :, 1);
Green = img(:, :, 2);
Blue = img(:, :, 3);
Gray = Red * 0.2989 + Green * 0.5870 + Blue * 0.1140;
% imshow(Gray, [])
img(:, :, 1) = Gray;
img(:, :, 2) = Gray;
img(:, :, 3) = Gray;
R = 200;
for i = 1 : size(img, 1)... |
function [Y,XA]=enkf_lorenz(Yi,Xi,r,ts,nac,l_f,t_f,it_f,winov_f,update_f)
% EnKF simulation using lorenz model.
%
% in:
% Yi : initial observation
% Xi : initial ensemble
% r : variance of observed data
% ts : time steps between each assimilation cycle, vector of length nac,
% b... |
%% normalize
% Normalize functional images to MNI space.
% MM/DD/YY: CHANGELOG
% 02/11/20: Changelog started, file forked from isss_multi
% 02/17/20: Estimate, no reslice, and switching to 3x3x3.5mm voxel
% 02/17/20: Last change is an oxymoron? Est + Res, 3x3x3.5mm voxel.
% 03/30/20: Cloned for hybrid_isss. Using 3x... |
function y = apply(x,settings)
%REMOVEROWS.APPLY Process values
% Copyright 2012-2015 The MathWorks, Inc.
y = x(settings.keep_ind,:);
end
|
function [recombination error] = extract_recombination(sibship, family, intervals, parameters)
error = 0;
recombination = [];
global debug_mode;
status = sibship.sibship_status;
[nIND, fields] = size(family);
if( nIND <= 0 || fields < 12 )
error = 1;
disp('error in family structures');
return;
end
[n... |
testSize = 100;
% x = zeros(testSize, 1);
% y = zeros(testSize, 1);
x = [];
y = [];
xc = [];
yc = [];
imageSize = [8.5 11];
center = [imageSize(1)/2; imageSize(2)*3/4];
sigma = [1; 1.5];
for i=1:testSize
boxSize = [normrnd(4, 1); normrnd(1, 0.1)];
[xt, yt, c] = randomImageLocation(center, sigma, i... |
clear all
FCut = 143;% Cutoff
Fs = 400; % Sampling
r = 0.6; %R
%pole
w1 = 2*pi*50/Fs; % another high frequency for correspondence
%zero
wo = 2*pi*FCut/Fs; % converting to cutoff frequency to rad/s
a_w = 1 - 2*cos(wo)*exp(-1i*w1)+ exp(-2i*w1); % Num @ w = w1
b_w = 1 - 2*r*cos(w1)*exp(-1i*w1)+r^2*exp(-2i*w1); % Den @ w... |
function [start_time,end_time]=start_end_time_from_asl_file(filename)
fid=fopen(filename,'r','b');
BLCK_SIZE=1e4;
if fid==-1
start_time=0;
end_time=1e9;
return;
end
start_time=0;
end_time=1e9;
fseek(fid,0,'bof');
found_start=0;
while found_start==0&&~feof(fid)
pos = ftell(fid);
int_rea... |
function [Jac_cell,residual_cell,maxspeedF,maxspeedG] = res_and_Jac_brute(DGregion,DGregion_past,nuv1,nuv2,data)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
vectpsi = data.vectpsi;
vectpsi_dxii_Trans = data.vectpsi_dxii_Trans;
vectpsi_deta_Trans = data.vectpsi_deta_Trans;
tauflux ... |
clear
close all
addpath('../utilities')
DataPath = '../../out/ode_studies/';
mkdir(DataPath)
% specify project to load
project = 'naive_ncr';
% load
load([DataPath project '_setup.mat'])
% make figure path
FigPath = ['../../fig/ode_studies/' project '/' ];
mkdir(FigPath)
t_max = 1e4;
f_ind = 5;
% Generate expected... |
function Statswindow()
global HandleList
global muleapp
global app
global points
global mulehit
%=======================================================================
%creates the score info window
%=======================================================================
figNumber=figure( ...
... |
clc;
format longg;
load carsmall;
X = [MPG,Acceleration,Displacement,Weight,Horsepower];
varName = {'MPG','Acceleration','Displacement','Weight','Horsepower'};
comet(Displacement);
xlabel('Index of Car');
ylabel('Displacement');
boxplot(Acceleration);
ylabel('Acceleration');
boxplot(Acceleration,Cylinders);
xlabel(... |
% Wireless Communication Network
% Homework4_20181224
% 107064522
clc;
clear;
%close all;
%%%%%%%%%%%%%%%%%%
%%%%% Ricean %%%%%
%%%%%%%%%%%%%%%%%%
%% Transmission Signal & Channel Condition
no_samples = 3e5; % Number of bits to be transmitted
SNR = [1 3 5 7 9]; % Es/N0 in dB scale
L = [1 2 3 4]; ... |
function modifiedMov = downSampleVid(mov, N, par)
%Want each RF to be a 10x10pixel array. Assuming the width of view is
%90x90deg view and each RF is roughly 5x5deg, we want (90/5)*10=
%180x180pixels for each frame
if ~exist('N','var')
num_blocks_h = 180;
num_blocks_w = 180;
else
num_blocks_h = N;
n... |
function [ outImage ] = local_histeq_cvip( inImage, blockSize, band)
% LOCAL_HISTEQ_CVIP - Histogram equalization on block-by-block basis.
% The function performs the histogram equalization on local areas of an
% image rather than on the image as a whole.The user may specify the size
% of blocks to use.By performin... |
function blad =wskaznikZawor3(parametry)
global C3;
global x03;
global pomiar_zawor3;
C3=parametry(1);
x03=parametry(2);
pomiar=pomiar_zawor3;
sim('identyfikacja_zawor3_reczny.slx');
blad = sum((pomiar-H3.signals.values).^2);
end |
function[deltaZ, dopt] = lp_find_new_poles(Z, NIN, Amax, Zmin, Dmin)
%
% Finds the change in the location of the attenuation poles and
% the minimum attenuation dopt.
% Inputs are the attenuation pole vector Z, the number of attenuation
% poles at infinity NIN, the passband attenuation Amax, the z frequencies... |
function testIfResVelAndRotVelGiveXYvel()
close all; clear variables; clc;
[a] = UKF_create_simulation_data(true);
[ap.thisFile, nm.CurrFile] = fileparts(mfilename('fullpath'));
cd(ap.thisFile);
load(fullfile(fileparts(ap.thisFile),'UKF_create_simulation_data.mat'))
figure('units','normalized','outerposition',[0.1 0... |
% Synopsis: F = make_dct(n)
% Returns the n x n DCT transform matrix.
% Taken from: octave matcompat, author: Paul Kienzle, GPL license
% Tested against: dct in sig. proc. toolbox and dctmtx in image proc
% toolbox
function F = dct_matrix(n)
if(n > 1)
F = [ sqrt(1/n)*ones(1,n) ; sqrt(2/n)*cos((pi/2/n)*(... |
function [ fval, matching ] = gmm_IAW_Sinkhorn( gmm1,gmm2,sample_size, options)
epsilon = 0.01;
if isfield(options, 'sinkhorn_epsilon')
epsilon = options.sinkhorn_epsilon;
end
max_iters = 300;
if isfield(options, 'sinkhorn_max_iters')
max_iters = options.sinkhorn_max_iters;
end... |
NZ=4*NX;
Z_axis_shift=round(Z_axis/DX)
X_axis_shift=round(X_axis/DX)
minX=max(mid_X-round(1.4*size_r),3);
maxX=min(mid_X+round(1.6*size_r),NZ-2);
minZ=max(mid_Z+Z_axis_shift-round(1.0*elongation*size_r),3);
maxZ=min(mid_Z+Z_axis_shift+round(1.1*elongation*size_r),NZ-2);
sizeX=2*ceil(0.5*(maxX-minX));
sizeZ=2*ceil(... |
function [mv,tv,av,pv] = computeTransvalvularFlow(flowDir, laDir)
[mv,tv,av,pv] = RetrospectiveValveTracker([], flowDir, laDir, [], [], 0, 'valveLocations.mat');
end
|
%@(#) sdmstep.m 1.10 00/10/06 12:38:10
%
function sdmstep
hval=get(gcf,'userdata');
load simfile
%i=find(filenames(1,:)=='/');
%block=filenames(1,i(3)+1:i(4)-1);
efph=str2num(get(hval(6),'string'));
point=find(efph==blist);
tx=readtextfile('comp-sdm-ref.sim');
stx=size(tx);
tx(1,:)=setstr(32*ones(1,stx(2)));
tx(... |
function t = trape(f,a,b,n)
% 复化梯形求积公式
%Input -fun 被积函数 -[a,b] 积分区间 -n n等分
%Output -t 积分值
x = linspace(a,b,n);
h = (b - a)/n;
s = 0;
for i = 2:n-1
s = s + 2*feval(f,0,x(i));
end
t = h/2*(feval(f,0,a) + feval(f,0,b) + s); |
% written by Mojtaba Eslami
clear all
ul = -5; % lower bound of design variables
uh = 5; % higher bound of design variables
x = [ul:0.01:uh];
y = [ul:0.01:uh];
for i=1:length(x)
for j=1:length(y)
f(i,j) = 20+x(i)^2+y(j)^2-10*(cos(2*pi*x(i))+cos(2*pi*y(j)));
end
end
figure(1);clf;hold on
contour(x,y,f... |
function v = dfmconv(s, fcamp)
fmin = 20;
fmax = 20480; %Per ottenere un valore intero come fattore per ottenere ampiezza progressiva.
shalf = s * 10^(-6/20);
invshalf = fliplr(shalf);
invshalffilt = (invshalf(2:end) .- invshalf(1:end-1))/2;
v = conv(shalf, invshalffilt, 'same');
endfunction
|
% Matlab binding test cases
% Uses Matlab's builtin testing framework
classdef OpenCVTest < matlab.unittest.TestCase
methods(Test)
% -------------------------------------------------------------------------
% EXCEPTIONS
% Check that errors and exceptions are thrown correctly
% ----------------------... |
%
% находим центры объектов на кадре -> result_name
startuem
% showresult.m показать результат
% для каждой точки знаем ее перемещение -> mass_image_centers
calculate
% вычисляем параметры дисторсии aproxdist
% апроксимируем параметры гармоническими функциями параметры -> harmonicX harmonicY
distcorrect % внутри выз... |
bag_id = [1:size(bags_data,1)]';
dataset_bag = prdataset(bag_id,bags_label);
num=100;
error = cell(2,num);
for j = 1:size(error,2)
j
[train_bag,test_bag,train_bag_id,test_bag_id] = gendat(dataset_bag,0.75);
train_instance_id = [];
test_instance_id = [];
for i = 1:size(train_bag,1)
temp... |
classdef reshape_varargin
properties
nT = 51;
nOut = 6;
nSta = 9;
nCtr = 3;
nPar = 2;
end
properties (Dependent)
data
end
methods
function ret = get.data(obj)
ret = cell(1,4);
ret{1} = reshape(linspace(1... |
function PtsPlot_tmp(x,y,lmx,lmy,titlename)
if nargin<5, titlename='point/landmark plot'; end
figure, axis equal, hold on; title(titlename);
plot(x(:,1),x(:,2),'.r')
plot(y(:,1),y(:,2),'.g')
plot(lmx(:,1),lmx(:,2),'or','markersize',10,'linewidth',2)
plot(lmy(:,1),lmy(:,2),'og','markersize',10,'linewidth',2)
|
function create_warps(autotop_folder, warps_folder)
arguments
autotop_folder string
warps_folder string
end
n_steps_unfold = [256 128 16];
%get path to reference nifti relative AUTOTOP_DIR
unfold_ref_nii = [getenv('AUTOTOP_DIR') '/misc/unfold_ref_256x128x16.nii.gz'];
in_coord_ap_nii=sprintf('%s/coords-AP.nii... |
PKM3DFN=[WorkingP 'PKM3D.mat'];
load(PKM3DFN,'OutAIFParam','AMIdxs','ACXs','RMSs');
%%
TimeBetweenDCEVolsMin=TimeBetweenDCEVols/60;
InterpolationFactor=ceil(TimeBetweenDCEVols);
SampleTs=((1:nSVols)-1)*TimeBetweenDCEVolsMin;
HInterpolationFactor=ceil(InterpolationFactor*2);
Hdt=TimeBetweenDCEVolsMin/HInterpolationFact... |
%% Initialization of simulation.
% Needed functions: noquantumsim.m, plotlattice.m, fillfield.m, checkfree.m
% here we choose the variables which define our simulation
% version 2.0: probability for predators is proportional to preys
clear;clc;
% Death value for sigmaz:
deathvalue=-0.8;
% grid dimensions.
... |
%% Select good cells (based on one-sided t-test comparing sequential laser/nolaser trials from 400-450ms [spontaneous firing])
clear all
MNum = [3080];
Filters = [1 2]; %Session 1 = 290; Session 2 = 110; Session 3 = 60;
SIG = cell(length(MNum),1);
for u = 1:length(MNum)
cd(['D:\Spikes\M' num2str(M... |
function result = f_corr_PT(X,Y,verb)
% - linear correlation between masses for replicate otolith profile transects
%
% USAGE result = f_corr_PT(X,Y)
%
% X,Y = strctures created by the f_cps2ppm_PT function
% verb = optionally send results to display (default = 1)
%
% result = structure with the fo... |
function value = hermiteN(n,x)
value = hermite(n,x)/sqrt(factorial(n));
end |
function mortrage()
clc;clear all; close all;
% definitions
% P = principle amount
% J = Monthly intrest rate
% R = Total monthly payment
% R = J*P+ amount applied to principle
% new principle amount
% P+j*P-R => P(1+J)-R => P*m-R: m=1+J
% inputs
pri=input('Principle amount ');
Yr=input(' No of Year ' );... |
function [select,val]=listdlg_perso(main_figure,tt_str,str_list,varargin)
select=[];
val=0;
p = inputParser;
addRequired(p,'main_figure',@(h) isempty(h)|isa(h,'matlab.ui.Figure'));
addRequired(p,'tt_str',@ischar);
addRequired(p,'str_list',@iscell);
addParameter(p,'init_val',1:numel(str_list),@isnumeric);
addParameter... |
%@(#) flipmap.m 1.1 99/06/02 13:25:24
%
function flipmap(filename)
% flipmap(filename);
% Denna funktion vrider safeguardfilen med pinnidentiteter 90 grader
fid=fopen(filename,'r');
fid2=fopen('printfil.txt','w');
bundleline=fgetl(fid);
fprintf(fid2,'%s',bundleline);
fprintf(fid2,'\n');
for i0=1:1000
for i=... |
function [w_m,sigma_min]=MFS_ITE_ellipse_elastic(m,init,semi_x,semi_y,Rrel_S,mu,lambda,rho)
% ROUTINE: Computes approximate elastic ITEs for ellipse scatterer via modified MFS
% INPUT:
% m = number of boundary collocation points (or equivalently source points)
% init = initial guess for approximate ITE loc... |
% [data,pdata] = countstat(data,fac)
%
% transforms a given data into countstatistcs with poisson statistics
% each new value is mynrand with mu = value; sigma = fac*sqrt(value).
% Quantization noise is included by rounding the data.
function [data,pdata] = countstat(data,fac)
if nargin < 2,
fac = 1;
end
pdata =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.