text stringlengths 8 6.12M |
|---|
clc;
img1=imread('./rect.bmp');
J = fft2(img1); %FFT
J = fftshift(J); %spectrum shift frequency to origin
L=abs(J/256);
subplot(2,3,1);
imshow(img1);
title('original image');
subplot(2,3,4);
imshow(uint8(L));
title('original image in frequency domain');
img2=imread('./rect-45.bmp');
J2 = fft2(img2); %FFT
J2 = ... |
function leg=get_legend_weight(measurement)
leg = strjoin({'m = ' strjoin({num2str(measurement.mkg, '%0.3f') 'kg'}, '')}, ' ');
end |
function s = str2str(s)
% Copyright 2010 The MathWorks, Inc.
s = ['''' s ''''];
|
%% Test Lagrangien Augmente sur tho
%flag, x0, l0, f, c, grad_f, deriv_c, hess_f, d2c, kmax
clear all
close all
format long
[f, grad_f, hess_f] = f2();
x0=[sqrt(3)/2;sqrt(3)/2];
% x0=[1;0];
nb_max=50;
nbmax_sp=50;
l0=1;
delta_0=1;
delta_max=10;
global mu0 nt0 a b;
a=0.1;
b=0.9;
mu0=10;
nt0=0.1258925;
n=50;
[ c, de... |
% the following part is only valid in R2017a version, i.e. function in
% script
% load mcmc results
% mcmc_data_folder = '../results/TripleFit/';
% mcmc_data_folder = '../results/fixOverlap/';
% mcmc_data_folder = '../results/secondFixOverlap/';
mcmc_data_folder = '../results/HJYaddHXTcomp/';
% mcmc_data_folder = '../... |
clc;
clear;
close all;
a=5;
b=6;
c=a+b;
disp(c); |
%% Define Feedforward Convolutional Code
SNR_dB = 3
LM = 1600 % Mesg Length excluding pre-determined bits for starting & ending trellis at state 0
TREL_TYPE = 'Feedback' % {'Feedback', 'Feedforward'}
%% Matlab Generator Polynomial convention
% Build a binary number representation by placing a 1 in each spot w... |
function sort_lines(file_path)
% sort_lines(file_path)
% sort lines in file alphabetically
fprintf('Sorting lines of [%s] ...', file_path);
fid = safefopen(file_path);
text = textscan(fid, '%s', 'Delimiter', '\n');
% sort each line
text = text{1};
text = sort(text);
% save sorted lines
fid = safefopen... |
close all; clear; clc;
format long;
disp('ZADANIE 5');
% blad absolutny
blad = 0.0005;
% przedzial calkowania
a = 0;
b = 1;
% funkcja podcalkowa
f = inline('exp(x)');
% dokladna wartosc calki
I = exp(b) - exp(a);
% maksymalna liczba podprzedzialow
mmax = 10000;
disp('METODA TRAPEZOW');
for ... |
function out = earm2_embedded_odes(t, input, param)
% input(1) = L(bf=None);
% input(2) = R(bf=None);
% input(3) = flip(bf=None);
% input(4) = C8(bf=None, state=pro);
% input(5) = BAR(bf=None);
% input(6) = Apaf(bf=None, state=I);
% input(7) = C3(bf=None, state=pro);
% input(8) = C6(bf=None, state=pro);
% input(9) = C... |
function [f] = fitting_function(X, a, b, c, x0, y0)
%FITTING_FUNCTION Function for fitting the RF bounding box
x = X(1);
y = X(2);
f = exp(-(a*(x-x0)^2 + 2*b*(x-x0)*(y-y0) + c*(y-y0)^2));
end
|
function varargout = UploadImages(varargin)
% UPLOADIMAGES MATLAB code for UploadImages.fig
% UPLOADIMAGES, by itself, creates a new UPLOADIMAGES or raises the existing
% singleton*.
%
% H = UPLOADIMAGES returns the handle to a new UPLOADIMAGES or the handle to
% the existing singleton*.
%
% UP... |
function [SX, AG] = processphenotype(data_name, path)
% Extract age and sex of the subject
if (strcmp(data_name, 'mindboggle'))
mindsourceinfo = readtable(path);
[idx,~] = find(strcmp(no_file(id).name(1:end-7),mindsourceinfo{:,1})==1);
if (strcmp(mindsourceinfo{idx,2},'M'))
SX = ... |
function UKF_weights_test()
n = 4;
alpha = 0.1;
beta = 2;
kappa = 1;
weights = UKF_weights(n,alpha,beta,kappa);
Wc_test = [-76.0100 10.0000 10.0000 10.0000 10.0000 10.0000 10.0000 10.0000 10.0000];
Wm_test = [-79.0000 10.0000 10.0000 10.0000 10.0000 10.0000 10.0000 10.0000 10.0000];
... |
function [theta, delta] = dcbm_theta_update_spingarn(d,tau,varargin)
%function [theta, delta] = dcbm_theta_update_spingarn(d,tau,alpha,VERBOSE)
parser = inputParser;
parser.KeepUnmatched = true;
addOptional(parser,'alpha',1)
addOptional(parser,'VERBOSE',0)
parse(parser, varargin{:});
alpha = parser.Results.alpha;
VER... |
function d = dist_M_spd(X,Y)
V = logmap_spd(X,Y);
d = sqrt(innerprod_TpM_spd(V,V,X));
%% This version will be faster.
%rtX = sqrtm(X);
%tmp = logm(rtX*Y*rtX);
%d = sqrt(trace(tmp*tmp));
end |
function [dta,bheader]=getblock(file,np,n)
%file: file to read block from
%dta: returned block
%bheader: returned fid block header information for the last block that
%was read
bheader=struct('scale',{0},'status',{0},'index',{0},'mode',{0},'ctcount',{0},'lpval',{0},'rpval',{0},'lvl',{0},'tlt',{0... |
% for i=1:length(taggedGroups{1}) % beds
% for j=
%
%
%
% end
% end
allKeys=keys(mapOfCompToVarshaCategory);
numberOfBedsInScenes=zeros(0);
objectsNearBedInOneBedScenes=zeros(0);
for i=1:length(allKeys)
value=mapOfCompToVarshaCategory(allKeys{i});
if ~isequal('help',allKeys{i})
i; ... |
% Zadatak:
% Napisati algoritam i kod u Matlabu koji ce da izracuna zbir svih
% pozitivnih elemenata vektora.
function output = SumaPozitivnihElemenata(vektor)
output_sum = 0;
for i = 1:length(vektor)
current_element = vektor(i);
if current_element > 0
output_sum = output_sum + current_element;
end
end
output... |
clear
path = '/Users/pyeror/Work/transfert/PreventAD/group_motion_adni/';
file_template = 'subject[0-9]*_session1_r1d[0-9]*';
[tab,labels_x,labels_y,labels_id] = niak_read_csv([path 'qc_scrubbing_group.csv']);
sub = 0;
for n = 1:length(labels_x)
in_string = labels_x(n);
start = regexp(in_string, ... |
function p = random_param_generator(sets, model, varargin);
% this gets called by optimize_fcn. any others?
fixed_params = [];
generating_flag = false;
assignopts(who,varargin);
if generating_flag
lb=model.lb_gen;
ub=model.ub_gen;
else
lb=model.lb;
ub=model.ub;
end
contrast_type = 'new';
switch contr... |
function [hp]=patchNormPlot(varargin)
% function [hp]=patchNormPlot(F,V,a,pathType)
%
% Simple function to plot surface normal vectors with magnitude a for the
% patch data specified by the faces F and vertices V. The option third
% input patchType sets the type of surface normal to use, i.e. the face
% normal ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% 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:... |
function recordComment(varargin)
% Call to record a comment
% Inputs:
% (Optional) handle to imlook4d handles (assume gcf if not specified)
% string
%
if nargin == 2
comment = varargin{2};
imlook4d_current_handles = varargin{1};
else
imlook4d_current_handles... |
% ===Generate tansmitted and recieved signals
% ---Setting parameters
R = [1.e3, 2.e3, 3.e3]
A = [0.5, 1.0, 0.8]
Kr = 4.1e+11
Tp = 37.0e-06
Br = abs(Kr) * Tp
alp = 1.24588 % 1.1-1.4
Fsr = alp * Br
Fc = 5.3e9
Fc = 0.
Tsr = 5.1 * Tp
Nsr = int(Fsr * Tsr)
t = linspace(-Tsr / 2., Tsr / 2, Nsr)
f = linspace(-Fsr / 2., F... |
% Carries out 3 trials each, with 6 different trainings, and saves
% the resulting raster plots of W1 in a series of files. Also counts
% the number of neuron firings in W1 due to C2 and C3 in the post-
% competitive epoch (from 155ms to 205ms), and saves the result in a
% file
PCE = [];
for training = 1:12
seed1 = ... |
%%
% Author: Amoiensis
% Email:Amoiensis@outlook.com
% Date: 2019.10.08
% Homework 10.08
% Course: Computational Method
%%
function [y] = LaGrange(X,Y,position)
%Give accurate X<Vector>,Y<Vector> and position<scalar> value, and return the LaGrange_Fuction(positon)<scalsr> value.
% 输入用于拟合的 X、Y值(向量)和 待估计点的值,返回该点拉格朗日插值法估计... |
function [ dtheta ] = eqns1( t, theta, Io, m,g, R, alpha, b, c, ag, omega, phi, Tex, Fp,signf)
dtheta=zeros(2,1);
ddu=ag*sin(omega*t+phi)*heaviside(Tex-t); % y=heaviside(x) if x<0, y=0; if x>0,y=1.
term1=m*g*R*sin(alpha*signf-theta(1));
term2=c*theta(2)*(2*b*cos(theta(1)/2))^2;
term3=Fp*b*signf*cos(theta(1)/2);
ter... |
function setversion(version,release)
%SETVERSION Set the version of AT
%
%SETVERSION()
% Keep the version number and try to get a release string from the "pull
% request" number. If not available, the release is set to 'atcollab'.
%
%SETVERSION(VERSION)
% Set a new version number. The release is set to 'atcollab'... |
function [ ls ] = logSum( x )
pi=max(x);
ls=pi+log(sum(exp(x-pi)));
end
|
load swissRainfall.mat
normplot(swissRain(:, 1))
print('proj1/normplot_data', '-deps')
close
normplot(sqrt(swissRain(:, 1)))
xlabel('sqrt(Data)')
print('proj1/normplot_sqrt_data', '-deps')
close
normplot(log(swissRain(:, 1) + 1))
xlabel('log(Data + 1)')
print('proj1/normplot_log_data', '-deps')
close
|
function [c1,F1,Fr] = analyzeP31()
%
% this analysis tool was used for Ascorbic Acud Project to plot the
% phosphorous spectra taken over time for a given perfused lung.
%
% File created: 2/20/2013 by Mehrdad Pourfathi
%
% Update 1: 1 2/21/2013 by Mehrdad Pourfathi
%
%% Load FIle
clear all
% Experiment parameters.... |
%
% CREATE TABLE t_transducer
% (
% transducer_pkey SERIAL PRIMARY KEY,
%
% transducer_manufacturer TEXT, -- Transducer manufacturer (ICES instrument_transducer_manufacturer)
% transducer_model TEXT, -- Transducer model (ICES instrument_transducer_model)
% transducer_beam_type_key INT, -- For example "single-be... |
% This function generates normalized rayleigh samples based on Inverse DFT
% method as was proposed by David J. Young, and Norman C. Beaulieu
% "The Generation of Correlated Rayleigh Random Variates by Inverse
% Discrete Fourier Transform, "
% Sample Use:
% chan=genRayleighFading(512,ceil(10000/512),1e4,100);
%... |
function [im, skin_mask, I] = detect_skin(I)
if nargin < 1
I = imread('img.jpg');
[im, skin_mask] = detect_skin(I);
imshow(im,[]);
imshow(skin_mask,[])
im = [];
skin_mask = [];
return
end
[hue, s, v]=rgb2hsv(I);
% YCbCr per ITU Rec. 601, the following equations, correct to three decimal places, can be ... |
function h = apply_lims_and_save( filename, kind, lims, varargin )
params = struct( ...
'formats', {{ 'eps', 'svg', 'png' }} ...
, 'append', [] ...
);
params = parsestruct( params, varargin );
h = dsp__load_and_apply_limits( filename, kind, lims );
if ( ~isempty(params.append) )
filename = sprintf( '%s_%s', ... |
function varargout = FECG_GUI(varargin)
% FECG_GUI MATLAB code for FECG_GUI.fig
% FECG_GUI, by itself, creates a new FECG_GUI or raises the existing
% singleton*.
%
% H = FECG_GUI returns the handle to a new FECG_GUI or the handle to
% the existing singleton*.
%
% FECG_GUI('CALLBACK',hObject,ev... |
function [x,VoicedVector] = CodeSpeech1(wavname)
% Sample file to code the active speech frames
x = wavread(wavname);
% % % FID = fopen('CodedData.cod', 'w');
CActive = 1;
CSilence = 0;
CSID = 2;
Ns = length(x); %Number of samples
NsFrame = 80; % Frame size (10ms) --- NEED TO CHANGE FOR
NsLA = 40; ... |
function get_harm_dir(directory,F0,wid,thr)
%
%function get_harm_dir( directory [, F0, wid, thr ] )
%
% Applique la fonction GET_HARMONICS a tous les fichiers wav
%contenus dans le repertoire 'directory'. Attention, a ne lancer
%que le soir avant de partir si le repertoire contient plus d'une
%dizaine de fichi... |
function [header,data] = load_mbs_results_struct(filename)
[fid, message] = fopen(filename);
if fid == -1
disp(message)
return
end
% read in the first 14 lines - these contain various header bits.
line = fgetl(fid);
while ~contains(line,'#')
[t,r]=strtok(line, ':');
if strcmp(t,'number_of_regions')
... |
% create invt list and hamming distance table for hash
% z.li, 2017/07/07, started
% input:
% q - query hash
% r - hamming distance
% indx - hash index, precomputed with getHashIndex()
% output:
% hoffs - offset in the hash table
function [hoffs,dist,offs,vlist]=fastHashSearch(q, r, indx)
dbg=0;
if dbg
n=1... |
load PS4_info_1st20.mat
load initial_trans.mat
t = tnew;
tstep = t(2)-t(1);
R_earth = NormREarth;
R_sun = NormRSun;
mu_sun = 1.32712440018e11;
mu_earth = 3.986004418e5;
Ix = 184.9343576; % kg * m^2
Iy = 321.8711548; % kg * m^2
Iz = 423.2775247; % kg * m^2
I = [Ix 0 0;
0 Iy 0;
0 0 Iz];
C = initial_trans;
beta4... |
% we can train a nn - save net, load net and use it for prediction
%digitDatasetPath = fullfile('D:\Sabha\Test\train');
digitDatasetPath = fullfile('D:\Sabha\Test\Training_dataset_2700');
imds = imageDatastore(digitDatasetPath, ...
'IncludeSubfolders',true,'LabelSource','foldernames');
labelCount = co... |
% ------------------------------------------------------------------
% --- OS4 ----
%
% This Program shows the initial window for the obstacle avoidance
% procedure developed for the OS4 helicopter.
%
% Developed by Marcelo Becker & Samir Bouabdallah
%
% ... |
function [SimulationMatrix,Pges_max, Nmax] = FillBigMatrix(BusArray,dt,worstCase)
arrtime=datetime('00:00:00','InputFormat','HH:mm:SS');
deptime=datetime('07:00:00','InputFormat','HH:mm:SS');
timediff =etime(datevec(deptime),datevec(arrtime));
dtm=fix(timediff/dt)+1;
[~,sz] =size(BusArray);
SimulationMatrix=zeros(sz+2,... |
clc;
clear;
nps=43;%43个人
result=zeros(1,1);
%读取训练数据%
[f_matrix,tclass]=readface(nps,0);
nfaces=size(f_matrix,1);%人脸的数量
%pca特征降维%
mA=mean(f_matrix);%平均数
k=80;%维度
[pcaface,V]=fastpca(f_matrix,k,mA);
%训练数据scaling化%
lowvec=min(pcaface);
upvec=max(pcaface);
pcaface = scaling( pcaface,lowvec,upvec);
%样... |
function [varexp,B,BINT,R,RINT,STATS] = regress_fine_template(session_dir,runs,hemi,template,cluster)
% Run linear regression using a retinotopic template and movie correlation
% data
%
% Usage:
% [B,BINT,R,RINT,STATS] = regress_template(areas_template,movie_mat,corr_mat)
%
% Written by Andrew S Bock Aug 2015
%... |
function [message_rank, numeric_tag, string_tag] = MPI_Probe(source, tag, comm)
% MPI_Probe - Returns a list of all messages waiting to be received.
%
% [message_rank, numeric_tag] = MPI_Probe(source, tag, comm)
%
% Source can be an integer or a wildcard '*'.
% Tag can be an integer or a string, includi... |
function [M,linearInd]=subImage(M,nSub)
% function M=subImage(M,nSub)
% ------------------------------------------------------------------------
%
%This function refines the input image M by splitting its voxels in half during nSub times
%which contains all folders and sub-folders within the folder specified by
... |
clc, clear all
data = inriaData;
name = {'Go','Si'};
for i = 1:numel(name)
params = load(['results/optimize/inriaParameters' name{i}]);
params.loggerBinFilter = handler(emptyLogger);
[~] = inriaOptimizeEnum(data,params.diaryFile,params.loggerBinFilter,...
params.method,params.svmArgs,'binFilter',... |
%% Classification by multiclass SVM-C
% Using radial basis kernel
function [accuracy, predicted_labels] = classifier_multiclassSVM(trainingData, trainingLabels, testingData, testingLabels)
% train 10 fold cross-validated multiclass SVM
addpath('libsvm-3.20/matlab');
model = svmtrain(trainingLabels, trainingData, '-t 2'... |
stiff=load('Job-1_STIF1.mtx');
mass=load('Job-1_MASS2.mtx');
num_nodes=3636;
% Ms=sparse(mass(:,1),mass(:,2),mass(:,3));
% Ks=sparse(stiff(:,1),stiff(:,2),stiff(:,3));
Ks1=zeros(num_nodes);
for i=1:size(stiff,1)
Ks1(stiff(i,1),stiff(i,2))=stiff(i,3);
end
Ms1=zeros(num_nodes);
for i=1:size(mass,1)
Ms1... |
function new_data = set_threshold(original_data, threshold)
new_data = original_data;
a=find(abs(original_data(1,:))<threshold);
new_data(1,a)=0;
b=find(abs(original_data(1,:))>=threshold);
new_data(1,b)=1;
end
|
%Anonymise results
%Set a seed
rng(1234);
%Anonymise individual results files
d = dir('./Results_All');
id_list = [];
for n = 1:length(d)
if d(n).isdir == 0
load(['./Results_All/' d(n).name]);
%generate random identifier
id = randi(2^16,1);
%If id is in the list generate until a n... |
% pVnRT asks the user for two quantities out of
% p, V and T, and gives the remaining one
% using the equation pV=nRT
% James Clark 10/10/2014
% units:
t_units = 'degrees Kelvin';
v_units = 'in m^3';
p_units = 'in Pa';
% constants used in calculation:
n = 1;
R = 8.315;
% ask user for t, p or v initally
... |
clear
clc
close all
% USER-DEFINED PARAMETERS
filename = 'data.2d';
filedir = 'Z:\Data\AST\Additives\CPMG_FT_Sample66_Oct2\5\';
omitEchoes = 0; %front-end echoes to omit
G = 23.87; %T/m
zf = 2; %levels of zero-filling
% END USER-DEFINED PARAMETERS
fileloc = strcat(filedir,filename);
parloc = strcat(filedir,'acqu.pa... |
%% URINSEV: Sensitivity analysis, switches plot and random subject fit plotting
% change the truth id accordingly when analyzing different simulations
% -FTSC
%% loading clustering result
clear;
clc;
yvar = 'urinsev';
YVAR_path = 'URINSEV';
YVAR_plot = 'Urinary Severity First Period';
period = '4to24\';
%% Data ... |
function ret = sortCards(cards)
%SORTCARDS 此处显示有关此函数的摘要
% 此处显示详细说明
load('CARDS.mat')
ranks = [];
[~, size_t] = size(cards);
for i=1:size_t
ranks(end+1) = CARDS2RANK(cards(i));
end
ranks = sort(ranks,'descend');
ret = CARDS(ranks);
end
|
% Matlab program
function B = principal_component_analysis(X, k)
% Input: X, p*n data matrix, p 個 features 以及 n 個 samples
% k, 要降到的維度, k 為正整數, k<n
% Output: B: k*n data matrix, k 個 features 以及 n 個 samples
[~, n] = size(X); % p 個 features 以及 n 個 samples
mu = sum(X, 2)/n; ... |
function [overlapbinstep,binoverlapzero,binoverlapzerointensity,binoverlapzeroarea,binoverlap,binoverlapintensity,binoverlaparea]=...
Binning(input_binnumber,input_startpoint, input_endpoint, input_data,input_intensity,input_area)
overlapbinsize=(input_endpoint-input_startpoint)/input_binnumber;
overla... |
%% impressao.m
%%
%% [IACC] = impressao(ir_dir,ir_esq,t1,t2,Fs)
%%
%% Evaluates the "interaural cross correlation" (iacc) of a binaural
%% impulse response.
%% The inputs are the right ear impulse response (ir_dir), left ear impulse
%% response (ir_esq) and its sampling frequency Fs. t1 is the integration
%% l... |
% Name: Brendan Higgins
% Date: 09/14/16
% Class: ME570 - Robot Motion Theory
% Assignment #1
%% Question 1.3 - Triangle Test Function
function [] = triangleTest()
% The purpose of this function is to generate a random triangle by calling
% the "triangleDraw" function and then generate 100 random points and
% determin... |
%%%%%%%%%%%%%%%%%%%%%%
%%MMC - TP1 %%
%%Yann LE GUILLY %%
%%%%%%%%%%%%%%%%%%%%%%
close all;clear;clc;
d=1; L=5; A=d*d; E=210e9; nu=1/2;
lam=(E*nu)/((1+nu)*(1-2*nu));
mu=E/(2*(1+nu));
%On construit les points pour tracer la barre que l on va etirer
ttM=[...
+d/2,-d/2,0;...
-d/2,-d/2,0;...
-d/2... |
function [xlist, vxhat,vyhat,dhat,dxvx,dxvy,dxd]=getmeans2(dat,plotflag)
x=dat(:,1); y=dat(:,2); d=dat(:,3); vx=dat(:,4);
vy=dat(:,5)+1.5.*x;
%vy =dat(:,5);
xlist=unique(x'); ylist=unique(y');
Nx=length(xlist); Ny=length(ylist);
Lx = max(xlist)-min(xlist);
for i=1:Nx
ind = find(x == xlist(i));
vxhat(:,i) = fft(vx... |
%
% CircleObjectDetector
%
classdef CircleObjectDetector < ObjectDetector
%ObjectDetector Summary of this class goes here
% Detailed explanation goes here
properties
objectRadiusMin;
objectRadiusMax;
objectPolarity;
objectSensitivity;
rgbImg;
e... |
function [ G,gWinLen ] = genGaborKernelF( mu,nu,sigma,scaleXY,imgSz )
% [G GWINLEN] = genGaborKernelF( MU,NU,sigma,scaleXY,imgSz )
% G = FFT{ genGaborKernel(MU,NU,sigma,scaleXY) }
% imgSz is the size of the image. In order to avoid loop noise of FFT,
% size(G{1}) will be 2^nextpow2(max(imgSz)+kernal_size-1)
% GW... |
function result = degrees( A )
%DEGREES Returns degrees for each node of adjacency graph
result = sum(adj(A)~=0, 2);
end
|
function CB1 = GOLD_code()
G1=[0 1 0 1 0 1 0 1 0 1 0];
G2=[0 1 0 1 0 1 0 1 0 1 0];
c_out=[];
for i=1:2046
G1=[ mod( sum([G1(1),G1(7),G1(8),G1(9),G1(10),G1(11)]),2 ) , G1(1:10) ];
G2=[ mod( sum([G2(1),G2(2),G2(3),G2(4),G2(5),G2(8),G2(9),G2(11)]),2 ) , G2(1:10) ];
c_out(i)=mod( sum([G1(11),G2(6),G2(11)]) ,2... |
function [yx] = FFD3(y, hx)
% use 2nd order FFD
yx = 1/(2*hx)*(-11*y(:,1:end-3) + 18*y(:,2:end-2) - 9*y(:,3:end-1) + 2*y(:,4:end));
end
|
% imagebinRP.m
% Averages 2D image into "bins" of mxm pixels, i.e. rescaling by 1/m
% If N is not an integer multiple of m, ignore "remainder" pixels at
% right, bottom edges
% Similar to imresize, but more reliable since avoids "unknown" filtering
% Inputs:
% A = input image (can be double, uint8, or uint... |
function f = parIVMDoseResponseErr(model)
global taucurve semtaucurve Icurve semIcurve
IVM=[0,0.3,1,3,6,10];
% taucurve=[0.9,0.9,2.8,11.9,16.1,16.6].';
% semtaucurve=[0.0567,0.0567,0.1129,1.8645,0.5084,4.0115].';
% taucurve=[0.19,0.19,1.8,12.1,16.7,16.9].';
% semtaucurve=[0.0567,0.0567,0.1... |
% % % Analyze Language History Questionnaire
clear all; close all; clc
group = 'Ita-Sard';
coded = 1;
if coded == 0
% read the logs
logfile = dir('Lang_Quest_Ita_Sard-*.csv');
logfile = sort_nat({logfile.name}).';
for s = 1:length(logfile)
[na, txt, whole]= xlsread(char(logfile(s))... |
% oscC00NC.m
% 190524 Matlab 2018b
% SIMULATION OF THE MOTION OF N COUPLED OSCILLATORS
% DYNAMICS OF CRYSTAL LATTICES
% All parameters are changed within the Script
% [default values and units]
% DOING PHYSICS ONLINE
% https://d-arora.github.io/Doing-Physics-With-Matlab/
% Scripts
% http://www.physics.usyd.e... |
function [ edge_mag, edge_dir ] = prewitt_ed_cvip( input_image, kernel_size )
% PREWITT_ED_CVIP- perform prewitt edge detection
%
% SYNTAX :
% ------
% [ edge_mag, edge_dir ] = prewitt_ed_cvip( input_image, kernel_size )
%
% Input Parameters include :
% ------------------------
% 'input_image' Inpu... |
cd c:/shared/audio/s2 ; ls
clear all ; close all
sets=dir('*sound*vhdr') ;
for s=1:length(sets)
EEG = pop_loadbv('.',sets(s).name) ;
EEG = pop_chanedit(EEG,'lookup','C:\eeglab10_0_0_0b\plugins\dipfit2.2\standard_BESA\standard-10-5-cap385.elp') ;
EEG = pop_resample(EEG,500) ;
if s==1 ; merged = EEG ; ... |
function triangles = polygon_triangulate ( n, x, y )
%*****************************************************************************80
%
%% POLYGON_TRIANGULATE determines a triangulation of a polygon.
%
% Discussion:
%
% There are N-3 triangles in the triangulation.
%
% For the first N-2 triangles, the first edg... |
## 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... |
%@(#) ccplot.m 1.25 05/12/12 14:47:35
%
function ccplot(matvar)
set(gcf,'pointer','watch');
handles=get(gcf,'userdata');
hpl=handles(2);
if gca~=hpl, axes(hpl);end
ud=get(hpl,'userdata');
[iu,ju]=size(ud);
axtyp=ud(1,:);
plottyp=ud(2,:);
clmap=ud(3,:);
dname=ud(4,:);
distfile=ud(5,:);
option=ud(6,:);
cminstr=ud(... |
function [laneID] = isOnLaneSection(obj,point)
%ISONLANESECTION Check if a point is located within a laneSection
% Return the laneID
%
%----------------------------------------------------------------------
% BSD 3-Clause License
%
% Copyright (c) 2020, Jonas Wurst, Alberto Flores Fernánde... |
function [ output_args ] = CHECK( a )
%CHECK Summary of this function goes here
% Detailed explanation goes here
output_args = ~bitand(1, a);
end
|
clc
clear all
fprintf ('\t\t\t\t\t\t\t\t Escuela politecnica del Ejercito')
fprintf('\n\t\t\t\t\t\t\t\t\t Procesos estocasticos')
fprintf('\n\t\t\t\t\t\t\t Ejercio 1 variable aleatoria')
fprintf('\n\t\t\t\t\t\t Nombre: Felipe Leon');
fprintf('\n\t\t\t\t\t\t Curso: 5to ETE B ');
k=[0:1:15];
l=10; %lambda
e1=exp(-l); %... |
clear all
figure
hold on
init_Constants
disp('Testing on the left side of the field')
Robot.x = 0;
Robot.y = 0;
Robot.theta = 0*deg;
R = 5;
table = [];
for alfa=0*deg:10*deg:350*deg,
carrot.x = cos(alfa) * R;
carrot.y = sin(alfa) * R;
[angle, distance] = calcAngleandDistance_v... |
function [data,domain,ID]=GetDataL1M;
data=[];
domain=[];
ID=[];
xdim=1024;
ydim=512;
eps=0.01;
atype=1;
xtype=1;
ntype=1;
xmax=inf;
nnul=ceil(sqrt(xdim));
nnulprob=nnul/xdim;
normalize=0;
nxny=[32,32];
while(1==1)
strXdim=sprintf('x-dimension: %1d',xdim);
strYdim=sprintf('y-dimension: %1d',ydi... |
function [F1, F2] = lower_constraint_dPsi(Y_0, Y_end, dy, dy_constr1)
delta = Y_end(1) - Y_0(1);
c0 = Y_0(2);
c1 = Y_0(3)/Y_0(2);
Ma = [delta^2 delta^3;
2*delta 3*delta^2];
Mb = [Y_end(2) - c1*delta - c0;
Y_end(3)/Y_end(2) - c1];
Mc = inv(Ma)*Mb;
c2 = Mc(1);
c3 = Mc(2);
y=Y_0(1):dy:Y_end(1);... |
%% Quick Test : Classify a single feature
clc
clear all
close all
load SubSetNormalizedFeaturesSet2.mat
y=SubSetNormalizedFeaturesSet2;
clear SubSetNormalizedFeaturesSet2;
% load NormalizedFeaturesSet2.mat
% y=NormalizedFeaturesSet2;
% clear NormalizedFeaturesSet2;
num_features=size(y,2)-1
[class1, class2 ,class3]... |
clc;
close all;
clear all;
% load first_order;
load high_order;
y1 = y;
y2 = de_abnormal_1(y,10);
[ts,Mp,fai,tr,tp,ys,text]= value(y2,t(2)-t(1));
plot(t,y2,'y-','linewidth',5);
hold on;
[lp,m]=size(y2);
if m>lp
lp = m;
end
dt = t(2)-t(1);
k=ys;
T=0;
Point_T040 = 0.40*ys;
Point_T080 = 0.80*ys;
s... |
function left_impact_constraints(nlp, src, tar, bounds, varargin)
plant = nlp.Plant;
% fist call the class method
plant.rigidImpactConstraint(nlp, src, tar, bounds, varargin{:});
% Don't need time continuity constraint
removeConstraint(nlp,'tContDomain');
end |
function general_adaption_scipt
global reynoldsnumber nu Lref alpha TEmax curiter curfeval fidhistory ...
leftbndry rightbndry method freq_history forward_mapping TEtolerance
% clear
% clc
%% Setup executable path
working_dir = '/home/roycfd/Tyrone/burgers-mesh-optimization/';
exe_path = [working_dir,'libra... |
%M4.6) Causal IIR filter
% https://ece.uwaterloo.ca/~ece413/HW/Solution1.pdf
% https://uk.mathworks.com/help/ident/ref/bode.html TF
close all;
clear all;
k = 1;
for w = 0:0.01:2*pi %frequency range
z=exp(-1i*w);
%Transfer function
H(k)=(0.0534.*(1+z.^(-1)).*(1-1.0166.*z.^(-1)+z.^(-2)))./...
... |
clearvars
Folder='E:\F8Se2 July\08042020\apd';
codefolder=pwd;
cd(Folder)
names=struct2cell(dir('p*d*d.txt'));
n=names(1,:);n_length=length(n);
for i=1:n_length
new=genvarname(n{1,i}(1:end-4));
eval([new '=importdata(names{1,i});']);
end
clearvars names n
names=struct2cell(dir('*d*dp*'));
n=names(1,:);n_length... |
function [f,nf]=getfreq(fnamefr,fs);
%
% functia citeste primele numere prime care sunt mai mici dacat jumaate
% din frecventa
%
f1=load(fnamefr,'-ascii');
m1=length(f1);
fmax=fs/2;
j=1;
while (j <= m1) & (f1(j) <=fmax)
f(j)=f1(j);
j=j+1;
end
nf=j-1;
% |
% Example of using Moran's eigenvector maps (MEM's) in spatial ecology
%
% by David L. Jones, May-2008
%
% This file is part of the FATHOM Toolbox for Matlab and
% is released under the GNU General Public License, version 2.
% File: '.../examples/spacemaker.mat'
% File: '.../examples/oribatid_mites.mat''
% -----Note... |
function v=vecshd(v,u);
%usage: vec=vecshd(v,u)
%
%shift down a vector v, pad with u or zero.
% Programmed 1994 by Niels K. Poulsen
% Department of Mathematical Modelling,
% Technical University of Denmark
%
n=max(size(v));
v(2:n)=v(1:n-1);
if nargin==1,
v(1)=0;
else
v(1)=u;
end
|
% This code takes in input a Data.csv file with one line og header and 7
% data columns.
clear all
close all
clc
%DataTab = readtable('Data.csv') ;
%%
% Reading CSV file with standard format. From first to 7th column we read:
% integers, string, string, string, floating, floating, floating
IDf = fopen('Data.csv') ;
... |
% Example of dummy coding categorical variables for regression analysis
%
% by David L. Jones, Oct-2010
%
%
% This file is part of the FATHOM Toolbox for Matlab and
% is released under the GNU General Public License, version 2.
% Create some categorical variables:
var_01 = [ones(12,1);ones(12,1)+1] % 1 ... |
function [ EB Psi r ] = qp_fh( pqn, L, m_L )
% Solution of Schrodinger Equation for hydrogen atom
% INPUTS +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
r_max = 20e-10;
% if pqn > 3
% r_max = 40e-10;
% end
Z = 1;
num = 901; % must be odd number
% CONSTANTS ++++++++++++++++++++++++++++++++... |
function compute_gamma_M_vector(obj, estimator)
if isempty(obj.gamma_M)
obj.gamma_M= estimator.gamma_k;
for i= 1:obj.M
n_start= estimator.n_k + sum( obj.n_ph(1:i-1) ) + 1;
n_end= estimator.n_k + sum( obj.n_ph(1:i) );
obj.gamma_M( n_start:n_end )= obj.gamma_ph{i};
end
else % updat... |
function p = ortotest(u, reg, lags)
z = size(u,1);
rog = [ones(z-lags,1)];
for j=1:lags
rog = [rog reg(lags+1-j:end-j,:) ];
end
[a b]=myols(u(lags+1:end),rog);
R=a(1,end);
dn = lags*size(reg,2);
dd=z-dn-1;
p=1-fcdf((R/dn)/((1-R)/dd),dn,dd);
|
function[] = plot_stride_md_spd(group_speed,plt_cell,plt_mean_cell)
if ~isfield(group_speed,'stride_bins_mean') && ((~isfield(group_speed,'img_bins_mean')&& plt_cell)|| (~isfield(group_speed,'img_bins_mean_cell')&& plt_mean_cell))
error('Necessary fields missing.')
else
paw_lab = {'FR','HR','FL','HL... |
clear;
isCanceled = false;
hWaitbar = waitbar(0.9,'请等待...',...
'Name','这是名字',...
'CreateCancelBtn','isCanceled = true;');
btnCancel = findall(hWaitbar,'style','pushbutton');
set(btnCancel,'string','取消','fontsize',10);
h = findall(hWaitbar,'type','patch');
set(h,'EdgeColor','k','fa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.