text stringlengths 8 6.12M |
|---|
function errorRate = Part2_OOK(SNR, showFigures)
% To run function type in the following commands in command prompt
% Part2_OOK(5, 0) => Provides error rate for OOK with SNR 5 without figures
% Part2_OOK(5, 1) => Provides error rate for OOK with SNR 5 with figures
SIZE = 1024; %Number of bits to be transmitted
origin... |
function[data] = construct_data()
fout = fopen('Data.csv', 'wt');
in_filenames = {'aps_failure_training_set_processed_8bit.csv', 'aps_failure_test_set_processed_8bit.csv'};
for K = 1 : length(in_filenames)
thisfile = in_filenames{K};
fin = fopen(thisfile, 'rt');
while true
thisline = fgetl(fin);
if ~ischa... |
function [caminho, i, j] = frentePraBaixo(imagem, currenti, currentj)
caminho = imagem;
direita = [1 0 0 0 1,
0 0 0 0 1,
0 0 0 0 1,
0 0 0 0 1,
1 1 1 1 1];
esquerda = [1 0 0 0 1,
1 0 0 0 0,
1 0 0 0 0,
1 0 0 0 0,
1 1 1 1 ... |
function [ Temperature ] = thermalsimGauss( p, mediumX, mediumY, leftBound, rightBound, topBound, bottomBound )
%THERMALSIMGAUSS solves the 2D steady state thermal problem using Gaussian
%elimination
% INPUT:
% p: discretized power density
% mediumX: x-dimension of the medium
% mediumY: y-dimension... |
%% Optical flow evaluation demo
%
% Computes flow field between two images using various methods and display it
% (deepflow, simpleflow, sparsetodenseflow, Farneback, TV-L1).
%
% <https://github.com/opencv/opencv_contrib/blob/3.1.0/modules/optflow/samples/optical_flow_evaluation.cpp>
%
%% Input images
% a pair of 8-bi... |
clc
clear all
xlog(1,1) = .311;
for k=2: 16+2
Alog=4; % Parameter of map
xlog(1,k)=mod(Alog*xlog(1,k-1)*(1-xlog(1,k-1)),1);
end
im = double(rgb2gray(imread('/Users/INNOCENTBOY/Downloads/videos/Imageprocessing/week6/original_cameraman.jpg')));
% Mu=3.999; % Parameter of map
% xlog1= 20;
% ylog1= 22;
% z... |
function [ cl ] = C(xd, yd, zd, ancore )
cl = [ 2*(xd -ancore(1,1)) 0 0 2*(yd- ancore(1,2)) 0 0 2*(zd-ancore(1,3)) 0 0
2*(xd -ancore(2,1)) 0 0 2*(yd- ancore(2,2)) 0 0 2*(zd-ancore(2,3)) 0 0
2*(xd -ancore(3,1)) 0 0 2*(yd- ancore(3,2)) 0 0 2*(zd-ancore(3,3)) 0 ... |
function[textComponents, componentBboxes] = filterComponents(strokeWidthImg, components)
% This function performs some fairly flexible tests based on some fairly general rules
% on connected components of swt image.
%
% Usage:
% textComponents = filterComponents(strokeWidthImg, components)
... |
function [noctimg medline] = splitnormalize(octimg, params, mode, medline)
% SPLITNORMALIZE An OCT BScan is normaized differently in the inner and
% outer part
% [RESOCTIMAGE MEDLINE] = splitnormalize(OCTIMAGE, MODE, CUTOFF)
% Partnorm: Norms the inner and outer part of an circular B-Scan different.
% OCTIMAGE: The inp... |
function [A,t] = Q2MatForm(obj,q)
%Q2MatFormSummary of this function goes here
% Detailed explanation goes here
shape = obj.Q2Shape(q);
ann = obj.Shape2Ann(shape);
[A,t] = obj.ComputeSimilarityMatrixForm(ann);
end
|
f = @(x,y) -0.5*exp(x/2).*sin(5*x) + 5*exp(x/2).*cos(5*x) + y; % anonym beskrivelse av høreside-funksjonen (obs: vi bruker x istf t som variabel).
x0 = 0; y0 = 0; % Initialverdien (løsningsfunksjonen skal gå igjenom punktet (0,0))
ytrue = @(x) exp(x/2).*sin(5*x);
n = 80; b = 8;
[x, y] = Euler(f,x0,y0,b... |
clear,clc
load 'JPCNN001_small.mat';
%Extracting chest x-ray image
I = jrst.cxr;
in = I;
out = my_local_contrast(in,51,16);
[ gain_in, bias_in, im_in ] = im(in,1);
[ gain_out, bias_out, im_out ] = im(out,1); |
% this directory holds the mat files arising from the simulation results
|
% TREEORD ツリーの次数
% ORD = treeord(T) は、ツリー T の次数 ORD を出力します。
%
% 参考 WTREEMGR.
% Copyright 1995-2004 The MathWorks, Inc.
|
% ------------------------------ Signal in time domain ---------%
[y,fs] = audioread('NoisySpeech-16-22p5-mono-5secs.wav');
%y = samples
%fs = sampling frequency
t=linspace(0,length(y)/fs,length(y));
%linspace = creating time vector
%0= start time
%length(y)/fs = end time
%length(y) = number of samples in y
Nfft=leng... |
%
% Implement of SVD paper,
% run and save results
%
addpath('/cewit/home/shhan/MATLAB/ThridParty')
filename='iconx_10572_417.csv'
G = csvread(filename,1,1)
% data imputation
G = knnimpute(G)
save('G.mat','G')
% plot boxplot
fig1 = figure(1)
boxplot(G)
title('boxplot of data set')
saveas(fig1,'boxplot.pdf','pdf')... |
function h = outputFunction(XZ,user_data_struct) % h is a 'vector valued' function.
X = XZ(1:user_data_struct.n_diff); % extract the 1st n_diff variables (pure state vector) from the user data struct
h = X(1:user_data_struct.n_outputs); % in this specific example, the 1st four states (differential variable... |
function [output] = clear_boundary(Im)
%CLEAR_BOUNDARY 对图像进行预处理,去除其边缘,求出其最小外接矩形,定位关键图像
% 此处显示详细说明
[m,n] = size(Im);
% 先去边框,试探空格
exist = [];
for i = 1:n
tmp = find(Im(:,i)== 0);
exist(i) = ~isempty(tmp);
end
% 分块
part = [];
sflag = 0;
eflag = 0;
for i = 1:length(exist)
if(exist(i)==0 && sflag ==0 && efl... |
function [Xmin, fmin, Xall, errcount] = ...
dijkstra_binarySearch(str_labelFileName, varargin)
% NAME
%
% function [Xmin, fmin, Xall, errcount] = ...
% dijkstra_binarySearch(str_labelFileName, ...
% varargin)
%
%
% ARGUMENTS
% INPUTS
% str_labelFileName string FreeSurfer label file
% describing reference
... |
function [fastring,fastringrad,ringrad,OAM,SigmaMat]=...
CreateFastRing_OAMThick_Sig_UseFullTracking(...
ring,RFVolt,hnum,nusp,filename,rotatify,radflag,subdir)
%
%
%
%
% ringrad=atsetcavity(atradon(ring),RFVolt,1,hnum)
indcav=findcells(ring,'Class','RFCavity');
cav=ring(indcav(1));
ring(indcav)=[];
ring=[cav;... |
function [sd]=standard_deviation(N,i,j)
A=2;
B=N*N/(2*log(200));
pow=((i-N/2)*(i-N/2)+(j-N/2)*(j-N/2))/B;
sd=A*exp(-1*pow);
|
% Plot SCOPE time-series run
work_dir = '/Volumes/XiYangResearch/src/SCOPE/SCOPE_v1.53/output/Kenia_2010_2015-04-05-1614/';
PSN = dlmread([work_dir 'fluxes.dat'],'',[2,10,2920,10]);
t = dlmread([work_dir 'fluxes.dat'],'',[2,3,2920,3]);
SIF760 = dlmread([work_dir 'fluorescence.dat'],'',[2,760-640+1,2920,760... |
%% Plot VD vs VPD50
% VPD50 is calculated in "PostAnalysis.m"
figure(61);
clf('reset');
set(gcf,'Position',[391 1 873 805]);
figure(62);
clf('reset');
set(gcf,'Position',[391 1 873 805]);
figure(63);
clf('reset');
set(gcf,'Position',[391 1 873 805]);
%Convert day into day&week. 70 colors are too much.
TP2Day = ... |
function write_config(handles, psd_info)
config.sampRateMenu = get(handles.sampRateMenu,'Value');
config.IRIGtimeMenu = get(handles.IRIGtimeMenu,'Value');
config.latMagText = get(handles.latMagText,'String');
config.longMagText = get(handles.longMagText,'String');
config.latMenu = get(handles.latMenu,'Value');
config.l... |
function fbank = ctrl_triangularFilterBank(Fl,Fh,N,Fs,sampleLength)
%The function return Mel Filrets and Square Filters
%transform frequency to mel
% fmelL - lower frequency
% fmelH - upper frequencies
% ctrlPointFilt - number of chalk filters
% n - reference points
% FMel - frequency step
nMelFilt=N;
fmelL=1127*log(1... |
function Pattern_Recognition
global pattern image Z X Y
pattern=imread('ball.jpg');
image=imread('Background.jpg');
%Scan images into global variables
[m,n,k]=size(pattern);
image=imrotate(image,180);
[M,N,K]=size(image);
figure1;imagsc(image);
%set up variables used through out program.
%failed attempt to use Lu Tabl... |
function x = arcsigm(y)
x = log(y./(1-y));
return; |
function compileObjective(obj, cost, export_path, exclude, varargin)
% Compile and export symbolic expression and derivatives of all NLP functions
%
% @note If 'cost' is emtpy, then it will compile all cost functions.
%
% Parameters:
% cost: the cost function to be compiled @type cells... |
close all;
clear all;
clc;
%graphics_toolkit('gnuplot');
T=302; %Initialize the parameter
%Tr1=40;
%Tr=298;
%S=[100 80 60 40 20]; % Different value of Solar Radiation
%S=70;
%ki=0.00023;
%Iscr=3.75;
%Irr=0.000021;
k=1.38065*10^(-23);
q=1.6022*10^(-19);
A=2.15;
%Eg0=1.166;
%alpha=0.473;
%be... |
function t = reverse2(s)
% Recursive version of string reversion.
% s is the string to be reversed.
len = length(s);
if len == 1 % base case
t = s;
else % recursive case
t = [s(len) reverse2(s(1:len-1))];
end |
clear all, close all
% addpath(genpath('../../../../code/gpml'));
% addpath(genpath('../../../../code/project'));
% addpath(genpath('../../../../code/oldgpml'));
% addpath(genpath('../../../../code/figtree-0.9.3'));
% addpath(genpath('../../../../code/project'));
addpath(genpath('../../code/gpml'));
addpath(genpath('.... |
% function epoch = dateToEpoch(date,referenceDate)
function epoch = dateToEpoch(date)
% if ~isa(date,'datetime')
% date = datetime(date);
% end
referenceDate = datetime(2000,01,01,12,00,00);
% if nargin < 2
% referenceDate = '2000-01-01 12:00:00'; % J2000
% elseif ~isa(referenceDate,'datetime')
% referen... |
function [ctx] = readInflatedCortex(subjId)
%[ctx] = readDefaultCortex(subjId)
anatDir = getpref('mrCurrent','AnatomyFolder');
ctxFilename=fullfile(anatDir,subjId,'Standard','meshes','inflatedCortex');
load(ctxFilename);
ctx.faces = faces;
ctx.vertices = vertices;
|
% %######################################################################
% %################ Define Sizes Here ##########################
% %######################################################################
dimx=12; % number of states
dimu=4; % number of inputs
dimec=0; % nu... |
function [a, u, fit, v] = arex(y, x, p, b, c)
if nargin == 4, c = 0; end;
pp = max([p b]);
xx = y(pp+1 : length(y));
z = x(pp+1 : length(y));
if pp == 0;
yy = y
zz = x;
else
for i = 1:pp,
yy(: , pp+1-i) = y(i:length(y) - pp + i-1);
zz(: , pp+1-i) = x(i:length(x) - pp ... |
clear
close all
savepath = '/work/a2grace/data_for_Justin/';
datapath = '/scratch/kglamb/a2grace/L25/';
filename = 'L25_tight.mat';
cd(datapath)
%Read in parameters from spins.conf
%This requires a buch of David's functions
%It's just easiest to import the SPINSmatlab folder from Boogaloo
%All the funct... |
function testPoisson
%This script implements an approximation of the homogeneous Poisson process
%X ~ Pois(lambda), valid for lambda << 1.
%
%we test the accuracy of the discretisation for different dt.
%parameters
dt = [0.0001 0.0005 0.001 0.005 ]; %discretisation
lambda = .1; %rate
T = 50000; %simulation time
%simu... |
centers = load ("LVQ_Centers.txt");
clusters = load("LVQ_Clusters.txt");
plot (centers (:,1), centers (:,2),'*',clusters(:,1),clusters(:,2),'+'); |
%% ---------------- Parameters (All in kg, km, s) -------------------------
% -- Physical parameters --
G = 6.67408 * 10^-11; % Grav. const. (m^3 * kg^-1 * s^-2)
M = 7.348 * 10^22; % Moon mass (kg)
mu = G * M; % Std. grav. param. (km^3 * s^-2)
R = 1737.5 * 10^3; %... |
function cost = calculate_true_cost(A, B, ops)
% given:
% - true system A and B
% - control policy (K, Se)
% this function computes:
% - the true cost
%%
[Nx, ~] = size(B);
I = eye(Nx);
Q = ops.Q;
R = ops.R;
Se = ops.Se;
K = ops.K;
sigma_w = ops.sigma_w;
if length(sigma_w) > 1
Sigma_w = dia... |
function test_suite = test_checkrequired%#ok<STOUT>
initTestSuite;
function values = setup %#ok<DEFNU>
% Read in the HED schema
latestHed = 'HED 2.026.xml';
values.Maps = parsehedxml(latestHed);
requiredTags = values.Maps.required.values();
values.Tags1 = {};
values.Tags2 = requiredTags(1);
values.Tags3 = requiredTags... |
%
% J.T. Ouwerling <j.t.ouwerling@student.rug.nl>, University of Groningen
% Date created: June 3, 2015
%
% Plot the griodpoints and susbets on the image.
%
% function plotGridpoints(config)
%
function plotGridpoints(config)
im = imread(config.imReference.file);
im = double(im(:,:));
imshow(im,... |
clear, clc, close all
f=@(x) 10+x.^2+5*x.*sin(x);
figure(1);
fplot(f, [0 10])
grid on
legend('y=10+x^2+5*x*sin(x)','location','northwest')
|
% Housekeeping
clc;
clear all;
%% Import the image
img = imread('Sample_1.jpg');
img = imresize(img,0.5);
%% Low-level image processing
img_gray = rgb2gray(img);
img_BW = imbinarize(img_gray);
img_BW = imcomplement(img_BW);
BW2_1 = bwmorph(img_BW,'remove');
% BW2 = imcomplement(BW2);
figure;
imshow(BW2_1)
% ... |
function [ jac ] = jacVanDerPol( t, Y, args )
%VANDELPOL Summary of this function goes here
% Detailed explanation goes here
mu = 100;
x = Y(1);
y = Y(2);
jac = zeros(length(Y));
% Syntax: xdot = PreyPredator(t,x,a,b)
jac(1,1) = 0;
jac(1,2) = 1;
jac(2,1) = -2*mu*x*y -1;
jac(2,1) = ... |
function OnStreamingStarted(src,evtdata,label)
myMAX30101 = src; % the MAX30101 object that fired the event
label.Text = 'Monitoring....'
% Optional: EVKIT diagnostic LEDs Red Off, Green ON
myMAX30101.MAX30101EVKITdiagnosticLED(0, 1);
end |
[x fs] = audioread('a.wav');
x = x(4000:end);
frames = floor(88200/1024);
N = 1024;
X = zeros(N,frames);
for i = 1:frames
X(:,i) = fft(x(i*1024-1023:i*1024));
end
Xa = angle(X)/pi*180;
Xabs = abs(X);
z = (0:2:(N*2-2))*pi/N;
z = complex(cos(z),sin(z));
Xz =Xabs;
Xz(:,1) = 1;
for f = 2:frames
Xz(:,f) =z;
z ... |
function [] = campbell(nat_freq,N,kappa)
nat_freq_Hz=nat_freq/(2*pi);
whirl_dirn=zeros(length(nat_freq_Hz),length(N));
N_Hz=(N/60)*[1];
plot(N,nat_freq_Hz,'k-',N,N_Hz,'b--');
ylim([0 N_Hz(end)])
set(gca,'fontsize',24)
grid;
pos_whirl=[];
neg_whirl=[];
mix_whirl=[];
if nargin>2
for i=1:length(kappa(1,:,1)) % from kappa
... |
function out = regexSearch(expr, condensedStates, timeData, filenames, selection)
%turn the condensed states into a searchable text array and locate all
%instances of expr in it. Record relevant event details such as file
%location and start time by encoding each position in the long string to
%correspond to a timesta... |
b=1;
a1=-10;
a2=10;
a3=-10+100i;
a4=10+100i;
t=0:0.001:1;
x1=b*exp(a1*t);
x2=b*exp(a2*t);
x3=b*exp(a3*t);
x4=b*exp(a4*t);
figure
subplot(2,2,1),plot(t,x1),xlabel('Tempo(t)'),ylabel('Amplitude'),grid
subplot(2,2,2),plot(t,x2),xlabel('Tempo(t)'),ylabel('Amplitude'),grid
subplot(2,2,3),plot(t,real(x3)),xlabel('Tempo(t)'),... |
clear all
close all
N = [10 20 30];
K = 8;
x100= linspace(-1,1,100);
x1000 = linspace(-1,1,1000);
%wzór funkcji - funkcja anonimowa
F=@(u) (u+1/3).*(u+1/3)+exp(-u-2);
iks=@(w) (2*((1:w)-1))/(w-1)-1;
%%%Zadanie 1 - sprządzanie wykresu funkcji
for i=1:length(N)
[xn, yn] = wyliczWezly(N(i));
figure;... |
function Cxxe = epochwise_covariance(X_epo)
%
% Cxxe = epochwise_covariance(X_epo)
%
% Computes epochwise covariance matrices.
%
% IN:
% X_epo - epoched data with size(X_epo) = [T, n_channels, n_epochs]
%
% OUT:
% Cxxe - timeseris of covariance matrices with
% size(Cxxe) = [n_channels, n_channels, n_epoch... |
% 绕Y轴旋转矩阵
function R = rotationy(angle)
<<<<<<< HEAD
R = roty(angle);
=======
R = roty(angle);
>>>>>>> 943c4faedec0557bb03b6d917afd83996852ce2a
|
function kmlStruct = kmz2struct(filename)
[~,~,ext] = fileparts(filename);
if strcmpi(ext,'.kmz')
userDir = fullfile( ...
char(java.lang.System.getProperty('user.home')), ...
'.kml2struct');
if ~exist(userDir,'dir')
mkdir(userDir);
end
unz... |
function f = calc_cbf_wp(Diff_file, SpinDens_file, inv_alpha, Ttag, TR, PLD, T1)
%
% function f = calc_cbf_wp(Diff_file, SpinDens_File, inv_alpha,Ttag, TR, PLD, T1)
%
% We then use the input tagging time, TR , PostInversionDelay and T1 along
% with the calculated spin density in
% order to compute a CBF map.
% Note... |
function y = mtimes(A,x)
if 0%(length(A.htld_hat)==2)
if ~xor(A.inverse == 0,A.adjoint == 0)
y.coarse{1} = x;
for i = 1:max(A.J)
[y.coarse{i+1},y.wav{i}{1},y.wav{i}{2},y.wav{i}{3}] = dwt2(y.coarse{i},conj(A.htld_hat).',conj(A.gtld_hat).','mode','per');
end
y = wavelet(y,... |
%% OpenEXR images HDR Retina tone mapping demo
% High Dynamic Range retina tone mapping with the help of the Gipsa/Listic's
% retina.
%
% Retina demonstration for High Dynamic Range compression (tone-mapping):
% demonstrates the use of wrapper class of the Gipsa/Listic Labs retina model.
%
% This retina model allows sp... |
function H = retornaH12(deltak, Vk, Y)
H = [DtijDVi(Vk(1), Vk(2), real(Y(1,2)), imag(Y(1,2)), 0, deltak(1), 1) DtijDVj(Vk(2), real(Y(1,2)), imag(Y(1,2)), 0, deltak(1)) 0 0;
DtijDVj(Vk(3), real(Y(3,1)), imag(Y(3,1)), deltak(2), 0) 0 DtijDVi(Vk(3), Vk(1), real(Y(3,1)), imag(Y(3,1)), deltak(2), 0, 1) 0;
DpiDVj(2, 1... |
% Number of nodes
num_nodes = 10;
% Number of time slots to run for
num_time_slots = 500;
num_calculations = 50;
% Probability of transmitting p
p = 0.025;
% Number of times to run simulation
num_intervals = 28;
efficiency = zeros(num_calculations, (num_intervals - 1));
mean_wait_time = zeros(num_calculations, (num_... |
%This function take all the image from a folder and make it into a video.
function im_to_vid(folder)
v = VideoWriter('plain.avi');
if nargin ~= 1 && nargin ~= 0
error('Input not valid!')
elseif nargin == 0
file = list_bmp();
else
if exist(folder, 'dir') == 7
... |
function out = PlugPlayADMM_general(y,A,lambda,method,opts)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%out = PlugPlayADMM_general(y,A,lambda,method,opts)
%solves the general inverse problem
%
%inversion step: x=argmin_x(||Ax-y||^2+rho/2||x-(v-u)||^2)
%denoising step: v=Denoise(x+u)
% update u: u=u+(x-v)
%
... |
function [hi]=iresponse(M);
epsilon=1E-2;
X=ones(size(M))./M;
X=fade(X,171,271,839,880);
index=find(X==0); X(index)=ones(size(index))*epsilon;
hi=rifft(X);
hi=fftshift(hi);
|
%This code implements the law of large numbers (law of averages) for two
%fair dices. The law of averages states that as the # of indentically
%distributed variables increases, randomly generated, the sample mean
%approaches the theoretical mean.
%
%The program approximates the probability of obtaining the event "... |
%=============================================================
% functions you would need to modify:
% 0. This function, proj5.m
% 1. get_sketch_tokens.m
% 2. detect_sketch_tokens.m
%=============================================================
%See http://cs.brown.edu/courses/cs143/proj5/ for suggestions on how to
%i... |
clear all;
close all;
clc;
a = 5^2;
b = 3*pi;
y = exp(a/b);
disp(y) |
close all
clc
clear
% m100 s100
path_out_m100_s100_write = 'C:\Users\rune\Documents\BTH\Thesis\hyperledger\BasicNetwork-my-version\results\caliper_outputs\exp_batch_new_outputs_m100_s100_write.txt';
path_in_m100_s100_write = 'C:\Users\rune\Documents\BTH\Thesis\hyperledger\BasicNetwork-my-version\results\caliper_... |
function iou = overlap_ratio(gt_box, box)
%
% This is a function of MDNet, which is used to compute overlap ratio.
%
% OVERLAP_RATIO
% Compute the overlap ratio between two rectangles
%
% Hyeonseob Nam, 2015
%
inter_area = rectint(box,gt_box); % matlab compute rectangle intersection area
union_area = box(:,3).*box(:... |
function [D, D2] = learn_features_bts(volumes, class, grade, params, params2)
% Load and sample from volumes
sample = 2;
V = cell(length(volumes), 1);
for i = 1:length(volumes)
I = load_braintumor(class, grade, volumes(i));
I = I(:,:,sample:sample:end,:);
V{i} = pyramid_4d(I./25... |
function varargout = data_plot_extractor_v01(varargin)
% DATA_PLOT_EXTRACTOR_V01 MATLAB code for data_plot_extractor_v01.fig
% DATA_PLOT_EXTRACTOR_V01, by itself, creates a new DATA_PLOT_EXTRACTOR_V01 or raises the existing
% singleton*.
%
% H = DATA_PLOT_EXTRACTOR_V01 returns the handle to a new DATA_PL... |
function cellObj=getcellfocal(imBgSub,cellObj)
% This function identifies cell focal plane based on histogram
% @param - imageBgSub, cellObj
% @return - cellObj
% @author - Yiming Kang
% @version - 03.29.2014
for i=1:length(cellObj)
listNegPct=length(cellObj{i}.PixelIdxList);
for j=1:length(cellObj{i}.Pixe... |
function pelican_post(accum,m)
close all
shipname = 'Pelican';
for i = 1:length(m.segs)
close all
A = load([m.dir.proc m.segs{i} '.mat']);
fout = [m.dir.figs A.name sprintf('_%dkHz',A.config.beam_freq) '.jpg'];
sadcp_figure_summary(A,fout,shipname);
end
|
function [Q,R] = QRDecomposition(A)
N = length(A);
I = eye(N);
Qk = I;
Q = I;
Ap = A;
for k = 1:N
x = Ap(k:N,k);
alpha = sign(-x(1))*abs(norm(x,2));
u = x + alpha*I(k:N,k);
v = u / (norm(u,2) + eps());
w = (x'*v)/(v'*x + eps());
Qk(... |
function y = bin_step(x)
%y = x;
%SIGMOID computes the sigmoidal logistic funtion
% Detailed explanation goes here
for x(i) in x
if (x(i) >= 0)
y(i) = 1;
else
y(i) = 0;
end
end
end |
function showfig
set(0, 'DefaultFigureVisible', 'on')
end |
function [G,a] = Gradient(I, angleRange)
%Gradient of I
%
%INPUT
%I: a grey-scale image
%angleRange: the angular span (see below)
%
%OUTPUT
%G: gradient intensity
%a: gradient direction. Values in the range
% [-pi/2,pi/2] if angleRange = 'pi'
% ... |
%import paraconducting data
%extrapolate linear fit data using parameters found from best fit
p0 = 0.40157;
p1 = 0.0017209;
res_linear_extended = p0 + p1*temp_paracond;
res_difference = res_linear_extended - res_paracond;
%visualize
subplot(3,1,1);
scatter(temp_paracond, res_linear_extended);
subplot(3,1,2);
scatte... |
file_name = 'viptraffic.avi';
videoObj = VideoReader(file_name);
vidFrames = read(videoObj);
GMM = InitialiseGMM(videoObj.height, videoObj.width);
biFrames = ones(120,160,120);
for t = 1:120
currentFrame = vidFrames(:,:,:,t);
currentFrameGray = rgb2gray(currentFrame);
currentFrameGrayDouble = double(current... |
% Fatigue life estimate from stress psd - spectral method
% psd should be of the form [frequency spectrum]
% sn should be of the form [N S]
% Ricardo Frederico Leuck Filho 2012/2-2013/1
function Ed = spectrallife(psd,sn,meanstress,criteria,pdf,showplots)
% %% Options
% meanstress: mean stress
% criteria: Mean stress co... |
%
% 模型为60类的训练模型--11个view-多multi
%
% 保存特征到文件夹的版本
% 选择不同层的特征+PCA+进行liblinear实验
%
clc
clear
run(fullfile('F:\chenjun\dynamic','matconvnet-1.0-beta23\matconvnet-1.0-beta23', 'matlab', 'vl_setupnn.m')) ;
% net_view1 = dagnn.DagNN.loadobj(load('F:\chenjun\dynamic\exp\ntu_multisubject_view1\net-deployed-view1.mat')) ;
%... |
%metodo grafico
syms x
y1= input('Digite la funcion 1')
y2= input('Digite la funcion 2')
x=[-20:0.5:30];
y1= eval (y1);
y2= eval (y2);
plot(x,y1)
hold on
plot(x,y2,'r')
grid on |
function myBarPlot(inputArrays,inputStdErr,options)
% myBarPlot(inputArrays,inputStdErr,options)
%
% multiple bar plots with error bars, saves sized image
%
% mandatory inputs:
% inputArrays: n x m matrix of n groupings ("ticks") on x-axis,
% and m categories per grouping (categories=diff. ... |
function [sys,x0,str,ts] = modulos_opc(t,x,u,flag,dt,machine,server,tagin,tagout)
% Função que envia o sinal de entrada "u" para o canal de entrada (bomba)
% e faz leituras através de comunicação com servidor OPC.
% Parâmetros:
% dt : tempo de amostragem em segundos
% machine : string contendo o alias do comp... |
function save_kdf(filename, varagin)
% check for filename
% Overwrite without warning
if exist(filename, 'file') == 2
delete(filename);
end
% open
h5create(filename);
% check length of varagin, if 1
% treat as a dict-ish thing
if length(varagin) == 1
if isstruct(va... |
% Reset all the variables
clear
clc
close all
% Read left and right images - scale down by 2
L = iread('rocks2-l.png', 'reduce', 2);
R = iread('rocks2-r.png', 'reduce', 2);
% To view the images in stereo vision next to each other
% figure;
% stdisp(L, R)
% % Stereo vision with interpolation
d = istereo(L, R, [40 9... |
function [neigs,x] = eighistogram(A,nbins,type)
% EIGHISTOGRAM Compute eigenvalue density using the ldl factorization
%
% This function only works on the normalized Laplacian matrix at the
% moment.
%
% It uses the inertial preserving properties of the LDL' factorization to
% count the number of eigenvalues in a reg... |
%Exercise 18, Andrew Banman
%Constructs the homology of RP2 from LazyWitness complexes
%with Zmod3 and Zmod2 coefficients.
dist = ex6_RP2Distances(1000);
file_name = 'lazyRP2-Zmod3';
coeff_dim = 3;
lazyWitness(dist,coeff_dim,file_name);
file_name = 'lazyRP2-Zmod2';
coeff_dim = 2;
lazyWitness(dist,coeff_dim, file_name);... |
function varargout = gui(varargin)
% tableplot.m -- Programmatic main function to set up a GUI
% containing a uitable and an axes which
% displays columns of the table as lines,
% plus markers that show table selections.
%
% The following callbacks are also provided, as subf... |
function sum_variance = select_cur_skeleton(bodies)
nof_joints = bodies.jointCounts;
X = bodies.joints.X;
Y = bodies.joints.Y;
Z = bodies.joints.Z;
sum_variance = 0;
% list_value_variance_joints = zeros(nof_joints,1);
for i=1:nof_joints
list_value_joint =zeros(nof_frames,3);
... |
function PA = getNBNSPL(NBNcfL, NBNcfR, CALfreq, CALpower, CALnsadj)
PA = zeros(size(NBNcfL));
for mmm = 1:length(NBNcfL)
[p, q1] = min(abs(CALfreq - NBNcfL(mmm)));
[p, q2] = min(abs(CALfreq - NBNcfR(mmm)));
PA(mmm) = 10*log10(sum(CALpower(q1:q2))) + CALnsadj;
end
|
function [QuatCur,eOut] = Mahony(Gyroscope, Accelerometer, Magnetometer, QuatPsd,eInt, tau)
%%Mahony算法进行姿态的更新
Kp = 1.0730*5;
Ki = 0.2878*5;
q = QuatPsd;
if(norm(Accelerometer) == 0),return; end
Accelerometer = Accelerometer / norm(Accelerometer);
v = [2*(q(2)*q(4) - ... |
% Étude statistique de la distribtuion des dépassements
% Les comparaisons se feront entre les intervalles [I1] et [I2]
%% Importation des données
% [Itot]
tableDepassement_Itot = readtable('Résultats/BETA_PARC_HYDRO.csv','Delimiter',';');
% [I1]
tableDepassement_I1 = readtable('Résultats/Depassement_PAR... |
function find_cell_mask_properties(exp_dir,varargin)
tic;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Setup variables and parse command line
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
i_p = inputParser;
i_p.addRequired('exp_dir',@(x)exist(x,'d... |
classdef Arrow < logical
% Arrow - Direction of tensor leg.
% Enumeration class with directions.
enumeration
in (false)
out (true)
end
end
|
function out = bandlimit(data,sr,band)
% computes band-limited power of a time series
% data is a matrix of data (to be filtered along first non-singleton
% dimension -- i.e., each column a variable)
% sr is the sampling rate (in Hz)
% band is either a named frequency band or a two-element vector of
% frequencies (in H... |
function mx=move_av(x,n)
if mod(n,2)==0;
n=n+1;
end
mx=nan(size(x));
for j=1:length(x)-n
mx(j+floor(n/2))=nanmean(x(j:j+n-1));
end
end |
% The optitoolbox implementation of quadratic programming solvers
% Author : Jonathan EDEN
% Created : 2016
% Description : Optitoolbox implementation of QP solvers.
function [x_opt, exit_type] = id_qp_opti(A, b, A_ineq, b_ineq, A_eq, b_eq, xmin, xmax, x0,options)
[x_opt, ~, exitflag] = opti_quadprog... |
% After merging components (in demo_script_finalMerge), use this script to evaluate the results.
% remember indeces in merged_ROIs are on the original A (before merging)
% after removing badComps (ie from A, badComps were removed and then
% merging ROIs were found).
%% Index of mergedROIs after sorting
nNe... |
%Considering a full white illuminated image, this is one method of removing
%shadow pixels and making them for exclusion from futher calculations.
clc,clear all, close all
I = imread('cleaned_up_image_(test_skin_2.JPG).png');
I2 = im2double(I);
S = size(I);
GRAY = rgb2gray(I);
figure(1)
imshow (GRAY)
%Normalize the ... |
function [FREQHZ]= MODESH(NM,MODE,FRQ,XYZ,KAKOM)
XX=XYZ(:,1);YY=XYZ(:,2);ZZ=XYZ(:,3);
NELT=size(KAKOM,1);NODT=size(XX,1);NT=NODT*3;
AMP=0;FREQHZ=0;
for NE=1:NELT
IN=KAKOM(NE,1);
XI=XX(IN);YI=YY(IN);ZI=ZZ(IN);
JN=KAKOM(NE,2);
XJ=XX(JN);YJ=YY(JN);ZJ=ZZ(JN);
KN=KAKOM(NE,3);
XK=XX(KN);YK=... |
function A = atmLight(im, JDark)
% the color of the atmospheric light is very close to the color of the sky
% so just pick the first few pixels that are closest to 1 in JDark
% and take the average
% pick top 0.1% brightest pixels in the dark channel
% get the image size
[height, width, ~] = size(im);
imsi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.