text stringlengths 8 6.12M |
|---|
function [hl,hv]=d_enthalpy(T,Tb,x,y,cp_l,cv,lambda,c,N) % Note: lambda (J/kg) at the respective Tb for a given pressure
aux=1;
cp=zeros(N,c);
lambdac=zeros(N,c);
for i=1:N
for j=1:c
cp(i,j)=(cp_l(j,1)+cp_l(j,2)*T(aux)+cp_l(j,3)*T(aux)^2+cp_l(j,4)*T(aux)^3+cp_l(j,5)*T(aux)^4); % J/mol/K
end
lambdac(aux... |
%% Channel
% Send signal over an AWGN channel.
function [data_rx]=channel_d(data_tx,snr)
%% specify the snr level
%snr =10; % In dB
data_rx = awgn(data_tx,snr,'measured');
|
classdef SolarRadiationScenariosGenerator < Scenarios.ScenariosGenerator
%
% ---------------------------------------------------------------------
properties
%
% labels of the periods
tPeriodsLabels;
%
% starting times of the periods
afPeriodsStartingTimes;
%
% in number of samples
iFor... |
function base = loadBaseAirfoil(expressionFunction, dof)
%loadBaseAirfoil- Creates base struct with drag, lift, and geometry
%
% Syntax: base = loadBaseAirfoil(expressionFunction)
%
% Inputs:
% expressionFunction: function handle for producing deformation
% dof: number of degrees of freedom (genome ... |
function [area,maxside] = Tri_Area(ind, tris, nodes)
% getting point coordinates
p1=nodes(tris(ind,1),:);
p2=nodes(tris(ind,2),:);
p3=nodes(tris(ind,3),:);
% lengths of triangle sides
a = norm(p1-p2);
b = norm(p1-p3);
c = norm(p3-p2);
% maximum side length
maxside = max... |
function ShowPairProbs(map_z, pair_probs)
pp = squareform(pair_probs);
K = max(map_z);
N = length(map_z);
clust_col = repmat(PTPalette(12),ceil(K/12),1);
clust_col = clust_col(1:K,:);
[sorted_z, sorted_i] = sort(map_z);
parcels = mat2cell(sorted_i, 1, diff(find(diff([0 sorted_z (K+1)]))));
vox_col = zeros(N,3);
for... |
% algorithm:
%
% - start by finding the closest y signal (i.e., look for the x that is closest to the desired one)
% - then find the closest y in that y signal (i.e., now look for the y that is closest to the desired one given the previously computed closest x)
% - call 'delta' the distance between these closest x, y w... |
function [lat, lon, alt] = ecef_to_lla(ecef_x, ecef_y, ecef_z)
%% Convert coordinates in ECEF to LLA.
% :param ecef_x: The x coordinate of the point (meters).
% :param ecef_y: The y coordinate of the point (meters).
% :param ecef_z: The z coordinate of the point (meters).
% :return: The LLA coordinates of the point.
%
... |
function [tf, n] = check_exist(varargin)
% [tf, n] = check_exist(folder, expr, n, 'verboseOFF', 'errorON')
% Check if file/folder exists or has number of files equal to n.
% Furthermore, if folder does not exist, create folder.
%
% Optional Inputs:
% folder: folder to check if exists (or contains files)
% expr: express... |
function [thetas, inter_kp, intra_bot_kp, intra_top_kp, inter_shells, intra_shells] = parse_datafile(filename)
%load dft_full_relax_data_02-04-2019.mat;
%filename = '../data/full_relax_kp_01-06-2019.dat';
fid = fopen(filename);
sizes = str2num(fgetl(fid)); % get array sizes
n_theta = siz... |
function out = model
%
% fluid.m
%
% Model exported on Jan 1 2021, 18:17 by COMSOL 5.4.0.225.
import com.comsol.model.*
import com.comsol.model.util.*
model = ModelUtil.create('Model');
model.modelPath('C:\Users\dcy60\Google Drive\Research\MLOPT\code_data\fluid_fine');
model.param.set('width', '2');
model.param.set... |
function [ M ] = label( E, l )
% Compute the vector of points in the nodule from the matrix of probabilities
M=zeros(size(E));
for i=1:size(E,1)
for j=1:size(E,2)
for k=1:size(E,3)
if E(i,j,k) == l
M(i,j,k) = 1;
end
end
end
end
end
|
% simulation of the identified model:
function y = sim_model(x)
end
|
% This script calculates the critical temperature of a superconductor/ferromagnet
% bilayer with spin-orbit coupling, by performing a kind of binary search for
% the temperature where the superconducting gap vanishes numerically.
%
% Written by Jabir Ali Ouassou <jabirali@switzerlandmail.ch>
% Created 2015-03-01
% Upd... |
%{
EC503 - Learning from Data
March 2018
Word Embeddings De-biasing
Main script
Work by: Frank Tranghese, Nidhi Tiwari, Aditya Singh
%}
% CODE GOES HERE
% Get the word vectors for the dataset
% Loading the co-occurrence matrix
load('coo_matrix');
% Loading the 6000 wordslist which the ... |
function [y] = phibasederp2(x,k,ilocal,n)
% Entree: x: point courant
% k: numero du maillage
% ilocal: indice du point x courant (1 si droite, 2 si gauche)
% n: nombre d'intervalles
% Sortie: fonction derivee de phi dans le maillage k
% en dehors des intervalles (valeur ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Lab 1: Image rectification
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 1. Applying image transformations
% ToDo: create the function "apply_H" that gets as input a homography and
% an image and returns th... |
function [mfccs, f, t] = getNormalisedFeatures(Y, FS, window, bands)
%get the coeffecients
[mfccs,~,f,t] = GetSpeechFeatures(Y,FS,window,bands);
for i=1:bands
avg = mean(mfccs(i,:));
std_dev = std(mfccs(i, :));
mfccs(i, :) = (mfccs(i, :) - avg)/std_dev; %normalise
end
end |
function [dx1, dx2] = system_dynamics(x1,x2,u,a,b,type)
%DER1 Summary of this function goes here
% Detailed explanation goes here
if type == 1
dx1 = -x1 + x1^2 +x1^3 + x1^2*x2 -x1*x2^2 + x2 + x1*u;
dx2 = - a*x1 - 6*x2 + b*u;
end
if type == 2
dx1 = -x1 + x1^2 +x1^3 + x1^2*x2 -x1*x2^2 + x2 + x1*u;
dx2 =... |
function obj = junctionXML(obj,junctionIn)
%junctionXML Parsing the XML to the corresponding classes and properties
%
%----------------------------------------------------------------------
% BSD 3-Clause License
%
% Copyright (c) 2020, Jonas Wurst, Alberto Flores Fernández
% All rig... |
function [slope, intercept, correlation] = LinReg(X,Y)
% check that X and Y are the same length
if length(X) ~= length(Y)
error('LinReg: Vectors are not same length.');
end
Xbar = mean(X);
Ybar = mean(Y);
% calculate the covariance and variance of the two variables
CovArra... |
%
% ConvertTxtFromWebsite.m
%
% usage:
%
% tDataset = ConvertTxtFromWebsite( ...
% astrDatabaseFilenames, ...
% fSamplingPeriodInSeconds, ...
% strConvertedDatabaseFilename, ...
% ... |
%Neu su dung board arduino origin thi su dung lenh sau
%a = arduino();
%Neu su dung board arduino clone (TQ)
board = arduino('com9', 'uno');
led = 'D13';
for k=1:10
disp('turn on LED');
writeDigitalPin(board, led, 1);
pause(1);
disp('turn off LED');
writeDigitalPin(board, led, 0);
pause(1);
end
... |
function [data, PARS] = MCRI_PG(ORNtrace, ORNsamplingrate, varargin)
paroverrides = varargin;
%% set up params
PARS = MC_pars;
PARS = PG_pars(PARS);
PARS = InhibSyn_pars(PARS,'PGMC');
MCVinit = -66.5;
PARS.PGMC_gSyn = 10;
PARS.MCGC_g_syn = 0;
PARS.ORNGain = 15;
... |
classdef ExpParforTrainTask < rl.task.parfor.ParforTrainTask
% EXPPARFORTRAINTASK
%
% Train an agent using parfor, where each simulation send experiences back
% to the host for learning. Parameters are installed at the top of every
% parfor loop.
% Revised: 8-14-2019
% Copyright 2019 The MathWorks, Inc.
methods
... |
function []=spheres(n,m)
x=zeros(n,m);
y=zeros(n,m);
z=zeros(n,m);
% Naive
for i=0:n-1
u=i/(n-1);
theta=2*pi*u;
for j=0:m-1
v=j/(m-1);
phi=pi*v;
t=sin(phi);
x(i+1,j+1)=t*cos(theta);
y(i+1,j+1)=t*sin(theta);
z(i+1,j+1)=cos(phi);
end
end
subplot(2,2,1);
sur... |
function [U, V, B, sortB, obj] = scVDMC(X, d, k, w, lambda, alpha, U_ini, V_ini, max_iter)
% Objective function as follows
% 1/2 sum_d ||diag(sqrt(B)) (X{d} - U{d} V{d}') ||_F^2 - w sum_d B'*Var(U_d)
% +alpha sum_{i,j} B_i Var(Y{i,j})
% s.t.
% sum(V(d)(i,:))=1 and V(d) is binary matrix
% sum(B) = lambda and B is ... |
% pdomain : generate a two-dimensional domain that bounds a specified
% sample probability
function [x,y]=pdomain(moments,correlations,Nsigma,numpoints)
% handle input
if (nargin<1) || isempty(moments)
error('ERROR: moments table not specified');
end
L=size(moments,2);
if L<2
error('ERROR: at least t... |
function [ F ] = sevenpoint( pts1, pts2, M )
% sevenpoint:
% pts1 - 7x2 matrix of (x,y) coordinates
% pts2 - 7x2 matrix of (x,y) coordinates
% M - max (imwidth, imheight)
% Q2.2:
% Implement the eightpoint algorithm
% Generate a matrix F from some '../data/some_corresp.mat'
% Save recovered F (eit... |
scale = 4;
lvv = Lvvtilde(discgaussfft(few256, scale), 'same');
lvvv = Lvvvtilde(discgaussfft(few256, scale), 'same');
figure;
subplot(1,4,1);
c1 = contour(lvv, [0 0]);
axis('image');
axis('ij');
subplot(1,4,2);
c2 = contour((lvvv < 0), [0 0]);
axis('image');
axis('ij');
subplot(1,4,3);
k = log(1 + lvv .* (lvvv < 0... |
function [select_id] = planB(data_other,segment,start_id, end_id)
%UNTITLED3 此处显示有关此函数的摘要
% 此处显示详细说明
addpath('../code')
id = start_id:end_id;
select_id = zeros(1,length(id));
for i = id
if i-5<=0
st = 1; en = 11;
elseif i+5>end_id
st = end_id-10; en = end_id;
else
st = i-5;en = i+5... |
function make_LGN_Fstat_ROI(session_dir,subject_name,runNums,func,thresh)
% Makes a mask in the LGN based on anatomical ROI and Fstat values
%
% Usage:
%
%
% Written by Andrew S Bock Nov 2015
%% set defaults
if ~exist('thresh','var')
thresh = 0.05; % p-value threshold
end
hemis = {'lh' 'rh'};
%% get bold dirs... |
function M = compute_moments2D( T )
% Compute moments of noiseless wavelet coefficients
% The moments used for parameter estimation in the GLG model are computed.
%
% Syntax:
% M = compute_moments2D( T )
%
% Input:
% T : Cell from DWT2_TO_CELL.
%
% Output:
% M : L-by-4-by-3 matrix where L is the number of levels... |
clc, clear all;
tic
OriginImage = imread('1.png');
OriginImage = padarray(OriginImage, [5 5], 255, 'both');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%找出外轮廓%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
w = fspecial('laplacian', 0.5);
EnhanceImage = imfilter(OriginImage, w, 'replicate');
LapBorderImage = im2bw(EnhanceImage, 0.9);
% hough_... |
function [filelist] = px_text(fop,vn,flag)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FORMAT [filelist] = px_text(op,on,vn,flag)
% Usegae This function is used to save the variable to text.
% Input
% fop - fullfile path for the output txt file. e.g.,
% '/d... |
function string = mqltxtc(uic)
% Script for txt
% Siemens ASCII pulse file
% Called by mqlqm
set(uic,'BackGroundColor','white') ;
string = get(uic,'String') ; |
struct( ...
'id', '4711', ...
'foo', 2, ...
'bar', 'DEF_VAL') |
classdef EqualizationType
%EQUALIZATIONTYPE Enumeration of methods for equalizing Riesz channels
% --------------------------------------------------------------------------
%
% Part of the Generalized Riesz-wavelet toolbox
%
% Author: Nicolas Chenouard. Ecole Polytechnique Federale de Lausanne.... |
clear all, close all, clc;
addpath('./data/');
addpath('./equitability-code/');
flag_dataset = 10;
flag_normalization = true;
flag_randomsample = false;
if flag_dataset == 1
load_casp;
elseif flag_dataset == 2
load_cccp;
elseif flag_dataset == 3
load_parkinson;
elseif flag_dataset == 4
load_calhousin... |
clc; clear; close all;
RAND_MAX = 32767;
camera_ray = [0; 0; 1];
output_path = 'C:\Developer\data\MATLAB\convolution_feel\';
surface_color = [61, 131, 119]/150;
spheres_color = surface_color;
%% Pill
%[centers, radii, blocks] = get_random_convsegment(3);
blocks = {[1, 2]};
centers{1} = [0.4; 0.0; 0.2];
centers{2} = [0... |
function [] = histogram(csvfile)
points = csvread(csvfile);
x = points(:, 2); % mq135 column
for i = 1:100
edges(i) = i * 10;
end
[n] = histc(x, edges);
bar(edges, n, 'histc');
end
|
function [MaxLMSDirection, MaxMelDirection, LightFluxDirection] = testGenerateNominalMaxMelishDirections(calibrationType, observerAge)
% Compute nominal backgrounds and directions based for MaxMel type experiments.
%
% Syntax:
% [MaxLMSDirection, MaxMelDirection, LightFluxDirection] = testGenerateNominalMaxMelishDir... |
clear all ; close all
name = 'alex' ;
cd(['c:/shared/badger_eeg/',name]) ; ls
% get a raw epoch for the times
setnames = dir('preproc*gamma*set') ; eegsets = {setnames(1).name,setnames(2).name} ; EEG = pop_loadset(eegsets{1}) ; ep = pop_epoch(EEG,{'S 1'},[-6,12]) ;
baseline = find(ep.times<0 & ep.times>-3... |
function res = adaptationModel(stimulus, name, options)
Gmax = options(1);
Gmin = options(2);
Spl = options(3);
Sp = options(4);
Sm = options(5);
Sml = options(6);
flag1 = options(7);
flag2 = options(8);
stLen = length(stimulus);
res = zeros(stLen, 1);
switch name
case 'trilinear'
if flag1 ==... |
function write_matrix_to_csv(name, A)
%Writes a csv file name which contains the IJV representation of A
% the first row contains the values n,m,nnz
% the ith row contains I[i]-1,J[i]-1,V[i].
[m,n] = size(A);
nnzA = nnz(A);
[I,J,V] = find(A);
fid = fopen(name,'w');
fprintf(fid,'%d,%d,... |
function LFP_DATA=stan_ephys_getdata_lfp_mu
%
% stability analysis--baseline data
% first take all of the data from control
[options,dirs]=stan_preflight;
options.lfp_fs=1e3;
kernedges=[-3*options.smooth_sig:1/options.smooth_fs:3*options.smooth_sig];
kernel=(1/(options.smooth_sig*sqrt(2*pi)))*exp((-(kernedges-0).^2).... |
function BIP=bipfit(D,VERHOR)
% FIT BIPolynomial to a matrix
% (bipfit is based on POLYFIC)
%Input:
% D = data matrix
% VERHOR = size( BIP), or
% VERHOR = orders of BIP in VERtical
% and HORizontal directions;
% if VERHOR is scalar, VERHOR(2)=VERHOR(1)
%Output:
% BIP =... |
#Part A
limit = 5;
t = -limit:0.1:limit;
ft = rect(t);
#Drawing the rectangle (without the vertical lines)
subplot(3,3,1), plot(t, ft);
xlabel("t"); ylabel("rect(t)");
title("Rectangle");
ft = triangl(t);
#Drawing the triangle
subplot(3,3,2), plot(t, ft);
xlabel("t"); ylabel("triangl(t)");
title("Triangle");
ft = u... |
%old 1d simulation without reference cells
function noreference_ode()
global N s0
N=5;
cell_positions = (2*(0:(N-1))).';
% default_postiion = 0:(N-1);
s0 = 1; %default length
tend = 50;% how long the simulation goes for
[T,Y] = ode45(@cell_forces,[0 tend],cell_positions);
plot(T,Y);
xlabel('t')
end
function dxdt ... |
function demo_LocNet_object_detection_pipeline(varargin)
% demo of the object detection pipeline using as a localization model
% either a LocNet model or a CNN-based bounding box regression model
%
% The input arguments are given in the form of Name,Value pair arguments
% and are:
% 'gpu_id': scalar value with gpu id ... |
clear all;
close all;
clc;
data = xlsread('data.csv', 'Data', 'A:H'); % Read curve's points from the Excel file
dataU = data(:,1); % Extract RowCo-ordinate
dataI = data(:,2); % Extract col
clear data
%Define fault rate
Va = 0:0.01:1.665;
Ns = 4; %
Va0 = 0:0.01:0.665... |
function Vs = logmap_pt2array_spd_tf(ps,Xs)
N = length(ps);
Vs = cell(size(Xs));
for i = 1:N
p = ps{i};
Vs{i} = logmap_pt2array_spd(p,Xs{i});
end
|
clear;
x=-3:0.01:3;
y=-3:0.01:3;
[X,Y]=meshgrid(x,y);
f=-5./(1+X.^2+Y.^2);
subplot(1,2,1);
mesh(f);
title('f=-5./(1+X.^2+Y.^2);');
subplot(1,2,2);
surf(x,y,f);
title('f=-5./(1+X.^2+Y.^2);'); |
tic
clc
clear all
fname=uigetfile('*.jpg');
I = imread(fname);
I=imresize(I,[256 256]);
I = (double(I))/255;
fprintf('Initialise variables');
K = 50; % number of clusters
imgSize = size(I);
fprintf('Size of image=%d\n',imgSize);
itercentroids = 10; % number of times K means runs to find the best centroi... |
function q = mpi2pi(q)
% transforms the staning qin values to -pi to pi
while any(any(q > pi))
i=find(q>pi);
q(i)=q(i)-2*pi;
end
while any(any(q < -pi))
i=find(q < -pi);
q(i)=q(i)+2*pi;
end |
% First of all, add stc toolbox to search path
% addpath('G:\My Drive\EECE562_Steganography\HW5\all_stego_images\')
% ----------------- Assignment on FLD --------------
% tic;
FLD_Test();
% toc;
% fprintf(' Total execution time is %s \n', datestr(toc/(24*60*60),'HH:MM:SS:FFF'));
% ------------------ FLD function --... |
function mtx = avi2ctx2()
% Converts an avi file to ctx format
mtx = cell(1,20);
mov = aviread(['lola1.avi'],1:20);
for k=1:20
piece = uint8((double(mov(k).cdata(:,:,1)) + double(mov(k).cdata(:,:,2)) + double(mov(k).cdata(:,:,3)))/3);
mtx{k} = [piece piece piece piece piece; piece piece piece piece ... |
function varargout = synchro_injecteur2(varargin)
% SYNCHRO_INJECTEUR2 M-file for synchro_injecteur2.fig
% SYNCHRO_INJECTEUR2, by itself, creates a new SYNCHRO_INJECTEUR2 or raises the existing
% singleton*.
%
% H = SYNCHRO_INJECTEUR2 returns the handle to a new SYNCHRO_INJECTEUR2 or the handle to
% ... |
code_submit;
momentum.submit; |
function [J grad] = nnCostFunction(nn_params, ...
input_layer_size, ...
hidden_layer_size, ...
num_labels, ...
X, y, lambda)
% Reshape nn_params bac... |
% with no explicit loops
function prim = my_prime02(p)
v = 2:sqrt(p);
v = v(rem(p,v) == 0); % if p is prime, none of the remainders can be 0
prim = ~length(v) && (p ~= 1); % so if v has any elements, p is not prime
end % 1 is handled by the (p ~= 1) condition |
function paperPlotSingleVesselTheIteBiasLengthAndAspectRatio(param,massFlowData,isSaveFigure)
%迭代偏置距离和长径比
% chartType = 'surf';
chartType = 'contourf';
endIndex = length(param.sectionL1) + length(param.sectionL2);
% startIndex = find(param.sectionL1>2);
% startIndex = startIndex(1);
startInd... |
% clear all
load('..\data_tokamak\physics_constants.mat')
load('..\data_tokamak\pressure_profile.mat')
load('..\data_tokamak\B_fields.mat')
load('..\data_tokamak\flux_geometry.mat')
load('..\data_tokamak\tokamak_map_dimensions')
load('..\data_tokamak\tokamak_PR_map')
%%
[XX,ZZ] = meshgrid(X_scale,Z_scale);
F2_PR_m... |
function lstmSVprint(theta,iter)
%LSTMSVPRINT Custom printed message during the sampling phase
disp(['iteration: ',num2str(iter), '|beta0: ',num2str(theta.beta0),'|beta1: ',num2str(theta.beta1), ...
'|phi: ',num2str(theta.phi),'|sigma2: ',num2str(theta.sigma2)]);
end
|
clear all;
clc;
load('Zheng_Data.mat') %%%Loading data
X=Data; %%%%%%%scRNA-seq count data, rows are genes, columns are cell sample
% X=Normalize_TPM(X);%%%TPM normalization scRNA-seq count data X
k=5; %%%%%%%%%%%%%%k is the number of feature for dimension reduction,
k2=3;%%k is the number of clusters,
[mFea,nSmp]=size... |
classdef IndividualEC < EvolutionControl & Observable
properties
model
counteval
end
methods
function obj = IndividualEC()
% constructor
obj.model = [];
obj.counteval = 0;
end
function [obj, fitness_raw, arx, arxvalid, arz, counteval, lambda, archive, surrogateStats, or... |
function [ icpPoseNew ] = poseSparsification_yq( savePoseName, saveIndexName, icpPose, expDis )
%POSESPARCIFICATION Summary of this function goes here
% Detailed explanation goes here
% YQ dataset, data preparation
% same for park dataset
keepIndex = [1];
icpPoseNew(1,:) = icpPose(1,:); % for pl... |
function score=get_path_score(soln, obj)
score = sum(sum(s.payoffs0(s.path==0))) ...
+ sum(sum(s.payoffs1(s.path==1))) ...
- s.num_walls*obj.wall_penalty ...
- s.num_occlusions*obj.occlusion_penalty;
|
% ELLIPTIC INTEGRALS AND ELLIPTIC FUNCTIONS FOR REAL ARGUMENTS
% ============================================================
%
% Version: jan 2018
%
% Burlisch's elliptic integrals
% -----------------------------
% BulirschCEL( KC, P, A, B ) General complete elliptic integral
% BulirschCEL1( KC ) Complet... |
function [ best ] = Best_Line_pair( test_case,channel,set_energy,theta1,linelength1,theta2,linelength2,theta3,linelength3,theta4,linelength4 )
%find the best pair line of left and right
% used for case 1
% you should find the best line of the corner before carry on this step
% ____________
% | T1 | T3 |
% |__... |
% This function take and IMU reading and adds noise to it
function imu_new = noisify(imu)
global simdata;
imu_new= imu; % create new IMU
for k = 1:length(imu)
fprintf(' Adding noise to IMU: %s\n',imu{k}.name);
n = size(imu{k}.acc,2);
% variables to save bias... |
function [idx] = idx_feature_assisted_clustering(X, artificial_modes, cent_crit, scal_crit)
% This function partitions the data into `k` clusters according to
% the Feature Assisted Clustering technique. The observation is assigned to
% a cluster `k_i` if the absolute value of the maximum score for that observation
% i... |
%% SYS800 - Reconnaissance de formes et inspection
% M'Hand Kedjar - December 2016
function [err_KNN, cm_KNN, err] = Classify_KNN(data_l, labels_l, ind_l, ...
data_v, labels_v, ind_v, ...
n_classes, knn_v)
... |
function [alt_amp,alt_phase,t,n] = CD_multibin(signal,t_beat,binDuration,twave_beg,twave_end,F_s)
%CD Summary of this function goes here
% Detailed explanation goes here
T = 1 / F_s;
% Generate median t-wave
N = find(t_beat < length(signal),1,'last') - 1; %length(t_beat) exceeds signal length?
mdnMat = zeros(N,round... |
function partsDivision = randomDivideToParts(num_samples ,numberOfParts)
%partsDivision = randomDivideToParts(num_samples ,numberOfParts)
%This function returns a logical matrix of size (num_samples x numberOfParts)
%
%For example if you want to use this for dividing the data to 5 non
%overlapping... |
function [H, dnH, dxH, dxxH, dxnH] = hillcomponent(interactionType, theta, ell, delta, varargin)
%HILLCOMPONENT - Returns a function handle to evaluate a Hill function for positive parameters {theta, ell, delta}
% HILLCOMPONENT() - A more detailed description of the function
%
% Syntax:
% H = HILLCOMPONENT(+,... |
hFig = figure;
hFig.Name = 'IMU1 IMU2 IMU3';
IMU1_idxsel = 1:4:length(IN_SENSOR.IMU1.time)-1;
data1 = IN_SENSOR.IMU1;
data2 = IN_SENSOR.IMU2;
data3 = IN_SENSOR.IMU3;
% ax
subplot(321)
plot(data1.time(IMU1_idxsel),data1.accel_x(IMU1_idxsel),'r');hold on;
plot(data2.time,data2.accel_x,'k');hold on;
plot(data3.time,data3.... |
function [] = beta_plot(wNIC_file, wNIC_groups_file, fiber_name, Mnames, color_map)
if ~exist('fiber_name', 'var')
[fiber_name,~,~] = name_select('FA_wNIC', 'groups_wNIC');
end
if ~exist('Mnames', 'var')
Mnames=cell(1,1); % if we consider m response variables, cells(m,1).
Mnames{1}='FA';
end
if ~exist('... |
%column removal
clear all; close all ; clc;
A=[1,2,3;5,67,7];
if n=2
A_1=A((n-1),(n+1))
end |
function Randomsong()
global points
%=======================================================================
%if you score a bad score it will play a clip that mocks you if good
%score a clip that praises you
%=======================================================================
if points<=200
randlo... |
function [ B_h, B_w ] = projection_cvip( lab_image, gray_level, normWidth, normHeight )
% PROJECTION_CVIP - extracts horizontal and vertical projections of a binary object.
%
% SYNTAX :
% ------
% [ B_h, B_w ] = projection_cvip( lab_image, gray_level, normWidth, normHeight )
%
% Input Parameters include :
% -... |
clear; close;
array=[-2 0 0; -1 0 0; 0 0 0; 1 0 0; 2 0 0];
azimuth = 0: 180;
elevation = 0;
directions = [30 0; 35 0; 90 0];
dirTarget = directions(3, :);
gainWh = 1;
% additive uncorrelated isotropic noise, SNR = 40 dB
varNoise = 1e-4;
%% Array pattern plot
% only determined by array; best direction is 90 Azimuth
patt... |
%% NOTE: THIS SCRIPT REQUIRES A HEAD MODEL FROM SIMNIBS
% CHECK GIT README.MD FOR INSTRUCTIONS
% MAKE SURE SIMNIBS IS IN MATLAB PATH
% Root path
mat_dir = addPaths;
%% Make SimNIBS simulation
% Initialize a session
s = sim_struct('SESSION');
% Name of head mesh
s.fnamehead = fullfile(mat_dir,'/preprocessing/head_m... |
clc;clear;close all;
img = imread('/Users/Martin/Downloads/rbjd002.jpg');
figure,
%imshow(img);
subplot(2,2,1);imshow(img);title('原图');
grayimg = rgb2gray(img); %转灰度
Ezhimg = grayimg;
[width,height] = size(grayimg);
subplot(2,2,2);imshow(grayimg);title('灰度');
T1 = 80;
%此循环二值化
for i = 1:width
for j = 1:height
... |
function [flr_rate, relia_func, flr_density] = getFunc(t, para)
validateattributes(t, {'numeric'}, {'>=', 0});
validateattributes(para, {'numeric'}, {'>', 0});
relia_func = exp(-para * t);
flr_rate = para;
flr_density = para * exp(-para * t);
end |
% function prueba_tiempo_real()
addpath(genpath('functions'))
% PRUEBA LOCALIZACI?N EN TIEMPO REAL EN PASEO DE 2 MINUTOS
% Para respuesta a la revisi?n de Mayo de 2011
%% Par?metros de la simulaci?n
MACs = {'0020a659bae6',...
'0020a65a3de9',...
'0020a65a21ff'};
Naps = 3;
%% Cargamos los datos de entren... |
function getcols (col)
global A leg opt
if size(A) == 0 helpdlg('No data. You must read a file first','Error'); return, end
switch col
case 'x'
[opt.xc,value] = listdlg('PromptString','Choose X column','SelectionMode','single','ListString',leg);
case 'y'
[opt.yc,value] = listdlg('PromptString','Choose... |
function testim(fn)
img = imread(fn);
img = img(end:-1:1,end:-1:1,:);
end |
%This file is to generate the plot of trend, error distribution and
%correlation between YtestPaxton speed and predict speed of Blandford by 5
%different methods
clear;
close all;
load('AllResults.mat');
x=1:300;
subplot(5,1,1)
plot(YtestPaxton);
hold on
plot( x(1:3:300),Yhat3ARIMAPaxton(1:3:300), ... |
tspan = [0 25];
y0 = [15 50];
b=1
[t,x]=ode45(@(t,x) func(t,x,b),tspan, y0);
plot(x(:,1), 'm')
title("X1 Time Response")
figure
plot(x(:,2), 'm')
title("X2 Time Response")
figure
plot(x(:,1),x(:,2), 'k')
xlabel('X1-axis')
ylabel('X2-axis')
hold on
b=2
[t,x]=ode45(@(t,x) func(t,x,b),tspan, y0);
pl... |
%
% function Fsdifclose(file)
%
% close sdif file
%
% INPUT :
% file = file handle previously opened with Fsdifopen
%
% OUTPUT :
% NONE
%
% SEE also : Fsdifopen, Fsdifclose, Fsdifread, and the low level handlers
% Fsdif_read_handler and Fsdif_write_handler
%
%
% AUTHOR : Axel Roebel
% DATE : 21.01.2008
%
% $R... |
x = linspace(-pi/2,pi/2,50);
y1 = sin(x);
y2 = cos(x);
figure;
% plot(x,y1,'--ro',x,y2,': b*');
plot(x,y1 .* y2 ,'b')
hold on
stem(x,y1)
stem(x,y2)
hold off
title('sin(x)*cos(x)')
xlabel('x')
ylabel('y')
legend('sin(x)*cos(x)','sin(x)','cos(x)') |
function [p,verts_l,verts_r,faces_l,faces_r,cdata_l,cdata_r,curvs_l,curvs_r,ROI]=visualize_ROI(ROI_path,smooth_rounds,varargin)
% p=visualize_ROI(ROI_path,smooth_rounds,varargin)
%
% p is handle to the figure
%
% ROI_path is a path to a ROI .mat-file
% subj_id is the ID of the subject used in anatomical data organizati... |
function datste=nanste(dat,DM)
datste=nanstd(dat,[],DM)./sqrt(sum(~isnan(dat),DM));
%datste=nanstd(dat,[],DM)./sqrt(size(dat,DM)); |
%Delete pixel data from files in order to have smaller size
%ONLY complete after extracting video
list = dir('/Directory/folder/*.mat');
for file_ind = 1:numel(list)
clear data
fileName = list(file_ind).name;
disp(['Currently processing: ' fileName]);
f = fullfile('/Directory','folder', fileName)
... |
function [ par, zipInf ] = zipPar( GPy, GPz, Zm )
%zip parameters of GPy, GPz, and the latent parameters Zm into a vector
[ gpy, zipInf.GPy ] = zipGPy(GPy);
clear GPy;
[ gpz, zipInf.GPz ] = zipGPz(GPz);
clear GPz;
isEmptyZm = isempty(Zm);
if ~isEmptyZm
[ zm, zipInf.Zm ] = zipZm( Zm ); %zmLn is a vector of cells... |
#include "com_codename1_ui_Container_Anim.h"
const struct clazz *base_interfaces_for_com_codename1_ui_Container_Anim[] = {&class__com_codename1_ui_animations_Animation, &class__java_lang_Runnable};
struct clazz class__com_codename1_ui_Container_Anim = {
DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FI... |
% Harris角点检测
%来自于:http://www.cnblogs.com/tiandsp/archive/2012/04/09/2439678.html
close all;
clear all;
clc;
img=imread('rice.jpg'); %要求是灰度图
imshow(img);
[m n]=size(img);
tmp=zeros(m+2,n+2);
tmp(2:m+1,2:n+1)=img;
Ix=zeros(m+2,n+2);
Iy=zeros(m+2,n+2);
E=zeros(m+2,n+2);
Ix(:,2:n)=tmp(:,3:n+1)-tmp(:,1:n-1);
Iy(2:m,:)=... |
function M = init(varargin)
%M = INIT(filename) Loads a triangle mesh from the given file.
%
%M = INIT(--, opts) Loads a triangle mesh from the given file and executes
%the given options.
%
%M = INIT('Cache', cachename) Loads a triangle mesh from the given cache
%file. This function assumes that the cache file contains... |
function czx_mat2obj(shape, outfilename)
f = fopen(outfilename, 'w');
for i=1:length(shape.X)
fprintf(f, 'v %f %f %f\n', shape.X(i), shape.Y(i), shape.Z(i));
end
for i=1:length(shape.TRIV)
fprintf(f, 'f %d/%d/%d %d/%d/%d %d/%d/%d\n', shape.TRIV(i,1), shape.TRIV(i,1), shape.TRIV(i,1), ...... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.