text stringlengths 8 6.12M |
|---|
function varargout=closesurf(varargin)
%CLOSESURF Close a parameterized surface by concatenation.
% CLOSESURF closes a surface by concatenating the first row or column
% after the last row/column. The surface must be "closable", i.e. the
% first and the last row or column must be constant. SURFVOL will close
... |
clear all
close all
% load reference frame (frame_0) and target frame (frame_1)
frame_0 = double(imread('frame_0.jpg'));
frame_1 = double(imread('frame_1.jpg'));
[H, W] = size(frame_0); % frame dimensions
%% book-keeping variables and parameters
blk_size = 16; % block dimensions
num_blk_H = H / blk_size; ... |
classdef ImageDatastoreDispatcher < nnet.internal.cnn.DataDispatcher
% ImageDatastoreDispatcher class to dispatch 4D data from
% ImageDatastore data
%
% Input data - an image datastore containing either RGB or grayscale
% images of the same size
% Output data - 4D data wher... |
function [O_trans,Spacing,Xreg]=point_registration(sizeI,Xmoving,Xstatic,Options)
% This function creates a 2D or 3D b-spline grid, which transform space to
% fit a set of points Xmoving to set of corresponding points in Xstatic.
% Usefull for:
% - For image-registration based on corresponding landmarks like in
... |
function r = dynamic_problem_Nadj(m,s,r)
% Dynamic problem: value functions and policy functions.
r.exporter = zeros(s.y_grid_size,s.z_grid_size,s.x_grid_size);
r.y_prime = zeros(s.y_grid_size,s.z_grid_size,s.x_grid_size);
r.y_prime_ind = zeros(s.y_grid_size,s.z_grid_size,s.x_grid_size);
... |
function iNImgs = fLargePopup(cShow)
% show popup figure for selection of shown images (EvalGUI)
%
% input:
% cShow cell array with image names
%
% output:
% iNImgs selected images
%
% -------------------------------------------------------------------------
% (c) 2015: Thomas Kuestner
% --------... |
function[log_fm2, gerade2, Intcal_A0, Age_const, Age_lower_ci, Age_upper_ci, lambda] = ...
GR2_fit(depth, fm, index, Anchorpoint_age, Anchorpoint_depth, x2, y2)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Growth rate determination using the depth and radiocarbon content (fm)
... |
function [fx, fy] = plot_sinusoidal()
% Limpar a consola.
clc;
% Criar o vetor de pontos - grelha de tempo.
t = 0 : 0.0001 : 4/200;
x = 2 * cos(2 * pi * 1000 * t) + 4 * cos(2 * pi * 1200 * t);
figure;
plot( t, x);
legend (' x(t)=2 * cos(2 * pi * 1000 * t) + 4 * cos(2 * pi * 1200 * t)' );
grid on;
title( sprintf('... |
%% Task 3 - Evaluate
load ('eval.mat');
load('train.mat'); %load training data
%pre-processing data
strd_train_data = standardisation(train_data);
strd_eval_data = standardisation(eval_data);
[M,N] = size(strd_train_data);
gram_matrix = zeros(N,N);
h_matrix = zeros(N,N);
p = 1;
C =0.1 ;
threshold... |
function [sub_G,a_sub_G,xy] = create_subgraph(path_edges,G3,XY3)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
nodes = unique(path_edges,'stable');
sub_G = subgraph(G3,nodes);
xy = XY3(nodes,:);
a_sub_G=adjacency(sub_G);
end
|
%% Make a figure with two ROC's that acheive simila min PE
clear all;
close all;
nSamples = 200;
%4-D
rvH1 = prtRvMvn('mu',[0 0 2 0],'sigma',eye(4));
rvH0 = prtRvMvn('mu',[0 0 0 0],'sigma',eye(4));
x = cat(1,rvH0.draw(nSamples),rvH1.draw(nSamples));
y = prtUtilY(nSamples,nSamples);
ds = prtDataSetClass... |
TEMP_INST.uuid = 'c5ce6999-1e66-4758-81ee-567db8689a9b';
TEMP_INST.url = matlab.addons.repositories.FileExchangeRepository().getAddonURL(TEMP_INST.uuid);
TEMP_INST.fname = websave(tempname + ".mltbx", TEMP_INST.url);
open(TEMP_INST.fname);
clear TEMP_INST |
%CELL'S MIMICS SEGMENTATION CODE !!!!!!!! NO TRACKING !!!!!!! Will segment
%one image and apply the crop to the whole tiff stack. If your images are
%drifting, please apply an image registration pipeline first.
%Define the location of your Tiff stack with GFP channel. Only one channel
%color stack is supporter... |
load CE2.mat
N = size(u,1);
tsample = 0.03;
in = detrend(u,'constant');
out = detrend(y,'constant');
Z = iddata(out,in,tsample);
% Data partitioning
Zi = Z(1:ceil(N/2));
Zv = Z(ceil(N/2)+1:N);
% Estimated parameters from Exercise 2.2.1
na = 6; % number of parameters in the denominator
nb = 4; % number of parameter... |
clear;
Ns = 20;
Nt = 100;
xline = linspace(-1,1,Ns);
yline = linspace(-1,1,Ns);
A = FDLaplacial2D(xline,yline);
B = BInterior2D(xline,yline,-0.25,0.25,-0.25,0.25);
[xms,yms] = meshgrid(xline,yline);
tspan = linspace(0,11,Nt);
idynamics = pde('A',A,'B',B);
alpha = 0.5;
Y0 = 10*exp(-xms.^2/alpha^2 - yms.^2/alpha^... |
function [snrCriteria] = readSNRcriteria()
%get the SNR criteria from the root NTB folder
currentFolder = 'C:\SNRdata_NTB';
fileName = 'SNRcriteria.crit';
fullPath = strcat(currentFolder, '\', fileName);
rawData = csvread(fullPath);
snrCriteria.RMS_limit = rawData(1,1);
snrCriteria.WN_limit = rawData(1,2);
snrCri... |
function [out_bytes,varargout] = read_status_bytes(varargin)
global porta_ser
verbose = 0;
CR = char(13);
n = 45;
for i = 1:nargin
switch varargin{i}
case 'verbose'
verbose = 1;
end
end
fprintf(porta_ser,[CR,CR,CR])
pause(1)
% wake up board
fprintf(porta_ser,['s-15',CR,'g',CR,'p',CR,CR,CR])
... |
randn('seed',132);
m = 3;
n = 2;
k = 4;
A = randn(k,m);
B = randn(k,n);
C = randn(m,n);
alpha = randn;
beta = randn;
C2 = beta*C + alpha*A'*B; |
function annolist_orig = unflatten_annolist(annolist_flat,annolist_orig)
n = 0;
for imgidx = 1:length(annolist_orig)
rect_orig = annolist_orig(imgidx).annorect;
for ridx = 1:length(rect_orig)
if (isfield(rect_orig(ridx),'objpos') && ~isempty(rect_orig(ridx).objpos))
n = n + 1;
r... |
function [ ] = authenticate( im_orig, im_forge, im_test )
%Authenticates an image
% Given an original and a forged image it extracts feature vectors out of these and trains an SVM. Then it extracts feature vectors out of the test image and calculates a score - percentage of correct labels
display('Extracting Feature... |
function recsurf = surfReconstruct(normal,scale)
[m,n,~] = size(normal);
normal=imgaussfilt(normal);
slant = zeros(m,n);
tilt = zeros(m,n);
for i = 1:m
for j = 1:n
normalT = squeeze(normal(m+1-i,j,:));
slant(i,j) = acos(normalT(3));
tilt(i,j) = sign(normalT(2)) * acos(normalT(1));
end... |
clc
clear
h = 0.01;
x = 0 : h : 10;
n = length(x);
y_sin = sin(x);
der = first(y_sin, h);
y_cos = cos(x);
x_plot = 0 : 0.01 : 10;
y_cos_plot = cos(x_plot);
% скорость сходимости
max = max_deviation(der(1 : n-1), y_cos(1 : n-1));
alpha = log(max)/log(h)
plot(x(1 : n-1), der(1 : n-1), 'r', x_plot, y_c... |
function [rain_field_esti,is_par,Incentive_rec_rec]=ABM_share_budget(rain_field_true,radar_field,gauge_xy,...
budget,alpha_P,max_par,min_par,rate,...
X,Y,folder,loop_ID)
N_event=length(rain_field_true);
N_agent=length(max_par);
% model warm up
total_par_warmup=zeros(2... |
clc;
clear;
close all;
%% Receive sequence
% homeword
m = 6;
t = 4;
r_coeff = [36 4 33 21 56 52 47 13 39 0 5 11 37];
r_power = [0 1 2 3 4 5 6 7 8 9 10 23 60];
% textbook example
% m = 4;
% t = 3;
% r_coeff = [1 5 11];
% r_power = [7 5 2];
%% Syndrome
S_terms = -Inf(2*t,length(r_power));
S = -Inf(2*t,1);
for i = 1:2*... |
disp('Reading data and performing statistics');
setNifti;
pkg load image;
pkg load statistics;
pkg load optim;
curdir = pwd;
cd('/home/jovyan/work');
unix('tar -xvf /home/jovyan/work/dogSC_data.tar.gz');
addpath('/home/jovyan/work/Users/Agah/Desktop/OctaveJN/scn_rscn');
cd(curdir);
% ------------------ READ AND LOA... |
function d = log10(p1)
%PREAL/LOG10 Overloaded logarithm function for class preal.
global useUnitsFlag
if ~(useUnitsFlag) % If physunits is disabled...
d=log10(double(p1)); % ... treat as double.
return
end
tol=0.001;
d=ones(size(p1));
for k=1:numel(d)
if any(abs(p1(k).units)>tol)
e... |
function m = matvec_double_layer_mobility(X, domain)
% MATVEC_DOUBLE_LAYER_MOBILITY: perform a matrix vector product using the
% double-layer formulation to compute the mobility problem on an unbounded
% domain, i.e. u_bg(x) = -q/2 + -D[q](x) - u_trans - omega(x - c)^\perp.
% Here u_bg is the backgroudn flow, u_tran... |
b=fopen('Senoidal_AltFijo.txt', 'wt');
load Senoidal_Alt.txt
for i = 1:601;
binario = Decimal_a_PtoFijo(Senoidal_Alt(i), 14, 23);
fprintf(b, '%s \n', binario);
end
fclose(b); |
function [ output_args ] = make_matrices(count)
for i = 1:count
check_random_symbols_4_strong;
check_random_symbols_4_weak;
check_random_symbols_5;
i = i + 1;
end
|
function peassignment = getpeassignment(schedule)
%peassignment = getpeassignment(schedule)
% Operand types that we don't assign to a PE
noassign = [1 2 6];
schtime = schedule(1,1);
% Remove types that shall not be assigned to a PE
processes = schedule(2:end, :);
for i = noassign
processes(processes(:, 1) == i, ... |
function [max_r,ind] = lp_s(p,set)
%
% Computation of the maximal magnitude of the rational ADI function over
% a discrete subset of the left complex half plane.
%
% Calling sequence:
%
% [max_r,ind] = lp_s(p,set)
%
% Input:
%
% p vector of ADI parameters;
% set vector representi... |
clear all;
P = [1 2 3 4 5 6 7];
Tc = [1 2 3 2 2 3 1];
T = ind2vec(Tc) %将数据索引转换为向量组
net = newpnn(P,T);
Y = sim(net,P)
Yc = vec2ind(Y) %将向量组转换为数据索引
|
close all
clear all
time = load('time.txt');
orient = load('orientation.txt');
% pressure = load('Pressure.txt');
%fib_stress0 = load('fib_stress0.txt');
%fib_stress = load('fib_stress5000.txt');
%fib_type = load('fib_type5000.txt');
%fib_rads = load('fib_rads5000.txt');
%init_lens = load('init_lens5000.txt');
phi=... |
function [x,y,z] = spin(jv,qv,iterations,limit,m,n,d,mit)
syms x y z x0 y0 z0;
rand;
if d == '2d'
theta = (pi/2)*ones(m,n);
else
theta =(pi/2)*rand(m,n);
end
phi = 2 * pi * rand(m,n);
x = sin(theta).*cos(phi);
y = sin(theta).*sin(phi);
z = cos(theta);
zp = ones(m,n);
p(limit) = zeros;
... |
clear all;
close all;
clc;
im = imread('pattern_noise3.tif');
im = double(im);
figure;
subplot(1,2,1);imhist(uint8(im));title("histogram");
subplot(1,2,2); imshow(uint8(im)); title("original");
|
function [rectifiedImage] = apply_H (I, H)
Hinv = inv(H);
corners = [1, 1, columns(I) , columns(I) ;
1, rows(I) ,1 , rows(I) ;
1, 1 ,1 , 1 ]
rectifiedCorners = H * corners
minCol = min(floor(min(rectifiedCorners(1,:))),1);
maxCol = max(ceil (max(rectifi... |
% This code tests various inversion schemes on a simple linear regression
% model and compares results.
%
% YQW, Nov 21, 2019.
clear all; close all;
addpath(genpath('../'));
set(0,'defaultlinelinewidth',2);
rng(16); % for reproducibility
%% generate true model
Nvars = 2; % number of model parameters
... |
%Carga de las muestras de entrenamiento
load('training.csv');
X = training(:,1:28);
Y = training(:,29);
load('testing.csv');
X = [X;testing(:,1:28)];
Y = [Y;testing(:,29)];
% Se generan los conjuntos de sobremuestreo de cada clase y se selecciona
% el 12% de muestras nuevas (por clase) para formar parte del nuevo
% co... |
function test_structgrad()
% Create a problem
A0 = randn(10) + 1i * randn(10);
A = @(z) A0 + diag(z(:));
b = randn(10, 1) + 1i * randn(10, 1);
B = @(x) diag(x(:));
d = @(x) b - A0 * x;
% Test equivalence of (A, b) and (B, d).
x = randn(10, 1) + 1i * randn(10, 1);
z = randn(10, 1);
... |
function [ x_lin ] = lin( x_db )
%% Convert from decibels to linear units
% :param x_db: The value in decibels.
% :return: The value in linear units.
%
% Created by: Lee A. Harrison
% On: 6/18/2018
%
% Copyright (C) 2019 Artech House (artech@artechhouse.com)
% This file is part of Introduction to Radar Using Python and... |
% Fig. 6.2 Feedback Control of Dynamic Systems, 5e
% Franklin, Powell, Emami
%
clear all;
close all;
clf
num=[1 1];
den=[.1 1];
[mag,ph,w]=bode(num,den);
figure(1)
subplot(2,1,1),loglog(w,mag),grid
title('Fig. 6.2 (a) Magnitude'),ylabel('Magnitude')
subplot(2,1,2),semilogx(w,ph),grid
title... |
function a=AFun(r,z,t)
%Heat Source
global eV nm ps Ce Ca KeV KeH KaV KaH g;
global rMin rMax zMin zMax Nr Nz rNum zNum dr dz tBegin tEnd Nt dt;
global M C T1 T0; %T1 is the Temp at next time, T0 is now Temp
global nT Tmax; %nT total number of rearrangement atoms; Tmax the max Temp during process;
global Ea Na v... |
function x = decay(x0,tau,tf,dt)
t=[0:dt:tf-dt,tf].';
x=x0*exp(-t/tau);
end
|
function U6_logger(fname,dt)
%
% U6_logger(fname,dt)
%
ljud_LoadDriver; % Loads LabJack UD Function Library
ljud_Constants; % Loads LabJack UD constant file
[Error ljHandle] = ljud_OpenLabJack(LJ_dtU6,LJ_ctUSB,'1',1); % Returns ljHandle for open LabJack
Error_Message(Error) % Check for and display any Erro... |
function L = Compute_Lap_Mat(descr, param)
% EVALUTATE THE LAPLACIAN MATRIX
% when we use dense sifts on a gride.
% The output is the combination of the Laplacian matrices at different
% scales.
printMessage('Computing Laplacian matrix (mex file)....', 0 , mfilename, 'm');
I=cell(param.nPics,1);
J=cell(param.nPics,1);... |
function sg_clock()
global currname totaltimes startt names order nstories storytimes storyname cstorystart
currname = 1;
totaltimes = zeros(size(names),'double');
ta = datevec(now);
startt = ta(4:6);
nstories = 0;
storytimes = 0;
cstorystart = 0;
storyname{1} = '';
fh = figure('Name','Subgroup Clock','... |
function [] = BLPlot(Mag, Height, UnitChoice)
%Boundary Layer Plot
semilogy(Mag, Height);
title('Boundary Layer Plot')
switch UnitChoice
case 1
xlabel('Wind Speed, m/s')
ylabel('Height, m')
case 2
xlabel('Wind Speed, mph')
ylabel('Height, ft')
end
end
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Author: Hamza Bourbouh <hamza.bourbouh@nasa.gov>
% Notices:
%
% Copyright @ 2020 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration. All
% Rights Reserved.
%
% Disclaimers
%
% No Warranty:... |
x = 0:pi/100:2*pi;
y = sin(x);
plot(x,y)
hold on
y2 = cos(x);
plot(x,y2,':')
legend('sin','cos')
hold off |
## Copyright (C) 2021 Robertson
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is dist... |
clc; clear; close all
pkg load image
A = [0 0 0 0 0;
0 1 1 0 0;
0 1 1 0 0;
0 0 1 0 0;
0 0 0 0 0];
B = strel('diamond', 1)
C = imdilate(A, B) |
% Taxa de bit
R = 1000;
% Número de amostras por bit na simulação
N_amostras_bit = 100;
%frequência de amostragem da simulação numérica
fs = 100e3;
%período de amostragem da simulação
ts = 1/fs;
% duração dos impulsos: tempo de bit
Tb = 1/R;
%tempo de simulação 100ms
tsim = (1000e-3);
% Nbits, número de bits tota... |
clc;
clear;
close all;
% Load the plant
load ohm100.mat
load ohm50.mat
load ohm10.mat
load ohm200.mat
G1 = ohm100_10kHz;
G2 = ohm50;
G3 = ohm10;
G4 = ohm200;
% Sampling period
Ts = G1.Ts;
A = G1.A; B = G1.B; C = [0 1];
ref = 5; %5V steady state voltage
Q = [50,0;0,1];
R = 1;
% Steady state values computation
val_s... |
%@(#) p2c.m 1.1 98/12/08 14:25:29
%
%p2c Convert decimal-point to decimal-comma
%function function str2=p2c(str1, formatstr)
% str1 - input floating point
% formatstr - format for floating point ex. %7.2f.
% str2 - output string
% Example:
% fprintf(fid,'Total: %s\n', p2c(value,'%15.... |
function v = cdiff(x,dt)
% Fourth order central finite difference
v = zeros(size(x,1),3);
for i = 3:size(x,1)-2
v(i,:) = (-x(i+2,:)+8*x(i+1,:)-8*x(i-1,:)+x(i-2,:))/(12*dt);
end
|
function i = index_mcall_initial
i.file_index = 1;
i.est_pos_err = 2:4;
i.est_vel_err = 5:7;
i.est_angles_xyz_err = 8:10;
i.est_rates_dps_err = 11:13;
i.mass = 14;
i.flr_15k_percent_error = 15;
i.flr_15k_range_max = 16;
i.st_noise = 17;
i.cam_integ... |
function E = distance_tsrvf_se3(h1,h2)
%h1 is a point on the lie algebra, expected to be 6xT matrix
% T = size(h1,2);
% d = 0;
% for t = 1:T
% d = d + h1(:,t)'*h2(:,t);
% end
% E = d;
% E = sqrt(E/T);
E = norm(h1(:) - h2(:));
T = size(h1,2);
E = sqrt(E/T); |
function convertImagesToJpg()
imageLoc = readImageLoc();
ss = size(imageLoc);
n = ss(1);
for i = 1:n
name = imageLoc(i,:);
A = imread(name,'pgm');
h = figure;
name = num2str(i-1);
fname = strcat('D:\Semester 8\Numerical Algorithms\Assignment 2b\ConvertedImages\', ... |
function [rfSigmas, rfGain, hiResConeActivationMap, hiResPSFsupportDegs] = fitActivationMapForDeconvolution(functionName, coneActivations, conePosDegs, coneAperturesDegs, thePSFsupportDegs)
deltaX = thePSFsupportDegs(2)-thePSFsupportDegs(1);
minConeCharacteristicRadiusDegs = 0.5*min(coneAperturesDegs)/3;
... |
clc; clear;
path = ['C:\Users\', getenv('USERNAME'), '\OneDrive\EPFL\Code\HandModel\data\convsegments\'];
load([path, 'radii']);
load([path, 'blocks']);
load([path, 'centers']);
pose.centers = centers;
neighbours = [2, 1];
tangent_points = cell(length(blocks), 1);
[bounding_box.min_x, bounding_box.min_y, bounding_box... |
%%
% Metode untuk mencari akar x untuk suatu fungsi f(x). Cara pakenya misalnya:
% Nyari akar buat fungsi: f(x) = e^x - 3x
% metode_secant(@(x) exp(x)-3*x, 1, 2, 10)
%
% @param f Fungsi dari persamaan yang akan dicari akar x-nya.
% @param x_a Nilai x_i-1.
% @param x_b Nilai x_i.
% @pa... |
classdef ConstraintList
properties (SetAccess=public , GetAccess=public)
FinalTime
StepLength
StepWidth
StepHeight
ForwardWalkingSpeed
PhaseVariableDerivative
SlewRate
Trajectory
... |
function varargout = test(varargin)
% TEST MATLAB code for test.fig
% TEST, by itself, creates a new TEST or raises the existing
% singleton*.
%
% H = TEST returns the handle to a new TEST or the handle to
% the existing singleton*.
%
% TEST('CALLBACK',hObject,eventData,handles,...) calls the l... |
function [] = nsht_plot_sampling(SHOW_ANTI)
% nsht_plot_sampling - Plots the sampling points on the sphere over the
% surface of the sphere. For the spectral multi-shell sampling scheme.
% Plots first the actual samples and then the antipodal points in a lighter
% shade if SHOW_ANTI = 1, just plots actual samples othe... |
function rho=brine_density(P,T,m,xx);
phi_V0=18.22;
A=2.5830;
B=-0.2624;
C=0.01598;
D=1.4270;
E=-0.4265;
F=-0.004437;
G=0.001353;
H0=-631.89E-4;
H1=3.254E-4;
H2=0.0047E-4;
I0=470.26E-4;
I1=-2.668E-4;
I2=0.0039E-4;
Av=1.8743;
term1=0;
term2=0;
T0=298;
P0=1.01325;
m=m/2;
P=P/145.038; %convert P... |
%% Poisson 1D Solver 3rd Example
clc;
clear all;
a = 0;
b = 2;
N = 6;
p = 2;
resol = 0.01;
lvl = 4;
obj = thbSplBasML(a,b,p,N,resol,lvl);
f = @(x) exp(x);
g = @(x) -exp(x)+7.3890561*x+1;
dBC = boundCond('Dirichlet','Neumann',0,0);
% plotBas(obj);
refArea = [1 2];
obj.ThbRefinement1DML(1,refArea)... |
function [tw, tv] = total_weight(vol, wd)
% tw = sum(vol .* wd); %array multiplication
tv = sum(vol);
tw = vol * wd'; % matrix multiplication
end |
function [ B ] = bernoulli_divergence_weighted( F, D, a )
%BERNOULLI_DIVERGENCE Summary of this function goes here
% Detailed explanation goes here
if nargin < 3
a = 0;
end
weighted = nargin > 1 & a ~= 0;
K = F.PDocs + 1;
J = F.NDocs + 1;
N = K + J;
P = K./N;
L = P.^K;
L = L.*(1-P).^J;
from = 1;
C = size(F,1)... |
function [acov, var, cov_h, cov_v] = autocov(im)
% Input argument: im - input image of type double [0..1]
% Output arguments: acov - autocovariance matrix
% var - variance
% cov_h - horizontal covariance
% cov_v - vertical covariance
neighborhood = 11;
nh2 = floor(neighborhood/2); % Neighborhood: nh2 elem. for... |
function [p300_features,non_p300_features]=extract_features(y,trials,letters) % y is input matrix
y=y';
% letters = 1:35 for offline
% letters = 1 for online (since we classify one letter at a time)
% EEG is sampled at 256Hz from 8 sites % P300 Speller Matrix Paradigm is used
filterorder=3;
filtercutoff =[0... |
function [dimR, center_roi]=rect_Stair(vsEdgesLeft)
% returns a rectangular representing the rigion of interest given by a
% group of interesting edgelets.
sum_vPts=0;
sum_u=0;
sum_v=0;
for i=1:length(vsEdgesLeft)
sum_vPts=sum_vPts+length(vsEdgesLeft(i).vPts_un);
sum_u=sum_u+sum(vsEdgesLeft(i).vPts_un... |
function loc_3d_quarter_sphere(NumOfSamples)
% Create Localized Semi - Spherical 3-d data from uniform distribution.
% Data are bount to the neighborhood near a sphere surface.
% Sphere surface equation:
%
% (x-x0)^2 + (y-y0)^2 + (z-z0)^2 = r^2
%
% The created data are bound in a spherical shell r1<=Da... |
function psi = psifunc(centers,x,dis)
%This function is the psi second order spline function
% If other orders are desired, this function can be replaced
% centers are the knot locations
%x is a nxd matrix where d is the dimension and n are the number of points
%dis is an optional distance matrix. If it is not sup... |
function P = db2pa(dB)
%% DOCUMENTATION TABLE OF CONTENTS
% I. OVERVIEW
% II. REQUIREMENTS
% III. INPUTS
% IV. OUTPUTS
%%
% I. OVERVIEW
% This function converts a vector of sound pressure level values expressed
% in dB SPL to a vector of sound pressure level values expressed in
% pascals.
% II. REQUIREMENTS
% None (... |
function [x]=q1a(a,b,c)
[y] = sqrt(a.^2 - b.^2);
[z] = exp(5) - c;
[x]=y/z
end |
function y = g_protoype(u, varargin)
%% y = g_protoype(u, varargin)
% TODO
%% ##### parse input arguments
% TODO
p = inputParser;
addRequired(p,'G');
%addOptional(p,'opt',defaultOpt,@isnumeric)
parse(p,u,varargin{:})
u = p.Results.G;
%opt = p.Results.opt;
%% ##### functi... |
function [A] = quantize(A, level)
% To reduce the level of rgb image
% Input paramater A is an 256 level rgb image
% Input paramater level means the target level
n = double(256) / level;
R = A(:,:,1);
G = A(:,:,2);
B = A(:,:,3);
fr = floor(double(R) / n);
fg = floor(double(G) / n);
fb = floor(double(B) / n);
... |
function [txt] = function_template( )
% FUNCTION_TEMPLATE Provides a template for function help entries
%
% [txt] = function_template( )
%
% `function_template` returns the template as a string vector `txt`.
%
%
%
txt = [] ;
% should also be able print to a new file.m (w/out overwrite option)
%
% DEFAULT.li... |
% This script analysis relation between blocklength and BLER
% Find optimal blocklength first
% Show BLER against blocklength
clc; clear variables; close all;
N = 1e6;
N1 = 80;
N2 = 80;
eplsion1R = 10^-5;
eplsion2R = 10^-4;
Pt = 20; %Transmit Power in dBm
pt = (10^-3)*db2pow(Pt); %Transmit Powe... |
classdef RegistrationFacade < mlfsl.RegistrationFacade
%% REGISTRATIONFACADE
% $Revision$
% was created 15-Feb-2016 17:06:46
% by jjlee,
% last modified $LastChangedDate$
% and checked into repository /Users/jjlee/Local/src/mlcvl/mlraichle/src/+mlraichle.
%% It was developed on Matlab 9.0.0.307022 (... |
%de Boorによる3次の双スプラインの定数a0,0~a3,3を求める連立方程式で使用する行列を取得
function[Q] = matrixForEquations()
degree = 3; %3次の双スプライン
size = (degree + 1)^2;
Q = zeros(size, size);
for row = 1 : size
parameters = parametersForDifferential(row);
for col = 1 : size
deg_x = floor((col - 1) / 4); % ... |
function Tx = partitions( sz, k )
PT = k; % assuré pr chaque classe au moin 1 element
C = [];
Ci = 1;
C(Ci) = 1;
Ci = Ci + 1;
min = 1;
max = sz;
for i=1:k-1
r = randi([min max-PT], 1, 1)
C(Ci) = r+C(Ci-1);
Ci = Ci + 1;
max = max - r;
PT = PT - 1... |
clear all;
clc;
%Erwthma 3-(b)
k=1;
for i=7:12
n=2^i;
%(ii) tridiagwnio matrices
upo_diag=rand(n-1,1);
kuria_diag=rand(n,1);
uper_diag=rand(n-1,1);
Aii=[diag(upo_diag,-1)+diag(kuria_diag)+diag(uper_diag,1)];
upo_diag=rand(n... |
function viewProjectedImage(path, eigFac, avg)
omega = computeProjectionInEigenFaces(eigFac,avg,path);
ss = size(eigFac);
n = ss(1);
m = ss(2);
u = zeros(n,1);
for i = 1:m
u = u + omega(i)*eigFac(:,i);
end
u = mat2gray(u);
u = reshape(u, 286,384);
imshow(u);
end
|
classdef deq
properties
f;
tspan;
y0;
end
methods
function [t, y] = sol(obj)
[t, y] = ode45(obj.f,obj.tspan,obj.y0);
end
end
end |
%% Version description
% v12.1:
% 1. RKF23 adaptive time integration implemented in getRho
%% Do outer iteration loop
%% setup exit criteria for outer iteration loop and some outer loop and
% inner loop options
if ~do_newton & ~do_basic_rho_update
max_out_it = 1;
end
% setup parameters for newton... |
clear all
clc
%% outline
% show en and ch result
%
% use XP ser to train ANN
% random choose the ser.
% 6000 ser + 2000 rmsd
%% en %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clf
k=3;
tr_rat=1;
tr_rat_str=mat2str(100*tr_rat);
i=1;
nnt_epochs_en=7500;
fi_na=['../res_data/en/en_atom_dis_ra... |
% function [outputArg1,outputArg2] = perform_circle(data,data_sea_surface,data_under,segment,num_seg,start_id,end_id)
function perform_circle(data,data_sea_surface,data_under,segment,num_seg,start_id,end_id)
%UNTITLED2 此处显示有关此函数的摘要
% 此处显示详细说明
for i = start_id:end_id
if i-num_seg<start_id
st_id = start_id... |
% This function outptus the calculated values for a frame set.
% First at least N different people both in the PD and Healthy class are
% considered and then given a frame count, the frames in an interval with
% that length around the center frame are considered for analysis, this
% gives us 2 * frame_count + 1 for eac... |
function [dist]=Distance(xx)
ND=max(xx(:,2)); NL=max(xx(:,1));
if (NL>ND)
ND=NL; %确保 DN 取为第一二列最大值中的较大者,并将其作为数据点总数
end
N=size(xx,1); %xx 第一个维度的长度,相当于文件的行数(即距离的总个数)
for i=1:ND
for j=1:ND
dist(i,j)=0;
end
end
for i=1:N
... |
% input:
% grid=NeighbourValue(idx,grid)
function grid=NeighbourValue(idx,grid,step)
if isempty(idx),return;end
if ~exist('step','var'),step=1;end
neighbouredMeanedGrid=getMean(grid);
grid(idx)=neighbouredMeanedGrid(idx);
if mod(step,100)==0, disp(['blending in nans. Recursion level: ' num2str(step)]); end
%% rec... |
function [output,T,S,D] = GraphD(DiffusionCoefficients,Speeds,OBJT,LENST)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
LT=cellfun(@(x)strrep(x,'p','.'),LENST,'UniformOutput',false);
OT=cellfun(@(x)strrep(x,'p','.'),OBJT,'UniformOutput',false);
T=cellfun(@(x,y)mean([str2double(x),str2... |
%%%TESTING
load("train.mat");
X = X_train_bag;
Y = Y_train;
% [X_most_freq] = mostusedwords(X_train_bag);
costs = [0 3 1 2 3; 4 0 2 3 2; 1 2 0 2 1; 2 1 2 0 2; 2 2 2 1 0];
K = 10;
err_vec = zeros(K,1);
joy= X(Y==1, :);
sadness = X(Y==2, :);
surprise = X(Y==3, :);
anger = X(Y==4, :);
fear = X(Y==5, :);
cv_index_all = cro... |
function [ args ] = formatparams( valdelim, paramdelim, params)
%FORMATPARAMS Summary of this function goes here
% Detailed explanation goes here
argNames = params(1:2:end);
argValues = params(2:2:end);
argValues = cellfun(@(x) str(x), argValues, 'UniformOutput', false);
args = {argNames{:}; argValues{:}};
args = a... |
clear all;
% clc;
addpath(genpath('gpml-matlab-v3.1-2010-09-27'), '-end');
addpath(genpath('Netlab'), '-end');
addpath(genpath('utils'), '-end');
%rand('seed', 12);
%randn('seed', 24);
cov_func = 'covSEiso';
n_expts = 5;
hyp_mean = [0.6;0.6];
n_class = 3;
[x, y1, n_class, Hyps] = generate_data(hyp_mean, cov_func... |
function sst=fct_sst_toy5(model)
% Create a simple temperature gradient
%
model.odg_b=1;
model.k_inf_on_k1 = 4;
model.slope_b_ini = -5;
sst = init_Spectrum(model);
figure;imagesc(sst');axis xy;axis equal;
% keyboard;
% odg_b = 1e-3;
%
% [sigma_on_sq_dt,f_sigma,a0_on_dt,spectrum_sigma,spectrum] = fct_random_tracer(m... |
%% FUNCTION missHistogram
% display histogram of missing data percentage
% @param runs: [run1: Int, run2: Int, ...] - selected indexes of run
% @param condition: String - {"cues" or "rewards"}
% example usage: missHistogram(ALLEEG, [1,2], "rewards")
function missHistogram(ALLEEG, runs, condition)
histData = [];
... |
clear; clc; close all
%% Setup
addpath(genpath('./SupportingScripts'));
X = 1;
Y = 2;
Z = 3;
% %% Generate Fake Data
% thet = 0 : pi/10 : 2*pi;
% thet = thet';
% test = [(cos(thet)+1), zeros(length(thet),1), (sin(thet)+1)]; %Center at (1,0,1)
%% Load Data
%Data
% d15 = [0.0129, -0.06, 0.232, 39; ...
% -0.085,... |
function [pass,maxerr] = test(opt)
% Check that fitbackground() can fit polynomials
clear fitbackground
t = linspace(0,3,100).';
bckg = polyval([-1 1],t);
bckg2 = polyval([-1 -1 1],t);
bckg3 = polyval([-1 -1 -1 1],t);
data2fit = bckg(1:end);
data2fit2 = bckg2(1:end);
data2fit3 = bckg3(1:end);
tstart = t(1);
[fit,la... |
% FILE: Ex1.m
% NAME: [LUKE JIANG]
% DESCRIPTION: Matlab Variables and Basic Operations
% Clear all variables and close all windows
clear all;close all;
% PART A
y1 = [4; 6; 2];
z = [1 1 1; 3 6 9; 0 0 0];
% PART B
c = y1(2)
c1 = y1(2:3)
% PART C
d = z(2,3)
z(3,2:3) = -1
% PART D
e = size(y1,2) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.