text stringlengths 8 6.12M |
|---|
clear;
% [num1 txt1]=xlsread('C:/PairsWS/AUDUSD');
% [num2 txt2]=xlsread('C:/PairsWS/USDCAD');
%
% audcad=num2./num1;
[audcad txt]=xlsread('C:/PairsWS/AUDCAD');
audcad(isnan(audcad))=[];
plot(audcad);
results=adf(audcad, 0, 2)
%% mean reverting trading
lookback=5;
ma=smartMovingAvg(audcad, lookback);
mstd=smartM... |
% YOUR SCRIPT NAME HERE
% ---------------------
% This is a template for an imlook4d script that runs your code and puts the results into a new imlook4d window.
% For documentation: a) imlook4d menu "/HELP/Help", or
% b) type in matlab: open('Scripting-imlook4d.pdf')
%
% 1) Edit your own cod... |
%%%Places Models into structure array for access in generate_and_recover
function LoadModels_reversal
global modelStrxr AnimalList
%%%AnimalList%%%
AnimalList{1}={'M1' 'M2' 'M3' 'M4' 'M5' 'M6' 'M7' 'M8' 'M9'};
AnimalList{2}={'M15' 'M16' 'M17' 'M18' 'M19' 'M20'};
AnimalList{3}={'M10' 'M11' 'M12' 'M13' 'M14'}
%%% FINA... |
clear; clc; close all;
D = 3; verbose = false;
num_parameters = 26;
%% Hmodel
input_path = '_my_hand/tracking_initialization/';
semantics_path = '_my_hand/semantics/';
sensor_path = 'C:/Users/tkach/Desktop/training/';
output_path = '_my_hand/tracking_initialization/';
data_path = '_data/hmodel/';
load([semantics_path,... |
% Example:
%
% Image filtering using Fourier 1D
%
% Computer Vision Course
% (c) Domingo Mery (2015) - http://dmery.ing.puc.cl
% Input image
close all
I = double(imread('zebra_noise.png'));
imshow(uint8(I))
title('Original Image');
axis on
figure
imshow(uint8(I))
title('Original Image');
axis on
hold on
% Initializat... |
%compute error rate and confusion matrices given the predicted and actual
%Y labels
%
%Input:
% output: predicted labels
% testY: actual labels
%Return:
% error_rate: error rate for all languages
% distrib_matrix: confusion matrix. element on [i,j] is the number of
% examples with actual label i falling ... |
function [ x, mu ] = sigmoid( aL, cL, cR,aR, kesin, geridonus )
%SİGMOİD Summary of this function goes here
% Detailed explanation goes here
bkesin = 1/(1+exp(-aL*(kesin-cL)));
ckesin = 1/(1+exp(-aR*(kesin-cR)));
x = max(bkesin, ckesin);
mu = x;
for t=1:1
if(geridonus == 0) break; end
%fprintf('Uyelik D... |
function index = index_Section(Section_vec,cell_Theta)
% function index = index_Section(Section_vec,cell_Theta)
%
% transfor vector indices into float indices
% INPUT
% Section_vec vector indicator of a section
% cell_Theta cell of the dimension of the threshold
% OUTPUT
% index index of hte Se... |
%% SVD 实现人脸图像降维和重构
% 任何一个 m×n(m>=n) 的矩阵 A 可以写成:
clc;
clear;
close all;
%% 读取数据
% faceMatrix是77760*120的矩阵,每列表示一张图像。
% 每张图像大小为243*320,用mgRow,imgCol存储
%[imgRow,imgCol] - image size
% FaceContainer - images
img=imread('./yalefaces/subject01.glasses');
[imgRow,imgCol]=size(img);
FaceContainer=zeros(120,imgRow*imgCol);
a... |
function [boolMat, featName] = DiscreteToBoolean(enriched, labels, cols)
%Enriched is a cell array. Each row is a sample, each column is a category
if ~iscell(enriched)
disp('Converting discrete features to booleans');
enriched = cellfun(@(x) num2str(x), (num2cell(enriched)),'UniformOutput', false);
end
... |
function [toffs,q,D] = tagtdoa(tag1,tag2,D,sigintvl,filt,srchintvl)
%
% [toffs,q,D] = tagtdoa(tag1,tag2,D,sigintvl,filt,srchintvl)
% Wideband time-difference-of-arrival estimator for pairs of tags
% using the generalized cross-correlation.
% cmin the delay time in samples between each column of X and... |
function ghat=GhatZero(X,logY,beta,h)
format long
kerf = @(u,h)exp(-u.^2/(2*h^2))/sqrt(2*pi)/h;
t=X*beta;
n=length(t);
T=t*ones(1,n);
temp=T-T';
S0=kerf(temp,h);
S1=temp.*S0;
S2=temp.^2.*S0;
S0Mean=ones(n,1)*mean(S0);
S1Mean=ones(n,1)*mean(S1);
S2Mean=ones(n,1)*mean(S2);
U = (S2Mean-temp.*S1Mean).*S0;
%for i=1:n
... |
orderParams = {'ang', 'abs', 'polar', 'nearNeighbor'};
for whichParam = 1:length(orderParams)
%these csvs have column labels, which are super useful but also a pain
%when reading them in matlab. Hence skipping the first row.
%cols: expnum | naive mean | naive radius | model mean | model radius
data = cs... |
function graficarInterfaces2
[ax1 ay1 ax2 ay2 ax3 ay3]=constanteCompuesto;
VectoraX=[ax1 ax2 ax3 ax1];
VectoraY=[ay1 ay2 ay3 ay1];
plot(VectoraX,VectoraY,'linewidth',1)
axis equal;
hold on
[h,k,r]=constanteCompuestoCirculo;
ancho=pi/200;
theta=0:ancho:2*pi;
Xcirculo=h+r*cos(theta);
Ycirculo=k+r*sin(theta... |
im = im2double(imread('lenna_gray.jpg'));
% Compute Laplacian pyramid with Gaussian filter
F = 1/8 * [ 0 1 0 ; 1 4 1 ; 0 1 0 ]; % Gaussian filter
G = compute_reconstruction_filter(); % Gaussian reconstruction filter
laplacian_pyr_gauss = generate_laplacian_pyr(im, F, G);
% Compute Laplacian pyramid with CDF ... |
% initialize_network creates a new struct for the populations, the
% connections and the inputs to the network. Sets the counters to zero.
%
% created: Jakob Heinzle 01/07
clear pops cons inputs
pops.npops=0;
cons.ncons=0;
inputs.ninputs=0; |
clear all
global w_0 max_intensity;
% Task 2
%a)
data = load('boat_variables.mat');
info = load('wave.mat');
time = info.psi_w(1, :);
psi = (info.psi_w(2, :))*pi/180;
% sampling frequency and window size
fs = 10;
window = 4096;
% pxx_e = The PSD estimated
% f = frequency for any given w
[px... |
function tools = nnParallel(varargin)
% Copyright 2012 The MathWorks, Inc.
% Mode
tools.mode = mfilename;
% Default Hints
hints.name = '';
hints.subcalc.name = 'default';
hints.onlyGPUs = false;
hints.precision = 'double';
hints.direction = 'default';
% Override Default Hints
hints = nncalc.argPairs2Struct(hints,va... |
% %% Primera
%
% % % 1 para 2 sensores, 2 para 5 sensores, 3 para 10 sensores
% % % 4 para 20 sensores, 5 para 50 sensores
% %
% for clusters_fijados=2
% clearvars -except clusters_fijados
% cd resultados
% sensores_a_cargar=1;
% % simulaciones_a_cargar=(1+sensores_a_cargar-1:5:26+sensores_a_cargar-1);
% gr... |
color_bwr = bluewhitered(256);
x = 1:1:size(color_bwr,1);
y = 1:1:size(color_bwr,1);
c =
temp_scatter_h = scatter(x,y,100,color_bwr,...
'o','filled','MarkerFaceAlpha',1.0,'MarkerEdgeAlpha',1.0); |
%Save a file containing the 3D points that define the perimeter of the
%opercle.
function [] = createOpPerim(varargin)
if nargin ==1
fileDir = varargin{1};
elseif nargin==0
fileDir = uigetdir('C:\Jemielita\markers', 'Select directory to load markers from');
end
for i=1:144
fN = [fileDir... |
%For a given directory structure return the parameters that correspond to
%regions that are overlapping between different regions.
%SUMMARY: [data, param] = registerImagesData(data,param)
%
%Returns param.registerImXY which is an array of size: [numRegions-1,2, 4].
%The second argument gives the region of overlap ... |
%% SGD gradient calculation
function gr = getSGD(xi, yi, W, type)
if(strcmp(type,'cross-entropy'))
s = W'*xi;
gr = - yi*xi/(1+exp(yi*s)); %W'*xi)); % W at t i.e. W(t)
elseif(strcmp(type,'softmax'))
s = W'*xi; % W'(NCxd) * x(dx1) = s(NCx1);
[d, NC] = size(W);
D = ... |
Problem 249
Problem 145
Problem 131
Problem 35
Problem 36
Problem 37
Problem 50
Problem 31 |
function [A,b,output] = calc(A,b,do)
% Calcite dissolution: kinetics + respiration (M3)
fprintf('%s','calc...')
% unpack the key parameters
SF = do.calc.SF;
x = do.calc.x;
m = do.calc.m;
sedremin = do.calc.sedremin;
% load the grid and the model output for P uptake (productivity)
load data/ao.mat
load data/P_UP.mat
l... |
function [y,h] = ecgcleanup(x,FS,lambda,thr,h)
%
% [y,h] = ecgcleanup(x,fs,lambda,thr,h)
%
fmains = 49.99 ; % frequency of mains interference, Hz
Fbase = 250 ; % frequency of sensor interference, Hz
g = 5 ;
if nargin<2,
ecgcleanup ;
end
if nargin<3 | isempty(lambda),
lambda = 0.0001 ;
end
if... |
samples = 100;
n=10;
%y = 5x +2;
for i = 1:samples
x1(i) = 20*rand();
y1(i) = 5*x1(i)+2;
%add gaussian noise
y1(i) = y1(i)+n*randn();
end
X{1} = x1';
Y{1} = y1';
%y = 4x -2;
for i = 1:samples
x2(i) = 20*rand();
y2(i) = 4*x2(i)-2;
y2(i) = y2(i)+n*randn();%add gaussian noise
end
X{2} = x2';
Y{... |
%% probability statistics: adding sw sequence restrictions
%% CLEAR: all workspace and global variables, and close all figues
clearvars -global; clearvars; close all; clc;
%% probability
pf = linspace(0.01, 0.9999, 10000);
vector_size = 10;
n = linspace(1, vector_size, vector_size);
f = 1*ones(1,length(n));
mode... |
classdef solid
%SOLID CLASS Contains all the properties and geometrical details of the
%solid material in the HEX
properties
% General variables
subs
T1
T2
k
Cp
sigma
t_D_min
shape
Ax
L
V
VR
... |
function [inputs,kerr]=a_rmisc(p,inputs)
global A_FID
ip=a_init_misc;
[ip,kerr]=a_diktat(p,ip,A_FID);
inputs.misc.ip=ip; |
clear all; clear java;
clc;
%% setup problem
point=[0 0;];
segment=2*rand(1,4)-1;
%segment=nan(5,4);
%segment(1,:)=[-0.5 1 0.5 0.75];
%segment(2,:)=[0.5 0.25 0.4 -0.25];
%segment(3,:)=[-0 -0.5 -1 0.25];
%segment(4,:)=[-0.75 0.5 0.75 0.5];
%segment(5,:)=[1 1.2 0.9 -1.2];
% order is important!
%theta=[0 180];
theta=[4... |
% Compute the inputs over the prediction horizon
%
% ALGORITHM
% -
%
function ComputeControlInputs( tController )
%
%
try %
if( tController.bPrintDebugInformation )
%
fprintf('Entering ComputeControlInputs()\n');
%
end;%
%
%------------------------------------------------------------... |
clear
randn('state',sum(100*clock));
load longrunbill.mat;
% relsize = 1500;
% Lx = 1.0;
% Ly = 1.61803399;
% nmax = relsize;
% mmax = floor(relsize*sqrt(Ly));
%
% E = zeros(nmax,mmax);
% k = 0;
% for n = 1:nmax
% for m = 1:mmax
% E(n,m) = (n*n/Lx + m*m/Ly);
% k = k + 1;
% ... |
function [Problem] = CMATpick_point(...
Problem,Constraints,Spec,Objectives,Haxes)
satisfied = false;
while ~satisfied
disp('Choose new point by clicking')
[x,y] = ginput(1);
newpth = plot(gca,x,y,'*k','MarkerEdgeColor','k',...
'MarkerFaceColor','b','MarkerSize',9);
%% Change ... |
function output = noiseiterations(times)
im1 = imread("pout.tif");
[size1, size2] = size(im1);
tempmat = zeros(size1,size2);
for i = 1:times
tempnoise = im2double(imnoise(im1,"gaussian",0,0.1));
tempmat = tempmat + tempnoise;
end
tempmat = tempmat/times;
output = tempmat;
end
|
%close all,clear all
%% Define Excel Source file and Matlab Data file
excelFile = 'est_mtv_msg.csv'; % Excel file name
Sheet = 'est_mtv_msg'; % Sheet
matFile = 'est_mtv_msg.mat'; % Mat file name
%% Read the data
if strncmp(computer,'PCWIN',5)
[data , txt, raw] = xlsread(excelFile, Sheet);
el... |
function K = lqr_control(M, m, L, g, d)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
s = 1;
A = [0 1 0 0;
0 -d/M -m*g/M 0;
0 0 0 1;
0 -s*d/(M*L) -s*(m+M)*g/(M*L) 0];
B = [0; 1/M; 0; s*1/(M*L)];
eig(A)
Q = [1 0 0 0;
0 1 0 0;
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Plot Hypothesis Bar Graphs %
% %
%%%%%%%%%%%%%%... |
classdef RegionalMeasurements
%% REGIONALMEASUREMENTS is a meta-director that organizes specific directors
% for reading, constructing, assembling, processing regional measurements
% that are salient for publication of glucose threshold imaging studies.
% See also: mlarbelaez.KineticsDirector,
% ... |
T = 4;
%in functie de rezolutia temporala, se vor introduce vectori diferiti
T1_temaPCT4_Coman_Ionut_Ovidius_Cristian(0:0.002:T,1) % 2ms = 0.002s
T1_temaPCT4_Coman_Ionut_Ovidius_Cristian(0:0.02:T,2) % 20ms = 0.02s
T1_temaPCT4_Coman_Ionut_Ovidius_Cristian(0:0.2:T,3) % 200ms = 0.2s |
classdef (Hidden) EnergyBuilderFlat < amg.energy.EnergyBuilder
%ENERGYBUILDERGALERKIN Flat factor coarse-level energy builder.
% This implementation returns the coarse-level Galerkin operator
% as-is (no energy correction) and a constant RHS correction factor
% mu.
%
% See also: LE... |
% function out = apply_color_matrix( I, matrix )
% ----------------------------------------------
%
% applies a 3x3 color matrix to a 3-channel image I
%
% (c) 2011 Ivo Ihrke
% Universitaet des Saarlandes
% MPI Informatik
function out = apply_color_matrix( I, matrix )
vec = reshape(I,size(I,1)*siz... |
function [Rodada,Jogador] = iniciarRodada(Jogo,Partida,Rodada,Jogador)
Rodada.NRodadas = Rodada.NRodadas + 1;
Rodada.ApostaMinima = Partida.BigBlind;
Jogador.Acao = cell(1,Jogo.NJogadores);
Jogador.Aposta = zeros(1,Jogo.NJogadores);
Jogador.ApostaTemp = zeros(1,Jogo.NJogadores);
Jogador.Call = zeros(1,Jogo.NJogad... |
w = [0.6
0.6
0.6
0.72
0.72];
sigma2 = [10000
10000
10000
10000
10000];
sigma = sqrt(sigma2);
%%
cvx_clear
cvx_begin quiet
variable x(5,24)
expressions mu(24,1) sig(24,1) z(24,1)
minimize(1.2.*sum(x(1,:)+x(2,:)+x(3,:))+sum(x(4,:)+x(5,... |
% Author: Xinshuo
% Email: xinshuow@andrew.cmu.edu
function startup()
libdir = fileparts(mfilename('fullpath'));
addpath(genpath(fullfile(libdir, 'lib')));
% addpath(genpath(fullfile(libdir, 'xinshuo_toolbox', 'matlab')));
% addpath(genpath(fullfile(libdir, 'xinshuo_toolbox', 'file_io')));
% addpath(genpath(fullf... |
clear all
close all
clc
disp('AR1')
rng('default')
% Monte-Carlo runs
runs = 1000;
%AR(1) model specs
n = 300;
Y = NaN(n,runs);
theta = [0 ; 0.9 ; 0.2]; %[mu_y phi_1 sigma]
p = 1;
q = 0;
%residuals
epsY = theta(3)*randn(n,runs);
%Generate the AR(1) process
Y(1,:) = epsY(1,:);
for t = 1:... |
function [fx,dfx,ifx] = sat_i(u,m,M)
if abs(u)<=m
fx = u;
dfx = 1;
ifx = u^2/2;
elseif u>m
w = pi*(u-m) / (2*(M-m));
fx = m+2*(M-m)*atan(w)/pi;
dfx = (1+w^2)^(-1);
ifx = m*(u-m/2)+(2*(M-m)/pi)^2*iatan(w);
else
w = pi*(u+m) / (2*(M-m));
... |
function [ price ] = estimatePrice( x , params )
gaussians = computeBasisFunctionsVector(x,params);
price = params.Weights.' * gaussians;
% [N,~] = size(params.Weights);
% price = 0;
% for i = 1:N
% w = params.Weights(i);
% mu = params.MUs(:,i);
% covs = params.Covs{i};
% price = price +... |
function [R1_sdav,R2_sdav,R3_sdav,R4_sdav,R5_sdav,R6_sdav,R7_sdav,R8_sdav,lin_spec]=...
twoD_with_HEOM_main(sdlp_rng,coup_com_save,coup_acom_save,...
const_factor,QQ_topass,nn,max_tier_final,fock_space_rep,...
H_site,site_shift,V_n,av_2,av_3,av2_3,av_4,av_5,av2_5,...
calc_rp,calc_nr... |
function Dh = hammingDist(B1, B2)
[m1,n1]=size(B1);
[m2,n2]=size(B2);
NN1=max(m1,n1); %%%length
NN2=max(m2,n2);
if NN1~=NN2
disp('error');
Dh=10000;
end
len=NN1;
counter=0;
for i=1:len
% if B1(i)~=B2(i)
% counter=counter+1;
% end
counter = counter + abs(B1(i)-B2(i))... |
T_C0toI = [0.0148655429818, -0.999880929698, 0.00414029679422, -0.0216401454975;...
0.999557249008, 0.0149672133247, 0.025715529948, -0.064676986768;...
-0.0257744366974, 0.00375618835797, 0.999660727178, 0.00981073058949;...
0.0, 0.0, 0.0, 1.0];
T_C1toI = [0.0125552670891, -0.99... |
function [F, M, trpy, drpy] = controller(qd, t, qn, params)
% CONTROLLER quadrotor controller
% The current states are:
% qd{qn}.pos, qd{qn}.vel, qd{qn}.euler = [roll;pitch;yaw], qd{qn}.omega
% The desired states are:
% qd{qn}.pos_des, qd{qn}.vel_des, qd{qn}.acc_des, qd{qn}.yaw_des, qd{qn}.yawdot_des
% Using these curr... |
% Create an array to save all feature vectors for 20 images
Set=[];
% Create a text file to save training set
fileID = fopen('testset.txt','at');
% Using a for loop to save feature vectors automatically
for w='a':'h';
P=strcat(w,'.pgm');
Q=imread(P);
fun=@minutie;
L = nlfilter(K,[3 3],f... |
function [xp,yp,hp,cost] = descentwithcost(x,y,h,dhdx,dhdy,xp,yp,g,C,V,cg,cycles)
% Computes the optimal path (xp,yp) with height hp for a cost function
% of the form J = sum(distance*(1 + (2*g*C*h/V^2)^2) on a terrain.
% Inputs: xp and yp are the path. The gravitational constant (g), the constant
% (C... |
load burst_data_matrix_aj
%counter = 1;
counter_2 = 1;
counter_3 = 1;
counter_4 = 1;
counter_5 = 1;
counter_6 = 1;
counter_7 = 1;
counter_8 = 1;
counter_9 = 1;
counter_10 = 1;
counter_11 = 1;
counter_12 = 1;
counter_13 = 1;
counter_14 = 1;
counter_15 = 1;
counter_16 = 1;
for counter = 1:5296
... |
% Yuta Kuboyama
% Converts a segment of a wavefile into coe format.
% filename : name of wavefile, eg 'violin.wav'
% start : starting index of segment
% finish : final index of segment
% channel : 1 for left channel, 2 for right channel.
% output_name : name of output coe file, eg "violin.coe"
% scaling_fact... |
% Model4S1: Model 4, Step 1 --> initialize optimization
close all; clear all;
setupstart = tic;
% open parallel pool
parpool(10);
options = optimoptions('ga','UseParallel',true);
% three parameters: export scaling factor, mean TA, Rconst
lb = [0.15 2375 0]; % lower bound
ub = [0.8 2425 0.1]; % upper bound
% Genet... |
function event_data = mxm_get_next_event()
%MXM_GET_NEXT_EVENT Grab the next event out of the file.
% mxm_get_next_event either returns the next event as a MATLAB struct with all of the
% event data as fields.
event_data = mxMonarch('next_event');
end
|
function drawTrainAccuracy_multitask(fileName)
clc;
% load the log file of caffe model
fid = fopen(fileName, 'r');
tline = fgetl(fid);
%get arrays to draw figures
lossIter = [0]; %loss横坐标
lossArrayAds = [0]; %loss纵坐标
lossArrayMulti = [0]; %loss纵坐标
lossArraySingle = [0]... |
classdef DoubleArrayDataSink < DataSink
properties
Array;
end
methods
function obj = DoubleArrayDataSink(dimensions,dataSink)
if nargin < 1
dimensions = size(1);
end
if nargin < 2
mo... |
function Tdot =Tdot_TRCM_3D(t,T,R,C,Para)
%% Description :
% Tdot_TRCM_3D is an incredibly clean chunk of code full of very usefull comments and explanations used by TRCM_3D to compute a matrix of dT/dt for each node of the TRCM network.
%
% Author : Philippe Pasquier (philippe.pasquier@polymtl.ca)
% Tdot_TRCM_3D ... |
function [sfg]=sfg_macfirfilter(h,type)
% SFG_FIRFILTER Signal flow graph for FIR filter based on MAC
% SFG=SFG_FIRFILTER(H, TYPE) returns the signal flow graph of a
% FIR filter with impulse response H and type TYPE based on
% multiply-accumulate (MAC) operations.
%
% H - impulse response
% TYPE - 'di... |
function [trapArea,OutError,OutTrueError] = TrapezoidArea(x1,x2,y1,y2,dfun,fun)
trapArea=(1/2)*abs(x2-x1)*(abs(y1)+abs(y2));
OutError=(abs(x1-x2)^2/12)*(dfun(x1)-dfun(x2));
OutTrueError=integral(fun,x1,x2)-trapArea;
end
|
function returnVal = newtonMethodV3(iniGuessEtaHat,iniGuessC, a, h, g, rho, N, L, x)
iniGuessX = [iniGuessEtaHat;iniGuessC];
% - - - - - - - - - - - - - - - - - - -
% Use the internal Matlab "Newton's Method"
% - - - - - - - - - - - - - - - - - - -
options = optimset('TolFun',1e-6,'TolX',1e... |
clc
clear
run cal
run unknown_input
load force.mat
load f_un.mat
load X.mat
load Y.mat
load u.mat
n=4
for ii=1:4;
figure(ii)
plot(detrend(X(ii,:)),'r')
hold on
plot(detrend(u(:,ii)))
end
for ii=1:4;
figure(4+ii)
plot(detrend(X(n+ii,:)),'r')
hold on... |
cd /Users/Cedric/Documents/Matlab/SD1
%% Plot the clocks
clc;
figure(1);
subplot(5,1,1); %%! Plot of the master clock
plot(M_clk.Time, M_clk.Data);
xlim([0 1e-2]);
ylim([-0.5 1.5]);
title('Master clock', 'FontSize', 6);
xlabel('time, t', 'FontSize', 6);
ylabel('magnitude, A', 'FontSize', 6);
sub... |
function a=read_train_data(im,b,start_image_num,end_image_num,mrc_directory,box_directory,particle_image_size,mic_width,mic_length)
%im indicate the prefix of the image name
%b indicate the bites of the number in the image name
num=0;
for image_num=start_image_num:end_image_num
c=im;
c3=num2str(image_num,['%0'... |
function CS4640_A1_driver_tch
% CS4640_A1_driver - driver to test A1 functions
% On input:
% N/A
% On output:
% N/A
% Call:
% CS4640_A1_driver
% Author:
% T. Henderson
% UU
% Spring 2018
%
% Test create image
imc = CS4640_create_im('CS4640_hemisphere',100,100,256,-3,5,-4,4);
% Show as graylevel... |
function pa_pet_decaycorrect(files,t1,t2,FDG)
%% Initialization
%% Difference
thresh = 200;
%% Load
dat = struct([]);
nfiles = length(files);
for ii = 1:nfiles
file = files{ii};
nii = load_nii(file, [], 1); % load the scan
view_nii(nii);
dat(ii).img = nii.img;
end
%% Non-adjusted graphs
a... |
% errorxym - plots multiple sequences of points with different
% markers (without connecting lines)
%
% Syntax
% errorxym(X, Ym, Ys, varargin)
%
% See also
% errorxy
%
% Reference
% "Estimation of low-rank tensors via convex optimization"
% Ryota Tomioka, Kohei Hayashi, and Hisashi Kashima
% arXiv:1010.07... |
function msgAndWait(m,args)
% function msg(msg,args)
% ex helper function, sends a message to the slave and then waits for a
% response from the slave
%
% msg: a string message
% args: if present, the msg variable can use % replacement like fprintf and
% these are the arguments
%
% examples:
% > msg('obj_on 3');
% > ... |
function data = haranfilter( input, M,P,windowSizes )
% haranfilter Filter noise in fluorescence traces, preserving anticorrelation.
%
% DATA = haranfilter( DATA )
% applies a non-linear filter specifically designed to reduce noise in
% single-molecule fluorescence traces, while preserving sharp transitions
% in F... |
function [ output_args ] = uygulama_acinim( input_args )
%UYGULAMA_ACİNİM Summary of this function goes here
% Detailed explanation goes here
[x1, y1] = ucgen(0,2,4,1,1);
[x2, y2] = acinim(x1, y1, 2, 0, -1);
plot(x2, y2);
title('ucgen fonksiyonuna 2x^2 - 1 ile acinim yapılmış hali')
end
|
%% RedObject ver 0.2
%% discription
% This function allows to identify red objects in live video,
% and painting them according to user-selectable colors: red, green or blue.
%
% No need computer vision toolbox
%% Operating Instructions
% To paint the color red object we vote to act as follows:
%
% * Red - ... |
function new_feature = temporal_max_pooling(feature, filter_size, stride)
% Input:
% feature : Mx1 cell array containing spatial features
% feature{i} is one spatial feature map of any ConvNet
% layers: ex) conv5, pool5, etc
% filter_size : tempora... |
function [ T_VECTOR ] = RGP( T )
% returned avarage value of k=30 attampts of craeting randomaly graph
%by Attribute of T1/T2
% call MAKE_RGP() for each value of n=5..10..100 for 30 times and push
% into T_VECTOR the avarage of 30 times
T_VECTOR=zeros(1,20);
if T==1
for n=1:20
counte... |
function runs = eb_fret_waitbar(x, K_values, restarts, varargin)
% eb_fret(x, K_values, restarts, varargin)
%
% Runs EB inference on a set of FRET time series.
%
% Inputs
% ------
%
% x : (1xN) cell
% Time series to perform inference on
%
% K_values : (1xR)
% Number o... |
%% In-Class Exercises for the Multi-Path Fading
% These problems are part of the multi-path fading lecture.
% You can complete each problem after the corresponding section in the
% class.
%
% For each problem, complete the sections labeled TODO.
%% Up and down-conversion, Problem 1
% Consider a system with the foll... |
function [XX,YY,gmPDF,threshold] = GaussianHalfFit(data)
% find the 50% ofaudio samples that fall into the ellips
newUseIndex = true(size(data,1),1);
for iter = 1:3,
GMModel = fitgmdist([data(newUseIndex,1),data(newUseIndex,2)],1);
gmPDF = pdf(GMModel,data);
tempThreshold = median(gmPDF);
newUseIndex =... |
function [ xNew ] = uniformXPoints(n, q, data)
% [ xNew ] = uniformXPoints(n, q, data)
%
% n ... size of data for uniformPoints
% n = ceil(mean([length(x1), lenght(x2)]))
% data ...data from which we'll count q-quantiles and therefore starting
% and ending point for histogram
%
%n = sqrt(n);
%n = ceil(log2(n));
n =... |
function dn = dnmult(dn0,dn1)
% DMULT dual number multiplication
%
% DN = DNMULT(DN0,DN1) returns the dual number DN which is the dual number
% multiplication of the dual numbers DN0 and DN1
% - DN0 (resp. DN1) is a dual number (DN0 = a0 + eps*b0, eps^2 = 0).
% It is a 2-vector or a 2*N array... |
function [process_list,missing_list] = fcon_get_files(subjects,opt);
% Gets a structure of files to be used to create the pipeline using fcon_fmri_preprocess.
%
% [process_list,missing_list] = fcon_get_files(subjects,opt)
%
% IN:
% subjects:
% List of subject names, see fcon_read_demog for more information.
% ... |
function [decoded, times] = exDecode(codeIn)
%To decode ex codes into something resembling English. adam@adamcsnyder.com
%23Apr2012
globals; times = [];
if isa(codeIn,'struct')&&isfield(codeIn,'codes') %added to make it easier to work with allCodes variables output by Ex -ACS 24AUG2012
codeIn = cod... |
global exp1 exp3 exp10 exp32 exp100 exp3ca exp10ca exp32ca exp100ca exp320ca Acell
exp3ca.conditions={5,125,245};
exp3ca.globals=struct('ATP',0.2*10^-6,'A',0.2*10^-6,'V',-60*10^-3,'C',2*10^-3);
exp3ca.simple.conditions={5,125,245};
exp3ca.simple.globals=struct('ATP',0.2*10^-6,'A',0.2*10^-6,'V',-60*10^-3,'C',2*10^-3);... |
function f = NS_ode(times, x, p, more)
m2 = 0;
betabasis = more.betabasis;
betanbasis = getnbasis(betabasis);
m1 = m2 + 1;
m2 = m2 + betanbasis;
betacoef = p(m1:m2);
betamat = eval_basis(times, betabasis);
betavec = betamat * betacoef;
alphabasis = more.alphabasis;
alphanbasis = getnbasis(alphabasis);
m1 = m2 + 1;
m2 =... |
function flag = access(startPoint, endPoint, tabu)%%起终点不一定是真正意义上的起终点,返回值为0时不可达
% 判断startPoint, endPoint组成的线段是否与tabu构成的障碍物多边形的边相交
% startPoint 1*2 double表示起点
% endPoint 1*2 double 表示终点
% tabu pn*2 double 表示障碍物多边形,每个点顺次连接组成的多边形,可以为凸多边形,也可以为凹多边形,但是不能有"洞"。tabu(1,:)应该与tabu(end,:)相同。(若不同,程序自动调整为相同)
% Author A.Star
% e-mail :... |
%% Atmosphere Plot Script from OpenVSP APIParasiteDragTestSuite
%% Date: 3/28/2017
%% Author: Bryan Schmidt
clear all
close all
clc
height = 4;
width = 6;
legendfontsize = 9;
labelfontsize = 12;
%% Collect Data (US Standard Atmosphere 1976)
% Data Type
Data_Type = 'USStandardAtmosphere1976';
File_Name = sprintf('%... |
% get root of current file
root = fullfile(fileparts(mfilename('fullpath')),'../');
p_generated = genpath([root '/Core']);
addpath(p_generated);
addpath([root '/IO']);
addpath([root '/Data']);
addpath([root '/Scripts']);
p_generated = genpath([root '/ThirdParty/tetgen1.4.3/bin']);
addpath(p_generated);
p_generated =... |
%超前校正
clc;
clear all;
close all;
kc=1;
ypm=10;
num=[1];
den=[1 1 0];
sys=tf(num,den);
[Gm,Pm,Wgm,Wpm]=margin(sys*kc);
[mag,pha,w]=bode(sys*kc);
Mag=20*log10(mag);
phi=(ypm-Pm)*pi/180+10;
alpha=(1+sin(phi))/(1-sin(phi));
Mn=-10*log10(alpha);
Wcgn=spline(Mag,w,Mn);
T=1/Wcgn/sqrt(alpha);
Tz=alpha*T;
... |
function [I_hash, I_offset ] = Inner_Loop4( sigma, n, B )
%UNTITLED10 この関数の概要をここに記述
% hash関数とoffset関数の定義.
hash_func = @(x)(round(x*sigma*B/n));
offset_func = @(x)(sigma*x - round(sigma*x*B/n)*n/B);
I_hash = hash_func(1:n);
I_offset = offset_func(1:n);
end
|
%% Clear
clear; close all;
%% Sample images from the sparse prior
% load prior and display
prior = load('sparsePrior.mat');
display = displayCreate('CRT12BitDisplay');
%% Sample a small patch of image
stride = sqrt(size(prior.regBasis, 1) / 3);
imSize = [stride, stride, 3];
meanPatch = prior.mu';
% sample from an ex... |
%@(#) readkinf.m 1.3 94/03/16 14:39:53
%
function readkinf
set(gcf,'pointer','watch')
h=get(gcf,'userdata');
eocfile=get(h(4),'string');
kinf=kinf2mlab(eocfile);
set(h(4),'userdata',kinf)
set(gcf,'pointer','arrow')
|
% function from deep irf to DC:
function [R,T,Z]=irf2dc_fund(M,FT,bigC,ZZ,ZR,RZ,RR,TT,HS,az,Sh,dr)
% remember the conventions, R = radial, T transverse, Z vertical downward.
% rotate the moment tensor at each point source.
for ir=1:length(ZZ)
cosa=cos(az{ir}*pi/180);cosb=cosa;
sina=sin(az{ir}*pi/180);sinb=sin... |
function [t_plot, y_t] = filter1(x_t, h_t)
%UNTITLED5 此处显示有关此函数的摘要
% 此处显示详细说明
n = (length(h_t) - 1) / 2;
y_t = conv(x_t, h_t);
y_t = y_t(n + 1: n + length(x_t));
t_plot = n + 1: length(x_t) - n;
% i=1;
% y=zeros(size(t));
% irfk = irf(-n:n);
% for j=1:length(t)
% yi=zeros(1,2*n+3);
% for k=-n : n
% yi(i)=irfk(k +... |
clear all
% % % your results
yourfilename='../NTHMPresults/BP5/Revere_gagesB.txt';
[tt,hg4,hg5,hg6,hg7,hg8,hg9,hg10]=textread(yourfilename,'%f %f %f %f %f %f %f %f %*[^\n]','emptyvalue',NaN);
ntt=length(tt);
hhh(1:ntt,1:7)=0;
hhh(:,1)=hg4;
hhh(:,2)=hg5;
hhh(:,3)=hg6;
hhh(:,4)=hg7;
hhh(:,5)=hg8;
hhh(:,6)=hg9;
hhh(:,7)=... |
% PCA Networks and the Cocktail Party Problem
% Coded In: MATLABr2013a
%
% This program uses a PCA network to apply PCA to find the first
% principal component of two sound sources to produce one isolated sound
% source.
%Create a PCA network with learning rate 0.1
soundFile = csvread('sound.csv');
[numTrainingExam... |
function Lab=i_lch2lab(LCh)
%I_LAB2LCH Convert from LCh to Lab.
% LAB=I_LCH2LAB(LCH) with size(LCH)=[M 3] returns matrix LAB with
% same size.
%
% Remark:
% This is a low level function, that has a rigid parameter passing
% mechanism and no error handling. It is only to be used when the
% n... |
clear;
close all;
clc;
figure;
% ZN Continuous method
sys = tf([1], [1 6 11 6 0]);
kp = 6;
ki = 6/pi;
kd = 3*pi/2;
step_from_pid(sys, kp, ki, kd);
hold on;
% ZN Damped Oscillation method
[kp, ki, kd] = damped_oscillation_tuning(sys);
step_from_pid(sys, kp, ki, kd);
hold on;
% ZN Reaction Curve
[... |
% % takes an image and an alpha, and returns a matrix of size alpha × 2 of
% % random pixels locations inside the image
function [points] = getRandomPoints(I, alpha)
m = size(I, 1);
n = size(I, 2);
s = [m, n];
inds = randperm(numel(rand(s)), alpha);
[pts_x, pts_y] = ind2sub(s, inds);
poi... |
function yrng = yrange(ax)
% function yrng = yrange(ax)
% - returns the y range of the passed axes
% - if no axes specified, uses current axes
if ~nargin
ax = gca;
end;
yrng = range(get(ax,'YLim'));
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.