text stringlengths 8 6.12M |
|---|
%> @file logMessage.m
%> @brief Represents a single log entry
%> @details Contains all the information needed to filter and display a single log entry
%> @author Ben Nordin
%> @date 2011-09-01
% ======================================================================
%> @brief Represents a single log entry
%> @details Co... |
a=zeros(1,10000);
for i=1:10000
N=zeros(1,i);
for k=1:i
x=ceil(rand(1,1)*i);
N(1,x)= N(1,x)+1;
end
sum=0;
for j=1:i
if N(1,j)==0
sum=sum+1;
end
end
a(1,i)=sum/i;
end
sample=sqrt(var(a))/100
figure(1);
plot(a(1,1:10000));
axis([1 10000 ... |
clear;
k=input('PODAJ LICZBĘ WĘZŁÓW (0 - QUIT) m=');
if (k==0) end
if (k<0) || (k==1) || (k==2) rat3n; end
if (k>2)
for m=3:k
n=m-1;
a=-1;b=1;
step1=(b-a)/n;
x=a:step1:b;
y=1./(1+100.*x.*x);
for i=0:n
xc(i+1)=cos((2*i+1)*pi/(2*n+2));
end;
yc=1./(1+100.*xc.*xc);
step2=(b-a)/100;
xt=a:step2:b;
wnc=polyfit(xc,yc,n);
y... |
function dydt = springsmasssystem(t, y, p, isLinear, u1f, u2f)
% SPRINGSMASSSYSTEM Spring-mass system equations for the ODE solver.
%
% $m*a_i + 2c vi + k(xi-xim1) + k(xi - xip1) = 0$
%
% ODE solver requires function f such that y' = f(t,y)
% Here, y = [x; v], x' = v, and v' = a.
% Then function is [v; a] = f(t, ... |
fs=10000;
fc=2000;
pb=1;
sb=40;
N = 5;
[bb,ab] = butter(N,fc/(fs/2));
[hb,wb] = freqz(bb,ab,2001,fs);
[b1,a1] = cheby1(N,pb,fc/(fs/2),'low');
[h1,w1] = freqz(b1,a1,2001,fs);
[b2,a2] = cheby2(N,sb,fc/(fs/2),'low');
[h2,w2] = freqz(b2,a2,2001,fs);
[be,ae] = ellip(N,pb,sb,fc/(fs/2),'low');
[he,we] = freqz(be,ae,2001,f... |
function [y_dowm,y_up,x_right,x_left,yuzhi]=xiuzheng(y_dowm,y_up,x_right,x_left)
S=(y_dowm-y_up)*(x_right-x_left) ; %S为像素面积
if S<=25000
yuzhi=50;
y_xiuzheng=3;
x_xiuzheng=3;
elseif S>25000&&S<=45000
yuzhi=100;
y_xiuzheng=3;
x_xiuzheng=3;
elseif S>45000&&S<=80000
yuzhi=200;
y_x... |
function [K, invK, rbfK] = computePriorKernel(X, theta, type, Kn, invKn);
if nargin < 4
if (type == -1)
K = eye(size(X,1), size(X,1));
else
theta = thetaConstrain(theta);
if (type == 0)
K = kernel2(X, X, theta);
rbfK = K;
elseif (type == 1)
K = kernel(X, X, theta);
rbfK... |
function mat = APM(f,mat)
db=0;
omega = 2*pi*f;
rho_0 = mat.rho; % [Kg.m-3] density at rest of air at 22C, 1atm
c_0 = mat.c; % [m.s-1] speed of sound in air at 22C, 1atm
P_0 = 1.0132e+05; % [N.m-2] atmospheric pressure at 22C, 1atm
sigma = mat.sigma ; % [N.s.m-4] static air flow ... |
% Update all the equations of motion
% (velocity and acceleration in x and y)
% Takes in all these values from previous timestep to update
function res = movePendulum(~, CurrentValues)
% Define given terms
m = 1; % kg
g = 9.8; % m/s^2
%k = 1000000000; % Spring constant
l = 1; % rest length
% Get current value... |
function BinFeatures = feature2bin_2( saveFilePath, fileLoad, fileSave, col, Methods)
%% Process Formation Field
%col: col th in raw1 matrix, containing the respective categoric feature
%Methods:
load( [saveFilePath fileLoad]);
[N F] = size(raw1);
%% Process Type Object Field
f = col... |
function krFwdCorr_SingleSaccade()
% testing psychtoolbox screen command
clc, clear; close all; pause(0.01);
try
[ai, dio] = krConnectDAQ();
isDaq = true;
catch
disp('no daq')
isDaq = false;
end
% remember to clear this out for real experiments
Screen('Preference', 'SkipSyncTests', 0);
whichScreen... |
function ppath = projectspath
%PROJECTSPATH
%
% Returns the path, where all projects are stored
ppath = 'C:\Users\q284114\Projects'; |
function [ condicion,x, y, xinc, yinc, img2 ] = untitled( x,y,xinc,yinc )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
%% Leemos nuestras dos imagenes en formato doble y normalizadas
img=(imread('semilleo 2.jpg'));
img2=(imread('Imagen Final Semilleo 2.jpg'));
%%... |
img=imread("cameraman.tif"); %reading cameraman image and loading into variable img
figure,imshow(img); %displaying img's image
[m,n]=size(img); %initializing the size of image into m and n variables
imgpad = zeros(258,258); %assigning the imgpad to zeros 258 rows and 258 coloumns .
imgpad(... |
function processCaImagingMCPnev(paramsFileName)
% processCaImagingMCPnev(paramsFileName)
%
% This is the master function for Matt's Ca imaging pathway. It performs
% the following steps:
% 1) Load a parameters file from a folder in the current directory named
% improcparams/paramsFileName. This file should be... |
%% Lab Curriculum, Course 1 - The Basics of Binocular Rivalry (BR intro)
% at the start of any code, close any open windows, clear all Matlab variables, and clear the
% command window
clear all; close all; clc;
% these commands hide the mouse cursor, and prevent keypresses from
% displaying in the command window
Hide... |
diary('C:\Users\cayde\Documents\GitHub\Avalanche-Detection-Capstone\unfilterresult.txt')
for i = 1:100
algorithim_demo()
end
diary('off') |
function c=myAdd(a,b)
c=a+b;
end |
clear all, close all
file="FIR.wav";
[s, fe] = audioread(file);
n=0:length(s);
figure()
plot(s)
xlabel('n'), ylabel("p_+(n)")
set(gcf,'units','points','position',[100,10,400,150]) |
function this_img = get_img(img_in,im_opts)
% Get the greyscale image and some intensity stats
% img_in = imread(fullfile(im_opts.root,im_opts.name));
this_img = get_imdetails(img_in);
x_len = size(this_img.img,1);
y_len = size(this_img.img,2);
% Retrieve the thresholded COM and other data
% ... |
function [out] = filterFeasible(in, search_bounds, boundary_type)
% Usage:
%
% [out] = filterFeasible(in, search_bounds, boundary_type)
%
% Inputs:
% o in - 1xN array of positions to 'fix'
% o search_bounds - 2xN array of limits of the positions
% o boundary_type - String matching one of th... |
function fh = plot_by_year(data_itM, yearV, yLabelStr, legendV, saveFigures, cS)
figS = const_fig_so1;
fh = output_so1.fig_new(saveFigures);
hold on;
% Keep track of series plotted
ns = size(data_itM, 1);
plottedV = zeros(ns, 1);
for i1 = 1 : size(data_itM, 1)
yV = data_itM(i1,:)';
idxV = find(yV ~= cS.missVa... |
% ==============================================
% function Plotdisp_show
% ==============================================
function Plotdisp_show(U0,coordinatesFEM,elementsFEM)
warning off;
figure; show([],elementsFEM(:,1:4),coordinatesFEM,U0(1:2:end));
title('$x-$displacement $u$','FontWeight','Normal','Interpreter... |
clear all; close all; clc;
rng('default');
rng(1);
c=3;
n_train=100;
n_test=1000;
k=10;
[x_train,y_train] = generateMultiringDataset(c,n_train);
[x_test, y_test] = generateMultiringDataset(c, n_test);
iter_max = 100;
result = zeros(iter_max,3);
x_train_label1=x_train(:,y_train==1);
x_train_label2=x_train(:,y_train==2... |
load SpikeTimeGaussian
load GaussianMovieData
%%
K=find(WW(:,1)>150);StimWW=K(find(diff(K)>10));
Stim=zeros(601000*20,1);
NewStimTime=[];
for i=106:124% 1:20 %length(StimWW)
i
NewStimTime=[NewStimTime StimTime(i)-StimTime(106)];
for j=3:1790
% Stim(round((j-1)*333.333+(1:334)),1)=WW(StimWW(i)+j,... |
% create lists of indices for each 3 month period
endt=360;
mam=sort([[3:12:endt],[4:12:endt],[5:12:endt]]);
jja=sort([[6:12:endt],[7:12:endt],[8:12:endt]]);
son=sort([[9:12:endt],[10:12:endt],[11:12:endt]]);
djf=sort([[1:12:endt],[2:12:endt],[12:12:endt]]);
% create new arrays containing only the given 3 month perio... |
function [millerTimeArray_seconds,millerDataArray] = millerize(timeArray,dataArray)
%MILLERIZE Summary of this function goes here
% Detailed explanation goes here
relTimeArray_days = mod(timeArray-floor(timeArray(1)),1);
relTimeArray_seconds = round(relTimeArray_days*24*60*60/30)*30; % precise to 30 seconds
miller... |
function [tradeArray, ret] = queryTrades(self)
% [tradeArray, ret] = queryTrades(self);
[tradeArray, ret] = ctp_counter_loadtrades(self.counterId);
end |
function [x, fval] = l1_solve(P, b, lambda, max_iters,optTol,progTol, x0)
%wrapper for minFunc
mfopts = [];
mfopts.display = 'iter';
if max_iters>0
mfopts.MaxIter = max_iters;
mfopts.MaxFunEvals = 3 * max_iters;
end
if optTol>=0
mfopts.optTol=optTol; %default 1e-6
end
if ... |
%This project works for Markov chains and discrete events
clear all;
clc
%Question1
Ts = 0;
t = 0;
T = 100;
i = 1;
lamda = 19;
%Non-homogenous Poisson process for arrivals
while(Ts(i)<T)
while(t<T)
u1 = rand();
t = t - 1/lamda*log(u1);
u2 = rand();
if(mod(t,10)<5)
... |
if ~exist('ute_buffer','var');
load('uteload.mat');
end
if ~exist('scott_buffer','var');
load('scottload.mat');
end
%Hints from scott on visualizing points n bits.
%obj=sphere(radius?)
%surf(obj)
% He has some pointers on visualizing density, which we'll get back to me with
save_path='';
%%{
%%% display fir... |
%
% Written By: Michael Hutchins
aviobj=avifile('movie_name.avi');
%insert figure code here in for loop
pause(1);
F=getframe(gcf);
aviobj=addframe(aviobj,F);
%end for loop
aviobj=close(aviobj);
!mencoder mf://*.png -mf w=400:h=400 -ovc lavc -lavcopts vcodec=xvid -of avi -o output.avi |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Instruction set for panels
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Privliged memory locations
X0 = hex2dec('00');
ONVAL = hex2dec('01');
OFFVAL = hex2dec('02');
X1 = hex2dec('03');
Y1 = hex2dec('04');
X2 = hex2dec('05');
Y2 = hex2dec('06');
X3 = hex2dec('... |
%% Estimation of MAX Rate of Climb
clc
clear all
%% Variables
global P
global RO
RO_ss=1.225;%density at sea level
T_ss=288.16;%temperature at sea level
R=287;%universall const of air
S=56.36;%area of the wings
e=-2.5*(pi/180);%angle fo engine
P_ss=0.75*2*1864249.67;%power of both engine in max cruise
g=9.81;%gravity c... |
function con = MarijnMakeCon(cfg,inettyp,inet,MStore)
M = MStore(inettyp,inet,cfg.netpara).M;
for i = 1:length(cfg.nci)
indx{i} = 1:cfg.nci(i);
end
con = zeros(cfg.Ntot);
for i = 1:length(cfg.nci)
for j = 1:length(cfg.nci)
con(cfg.cci(i) + indx{i}, cfg.cci(j) + indx{j}) = cfg.SynConMat(i,j) * M(cfg.cci... |
function [times,C,spLB]=time_icip_mex(N,nIO,nEO,nOP,onlyDiag)
%Returned times are [chol,extract,mex,total];
%N is IO-EO-OP on entry.
p=[nIO+nEO+(1:nOP),nIO+(1:nEO),1:nIO];
N=N(p,p);
startClock=now;
L=chol(N,'lower');
cholClock=now;
cholTime=(cholClock-startClock)*86400;
% Extract blocks of L = [ A, 0; B, C].
% Di... |
function [ t, force, torque ] = readFTDataLVM( filename )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
data = textread(filename,'','delimiter','\t','headerlines',22);
force(:,1) = data(1:6:end,2);
force(:,2) = data(2:6:end,2);
force(:,3) = data(3:6:end,2);
... |
function [new_dsc,success,error_msg,warnings] = LoadDscFromXML(filename)
% @fn LoadDscFromXML
% @brief Loads measurement descriptor from XML file
% @param filename The name of the XML file
% @return new_dsc The descriptor read from the file on disk
% @return success 1 if load succeeded, 0 otherwise
% @return error_msg ... |
falls_list = [7,1; 8,1;9,1;10,1;11,1;12,2;13,1;14,2;15,1;16,1;17,2;18,1;19,1;20,1;21,1;22,1;23,1;24,2;25,2;26,1;27,1;28,3;29,2;30,5;31,2;32,4;33,1;34,2;35,2;36,1;37,4;38,1;39,1;40,3;41,1;42,4;43,2;44,1;45,3;46,3];
label_bathroom_cha ={'bendpick71';'bendpick72';'bendpick73';'bendpick74';...
'bendpick75';'empty';'f... |
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR
% Autores: Gonzalo Pajares y Jesús Manuel de la Cruz
% Copyright RA-MA, 2007
% Ejercicio 13.1: Movimiento
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 13.5.1 Flujo óptico
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function [candidate, Lattice, errorS] = symope_crystal(nsym, numIons, lat, minD, sym_coef)
global ORG_STRUC
spgBINDIR=[ORG_STRUC.USPEXPath '/FunctionFolder/spacegroup']; % path of execution
fixRndSeed = ORG_STRUC.fixRndSeed; % fix rand seed, to reproduce results
sGroup = spaceGroups(nsy... |
function [w_n, yHat, error] = DFT_NCLMS(y,x_n,mu)
N = length(x_n);
w_n = complex(zeros(N,N));
error = complex(zeros(N,1));
yHat = complex(zeros(N,1));
for i=1:N
x_i = x_n(:,i);
yHat(i,1) = w_n(:,i)' * x_i;
error(i,1) = y(i,1)-yHat(i,1);
w_n(:,i+1) = w_n(:,i) + (mu/(x_... |
%%
[filename,pathname] = uigetfile('*.xlsx', 'Chose files to load:','MultiSelect','on');
nfiles = length(filename);
for k = 1:nfiles
file = fullfile(filename,pathname(k));
end
S=xlsread(filename);
newfile=S;
% % x=newfile(:,1);
% % y=newfile(:,2);
% % plot(x,y,'m','lineWidth',2);
plot(S) |
syms t;
F = fourier(0.5 * exp(-2 * t) * heaviside(t));
subplot(2, 2, 1);
fplot(abs(F));
grid on;
subplot(2, 2, 2);
F2 = angle(F) * 180 / pi;
fplot(F2);
grid on;
syms t;
F = fourier(0.5 * exp(-2 * (t - 1)) * heaviside(t-1));
subplot(2, 2, 3);
fplot(abs(F));
grid on;
subplot(2, 2, 4);
F2 = angle(F) * 180 / pi;
fplot(F2);... |
function [P1,Q1,P2,Q2,P,Q,X1,X2,Y1,Y2,wjj,zjj,isolve,duality,exdual ] = ...
semi( j,anorm,T,P1,Q1,P2,Q2,P,Q,ip,pqnorm,X1,X2,Y1,Y2,...
wjj,zjj,duality,exdual )
%
% Purpose
% =======
%
% Monitor the loss of duality and correction is invoked to maintain
% semi-duality if necessary
%
% ... |
function CallPutParityMark(aBot,aStrike,aTime)
% Preambule and parameters
myCallOptionDepth = OptionDepth(aBot,aStrike,1);
myPutOptionDepth = OptionDepth(aBot,aStrike,0);
myStrike=aStrike;
myFactor=1.0003;
myVolumeDivider=1;
myFeedLength=3300;
myTimeFactor=1;%abs(myFeedLength-aTime)/myFeedLength;
myMaximumVolume=60000... |
function [vnvsig] = vnvseg(s,zf,fs,nmean)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Usage: [vnv,vnvevidence,filtsig] = vnvseg(wav,fs, ntrend);
%
% Description: This function computes the voicing strength of the given speech
% signal 'wav' with sampling rate 'fs'. 'nmean' specifies... |
%%
fig_path = fileparts(mfilename('fullpath'));
load([fig_path '/' 'Fig7.mat']);
%% plot compasses
subj = 8;
t_min_max = [-0,600];
mask = t_min_max(1)<times & times<t_min_max(2);
[~,t_ind_subj] = max(mean(theta_phases_r(:,:,subj),2).*mask');
% t_ind_subj = 100;
subj_theta_phases = cell2mat(cellfun(@(X) X(t_ind_subj,... |
% XXXXXXXXXXXXXXXXXXXXXXXXXXXX htet_reconstruct_using_trained_emfis XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
%
% Author : Htet
% Date : Sep 11, 2019
% Function : used to predict using pre-trained eMFIS(FRIE)
% Syntax : htet_reconstruct_using_trained_emfis(input, net)
% input - input data
% net - pre-trained... |
function [f,df,d2f] = objFunLSQ( x, A, b )
%OBJFUNLSQ implementation of objective function for
%least squares problem
%
% inputs:
% A n x m matrix
% b right hand side (vector)
% x current iterate
%
% outputs:
% f objective value
% df gradient
% d2f hessian
... |
function[] = stab_T1(s, v, job, cc)
% This function plots the absolute stability region of 1st order RKC (RKC
% or RKC1)
%
% The stability polynomial is
% R(z;s) = T(w0 + w1*z;s) / T(w0;s),
% where
% w0 = 1 + epsilon/s^2,
% w1 = T(w0;s)/T'(w0;s), and
% T(x;s) is the degree s Chebyshev polynomial of the firs... |
%%%this file aims to generate training samples
clc
clear
%--------------------------parameter configuration-------------------------
antenna_x = 16;
antenna_y = 16;
antenna_size = antenna_x * antenna_y;
sample_size = antenna_size; % times of mearsurment for one sample
probability = 0.1; % probability of antenna faul... |
%Plot the mcc error in 3D(LAB) space. The square is the reference and the
%circle is the "current" color
%
% Input
% *lab: The "current" lab color. It is a 24*3 matrix (in 0-255)
% *slab: The reference lab color. A 24*3 matrix (in 0-255)
% *rgb: The "current" rgb color, used for display. It is a 24*3 matrix (in 0-255)
... |
%
% Christian Sherland
% Sameer Chauhan
% Michael Scibor
%
% featureSelectionCorrelation.m
% Attempt to select best features by using
% PRT sequential feature selection tool
%clear all
%close all
%clc
addpath(genpath('..'));
prtPath( 'alpha', 'beta' );
%% Read dataset and choose features using PRTFeatureSelSeq
... |
% Philippe Chatelain
% MECA 2550
% Standard atmosphere
function [p,rho,T,gamma,R,cp] = stdatm(z)
T0 = 288.15;% K
g = 9.81; % m/s2
lambda = -6.5E-3; % K/m
gamma = 1.4; %
R = 287.0529; % J/kg/K
cp = 1005;% J/kg/K
gammad = -9.8E-3;% K/m
rho0 = 1.225; % kg/m3
p0 = 101325; % Pa
T = (1 + lambda*z/T0) * T0;
p = ((T/T0)^... |
%N_ODE45 ODE45 do Matlab.
% [t,y] = N_ODE45(f,a,b,n,y0) Método numérico para a resolução de um PVI
% y'= f(t,y) com t=[a, b] e y(a)=y0 condição inicial
%
%Alunos:
%Ana Sofia Janeiro 2019132578
%Bruno Teixeira 2019100036
%Rafael Ribeiro 2019131989
%Gonçalo Correia 2019150122
function [t,y]=ODE45(f,a,b,n,y0)
... |
% b = triangolareInfCol(A, b)
% Metodo per la risoluzione di sistemi lineari triangolari inferiori,
% accedendo agli elementi per colonna.
% Input:
% -A: la matrice dei coefficienti;
% -b: vettore dei termini noti.
% Output:
% -b: vettore delle soluzioni.
%
% Autore: Tommaso Papini,
% Ultima modifica: 6 Ottobre 2... |
%% SVR METAMODELLING: VARIOUS METHODS
% This example showcases how to perform SVR metamodelling
% for a simple 1D function, using various hyperparameter estimation and
% optimization methods.
%% 1 - CLEAR THE WORKSPACE AND INITIALIZE THE UQLAB FRAMEWORK
clearvars
uqlab
rng(100, 'twister')% fix the random seed for re... |
function[aa]=alisa(zn1)
%alisa o espectro
%Este tipo de alisamento equivale a aplicar uma janela de hanning tantas vezes
%quanto desejado no dominio do tempo. No dominio da frequencia isto equivale a
%convoluir a janela de hanning com o espectro.
%O numero de graus de liberdade eh dado por (2 * y), tal que
... |
function v = ANaxon(Iinj,dt,Nc,F)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Auditory nerve axonal spike conduction model
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Input
% Iinj : injected current to each node at each time point [pA] (2D-vector... |
function state = vehicleDynamicsOptimized(track,car,N,dt)
initState = car.state;
width = 5;
x0 = repmat([0;0],1,N);
A = [];
B = [];
Aeq = [];
Beq = [];
LB = repmat([car.amin;car.amin],1,N);
UB = repmat([car.amax;car.amax],1,N);
nonlcon = [];
options = optimoptions('... |
function [x,relres,iter,resvec,mvecs] = mpgmres(A,b,P,type_in,tol,maxits,x0,varargin)
%MPGMRES An extension of GMRES which accepts multiple preconditioners.
%
% X = MPGMRES(A,B,P) solves the linear system A*X = B for X. The matrix
% A should be of dimension n by n, and generally large and sparse. The
% vec... |
function [smwt] = particlesmoother2(phi1, sig_rho , mu_rho, pfOut1, rho1, wt)
[Xsize Ysize] = size(pfOut1);
pfOut1 = gpuArray(pfOut1);
wt = gpuArray(wt);
smwt = gpuArray(wt);
rho1 = gpuArray(rho1);
for dt = (Xsize - 1):-1:1
sm_table1 = normpdf(pfOut1(dt+1,:), [phi1 * pfOut1(dt, :)]',... |
clc
clear all;
%γ =- 2(α+β)
nx = 100;
ny = 150;
L=2;
dx = 2/(nx-1);
dy = 2/(ny-1);
a = 1/dx^2;
b = 1/dy^2;
g = -2*(a+b);
Main_g(1:nx-2) = g;
dg = diag(Main_g);
Main_a(1:nx-3) = a;
da1 = diag(Main_a,1);
da2 = diag(Main_a,-1);
M1 = dg + da1 + da2;
Main_b(1:nx-2) = b;
M2 = diag(Main_b);
K1=kron(eye(ny-2),M1);
AU(1:nx... |
clear all; close all; clc;
%% Vykreslení Trajektorie pohybu pro jednu buňku
% Vývoj kulovitosti a velikosti plochy buňky
stat = {};
for k = 3:39
if k < 10
obr = imread(['MSC-CMFDA-migrace-6h-23-1-2018.lif_Series011_t0', num2str(k),'_z2_ch00.tif']);
obr = imcrop(obr,[674 347 392 451]); %Oříznutí ... |
%% Angular correlation between spherical harmonics profiles
%% Reference:
%% Adam W. Anderson.
%% Measurement of Fiber Orientation Distributions Using High Angular Resolution Diffusion Imaging.
%% Magn. Reson. Med., 54(5):1194-1206, 2005. (Eq.(71))
%% Example:
%% [corr] = angular_correlation(c... |
function [PC_back,intmem_back,cycle_back]=MulAB(PC,cycle,intmem)
intmem_back=intmem;
%load ACC,B
ACC=intmem(225,1);
B=intmem(241,1);
tmp=fi(ACC*B,0,16,0);
tmpl=mod(tmp.data,256);
tmph=fix(tmp.data/256);
%load Rn,PSW
PSW=loadPSW(intmem(209,1));
CY=PSW(1,1);
AC=PSW(2,1);
... |
function [opt] = sete4opt(o1,v1,o2,v2,o3,v3,o4,v4,o5,v5,o6,v6, ...
o7,v7,o8,v8,o9,v9,o10,v10)
% SETE4OPT - Allows user to modify the global toolbox options.
% opt = sete4opt('option', 'value', ...)
% Different calls have different effects:
% sete4opt set default options
% sete4opt('sho... |
function [x,fx,n]=Bisect(f,x1,x2,toll)
% Input:
% f macro contenente la funzione in x
% x1,x2 estremi sx e dx dell'intervallo
% toll tolleranza sull'intervallo
% Output:
% n numero iterazioni
% x approssimazione dello zero
% fx valore della funzione in x
x=x1;
f... |
%% Plotting terms appearing in the transport equations
% to determine their relative sizes.
ijp = 950;
dataFolder = '~/data/gs2/prof_reconstruct/ijp_950/';
fluxFile = [dataFolder 'fluxes_gs2.csv'];
omegaFile = [dataFolder 'omegaReconstruct.csv'];
tCoeffFile = [dataFolder 'transpCoeff.csv'];
use_Pi_over_Q = 0;
nrm_g... |
function x = importtab(file)
% imports data from a tab file with a text header row
a = importdata(file,'\t');
x = struct();
start = 1;
%find when results start
for i=1:length(a.colheaders)
if (strcmp(a.colheaders{i}, 'Sim_SimDuration') == 1)
c = find (a.data(:, i) > 0);
start = c(1,:);
... |
%mem clear func
clc;
clear;
clear all;
warning off;
%8lvl PAM
%MOD index
M = 8;
for i=1:M
a(i) = 2*i-1-M;
end
%disp(a);
%bit sequence
n = randi(1, 12);
disp(n);
%unipolar coding
for j = 1:length(n)
if n(j) == 1
y(j) = 1;
else
y(j) = 0;
end
end
%disp(y);
%pulse sh... |
function prior = fillpriormat_gauss(Nobs,ons,offs,Nstates)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% prior = fillpriormat_gauss(Nobs,ons,offs,Nstates)
%
% Description:
% Creates a prior matrix based on the DTW alignment (supplied by the input
% variables ons and offs. A rectangular ... |
function [re,RHe] = fhum(re,dr,Te,pe,z,hbl,iRH)
% prescribed RH in free troposphere/cloud layer
RHcl = .6;
% heights
tmp = abs(z-hbl/2);
bl1 = find(tmp==min(tmp));
tmp = abs(z-hbl);
bl2 = find(tmp==min(tmp));
if sum(isnan(re(:)))==numel(re)
re(1:end) = RH2r(iRH,Te(1),pe(1));
RHe = r2RH(re,Te,pe);
... |
function [R] = Coil_Resistance_Calculate(x_points,y_points,z_points,trace_width, trace_thickness, trace_resistivity, via_resistance)
%COIL_RESISTANCE_CALCULATE Summary of this function goes here
% Assumes coil is on the xy plane and not rotated in space, vertical z
% displacements are counted as vias
x_diff=diff(x_... |
function [BER_Fade,BER_Fade_ZF] = Freq_Fade_qpsk_ZF(SNR)
% clear all
% %close
% clc
%%%%%初始参数设置%%%% %%%%%
N_packet = 1e5;
N_bits = 1e2;
% N_symbol_qpsk=N_bits/2;
% SNR = 0:5:40;
SNRR = 10.^(SNR./10);
SNR_len=length(SNR);
Data_bit = round(rand(N_bits,SNR_len));
BER_qpsk_index = zeros(SNR_len,N_packet);
BER_qpsk_Fade_in... |
function [mu, Sigma] = initLandmarks(z,Q,xr)
x = xr(1);
y = xr(2);
theta = xr(3);
mu = [];
Sigma = [];
for i = 1:length(z)
r = z(i, 1);
b = z(i, 2);
% init mu
lnew = [
x+r*cos(theta+b)
y+r*sin(theta+b)
];
... |
function [ Gain ] = findGain( entropy1, entropy2, totalE )
%find information gain given binary entropy
%this is based on a binary tree
%total entropy of system - entropy of reduced set
Gain = totalE - (entropy1 + entropy2);
end
|
function [Maware] = calcAwareness2(node1,node2,st2,Vattack,Mimmun,Maware)
%Calculating node1 awareness got by node2.
STRATEGY_DEFECT = 0;
STRATEGY_COOPERATE = 1;
awareness = 0;
if (st2==STRATEGY_COOPERATE)
if (Vattack(node2)>0)
%Node2 has been attacked, So it could have util informati... |
function [FilterResponse, PhaseValue] = GetFilterEnergy(freStep, OriStep, patch, stiPar, scr)
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
nFre = length(freStep);
nOri = length(OriStep);
nImg = length(patch);
FilterResponse = nan(nFre, nOri, nImg);
PhaseValue = nan(nFre, nOri, n... |
function output = AfferentedMuscleModel(muscle_parameter,delay_parameter,gain_parameter,targetTrajectory,additionalInput)
%% muscle architectural parameters
alpha = muscle_parameter.pennationAngle;
mass = muscle_parameter.mass;
L0 = muscle_parameter.optimalLength;
L_tendon = muscle_parameter.tendonLength;
L0T = L_tend... |
clear;
h=0.001;
start=0;
finish=10;
t0=0;
x0=0;
v0=1;
t=0:h:10;
point_count=length(t);
b2=abash(h,t0,x0,v0,point_count, 2);
b3=abash(h,t0,x0,v0,point_count, 3);
f=@(x)(sin(x));
y=arrayfun(f, t);
plot(b2(1, :), b2(2, :), 'o', b3(1, :), b3(2, :), 'x', t, y);
grid on;
grid minor;
title('Porównanie rozwiązań układu równ... |
%This is the file used to run the whole project : "overcomplete dictionary learning"
%---------------------------Reading Input----------------------------------
%in my case I read
%input from '60 folders' and stored in a file 'project_input.mat(X)'
%AVOID THIS: you may read images from '80 folders' by using '... |
%------------FQPSK Modulation-------------------
close all;
clear all;
%------------parameters----------------
M = 4;
Rsym = 8000; % Input symbol rate
Rbit = Rsym * log2(M); % Input bit rate
Nos = 60; % Oversampling factor
ts = (1/Rsym) / Nos; % Input sample period... |
% change the input tar file name here
input = 'F101993.v4.tar'
% untar file
% v4 composite tar file structure is
% untarfile =
% {
% [1,1] = F101993.v4b_web.avg_vis.tfw
% [2,1] = F101993.v4b_web.avg_vis.tif.gz
% [3,1] = F101993.v4b_web.cf_cvg.tfw
% [4,1] = F101993.v4b_web.cf_cvg.tif.gz
% [5,1] = ... |
function [vars] = comp_Ur_mmx_nuc(vars, params)
%COMP_UR_MMX_NUC Optimal Ur with Group Lasso penalty, MMX
%
% Mehdi Bahri - Imperial College London
% June, 2016
S = vars.S;
T = vars.T;
A = vars.Uc;
Ur = vars.B;
Y_r = vars.Y_r;
Bn = mmx('mult', S, A, 'tn');
Bn = sum(mmx('mult', Bn, T) ,3) + vars.mu_r*Ur + Y_r;
V = pa... |
function output = permute_matrix(input,dimInt)
% function to permute matrix along one of the dimensions of a 3D data
% matrix
% input -
% David.J.Caldwell
lengthShuffle = size(input,dimInt);
operateOn = [2,3]; % Operate on submatrix along 3rd and 5th dimension
v = 1:ndims(X);
XX = permute(X, [operateOn, setdiff(v,... |
function obj = dirfiles(varargin)
%@latency Constructor function for LATENCY class
% OBJ = latency('auto') attempts to create a LATENCY object by ...
Args = struct('RedoLevels',0,'SaveLevels',0,'Auto',0,'SubBinSize',1, ...
'NumFrames',1);
Args.flags = {'Auto'};
[Args,modvarargin] = getOptArgs(varargin,Args, ...
... |
A=xlsread('Book1.xlsx','A2:F10');
plot(A(:,1),A(:,2),A(:,1),A(:,3),'LineWidth',5);
xlabel('\bf{turn duration (s)}')
ylabel('\bf{area covered (%)}')
legend('energy optimization','time optimization')
figure(2)
plot(A(:,1),A(:,4),A(:,1),A(:,5),'LineWidth',5);
xlabel('\bf{turn duration (s)}')
ylabel('\bf{distance f... |
function x_opt = simplex(A, b, c, mode)
% Fase I
[t, I_b, I_n] = fases(A, b, mode);
x_opt = "Solución no factible";
if t % En dado caso de que exista solucion factible.
% Fase II
if mode
disp('FASE II')
end
[x_opt] = iteration(A, b, c, I_b, I_n, mode, 1);
... |
% Generate numerical bead geomerty module of the CAT phantom
%
% Meng Wu at Stanford University
% 2014
ellipsesParams = zeros(51, 6 );
ellipsesParams(1,:) = [0 0 90 90 0 1];
ellipsesParamsDensity = [0 0 90 90 0 0.95; ...
0 0 75 75 0 1];
radius = 52;
patternLength = 10;
distance = 15;
... |
function y = get_random_slice(x)
% y = GET_RANDOM_SLICE(x)
%
% Return a random slice from the last dimension of x.
%
% Author: Vivek Venkatachalam (vivekv2@gmail.com)
s = size(x);
n_slices = s(end);
idx = randi(n_slices);
y = get_slice(x, idx); |
function [newT,newIndexchannel]=reduceNeurons(t,indexchannel,varargin);
%function [newT,newIndexchannel]=reduceNeurons(t,indexchannel,varargin);
% a function that reduce size of indexchannel. takes varagin{2:end} and
% adds them to varargin{1}
%example: [newT,newIndexchannel]=reduceNeurons(t,indexchannel,[2;1],[2;3],[... |
syms Vx s Cf Cr Jz lf lr m k
%%
A = [ -(Cf+Cr)/(m*Vx) ((Cr*lr-Cf*lf)/(m*Vx))-Vx 0 0
(Cr*lr - Cf*lf)/(Jz*Vx) -(Cf*lf^2 + Cr*lr^2)/(Jz*Vx) 0 0
0 1 0 0
1 0 Vx 0];
B = [ Cf/m 0
Cf*lf/Jz 0
0 -Vx
0 0];
C = [ 0 0 Vx/k 1];
D = 0;
%%
modelTF = C*inv(s*... |
function [ xcorrmat ] = sigxcorr( ind )
%SIGXCORR computest the crosscorrelation between an input signal and the
%rest and display the results as scaled image.
% sigxcorr( input_vector_number )
% Input the following variables directly from base
final_cell_sig = evalin('base','final_cell_sig');
% Obrain and scale th... |
function err = ...
errorfun_spectralintegration10(V,IA_fullspec,...
ILD_piece1,...
ILD_piece2,...
ILD_piece3,...
ILD_piece4,...
ILD_piece5,...
ILD_piece6,...
ILD_piece7,...
ILD_piece8,...
IA_bestloc)
%This function takes only ILDAlone mean arrays
%errorfun_spectralintegration7(... |
%{
common.OpticalSession (manual) # intrinsic imaging session
-> common.Animal
opt_sess : smallint # optical session number for this animal
-----
opt_path : varchar(255) # root path to raw data
opt_note : varchar(4095) # whatever you want
%}
classdef OpticalSession < dj.Relvar
properties(Consta... |
% Cross validation design based on training set(HS), test set(TBI), and
% eval set (NC). Note that the cross validation is project-specific.
% Performance is evaluated using ROC curves and AUC
%
% Author: Matineh Shaker
% shaker@ece.neu.edu
function [auc,modelorder,mahaldist_TBI,mahaldist_NC] = get_auc(HS,NC,TBI,grap... |
% Copyright 2014
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writin... |
function [v1Prim,v2Prim] = getNewVelocityVectorFromCircleCollide( circle1, circle2) % Fonction pour définir le nouveau vecteur vitesse du cercle effectuant la collision
V1 = [circle1.vVector.projectedSpeedVx ; circle1.vVector.projectedSpeedVy];
V2 = [circle2.vVector.projectedSpeedVx ; circle2.vVector.projectedSpeedVy];... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.