text stringlengths 8 6.12M |
|---|
%Automation algorithm to generate graphs of white noise signal
wn = wgn(290000,1,-20);
wn= alpha_filt(wn,500);
x_nodos1= []; %nodos
y_ass1=[]; % assortativities
N0={}; %nets
wn_alpha= {};
for i=3:-0.05:2
[nodos]= v_clocalmaximum(wn,1.5,2,i);
x_nodos1= [x_nodos1,size(nodos,2)]
[con... |
function y=PRO_sum(Jw,rho,t,con)
global delta_h_p c_d0 c_f0 volume_ratio c_os;
l_j=length(Jw);
y=zeros(length(Jw)-1,2);
delta_deltaV=zeros(l_j-1,1);
y(1,1)=0;
y(1,2)=0;
delta_v_max1=1-c_f0./(c_d0-delta_h_p./(c_os));%the condition that c_f=c_d0-delta_h_p at the entrance of the draw solution... |
function matchRatio = BBMatchRatio( BB1NormHist, BB2NormHist )
%BBMATCHRATIO ( BB1NormHist, BB2NormHist ) Calculate the match ratio
%between two normalized histograms of bounding boxes in a frame
SSDWeight = 0.2;
angleWeight = 0.4;
BhattaWeight = 1 - angleWeight - SSDWeight;
SSD = 1 - norm(BB1NormHist - BB2NormHist);... |
function orient = setOrientationFromPosition(dx,dy)
if dx == 0
if dy > 0
orient = 1.6;
else
orient = -1.6;
end
elseif dy == 0
if dx > 0
orient = 0;
else
orient = 3.2;
end
else
if dx > 0
orient... |
classdef generator < handle
properties (Access = public)
t
y
f1
f2
A
B
end
methods
function obj = generator(t, f1, f2, A, B)
obj.t = t
obj.y = zeros(length(obj.t), 1)
obj.f1 = f1
ob... |
% File: Exampl5_12.m for Example 5-12 and Figure 5-33
clear;
clf
R = 3;
l = 3;
Tb = 1/R;
f = 0:0.02:10;
x = l*pi*f*Tb;
PdB = 10*log10(SA(x).*SA(x));
% Note that on this plot consecutive points that are below
% the -30dB point are connected with a straight line
plot(f,PdB);
axis([min(f) max(f) -30 0]);
xlabel('f ... |
% testing image processing for quick and dirty prototyping
% quickColTest([2,30])
%
% for seHeight=1:2:5
% for seWidth=5:5:50
% quickColTest([seHeight seWidth])
% set(gcf,'OuterPosition',[2700-seWidth*25,1200-seHeight*200,600,400])
% end
% end
% function quickColTest(se)
% load('TestImagesFro... |
%transforma un tensor simetrico plano a un vector vertical de 6 componentes
%entrada [11, 12, 0;
% 12, 22, 0;
% 0, 0, 0]
%salida [11; 22; 33; 23; 13; 12]
function v = tensor_a_vector3(t)
v = [t(1,1); t(2,2); t(1, 2)];
end |
clear all;
v=1:30:3500;
N=10000;
k=1.38*10^(-23);
T=400;
m=6.6*10^(-27);
e=2.71;
Aaaaa=4*pi*N*((m/(2*pi*k*T))^(1.5));
dv=30;
%Q(a)random speed distribution
Tt=0;
bins=117;
W=0;
for bin=1:117
BigV(bin)=(bin-1).*dv;
Ener(bin)=exp((-m.*( BigV(bin).^2))./(2.*k.*T));
f_4(bin)=Aaaaa.*... |
function varargout = llrf(varargin)
% LLRF MATLAB code for llrf.fig
% LLRF, by itself, creates a new LLRF or raises the existing
% singleton*.
%
% H = LLRF returns the handle to a new LLRF or the handle to
% the existing singleton*.
%
% LLRF('CALLBACK',hObject,eventData,handles,...) calls the l... |
% Finite element solution of the scalar wave equation
% in a waveguide with perfectly conducting walls
%
% Author: Casey Icenhour
% Organization: North Carolina State University/Oak Ridge National
% Laboratory
% December 2016
% last update: March 1, 2017
clear all
%close ... |
function [ tfData,outD ] = fdtp_run_wavelet( incfg, data )
%UNTITLED7 Summary of this function goes here
% Detailed explanation goes here
% tfData.powspctrm = abs(tfData.fourierspctrm).^2;
% tfData.instphase = angle(tfData.fourierspctrm);
% freqnew=ft_checkdata(tfData,'cmbrepresentation','sparsewithpow');
if 1 ... |
function ang=SteeringPhasesPA(v,h,z,R,ElemLoc,f,c0)
% Function to calculate phases of each element of a PHASED ARRAY whose element locations
% are given by the ElemLoc matrix input. The transducer has a geometrical radius of curvature R.
% The focus is moved to a spot v,h,z (in cartesian coords) away from the ce... |
function Sol=RegrExOLSLADstudy(GEM,Data,samplesize)
%Create sample of perturbed data vectors
Rxns=size(GEM.S,2);
% Data=Data/max(Data);
DataRxns=find(Data>0);
DataSample=zeros(Rxns,samplesize);
epsmax=0.01*mean(Data(DataRxns));epsmin=-epsmax;
for i=1:samplesize,
DataSample(DataRxns,i)=Data(DataRxns)+(epsm... |
clc; close all; clear all;
%% This part will setup all the FDwave programcode_path='F..\FDwave'; % Path of FD code files
clc; close all; clear all;
code_path='../FDwave'; % Path of FD code files
addpath(code_path); ... |
%Boundary of combined classifier
%pn = combine2(any(combine2== 1,2),:);
%nn= combine2(any(combine2== 0,2),:);
%Boundary of general classifier
%pn = combine(any(combine== 1,2),:);
%nn= combine(any(combine== 0,2),:);
%Boundary of 1 such pruned classifier
%pn = combine10(any(combine10== 1,2),:);
%nn = combine10(any(c... |
function fitpagetofig(fig)
oldunits = get(fig,'Units');
set(fig, 'PaperUnits', 'centimeters', 'Units', 'centimeters');
figpos = get(fig, 'Position');
set(fig, 'PaperSize', figpos(3:4),'PaperPosition',[0 0 figpos(3:4)], 'Units', oldunits); |
%Produzindo trackings com erros de posicionamento
STEINTracking(true,false,true,'saveSTEIN1_1.mat',0.0005,0.05);
STEINTracking(true,false,true,'saveSTEIN1_2.mat',0.001,0.1);
STEINTracking(true,false,true,'saveSTEIN2_1.mat',0.0005,0.05);
STEINTracking(true,false,true,'saveSTEIN2_2.mat',0.001,0.1);
STEINTracking(true,fa... |
function output = vecSplit(n)
output = num2str(n)-'0';
end |
% Last Edited: Jan 2021
% Yifei Simon Shao
% This code generate the reference trajectory for car example in paper
% takes in desired velocity k_pk, initial velocity kv, initial heading kh
% and desired latitudinal offset ky.
% output is T vector for time [0,6]s, 2s to peak velocity, 4s to desired y, 6 seconds to stop. ... |
% Update status
function Print_Laser_Status(Onda,printStatus)
fprintf(Onda.outTarget,'[Onda] Laser status summary:\n')
if printStatus % print this always as short status
if Onda.emission
fprintf(Onda.outTarget,'Emission = On | ');
else
fprintf(Onda.outTarget,'Emission = Off | ');
end
if... |
clear all ; close all
subs = {'alex','dina','genevieve','jeremie','russell','valerie'} ;
eegcomps = {[24,25],[17],[11,15,21],[24],[27,45],[33,18]} ;
fmricomps = {[64],[41],[61],[67],[79],[75]} ;
for sub=1%:length(subs)
%%%% BOLD FMRI processing:
cd(['c:/shared/badger_mri/',subs{sub},'/nii/melodi... |
% %1
% a=[3.14,15,9,26];
% %2
clc
% b=[2.71;7;2.1;71];
% %3
% c=(5:-0.2:-5).';
% %4
% A=ones(9)+1;
% %5
% B=diag([1,2,3,4,5,4,3,2,1]);
% %6
% C=reshape(1:100,[10,10]);
% %7
% D=floor((-3 + (3+3)*rand(5))*10)/10;
%
% %prob2
% %1
% Ax=(-a.^2)/(2*2.5).^2;
% Bx=(2*pi*2.5.^2);
% x=exp(Ax)/sqrt(Bx);
% %2
% y=sqrt((a').^2+b.... |
function [img_segment, img_inside] = FuncSegment(img,mark_points, template_circle ,img_type)
[m, n] = size(template_circle);
% m = round(m / 2) + 1;
n = round(n / 2) + 1;
img_start_x = min(mark_points(:,2)) - n;
img_stop_x = max(mark_points(:,2)) + n;
img_start_y = min(mark_points(:,1)) - m ;
img_stop_y = max... |
p.NumBowties = 100;
p.REmitter = 1; % 1 ohm
p.RCollector = 1; % 1 ohm
p.Area = 5e-18; % 5 nm^2
p.Beta = 25; % enhancement factor
p.Distance = 10; % 10 nm
p.workFunction = 5.1; % work function of gold
p.CemitterCollector = 0.1; % nano farad
p.Cparasitic = 0.08; % 0.1 nano farad
p.Radius = 10; % 1 nm?
p.taby = csvrea... |
% Lambert W function package.
% wapr - Real values of the Lambert W function
% wapr_test - Routine to test wapr
% bisect - Lambert W function by bisection
% crude - crude approximations to W |
function boxes_mpc_gen(timesteps)
% n -- number of agents
% FORCES - Fast interior point code generation for multistage problems.
% Copyright (C) 2011-12 Alexander Domahidi [domahidi@control.ee.ethz.ch],
% Automatic Control Laboratory, ETH Zurich.
currDir = pwd;
disp('currDir');
disp(currDir);
endPwdIndex =... |
% Greg Guyles
% Machine learning
% Asst 1
% 1-24-2014
function preds = knn(k, X_trn, y_trn, X_tst, do_regression)
% find distance matrix
Dist = dist_2(X_tst, X_trn);
% find k closest values and indices
[DistSort, DistInd] = sort(Dist, 2);
DistSort = DistSort(1:end, 1:k);
DistInd = DistInd(1:end, 1:k);
if (do_re... |
function writetrg(fid,Edge,Bit,EventOn,Onset,ID)
% WRITELED(FID,EDGE,BIT,EVENTON,ONSET,ID)
%
% Write a trigger-event line in an exp-file with file identifier FID.
%
% EDGE - EdgeFlag: 1 - Button Press, 2 - Button Release
% BIT - MicroController Bit
% EVENTON - The Event that triggers the onset of the TRG (0 - ... |
function [informaMutua] = InfoMutuab(fonte,fonte1)
[query,Fs] = audioread(fonte);
[target,Fs_] = audioread(fonte1);
target_esq = target(:,1);
query_esq=query(:,1);
query_esq = query_esq(:);
step = round(length(query_esq)/4);
alfa = calculaAlfa(fonte);
p = histc(query_... |
function [dirInfo,genericInfo]=init_CommonVar(fileName)%, callTypeTag)
fid=fopen(fileName);
C1=textscan(fid,'%s');
% variables
dirInfo.pathEMI=cell2mat(C1{1}(1)); % path for emission files
dirInfo.pathFOD=cell2mat(C1{1}(2)); % path for coordinate, policy application domain, AQI computation domain, po... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 8/1/07 ProbDist.mat: Creates a normalized histogram,
% then overlays a plot of the Probability distribution
% based from the scattering theory calculation.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Inputs:
% histdata-histogram data from the ... |
function m = skew_sym (u)
%
% function m = skew_sym (u)
% returns the matrix representing the linear application:
% v -> u ^ v
% where ^ is the vector product.
%
m = [ 0, -u(3), +u(2); ...
+u(3), 0, -u(1); ...
-u(2), +u(1), 0 ];
%!demo
%!
%! u = randn (3, 1)
%! m = skew_sym (... |
% Testing observability with different disturbances
% Calculater varibles
T=70.4663;
K=0.1556;
omega_0 = 0.7823;
lambda = 0.0749;
%With no disturbance at all
A_1=[0 1; 0 -1/T];
C_1=[1 0];
%With current as the only disturbance
A_2=[0 1 0; 0 -1/T -K/T;0 0 0];
C_2=[1 0 0];
%With waves as the only dist... |
%written by matthew
%icewong
%Batch Gradient Descent
x=linspace(-2,2,40)';
y=2*x+rand(length(x),1);
alpha0=0;
theta=zeros(2,1);
k=0;%iteration;
for k=1:100
alpha=1/k+alpha0;
error = x*theta(2)+theta(1)-y;
mse = norm(error);
delta_theta = error'*x;
delta_theta_norm = norm(delta_theta);
theta(1) =... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Data Generation Parameters
clear, close all, clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% set data parameters
mu = [ 1, 2, 1; 12, 14, 18; 6, 8, 7];
cov = [1, 2, 1];
scale = 20;
pi = [0.2 0.2 0.6];
% extra parameters for GMM, file I/O
write = fals... |
% demonstrate shortcuts for initializing arrays (pgs 339-340)
d=[0:0.2:1]
e=linspace(0,1,4)
|
function varargout = srgb2rgb(varargin)
% Converts sRGB to RGB data.
%
% img = srgb2rgb(img)
% vec = srgb2rgb(vec)
% [r,g,b] = srgb2rgb(r, g, b)
%
% Takes in image, vector (3xN) or independent channels.
%
% See http://en.wikipedia.org/wiki/SRGB
%
% ----------
% Jean-Francois Lalonde
[R, G, B, type] = parseColorI... |
function L = getL(training_feats,H_train,k,lamda)
%% Constructing a supervised graph and calculate Laplacian matrix
% Input:
% training_feats -each column is a data point
% H_train -a one-hot binary matrix (size: nClass * nSmp)
% k -number of nearest neighbors
% lamd... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% boundariesInd = getBoundaryIndicesFromEdgesSubPixel(boundaries, edgeImg, varargin)
% Finds boundaries which overlap an edge map.
%
% Input parameters:
% - boundaries: image boundaries
% - edgeImg: edge map (1=edge, 0=no edge)
%
% Output par... |
clear;
Z2=37;
Z1=17;
l=[35 30 30];
b=18;
h=11;
%l=l-b;
d=[60 60 65];
Temax=345.5*1000;
Tg=ones(1,length(d))*Temax*Z2/Z1;
sigma_p=4*Tg./(h.*l.*d)/1.5; |
function result = feedtime(dist,param1,param2,param3)
switch dist
case 'P'
feed_time = param1;
case 'N'
feed_time = randraw('norm',[param1,param2],1);
case 'R'
feed_time = randraw('uniform',[param1,param2],1);
case 'T'
feed_time = randr... |
function [centers, classes] = find_centers(trainX, trainY)
nSmp = size(trainY)(1);
classCount = 0;
for i = 1:nSmp
if i == 1
class = trainX(i,:);
count = 1;
%printf('fist class\n')
classes = trainY(i);
else
if last == trainY(i)... |
function Table_nonlin_functions(problem,nn,dd,k)
% This function displays a table to give an overview over the results
% obtained by SBSOS and SPUT
% problem: 'ChainedWood', 'ChainedSingular', 'Rosenbrock'
% 'DiscreteBoundary', 'BroydenBanded'
% nn: vector of number of variables that shall be displayed ... |
function finalerr = ur5GradControl(q_start, q_target, ur5)
% control robot by gradient descent method
% q_(k+1) = q_k - K*T_step*JBst'*xi
addpath('interface_trframe/');
addpath('InvKin_UR5/');
v_threshold = 0.008; % meters
w_threshold = 10/180 * pi; % radians
K = 1;
delta_t = ... |
%Zihang Zhou
%861090400
%April 18, 2016
%CS 171
%PS 2
function [ class ] = knearest(dist, TrainY, k)
%returns the classification given dist, kth nearest and the array of points
classes = zeros(1, max(TrainY) + 1);
temp = [dist TrainY];
temp = sortrows(temp);
for i = 1:k
classes(temp(i,2) + 1) = ... |
function aNew=swapRows(a,r1,r2)
a_row=size(a,1);
%a_column=size(a,2);
if(r1<0 || a_row<r1 || r2<0 || a_row<r2)
disp('ÐÐÊý³¬³öË÷Òý');
end
temp=a(r1,:);
a(r1,:)=a(r2,:);
a(r2,:)=temp;
aNew=a;
end |
%% Description
%This script will take the range of values that meet all Turing conditions,
%and re-simulate them with actual time values and constants, etc. The
%objective is to make sure that the true ODE-simulated parameter space
%matches the one that the quick analysis (New_RunNetwork) shows. I do
%expect there... |
% This file is to calculate the relation between the frequency distance and
% atom distance for two atoms.
%
% Created by JYI, 03/21/2020
% Modified by JYI, 01/26/2021
% - ToDo: documentation
clear all; clc
%% N = 127
% - use interpolation to estimate the relation between frequency separation
% and atom separation
... |
%% curlClinicalDataGet
% Get clinical data from cBioPortal using a Curl API
% get the location of the data on the cBioPortal website
% dataLocation = sprintf(['http://www.cbioportal.org/api/studies/%s/',...
% 'clinical-data?clinicalDataType=PATIENT&projection=',...
% 'SUMMARY&pageSize=10000000&pageNumber=0&dire... |
x0 = [1 1 1 1];
l1 = 30;
l2 = 20;
l3 = 10;
Px3 = 40;
Py3 = 20;
[x,fval] = fsolve(@funopt,x0); % Call solver
hipotenusa = (x(3)^2 + x(4)^2)^(1/2);
theta2 = acosd((-hipotenusa^2 + l1^2 + l2^2)/(2*l1*l2))
theta3 = asind((sind(theta2)/hipotenusa)*l1)+180
|
function T = align_shape(im1, im2)
% ICP algorithm
% fwu11
tic
% compute center of mass
[im1_y,im1_x] = find(im1==1);
avg_x1 = mean(im1_x);
avg_y1 = mean(im1_y);
std_x1= std(im1_x);
std_y1 = std(im1_y);
normalized_x1 = (im1_x-avg_x1)./std_x1;
normalized_y1 = (im1_y-avg_y1)... |
%Usage:Iinterp = InterpolateDiagonalLines(I,Ipixels)
%This function interpolates the diagonals in CONFIGR filling-in areas
%I is the input to CONFIGR and Ipixels is the output obtained from
%[I_out,Ipixels]=runCONFIGR(I)
function Iinterp = InterpolateDiagonalLines(I,Ipixels)
CheckCornKernel=[-1 -1 -1;-1 1 1;-1 1 1];... |
% Project II _ Original Model
% Bifurcation and stability analysis (for aw, dw) (stem cells)
%%%
% Find the eigen values to perform stability analysis for the system
%%%
% Define the matrix
lowbound = 0;
upbound = 1;
N = 50;
% Changes in the parameters for stem cells
eigenvalues = zeros(1,N);
aw_vec = lins... |
%% Setup the MATLAB path to contain the proper folders for the Numerical Methods Toolbox
% Find out where the toolbox is
filename = [mfilename, '.m'];
scriptDir = which(filename);
scriptDir = strrep(scriptDir, filename, '');
% Add all subfolders to the path
addpath( genpath(scriptDir) );
% Remove the testbench direc... |
%=========================================================================
%
% Program to plot term structure data
%
%=========================================================================
clear all
clc
% Read the data:
% US daily zero coupon yields starting 10/04/1988 and ending 12/28/2001
% The variables are... |
function [out_img] = denoising()
tic;
img = imread('./data/barbara256.png');
img = double(img);
[m,n] = size(img);
img_noisy = img + randn(m)*10;
lambda = .5;
rows = 1:m-7;
cols = 1:n-7;
patch_size = 8;
A = kron(dctmtx(patch_size),dctmtx(patch_size));
alpha = max(ei... |
function [] = display_blocks(centers, points, projections, blocks, radii, display_data)
%% Generating the volumetric domain data:
n = 70; color = double([234; 189; 157]./255);
model_bounding_box = compute_model_bounding_box(centers, radii);
xm = linspace(model_bounding_box.min_x, model_bounding_box.max_x, n);
ym = li... |
close all
clc
clear all
run('VLFEATROOT/toolbox/vl_setup')
leftRaw = imread('left.jpg');
rightRaw = imread('right.jpg');
% convert to double
leftDouble = im2double(leftRaw);
rightDouble = im2double(rightRaw);
% convert to grayscale
leftGray = rgb2gray(leftDouble);
rightGray = rgb2gray(rightDouble);
% convert to sin... |
function [ERRZ] = computerEssentialErrorSVDNFramesGeneralMODREWEIGHTED(x,F,weights,w,h,outputformat)
[K]=convertXTOKselfK(x,w,h);
KT=K';
n=size(F,2);
ERRZ=zeros(n,1);
for i=1:n
T(i,1) = computerEssentialErrorSVD(F{1,i},K,KT);
end
%T
T=T.^2;
%sigma = 1; % 1.253*mad(T,0); %std( T) ;
sigma=1.4826*mad(T,1);
N=ab... |
clear all, close all
x = -15:.011:15;
y = sin(x)./x + randn(1, length(x))*.1;
yy = y;
% plot(x, y, '*')
m = 15;
[hyp, hyp_orig px] = hyper_pseudo([x', sin(x)'], y', m, 100);
[mu1,s1,t_train,t_test] = spgp_pred(y',[x', sin(x)'], px, [x', sin(x)'],hyp_orig);
figure, plot(x, mu1), hold on, plot(x, mu1+2*s1.^.5, 'b-... |
% Function omegaA_lookup
% To be used in concert with code "combo.m" for determining omegaslope
% values given projected timeseries of temperature and CO2 concentrations.
% NEW VERSION 3/1/11: Calculates Omega values using J. Kleypas CO2SYS code,
% rather than using lookup table of Omega values. Requires as input valu... |
function r = rossdfdp(t,fd_cell,p)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% rossdfdp
%
% The derivative of the Rossler equations with respect to p
% at times t.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%y = cell2mat(eval_fdcell(t,fd_cell,0)');
% r = ... |
close all
clear all
clc
x=[];
n=0:25;
m=0:10;
for k=1:length(n)
x1=0;
for q=1:length(m)
[ y , n1 ] = imp_seq( 2*m(q),0,25 ); %del(n-2m)
[ z, n2 ] = imp_seq( (2*m(q)+1),0,25 ); %del(n-2m-1)
[ l , n3 ] = sig_diff( y,n1 , z,n2 );
x1=x1+(m(q)+1)*(l(k));
end
... |
function [MSE] = calcMSE(x1, x2)
if numel(x1) ~= numel(x2)
error('Vectors must be same size')
end
sumofdiffs = 0;
for ii = 1:numel(x1)
sumofdiffs = sumofdiffs + ((x1(ii)-x2(ii)) ^ 2);
end
MSE = sumofdiffs / numel(x1);
end
|
function [val] = loadAlterations(numAlt,des,par)
%loadAlterations Intialize GUI and capture the responses.
%[left bottom width height]
%des={'first','second','third','fourth','fifth','sixth'};
%numAlt=1;
but={};
vdist=1/11;
widEntry=.15;
% hdist=[.35/3, 2*.35/3, .1];
hdist{1} = [0 ,((1-widEntry*numAlt)/3)];
hdist{2}... |
%*******************************************************************************
%* Program: set_defualts.m
%* Description: Sets defualt values for undefined variables.
%* Author: Andrew Kercher
%-------------------------------------------------------------------------------
%*****************************************... |
function [x,y] = getcircle(c,r,n)
%GETCIRCLE calculate points on a given circle
% [X,Y] = getcircle(C,R,N) returns the N numer of X- and Y-coordinates of
% circles specified by centres C and radii R.
%
% C is an n-by-2 matrix, each row specifies the X- and Y-coordinates of a
% circle.
%
% R is an n-by-1 or 1-by-n arra... |
% Face maximum for spectral radius specially tailored for this problem
[a_j_minus_half,a_j_plus_half]=aspeedFullAlphaEqn(alphag0,rhol,rhog,V0);
% alphaFlux
% Calculation of drift velocity from alphag
Vdrp=U;
Vdrp.internal=Vpq.internal(1:end).*(1-alphag0.internal(1:end).*rhog./rhom.internal);
Vdrp=setBC... |
T = 400;
t = linspace(0, 2*pi, T+1);
r = 0.06;
xd_x = r * cos(t);
xd_y = r * sin(2*t);
xd_z = (0.8) * ones(1,numel(t));
Rd_r = 0 * ones(1, numel(t));
Rd_p = 0 * ones(1, numel(t));
Rd_y = 0 * ones(1, numel(t));
x_des = [xd_x; xd_y; xd_z; Rd_r; Rd_p; Rd_y];
T0 = [[eye(3);0 0 0],[xd_x(1) xd_y(1) xd_z(1... |
function [u0,X0]=offset(w)
% [u0,X0]=offset(w)
%
% w=x1
%
% [x1;x2] = [h2;h1-h2];
tank_par
x1=w;
u0=ao*s0*sqrt(2*g*x1);
x2=(u0/(s1*al))^2; x2=x2/(2*g);
X0=[x1; x2];
|
function [newring,radelemIndex,cavitiesIndex,energy] = atenable_6d(ring,varargin)
%ATENABLE_6D switches RF and radiation on
%
%[NEWRING,RADINDEX,CAVINDEX] = ATENABLE_6D(RING,CAVIPASS,BENDPASS,QUADPASS)
% Changes passmethods to get RF cavity acceleration and radiation
% damping.
%
% The default is to turn cavities... |
clear all;
addpath ('../')
addpath ('../include')
% Load input
ball_arena_input
% Generate common arena parameters
arena_generate
if strcmp(coordinate_system, 'LL')
% Convert dropoff points to UTM
for i=1:size(dropoff_in,2)
[dropoff_in(1, i), dropoff_in(2, i)] = LLToUTM(dropoff_in(1, i), dropoff_in(2, i))... |
function kosztgen
% wykresla koszty wytwarzania mocy przez 2 turbozespoly
% K = a1*P1^2 + b1*P + a2*P2^2 + b2*P2
a1=0.5; a2=1.0;
b1=1; b2=2;
P1=100:1:160;
P2=140:1:200;
[x,y]=meshgrid(P1,P2);
z=a1*x.^2+b1*x + a2*y.^2+b2*y;
mesh(x,y,z);
xlabel(' Generator P1');ylabel(' Generator P2');
zlabel('Koszt generacji mocy');
gri... |
% hrfDeconvolution.m
%
% $Id$
% usage: [params,hrf] = hrfCustom(params, sampleDuration, sampleDelay, defaultParams)
% by: julien besle
% date: 13/04/2010
% purpose: returns the HRF specified as values in the parameters. If a time vector is specified
% checks that times correspon... |
function [circleAvailable strength] = detectCircle(img);
%detectCircle: Uses Circular Hough transform to detect the presence of a
%circle in a image. Input image should be grayscale
%{
STEPS
1. Check to make sure recieved image is Black and White
2. Detect
3. Assign detection strength
Created on: 21st June, 2017
... |
% DemoTrackingLibraries2
% Tracks a bunch through a FODO lattice using different tracking libraries,
% and plots the emittances (which are conserved under linear, symplectic
% transport) after each turn.
% Set up the beam line
DefineBeamline
% Set up the particle bunch
bl.SetTrackingMethod('CParticleTracking');
[beta... |
%% Super Lorentzian lineshape including second moment, and also interpolated.
% Return LUT interpolated from -30kHz to +30KHz.
% Units of Gs. Shaihan Malik and Daniel West 2019.
function [G,D,ff] = SuperLorentzian_LSint(T2b,fsample)
% Define frequency range.
n=512;
ff = linspace(-30e3,30e3,n);
% Compute G for this r... |
function c = matrix2cell(mat, opt)
if strcmpi(opt, 'rows')
c=mat2cell(mat, ones(size(mat, 1), 1), size(mat, 2));
elseif strcmpi(opt, 'columns')
mat = mat';
c=mat2cell(mat, ones(size(mat, 1), 1), size(mat, 2));
else
c=mat2cell(mat);
end |
function [parameters, stderrors, LLF, ht, resids, summary] = garchfind(data, models, distributions, ar, ma, p, q, options)
%{
[parameters, stderrors, LLF, ht, resids, summary] = garch(data, model, distr, ar, ma, x, p, q, y,startingvalues, options)
---------------------------------------------------------------------... |
function [parm] = cutting_plane_solve_p(parm,model),
%%%%% We are optimizing the function C\Xi, subject to constraints on p.
dbstop if error
lpparm = struct; %linear programming parameters.
lpparm.A = [];
lpparm.b = [];
lpparm.Aeq = zeros(parm.numViews, ( (parm.numParts + 1) * parm.numViews ) + 1); % the last on... |
% Assignment 5
% Question 2
% Yuan Sun
% 2015-11-25
clear
clc
%% Contruct the system
A = [0 0 0; 1 0 -16; 0 1 -10];
B = [10; 0; 0];
C = [0 0 1];
sys = ss(A, B, C, 0);
%% Desired Characteristic polynomial of A-BK
poles = [-1.42 -1.04+2.14*1i -1.04-2.14*1i];
K = place(A, B, poles); |
function [centpoints, th_T, th_B, dist_to_overlap_top, dist_to_overlap_bottom] = calcNormalsBothHit(p,X)
% Translate polyshapes
top_cutter = translate(p.top_shape, X(1), X(3));
bottom_cutter = translate(p.bottom_shape, X(1), X(3));
branch = translate(p.branch_shape, X(5), X(7));
% Get intersect... |
prompt = {'Compare to FS?'...
'Compare to next cluster?',...
'Compare across different cosType?',...
'Compare for different weighing Factors?',...
'Compare for different clustering types(Rec or NonRec)?'};
dlg_title = 'Input only one true value';
num_lines = 1;
defaultans = {'true',...
'false',...
... |
clc,clear,close all
a=[1,1,1,4,1,1/2
1,1,2,4,1,1/2
1,1/2,1,5,3,1/2
1/4,1/4,1/5,1,1/3,1/3
1,1,1/3,3,1,1
2,2,2,3,3,1];
[x,y]=eig(a);%求特征值
eigenvalue=diag(y);%提取y矩阵的对角值
lamda=eigenvalue(1);
ci1=(lamda-6)/5;
cr1=ci1/1.24;
w1=x(:,1)/sum(x(:,1)) %准则层权值
%% 准则层1
b1=[1,1/4,1/2;4,1,3;2,1/3,1];
[x,y]=eig(b1);
eigen... |
function vout=nextwhile(v,lo,cond,dx)
%NEXTWHILE find the next vector in the vectorized while loop
% usage: vout = nextfor(v,lo,cond)
% vout = nextfor(v,lo,cond,dx)
%
% NEXTWHILE(V,LO,COND), where V is an array of the same size as LO, and
% COND is a function handle accepting inputs the same size as LO an... |
function [rbar cbar] = centerofmass(im)
[H,W] = size(im);
% r: the sum of the height
% c: the sum of the width
r = 0;
c = 0;
area = 0;
% Calculate
for x = 1 : W
for y = 1 : H
if (im(y,x) > 0)
r = r + y;
c = c + x;
... |
% frequency_iqr_calculation.m
%
% Scan the directory of the loader output and report the IQR for the
% replicates of each directory.
addpath('include');
clear;
[data, labels] = scan('../Analysis/Loader/out/', @report);
bfa_boxplot(data, labels, '580Y Frequency');
% Generate the IRQ output and return the last maximu... |
function hdl = proplistener(hContainer, hSrc, eventName, callback)
% PROPLISTENER Attach a listener callback to property value change event(s)
%
% PROPLISTENER(HContainer, HSrc, EventNames, Callback)
% Adds a listener to each object in HContainer for events
% originating from each property in HSrc having one ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Importance Sampling - Parallel Dynamic Programming (IS-PDP) Toolbox
%
% This toolbox purpose is to solve the curse of dimensionality of multi-reservoir
% impoundment operation, in an example of three-reservoir system (Li-Yuan,A-hai,
%... |
% The purpose of this function is to find a set of linear regression weights (betas)
% that can predict a response value based on a set of predictor values. To find the beta values, a
% cross-validation loop is used and
% s object does cross-validation over an input alpha array and generates beta based on the optim... |
function [selected_features, fisher_score_run] = psd2features(PSD, run_k, cue_k, classes, num_features ,features_weight)
% [selected_features, fisher_score_run] = psd2features(PSD, run_k, cue_k, classes, num_features ,features_weight)
%
% The function extracts the data to be used to train the classifiers (remember to n... |
function act = softmax(netinput)
% Given a netinput vector, compute the activation vector.
% This function is often used in a pattern classification task in which
% only one output unit should be turned on while all the other output units
% are turned off (1-of-n). Note that the sum of the activation values is 1.
% Thu... |
function procData = smoothBallData(ball,sampleRate)
rawBall = ball(:,2);
t = ball(:,1);
dsFs = 30; % Hz - downsampled frequency
trialDuration_sec = t(end); % read this variable in from your data in seconds
analogSamplingRate = sampleRate; % Hz - change if yours is different
analogExpectedLength = trialDur... |
%{
#
-> acquisition.ProbeInsertion
-> acquisition.ProbeInsertion
-> acquisition.ClusterTimeWindows
-> acquisition.ClusterTimeWindows
-> reference.ClusterParam
-> reference.ClusterParam
-> reference.ElectrodeConfig
-> reference.ElectrodeConfig
-> reference.SyncMethod
-> reference.SyncMethod
---
-> reference.Repository
... |
function exactSol = ppExact(xVar,a,psi0,alph,bet)
exactSol = -4./sqrt(1+(heaviside(xVar-a).*psi0).^2).*(alph + bet*(1+xVar-(1-a)*atan(psi0)/pi))...
.*sqrt((1-xVar)./(1+xVar)).*abs((xVar-a)./(1-xVar)).^(atan(psi0)/pi);
end |
%Iegustam attelu
clear
img=imread('humface2.jpg');
siz=size(img);
R=img(:,:,1);
V=img(:,:,2);
B=img(:,:,3);
img_R(:,:,1)=R;
img_V(:,:,2)=V;
img_B(:,:,3)=B;
Y = 0.299*R+0.587*V+0.114*B;
img_Y(:,:,1) = Y;
img_grey=img_Y(:,:,1);
figure(3)
imshow(img_grey)
kf=44;
kordx = 61 ;
kordy = 40;
%kolonn... |
%% Collect Inconsistent Instances
% In this function only collect relevant information are being collected as
% it is yet not known which ones are consistent or inconsistant.
% omPlusScore: score when individual error ascends
% omPlusLevel: level when individual error ascends
% omMinuScore: score when individ... |
function [errs, C_ind, sig_ind] = testcsigma()
test_values = [.01, .03, .1, .3, 1, 3, 10, 30];
load('ex6data3.mat')
errors = zeros(1, numel(test_values)^2);
Cs = zeros(1, numel(test_values)^2);
sigmas = zeros(1, numel(test_values)^2);
iterator = 0;
for idx = 1:numel(test_values)
for idx2 = 1:numel(test_values)... |
function [Pos_R,R_R,Pos_G,R_G] = FitGridToChannel(Old_Channel,New_Channel,Pos_R,R_R,Pos_G,R_G)
%UNTITLED6 Summary of this function goes here
% Detailed explanation goes here
[optimizer, metric] = imregconfig('monomodal');
% Old_Channel=UniformBackgroundIllumination(Old_Channel,0);
% New_Channel=UniformBackgroundIllu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.