text stringlengths 8 6.12M |
|---|
%=============================== Start ====================================
clc
clear
close all;
%================= Load Data & Define Input and Output ====================
load ShahroodDamghanWithoutPCI.mat;
Data=ShahroodDamghanWithoutPCI;
X = Data(:,2:end);
Y = Data(:,1);
InputNum = size(X,2);
OutputN... |
A = [0, 2, 0; ...
0, 0, 5; ...
1, 0, 0];
A
exact = 1;
dagA = fasOpt(A, exact);
dagA
%%
%%
mex mexino.c -I'C:\Users\dstamos\Downloads\igraph-0.7.1-msvc\igraph-0.7.1-msvc\include' -L'C:\Users\dstamos\Downloads\igraph-0.7.1-msvc\igraph-0.7.... |
% See http://nibot-lab.livejournal.com/73290.html for more info
function save2png(name,resolution)
if strcmpi(resolution,'low')
res = '90';
elseif strcmpi(resolution,'medium')
res = '230';
elseif strcmpi(resolution,'high')
res = '300';
else
error('Incorrect resolution');
end
% Save to the pdf file
pr... |
%
% The code is an 1D implementation of the HHO method for the Laplace
% equation and illustrates the construction of the HHO operators and
% the assembly of the global problem, including static condensation.
%
% This code is in the public domain, you are free to do whatever you
% like with it. The program's only purpo... |
% Coupled nonlinear PDE's
% Buckley Leverett equation
% dependent variables: pressure and water saturation
% Prepared for educational purposes by ** AAE **
% Spontaneous imbibition in a core, IMPES, works fine
% not as fast as expected, can be improved
% Written by Ali A. Eftekhari
% Last checked: June 2021
clc
%% defi... |
function color_rgb = orchid
color_rgb = {'color', [0.8549, 0.43921, 0.83921]};
end |
%[HBPM, VBPM, HCM, VCM, HSV, VSV] = ocsinit('FOFB');
% Golden orbit in the cell controller
% The waveform record contains 64 LONG data values in units of nanometers.
% The first array entry is the desired x position of the BPM whose least significant
% five bits of fast orbit feedback index are equal to 0, the se... |
% CREATES SIMULATED DATE FOR TRIAL SELECTION M3
load options
xi = options(:,1); % x = ref option
xj = options(:,2);
yi = options(:,3); % y = non-ref option
yj = options(:,4);
rx = (xi-xj)>=0; % this is for the Charness-Rabin model
zx = (xj-xi)>0;
ry = (yi-yj)>=0;
zy = (yj-yi)>0;
options(:,5) = rx; % x = ref opti... |
function dx = unicycle(t,x,u)
%
% unicycle model (continuous time)
%
% Input:
% -------
% x - state x = [x1;x2;x3]
% x1 - 'x' coordinate
% x2 - 'y' coordinate
% x3 - angle [rad] (around the 'z' axis)
% u - control input
% u(1) - linear velocity v
% u(2) - angular velocity w
%
% Output:
% ---... |
function y = q2dec(x,a,b,format)
% function y = q2dec(x,a,b,format)
% Convert numbers from Qa.b format to decimal
% where 'a' is the number of bits to the left of the binary point not including the sign bit
% and 'b' is the number of bits to the right of the binary point.
% An example of a Q0.15 (also called Q15) ... |
% Copyright (c) 2012 Howard Hughes Medical Institute.
% All rights reserved.
% Use is subject to Janelia Farm Research Campus Software Copyright 1.1 license terms.
% http://license.janelia.org/license/jfrc_copyright_1_1.html
classdef EpochPersistor < handle
properties
end
methods (Ab... |
function Multi_Run_Euclidean_Distance_betweenPial_and_Outer(Idfile);
% Idfile = strvcat('HCP_201111-20140807-T1wMPR1');
Idfile = '/media/Data/PROCESSING_RESULTS/HCP/5-freesurfer_processing/HCPrest_Ids.txt';
if exist(Idfile,'file')
Ids = char(textread(Idfile,'%s'));
else
Ids = Idfile;
end
Ids = 'HCP_857263-2015... |
%% Loading of the images
gpuDevice(1);
Tomo = imread('img/Italy_Tomo.png');
Height = im2double(imread('img/Italy_Height.png'));
Area = im2double(imread('img/Italy_Area.png'));
ratio = 1.0;
% Get the size from the image
[nY, nX] = size(Height);
if ratio < 1
nY = double(int32(nY * ratio));
nX =... |
function justSaySomething(wptr, something, color)
%justSaySomething.m
oldTextColor=Screen('TextColor', wptr);
DrawFormattedText(wptr, something, 'center', 'center', color);
Screen('Flip', wptr);
Screen('TextColor', wptr, oldTextColor);
|
function A = CalculateGlobalInconsistencyMatrix(M)
A = M;
[~, wg] = CalculateInconsistency_Saaty(M);
for i = 1:1:size(A, 1)
for j = 1:1:size(A, 2)
A(i, j) = abs(A(i, j) - wg(i)/wg(j));
if(i == j)
A(i, j) = 1;
end
end
end
end
|
% Intrari:
% -> d: diagonala principala a matricei tridiagonale simetrice;
% -> s: supradiagonala matricei tridiagonale simetrice;
% -> val_lambda: valoare pentru lambda.
% Iesiri:
% -> numvp: numarul de valori proprii mai mici decit val_lambda.
function numvp = NrValProprii(d, s, val_lambda)
P = ValoriPolinoame(d,s... |
function [mintab,maxtab]=ML_tleAdoptedToleranceExtremeExHum(v,iS,iE,P,stdAcceptance)
% ML_tleAdoptedToleranceExtremeExHum - finds minima in v
% Author : Michal Lewandowski
% Kingston University of London
% Digital Imaging Research Centre
% m.lewandowski@kingston.ac.uk
vBase = ... |
clt;
%
F = dir('jaffe_new/*.png');
nImages = length(F);
for i = 145:nImages
I = imread(['jaffe_new/' F(i).name]);
[I_eye1, I_eye2, I_nose, I_mouth] = preProcessing(I);
imshow(I_eye1);
input(F(i).name)
imshow(I_eye2);
input('next')
imshow(I_nose);
input('next')
imshow(I_mout... |
%clear
csi_trace=read_bf_file('G:\无源感知研究\数据采集\2019_07_18\会议室\clap_fang_1.dat');
%tx=2;
%rx=3;
L=length(csi_trace);
count_ntx1 = 0;
count_ntx2 = 0;
count_ntx3 = 0;
ntx3_seq = zeros(L,1);
ntx3_seq_string = '';
%csiA=zeros(L,30);
%csiB=zeros(L,30);
%csiC=zeros(L,30);
%csiA2=zeros(L,30);
%csiB2=zeros(L,30);
%csiC2=zeros(... |
function [ Theta, obj ] = solve_step_1_nesterov(cx, cy, SX, SZX, LX, LZX, Lambda, mu, tol, theta)
% This function is a modified version of the original version which can be found there:
% http://www.cs.cmu.edu/~sssykim/softwares/softwares.html#scggm
% It includes additional constraints required by the ADMM algorit... |
function [] = executeArmMovements(coordinates, a)
%EXECUTEARMMOVEMENTS Summary of this function goes here
% Detailed explanation goes here
% pin 2 is directionPin1
% pin 3 is stepPin1
% pin 4 is enablePin1
% pin 6 is directionPin2
% pin 7 is stepPin2
% pin 8 is enablePin2
old_theta1 = 0;
old_theta2 = 270;
%... |
function [TTL_start, TTL_end] = extract_TTL_times(TTLs)
% extract_TTL_time Extract times when TTLs are on and off
%
% function [TTL_start, TTL_end] = extract_TTL_times(TTLs)
%
% Takes TTL file containing n×m matrix sample by TTL bit number and
% outputs start and end samples numbers of TTL pulses.
% Sample number corr... |
H = 0.2;
baseL = 0.2;
% Must be even
Nx = 164; Ny = 128;
L = linspace(0.8, 1.2, 9)*baseL;
for i=1:(40)
newNx = Nx - 2*i;
%for j = 1:(Ny/2)
newNy = Ny; % + j*2;
newL = baseL*newNx/newNy;
foundL = false;
fprintf('(Nx, Ny) = (%d, %d), L = %f \... |
% ROI_data_to_workspace.m
%
% This script generates a cell of columnvectors, with the pixel values in each ROI:
%
% SCRIPT for imlook4d
% Jan Axelsson
ExportROIs |
% forest type classification script
% utilizes firts-last echo height difference algorithm by Liang et al.
% specify directory with LAZ and/or LAS file, plus DTM geotiff per tile
lasDir = '/Users/scholl/geo_uzh/data/KantonAargau/batch3/';
% output filepath for geotiff class maps
outPath = '/Users/scholl/geo_uzh/dat... |
function [Pi p ol] = Shepherd(a,b,j)
%
% [Pi p ol] = Shepherd(a,b,[j=10000])
%
% Calculates the robust Shepherd's Pi correlation:
% It first bootstraps the Mahalanobis distances, removes all observations
% with m >= 6 and finally calculates Spearman's rho of the remaining data.
%
% The inputs a and b are c... |
function [returnTable] = getTable(Task, Data)
% Row = 1000000; % Each row corrosponds to 1 ms
[Row, m] = size(Data);
SampleRate = 1000; % Hz
%%
varTypes = {'single', 'single', 'single', 'single',... % FSR 1 - 4
'single', 'single', 'single', 'single',... % FSR 5 - 8
'single', 'single... |
function [idx] = transform_particles(...
particles, angles, ranges, resolution, origin, map_size)
% transform particles in local coordinate to world coordinate
angles = angles + particles(3, :);
occ_x = cos(angles) .* ranges + particles(1, :);
occ_y = -sin(angles) .* ranges + particles(2, :);
coord_x = ceil(occ_x ... |
function [flag, t] = intersection2(o, d, a, b)
l = a-b;
norm_l = [-l(2) l(1)];
parallel_check = dot(norm_l, d);
if (parallel_check<=0.0001 && parallel_check>=-0.0001)
[flag, t] = deal(0);
return;
end;
y0 = abs(d(1));
if (y0<0.0001)
k = (o(1)-a(1))/(b(1)-a(1));
else
... |
function out = loadImage(varargin)
global dataset trajImages
% index global images variable or load images from disk
frame = varargin{1};
c = varargin{2};
if nargin < 3
out = trajImages{[trajImages{:, 1}]==frame, 2};
else
out = imread(fullfile([dataset.framesDirectory(1:end-1) num2str(c)], sprintf(dataset... |
%% OSTBC Decoder for 4x2 MIMO
%
% ECE 6604: 4G MIMO Research Project
% Klaus Okkelberg and Abhishek Obla Hema
function y = fun_OSTBCDec4x2(x,chan)
% Decoder for
% Lt = 4, R = 3/4 code
% C = [ s1 s2 s3 0;
% -s2* s1* 0 s3;
% s3* 0 -s1* s2;
% 0 s3* -s2* -s1];
%
% Decode using augmented... |
% barvar(X,Y,W)
%
% using patches to re-implement the bar-plot function, allowing different
% width for each bar.
%
% columns in Y are regarded as a data series (same color). rows are grouped
% into adjacent bars having different colors.
%
% to set the width for each data series input a row vector:
% W = [w1,w2,w3...... |
function [y]=recursive_fft(a)
% 傅立叶变换,a的长度必须为2的幂次
n=numel(a);
if n==1
y=a;
return;
end
wn=exp(2*pi*1i/n);
w=1;
a1=a(1:2:n-1);
a2=a(2:2:n);
y=zeros(n,1);
y1=recursive_fft(a1);
y2=recursive_fft(a2);
for k=1:n/2
y(k)=y1(k)+w*y2(k);
y(k+n... |
function data = read_regcoil_nescout( filename, nfp )
%READ_REGCOIL_NESCOUT
% For parsing the diagnostics output from stellopt/regcoil/nescout runs
%
% Note: The column order should be the same as in NESCIN files
fid = fopen(filename,'r');
if 1 % strfind(filename,'regcoil_nescout')
fgetl(fid);
line=fgetl(fid);... |
function prob = cluster_EM_gaussPrb(data, Miu, sigma)
% Inputs -----------------------------------------------------------------
% o data: N x D array representing N datapoints of D dimensions.
% o Miu: 1 x D array representing the centers of the GMM components.
% o sigma: D x D x K array represent... |
%% Question:
%% Lets play a guesing game with yes or no.You can guess any number from 1 to 100
% and ultimatey it reconizes the game and gives the number of guesses as
% well.
%% Parameters required for this Function are :
%set a upper limit as upper_limit
%set a lower limit as lower_limit
%mean is given b... |
function c = cluster2(x,k,particion,criterio)
% CLUSTER2 - Algoritmo de clustering jerarquico !! O(n^2) !!
% "Stepwise-Optimal Hierarchical Clustering"
%
% clases = cluster1(x,k)
% clases = cluster1(x,k,particion)
% clases = cluster1(x,k,'J2');
% clases = cluster1(x,k,particion,'J... |
function [ output ] = step( branch )
k=length(branch);
branch(k)=sum(power(fix(branch(1:k-3)+.5),2));
output=branch;
end
|
function [C,O] = fiber_conf(x,RP)
maxarea = 20000;
minarea = 250;
area = RP(x).Area;
if x~=0
if area > maxarea
C = 0; O = -180;
elseif area < minarea
C = 0; O = -180;
else
C = RP(x).Eccentricity;
O = RP(x).Orientation;
end
else
C=0;O=-180;
end
end |
function [ output_args ] = FindBestGridDim(NumPits,Pairs,Input)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
Factors=perms(factor(NumPits));
Possibilities=[];
for i=1:size(Factors,1)
for j=1:size(Factors,2)
Possibilities=cat(1,Possibilities,[prod(Factors(i,1:j)),prod(Factors(i,... |
%Recall that the physical level is z+2
%Value of r2 determines which leaf we start on, smaller r2 -> closer to
%boundary
%Difference between r2 and r3 determines position on leaf. Large difference
%close to bottom, small difference close to top
maxZ = 5;
r1 = 1;
r2 = .5;
r3 = .1;
PlotData = zeros(ma... |
A = tImplicitTemperatureController.tModel.aafA;
B = tImplicitTemperatureController.tModel.aafB;
C = tImplicitTemperatureController.tModel.aafC;
E = tImplicitTemperatureController.tModel.aafE;
tImplicitTemperatureController.tSimulation.aafStatesMatrix(:,iTimeStep + 1) = ...
A * tImplicitTemperatureController.tS... |
d=2;
N=10;
lam=0.5;
sp1=1; sp2=1; sp3=1;
jtype=1;
svals=linspace(0,10,20);
nruns=5;
runlen=10;
[wloads_holder, times]=simul_mwload(d,N,lam,jtype,sp1,sp2,sp3,nruns,runlen); |
% Handler of the functions
function h = dataset_generator
h.project = @project;
h.rotate = @rotate;
h.scale = @scale;
end
% Projection function
function project(patch_small, patch_large, noise_id)
% Set the number of projections to compute
number_projects = 16;
d = number_projects / 4;
... |
function []=CotourErrorPlot(TrueTipContourError,TrueOrienContourError,Proposed)
figure(6)
plot(Proposed(1,:),TrueTipContourError(:,4)*1e3,'b','Linewidth',1)
hold on
plot(Proposed(1,:),Proposed(3,:)*1e3,'r--','Linewidth',1);
xlabel('Time [sec]')
ylabel('Contour Error [micron]');
title('Comparision of True and P... |
function vectorImage = imageTo20x20Gray(fileName,cropPercentage,rotStep)
Image3DmatrixRGB = imread(fileName);
Image3DmatrixYIQ = rgb2ntsc(Image3DmatrixRGB);
Image2DmatrixBW = Image3DmatrixYIQ(:,:,1);
oldSize = size(Image2DmatrixBW);
cropDelta = floor((oldSize-min(oldSize)).*(cropPercentage/100));
finalSize = oldSize -... |
clear all;
load '/scratch/mghassem/modellingCode/dataForParForRun.mat';
clear featTemp;
matlabpool open local 8
for i = 1:size(outcome, 2)
i
savedParamsWords(i, :) = parallelLibSVM2(i, log2c, log2g, folds, plotLabel);
end
matlabpool close |
% This function assigns probabilities of failure to links based on their
% overload amount and position in the grid and chose one failure for this
% step and assigns some time to it
function [FailedIdx, FailedIndices, moreFailures, LinkProb]=...
FindMultiFailedLinks(TotalPowerLine,Capacity,mpc1,ListOfFailures,alpha... |
function X=transf1d(X,trans_f)
% %Two dimensional transformation.
%
% in:
% X - 3 dimensional array (2nd dim variables, 3rd dim replications)
% trans_f - function handle - 1D transformation
[~,nvar,reps]=size(X);
for rep_ind = 1:reps
for var_ind = 1:nvar
X(:,var_ind,rep_ind) ... |
function [ H ] = linearDecoderNghWinMat( topoDimNgh,topoDimSize,topoDimPeriodicBoundary, topoNghWin )
%LINEARDECODERNGHMAT Summary of this function goes here
% Detailed explanation goes here
% Example:
% topoDimNgh = [3 3];
% topoDimSize = [20 20];
% topoDimPeriodicBoundary = [true true];
if length(topoDimNgh) ... |
I = imread('yosemite.jpg');
I2 = gpuArray(I);
imgBlurred = generateBlurredImages(I,1,20,10,'disk');
imgBlurred2 = generateBlurredImages(I2,1,20,10,'disk');
tic
fprintf('Vertical only \n')
m = measureFocusNoGraph(imgBlurred);
toc
tic
fprintf('Horizontal and vertical \n')
m2 = measureFocus2NoGraph(imgBlurre... |
function [Results,u_star2,t,Q,K,tset]=...
Arm_1DOF_LinearQuadRegulator_Fun(StartAngle,Stable,I,l_c)
% this suggests an initial solution for the inverted pendulium problem
%Stable 1 hanging pendulium, -1 inverted
%StartAngle given in degrees
%system parameters
m=1; %mass of plumb, kg
g=9.806; %gravity, m/se... |
function myUserInput(myinput_variable)
fprintf('My variable has the value %d \n', myinput_variable)
end |
I = imread('bird.jpg');
colormap gray;
I_gray = rgb2gray(I);
I_bw = im2bw(I_gray);
I_bw2 = I_gray > 55;
se = strel('disk', 5);
A = imclose(I_bw, se);
B = imclose(I_bw2, se);
figure(1);
sgtitle('Morfoloske operacije')
subplot(2, 2, 1); imagesc(I_bw);
title('Original')
subplot(2, 2, 2); imagesc(A);
title... |
function [C,PI,PC] = dual(V,F)
% DUAL Construct the dual polygonal mesh of a given triangle mesh
%
% [C,PI,PC] = dual(V,F)
%
% Inputs:
% V #V by dim list of vertex positions
% F #F by 3 list of indices into rows of V
% Outputs:
% C #C by dim list dual vertex positions
% PI #PI stream of ... |
WLAN_G = 'z^32 + z^26 + z^22 + z^16 + z^12 + z^11 + z^10 + z^8 + z^7 + z^5 + z^4 + z^2 + z + 1';
p = 0.005
n = 16383;
k = 500 * 8; % Bytes
M = 10000; % payloads
% CRC-Prüfbits
crcG = comm.CRCGenerator(WLAN_G);
crcD = comm.CRCDetector(WLAN_G);
% + BCH-Code
bch_gen_poly = bchgenpoly(n, k);
bch_enc = comm.BCHEncoder(n... |
%% Sensor Definition
% ########################################################################
% Define the object of a sensor
% Detailed information: "Mainboard Sensor Calibration - Board1 - Sensor 1.xlsx"
% Establishment: 24.02.2021 Jiani He, PGS, RWTH Aachen
% #######################################################... |
function J = RegionGrowingSegmentate(I, thresh)
J = zeros(size(I));
J(1, :) = 1;
J(:, 1) = 1;
J(end, :) = 1;
J(:, end) = 1;
cnt = 0;
for i = 2:size(I, 1)-1
for j = 2:size(I, 2)-1
if J(i, j) == 0
cnt = cnt + 1;
qlist = [];
... |
function [D,G,I]=build_ops(Grid)
% author: Evan Carnahan
% date: 9/14/19
% HW1 Q3 (2)
% description:
% This function computes the discrete divergence and gradient matrices on a
% regular staggered grid using central difference approximations. The
% discrete gradient assu... |
function system = detrend_func(system,which_trend)
% System is a matrix of (T,N) where T is number of observations and N
% number of variables.
% which_trend cvan be BP, HP, lin, quad, none, demean
% For both HP and BP check the parameters are correct
for i = 1:size(system,2)
switch which_trend
case '... |
clear all; close all;
%% For Loops for Calling Functions
theta = (0:1:360).*(pi/180);
for i= 1:length(theta)
x0 = [5.7*pi/180,120*pi/180,175*pi/180,2.5];
options=optimset('Display','iter');
pos(i,:) = fsolve(@(pos) myfun(pos,theta(i)),x0,options);
end
for i= 1:length(theta)
x0 = [5.7*pi/180,120*pi/180,... |
function y = sliding_min (x, w_sz, stp)
if (w_sz <= 0)
y = NaN;
return
end
if (nargin < 3)
stp = 1;
end
y = sliding_fun (x, w_sz, 'min', stp);
%!demo
%! x = (-10:10)';
%! sliding_min (x, 3, 1)'
%! sliding_min (x, 3, 2)'
%! sliding_min (x, 3, 3)'
%! sliding_min (x, 10, 1)'
%! sliding_min (x, 10, 5)'
%! sli... |
function[unique_spd,trial_spd] = get_unique_speed(tracking_data)
spd = cat(1,[tracking_data.speed_L],[tracking_data.speed_R])';
unique_spd = unique(spd,'rows');
trk_trial = [tracking_data.trial_num];
for ispd = 1:size(unique_spd,1)
trial_spd{ispd} = trk_trial([tracking_data.speed_L]==unique_spd(ispd,1)&[tr... |
% Copyright 2011, Kenny Erleben
%clear all;
clear all;
close all;
% clc;
addpath('../fem');
addpath('./twist');
addpath('./twist2');
addpath('./twist3');
addpath('./bend');
addpath('./bend2');
addpath('./bend3');
addpath('./squeeze');
addpath('./stretch');
method = fem_method();
mesh_no = 3;
% scene = twist_create... |
function choice = genChoices(probs)
%generate a vector with a choice for each trial
options=size(probs,2);
trials=size(probs,1);
choice=zeros(trials, options);
randNr = rand(1,trials);
%if trials > 1
for i = 1 : trials
if randNr(i)<probs(i,1)
choice(i,1)=1;
elseif (randNr(i)>probs(i,1) && randNr(i)<su... |
function G_n=G_lin(x)
% xGS=x(1);yGS=x(2);zGS=x(3);
% uGS_b=x(1);vGS_b=x(2);wGS_b=x(3);
phi = x(4); theta = x(5); psi = x(6);
% lameda_x=x(10);lameda_y=x(11);lameda_z=x(12);
% lameda_p=x(13);lameda_q=x(14);lameda_r=x(15);
% u_w=x(16);v_w=x(17);w_w=x(18);
[num,den]=size(x);
G_n = ...
[ -cos(psi)*cos(theta... |
function cnn_qp1_mpii(varargin)
global VOCopts
startup;
opts.dataDir = fullfile('data/mpii_human') ;
opts.modelType = 'fcn32s';
opts.networkType = 'dagnn';
opts.alpha = 0.5;
[opts, varargin] = vl_argparse(opts, varargin) ;
addpath(opts.dataDir);
opts.expDir = fullfile('models', ['qp1-' opts.modelType]);
[opts, va... |
function [Y,X0]=sfilt(A,B,C,D,U)
%
% Filter u trough a filter. The initial state is determined
% such that ||Y-U|| is minimized.
%
% Usage: [y,x0]=sfilt(a,b,c,d,u);
% or [y,x0]=sfilt(a,b,u);
%
if nargin==3,
[A,B,C,D]=trf2ss(A,B);
end
x=ltitr(A,B,U);
Yf=x*C+D*U;
n=max(size(A));
O=[]; B0=zeros(n,1... |
function printBERContribution( d, Nd, wd, N, R )
%PRINTBERCONTRIBUTION Print contribution from distance spectrum components.
% d, Nd, wd are arrays of numbers, each index corresponding to one spectral
% component. N is interleaver size. R is rate.
%close all;
upperrange = 3.5;
%SNR Range in dB
SNR_range = [0:0.01:up... |
function He = lme_Hessian(X,Zcols,W,CBhat,L,phi,re,ni)
% He = lme_Hessian(X,Zcols,W,CBhat,L,phi,re,ni)
%
% Hessian matrix of the restricted log-likelihood.
%
% Input
% X: Ordered design Matrix (according to time for each subject).
% Zcols: Vector with the indices of the colums of X that will be considered
% as random ... |
% File: P4_11.m for Problem 4-11
clear;
clf
R = 400;
L = 1.583e-3;
C = 1e-6;
% Part a
fo = 1/(2*pi*sqrt(L*C));
Q = R*sqrt(C/L);
B = fo/Q;
fprintf('\nfo = %e Hz\n',fo);
fprintf('\nB = %e Hz\n',B);
fprintf('\nQ = %e \n',Q);
% Part b
f = 3500:4:4500;
j = sqrt(-1);
H = zeros(length(f),1);
for (i = 1:1:length(f))
H... |
% -------------------------------------------------------------------------
% ****************** Tumor Heterogeneity Package **************************
% File: RDE_2D_homog_example.m
% Paper: Everett et al. 'A tutorial review of mathematical techniques
% for quantifying tumor heterogeneity'. Math. Bi... |
function output = dilateNTimes(input,n)
% Repeatedly dilate an image (n times), returning the result in an image
% called 'output'. This function should call 'dilateImage'.
|
function contractTA_TB(TA, TB, fileName)
%* field of TA: subNo, quantNo, dim, tensor3
%* M((yi,zj),(yj,zi)) = sum{x}_(TA(x,yi,zi)*TB(x,yj,zj))
TANo = TA.subNo ;
n = 0 ;
for i = 1 : TANo
AquantNo = TA.quantNo(:, i) ;
j = find(AquantNo(1) == TB.quantNo(1, :)) ;
if ~isempty(j)
Adim = TA.dim(... |
function beta = leastSquares(y,tX)
%LEASTSQUARES Summary of this function goes here
% Detailed explanation goes here
beta = tX\y;
end
|
classdef pointLogger < handle
%POINTLOGGER Summary of this class goes here
% Detailed explanation goes here
properties
points=zeros(0,3);
inds=[];
curInd;
curPoint;
handles=[];
name;
end
methods
function obj=pointLogger(name)
... |
function [states_array] = RRTstar_cost_3D(x_init,y_init,z_init, final_states, occupancy_matrix)
% this function calculates the states via RRT* (euclidean distance)
%%
% initialization
map_width=50; % map width in meter
map_height=50; % map height in meter
map_length=50; % map length in meter (for 3D)
m... |
close all; clear all; clc;
load('train_data.mat');
train.X = train_data.inputs;
train.y = train_data.UTS;
[train.mu, train.sigma2] = estimateGaussian(train.X);
% Estimate mu and sigma2
train.p = multivariateGaussian(train.X, train.mu, train.sigma2);
% Returns the density of the multivariate ... |
function e=train_generator(period)
%
% function to return an excitation
% return unit impulse responses in each period when this is a voiced frame
%
% Inputs:
% period=pitch period of this frame
% Output:
% e=excitation
e=zeros(1,180);
for i=1:ceil(180/period)
e((i-1)*period+1)=1;
end |
function [data, it] = sim_data(EV,beta, RC, theta1, theta30, theta31)
data = zeros(1000, 100); % data with 100 columns (buses) and 1,000 rows (time)
it = zeros(1000,100);
for i=1:size(data,2)
epsilon(:,:,i) = -evrnd(0.5772156649,1,1000,2); % Note: the mu parameter being
% Euler's constant give a mean of ... |
%Potential reduction algorithm in the homogeneous form
%This solver allows the s variables to become negative as is proceeds,
% we are testing YYY hypothesis that the algorithm would still converge making
% the dual slacks feasible in the long run, for the exponential cone case!
function [xc,xf,y,s,info] = potentia... |
N1 = [];
N2 = [];
N3 = [];
lambda_avg = 1.11;
mu_avg = 1.67;
CV = 0.1;
Lc = 25;
L = 100;
H = 100;
Nx = 25;
Ny = 25;
Np = Nx*Ny;
Sx = linspace(0,L,Nx);
Sy = linspace(0,H,Ny);
[Xmesh,Ymesh] = meshgrid(Sx,Sy);
tol = 0.1;
A = 1/CV^2;
B_lambda = lambda_avg*CV^2;
B_mu = mu_avg*CV^2;
[d,v] = KLexpansion(1,Lc,Xmesh,Ymesh,Np... |
function xr_new_T = sim_kinematics_SE3(xr_T, uh) %all args are considered to be column vectors.
global delta_t;
xr_new_T = zeros(4,4); xr_new_T(4,4) = 1.0; %create empty homogeneous matrix.
xr = xr_T(1:3, 4); %get curr position
uh_t = uh(1:3); %current translational velocity
xr_new_T(1:3, 4) = xr ... |
clear all
close all
clc
%%Selecting the necessary folder for processing and running a batch operation
% Specify the folder where the files live.
myFolder = ('D:\NG-Challenge\NG_Challenge-master_sounds\NG_Challenge-master\Sound_Files');
% Check to make sure that folder actually exists. Warn user if it doesn't.
if ~isdi... |
function cq = affine_transform(cp,transform)
%get size of input
[~,wid]=size(cp);
%cp array must be as follows
% x x x x
% y y y y
% z z z z
%Extend so that we can multiply
cp_extended = [cp;transpose(ones(wid,1))];
%Apply transformation on ever... |
%Input: Matrix
%Description: For each column, returns the sample variance.
%Output: Vector (Row)
function sample_variance=Sample_Variance_C(x)
format long
y=Average_C(x);
sample_variance=[];
for i=[1:length(x(1,:))]
temp=0;
for j=[1:length(x(:,1))]
temp=temp+x(j,i)^2;
end
sa... |
function varargout = GUI_PropellerBlade(varargin)
% GUI_PROPELLERBLADE MATLAB code for GUI_PropellerBlade.fig
% GUI_PROPELLERBLADE, by itself, creates a new GUI_PROPELLERBLADE or raises the existing
% singleton*.
%
% H = GUI_PROPELLERBLADE returns the handle to a new GUI_PROPELLERBLADE or the handle to
%... |
function exploreData(trial_data)
%% get reward trials only for now
[~,td] = getTDidx(trial_data,'result','R');
%% Assign colors
% get block names and bump directions in order presented
epoch_names = {'AD','BL','WO'};
bumpDir_names = {0,90,180,270};
colors = linspecer(length(epoch_names)+length(bumpDir_na... |
%Checks to see whether or not a certain cell intersects with itself so that
%the simulation can stop.
function b = is_self_intersecting(C,V)
b = false;
for i = 1:size(C,1)
x = V(C{i},1);
y = V(C{i},2);
[~,~,segments] = selfintersect(x,y);
if ~(isequal(segments,double.empty(0,2))||isequal(segments,[]))
... |
function [ D, imDims, L0, S0, GTidx ] = loadFile( fileName, varargin )
%% Loads an experiment file from a file
% with ground truth data if present
%
% Author: Vahan Hovhannisyan, 2017.
data = load(fileName);
if isfield(data, 'X')
[ D, imDims, L0, S0, GTidx ] = loadTensor(data, varargin{:});
elseif isfield(da... |
classdef combination
%COMBINATION Summary of this class goes here
% Detailed explanation goes here
properties
an % instance of sample class that is an anode
cath % instance of sample class that is a cathode
ratio % gives a ratio of anode capacity to cathode capacity
end
... |
clear all
close all
clc
I = imread('Fig0241(c)(einstein high contrast).tif');
D = zeros(1,256);
[M,N]= size(I);
for r =1:M
for c=1:1:N
D(I(r,c))=D(I(r,c))+1;
end
end
figure
x = linspace(1,256,256);
stem(x,D);
figure
imhist(I,256)
|
function C = simplex_code(K)
if K == 1
error('K must be >= 2');
end
C = [1 -1];
for i = 2:K-1
u = -ones(i,1) / i;
v = zeros(i-1, 1);
mult_factor = sqrt(1 - (1/(i^2)));
C = [1 u';
v C*mult_factor];
end |
function data_med = plotDataSlice(data,cell_model_names,cell_ids,layers,slices,plane,varargin)
%PLOTDATASLICE ...
%
% Inputs
% ------
% Optional Inputs
% ---------------
% Outputs
% -------
% Examples
% ---------------
% AUTHOR : Aman Aberra
in.cutoff = [];
in.norm_to_max = 0;
in = sl.in... |
function retval = key_frames(IFSObj,varargin)
if ~key_frames_exist(IFSObj)
error('Key frames do not exist.');
end;
if isempty(varargin) || isempty(varargin{1})
a = 1:length(IFSObj.A);
else
a = varargin{1};
end;
retval = {IFSObj.A{a}};
for i=1:length(retval),
retval{i} = double(retval{i}... |
% CS5810 -- Programming for data analysis
%
% Assignment 2 | Prof. Alberto Paccanaro
%
% INSERT YOUR CODE HERE!
%marking id: 65138
function out = displaycarmodels()
%loading the dataset 'cardata.mat'
loadFile = load('cardata.mat')
%menu for the choices of number of cylinders
choice = menu('Choose number of cylinde... |
% Main - Stackelberg security game solved by ORIGAMI algorithm
% +HDR-------------------------------------------------------------------------
% FILE NAME : Main.m
% TYPE : MATLAB File
% COURSE : Binghamton University
% EECE580A - Cyber Physical Systems Security
% CODER ... |
function [ P,TAU,T ] = Fan(P,PI,gam,ETA,T,TAU)
%IN: P.t2, PI.f, gam, ETA.f
%OUT:T.t13, P.t13, T.t25, P.t25, TAU.f
%Flux primari
P.t25=P.t2*PI.f;
TAUi.f=pi2tau(PI.f,gam.cold);
Ti.t25=T.t2*TAUi.f;
T.t25=T.t2+(Ti.t25-T.t2)/ETA.f;
TAU.f=T.t25/T.t2;
%Flux secundari
P.t13=P.t25;
T.t13=T.t25;
end |
function [] = HFSS_ExportData(fileID,filename,setup_label)
% HFSS_ExportData generates a script to export the s-parameters of
% a certain setup with sweep. It will set the resistance to 50 and the
% number of digits to 15.
%
% Author : Zainulabideen Khalifa Last Revision : 2/22/2020
%
% Pars and ... |
% Function convert variable measured on a stagered grid to regulalar 3
% dimensional grid.
%
% Interpolation is done using the simplest approach - in 1D case the
% vector X=(X_1,...,X_n) is transformed to Y=(Y_1,...,Y_(n-1)):
%
%
%
% Y_i = (X_(i) + X_(i+1))/2 for i=1,...,n-1
%
% function Y=grid2stag... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.