text stringlengths 8 6.12M |
|---|
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 15;
baseFileName = 'lena.jpg'; % Assign the one on the ... |
function CreateSimulationFigure(PopParams)
W = PopParams.W;
%%
wEE = reshape(W(PopParams.EcellidX,PopParams.EcellidX),[numel(W(PopParams.EcellidX,PopParams.EcellidX)),1]);
wII = reshape(W(PopParams.IcellidX,PopParams.IcellidX),[numel(W(PopParams.IcellidX,PopParams.IcellidX)),1]);
wIE = reshape(W(PopParams.IcellidX,Po... |
close all;
clearvars;
filePath = fullfile(fileparts(which('PathPlanningExample')),'data','exampleMaps.mat');
load(filePath);
map = robotics.BinaryOccupancyGrid(simpleMap, 2);
robotRadius = 0.2;
mapInflated = copy(map);
inflate(mapInflated,robotRadius);
show(mapInflated);
hold on;
prm = robotics.PRM;
prm.Map = mapInfla... |
%zemi ja matricata samo deka gi ima RED vrednostite od rgb
%site pogolemi od prag gi zapisi kako 1 (beli)
red = img(:,:,1);
crno_belo = red > 200;
%imshow(crno_belo); |
% CT tong hop x[n] tu nhieu TH sin phuc va phat tin hieu vua moi tong hop duoc
n = -100:100; % vecto thoi gian roi rac
n0 = 20;
clf;
for i = 1:2
N = 10.^(i+1); % so luong TH sin
sum = 0;
for k = 0:N-1
A = 1; % bien do TH sin
sum = sum + A*exp(j*((-pi + 2*pi*k/N)*... |
clc, clear all, close all
N = 100;
x = linspace(-1,1,N);
xk0 = 100;
beta = 1;
vmin = 0.01;
vmax = 0.98;
b = 1-vmin^(1/beta);
rmax = b/(1-vmax^(1/beta));
xmuestart = 1;
pstart = 0;
xmuein = 1;
r = 1./(1-x.^(-beta));
v = (1-b./r).^beta;
sigma = beta*b./r.*(1-b./r).^(-1)
tau = xk0./(r.*v.^2.*(1+sigma))
p = (1-exp(... |
% Model the curve of dataset ID (Intrinsic Dimensionality) vs replication percentage:
% the model can predict the replication percentage given a few ID-repPercent pairs (preferabely only one).
% first, we start with an exponential decay function:
% y=a*exp(b*x) with x the dataset ID(or size) and y the replication perc... |
%% is it divisable by for
% file: q3a.m
%
% by Nathaniel Chang
% Created: 18/03/2021
% last edited: 18/03/2021
% programing (MATLAB and C) Semester 1
% asking the user for a number
TestingNumber = input("please input a number: ");
% checking if number is divisable by 4
if mod(TestingNumber, 4) == 0
disp('Divisabl... |
function [cfinal,ufinal,tab_err]=pb_inv_secante(u_ex,nmax,precision,c0,c1,f,u0,u1tilde)
% Méthode de la sécante pour trouver c
global Nt Nx theta
tab_err = zeros(1, nmax);
tab_err(1) = abs(c0 - c1);
c_vecteur = zeros(1, nmax);
c_vecteur(1) = c0;
c_vecteur(2) = c1;
n = 2;
diverge = 0;
erreur = tab_err(1);
while (n < n... |
function dispslope = FitDisplacementSlope(dirpath,dirpath_fig)
[filename dirpath] = uigetfile(fullfile(dirpath,'*.txt'),'Select a file');
[tmp fname] = fileparts(filename);
data = dlmread(fullfile(dirpath,filename));
x = data(:,5); % strain gauge position
% y = data(:,4);
qpd = data(:,3); % qpd x deflection
qpdz = ... |
clc;
clear all;
close all;
%% Add Required Paths %%
% addpath('Phase 1');
addpath('Random Test');
addpath('Lowpass400Hz');
addpath('FIR Filters Phase 2');
addpath('Sounds');
%% Call Audio File and Downsample/Mono %%
filename = ('twinkle.mp3');
[reMonoY,samplesize] = Convertto16khz(filename);
FS = 16000;
%% The Fol... |
function H = hamiltonian(in1,in2,alpha)
%HAMILTONIAN
% H = HAMILTONIAN(IN1,IN2,ALPHA)
% This function was generated by the Symbolic Math Toolbox version 8.0.
% 13-Jan-2019 21:13:36
lambda1 = in1(3,:);
lambda2 = in1(4,:);
u1 = in1(5,:);
x2 = in1(2,:);
H = lambda2.*u1+lambda1.*x2+u1.^2.*5.0e-1;
|
function [ u ] = rof_gradproj( f, nit, tau, lambda )
%ROF_GRADPROJ
% Algorithme du gradient projete
px = zeros(size(f));
py = zeros(size(f));
[M N] = size(f);
for k = 1:nit
div_p = divergence(px, py);
v = f/lambda + div_p;
[gradvx gradvy] = gradient(v);
abs = sqrt((px+tau*gradvx).^2 + (py + tau*g... |
classdef RectangularLattice < Lattice
methods
function draw( obj, ha )
hh=gca;
axes(ha);
axis equal
cla(ha);
sz= obj.size .* obj.baseSize;
for k1= 1:sz(1),
for k2= 1:sz(2),
rectangle( 'Position', [ k1,k... |
%% Load Notes and Music
clc;
clear all;
close all;
% Use the 'load_data' function here
[smagNote, smagMusic, sphaseMusic] = load_data();
%% Solution for Problem 2_1 here
% Store W in a file called "problem2_1.mat"
% W will be a 15xT matrix, where T is the number of frames in the music.
W=pinv(smagNote)*smagMusic;
W=max... |
function bestGenom = geneticOptimization(fixedLayer, layers, segments, genValues, Params, costFunction, dist, gradient, factor)
% Params: parameter struct. Entries
% sizePopulation = size of the population
% maxIter = maxNumber of iterations.
% numCouples = number of couples
% numChildren = number of children for each ... |
function test_costFunctionReg ()
tolerance = 1e-3;
% Test 1, w/ lambda = 3
% From TA Colin Beckingham, at https://class.coursera.org/ml-005/forum/thread?thread_id=943#post-4593
theta = [2; 1; -9];
X = magic(3);
y = [1; -0.2; 3];
lambda = 3;
J_exp = 50.971;
grad_exp = [-6.1081 -7.1... |
function [ P ] = powerEst( signal )
%powerEst Estimate the power of the received signal (baseband) in different
%frequency bands
% @input:
% - signal: the signal to be analysed
% @output:
% - P: 1X25 vectors with the power corresponding to the center
% frequencies 0, ..., 12, -12, -11, .... |
clear
close all
clc
%%%%%%%%%%%%% reading data%%%%%%%%%%%%%%%%%%%%%%%%
ds = tabularTextDatastore('house_prices_data_training_data.csv','TreatAsMissing','NA',.....
'MissingValue',0,'ReadSize',17999);
T=read(ds);
%%%%%%%%%%%%%%%% normalizing data %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x=T{:,4:21};
[m,n]=size(x... |
function [Q,R] = qrhh( A )
% QRHH computes the reduced QR-decomposition using Householder reflections,
% ie A_(MxN) = Q_(MxN) * R_(NxN), where the columns of Q are orthonormal,
% and R is upper triuangular square
% reference: Golub, Van Loan; 3rd ed; 5.2.1
% $Id$
M = size( A, 1 ); % rows
N = size( A, 2 ); % cols
... |
clc,clear all;
a=0.02;
b=0.2;
c=-65;
d=8; % RS
v0=c;
u0=b*v0;
h=0.01;
t0=0;
tk=1000;
Imax=6;
[ tout,uout,vout,I ] = EulerRichardson_Izhikevich( a,b,c,d,h,t0,tk,u0,v0,Imax );
figure;
plotyy(tout,vout,tout,uout);
title('RS');
legend('V','U')
hold on;
plot(tout,I,'y');
hold off;
[pks,loc,w,p] = findpeaks(v... |
function color_vect=calc_color_vect(curr_img,L)
%输出一张图片的颜色向量,其中L为每种颜色的编码长度
ORI_CODE_LEN=8;%原来每种颜色的编码长度,减去L即为移位的位数
color_vect=zeros(1,pow2(3*L));%当前图片的向量
curr_img=double(curr_img);
for i =1:size(curr_img,1)
for j =1:size(curr_img,2)
[i,j];
red_code=floor(curr_img(i,j,1)/pow2(ORI_CODE_LEN-L));
green_code=floor(cur... |
function [Praw] = pitot_avg_raw_data(basedir, rfid, varargin )
%% [Praw] = pitot_avg_raw_data(basedir, rfid, [is_chipod, [dt] ])
%
% This function averages the Pitot tube relevant raw data
%
% INPUT
% basedir : base directory
% rfid : raw file name
% is_chipod: 1 for chipod; 0 for gusTs ... |
function pulses=GrabPulsesFromFolder(folder)
%get _out folder info
dir_list = dir(folder);
file_num = numel(dir_list);
pulses = {};
for y = 1:file_num
file = dir_list(y).name; %pull out the file name
fprintf([file '\n']);
[~,~,ext] = fileparts(file);
path_file = [folder file];
if strcmp(ext,... |
function [out,varargout] = proxMin(GradErrHandle,ProxFunc,xk,b,options)
% Out = proxMin(GradErrHanle,ProxHandle,AxyTxy0,measurement,options)
%
% GradErrHandle: handle for function that computes error and gradient at
% each step
%
% ProxFunc: handle for function that does projection step
%
% AxyTxy0: initialization N... |
clear;clc;close all;
sift_path='.\test images\';
sift_path_list = dir(strcat(sift_path,'*.dsift'));
sift_num = length(sift_path_list)
codebook_=load('vladcodebook.mat');
codebook=codebook_.codebook;
index=load('vladindex.mat');
index=index.km_index;
%% 计算vlad编码,保存为code
split_feat=1;
for i = 1... |
function [RR,brady,tachy,PVC,PAC]=ECG_diagnosis(sig,fs)
% ECG_diagnosis distinguish R wave and find out if there are any diseases
%regarding brady,tachy,PVC and PAC
% sig the original ECG wave
% fs sampling rate
% RR the RR interval
% brady the index that looks like bradycardia
% tachy ... |
function xu_generateTiles_II(imgPath,imgName,bwHimg,tl,br,slidePtr,levelforRead,magHigh,magCoarse,magToUseAbove)
%% process most salient image patch
bpp=0.7; %% the percentage of blocks used
if nargin==9
tsize=[320,320];
tsize_low=tsize./(magHigh/magCoarse);
rind_low=tl(1):tsize_low(1)/2:br(1)-tsize_l... |
clc
clear
% im = (imread('/Users/INNOCENTBOY/Documents/MATLAB/pic/4.2.04.tiff'));
% % im = imresize(im,[1024,1024]);
% im1 = double((im));
tic
imo = double(imread('128_p.jpg'));
im1(:,:,:) = imo(:,:,:);
im = im1(:,:,3);
im2(:,:,:) = im1(:,:,:);
% data = 'ABCDEFABCDEFABCD';
% data = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI... |
function result = getEdge(image)
n = 5;
[height, width] = size(image);
tmp = double(zeros(height, width));
for i = 1 : n
core(i) = strel('diamond', i);
end
for i = 2 : n
tmp0 = double(getEdgeCore(core(i), image));
tmp0 = double(imerode(tmp0, core(i - 1)));
tmp = tmp + tmp0;
end
result = u... |
function ptime(T)
ehour = floor(T/3600);
emin = floor((T-ehour*3600)/60);
esec = floor( T - ehour*3600 - emin*60);
fprintf('ELAPSED : %d hours %d min. %d sec.\n', ehour,emin,esec );
|
function [BW,BW1] = segmentImage(X)
% Threshold image - adaptive threshold
BW = imbinarize(X, 'adaptive', 'Sensitivity', 0.680000, 'ForegroundPolarity', 'bright');
% Threshold image - adaptive threshold
BW1 = imbinarize(X, 'adaptive', 'Sensitivity', 0.680000, 'ForegroundPolarity', 'dark');
%BW1 = imcomplement(BW1);
... |
function [EEG, Cfg] = CTAP_load_chanlocs(EEG, Cfg)
%CTAP_load_chanlocs - Load channel locations
%
% Description:
% Load channel locations based on specification in Cfg.eeg.chanlocs.
% Cfg.ctap.load_chanlocs specifies how to read custom Cfg.eeg.chanlocs
% Can also define new chanlocs field values, and delete any c... |
function informationGain = calculateInformationGain(datasetEntropy, ratio)
informationGain = datasetEntropy - ratio * entropy;
end |
function norm_plot(varargin)
if nargin==0
hndl=gca;
else
hndl=varargin{1};
end
plotdata=getplot(hndl);
Ny=length(plotdata.y);
for ind1=1:Ny
ymaxes(ind1)=max(plotdata.y{ind1});
end
ymaxx=max(ymaxes);
for ind1=1:Ny
plotdata.y{ind1}=plotdata.y{ind1}/ymaxx;
end
plotdata.ylim=[0 1];
figure;... |
%RunAllAfrondenOpdrachtFiles
%
% ------------------------------------------------------------------------
% Copyright (C) 2017 M. Schrauwen (markschrauwen@gmail.com)
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as publish... |
function dms(varargin)
% DMS Automatically find and analyze VSM data from the base workspace.
% dms('searchstring') Analyze data containing searchstring in the name
% dms(CellArrayOfStrings) Analyze
%
% Based on an input search string or cell array of strings, the function will
% find variables which contain the st... |
% Computer Vision, Camera Calibration
%read in the images
ImageMatrix = imread('hm2.jpg');
figure(1);
imagesc(ImageMatrix);
xinput=ginput(8);
ImageMatrix = imread('hw22.jpg');
figure(1);
imagesc(ImageMatrix);
x1input=ginput(8);
|
for i=1:10
clearvars -except data
%% Classify Text Data Using BERT
%% Load data as table
% This example shows how to classify text data using a pretrained BERT
% model as a feature extractor.
%
% The simplest use of a pretrained BERT model is to use it as a feature
% extractor. In particular, you can use the BERT mode... |
%% Question 1: mu = 3 P-controller
close all; clear all;
% Paramters
tspan = [0 15];
N = 1000;
y0 = [1;1];
method = 'DOPRI54';
solver = ERKSolverErrorEstimationParameters(method);
h = (tspan(2)-tspan(1))/N;
abstol=10e-7;
reltol = 10e-7;
% Solvers
[tnList1,ynList1,hList1,rList1,nfun1] = ExplicitEulersAdaptiveStep(...
... |
function img = my_connected(img)
% Find connected level using DFS for 4-direction
% img : binary image
% Set Limit of recursion 3000
set(0, 'RecursionLimit', 3000);
% Set 1 to -1
img = ~img -1;
label = 1;
% recursive find 1 value
[height, width] = size(img);
for i = 1:height
for j = 1:width
... |
function Fi = f(param, C, t, DX, DY, kompartment, A_hod, U_hod)
% V1 = 1;
[m,n] = size(DX);
switch m
case 1
S = dsolve(strcat('DX1=', char(DX(1,1))), 'X1(0)=0', 't');
case 2
S = dsolve(strcat('DX1=', char(DX(1,1))),strcat('DX2=', char(DX(2,1))), 'X1(0)=0','X2(0)=0', 't');
case 3
S =... |
function [template,templateArgs, fitFun] = args2template(varargin)
% Converts a struct of classification parameters into a template
% -------------------------------------------------------------------------
% template = args2template(varargin)
% ---------------------------------------------------------------------... |
%% incoherent addition of images in focal plane
tic
s=[64 64];
tm=exp(-((xx(s)-14).^2+yy(s).^2)/30);
tl=exp(-((xx(s)-2).^2+(yy(s)+4).^2)/100); % soft
tl=sqrt((xx(s)-12).^2+(yy(s)+20).^2)<10 | rr(s)<4;
angles=7;
%%
acc=newim([s (2*angles+1)^2+1],'dfloat');
ma=1/2;
i=0;
for kx=-ma:ma/angles:ma
for ky=-ma:ma/angles:m... |
function [n, t, w] = PL_GetWF(s);
% PL_GetWF - get waveforms
%
% [n, t, w] = PL_GetWF(s)
%
% Input:
% s - server reference (see PL_Init)
%
% Output:
% n - 1 by 1 matrix, number of waveforms retrieved
%
% t - n by 3 matrix, timestamp info:
% t(:, 1) - channel numbers
% t(:, 2) - unit numbe... |
function names = RBES_subobjective_names()
global params
if isfield(params,'subobjective_names')
names = params.subobjective_names;
else
names = cell(RBES_count_subobj(),1);
n = 1;
for p =1:params.npanels
for o = 1:params.num_objectives_per_panel(p)
for so = 1:length(params.subobject... |
function [fox] = FoxPosition(fox, rabbit, scene, config)
% Set up the scene based on function parameters
traverseTowards = rabbit.Position;
if(!LineOfSight(fox.Position, rabbit.Position, scene))
% Rabbit is not visible, run to next corner
if(fox.Position(2) <... |
function varargout = uicirculation(x,y,u,v,varargin)
% function varargout = uicirculation(x,y,u,v,varargin)
type = 'circle';
def = [];
if ((nargin == 6) & all(size(varargin{1}) == size(varargin{2})) & isnumeric(varargin{1})),
type = 'preset';
xpt = shiftdim(varargin{1});
ypt = shiftdim(varargin{2});
else,
for i = ... |
%% Initialize automatic parameter variation algorithm.
function [vr,par] = var_init(par)
% add paramter combination ID into the parameters structure
par._vpid_ = 0;
% add total paramter combinations count into the parameters structure
par._vpcnt_ = 0;
% get input paramter names
vr.names = fiel... |
function h = SideAxes(a,location,s,varargin)
%SideAxes - Add side axes to existing axes.
%
% USAGE
%
% h = SideAxes(a,location,s,<options>)
%
% Using cell arrays will overlay variable pairs.
%
% a optional target axes (default = gca)
% s size, as proportion of target axes
% lo... |
function varargout = default(varargin)
%DEFAULT Return defaults struct or a single field of struct
%
% params = defaults.files();
% * This format returns full struct of parameters.
% e.g.
% >> params.var1 == 'something'; params.var2 == 'somethingelse'; ...
%
% [var1,var2,...] = defaults.files('var1Name',... |
%Program 6.1 Eulerís Method for Solving Initial Value Problems
%Use with ydot.m to evaluate rhs of differential equation
% Input: interval inter, initial value y0, number of steps n
% Output: time steps t, solution y
% Example usage: euler([0 1],1,10);
function [t,y]=euler(inter,y0,n)
t(1)=inter(1); y(1)=y0;
h=(inter(2... |
function u = hexacontrol (t,Y)
u = zeros(4,1);
global e;
global z;
z = 100; %Reference height
kp = 30; ki = 0.007; kd = 2000;%error coeffs
% kp = 0.05; ki = 0.1; kd = 1;%error coeffs
e(1) = z-Y(11);
e(3) = e(3) + e(1);
u(1) = kp*e(1) + ki*(e(3)) + kd*(e(1) - e(2));
e(2) = e(1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
%EPSP Tau Measurements
clear
m=1;
n=1;
RESULTS(100)=struct('cell','','label','','cond','','tau',0,'normr',0);
%%
loadphys
dt = time(2)-time(1);
%%
eps = 2;
c1 = {'-60mV','-70mV','-80mV'}; %Episodes
c2 = {'ctrl','SR,CGP'};
c3 = {'-70mV','-80mV'};
c4 = {'ctrl','-70,SR/CGP','-60,SR/CGP','-60,AP5'};
condition = {'-60mV'... |
function [an bn] = text_l2n(aa,bb)
% L to N conversion
% th = acos(-0.25);
% a = sqrt(2/(1+ml)) sqrt((ml-cos(th))/(1-cos(th)))
% b = sqrt((1+cos(th))/(1-cos(th))) sqrt((1-ml)/(1+ml))
% n = a(l+m)/abs(l+m) + b(l x m)/abs(l x m)
% m=(0,0,1);
r=pi/180;
ii=find(bb>0);
lx=sin(r*bb(ii)).*cos(r*aa(ii));
... |
% MSWCMPSCR 1 次元複数信号のウェーブレット圧縮スコア
%
% [THR,L2SCR,N0SCR,IDXSORT] = MSWCMPSCR(DEC) は、4 つの行列を計算します。
% スレッシュホールド THR、圧縮スコア L2SCR と N0SCR とインデックス IDXSORT。
% 分解 DEC は、detail と (オプションとして) approximation 係数の連結で
% 得られるウェーブレット係数 CFS の行列に対応します。
% CFS = [cd{DEC.LEV} , ... , cd{1}] または
% CFS = [ca , cd{DEC.LEV} ... |
function analyzeData
%ANALYZEDATA Summary of this function goes here
% Detailed explanation goes here
timestamp = datestr(now,'yyyy-mm-dd HH-MM');
[githubDir,~,~] = fileparts(pwd);
d12packDir = fullfile(githubDir,'d12pack');
addpath(d12packDir);
projectDir = '\\root\projects\Acuity_MtSinai';
% projectDir = '/Users/... |
%Student Name: Sarah Bland
%Program Name: SWAS_Base&Quick.m
%Description: Uses sep() function to separate discharge (Q) data for four SWAS
%sites into baseflow and quickflow values.
%Resources: http://onlinelibrary.wiley.com/doi/10.1029/2011WR010977/full - CATCHMENT SIZES
%PAINE RUN
%Catchment Area = 1... |
function y = spc_reconv(beta0, x);
global spc;
range = spc.fit.range;
%background = mean(spc.lifetime(range(1):range(1)+10));
pulse_int = round(spc.datainfo.pulseInt*1000/spc.datainfo.psPerUnit);
%pulse_int = 120;
prf1 = spc.fit.prf(range(1):range(2));
prf = interp1(x, prf1, x+beta0(5), 'linear');
prf(isnan(prf)) = 0... |
%Circle detection using Hough Transform
clear all;
close all;
clc
% figure 1
img = imread('HoughCircles.jpg');
r_min=33;
r_max=54;
%t1 and t2 are the thresholds for edges detections and
%max of hough accumulator
t1=0.22;
t2=0.66;
%g1 is the size of the gaussian kernal.
g1=3;
sigma=2;
hough_transform_Can... |
% ODE Formula
dvdt = @(t, v) v/t + 1/4 * log(t);
% Loop for each case
hold on
for i = 1:6
n = 2^i;
% RK4 Method
[x, y] = RK4(dvdt, 13.71, 10, 30, n);
fprintf('RK4: n = %2d, x = %6.4f, y = %6.4f\n', n, x(end), y(end));
plot(n, y(end), 'ro', 'DisplayName', 'RK4')
% Euler Method
[x, y] = eul... |
function [pw_weight] = pair_wise_cpu(phi1, filter_X, filter_weight, sm_weight)
[dT N] = size(filter_weight);
if N > 1000 | dT > 100000
pw_weight = zeros(N, N, dT);
for dt = 2:(dT - 1)
bunbo = filter_weight(dt - 1,:) * normpdf([filter_X(dt,:)], [phi1 * filter_X(dt - 1, :)]', sqrt(1 - phi1));
pw_... |
%% select_bib
% gets list of species that belongs to a taxon and has a specified string in its bibliography
%%
function [species, nm, sel] = select_bib(varargin)
% created 2019/03/13 by Bas Kooijman
%% Syntax
% [species, nm, sel] = <../select_bibt.m *select_bib*> (varargin)
%% Description
% gets all species in th... |
%suponemos que la matrix que me pasan por parametro es de 8x8
function ret = MNAdct2(matrix)
M = 8;
N = 8;
ret = zeros(M,N);
for p = 0:1:M-1
for q = 0:1:N-1
ret(p+1,q+1) = dctBlock(matrix,M,N,p,q);
end
end
ret;
%= round(ret);
end
|
% ViewSounds
% loads and displays TDT sounds
[FileName,PathName,FilterIndex] = uigetfile('*.*','Select TDT Sound');
if(FilterIndex==0), return, end
disp([PathName FileName]);
if(findstr('left', FileName) > 0)
L_name = FileName;
R_name = strrep(FileName,'left', 'right');
else
L_name = strrep(... |
% made some changes in test-branch
% made some additional changes in test-branch
clear all
close all
clc
format long;
MPIparams = struct;
SPIOparams = struct;
robot_movement_type = 'triangular_rastered';
% gradients (T/m) (current scanner)
Gxx = 4.8;
Gyy = 2.4;
Gzz = 2.4;
diameter = 25; % (nm)
B... |
function cpic = MakeClassifierPic(all_ftypes, chosen_f, alphas, ps, W, H)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
cpic = zeros(H,W);
fpic = zeros(H,W,size(chosen_f,1));
for i=1:size(chosen_f,1)
fpic(:,:,i) = MakeFeaturePic(all_ftypes(chosen_f(i),:),W,H);
end
for i=1:size(al... |
% sample = vibro(5).value;
% grid = make_grid(sample, 1000, 100);
%grid = a;
imagesc(grid)
colormap(jet)
%colormap(flipud(gray))
set(gca,'YDir','normal','GridLineStyle','-','XGrid','on','YGrid','on')
hold all
pause
for i = (1:100)
new_grid = do_iteration(grid);
% disp(nnz(grid ~= new_grid)) % count differi... |
function[X,F,V] = fiber2beam(X,F,V,R,minspace,lam,plotflag)
%FIBER2BEAM - converts fiber array to a reduced fiber array based on beam
%interpolations.
if nargin<7
plotflag = 0;
end
if isempty(F)
return
end
%For each fiber, pin down the vertices and end points and find a curv that
%passes near the rest of the p... |
function [ data ] = tySampling( s, C, R)
% generates data set of length n and dimension nd from trial data
% A: state transition matrix: nd x nd*np
% C: measurement matrix
% Q: covariance matrix for states
% R: observation noise
% output: [signal measurement]
[nd,nt,n]=size(s);
try
[~,~,Rt]=size(R);
if nd>1, ... |
function inputs = AMIGO_private_defaults_doc
% AMIGO_private_defaults_doc returns the inputs such that the field values
% are the specific comments on that field.
inputs.OEDsol.OEDcost_type='OED criteria';
%inputs.OEDsol.cost_file='missing description';
%inputs.OEDsol.n_obs_od='missing description';
inputs.PEsol.Cram... |
function varargout = GUIPart2(varargin)
% GUIPART2 MATLAB code for GUIPart2.fig
% GUIPART2, by itself, creates a new GUIPART2 or raises the existing
% singleton*.
%
% H = GUIPART2 returns the handle to a new GUIPART2 or the handle to
% the existing singleton*.
%
% GUIPART2('CALLBACK',hObject,ev... |
function Results = uq_PCE_sobol_indices(max_order, CurrentModel)
% RESULTS = UQ_PCE_SOBOL_INDICES(MAX_ORDER,PCMODEL): analytically calculate Sobol'
% indices up to maximum order MAX_ORDER for the PCE model PCMODEL.
%
% See also: UQ_SOBOL_INDICES,UQ_SENSITIVITY
%
%% RETRIEVE INFORMATION FROM THE PCE MODEL
% make s... |
clear;
clc;
%% Fetch market quotation.
conn = database('db','sa','1234','com.microsoft.sqlserver.jdbc.SQLServerDriver','jdbc:sqlserver://10.41.7.41:1433;databaseName=db');
% conn = database('test','sa','12345','com.microsoft.sqlserver.jdbc.SQLServerDriver','jdbc:sqlserver://10.41.7.129:1433;databaseName=test');
% sql... |
function [ s,bbrx,bbry,bbrz ] = bbr_gentab(xr,npoints,freqx,freqy,freqz,qx,qy,qz,rx,ry,rz)
%xr is extent of wake function in m
%npoints is number of points in table
%freq in GHz
%Rshunt in MOhm
%Based on equations 2.84 and 2.88 in Chao's 'Physics of Collective Instabilities'
clight = 2.99792458e8;
if mod(npoints,2) =... |
BASE_DIR='d:/Study/MTech/Y2016/Project/sax_12/sax_12/';
%BASE_DIR = 'D:\Study\MTech\Y2016\Project\6\study\sax_10';
files = dir( fullfile(BASE_DIR,'*.dcm') );
files = {files.name}';
%Get height and width of images
fne = fullfile(BASE_DIR,files{1});
dicinfo= dicominfo(fne);
nrow=dicinfo.Height;
ncol=dicinfo.... |
classdef DOFHandler < handle
%DOFHANDLER What does the DOF handler handle? The DOF handler handles
%DOFs!
% Detailed explanation goes here
properties
DOFs;
nDOFs;
n2DOF;
eDOFs;
e2DOF;
fDOFs;
f2DOF;
iDOFs;
i2DOF;
el2DOF;
Nd;
boundaryDOFs;
elements = {};
geom;
freeD... |
%---------------------------------------------------------------------------------------------------------------------
% ADVISOR Data file: FC_KTH.m
%
% Modeling results for a 50kW peak fuel cell system operating on pure hydrogen.
%
% Created on: 04/04/02
% By: Kristina Haraldsson, National Renewable Energy Laborato... |
function [d,dfull,sqdum] = dummy(s,bdry,asq,dsq,dfeat,n,flag)
% D = DUMMY(L,B,A,S,D,N,FLAG)
%
% Returns a structure library containing square dummy features for the
% input structure library L. The dummy features are placed only within the
% boundary, which is defined by B = [X1 X2 Y1 Y2] for a rectangular area.
%
%... |
function mesh = createRectangularMeshMK3(xMin, yMin, xMax, yMax, spacing)
xSpacingNumber = floor((xMax - xMin) / spacing);
ySpacingNumber = floor((yMax - yMin) / spacing);
x = 0 : xSpacingNumber;
y = 0 : ySpacingNumber;
[X,Y] = meshgrid(x,y);
points = [X(:), Y(:)];
pointIndices = 1:size(points, 1);
pointIndices = re... |
function prediction = sbmkl_supervised_classification_variational_test(Km, state)
N = size(Km, 2);
P = size(Km, 3);
prediction.G.mu = zeros(P, N);
for m = 1:P
prediction.G.mu(m, :) = state.a.mu' * Km(:, :, m);
end
prediction.f.mu = prediction.G.mu' * (state.s.pi .* state.e_success.mu) ... |
clear all
clc
eps=0.001;
input_eld
pload=input('Enter the total load demand');
pload
pgen=0;
lamda=max(generation(:,3));
n=length(generation(:,1));
alpha=1;
% for i=1:n
% pg(i)=(generation(i,5)+generation(i,6))/2;
% pgen=pgen+pg(i);
% end
pg(1)=300;
pg(2)=200;
pg(3)=300;
lamda=9.4484... |
function theta = lawOfCosine(a,b,c)
theta = acos((b^2 + c^2 - a^2) /(2 * b * c));
end |
close all;
clear all;
clc;
% THIS SCRIPT IS THE FIRST TRIAL OF MULTI-LEVEL BEAMFORMING
lambda = 0.005;
d = lambda/2;
M = 128; %M_T = M_R = M
N_B = 4;
K = 1 + floor(log(M)/log(N_B));
%K = M;
%N_B_o = 4;
%N_B = 2;
%K = 1 + floor(log(M/N_B_o)/log(N_B));
th_sp = 1*(2*pi/360); %4 degrees
N_ang = 100;
N_or = 1;
P_T = 10... |
function obj = loadBatchFunctionFolders(obj)
% Loads the necessary directories to have the batch functions present.
% Biafra Ahanonu
% started: 2013.12.24 [08:46:11]
% inputs
%
% outputs
%
% changelog
%
% TODO
%
loadRepoMethod = 1;
if loadRepoMethod==1
ciapkg.loadBatchFxns();
else
subfxnLoadFxns... |
function specplot(X,sigma,range,linspec,linewidth)
if nargin <=1
sigma =0.001;
end
if nargin <=2
range = [-10*sigma,X(end)+10*sigma];
end
if nargin <=3
linspec = 'b-';
end
if nargin <=4
linewidth = 1;
end
gaussian1D = @(x,mu,sigma) 1/sqrt(2*pi)/sigma * exp(-(x-mu).^2/2/sigma^2);
func = @(x) sum(gaussi... |
% This is a little test software to think about how to generate the
% spinning DISK mask for the DMD in C.
%
% I think I may be able to do it in a single giant for loop, even in C.
kernelSizeX=8;
kernelSizeY=8;
nFrames=kernelSizeX*kernelSizeY;
nSizeX=1024; %number of elements per row
nSizeY=768; %number of element... |
function status_pipe = psom_deamon(path_logs)
% Not meant to be used directly. See PSOM_RUN_PIPELINE.
%
% Start workers, a pipeline manager and a garbage collector
% SYNTAX: [] = PSOM_DEAMON(PATH_LOGS)
% PATH_LOGS (string) the logs folder.
% See licensing information in the code.
% Copyright (c) Pierre Bellec,
% Depa... |
function suppfig_controls_spontPCs(matroot)
load(fullfile(matroot, 'zscored_spectrum.mat'));
load(fullfile(matroot, 'spontPC_spectrum.mat'));
load(fullfile(matroot, 'eigs_and_stats_all.mat'));
%%
close all;
default_figure([10 1 6 2]);
nD = length(specZ);
lam = NaN*ones(2800,nD);
for k = 1:nD
lam(1:numel(specS{1}... |
function [sse,defocus_phase]=fitdefocus(obj,x,C4)
% fitdefocus - find amount of defocus in z of the measured PSF.
% It uses the zernike coefficient of defocus aberration found from zernike
% expansion of phase retrieved pupil function. This method function is used
% in OptimPR_Bi and OptimPR_Ast classes.
%
% ... |
classdef (Sealed) Csr < handle
% CSR Summary
% singleton class to cluster functionality around CSR
% Main reason for this design choice is the necessity of accessing data
% from various places.
% methods that define singleton class
methods (Access = private)
function obj = Csr
... |
%% Load data
clear all
clc
% Add path (at beginning of script)
narx = [pwd,'\narx'];
nn_function1 = [pwd,'\nn_function1'];
nn_function2 = [pwd,'\nn_function1'];
addpath(narx);
addpath(nn_function1);
addpath(nn_function2);
%this script is predicting the rupture period
log_start = 0.5e5-2;
% Load Original Migatronic l... |
function [Source,Target,method] = Process3Arguments(Input1,Input2,Input3)
if(ischar(Input1) && IsVector(Input2) && IsVector(Input3))
method = Input1;
Source = Input2;
Target = Input3;
Source = ReshapeCheck(Target,Source);
elseif(IsVector(Input1) && IsVector(Input2) && ischar(Input3))
method = Input3;
Source = ... |
function histograma(I,n,ps)
clear all
close all
[h,w] = size(I);
n = length(I(:));
[nk rk] = hist(I(:), [0:255]);
stem(rk,nk);
ps=nk/n;
for i = 1:length(ps)
sk(i) = sum(ps(1:i));
end
imshow(I)
for i=1:h
for j=1:w
Ih(i,j) = round(255*sk(I(i,j)+1));
end
end
figure
imshow(uint8(Ih))
|
function [fineI foundColorName] = finefind(I)
I = imcrop(I, [0 230 150 42]);
%I is an RBG image
IHSV = rgb2hsv(I);
e = im2bw(1-im2double(IHSV(:,:,1)));
er = bwmorph(e,'erode');
et = bwmorph(er,'thicken');
location = bwareaopen(et,100);
s = regionprops(location,'all');
licenseRatio=3.875;
licenseArea=248;
licens... |
function makeCycFile(cyc, name)
% function makeCycFile(cyc, name)
% creates an ADVISOR CYC_*.mat file for use with ADVISOR CYC_*.m file
try
cyc_mph=[cyc.t, cyc.v./0.44704]; % convert from m/s to mph
cyc_description=cyc.name; % get the name from the advisor file
% ok, need to fix the grade calcs LATER!... |
function irpTestBinarize(I, low, high)
% irpTestBinarize(I, low, high)
% Testet die Funktion irpBinarize. Es werden in einem subplot das
% Ausgangsbild und die beiden Binärbilder untereinander dargestellt.
%
% Parameter:
% 'I' Grauwertbild
% 'low' Niedriger Schwellwert
% 'high' ... |
function object_data_list = CS6640_extract_features(videos)
object_data_list=[];
for vidNo=1:length(videos)
vidObj=videos(vidNo);
%% CS6640_MM - A4 - Segments moving objects in video
M = CS6640_MM(vidObj);
%% CS6640_object_data - A4 - extracts object data from a video
nFrames=vidObj.NumberOfF... |
%clean
clear all;
clc;
fs = 300;
direc='/Volumes/TOSHIBA/Seņales suizos tercero, cuarto, quinto y sexto escenario/Datos/Datos_raw/Con_resh/valores_reshape_raw.mat';
load(direc);
%Pentro
InstFTrain = cellfun(@(x)instfreq(x,fs)',XTrain,'UniformOutput',false);
InstFTest = cellfun(@(x)instfreq(x,fs)',XTest,'UniformOutp... |
function class = query(classifier, dataString, priors)
%{
title: query function
author: Tim Campbell
date: 9/8/2014
description:
this is a previous script (prepareDataResample) that has been
completely rewritten for online FabSense classification. The function
is designed to be called from the command... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.