text stringlengths 8 6.12M |
|---|
classdef ImageStudy < handle
%IMAGESTUDY Summary of this class goes here
% Detailed explanation goes here
properties(SetAccess=private)
imageSeries = [];
instanceUid = '';
startDate = '';
startTime = '';
end
%----------------------------------------------------------------------------
properties(Acc... |
function negsemilogx(x,y)
% Do log10 but keep sign
xlog = sign(x).*log10(abs(x));
ylog = sign(y).*log10(abs(y));
% Just to get axis limits
plot(xlog,y,'o')
% Get limits
xaxislims = xlim;
xaxiswdth = diff(xaxislims);
yaxislims = ylim;
fprintf('%2.4f, %2.4f\n',yaxislims);
yaxishgt = diff(yaxislims);
fprintf('... |
partsize = [100 300 500 700];
BaselineMethod = [5.9158 6.0790 6.1647 6.0394];
IndexedMethod = [382.7849 368.9402 260.4121 119.3075];
% BaselineMethod = [7.4882 8.0491 8.2887 8.2173];
% IndexedMethod = [158.9952 401.5258 302.8987 225.4537];
set(gca,'Visible','on','Units','normalized');
set(gca,'Units','normalized','Fon... |
function [k,kc,Eyc,Q] = ADCP_DispCoef(beddepth,travdist,vertdepth,downstvel,startDist,endDist,extrp,extend_to_banks,banktype);
%This program computes the longitudinal dispersion coefficient from ADCP
%transects.
%P.R. Jackson & N.V. Reynolds, USGS, 11/16/10
%Inputs:
%
% beddepth = Depth (in meters) fr... |
function process_amp_dep_gain_phase(filename,range,if_plot,varargin)
S=load(filename);
if strcmp(range,'all')
range=1:length(S.Trials);
end
% Amps=cell2mat( arrayfun(@(c) c.period_index.amp(:,:), S.Trials', 'Uniform', 0) );
% Phases=cell2mat( arrayfun(@(c) c.period_index.phase(:,:), S... |
clear all
close all
fclose('all');
addpath('../jsonlab-1.5/');
datapath = '../data';
mass_cg = loadjson([datapath filesep 'mass_and_cg.json']);
% Inputs
load frames.mat;
%fuselage_start = [0 0 0];
%fuselage_end = [27 0 0];
% % % Rearrange frames for use
% % frame_shape = frames(2:end,2);
% % frame_X = cell2mat(frame... |
% Figure 4-8. Bleed System With Renewal
%
% Revision history
% 022020 LDY Code was created. Renewal was accomplished by adding new units
% to suspension fleet when POF of individual unit exceed control
% level.
% 022120 LDY Code was modified to match results from conventional failure
% ... |
function handles = optstraddletrading_entry(qms_, multi_)
% 期权Straddle交易界面控件的汇总
%handles = UIFrame.optstraddletrading_entry(qms_, multi)
% 吴云峰 20170415
% 全局变量
global QMS_INSTANCE;
global MULTI_INSTANCE;
global STRA_INSTANCE;
global OPT_INIT_AMOUNTS;
global OPTSTRUCTURE_INSTANCE;
STRA_INSTANCE = [];
QMS_INSTANCE = ... |
function [training_set, test_set] = preprocess_spkdata(spkdata, parameters)
%PREPROCESS_SPKDATA Preprocess spike data for MNE analysis
% Process spike data saved as .mat files in preparation of MNE analysis
% spkdata: struct with fields:
% -original_filename,
% -trode,
% ... |
function Z = atan2(Y,X)
% Symbolic four quadrant inverse tangent
% Convert inputs to SymExpression
X = SymExpression(X);
Y = SymExpression(Y);
% construct the operation string
sstr = ['ArcTan[' X.s ',' Y.s ']'];
% create a new object with the evaluated string
Z = SymExpression(sst... |
clear; close all; clc;
h = 0.1;
tau = 17;
T_tot = 2000;
%% RK4
rk4 = 1;
ChangeScaleMG = 0;
cibleMG;
figPlotMG = figure('units','normalized',...
'outerposition',[0.05 0.1 0.9 0.9],...
'Name','Equation de Mackey - Glass');
plot(T_out, Cible,'b', 'LineWidth',3); hold on;
xlabel('t [s]','Fon... |
% randomly show 60 numbers
load('F:\Documents\MATLAB\Data\MNIST\Farsi Digit Dataset\hoda_test_images(20000).mat');
for i=1:60
subplot(6, 10, i);
rand_idx = randi(20000);
imshow(test_images(:,:,rand_idx));
title(test_labels(rand_idx));
axis square;
end
|
Total[CoefficientList[Series[1/((1-x)^5(1+x+x^2)^2), {x, 0, 12342}], x]]
|
function logLikelihood=unsupervisedLogLikelihood(data,phi,params)
likelihoods=zeros(params.C,1);
for i=1:params.C
likelihoods(i)=supervisedLogLikelihood(data,i,phi,params);
end
mx=max(likelihoods);
likelihoods=likelihoods-mx;
logLikelihood=mx+log(sum(exp(likelihoods)));
end |
%I calculator rectangular tube
function [I,A] = IIB(b,d,t)
h = b - t; %cetre flange
k = d - 2*t;
I = (b*(d^3) - h*(k^3))/12;
%A = (b*d) - (h*k);
end |
clc
clear
% image = double(rgb2gray(imread('/Users/INNOCENTBOY/Documents/MATLAB/pic/512/4.2.04.tiff')));
x = [1,2,3;4,5,6];
h = ones(2,2);
% h = h/9;
M= size(x,1);
N= size(x,2);
m= size(h,1);
n= size(h,2);
h_conv = zeros(numel(x)+numel(h)-1,numel(x));
y = zeros(numel(x)+numel(h),1);
%% Stacking
% % [r,c] = size(image)... |
% This code trims the anatomical masks to avoid crosscontamination of the
% brain regions due to low resolution
clear all
%parameters to fill up
prompt = 'What is the position of the focal plane in the stack?';
z1 = input(prompt)
prompt = 'What is the distance betweeen stacks?';
dz= input(prompt)
prompt = 'What is... |
function burstanalysis(t,data, burstband,spikeband)
|
% Function that generates a 5 x 5 filtering kernel
% used for Laplacian Pyramidal blending
% a is usually 0.4
function [ker] = generating_kernel(a)
w_1d = [0.25 - a/2 0.25 a 0.25 0.25 - a/2];
ker = w_1d' * w_1d;
end |
clearvars
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%do 2D+1 analysis of a real AIRS-observed waves
%
%Corwin Wright, c.wright@bath.ac.uk, 2021/02/02
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function [c, s] = zgivens(a, b)
%compute givens rotation for vector [a b]'
if abs(b) < 1e-8
c = 1; s = 0;
else
if abs(b) > abs(a)
tau = -1*a ./ b ;
s = 1 ./ sqrt(1 + tau.^2);
c = s * tau;
else
tau = -1*b ./ a;
c = 1 ./ sqrt(1 + tau.^2);
s = c * tau;
end
e... |
clear
clc
close all
load('ConceptualDesign.mat', 'W0', 'V_Cruise', 'rho_cruise', 'SWing');
numPoints = 200;
CL_max = 1.4213;
V_D = V_Cruise*0.82/0.8;
V = linspace(0, V_D, numPoints);
%upper curve
Nz = (1.225*SWing*CL_max/(2*W0))*V.^2;
Nz(Nz > 2.5) = 2.5;
%lower curve
Nz(numPoints+1 : 2*numPoints) ... |
% classification using only brightness as feature.
clear all;
originalfeature=importdata('featureori.mat');
spamfeature=importdata('featurespam.mat');
originalfeature=originalfeature';
spamfeature=spamfeature';
random_gen1 = randperm(798,798);
random_gen2 = randperm(921,921);
for i=1:798
originalrand(i,:... |
function MLDS_DesignOptimality(data)
%%
for ns = 1:size(data.stimlist,3)%run over sigma values
for nrun = 1:length(data.stimlist)%run over simulations
%get the questions
q = data.stimlist{nrun,1,ns};
tq = size(q,1);
%prepare the design matrix
dm = MLDS_Q2DM(q);
%info... |
% This script downloads the CT1088 and CT1089 datasets from the ONS
% website.
if ~exist('data','dir')
mkdir data;
end
if ~exist('data/CT1088_tables','dir')
mkdir data/CT1088_tables;
end
url={'https://www.ons.gov.uk/redir/eyJhbGciOiJIUzI1NiJ9.eyJpbmRleCI6MSwicGFnZVNpemUiOjI1LCJ0ZXJtIjoiQ1QxMDg4KiIsInBhZ2UiOjE... |
function [simScore, bestLag] = computeTemplateSimilarity(W, U)
% covariance matrix between all templates
WtW = Neuropixel.Utils.getMeWtW_nomex(single(W), single(U));
nt0 = size(W, 1);
lags = nt0:-1:-nt0;
% the similarity score between templates is simply the correlation,
% taken... |
% Name:Tommy Lee Truong
% Last Edit:May 6 2021
% Program Name: HW 12
clc; clear all; close all;
%% a
A=imread('jaguar.jpg');
[m,n]=size(A)
maxval=max(max(A))
minval=min(min(A))
%% b
A=double(A);
[U,S,V]=svd(A);
r=rank(A)
sigmavals = diag(S);
figure();
scatter(1:r,sigmavals,'.')
xlabel('i')
ylabel('sigm... |
% Percent Change in CXCR4 analysis (test role of CD18 cell in suppressing
% CXCR4 growth)
close all; clear all; clc;
[N, T]= xlsread('../data/4_4_20_Dilutions_for_KJ.xlsx');
names = T(2, 2:end);
nsamps = length(names);
for i = 1:nsamps
CLLdata(i).time = N(:,1);
CLLdata(i).sample = names(i);
CLLdata(i).in... |
function r1 = myvideo()
end |
%==========================================================================
function [eDensity,hDensity]=f_charge_evp_pc(mesh,kgrid,SB1,SB2,XV1,XV2,EFn,EFh)
%test for prediction-correction for iteration
%==========================================================================
%
kB = 1.38D-23; % Boltzmann co... |
classdef rlDynModel < rlKinModel
properties
%Centrifugal Coriolis Vector
V = [];
%Gravity Vector G(q)
G = [];
%Mass Matrix Inverse
invM = [];
%Mass Matrix
M = [];
%Operational Mass Matrix Inverse
invMx = [];
%World gravity,... |
%make average of the time series
%javaaddpath '/home/sophie/Matlab/java/mij.jar'
javaaddpath '/usr/local/MATLAB/R2014b/java/mij/mij.jar'
javaaddpath '/home/sophie/Fiji.app/jars/ij-1.48q.jar'
MIJI;
%drag and drop data
Data=MIJ.getCurrentImage;
% use the subset of LPUs that are clearly visible is data (4landma... |
function y = butter_filters(x,Fs,n,Wn,ftype)
% -------------------------------------------------------------------------
% Inputs:
% x: siganl (array: returns filtered data for each column)
% Fs: sampling rate
% n: order
% Wn: cut off frequency
% ftype: 'high', 'stop', 'low', 'bandpass'
%
% Output:
... |
load case3_AVNRT %your complex heart model suited for matlab VHM
load pace_param_w_PVAAB
VHM_GUI('AVRNT_complex.mat'); %equivalent complex heart model created using the GUI
while 1
[node_table,path_table]=heart_model(node_table,path_table);
pace_param=pacemaker_new(pace_param,node_table{1,10},node_tabl... |
function M = simmx(A,B)
% M = simmx(A,B)
% calculate a sim matrix between specgram-like feature matrices A and B.
% size(M) = [size(A,2) size(B,2)]; A and B have same #rows.
% Omitting B gives simmx(A,A).
% 2003-03-15 dpwe@ee.columbia.edu
% $Header: /Users/dpwe/matlab/columbiafns/RCS/simmx.m,v 1.2 2009/07/08 ... |
function [cfr] = rls_pegasos_singlepass(X, bY, opt)
% rls_pegasos_singlepass(X,BY,OPT)
% utility function called by rls_pegasos
% computes a single pass for pegasos algorithm, performing the stochastic
% gradient descent over all training samples once.
%
% INPUTS:
% -X: input data matrix
% -BY: binary coded lab... |
clear, clc, close all
rng(1);
N = 10^4;
xrn = rand(1,N);
yrn = rand(1,N);
x = 4.*xrn - 2;
y = 4.*yrn - 2;
area_sq = 16;
r = 1.2;
hit = 0;
for i = 1 : N
if (x(i)^2 + y(i)^2 <= r^2)
hit = hit + 1;
end
end
area = hit/N * area_sq;
area
pi*r^2
|
function [t,t2,a,b] = tmatrix_mie_layered(nmax,k_medium,k_particle,radius)
% tmatrix_mie.m : mie scattering and internal coefficients for a uniform or
% layered sphere arranged as a sparse t-matrix.
%
% usage:
% [t,t2] = tmatrix_mie(nmax,k_medium,k_particle,radius)
% k_medium is the wavenumber in the su... |
%% clear everything
clear all
close all
clc
%% initialize the problem variables
%% the region that is serviced by a GDB is divided into m * n square cells,
m=300;
n=300;
max_v= m/300;%%<1/100 m maximum x velocity
max_p=100; %% maximum power an SU can use
%% initiate the problem:
%% generate real pu locations
PUnu... |
function sparsityLASSO()
function plotCurveGivenCoeffs(W)
x = -1:0.01:1;
y = W(1) * x;
for i = 1:12
y = y + W(i+1) * sin(0.4*pi*x*i);
end
plot(x,y);
end
% Phi: matrix whose rows are data point inputs Phi(x)^(i)
% y: vector whose entries are data ... |
function setup()
% users have to download 'liblinear-2.20'
% and the three data sets 'colon-cancer', 'rcv1', 'news20' from LIBSVM
% website.
%
% Download link for liblinear-2.20: http://www.csie.ntu.edu.tw/~cjlin/cgi-bin/liblinear.cgi?+http://www.csie.ntu.edu.tw/~cjlin/liblinear+zip
%
% Download link for the... |
%defineSleepEnvironment
%
%This file defines the environment needed to interact
%with the SLEEP component.
%
%The SLEEP component basically gives you a command
%interface to do set the power mode of the mote
%
%To send packets to a node running SLEEP, first run this file
%and then run one of the other functions in ... |
function PrepSegment(boldData)
%PREPSEGMENT Segments MRI structural images into CSF, WM, and GM components.
%
% SYNTAX:
% PrepSegment(boldData)
% PrepSegment(boldData, 'PropertyName', PropertyValue...)
%
% INPUT:
% boldData: BOLDOBJ
% A BOLD human data object undergoing... |
function distance = DTW(trainData, testSeq, startInd, windowLength)
if startInd == 0
startInd = 1;
end
if windowLength == 0
windowLength = length(testSeq);
end
if windowLength > length(testSeq)
distance = 10000;
else
distance = 0;
for i = 1 : length(trainData)
distance = distance + computeD... |
tic;
clear all; clc;
%Marsagalia's polar method
M1 = 1; % Mean of X
M2 = 2; % Mean of Y
V1 = 4; % Variance of X
V2 = 9; % Variance of Y
i = 0; % the random number generated by the algorithm
count1 = 10000000;
count2 = 1000000;
% Geberate X and Y that are N(0,1) random variables and independent
while(i <= co... |
function mysql_matlab()
patientID = 12;
sessionID = 13;
playlistID = 14;
exerciseID = 15;
error = 16;
csv_figure_name = strcat('dtw_', 'session', sessionID, '_playlist', playlistID, '_exercise', exerciseID, '.png');
%# JDBC connector path
javaaddpath('C:\Users\Public\mysql-connector-java-5.0.8\mysql... |
%-------------------------------------------------------------------------%
% npend - Jeremy Turner
%
% This is the file that drives all the magic. By running npend.m, the user
% is promped on the command line to:
% - select to play an animation
% --- list all available animations
% --- play animations
% --- replay an... |
%*************** Advanced Communication Systems*****************%
% CE542, Fall 2018 %
% ECE, UTH, Greece %
% File: project_4a.m %
% Authors: Christos Georgakidis (1964) ... |
function [rawfrapinf] = getrawfrap(imgs,roiMatrix,channel,date,experiment)
% Sum pixel brightness in each ROIs every fraps.
%
% [rawfrapinf] = getrawfrap(imgs,roiMatrix,channel,date,experiment)
t = size(imgs,3);
n = size(roiMatrix,3);
rawfrapinf = zeros(t,n);
for u = 1:t
for m = 1:n
r = imgs(:,:,u,channel)... |
function [X,f] = MyFFT(x,Fs,shift,n)
% [X,f] = MyFFT(x,Fs,n)
% INPUTS:
% x Data array.
% Fs Sampling time (seconds).
% shift fft shift applied or not, (default = yes)
% n zero pads, (degault = 0)
% OUTPUTS:
% X Shifted and normalized FT of w. Complex. DC component located in
% the "middle".
% f Arr... |
function [bz,az]=mapeamento(bZ,aZ,Nz,Dz)
bzord=(length(bZ)-1)*(length(Nz)-1);
azord=(length(aZ)-1)*(length(Dz)-1);
bz=zeros(1,bzord+1);
for k=0:bzord
pln=[1];
for l=0:k-1
pln=conv(pln,Nz);
end
pld=[1];
for l=0:bzord-k-1
pld=conv(pld,Dz);
end
bz=bz+bZ(k+1)*conv(pln,pld);
end... |
%% Project of Automatic Control
%%%%%%%%
%
% Project:
% Type 1.a
% Team members:
% Francesco Ciampana, Alessio Troffei, Vladyslav Tymofieiev,
% Francesco Scavello
%
%%%%%%%%
% Project specs:
% - zero steady state error with a step reference signal of w(t)=W1(t)
% - Mf>45°
% - S_%<1... |
% LOOK AT PET DICOMS
cd('/Users/caterinatrainito/Documents/Caterina/dicoms_PET/1.2.826.0.1.3417726.3.245890.20170116163055356/1.2.826.0.1.3417726.3.132947.20170116163055356');
direc=dir('*.dcm');
[sorted,ix]=sort(cell2mat({direc.datenum}));
dirname={direc.name};
dirname=dirname(ix);
% figure;
for i=1:numel(dirname)
... |
%% This script reconstructs 2D radial data acquired with the cryocoil in the Bruker magnet. The reconstruction currently works for:
% 1) FID acquisitions (cannot recon GRE acquisitions)
clc
%% INPUTS
mat=64; %Reconstruction matrix size
mat2=mat/2;
RecoScaleChan1=1; %These are variable names used in the Bruker... |
function [output] = runBLEACH(SN, params)
%%%%%%%%%%%%%%%%%%%% Network Establishment paramseters %%%%%%%%%%%%%%%%%%%%
%%% Area of Operation %%%
xm = params.xm; % Field Dimensions in meters %
ym = params.ym;
x = params.x;% added for better display results of the plot
y = params.y;% added for better display resul... |
%Author:Eduardo Alho
%date:06/09/2016
%Applies 2D transformations to binary masks segmented from original
%histology, builds a volume (Case01) from 2D slices, centralizes to the original volume and saves in nifti format ready for 3D transforms
%%mask_dir: directory where original folders with masks are
%The masks shou... |
% Thu nghiem Cholesky bang lenh chol
% tic;
% A = delsq(numgrid('L',1000)); n = 100;
% L = ichol(A,struct('type','ict','droptol',1e-02,'michol','on'));
% e = ones(size(A,2),1);t
% norm(A*e - L*L'*e, 'fro')
% toc;
clear all; clc;
% function l = Chol_trial(A)
A = delsq(numgrid('S',28));
n = size(A,1);
l = z... |
clear all;
clc;
% load 'PDmats/accMagn.mat';
% pd=accMagn;
% load 'OHmats/accMagn.mat';
% h=accMagn;
% load 'PDmats/rvelMagn.mat';
% pd=rvelMagn;
% load 'OHmats/rvelMagn.mat';
% h=rvelMagn;
%
% load 'PDmats/accSumDiff.mat';
% pd=accSumDiff;
% load 'OHmats/accSumDiff.mat';
% h=accSumDiff;
%
load 'PDmats/rvelAmp.mat'... |
function [histogram_encoding, binary_encoding] = encoding(descriptors, cluster_centers, numClusters)
temp = size(descriptors);
assigned_cluster_centers = zeros(1, temp(2));
for ii=1:temp(2)
[~, k] = min(vl_alldist(double(descriptors(:,ii)), cluster_centers));
assigned_cluster_centers(ii)=k;
... |
function lm = learnMean(trainData,classnumber)
idx = find(trainData(:,1)==classnumber);
lm = mean(trainData(idx,2));
end
|
% ------------------------------ 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
subplot(3... |
function ioVar
%% Parameters
dt = 5e-4; %discretisation step
gamma = logspace(log10(0.001),log10(1000),10); %memory range of interest
mu = 10;%[0.0005 10]; %spatial correlation (extreme values)
v0 = 0.02;
mu = mu/v0; %effective (temporal) correlation length
T = 3000; %length of trajectories
... |
function compareAvgTraj(averagedCentroidsSuccess,averagedCentroidsFail,VelocitySuccess,VelocityFail,AccelerationSuccess, AccelerationFail,JerkSuccess, JerkFail,day, RatID)
[euclidDiffAvgTraj] = calcEuclidianDiffBetweenAvgTraj(averagedCentroidsSuccess,averagedCentroidsFail,day,RatID);
% [velocityDiffAvgTraj] = calcVe... |
clear;
clc;
Sigma=[4 1; 1 9];
m1=[1; 2];
m2=[-2; -1];
p1=0.25;
p2=0.75;
Sigma_inv = inv(Sigma);
W_1 = Sigma_inv*m1;
W_10 = -1/2*(m1')*Sigma_inv*(m1)+log(p1);
W_2 = Sigma_inv*m2;
W_20 = -1/2*(m2')*Sigma_inv*(m2)+log(p2);
disp("W_1: ");
disp(W_1);
disp("W_10: ");
disp(W_10);
disp("W_2: ");... |
function Inconsistency = IEPM(Feature,Class,varargin)
%=========================================================================%
% 不一致性案例对 %
%=========================================================================%
% Description:
% 计算不一致对率:不一致案例对数/所有案例对... |
x=1:100;
x1=1:50;
x2=51:100;
y1 = exp(-x/20);
clearplot;
plot(x,y1,'b-;Training set;');
hold on;
title('Training error vs. test error','fontsize',30);
xlabel('Model complexity','fontsize',20);
ylabel('Classification error','fontsize',20)'
axis off;
y21 = 0.5+((50-x1)/1.3).^2/2200;
y22 = 0.5+((50-x2)/1.3).^2/6000;
y2... |
I=imread("fudan1_digimarc_S5.jpg");
BW=im2bw(I);
BW2=bwperim(BW);
figure;
imshow(BW2);
IBW = ~BW;
F1 = imfill(IBW,'holes');
SE = ones(3);
F2 = imdilate(F1,SE,'same');
BW3 = bwperim(F2);
BW4=edge(BW,'canny');
subplot(1,2,1);
figure;
imshow(I);
title('original iamge');
subplot(1,2,2), imshow(BW4);
title('operated bwper... |
function scans_to_process = LONG_timepoint_to_MNI( scans_to_process, dartelpath, timepoint)
%LONG_timepoint_to_MNI - warp timepoint to MNI
%
% Syntax: scans_to_process = LONG_timepoint_to_MNI( scans_to_process, dartelpath, timepoint)
%
% Inputs: scans_to_process - array of objects of class LONG_participant
% ... |
function [ PromptVd,DynamoVd,Vd ] = StormVd( FLAG,iP,AE,SLT )
%STORMVD Empirical vertical disturbance drifts model
% SUBROUTINE StormVd(FLAG,iP,AE,SLT,PromptVd,DynamoVd,Vd)
% *******************************************************************
% Empirical vertical disturbance drifts model
% After Fejer and Scherl... |
%hvoct3spectrum - issue 1.1 (30/07/10) - HVLab HRV Toolbox
%--------------------------------------------------------------------------
%[spectrum] = hvoct3spectrum(timedata, fmin, fmax, fscale)
% Computes spectrum of signal magnitudes in one-third octave bands from
% time history data
%
% spectrum = HVLab data s... |
function [zi,theta,phi,Adk,Bkw,Mk] = stdgibbs_update(zi,theta,phi,Adk,Bkw,Mk,...
I,D,K,W,di,wi,ci,citest,Id,Iw,Nd,alpha,beta);
% update (sample) phi's
for k=1:K
phi(k,:) = randdir(beta + Bkw(k,:));
end
% update (sample) theta's
for d=1:D
theta(d,:) = randdir(alpha + Adk(d,:));
end
% update (sample) z... |
function obs=useC2(obs,useL2C,poob)
%
% Function useC2
% ==============
%
% This function puts C2 in place of P2, for IIR-M satellites
% So C2 is used rather than P2 for chosen satellites
%
% Syntax
% ======
%
% obs=useC2(obs,useL2C)
%
% Input
% =====
%
% obs -> nsx(no+2) matrix containing ob... |
filename = 'lena.png';
cover = double(imread(filename));
cR = 0.299;
cG = 0.587;
cB = 0.114;
gray = round(cR * cover(:, :, 1) + cG * cover(:, :, 2) + cB * cover(:, :, 3));
[PER, PEB, ~, pred_R, pred_B, cost] = getPEs(gray, cover);
messL0 = 10000:20000:130000;
messL = messL0;
psnr = zeros(length(messL), 1);
D = psnr;
N ... |
function [ans, iter] = Dichotomy(a, left, right, eps)
MAX = 100;
format long;
if nargin == 0
a = 115;
left = 10.0;
right = 11.0;
eps = 10e-6;
elseif nargin == 1
left = floor(sqrt(a));
right = ceil(sqrt(a));
eps = 10e-6;
elseif nargin == 3
eps = 10e-6;
end
iter = 1;
ans = [];
while i... |
%% Import data from text file
% Script for importing data from the following text file:
%
% filename: F:\github\wearable-jacket\matlab\IEEE_sensors\JCS_data\Satish\Unknown_Subject_25_11_2019_13_54_23.txt
%
% Auto-generated by MATLAB on 25-Nov-2019 14:43:31
%% Setup the Import Options
opts = delimitedTextImportOptio... |
function xOut = subgradient(x,nIter,L,lamda,data0,data1)
%initialisation de xOut
xOut= [];
%taille des données
shape1 = size(data0);
shape2 = size(data1);
sizeH = shape1(1);
nA = shape1(2);
nB = shape2(2);
%nombre d'iteration
n = 0;
xnew = x; %xnew = valeur actuel de x
while n < nIter
%initialisation des gradients
... |
function setExpansionRateCoeff(w, k)
% SETEXPANSIONRATECOEFF -
%
wallmethods(9, wall_hndl(w), k);
|
% Stepper Code
% Authors: James Heath
% Last Updated: 2021/01/01
% Description:
% This code performs calibration and produces sample results from the
% calculated calibration values. It can perform both Spectral and/or
% Amplitude calibrations before running the analysis
% Inputs: None
% Outputs: Saved files for cali... |
function new_after = icp_reg( after, before, tol )
tol = tol * ones(3,1);
CUTOFF = 0;
while( CUTOFF == 0 )
% FIND CORRESPONDENCE
IDX = knnsearch(before,after);
C1 = after;
C2 = before(IDX,:);
% MATCH BY REGISTRATION
[R, t] = LS_SVD_findRt(C1, C2);
% APPLY TRANSFORM
new_P1 = ( ( R * a... |
for i = 1:60
for j = 1:60
x(i,j) = i;
y(i,j) =j;
end
end
surf(x(:,:),y(:,:),f(:,:));
colormap gray; |
%script calculates the RV to based on the input normalized variables
data= input('enter first NORMALIZDED variable=');
data1= input('enter second NORMALIZDED variable=');
data2= input('enter third NORMALIZDED variable=');
rv= input('enter RV to be predicted=');
%variables must the same size
size=length(data);
%store... |
function [L,U] = BlockLU_Recur(A,r)
% function [L,U] = BlockLU_Recur(A,r)
% Recursive Block LU without pivoting.
% A is nxn and has an LU factorization.
% L is nxn and unit lower triangular.
% U is nxn and upper triangular.
% r is the block size.
% A = LU.
% GVL4: Algorithm 3.2.3
[n,n] = size(A);
if n<=r
... |
clear all;
clc
[alphabet,targets] = prprob; %alphabet=35x26
S1=10;
[R,Q]=size(alphabet);
[S2,Q]=size(targets);
P=alphabet;
net=newff(minmax(P),[S1,S2],{'logsig','logsig'},'traingdx');
net.LW{2,1}=net.LW{2,1}*0.01;
net.b{2}=net.b{2}+0.01;
T=targets;
net.performFcn='sse';
net.trainParam.goal=0.1;
... |
function e = test_loneSum()
% test_loneSum() runs several tests and returns the number of tests that
% fail.
%
% Adam Rosenbloom on 3-1-2011
e = 0;
e = e + runtest(1, 2, 3, 6);
e = e + runtest(3, 2, 3, 2);
e = e + runtest(3, 3, 3, 0);
e = e + runtest(9, 9, 1, 1);
e = e + runtest(3, 7, 7, 3);
e = e + runtest(9, 7, 3, ... |
stash = '/home/jhaley/JPSSdata';
Longitude = hdfread('/home/jhaley/JPSSdata/MOD03.A2013222.0545.006.2013222112442.hdf', 'MODIS_Swath_Type_GEO', 'Fields', 'Longitude');
Latitude = hdfread('/home/jhaley/JPSSdata/MOD03.A2013222.0545.006.2013222112442.hdf', 'MODIS_Swath_Type_GEO', 'Fields', 'Latitude');
fire_mask = hdfre... |
nodeN = 3;
dmatrix = zeros(nodeN,nodeN);
Pr = 1; Bt = 2; Ut = 3;
dmatrix(Pr,[Bt Ut]) = 1;
Pr_nodes = 1:nodeN;
Pr_sizes = 2*ones(1,nodeN);
Pr_bnet = mk_bnet(dmatrix, Pr_sizes, 'names', {'Pr','Bt','Ut'},'discrete', Pr_nodes);
Pr_cases = 5;
% pos =1 neg =2 Yes =1 No =2
Pr_sample = cell(nodeN,Pr_cases);
Pr_sample = [ ... |
function [databaseYale, testsetYale] = readAllYale()
databaseYale = [];
testsetYale = [];
for i = 1 : 39
foldername = '/home/sudeep/Semester 5/CS 663/CroppedYale/yaleB';
if (i < 10)
foldername = strcat(foldername, '0',num2str(i),'/');
else if (i == 14)
continue;
else
... |
I=imread('img.jpg');
Ihsv=rgb2hsv(I);
Iv=Ihsv(:,:,3); %提取v空间
Ivl=Iv(500:end,:); %截取下半部
Iedge=edge(Ivl,'sobel'); %边沿检测
Iedge = imdilate(Iedge,ones(3));%图像膨胀
%新建窗口,绘图用
figure (2)
imshow(Iedge);
hold on
%左方直线检测与绘制
%得到霍夫空间
[H1,T1,R1] = hough(Iedge,'Theta',20:0.1:75);
%求极值点
Peaks=hough... |
%Philip Putnam
%Test in progress
clear all
clc
plx_path = fullfile(pwd, 'test', '4chTetrodeDemo_PLX.plx');
%Check if file exists
if ~exist(plx_path, 'file')
error('File not found.');
end
%Try to open file from specified path
fID = fopen(plx_path);
%If fopen failed, return error
if(fID == -1)
error('Error op... |
classdef AdvRotationUniformMesh3d < AdvAbstractVarFlow3d
%ADVROTATIONUNIFORMMESH3D Summary of this class goes here
% Detailed explanation goes here
properties
%> max order of horizontal and vertical basis functions
N, Nz
%> num of elements on horizontal axis
M, Mz
... |
clear all
close all
clc
%% LED duty cycle = 50%
Rext_low = [572 1563 2549 3539 4520 5490 6480 7470 8450 9440 10420 20360 30220 40200 50000 60000 69900 79600 89500 99500 109300];
Vr_low = [.003 .009 .015 .021 .027 .033 .039 .045 .051 .056 .061 .112 .156 .191 .219 .242 .259 0.272 .282 .292 .298];
Ir_low = Vr_low ./ Rex... |
function obj = updateProp(obj, varargin)
% This function updates the properties of the class object based on the
% input name-value pair arguments.
%
% Parameters:
% varargin: variable nama-value pair input arguments, in detail:
% lb: lower limit @type colvec
% ub: upper limit @type col... |
function y=fn_mult(u,v)
% function y=fn_mult(u,v)
%----
% tool to multiply a matrix row- or column-wise
% ex: y = fn_mult(rand(3,4),(1:3)')
% y = fn_mult(rand(5,2,5),shiftdim(ones(5,1),-2))
%
% See also fn_add
% Thomas Deneux
% Copyright 2002-2012
s1 = size(u); s2 = size(v);
if length(s2)>length(s1), y = fn_mult(... |
function y = filtx(x, s, type, s1)
%FILTX Gaussian filter for rows of a matrix.
% Y = FILTX(X, S, TYPE, S1)
%
% X: Matrix to be filtered
% S: Sigma of gaussian to use (default 1)
% TYPE: A string of 1-2 characters to determind type of filter.
% 'l' (default) for low-pass, 'h' for high-pass,
% 'b' for band-pass (dif... |
% Jacob Krol
% Finds the time between 16 as center chain value
max = input('Maximum value to be tested:');
chainval = zeros(1,max);
space = 0;
freq = [ ];
non16 = [;];
for nval = 1:max
movingval = nval;
while(log2(movingval)-floor(log2(movingval))>0)
if(mod(movingval,2)==0)
mo... |
function [ callOne ] = set_callOne( obj, iT, K )
%SET_CALLONE 设置obj.callOne@OptionOne, 指向待交易call期权的指针
% 拟:作为通用项,写在一个基本类里
% -----------------------
% cg, 20160320
if ~exist('iT', 'var'), iT = 1; end
if ~exist('K','var'), K = 2; end
type = 'call';
iK = obj.m2tkCallOne.getIdxByPropvalue_X( K );
call... |
function [x,y] = mapping(obj,element,xi,eta)
% Mapping computes crazy mapping between (xi,eta) and (x,y)
%
% Computes the mapping between (xi,eta) and (x,y),
% the computational domain and the physical domain, respectively, for a
% given element number (element) and the number of elements in x and y
% directions (n).
%... |
figure(2)
hold on
plot(reshape(data_received_equalized,1,size(data_received_equalized,1)*size(data_received_equalized,2)),'.b')
nr_bits=6;
data_test_bin=zeros(2^nr_bits,nr_bits);
for i=1:nr_bits
a=zeros(2^nr_bits/(2^i),(2^(i-1)));
b=ones(2^nr_bits/(2^i),(2^(i-1)));
data_test_bin(:,i)=res... |
function [T_cw] = PositionCamera(T_ow)
%PositionCamera
%Generate a random camera frame that has a good chance of the
%object being visible in the camera when the object is a 1m
% cube.
%Input T_ow is the 4x4 object frame in world coordinates
%T_cw is the 4x4 camera frame in world coordinates.
%Assign space for the... |
clc
clear all
close all
p_tot=-5.8;
a_1=0.8;
p_1=-p_tot;
w_1=pi/5;
a_2=1;
p_2=0;
w_2=pi/5;
b=-0.2;
x_p = -5.5:0.001:2;
dust = 1:length(x_p);
for mg = 1:length(x_p);
path1(mg)=path(x_p(mg),a_1,p_1,w_1,a_2,p_2,w_2,b);
end
plot(x_p(dust), path1)
line([x_p(1);x_p(end)],[0;0],'Color','r'); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.