text stringlengths 8 6.12M |
|---|
function [indnose, indtail, Boundary] = TuneNosePoint(NumberOfObjects, Boundary, indtail, indTail, Tail1Centroid, CC, p, v)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function [indnose, indtail, Boundary] = TuneNosePoint(NumberOfObjects, Boundary, indtail, indTail, Tail1Centroid, CC... |
%% Plotting script for Berry
% show what Logfile you are currently working on:
dataFileNameBarry
%% Plot the WAM Joint Positions
NoSubs = size(BarryData.WAMJointPositions,2);
greensHSV = [0.3333*ones(1, NoSubs)', 1*ones(1, NoSubs)', linspace(0.1, 1, NoSubs)'];
greens = hsv2rgb(greensHSV);
xWAM = (1:length(BarryData.... |
function [learning_obj, results_filename, model_filename] = init_hyper_params(learning_obj, hyper_params, ofold, ifold, get_only_fname)
% function [learning_obj, results_filename, model_filename] = init_hyper_params(learning_obj, hyper_params, ofold, ifold)
% input variables:
% learning_obj, is the learning instance to... |
%% Problem 4: Cruise Control
%% Part A: Equilibrium for open and closed loop controllers
% beta = a/a_hat: use as domain from 0:2
beta = 0:0.05:2
% let Vss/Vref = V
V_ff = 1./beta
V_fb = 10./(beta + 10)
figure(1)
clf
hold on
plot(beta, V_ff)r', 'latex')
hold off
saveas(1, "ES155P0_4a_steadystatevsbeta.png")
%% Pa... |
function varargout = asd(varargin)
% ASD M-file for asd.fig
% ASD, by itself, creates a new ASD or raises the existing
% singleton*.
%
% H = ASD returns the handle to a new ASD or the handle to
% the existing singleton*.
%
% ASD('CALLBACK',hObject,eventData,handles,...) calls the local
% f... |
% findE function
function E = findE(stress,strain)
numberPoints = 10;
coeffs = polyfit(strain(1:numberPoints),stress(1:numberPoints),1);
E = coeffs(1);
% dydx = derivative(stress,strain)
% d2ydx2 = derivative(dydx,strain(1:length(strain)-1))
% i = 1;
% epsilon =
% while abs(d... |
function writeToLogField(logFieldHandle)
global history;
log = '';
set(logFieldHandle,'string','');
for i=1:size(history,2)
chessColor='';
if history{i}(1,3)==1
chessColor = 'B';
else
chessColor = 'W';
end
log=[log,sprintf('%s (%s,%c)\n',ch... |
function [M,K] = tc(X,Z,varargin)
% Transfer components
% Parse input
p = inputParser;
addParameter(p, 'sigma', 1);
addParameter(p, 'mu', 1);
addParameter(p, 'nC', 1);
parse(p, varargin{:});
% Shapes
[~,n] = size(X);
[~,m] = size(Z);
% Form block kernel
K = K_block(X',Z', 'sigma', p.Results.sigma);
% Objective func... |
%% Nonlinear Conjugate Gradient Method
function [point, output, time, iter] = nonlinear_CG(f, f_exact, f_gradient, point, epsilon, max_iter)
tic;
v = 0.1; % for orthogonality test
plot_point = zeros(0, 2); % for plot result
before = f(point(1), point(2), point(1), point(2)); % initial function value
% initial... |
%% Importação dos dados
clear; clc; close all;
% X = Vetor de entrada
dataX = load('FULL_PKCV_data.txt');
dataX = dataX'; % dataX deve ser: atibutos(linhas) x amostras (colunas)
% Tamanho do conjunto de dados
[m, p] = size(dataX'); % m = numero de amostras, p = numero de atributos
% y ... |
% Function to check that the same resets are used for equal clocks when
% forming the product or input output composition
function b = compare_clock(c1,c2,R1,R2)
b=1;
for i=1:length(c1)
for j=1:length(c2)
if strcmp(c1{i},c2{j}) && ~strcmp(R1{i},R2{j})
b=0;
... |
function [H] = discrete_mean_curvature(V,F)
% DISCRETE_MEAN_CURVATURE Compute integrated mean curvature at each vertex.
%
% H = discrete_mean_curvature(V,F);
%
% Inputs:
% V #V by 3 list of vertex positions
% F #F by 3 list of triangle indices into V
% Outputs:
% H #V list of integrated mean-... |
centers_map = containers.Map();
radii_map = containers.Map();
%% Pinky
centers_map('pinky_top') = [-1.46; -1.984; -0.419];
radii_map('pinky_top') = 0.16;
centers_map('pinky_middle') = [-0.986; -1.698; -0.225];
radii_map('pinky_middle') = 0.18;
centers_map('pinky_bottom') = [-0.506; -1.324; 0.059];
radii_map('pinky_b... |
function rhs = rhs_skew_NCP(q,~)
global params
global m11 ;
global m12 ;
global m13 ;
global m21 ;
global m22 ;
global m23 ;
global m31 ;
global m32 ;
global m33 ;
%call get_param('Gittertypus', Gittertypus,default='kartesisch')
%call get_param('nt',nt)
%[ n1, n... |
% imgdata = DumpFrame(myobj, frameNumber)
% imgdata = DumpFrame(myobj, frameNumber, cropRect, downsample_pix)
%
% Retrieve frame number 'frameNumber' from the currently
% running plugin. The returned matrix is a matrix of
% unsigned chars with dimensions: 3 x width x ... |
%% Derivation: Rashad Baiyasi lab notebook 02/01/16-__/__/__: pgs 143-145
clearvars
%% Relavant parameters
d = 10; %nm
NWdiam = 430; %nm
rot = @(ttheta) [cos(ttheta),-sin(ttheta);sin(ttheta),cos(ttheta)];
phi_int = pi*108/180; % pentagon interior angle
%% Vertices of pentagon
% unit pentagon
phi_v = pi/180*(... |
clear
close all
% 循环次数
loopcnt = 5;
global_cutoff_soc = 0;
global_cutover_soc = 100;
param{1} = Parameters_init(global_cutover_soc);
param{1}.CutoffSOC = global_cutoff_soc;
param{1}.CutoverSOC = global_cutover_soc + 1; % 防止一开始就超过界限了
% 放电电流密度
curr_discharge = -25;
maxtime_discharge = 10000;
% 休息的时间
time_rest = 5000;
... |
function [X, idx_nan] = set_nans_zero(X)
idx_nan = any(isnan(X),2);
X(idx_nan,:) = 0;
end |
function [cx, minFoM ] = dickson_optimizer_ssl (topology,opt)
% dickson_optimizer_ssl(topology,mode,Io): Finds the optimal capacitor relative sizing fora a dkison
% topology. The otpimtzation is done for a converter operatin in the ssl
%
% Based on Michael Seeman work
%Input paramters:
% + topology: dikson topo... |
%Yukai controller.
classdef RadioCommandInterpreter <matlab.System & matlab.system.mixin.Propagates & matlab.system.mixin.SampleTime %#codegen
% PROTECTED PROPERTIES ====================================================
properties
max_turn_per_sec;
Vx_tgd_fil_param;
Vy_tgd_avg_f... |
function yout = zbiornik1(a1,c1,c,w,x1,u)
yout = (u-c1*(x1.^a1))/(c*w);
end
|
function [pf, J_pf_f, J_pf_p] = toFrame2D(F, p)
T = F(1:2);
th = F(3);
R = [cos(th) -sin(th); sin(th) cos(th)];
pf = R' * (p-T);
J_pf_p = R';
x = T(1);
y = T(2);
px = p(1);
py = p(2);
J_pf_f = [...
[ -cos(th), -sin(th), cos(th)*(py - y) - sin(th)*(px - x)]
[ sin(th), -cos(th), - cos(th)*(px - x) - sin(... |
%Powerpoint: Research Questions, Motivation, Lit Review, Contribution
load btcchoice_model.mat
sample_size = 819; %sample size (time periods) take off 200 at end
[stockstates_sample_path_index, index] = deal(3); % starting state(index) for CDF Random Draw
stockstates_sample_path = stockstates(index);
%Make Probabili... |
% This script fixes timestamps in jAER .aedat files that have non-monotonic or very large
% timetsamps differences that cause pauses in playback of data. These
% timestamp problems are due to early hardware used on early versions of
% the DVS128 camera and in some of the CPLD logic designs.
%
% The maxdt parameter... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
% unit step sequence
t=-5:0.1:10;
u=heaviside(t)
plot(t,u)
ylim([-0.3 1.3])
figure
t1=-5:.1:0
t2=0:.1:10
u1=zeros(size(t1))
u2=ones(size(t2));
t=[t1 t2];
u=[u1 u2];
plot(t,u);
ylim([-0.3... |
load tennis_data
M = size(W,1); % number of players
N = size(G,1); % number of games in 2011 season
psi = inline('normpdf(x)./normcdf(x)');
lambda = inline('(normpdf(x)./normcdf(x)).*( (normpdf(x)./normcdf(x)) + x)');
pv = 1.2; % prior skill variance (prior mean is always 0)
% init... |
% This is the main function of EP21 ADAS report m file
% with little change, this can also be used on other conditions
% for autonomous report generation
cd('C:\Users\CaoXing\Desktop\report_latex');
%%% This gives the Path where the .m file is stored
fname=mfilename();% m funtion name
completepath=mfilename('fullpath... |
function [] = computational_experiment()
%files = {'50.1sv1(20.15.30) (excellent dataset)', '50.1sv2(20.15.30) (MSE Control do not change)', '50.1sv3(20.15.30) (MSE Control do not change)', '50.1sv4(20.15.30) (Control tend bad)', '50.1sv5(20.15.30) (Tend bad)', '50.1sv5(20.15.30) (Very good)'};
files = {'50.2sv1(20.15... |
% Choudhury Noor, Cardy Wei
% ECE 455 - Computer Security
% Final Project
%% Load
f = fopen('devrnd_samples.txt','r');
s = fscanf(f,'%s');
bits_linux_full = nan(size(s));
for i = [1:length(s)]
bits_linux_full(i) = (str2double(s(i)));
end
fclose(f);
f = fopen('custom_samples.txt','r');
s = fscanf(f,'%s'... |
function [ML,MU] = munu_m_d
%
% Deletes the global data that has been generated by 'munu_m_i'.
%
% Calling sequence:
%
% munu_m_d
% [ML,MU] = munu_m_d
%
% Output:
%
% ML, MU LU factors of M
%
% ML and MU are returned just in case the LU factors of M are needed for some
% reason after... |
function dsp__plot_mult_spect()
plot_day = '042517';
% LINE SPEC
windows = { [0 300] };
plot_over_frequency = true;
line_limits = [ -.15 .07 ];
% SPECTROGRAM SPEC
color_limits = [ -.15 .07 ];
% BEHAV CORRELATIONS
time_freq_windows = { {[100 200], [45 65]}, {[200 300], [15 30]}, {[-50 50], [50 65]}, {[-50 50],... |
% cemDipoleRadiating
% Ian Cooper
% email: matlabvisualphysics@gmail.com
% 220815 / Matlab version R2021b
% DOING PHYSICS WITH MATLAB
% https://d-arora.github.io/Doing-Physics-With-Matlab/
clear
close all
clc
% Animated gif =======================================================
% Show and Save... |
%fig3-3
set(0,'DefaultAxesFontName', 'Arial');
set(0,'DefaultAxesFontSize', 12);
% Change default text fonts.
set(0,'DefaultTextFontname', 'Arial');
set(0,'DefaultTextFontSize', 12);
%spikes
spikes_data = load('activity_contr_ampl3.csv');
min_time = 100;
max_time =200;
start_index = find (spikes_data(:,... |
%%
%
%
% The Bravo Dome carbon dioxide gas field is located in northeast New Mexico. The Bravo Dome field
% covers approximately 3200 km^2. Production in 1989 was 3.2e9 cubic meter of gas from 272
% wells. Cumulative production at the end of 1989 was 17e9 cubic meter. Estimated recoverable
% reserves are more than 2... |
function prismatic
start = -.3;
finish = -.8;
startvelocity = 0;
finishvelocity = 0;
n = 20;
dt = 1/(n-1);
M = 10;
I = 1;
% bang bang!
pos = zeros(n,1);
vel = zeros(n,1);
acc = zeros(n,1);
pos_cur = start;
s = sign(finish - start);
pos(1) = start; vel(1) = startvelocity;
for i = 2:n
...
if start < fi... |
function msm_to_hb ( output_filename, A, rhs, title, key, type, ifmt, job )
%*****************************************************************************80
%
%% MSM_TO_HB writes a MATLAB Sparse Matrix to a Harwell Boeing Sparse Matrix file.
%
% Usage:
%
% For full control:
%
% msm_to_hb ( output_filename, ... |
% Copyright (c) 2017 Zi Wang
function K = computeAddKnm(xx, xxp, hyp, hyp_idx, z)
% Compute the additive kernel Knm
all_cat = unique(z);
K = 0;
for i = 1:length(all_cat)
K = K + computeKnm(xx(:,z==all_cat(i)), xxp(:,z==all_cat(i)), ...
hyp.l(hyp_idx, z==all_cat(i))', hyp.sigma(hyp_idx, all_cat(i)));
end |
function [ my_preproc ] = cm_maxlabPreproc( EEG,currentSub,iSub,RUN )
%Simplifies preprocessing by allowing you to change parameters of RUN
% RUN.maxlabPreproc contains several ways of preprocessing
% Output can be saved then loaded for further analysis
global RUN
%% Filter - currently in EEGLAB
%EEG = po... |
%% Clear memory and set path
clearvars; close all; clc
home = pwd; cd ..; cd ..; base = pwd; cd(home);
addpath(fullfile(base,'CoFE_toolbox'))
%% CASE data
% input file
inputFile = 'seventyTwoBarTruss.bdf';
% SUBCASE 1
CASE=case_obj;
CASE.SOL = 101;
CASE.SPC = 1;
CASE.LOAD = 1;
CASE.STRESS=1;
% SUBC... |
function len = polygonLength(poly, varargin)
%POLYGONLENGTH Perimeter of a polygon.
%
% L = polygonLength(POLYGON);
% Computes the boundary length of a polygon. POLYGON is given by a N-by-2
% array of vertices.
%
% Example
% % Perimeter of a circle approximation
% poly = circleToPolygon([0 0 1... |
function [time_1,time_2] = timeAndVol(neib_1,neib_2)
predict = readData('E:\traffic_data\detector_data\157\predict-cross.csv',2,80);
% [neib_1,neib_2] = correlation('E:\traffic_data\detector_data\157\neighbor_1.csv','E:\traffic_data\detector_data\157\neighbor_2.csv','E:\traffic_data\detector_data\157\predict-cross.csv'... |
%% ------------------------- Registration ------------------------------ %%
%% --------------------------------------------------------------------- %%
close all
clear, clc
%% ------------------------ Data set: Brooks --------------------------- %%
%% ------------------------- Load matricies ----------------------... |
function [post, a] = gmmpost(mix, x)
%GMMPOST Computes the class posterior probabilities of a Gaussian mixture model.
% Check that inputs are consistent
errstring = consist(mix, 'gmm', x);
if ~isempty(errstring)
error(errstring);
end
ndata = size(x, 1);
a = gmmactiv(mix, x);
post = (ones(ndata, 1)*mix.priors).*a;... |
%Script that approximates the side and drag forces, the average rotor
%torque acting on a rotor disk, and the power requirement to drive the
%rotor for a rotor disk of user-specified geometry travelling at a
%user-specified air velocity with vertical and forward components.
%Written by Jonathan De Sousa
%Credit to Dr... |
classdef CornersMethod < exmethods.AbstractMethod
methods
function st = extract(this, bwEyeIm)
[l,r] = this.getCorners(bwEyeIm);
quadMeanL = sqrt(mean(l.Location.^2));
quadMeanR = sqrt(mean(r.Location.^2));
densityL = mean(pdist2(quadMean... |
function [voxSet, voxSet_collapsed] = getVoxelSet(infoCell)
%UNTITLED2 Summary of this function goes here
% input - voxSelMat - [iter x CVB]
% output - voxSelIdx - [iter x 1] - idx of set of vox selected
nIters = size(infoCell,2);
if nIters ~= 0
NCVB = size(infoCell{1}.voxSel,2);
voxSet = cell(nIter... |
function L = ImageProcessing(image, threshold)
% splits up an image into good and bad region
% INPUTS:
% image - an RGB image, made by doing imread()
% threshold - threshold to find edge vs paper (default is set to 0.3)
% OUTPUTS:
% L - sectioned image that is 1 for bad area, and 0 for good area
if nargin == 1
... |
function PlotJointData(J)
jname = sprintf('%s/%s Joint', J.name1, J.name2);
nsubplotst(J.T,J.t1,sprintf('%s Torque on %s',jname, J.name1));
nsubplotst(J.T,J.f1,sprintf('%s Force on %s',jname, J.name1));
nsubplotst(J.T,J.t2,sprintf('%s Torque on %s',jname, J.name2));
nsubplotst(J.T,J.f2,sprintf('%s Force ... |
function header=read_protocol_header(filename);
% function header=read_protocol_header(filename);
%
% function to read parameters from siemens ascii protocol header
% (e.g., MrProt.asc or meas.asc for VA15 and VA21, respectively)
% and output the information in a matlab structure variable "header"
% **************... |
function c=inmultire(d,inm)
T=0;
for i=length(d):-1:1
c(i)=d(i)*inm+T;
T=floor(c(i)/10);
c(i)=mod(c(i),10);
endfor
while T
c=[mod(T,10) c];
T=floor(T/10);
endwhile
endfunction
|
function [xmin, fmin] = minima (f, a, b, tolm)
% one-dimensional minimization
% Brent's method
% input
% f = objective function coded as y = f(x)
% a = initial x search value
% b = final x search value
% tolm = convergence criterion
% output
% xmin = minimum x value
% fmin = minimum... |
function theoretical_BER = Theo_ber( varargin )
if nargin == 6 % DF K=1
CH_sd = varargin{1};%获取传入的第1个参数
CH_rd1 = varargin{2};%获取传入的第2个参数
POW_S_sd = varargin{3};%获取传入的第3个参数
POW_N_sd = varargin{4};%获取传入的第4个参数
POW_S_rd = varargin{5};%获取传入的第5个参数
POW_N_rd = varargin{6};%获取传入的第6个参数
gamma_... |
%% What is the percentage of beds capacity for ICU (Intensive Care Unit) beds in each country?
% when the goverment decided to restrict any gathering in this timeline?
any_gathering_restrict_start_date_spain='14/03/2020'
any_gathering_restrict_start_date_canada='23/03/2020'
icu_bed_s=icu_data_s().'
icu_bed_c=icu... |
%% randwalks.m
% From A First Course in Machine Learning, Chapter 4.
% Simon Rogers, 01/11/11 [simon.rogers@glasgow.ac.uk]
% Random walk examples
clear all;close all;
%% Define the starting point
w = [0;0];
%% Define the jump covariance
si = [0.1 0;0 0.1];
%% Do N steps
path(path,'../utilities');
N = 10;
figure(1);
... |
fileID = fopen('result.txt');
step = 5;
n = 102;
y = zeros(n);
x = zeros(n);
for i = 2:(n-1)
x(i) = 0.005 + 0.01*(i-2);
end
x(1) = 0;
x(102) = 1;
y(1) = 100;
y(102) = 0;
for i = 1:step
for j =2:101
y(j) = fscanf(fileID,'%f',1);
end
plot(x,y,"linewidth",2,"r");
hold on;
end
|
function [psth,x] = genBEZpsth_stochastic(stim,stim_fs,dB,CFs,nfibers,ANpar)
%generates post-stimulus spike histograms for a vector of center
%frequencies and for a set of fibers corresponding to each center
%frequency. In this function we call the Bruce, Erfani & Zilany (BEZ) model
%described in Bruce et al. (2018): ... |
function boozer_data = read_Boozer_output(fname_ext)
try
% matlab 2009a and newer
disp('<---Using Matlab''s built-in netcdf support');
ncid = netcdf.open(fname_ext, 'NC_NOWRITE');
ns_bID = netcdf.inqVarID(ncid, 'ns_b');
boozer_data.ns_b = netcdf.getVar(ncid, ns_bID); % number of surfs
nf... |
% Copyright (C) 2012 Quan Wang <wangq10@rpi.edu>,
% Signal Analysis and Machine Perception Laboratory,
% Department of Electrical, Computer, and Systems Engineering,
% Rensselaer Polytechnic Institute, Troy, NY 12180, USA
%
% You are free to use this software for academic purposes if you cite our paper:
% Qu... |
function launch_az = launchAzimuth(i, r, lat, inertial)
% LAUNCH_AZ = LAUNCHAZIMUTH(I,LAT,INERTIAL) calculates an appropriate
% launch azimuth for a rocket to reach an orbit with a given inclination
% and radius, from a launch site at a given latitude.
%
% Inputs:
% I - inclination of the orbit (degre... |
function varargout = initval_2c(this)
%% Load data
C = this.coords;
x = C(:,1);
y = C(:,2);
%% Centroid
xc = mean(x);
yc = mean(y);
xr = x - xc;
yr = y - yc;
%% Determine principal axis
angles = 0 : 2*pi / 100 : 2*pi ;
proj_score = NaN(length(ang... |
%%% Modified by Lo´c Chaubet November 10th 2017 %%%
%/Users/loicchaubet/OneDrive - McGill University/DATA/Hossein/Loic/Blebb/Sept_22_added_Set3/C193_P7/p4_great_analysis/others
%0.4set3_maybe.txt
clear
close all
clc
datdir=[pwd '/'];
cd(datdir);
%%% enter the file name here, make sure the current matlab working folde... |
function [test_results, performance, performance_age] = test_results_mlp(type, test_x, test_y,...
weights, biases, output_activationF)
% 2016-06-24
% Yejin Cho (scarletcho@korea.ac.kr)
%% Test results (performance) in multi-layer perceptron
switch type
case 'classification'
for sample = 1:size(test_x... |
clc
clear all;
close all;
xn1=input('enter sequence 1');
xn2=input('enter sequence 2');
n1=length(xn1);
n2=length(xn2);
if(n1~=n2)
if(n1>n2)
xn2=[xn2 zeros(1,(n1-n2))];
n=n1;
else
xn1=[xn1 zeros(1,(n2-n1))];
n=n2;
end
else
n=n1;
end
xk1=fft(xn1,n);
xk2=fft(xn2,n);
disp('d... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Center for Astronomy Signal Processing and Electronics Research %
% http://casper.berkeley.edu ... |
function r = ndcorr(a,b)
% r = ndcorr(a,b) ; % where a,b are n-d arrays (n>=2)
% correlation coefficient (pearson) between two n-d arrays.
a = a(:) - mean(a(:)) ; b = b(:) - mean(b(:)) ; % mean subtract
r = sum(a.*b)./(sqrt(sum(a.*a)).*sqrt(sum(b.*b))) ; % normalized covariance
end
|
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
% DTFT properties
%time shifting
syms w
n= 0:3;
x=[1,2,3,4] ;
n=0 :5 ;
xn0=[0 0 x]; %x[n-n0]=[0,0,1,2,3,4]
Left=sum(xn0.*exp(-j*w*n));
ezplot(abs(Left),[-pi pi])
title('| DTFT(x[n-n_0]) |')
ylim([2 1... |
function result = EllipticCE( K )
%ELLIPTICCE Complementary complete elliptic integral of the 2nd kind.
% ELLIPTICCE(K) is the complementary complete elliptic integral of the
% 2nd kind of the elements of modulus K. The elements of K must all be
% real.
%
% See also
% mEllipticCE
% ELLIPTICCE is a w... |
% ssc_refrigeration
% ssc_building_ventilation
clear all
%% Parameters
% Building
building_height = 2.5;
building_length = 15;
building_width = 10;
door_area = 1.2;
duct_area = 0.01;
% Fan
fan_flow_rate_table = [0,0.08, 0.12, 0.16, 0.2];
fan_setting_table = [0,1,2,3,4];
% Floor
floor_heat_transfer_coeff_internal = ... |
function [ positions ] = world2local( pos )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
global body2LegTmat;
global bodyTmat;
legTmat2body(:,:,1) = [[body2LegTmat(1:3,1:3,1)',-body2LegTmat(1:3,1:3,1)'*body2LegTmat(1:3,4,1)];0 0 0 1];
legTmat2body(:,:,2) = [[body2LegTmat(1:3,... |
%% Init
D = load('bg.txt'); % load initial dataset
[X, ~] = size(D); % get x dimension
D = [D, ones(X, 1)]; % add bias
l = ones(X, 1); l(101:200, 1) = -1;
D = [D, l]; % add label dimension
[X, Y] = size(D); % recomputing dimensions
DS = load('seeds_dataset.txt'); % 'seeds' dataset
[P, Q] = size(DS);
l = DS(:, ... |
function [ ] = segmentation( inputimg )
Lc = bwlabel(inputimg);
stats = regionprops(Lc,'all');
[x y] = size(stats);
for i=1:x
figure, imshow(stats(i).Image);
end
end |
function write_orients(orients filename)
imwrite(orientim(orients), filename);
|
function [ result, errors, timeUse ] = CG( A, b )
%CG Summary of this function goes here
% Detailed explanation goes here
n = size(A, 1);
x = zeros(n, 1);
errors = zeros(1, 1);
tic;
rk = b - A*x; % it is the r(k)
pk = rk;
timeUse = 1;
last = x;
while timeUse
alpha = dot(rk, rk) / dot(pk, A*pk);
x =... |
function [finalScore] = evaluateModel_quiz( score, numQs, showResults)
if nargin < 3
showResults = true;
end
% This function assume the data is the quiz data
% Namely, the input data can be converted to "cardinality X numQs matrix"
global p;
if numel(score) ~= p.maxItems * numQs
error('Size of the data is ... |
%clear;
if(exist('data_array','var')==0)
data_array = [];
end
label = 'CounterclockwiseRound';%标签名字
dirPath = 'G:\无源感知研究\数据采集\2019_04_28_copy\6';
fileNums = 19;
fileNames = traversing_folder(dirPath,'*.dat');
%循环遍历整个文件夹,并写入数据集
for i=1:fileNums
%读取CSI幅值,并进行滤波
amplitude = csi_amplitude_reading(strcat(dirPat... |
function [feats, im_cat] = extr_image_feats(im, frms_img_dir, vars)
% Main variables:
%
% sliding window:
% x_1 = 1
% x_n = x_{n-1} + (win_wid - n_overlap)
%
% window parameters:
% x
% y
% wid
% hei
% n_olp
%
% grid parameters:
% n_grid_row
% n_grid_col
%
% FEATS for... |
function lapackhelp(func)
%LAPACKHELP View online documentation for LAPACK and BLAS.
% LAPACKHELP(ROUTINE) displays the documented source code for the
% BLAS/LAPACK routine named ROUTINE. This contains detailed
% descriptions about what the routine does and what the arguments
% should be.
%
% LAPACKHELP() ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% 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: T... |
function p = rcdf(R,N)
t = R.*sqrt((N-2)./(1-R.^2));
p = 2*tcdf(-abs(t),N-2);
|
% remove Remove sinusoid from a PDV measurement
%
% This method removes a sinusoid:
% s(t) = A cos(2*pi*f0*t) + B sin(2*pi*f0*t)
% from a PDV measurement. The frequency and amplitudes of the sinusoid are
% determined from a target domain and then assumed to be valid for the
% entire measurement.
% >> object=re... |
function [ry,rye,t,vary]=acf(a,c,v,m);
%Usage: [ry,rye,t,vary]=acf(a,c,v,m)
%
% a: Denuminator polynomium
% c: Numinator polynomium
% v: Innovation variance.
% m: max number of lags
%
% ry: covariance function
% rye: cross covariance function
% t: time index
% Programmed 1994 by Niels K. Poulsen... |
function [b]=chi(mat1,mat2,gamma)
% mat1 is of dimension d*n
% mat2 is of dimension d*m
% Out put is of dimension n*m
[d n]=size(mat1);
[d m]=size(mat2);
epsilon=0.000000001;
% b=zeros(size(mat1,2),size(mat2,2));
% b=zeros(n,m);
b=[];
for i=1:n
D=mat1(:,i)-mat2;
D=D.^2;
E=mat1(:,i)+mat2+epsilon;
f=exp(... |
function [scatterH,f] = imfindpeaks( imH,varargin )
%IMFINDPEAKS Interactively adjust image contrast and filtering to find
%peaks. This does change imH.CData!
% IMFINDPEAKS(imH)
% IMFINDPEAKS(imH,default)
% IMFINDPEAKS(imH,varargin)
% IMFINDPEAKS(imH,default,varargin)
% - default is a struct with optional f... |
%Iegustam attelu
clear
img=imread('humface2.jpg');
detected_output = csvread('detected_output.txt');
siz=size(img);
%no YCBR panem spilgtuma koef
R=img(:,:,1);
V=img(:,:,2);
B=img(:,:,3);
img_R(:,:,1)=R;
img_V(:,:,2)=V;
img_B(:,:,3)=B;
Y = 0.299*R+0.587*V+0.114*B;
img_Y(:,:,1) = Y;
img_grey=img_Y(:,... |
function [b,e] = halftoneThreshold(f,T)
[N, M] = size(f);
b = zeros(N,M);
for i=1:N
for j=1:M
if (f(i,j) > T)
b(i,j) = 255;
else
b(i,j) = 0;
end
end
end
temp=0;
for i=1:N
for j=1:M
temp = temp + (doubl... |
function detectmove(image1, image2)
%-----------------------------------------
%-------- Traitement de l'image 1 --------
%-----------------------------------------
% Converti l'image RGB en YCBCR.
image=rgb2ycbcr(image1);
image2=rgb2ycbcr(image2);
% Créé la matrice a qui représente Cb (Y' - bleu).
a=image(:,:,2);
%... |
A=[ 1 2 3;
4 5 6;
7 8 9 ];
fid = fopen('a.txt','wt');
fprintf(fid,'%d %d %d \n',A');
fclose(fid);
|
function datasetPlot(Tests,InputsSelected,dates,opt)
% Plots dataset contained in array of structs -Tests-
%
% INPUTS
%
% - Tests row vector of 21 cells of struct type with fields
% .tt : row vector starting from zero, time of input signals
% .uu : ... |
function fourier2d(img, fe)
[M, N]=size(img);
cx=(0:N-1)-floor(N/2);
cy=(0:M-1)-floor(M/2);
[X, Y]=meshgrid(fe*cx/N, fe*cy/N);
img=double(img);
Z=abs(fft2(img-mean(img(:))));
Z=fftshift(Z);
subplot(131);
imshow(img, []);
title('Image');
... |
%{
RGB = imread('test2.jpg');
J = RGB_Mask(RGB);
J = imfill(J, 'holes');
BW = edge(J,'canny');
[H,T,R] = hough(BW,'RhoResolution',0.5,'Theta',-90:0.5:89);
subplot(2,1,1);
imshow(RGB);
title('gantrycrane.png');
subplot(2,1,2);
imshow(imadjust(rescale(H)),'XData',T,'YData',R,...
'InitialMagnification','fit');
title... |
function [x_Jdot] = Jdot()
x_Jdot=[[sec(Subscript(\[Theta],1)(t)).^2.*Derivative(1)(Subscript(\[Theta],1))(t),sec( ...
Subscript(\[Theta],1)(t)).^2.*Derivative(1)(Subscript(r,y))(t) + (-0.258) ...
.*cos(Subscript(\[Theta],1)(t)).*Derivative(1)(Subscript(\[Theta],1))(t) + ( ...
-0.04).*sin(Subscript(\[Theta],1)(t)... |
%% This script will epoch all segments of the newly-converted .mat file
% into 2-second epochs, perform a bandpass filter, ICA, and artifact
% rejection of visually inspected artifacts. Preprocessed data will be
% saved with the suffix '_CompRej.mat' into the same mat directory for
% further analyses.
ft_defaults;
%... |
classdef TracesFret4 < TracesFret
% TracesFret: multi-channel FRET traces
%
% Traces class with extra properties for additional data channels, including
% donor2, acceptor2, and fret2 for three-color FRET and two-pair FRET
% experiments, and factor/factor2 channels for miscellaneous fluorescence
% channels... |
function found = large_elements(A)
[row col] = size(A);
found = [];
for ii = 1:row
for jj = 1:col
if A(ii,jj) > ii + jj % if the element is larger than the sum of its indexes
found = [found; ii jj]; % add a new row to the output matrix
end
end
... |
function f = box_list(start,finish)
%BOX_LIST Create an index list for a d-dimensional box.
% F = BOX_LIST(START,FINISH) creates a kxd array F from two d-dimensional
% coordinates START and FINISH. F contains all the d-dimensional indices
% in the box [START(1),FINISH(1)]x...x[START(d),FINISH(d)].
%
% ... |
function ih = script_inheritance_2ind(input_pedigree, family_id, ind1, ind2)
ih.descent_graph = descent_graph_2ind(input_pedigree, family_id, ind1, ind2);
ih.num = ih.descent_graph(1,1);
[ih.is ih.transition] = hasse_matrix(ih.num);
[ih.prob_f, ih.tran_list] = condense_inheritance(ih.descent_graph)... |
%% load the data
[data,textdata,raw]=xlsread('../gasprices.xls');
%% Define colheaders
colheaders=textdata(end,:);
%% save into gasprices.mat
save gasprices
%% Define variables for prices in Germany and Mexico and a vector with the years
Germany=data(:,5);
Mexico=data(:,8);
Year=data(:,1);
Prices=data(:,2:end);
%% Com... |
pn = 1;
for n = 1:20
pnp1 = exp(1) - (n + 1) * pn;
pn = pnp1;
disp(pn)
end |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Read .bag files
% Sangjun Lee
% 8/30/2018
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear; close all; clc;
%% Copy bag file from Jackal to lacal folder
% scp administrator@192.168.1.104:/home/administrator/bagfiles/2018-08-30-16-34-13.bag /Users/SangjunLee/Mupasa/BoilerMaker/Resear... |
function P2 = interpolate_Pgth(P,u,v,q)
er = 1e-4;
nC = 20;
P2 = zeros(3*length(u(:,1)),length(q(1,:)));
for i = 1: size(u,1)
idx = find(u(i,:)~=0 & v(i,:)~=0);
idx2 = q(2*(i-1)+1,:)~=0;
q1 = q(2*(i-1)+1:2*(i-1)+2,idx2);
umin=min([u(i,idx),q1(1,:)])-0.001;umax=max([u(i,idx),q1(1,:)])+0.001;
vmi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.