text stringlengths 8 6.12M |
|---|
% function p = pathdef
% %PATHDEF Search path defaults.
% % PATHDEF returns a string that can be used as input to MATLABPATH
% % in order to set the path.
%
%
% % Copyright 1984-2007 The MathWorks, Inc.
% % $Revision: 1.4.2.2 $ $Date: 2007/06/07 14:45:14 $
%
%
% % DO NOT MODIFY THIS FILE. IT IS AN AUTOGE... |
function design = transform_L1O_into_L2O(design)
%remove last column (last step of validation)
design.train(:,end) = [];
design.test(:,end) = [];
design.label(:,end) = [];
%for each train chunk out, also leave the next one out
ind=find(design.train==0);
design.train(ind+1) = 0;
%for each test... |
function c = cel(kc,p,c,s)
% kc
% p
% c
% s
if kc == 0
c = nanM;
end
% # errtol = 1.0e-6;
errtol = 1.0e-6;
k = abs(kc);
em = 1.0;
if p > 0
p = sqrt(p);
s = s/p;
else
f = kc^2;
q = (1-f)*(s-c*p);
g = 1-p;
f = f-p;
p = sqrt(f/g);
c = (c-s)/g;
s = -q/((g^2)*p)+c*p;
end
f = c;
... |
%% move
% Moves the cell Network
%%
%% Syntax
% N = move(N)
%
%% Description
% Multiplies the vertices by a fixed number.
%
%% Inputs
% * N - a cellNetwork object
%
%% Outputs
% * N - a new cellNetwork object
%
%% Examples
% >> N = move(N,2);
%
%% See also
% *
%
%% Author
% Sebastien Besson.
% email address : ... |
function arrow(x,y,w,h,a)
%function arrow(x,y,w,h,a)
patch([x x+w-a*2-h/2 x+w-a*2-h/2 x+w x+w-a*2-h/2 x+w-a*2-h/2 x], ...
[y y y-a y+h/2 y+h+a y+h y+h],'k'); |
function [cellstr] = readTextSimple(path, head)
if(~exist(path,'file'))
error(['File: ' path ' does not exist']);
end
fid = fopen(path);
cellstr = textscan(fid, '%s', 'Delimiter', '\n','HeaderLines',head);
cellstr = strtrim(cellstr{1});
fclose(fid);
end
|
function h = modelIntern(model)
function b=coop(x)
global alpha beta gamma
model.setParams(x)
if alpha<=beta && beta<=gamma
b=1;
else
b=0;
end
end
h=@coop;
end
|
function S = get_odor(name)
odor_raw = imread(strcat('odor/',name,'.png'));
odor = zeros(size(odor_raw(:,:,1)));
for i = 1:size(odor,1)
for j = 1:size(odor,2)
if odor_raw(i,j,1) == 255
if odor_raw(i,j,2) == 255
if odor_raw(i,j,3) == 255
... |
load resp.mat
plot(timeResp,resp);
ylabel('Respiration Data');xlabel('Time (s)');
grid on
|
r = input('Enter the learning rate');
V = randn(785,8);
W = randn(9,10);
tk = zeros(10,1);
for n = 1:1000
random = randi(5000);
tk = zeros(10,1);
X = ([-1;train(random,2:end)'])./255;
t = train(random,1) + 1;
tk(t) = 1;
hj = V' * X;% 8x1
aj = [-1;sigmoid(h... |
function repP=Ei200_uvw100_at200TPmod2Peaks(varargin)
root = fileparts(pwd);
data_source= fullfile(root,'sqw','Data','Fe_ei200.sqw');
bragg = [2,0,0];
dE = 5;
dK = 0.05;
avrg_par=[0,0,949.35];
repPoints1 = [-0.33,-0.11,0,0.11,0.36;
120,15,0,10,155];
repPoints2=[-0.31,-0.08,0,0.11,0.36;
140,10,0,10,140];
rep... |
%regionOverlap: Get the regions in our image that are contained within a
%given cropping rectangle
%
%USAGE [regList, overlap] = regionOverlap(param, cropRect)
%
%AUTHOR Matthew Jemielita, April 2, 2014
function [regList, overlap] = regionOverlap(param, cropRect)
colorNum = 1;%To deal with oldish code
tot... |
% process_qsos: run DLA detection algorithm on specified objects
% load redshifts/DLA flags from training release
prior_catalog = ...
load(sprintf('%s/catalog', processed_directory(training_release)));
if (ischar(prior_ind))
prior_ind = eval(prior_ind);
end
prior.z_qsos = prior_catalog.z_qsos(prior_ind);
prio... |
function MClustCutterUndoStore(U)
% MClustCutterUndoStore(undoStateStruct)
% MClustCutterUndoStore(funcname)
%
% ADR 2008
%
% Part of the new undo mechanism in MClust 3.5.
% Modified from code by JCJ 2007
%
% Status: PROMOTED (Release version)
% See documentation for copyright (owned by original authors) and warranti... |
function [cipher_data]=Transposition_encryption(N)
add='plain.txt';
f_file = fopen(add, 'r');
plain_txt = fscanf(f_file, '%c');
trans=zeros(N,N);
NN=N*N;
cipher_txt=[];
D=length(plain_txt);
pad=mod(D,NN);
plain_txt=[plain_txt zeros(1,pad)];
for r=1:length(plain_txt)/NN
for s=1:NN
tran... |
function [ ranking ] = featureRanking( train_file, output_file, task)
values = load(train_file);
data = sparse(values(:, 1), values(:, 2), values(:, 3));
%data = values;
[m, n] = size(data)
if strcmp(task, 'survival') == 1
x = data(:, 1:n-2);
y = data(:, n-1:n);
num_features = n - 2;
else
x = data(:, 1:n-1);
y = d... |
clear all;
monkey = 'Pepe';
%monkey = 'Satchel';
load(sprintf('%s/bcidistance.mat',monkey));
load(sprintf('%s/bciacqtime.mat',monkey));
load(sprintf('%s/blockshamacqtime.mat',monkey));
load(sprintf('%s/blockshamdistance.mat',monkey));
load(sprintf('%s/sessindindex.mat',monkey));
unique_sessidx = unique(sessindindex... |
function [HijosCompleto] = Variacion(Padre,n,Hijos)
global a iteraciones
i= round(n*0.2);
while i < n
x1= abs(round(((n-1)*rand)+1));
x2= abs(round(((n-1)*rand)+1));
x3= abs(round(((n-1)*rand)+1));
minimo= abs(min(x1,x2));
%((*Ojo Truco adicional del profesor ))Este while me permite seleccionar dos padre... |
function color_rgb = aquamarine
color_rgb = {'color', [0.49803, 1.0, 0.83137]};
end |
%% label matrix and stats
tp=1;
path = '\\argon.fmi.ch\gkeller.mdrive\attialex\images\tp\';
prefix = 'vml';
width = 40;
idx = -(width/2) +1:width/2;
for site = 2:4%size(proj_meta,2)
for layer = 1:4
ROIs =proj_meta(site).rd(layer,tp).ROIinfo;
nROIs = size(ROIs,2);
L=zeros(400,750);
... |
subplot(2,1,1)
load out; a = nansum(Results.Sum,3); b = nansum(Results.Count,3); c = a./b;
% load out; c = log10(nansum(Results.Count,3));
% load out; i = 9;a = Results.Sum(:,:,i); b = Results.Count(:,:,i); c = a./b;
c = log10(c);
c = smoothn(c,[3,3]);
m_proj('lambert','lon',[-125,2],'lat',[20,80]);
m_pcolor(x... |
% iou plot
clear, clc
main_dir = '/home/dtc/MyGit/dtc-scannet-sparseconvnet/Result/pmserver/scannet_m16_rep2_residualTrue-000000650/Backup/';
f_random = strcat(main_dir, 'random_result_main.csv');
f_grid = strcat(main_dir, 'grid_result_main.csv');
f_hierarchy = strcat(main_dir, 'hierarchy_result_main.csv');
titleNam... |
function [ saida ] = obj3_norma( vetor_coeficientes )
saida = norm(vetor_coeficientes);
end
|
A = cartpole_agent('integrator_type','ode45');
AH = cartpole_agentHelper(A,'cartpole_frs_9_22.mat','safety_layer','N');
Env= cartpole_env(AH);
num_range = 5;
N_theta = num_range;% initial
N_theta_dot = num_range;% initial
N_x_dot = num_range;% initial & parameter
N_ka = num_range;% initi2al & parameter
N_kpeak = num... |
function J = computeCost(X, y, theta)
%COMPUTECOST Compute cost for linear regression
% J = COMPUTECOST(X, y, theta) computes the cost of using theta as the
% parameter for linear regression to fit the data points in X and y
% Initialize some useful values
m = length(y); % number of training examples
% You need t... |
x=input('enter x: ');
y=input('enter y: ');
if x>0
if y>0
disp('Quadrant 1');
else
disp('Quadrant 4');
end
else
if y>0
disp('Quadrant 2');
else
disp('Quadrant 3');
end
end |
function [defaultanswer fullPath]=mhdHeaderInformation( filePath)
try
% Image file path
try
[pathstr, name, ext] = fileparts(filePath);
temp=mhdHeader( filePath, 'ElementDataFile'); % Get data file path from header
fullPath=[pathstr filesep temp];
... |
clc;
clear;
close all;
for i = 1:1:256
formatSpec = "max(myPeaksDetector(y_Corr%d(1:1281)))\n";
fprintf(formatSpec,i);
end |
function t90 = g_ipts68_to_its90(t68)
% g_ipts68_to_its90 Convert temperature from IPTS68 to ITS90
%
% T68 = g_ipts68_to_its90(T90)
%
% INPUT t68 - Temperature in IPTS68
%
% OUTPUT t90 - Temperature in ITS90
%
% Gunnar Voet, APL - UW - Seattle
% voet@apl.washington.edu
%
% Last modi... |
clear;
clc;
syms d1 a1 a2 d2 r1 r2 r3 l1 l2 l3 g m1 m2 m3 m4 M real;
syms Ixx_1 Iyy_1 Izz_1 Ixx_2 Iyy_2 Izz_2 Ixx_3 Iyy_3 Izz_3 Ixx_4 Iyy_4 Izz_4 g real;
syms t real;
syms t1(t) t2(t) d3(t) t4(t);
syms t1_ t2_ d3_ t4_ real;
syms t1_dot_ t2_dot_ d3_dot_ t4_dot_ real;
syms t1_ddot_ t2_ddot_ d3_ddot_ t4_ddot_ real;
t1_... |
% QMG1H.m
% DOING PHYSICS WITH MATLAB
% https://d-arora.github.io/Doing-Physics-With-Matlab/
% Documentation
% https://d-arora.github.io/Doing-Physics-With-Matlab/mpDocs/QMG102.htm
% IAN COOPER
% matlabvisualphysics@gmail.com
% 230415 Matlab R2021b
% GRIFFITH problem 1.13
clear; close all; clc
% SETU... |
disp('Generamos la clave publica y privada de A');
[cpubla,cpriva]=generar_clave_aleatoria(100000)
disp('Generamos la clave publica y privada de B');
[cpublb,cprivb]=generar_clave_aleatoria(100000)
mensaje=input('Introduce el mensaje que B quiere enviar a A:');
while(not(ischar(mensaje)))
mensaje=input('No es una ... |
function varargout = dataCollection_screen1(varargin)
% DATACOLLECTION_SCREEN1 MATLAB code for dataCollection_screen1.fig
% DATACOLLECTION_SCREEN1, by itself, creates a new DATACOLLECTION_SCREEN1 or raises the existing
% singleton*.
%
% H = DATACOLLECTION_SCREEN1 returns the handle to a new DATACOLLECTIO... |
function gX = constraintLogLikeGradientsLDA(model)
% CONSTRAINTLOGLIKEGRADIENTSLDA Returns gradients of loglikelihood
% for LDA constraints
% FORMAT
% DESC Returns loglikelihood for LDAPos constraint
% ARG model : fgplvm model
% RETURN options : Returns loglikelihood
%
% SEEALSO : constraintLogLikelihood
%
% COPYRIGHT... |
function TestEM1PerfectSphere()
global w
% Frequency in optics
w = 5*10^14;
FindE(10^-9,13,'EM1Spherem13a1E9');
RelativeError(13,'EM1Spherem13.csv');
RelativeError(15,'EM1Spherem15.csv');
RelativeError(17,'EM1Spherem17.csv');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fu... |
clc;clear;
%% input
BM = load('Polbooks.mat');
mAdj = BM.C;
mMembership = BM.C;
vVertLineLocs = [];
vHorLineLocs = [];
mPosColour = [0 1 0; 0 0 0];
%% output
%drawColouredBlockmodel(mAdj, mMembership, mPosColour, vVertLineLocs, vHorLineLocs)
drawBlockmodel(mAdj, vVertLineLocs, vHorLineLocs)
|
%% Demo of how to compute discrete approximaiton to 1d/2d Gaussian posterior
mu = [5 1]'; Sigma = 2*eye(2);
Zexact2 = sqrt(det(2*pi*Sigma))
% picking the right range is crucial...
range1 = 0:0.1:10; range2 = -5:0.05:5;
target = @(X) gausspdfUnnormalized(X,mu,Sigma);
papprox2 = GridDist(target, range1, ran... |
%% martin curve
z=[100:100:6000]; %,
Aoc = 3.49e+014; %m2
b=0.858; %attenuation factor default: 0.858; upper limit 1.33 buesseler et al 2007
% LOSCAR low latitude export
Cexp = 395.19e12; %mol C/y %460 534 | 524 611
F100 = Cexp/Aoc % mol C/m2/y
F= F100.*(z./100).^-b;
% Berger '87. formulation
% NOTE TO MYSELF 5/12/20... |
function x = getopt(argv, options)
% GETOPT checks and returns the arguments of functions
%
% getopt(argv, options) checks that the arguments supplied in the argv cell
% array confrom to the options set in the options cell array. The parsed
% arguments are returned in a structure with appropriately named fields.
... |
%
% Fonction pour simuler la classe MException de matlab
%
% Retournera une structure "à la MException"
%
function foo =Oct_MException(leIDENTIFIER,leMESSAGE,leSTACK)
foo =struct('message',[],'identifier',[]);
if exist('leIDENTIFIER','var')
foo.identifier =leIDENTIFIER;
end
if exist('leMESSAGE','var')
... |
close all;
%% percentage alpha
parse_data_SIM;
interfaces = {'j','h'};
interface_cells = {'pa_re_jkld', 'pa_po_jkld', 'pa_re_jpot', 'pa_po_jpot';
'pa_re_hkld', 'pa_po_hkld', 'pa_re_hpot', 'pa_po_hpot'};
interface_cells = {'pc_re_jkld', 'pc_po_jkld', 'pc_re_jpot', 'pc_po_jpot';
'p... |
function x = OMP(A, y, s)
x = zeros(size(A,2),1);
r = y; %residue
supp = zeros(1,s); %support
for i=1:s
[~, IX] = sort(abs(r'*A),'descend');
supp(i) = IX(1);
Ai = A(:,supp(1:i));
b = (Ai'*Ai)\Ai'*y; %least squares
r = y - Ai*b; %residue update
end
x(supp) = b;
end |
function [figuredata]=UpdateFigure(figuredata,axeshandle,Names,newvalues)
for ii=1:length(Names)
temp=Names{ii};
newvalue=newvalues{ii};
figuredata=setfield(figuredata,temp,newvalue);
end
TimeDomainData=figuredata.TimeDomainData;
tau_vector=figuredata.tau_vector_raw;
T_vector=figuredata.T_vector_raw;
t_v... |
function out = run(testkey,prefix)
%Run HTESTS
%
% nnet.test.run, runs all htests in working directory
% nnet.test.run(dir), runs all htests in dir
% nnet.test.run(htest), runs htest
% nnet.test.run(htest,prefix), runs subtests of htest with given prefix
% Copyright 2013-2015 The MathWorks, Inc.
if nargin < 2, pr... |
% Domain extension
xleft=0;
xright=1;
% Cross sectional areas
S=0.02;
% Physical paramaters
rhol=1000;
mul=0.001;
rhog=1;
dp=0.005*0; % Ensures no relative velocity
g=-10*0;
% Initial values
alphag0=1;
% Time-step
dt=0.001;
% Number of timesteps
timesteps=1;
% PISO corrections
nCorr=3;
% Non-orthogonal correcti... |
function [timebase_x, timebase_y, wi_x, wi_y] = extract_transverse_wake_impedance_from_wake_data(wake_data)
% wake data (structure): contains all the data from the wake postprocessing
%
%timebase (vector): timebase in ns.
% wi_x (vector): transverse wake impedance in x.
% wi_x (vector): transverse wake impedance in y.
... |
X = zeros(100,1);
Y = X;
X(1) = 0.4;
Y(1) = 0.2;
rx = 3.8;
ry = 3.5;
Bxy = 0.01;
Byx = 0.2;
for fstep = 1:(length(X)-1),
X(fstep+1) = X(fstep)*(rx-rx*X(fstep)-Bxy*Y(fstep));
Y(fstep+1) = Y(fstep)*(ry-ry*Y(fstep)-Byx*X(fstep));
end;
eDims = 2:1:10;
tsteps_to_check = 1:1:50;
delta = [1e-6:5e-5:1e-2];
Tmax = 50;
br... |
#!/usr/bin/env octave
function mpi_sweep_octave_example
## Make sure that AT source files are in path.
## For this go to atoctave folder and run
## > octave --eval 'bootstrap;savepath'
## this code will run on all MPI nodes
D1.FamName = 'DR01';
D1.Length = 3;
D1.PassMethod = 'DriftPass';
QF.FamName... |
function [t] = calculate_time(poi_coord, policy, vel)
t(1,1) = 0;
for i = 2:length(policy)
t(i,1) = sqrt(power(poi_coord(policy(i),1)-poi_coord(policy(i-1),1),2) + power(poi_coord(policy(i),2)-poi_coord(policy(i-1),2),2))/vel;
end
end
|
% Searches for the minimum of a function using a genetic algorithm
% Initialise plotting
cityLocation = LoadCityLocations;
tspFigure = InitializeTspPlot(cityLocation,[0 20 0 20]);
connection = InitializeConnections(cityLocation);
% Parameters
populationSize = 50;
numberOfGenes ... |
%__________________________________________________________________________
%
% VALIDATION PLOTS
%
% Yves-Marie Bozec, y.bozec@uq.edu.au, 02/2021
%__________________________________________________________________________
clear
load('LTMP_Transect2Tow_NEW.mat') % Linear model allowing to convert manta tow into tranect... |
function [p1 p2 p3 p4 p5 ] = sortProb(pointX,pointY,x,y,prob );
for i=1: size(pointX, 2)-1
for j = 1: size(pointX, 2)-i
if (prob(j) > prob(j+1))
temp=prob(j);
prob(j)=prob(j+1);
prob(j+1)=temp;
temp=pointX(j);
pointX(j)=pointX(j+1);
p... |
function [t_out, y_out] = dp45( f, t_rng, y0, h, eps_abs )
if ~isa( f, 'function_handle' )
throw( MException( 'MATLAB:invalid_argument', ...
'the argument f is not a function handle' ) );
end
if ~isscalar( eps_abs) || (eps_abs <= 0)
throw( MException( 'MATLAB:invalid_argument', ...... |
function [v,t] = getPeak(V)
%Returns the value and the time of the first peak of a voltage trace
%
% v = getPeak(V) given an array of voltages V, returns the peak
% value
%
% [v,t] = getPeak(V) given an array of voltages V, returns the
% peak value and at which time the peak is reached
%Get first order di... |
function polyOut = parsePolygon(poly, format, varargin)
%PARSEPOLYGON Conversion between different polygon formats.
%
% POLYOUT = parsePolygon(POLY, FORMAT)
% Converts POLY to the specified format while FORMAT must be one of the
% following options: 'cell','nan','repetition','polyshape'. Mainly used
% in other ... |
function plot_figure(Mesh, FE, result)
if FE.basis_type_test == 202
Mesh.hx = Mesh.hx / 2;
Mesh.hy = Mesh.hy / 2;
end
x = Mesh.left: Mesh.hx: Mesh.right;
y = Mesh.bottom: Mesh.hy: Mesh.top;
[X, Y] = meshgrid(x, y);
exact = reshape(result.exact_solution, size(X));
numerical = reshape(result.solution, size(X));
s... |
x = <x0>;
y = [<x1>];
y = reshape(y,3,3)';
output = x*det(y);
if ~ exist('OutputFiles', 'dir')
status = mkdir('OutputFiles');
end
csvwrite(sprintf('OutputFiles/oupt.out'),output);
|
function model = fit_Hellinger_forest(features, labels, numTrees, numBins, minFeatureRatio, cutoff, printCount, memSplit, memThresh)
%Function: fit_Hellinger_forest
%Form: model = fit_Hellinger_forest(features, labels, numTrees, numBins, minFeatureRatio, cutoff, printCount, memSplit, memThresh)
%Description: Train a fo... |
function num = sci2num(str)
%% FUNCTION sci2num
% Converts a string to a number. String may contain an SI prefix which must be
% used in converting back to an absolute number.
%
%
% Examples:
%
% num = sci2num('14.5 m') returns num = 0.0145
% num = sci2num('14.5') returns num = 14.5
% num = sci2num({'14.5m',... |
function [ Param ] = paramFBMC( mod, numOfSym, sizeOfFFT, numOfCarrier, overSampling, K )
Param.N = sizeOfFFT;
Param.D = numOfCarrier;
Param.K = K;
Param.S = Param.N * Param.K;
Param.OV = overSampling;
Param.Offset = Param.N/2;
Param.CP = 0;
if (numOfCarrier == sizeOfFFT)
Param.CarrierIndexes ... |
function file = show(filename, is, file)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
setPlotParameters;
varname = {'t', 'fxp', 'fxv', 'fx', 'fyp', 'fyv', 'fy'};
if nargin < 3
nskip = 5;
nvars = 7;
file = loaddata(filename, nskip, nvars);
end
figure;
labels={};
for ii=is... |
% Include map
map = SMap.getInstance().getOccupancyGrid();
% Include ROB toolbox
start = [4.72 1.512];
viapoints = [
start;
4.72 2.488;
17.46 2.395;];
posCompLab = [17.92 2.2];
viaCompLab = [
13.32 2.488;
13.32 16.11;];
robotRadius = 0.2;
mapInflated = copy(map);
inflate(mapInflated,robotRadius... |
% get_laplacian gives the normalized laplacian matrix for an adjacency matrix
function ret=get_laplacian(adj)
deg = diag(sum(adj,2));
lpcn = deg - adj;
ret = (deg^(-1/2))*lpcn*(deg^(-1/2));
end
|
clear
%following combustion and flame 2001
%all the constants
kh2o=6.05e5;
kpyr=3.64e3;
kchar=430;
nuchar=0.338;
nuco2=0.2;
nuash=0.033;
nusoot=0.05;
nuo2=8/3;
erh2o=5956;
erpyr=7250;
echar=9000;
asg=0.5;
sigs=4000; %guessed for pine needles
rhog=1;
%heating rate
dTdt=10/60;
%get the production of all species
%ompy... |
function [x, h, dhdx] = tanhprofile(Xmax, Hright, Hleft, WidthR, WidthSlope, nx)
% [x, h, dhdx] = TANHPROFILE(Xmax, Hright, Hleft, WidthR, WidthL, nx)
%
% inputs
% - Xmax:
% - Hmin:
% - Hmax:
% - WidthHmin:
% - WidthHmax:
% - nx: number of points in the x grid.
%
% outputs
% ... |
#! /snap/bin/octave -qf
if (nargin!=7)
printf("Usage: pca+mixgaussian-eva.m <trdata> <trlabels> <pcaKs> <Ks> <alphas>\n")
exit(1);
end;
arg_list=argv();
trdata=arg_list{1};
trlabs=arg_list{2};
tedata=arg_list{3};
telabs=arg_list{4};
pcaKs = str2num(arg_list{5});
K = str2num(arg_list{6});
alpha=str2num(arg_list{7});
... |
tSNE_Flow=[];tSNE_Flow = tsne_perp(ZS,[],2,100,10:10:100);
Fighandle=figure;
set(Fighandle, 'Position', [100, 100, 1400, 900]);
xplot=floor(sqrt(length(tSNE_Flow)));yplot=ceil(length(tSNE_Flow)/xplot);IDX=[];counter=1;
for i=1:length(tSNE_Flow)
%[IDX{i}, isnoise]=DBSCAN(tSNE_Flow{i},10,20);
subplot(xplo... |
%%
close all
load('sincos_basis.mat')
%Y = [cos(bt) ; sin(bt)]
%B = [sin(ax) ; cos(ax)]
%sin(ax+bt) = sin(ax)cos(bt) +cos(ax)sin(bt)
%% initial image
for i = 1:10
Ii = renderim(Y(:,i),B,imsize);
imshow(Ii,[]);
drawnow;
pause(0.1);
end
%% transform A
% ax => 2ax
ax1 = B(:,1);
ax2 = B(:,2);... |
function quotient_img=NQI_horizontal(img)
%------Neighborhood Quotient Image------%
%------input img must is a gray image------%
temp_img=double(img);
for i=1:size(temp_img,1)
for j=1:size(temp_img,2)-1
if temp_img(i,j)<temp_img(i,j+1)
numerator=temp_img(i,j);
denominator=temp_img(i,j... |
function ABCtranslate = num2abc(D)
%NUM2ABC returns spreadsheet string equivalent to the specified integer.
% NUM2ABC(D) returns a string corresponding to the column label in the
% format commonly employed by spreadsheet programs, such as Calc and
% Microsoft Excel. The specified integer, D, must be greater than... |
function res = niqe_metric(img)
cd niqe_release
load modelparameters.mat
blocksizerow = 96;
blocksizecol = 96;
blockrowoverlap = 0;
blockcoloverlap = 0;
res = computequality(img,blocksizerow,blocksizecol,blockrowoverlap,blockcoloverlap, ...
mu_prisparam,cov_prisparam);
cd ..
end
|
function text = commentText(text)
% commentText Comment text
% Copyright 2012-2015 The MathWorks, Inc.
for i=1:numel(text)
text{i} = ['% ' text{i}];
end
|
% simplified unsteady 3D wing lifting line method by B. Davoudi 7/27/2016
% used for aiaa paper 2017
tic
clc; clear all;
Nxw=4; % chordwise panel per hald wing
Nyw=85; % spanwise panel per hald wing
AR=10.75; % Aspect ratio
bw=64.5*2*0.0254; % win... |
function filotypes = added_subtracted_transitioned (drawings, labels, opts)
%A DYNAMO ANALYSIS FUNCTION
%All Dynamo analysis functions take two arguments:
% drawing: a Dynamo saved structure containing the fields 'states' and 'traits'
% labels: a structure containing the annotation key used in drawing
%... |
classdef Sphere < Objet & handle
% Sphere Objet contenant les propriétés d'un sphere
% Méthodes disponibles :
% - CalcVolume
% - CalcMasse (Hérité d'Objet)
properties
Rayon
end
methods
% forme : type Forme, permet de déterminer si plein ou creux.
... |
function varargout = es_mi_lam_PID(varargin)
% ************************************************************************
% Univerzitet u Sarajevu
% Elektrotehnicki fakultet Sarajevo
% Inteligentno upravljanje
%
% Tema: Odredjivanje parametara PID regulatora koristenjem evolucione
% strategije ES ... |
function [] =CS_Adj_G(B,CofCS,Not_Arranged_G)
%300-Indicator
%1000-BP
%-1-Green(Outside CS)
%1-Red(outside CS)
%0-White(outside CS)
%-2-Green(inside)
%2-Red(inside)
%10-White(inside)
%5-Bot
c=1;
Not_Arr_converted=zeros(4,2);
for i=1:8
for j=1:8
if B(i,j)==300
B(i,j)=... |
%@(#) lagervalue3.m 1.2 94/08/12 12:15:16
%
%function lagervalue(matfil,prifil,plotta)
%function lagervalue(matfil,fid,plotta)
%Computes the rest-value all fuel
%Input:
% matfil - Output from bunhist (cf. that m-file),
% default='/cm/fx/div/bunhist/utfil.mat'
% prifil - Print res... |
clearvars
close all
%% linear system identification
experimental_responce; %load data
% resample data
T_fin = time_experimental(end); %final time [ms]
Ts = 1e-2; %sampling time [ms]
T_sim = 0:Ts:T_fin; %resampled experiment time vector [ms]
y_exp = interp1(time_experimental,displacement_experimental,T_sim,'... |
function X = LUsol(A,B)
%
% This is to solve linear equations in the form of: AX=BU using LU deomposition
%--------------------------------------------------------------------------
persistent sp;
if isempty(sp)
sp=issparse(A);
end
if sp;
[L1, U1, P1, Q1 ]= lu( A, 0.1 );
X = full( Q1*(U1 \( L1 \ ... |
function kernel = polynomial_kernel( x, z )
% returns a polynomial kernel matrix with d = 2
% CODE BEGIN
d = 2;
kernel = ((x' * z) + 1)^d;
% CODE END
|
function [feature_vector] = im2vector(image)
%IM2VECTOR Image to feature vector conversion
% Gets image as input and results its feature vector.
props = {'Contrast', 'Energy', 'Homogeneity', 'Entropy',...
'R_mean', 'G_mean', 'B_mean', 'R_std', 'G_std',...
'B_std', 'L_mean', 'a_mean', 'b_mean', 'L_... |
function [y]=fun(k,x)
A = k(1);
t2 = k(2);
tau = k(3);
beta = k(4);
y=A*exp(-(x./t2).*((1+(x./tau)).^(beta-1))); |
function A = loadFeatureBasis(strkind, nw)
% A [patchSize^2 nFeatures]
%
if nargin < 2
nw = nan;
end
switch strkind
case 'gabor'
if isnan(nw) && exist('../data/gaborBank.mat', 'file') > 0
G = load('../data/gaborBank.mat');
G = G.G;
else
G = tools.gaborFilter... |
function [W,b,c] = cross_validate_svm1(Xpos,Xneg,Call,trainpercent)
maxIter=1e12;
npos=size(Xpos,2);
nneg=size(Xneg,2);
ypos=ones(1,npos);
yneg=-ones(1,nneg);
ntrainpos=round(trainpercent*npos);
ntrainneg=round(trainpercent*nneg);
indpostrain=1:ntrainpos;
indposval=setdiff(1:npos,indpostrain);
indnegtrain=1:ntra... |
#include "com_codename1_impl_ios_IOSImplementation_TextureAlphaMask.h"
const struct clazz *base_interfaces_for_com_codename1_impl_ios_IOSImplementation_TextureAlphaMask[] = {};
struct clazz class__com_codename1_impl_ios_IOSImplementation_TextureAlphaMask = {
DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, ... |
function l=getWatchedLabelsomarP2X4coop()
l=['Q1';'Q2';'Q3';'Q4';'Q5';'Q6';'Q7';'Q8';'C2';'C3';'C4';'C5';'C6';'C7';'C8'];
end |
% Color Segmentation using
% Mery, D.; Pedreschi, F. (2005): Segmentation of Colour Food Images using
% a Robust Algorithm. Journal of Food Engineering, 66(3):353-360.
% PDF > http://web.ing.puc.cl/~dmery/Prints/ISI-Journals/2005-JFoodEng-Segmentation.pdf
close all
k = 3;
I = imread('flor.png');
I = imresize(I,1);
[... |
function centroids = faceCentroids(nodes, faces)
%FACECENTROIDS Compute centroids of a mesh faces
%
% NORMALS = faceCentroids(VERTICES, FACES)
% VERTICES is a set of 3D points (as a Nx3 array), and FACES is either a
% [Nx3] indices array or a cell array of indices. The function computes
% the centroid of... |
% Generat profile Na Nd
% How to launch :
% NaNd_GenerationProfile(1,1e15,1e15,2.5e-4,2.5e-4) In cm !!!
% profile = 1 ==> constant concentration
% profile = 2 ==>
% profile = 3 ==>
% profile = 4 ==>
function [] = NaNd_GenerationProfile(profile, N_a_experiment, N_d_experiment, t_NiO, t_ZnO)
% Gene... |
function elem=atM66Tijk(fname,varargin)
%ATM66(FAMNAME,M66,Tijk,PASSMETHOD)
% atM66 creates an element that applies an arbitrary matrix m66
%
%FAMNAME family name
%M66 transfer matrix, defaults to Identity(6)]
%Tijk 2nd order transfer matrix, defaults to zeros(6,6,6)]
%PASSMETHOD tracking function, defau... |
function f = myImClose(A,B)
f = erison(dilation(A,B),B);
end |
close all;
clear all;
a=0;
b=1;
%resolution of the plot, solution is evaluated at resolution points
resolution = 1000;
h=(b-a)/resolution;
x=a:h:b;
N=4;
P=6;
deltaX=(b-a)/N;
X=a:deltaX:b;
%Solve advection-equation du/dt+cdu/dx=s(u), x \in [a,b]
%u(0,t)=sin(t), u(x,0)=0
c=1;
%4th order Gauss... |
function [C,ID_in]=NN_train_VAD()
%%
C = [];ID_in=[];
succes=0;
PathSpeech='C:\Users\User\Desktop\matal\shahALL\';
FileListS = GetFileList(PathSpeech,2);
Nfiles = length(FileListS);
for I=1:Nfiles
WavFileS = strcat(PathSpeech,FileListS(I).name);
disp(WavFileS)
if WavFileS(end-3:end)=='.wav'
[Y,... |
function imshowfill(varargin)
% imshowf(img )
%
% Basically imshow but fills up the screen
%
% (c) Frank Ong 2015
im = varargin{1};
iSize = size(im);
sSize = get(0,'Screensize');
sSize = floor([sSize(4),sSize(3)]*0.67);
im = imresize(im,[sSize(1),sSize(1)*iSize(2)/iSize(1)],'Method','nearest');
iSize = size(im);
if... |
% a function to calculate normalized PSNR for images x and xr
%
% Ramin Eslami 6-1-05
function psnr = psnr2(x, xr)
Max = 255;
N = prod(size(x));
e = x(:)-xr(:);
% mse = sum(sum((e/Max).^2))/N;
psnr = 10*log10( Max^2 / ( sum(e.^2) / N ) ); |
function [ dx ] = f(x)
%f
global A r N E m g DC DN;
R = [x(1:3)' ; x(4:6)' ; x(7:9)'];
v = x(10:12);
alpha = x(13:14);
T = R*(2/5*m*r^2*eye(3))*R'-m*r^2*A(N(alpha(1),alpha(2)))^2;
w = T\v;
dR = (A(w)*R);
dalpha = r*(E(alpha(1),alpha(2))\(DC(alpha(1),alpha(2))'*A(w)*N(alpha(1),alpha(2))'));
dv = m*r*A(N(alpha... |
%% user defines incident angle of laser beam and distance of photodiode
%user input here%
incident_angle=45; %incident angle of beam on viewport in degrees
alpha=deg2rad(10); %angle that microdisk is deflected by in rads
d=0.002; %viewport thickness in meters - depends on viewport
x3=0.1; %distance to photodiode in me... |
clear;
clc;
close all;
% Note Recognition
%% Note Initialization
mainNames = char('C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B');
names = char('A0', 'A#0' ,'B0');
A0 = 27.5;
ind = 4;
for i = 0:87
data(i+1) = A0 * (2^(1/12))^i;
if i>2
a = [mainNames( rem((ind - 4), 12)+1,:) num2str(fi... |
%% test data - proj2compare.mat
clear; close all
load proj2compare.mat
%% plot initial figure and sonogram
figure
subplot(1,2,1)
imagesc(A)
title('Test Image 1')
axis off
subplot(1,2,2)
imagesc(S2)
title('Sonogram S2')
axis off
colormap('Gray')
%% Compute and plot DFI of proj2compare.mat data
DFI... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.