text
stringlengths
8
6.12M
% Skeleton code for simulation chain % History: % 2000-06-28 written /Stefan Parkvall % 2001-10-22 modified /George Jongren % 2012-02-13 modified /Daniel Anfelt %clear all clc close all % Initialization tic EbN0_db = 10;%:1:-0; % Eb/N0 values to simulate (in dB) nr_bits_per_symbol = 2; ...
clc; close all; clear all; %1.1 ezplot('x^5-8*x^3+10*x+6',[-3,3]); %grafica de la funcion hold on; %1.2 Max y min = las raices de la derivada f = @(x) x^5-8*x^3+10*x+6; g = @(x) 5*x^4-24*x^2+10; h = @(x) 20*x^3-48*x; puntosCriticos = double.empty; for i = linspace(-3,3,100) x = i; alfa = 1; delta = 1; ...
%% Adaptive Maximum Entropy (AME) % Liu, Haitao, et al. "An adaptive Bayesian sequential sampling approach for global metamodeling." % Journal of Mechanical Design 138.1 (2016): 011404. function x_new = AME_function(obj,A,strategy) % Details: Starting function for AME sampling. % % inputs: % obj - Ordinary kriging clas...
function p = pdfTLambda(t, lambda, kappa, b, m) % Joint density of postsyn. ISI and presyn. rate % Note the difference between this implementation and Eqns. 13 & 32 of Berger & % Levy 2010: m is assumed to be a real number (rather than an integer) no less than 1. % Xin Wang <xinw@salk.edu> % Copyright 2014, CNL-S, ...
function pixel = compute_color( ray ) %COMPUTE_COLOR Summary of this function goes here % Detailed explanation goes here fog = [0.82, 0.935, 1]; fog = [1, 1, 1]; % camera transform ray(2) = ray(2)+1; ray(3) = 0.35; % materials mats = [1, 1, 1;1, 0.7, 0.4; 0.25, 0.96, 0.43; 0.325...
function [row, col] = getHarrisCorners(image) k = .04; window_size = 9; threshold = 500000; g = gausswin(window_size.^2); % Convert to grayscale if RGB if(isRgb(image)) gray = rgb2gray(image); else gray = image; end % Gradient Kernels dx = [-1 0 1]; ...
function f=sensfig(wfstruct,cats,cases) % function f=sensfig(wfstructs,cats,cases) % wfstructs is a cell array of 2- or 3-element wfstructs, containing base and % sensitivity (optionally sensitivity low and high or somesuch). Each item % results in a bar on a sensitivity subplot. 'cats' is a vector of indices in...
function resetVideoPlayer(handles) % statusText could be toTerminate / Finished % stopTimer(handles); setPlayerStatus(handles, 'Terminated'); setappdata(handles.videoSlider, 'isReset', true); % reset slider first, then change video frame slider2Video(handles, 0); set(handles.numFrameInd, 'String...
function Sys = CalcDoFsNumber(Sys, Mesh) Sys.NDOFs = Mesh.NNODE + Mesh.NSPIG*(Sys.pOrd-1) + ... Mesh.NELE*(0<(Sys.pOrd-2))*(Sys.pOrd-2)*(Sys.pOrd-1)*.5; Sys.NDOFv = Sys.pOrd*Mesh.NSPIG*(1 + (Sys.pOrd>2)) + ... 2*Mesh.NELE*(Sys.pOrd>1)*(Sys.pOrd-1); end
classdef AnnoteLogger < log4m % ANNOTELOGGER % % DESCRIPTION: % % % SYNTAX: % % % INPUTS: % % % OUTPUTS: % % % COMMENTS: % % %@ % Copyright 2016 The Johns Hopkins University Applied Physics Laboratory % % Permission is hereby granted, free of charge, to any person obtaining a copy % of this software and associ...
clear; close all; clc; R = [0.75e-3, 0.5e-3, 0.25e-3]; % m E0 = [2e5, 4e5, 6e5, 8e5]; % v/m QdrMat = zeros(length(E0), length(R)); Meek0Mat = zeros(length(E0), length(R)); QdrMatmorrow = zeros(length(E0), length(R)); Meek0Matmorrow = zeros(length(E0), length(R)); h = fzero( @(h) satm(h)-0.4, 8); % find the altitud...
if ismember('/odom', rostopic('list')) odom_sub = rossubscriber('/odom'); end turtelbot3 = receive(odom_sub); % plot laser data tic; i = 0; yaw = []; while toc < 1000 turtelbot3 = receive(odom_sub,0.5); % robot_Orientation = [turtelbot3.Pose.Pose.Orientation.W, turtelbot3.Pose.Pose.Orientation...
function [ngbvs, nverts] = obtain_1ring_curv_NM... ( vid, edges, sibhvs, v2hv, varargin) %#codegen %OBTAIN_1RING_CURV Collect 1-ring vertices on non-manifold mesh. % [NGBVS,NVERTS] = OBTAIN_1RING_CURV_NM(VID,EDGS,SIBHVS,V2HV) Collects 1-ring % vertices and edges of a vertex and saves them into NGBVS and NGBES. %...
function con=con_fun(x,varargin) con=[0]; return
function [SelectSlices] = slices_with_pixel_selection(Patients) %% Read Annotated and Original Images SelectSlices = []; NumPos = 30; NumNeg = 300; for p = 1:length(Patients) PatientImgs = BrainImage_pid(Patients(p)); index = randsample(length(PatientImgs),min(length(PatientImgs),5...
function [status_read,status_Set,Err,B] = NE_Out(opwr,feedback) % opwr should be 1*13 size % feedback should be 'On' or 'Off'. If 'On', Err = real EDFA output - % desired output (dB). If 'Off', Err is empty. B = {}; folderpath = 'Z:/'; topo = [... 9103, 1, 9103, 1, 9109, 1; 9108, 1, 910...
classdef EllipticProblemAssembleFinalStiffMatrix3d < SWEBarotropic3d %ELLIPTICPROBLEMASSEMBLEFINALSTIFFMATRIX3D 此处显示有关此类的摘要 % 此处显示详细说明 properties StiffMatrix ChLength = 20 ChWidth = 20 Depth = 3.2 SurfaceBoundaryEdge...
%% Plot sweby diagrams % number of points N = 1000; % compute flux limiting functions for a range of methods theta = linspace(-1, 5, N); upwind = zeros(N,1); laxwendroff = ones(N,1); beamwarming = theta; fromm = 0.5*(1+theta); minmo = minmod(1, theta); superbee = max(0, max(min(1,2*theta), min(2,theta)...
%crreated by Sina BaniasadAzad close all clear clc %create the matrix a = randi([0 127], 256, 256); %converts the matrix into image k = mat2gray(a); min_image = min(k(:)) max_image = max(k(:)) %Image display figure imshow(K)
function f = GA_solution_short_route(x,x_start,y_start,x_goal,y_goal,obstacle,square) obs = [obstacle; [NaN NaN]; square]; prev = [x_start y_start]; polyline = prev; for i=x point = [prev(1)+cos(i) prev(2)+sin(i)]; polyline = [polyline; point]; prev = point; e...
%% MECH 6710 Homework 1 - Part 1 % Position analysis of mechanism 4-1 clear; clc; phi = 0; % deg %% Problem Constraints AB = 0.09; % m BC = 0.40; % m CE = 0.25; % m CD = 0.12; % m EF = 0.21; % m a = 0.22; % m b = 0.35; ...
%% Stelling 4 % % Met de functie randn() produceer je alleen negatieve % willekeurige getallen. % Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
function idx = findClosestCentroids(X, centroids) K = size(centroids, 1); idx = zeros(size(X,1), 1); % ----- % m = size(X,1); for i = 1:m, minDistance = 10^6; % randomly chosen large enough value for j = 1:K, distance = sum((X(i,:) - centroids(j,:)).^2); if distance < minDistance, minDista...
clear all; close all; clc; Train = load('train.txt'); Test = load('test.txt'); pcs = 64; %choose number of principal components C = cov(Train(:,2:end)); %find covariance matric MU = mean(Train(:,2:end))'; [V,D] = eig(C); %Take the principal eigenvectors E = V(:,end-pcs+1:end); % from each observation...
function [ V,S,K_STDP,K_inh ] = conv_step2( S,V,s,w,stride,th,K_STDP,K_inh ) global STDP_time_post %抑制性STDP作用时间,后神经元先发出脉冲,前神经元后发出脉冲,导致权值下降 %UNTITLED2 此处显示有关此函数的摘要 % 此处显示详细说明 [~,~,Ds]=size(s); [H,W,~]=size(V);%下一层的总深度D DD=Ds*WD [HH,WW,WD]=size(w); ks=0; for k=1:WD %一层一层的来 s每一层与权值矩阵的一层进行卷积,得到Ds层数据 conv_co...
% Reads a curve-skeleton stored in Oscar Au skeleton extraction by mesh % contraction format into a curve structure S function S = curve_read_auskeleton(filename) % Open file fid = fopen(filename); if fid == -1 error(['ERROR: could not open file "' filename '"']); end TEMP = textscan(fid, '%f', 1); S.vertices = z...
function cao_m(data,min_m,max_m,tau) %该程序用Cao氏法计算时间序列的嵌入维数 % clc % clear % load stock % data=x; % data为原始数据,列向量,n行1列 min_m=1; % max_m=10;% min_m,max_m分别为最小和最大嵌入维数 % tau=2; % tau为时间延迟 % 作者:Adu,武汉大学,adupopo@163.com [E1,E2]=cao_old(data,min_m,max_m,tau); n=length(E1); plot(1:n,E1,'-bs',1:n,E2,'-r*');xl...
clear; clc; data = csvread('feature_review_training-20000.csv',1,1); test = csvread('feature_review_testing-20000.csv',1,1); data = data(1:1000,:);%length(data),:); test = test(1:1000,:); % Labels % review_id true_stars word_count word_cap_count text_polarity biz_stars biz_review_count usr_avrstars u...
%testni primeri % c = 1/2; % f1 = @(x)f(x); % g = @(x) 0.*x; % h = @(x) 0.*x; % T = 1; % a = 0; % b = 1; % dt = 1/100; % dx = 1/10; % th = 1/2; % % x = [a:dx:b]; % y = [0:dt:T]; % [X,Y] = meshgrid(x,y); % [ U,lam ] = resiToplotnoDif(c,f1,g,h,T,a,b,dt,dx,th); % surf(X,Y,U) %test2 % c = 1/2; % f1 = @(x)f(x); % g = ...
function plotCCG(t, assignment, varargin) % Plot cross-correlograms of all pairs % parse optional inputs p = inputParser; p.addOptional('clusters', ':', @(x) isnumeric(x) || ischar(x) && isequal(x, ':')); p.addOptional('binsize', 1, @(x) isnumeric(x) && isscalar(x) && x > 0); p.addOptional('maxlag', 30, @(x) isnumeric...
function [valid, algorithmStr, infoStruct] = loadSignalExtractionSorting(inputFilePath,varargin) % [valid,algorithmStr,infoStruct] = loadSignalExtractionSorting(inputFilePath,varargin) % % Loads manual or automated (e.g. CLEAN) sorting.. % % Biafra Ahanonu % started: 2022.05.31 [20:14:54] (branched from modelVa...
function phaseout = gpops_Continuous( input ) phase_num = input.auxdata.phase_num; xf = input.auxdata.xf; dt = input.auxdata.dt; for j = 1:phase_num x_1 = input.phase(j).state(:,1); x_2 = input.phase(j).state(:,2); p = input.phase(j).parameter; ...
function [wi_1, wi_2, wo_1, wo_2, du_1] = UpdateBPWeights(xi, E, Epid, K, Oh, H, Out, wi_1, wi_2, wo_1, wo_2, du, du_1) xite=0.20; alfa=0.05; I=xi*wi_1'; dyu = sign(prod(E)./(du-du_1+0.0001)); %Output layer for j=1:1:Out dK(j)=2/(exp(K(j))+exp(-K(j)))^2; end for l=1:1:Out delta3(l)=sum(E)*dyu*Epid(l)*dK(l); end...
% UserDataContainer Helper class to implement user data and comments. % % Backend IRIS class. % No help provided. % -IRIS Macroeconomic Modeling Toolbox. % -Copyright (c) 2007-2017 IRIS Solutions Team. classdef UserDataContainer properties %(GetAccess=public, SetAccess=protected, Hidden) UserDa...
function [ fit_index ] = get_pareto( f_results ) %GET_PARETO Summary of this function goes here % Detailed explanation goes here N = size(f_results, 1); b = zeros(1,N); fit_index = zeros(1,N); for i = 1:N for j = 1:N if ((i~=j) && ((f_results(i,1) > f_results(j,1)) && (f_results(i,...
function [Iout, Zout] = hierarchical_compensation_weighted(Iv, Zv, levels) minZ = min(Zv(:)); maxZ = max(Zv(:)); Iv(repmat(isnan(Zv), [1 1 3])) = nan; Zv(isnan(Iv(:,:,1))) = nan; %W{1} = single(~isnan(Zv)); Wx = single((Zv-minZ)/(maxZ-minZ)); Wx(isnan(Wx)) = 0; I{1} = single(Iv).*repmat(Wx, [1 1 3]); I{1}(isnan(I{1})...
%%enregistrement d'un signal clear; [kk,vv]=recorder('B1'); %[zr,ste,frame]=STE_ZRC(kk,10,8000); figure(1) subplot(2,1,1) spectrogram(kk,hann(4),'yaxis'); subplot(2,1,2) plot(kk) %% variable L_sec = 0.025; % --- analysis window length in seconds STEP_sec = 0.010; sr_h...
X = imread('yoo2.jpg'); X = imshape('yoo2.jpg'); imshow(X); r_pixels = reshape(X(:,:,1),1,[])'; %reshapes into a column vector g_pixels = reshape(X(:,:,2),1,[])'; b_pixels = reshape(X(:,:,3),1,[])'; RGB_vec = {r_pixels, g_pixels, b_pixels}; numofPixels = size(r_pixels,1); random_sample = round(rand(1, 8000)*nu...
config; postfix = '_s'; proto_dir = './models/%s%s/'; proto_dir = sprintf(proto_dir, model_name, postfix); proto_file_tr = '%strain.prototxt'; proto_file_ts = '%stest.prototxt'; if use_pairwise proto_file_ts = '%stest_ip.prototxt'; end proto_file_tr = sprintf(proto_file_tr, proto_dir); proto_file_ts = sp...
function [nbour_results, time_taken_eval] = evaluate_neighbours(job_alloc, ... nbour_combos, k_exch, num_machines, cost_pm_matrix) % Time each evaluation step and accumulate in the solver script to see % how long we're spending on evaluation nbours start = tic; nbour_results = []; [max_val, loaded_mach] = max(cos...
function [ signal_const ] = Initialize_Signal_Constellation(n, dim, a, P) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %...
function [terminals,terminal_links] = findEndEffector(obj, joints) % Determines the end effector link of an array of rigid joints % % The end-effector link is the link that is not a parent link of any joints. % % Parameters: % joints: an array of rigid joints @type RigidJoint % % @note i...
function [params,llk,Mle]=Exp1_gibbs(allResp,allTarg,allRep,allPrev,center,numBurn,numSamps,init,probPrior,envrad) % Run Gibbs sampler on data % 4.8.2014-Created numTotal=numBurn+numSamps; Mle=nan(10,13,size(allResp,1),numTotal); %% Initialize priors and data structures params=nan(numTotal,5); % sd, targ, miss params(...
%% clear; close all; sim('hevmpc.slx'); %% Drive Cycle fig = figure; %#ok<*NASGU> plot(t,x_tot); title('Total Distance x_{tot}'); xlabel('Time [s]'); ylabel('x_{tot} [m]'); fig = figure; plot(t,v*3.6); title('Vehicle Speed v'); xlabel('Time [s]'); ylabel('v [km/h]') fig = figure; plot(t,dv); title('Vehicle ...
function xyz = mth_os2cart(e, a, lambda, eta) % MTH_OS2CART comptues Cartesian coordinates given oblate spheroid % coordinates. This version treats the semimajor axis as one of the % OS coordinates. % %----------------------------------------------------------------------- % Copyright 2020 Kurt Motekew % % This Source...
function [] = parseBinn16(data) imageId = typecast(data(1:2), 'uint16'); packetId = uint16(data(3)); fileName = [int2str(imageId) '_4']; image = openFile(fileName); if ((size(image.data, 1) ~= 16) || (size(image.data, 2) ~= 16)) image.data = -ones(16, 16); end image_r...
function [ NUM, DEN K] = OutPutFilter( Wp, Ws, Rp, Rs ) %OutPutFilter Return the % Returns the transfer function coefficients of an nth-order lowpass digital elliptic filter % with normalized passband edge frequency Wp [N, Wc] = ellipord(Wp, Ws, Rp ,Rs); [NUM, DEN, K] = ellip(N, Rp, Rs, Wc); end
function[]=tvl2min % This program solves the TV-L2 minimization problem, i.e., % 1/(2 \lambda) ||u-g||_{-1}^2 + \int_\Omega |\nabla u| dx % via the projection algo of Chambolle, i.e., the minimizer u is given by % u = g - [-\Delta ( \Pi_{\lambda K}(\Delta^{-1} g) )] % by Carola-Bibiane Sch�nlieb % Retrieved May 2016, K...
%% EX 1.1 %% EX 1.2 % 1.2 a) load sunspot.dat x = sunspot(:, 2); xMean = x - mean(x); xDetrend = detrend(x); logX = log(x+eps); logXmean = logX - mean(logX); [PSDmean,f1] = periodogram(xMean,hamming(length(xMean)),[],1); [PSDdetrend,f2] = periodogram(xDetrend,hamming(length(xDetrend)),[],1); [PSDlog,...
x = []; y = []; fileid=fopen('input.txt','r'); data = textscan(fileid, '%f %f'); x(1:numel(data{1}), 1) = data{1}; y(1:numel(data{2}), 1) = data{2}; fclose(fileid); prompt = 'Enter the degree '; m = input(prompt); leastsquare(x,y,m);
function coeff_sum = sum_poly_coeff(x1, x2) x1_order = length(x1); x2_order = length(x2); if x1_order > x2_order max_order = size(x1); else max_order = size(x2); end new_x1 = padarray(x1,max_order-size(x1),0,'pre'); new_x2 = padarray(x2,max_order-size(x2),0,'pre'); coeff_sum = new_x1 + new_x2; return end
% Spectral Roloff: Es la frecuencia en la cual se concentra el 85 porciento % de la magnitud de la distribucion function rol = spRoloff(v_stft) rol = find(cumsum(v_stft) >= .85*sum(v_stft), 1); % cumsum suma los valores hasta la posicion (cs[1] = v[1], cs[2] = % v[1]+v[2] ...) por lo que lo que se hace es encontrar...
function d = oval(angle, X, Y, R) % d = oval(angle, X, Y, R) % Returns the radial diameter for input angle(s) of an oval with % side lengths of X and Y, and a corner radii of R % % Peder Larson, 6/28/2006 if (R > min(X/2,Y/2)) error('Corner radius is too large (must be less than half the minimum side length)') e...
% Calculate False positive(FP) indicator % I_Out and I_Mask must be logical function FP_rate = FP_calculation(I_Out,I_Mask) % I_Out = ones(10,10) > 0; % I_Mask = (randi(2,10,10)-1) > 0; unit_region = I_Out | I_Mask; numerator = sum(sum(unit_region - I_Mask)); denominator = sum(sum(I_Mask)); FP_rate = numerato...
function [comp1_1, comp_1,prob] = huff_enc2(A) rem = mod(numel(A),8); add_val = [ zeros(1,8-rem),de2bi(8-rem,8,'left-msb')]; comp2 = [A;add_val']; y = reshape(comp2,[8,numel(comp2)/8]); y = bi2de(y','left-msb'); yG = prob_find(y); prob = yG (2,:); comp_1 = huffmandict(yG (1,:),yG (2,:)); l = cell(numel(comp_1)/2,1); fo...
% ReadTannerGraph.m % % Author: Hatef Monajemi % Date: Oct 26 2012 % % Description: % This program reads the *.txt file that % is generated by the PEG code of Hu . % Example of use: % A = ReadTannerGraph('RegGraph.txt') % A is a sparse matrix. function A = ReadTannerGraph(fname) fid = fopen(fname,'rt'); N = t...
function ea = average_deviation_wavelet(e,ind) % % AVERAGE_DEVIATION_WAVELET: computes the amplitude per subband in steerable wavelet % % Given a set of steerable pyramid vectors (columns on the matrix "e"), each % with a subband structure described by the matlabpyrtools parameter "ind", % the equivalent set of ...
classdef HexapodSimulator < matlab.apps.AppBase % Properties that correspond to app components properties (Access = public) UIFigure matlab.ui.Figure UIAxes matlab.ui.control.UIAxes XSliderLabel matlab.ui.control.Label XSlider matlab.ui.control...
function [ mato,err,errmsg ] = conc( snpi1,snpi2) %%function conc() links 2 SNPI by transforming them to TNP, then %%Mult them together. followed with T to S conversion. % Input variables: % snpi1,snpi2 -> S matrices to be concatenated % pindex1,pindex2 -> their pindex respectively % % Output variables...
function neighbor(position,vector1,vector2,r,c) %% Function to connect with ray the neighbor coordinates hold on; [x, y] = coord(position,r); if x-1 > 0 % If have neighbor in north. p = posi(x-1,y,c); connect(vector1(position),vector2(position),vector1(p),vector2(p)); end ...
% Script for pupil-based 3D localization: CPU version % (C) Copyright 2019 The Huang Lab % % All rights reserved Weldon School of Biomedical Engineering % Purdue University % West Lafayette, Indiana % ...
function workforce3() % Copyright 2019, Gurobi Optimization, LLC % % Assign workers to shifts; each worker may or may not be available on a % particular day. If the problem cannot be solved, relax the model % to determine which constraints cannot be satisfied, and how much % they need to be relaxed. % define data nSh...
%-------------------------------------------------------------------------% % % File: PU_weight(xc,locpts,Cp,cellradius) % % Goal: script that evaluates Wendland's function and its derivatives % % Inputs: xc: the collocation points % locpts: the collocation points on the subdomains % Cp: ...
function [X,Z,w] = ScharFlowAnalyticalKlemp() %% Common physical constants p0 = 1.0E5; cp = 1004.5; Rd = 287.0; cv = cp - Rd; T0 = 280.0; g = 9.80616; U = 10.0; N = 0.01; ac = 5000.0; hc = 250.0; lc = 4000.0; %% Schar Mountain Case % nx = 1024; nz = 256; x = [-50000.0 50000.0]; z = [0.0 25000.0]; ...
%{ MIT License Copyright (c) [2016] [Mallory Ann Jensen, jensenma@alum.mit.edu] Note: File contents from David P. Fenning. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, in...
function [Stat,Per,C9,S6Mach] = Performance(DataIn) S6Mach = -1; % Data is taken from the input table allowing for mutiple test cases to be % run at once sz=size(DataIn); Runs=sz(1,1); % Data imported and number of runs defined Stat=zeros(22,4,Runs); stn=[0,1,2,21,22,24,25,3,31,4,41,43,44,47,48,5,6,13,16,64,8,9]; Per=z...
function [X_train, X_test, y_train, y_test] = sklearn_data_poisson_processes() % Generate a data set containing a Poisson process in each feature %% PARAMETERS test_size = 1/3; num_times = 300; num_processes = 50; lambda_scale = 10; %% GENERATE % time-varying underlying rate is the ground-truth label lambdas = lambda...
# Load data # data = load('TSerieEjemplo.txt'); dim_data = size(data,1); min_value = min(data); max_value = max(data); for i=1:dim_data data(i) = (data(i)-min_value) / (max_value - min_value); end dim_data_tr = floor(dim_data * 0.8); x_tr = data(1:dim_data_tr); y_tr = data(dim_data_tr+1:end);
%SWAP. This function swap the value of two variables. %The input parameters are a and b, that represents the two numbers. %The output is a with the previous value of b, and b with the previous %value of a function [b,a]=swap(a,b)
function externalNodeHeatMap(BRAIN_NODES,INNER_NODES,OUTER_NODES,LOAD_NODES,LOCATIONS,CORRELATIONS,node) node_str = num2str(node); if(~ismember(node,INNER_NODES)) if(~ismember(node,OUTER_NODES)) disp([node_str ' is not an external node']); return; end end X = zeros(1,length(BRAIN_NODES)); Y = X; S = 5;...
function[x,FVAL,LAMBDA,EXITFLAG,OUTPUT,GRAD,HESSIAN]= sfminle(funfcn,x,A,b,verb,options,... computeLambda,initialf,initialGRAD,initialHESS,Hstr,varargin) %SFMINLE Nonlinear minimization with linear equalities. % % [x,val,g,it,npcg,ex]=sfminle(fname,xstart,A,b,fdata,verb,... % pcmtx,pcflags,mtxmpy,tol,i...
function topograph(outhsmm,data,chanlocs) if ~exist('data','var') ruta1='P:\BrainDynamicsLab\Software\HSMM\Sim_paper\Realdata_13Nov\'; file11='s7b1 clean broadband ENV.mat'; file22='s7b1 clean broadband.mat'; load([ruta1 file11]); load([ruta1 file22]); data=ADA...
clear clc close all t=-5:0.001:5; t0=3; y=unitstep(t+t0); figure(2) plot(t,y,'color', [255 0 0]/255,'Linewidth',2) axis([-5 5 -0.2 1.2]) xlabel('t') ylabel('f(t)')
function [ data, headers ] = toTable( obj, headers ) %TOTABLE 矩阵输出时间序列,存在TEBase.data, TEBase.headers里 % 原TradeList和EntrustList中单独的域和方法统一到这个 % 可供输出excel用。Ticks,Bars,TradeList里也有同样的函数 % headers的优先级:入参里 > obj.headers > default_headers(主要域都含) % =============================================================== % 程刚,140805 %%...
function[scale_param] = init_scale_estimator(im, location, scale_param) % desired scale filter output (gaussian shaped), bandwidth proportional to % number of scales init_target_sz = location([3,4]); scale_param.scale_sigma = scale_param.number_of_scales/sqrt(33) * scale_param.scale_sigma_factor; ss = (1:scale_pa...
%% Post-process RDF averages clear load('E1V_nm_stress_conc_data') % Box and bin dimensions box = [-6.8920100281133756e-01 4.2604373712814919e+01; -3.9211809832795872e+00 4.5836353693286085e+01; -5.3723467213784559e-01 4.2452407382139313e+01]; dx=box(1,2)-box(1,1); L=dx/10; x=0:L/20:L; xc=x(2:end)-L/20/2; % Volume of...
% This script starts from a .txt file and generates a term-document matrix % using tf-idf weighting data = dlmread('~/research/data/docword.enron.txt',' '); n_docs = data(1,1); n_words = data(2,1); n_nonzeros = data(3,1); % size(data,1)-3 % data(i,j) is the (raw) term frequency of word i in doc j, i.e. % the number o...
function [x, y] = genxy(num) x = floor(6*rand(1)); y = (num-x); y = mod(y,6); %disp(x,y,num);
clear all clc z=[-1 -3 -5 -20]; p=[-0.01 -2+4i -2-4i -10 -50]; k=1; Gs=zpk(z,p,k); sys=tf(Gs); [num,den]=tfdata(sys, 'v'); n=max(size(den)); A=zeros(2*n-1,n); A(1,:)=fliplr(den); A(2,:)=fliplr(num); for i=3:2*n-1 for j=1:n-1 A(i,j)=A(i-2,j+1)-A(i-2,1)*A(i-1,j+1)/A(i-1,1); end end h=zero...
function p = statsToolboxInstalled() % Determines if user has http://www.mathworks.com/access/helpdesk/help/toolbox/statistics p = exist('aoctool','file')>0; % name of obscure toolbox functin
function [t,y]=trojkat(A,f,fpr,faza,T,w) przesuniecie=round(faza/360*fpr/f); t=zeros(1,(T*fpr+przesuniecie)); y=t; #size(t) k=2; aa=round(w*fpr/f); aaa=round((1-w)*fpr/f); a1=0; a2=1; for i=1:1:length(t) t(k)=i/fpr; if a1<=aa #y(k)=y(k-1)+A*f/fpr/w; y(k)=A*a1/aa; a1=a1+1; end; if a1>aa...
function [T X] = delay_logistic(n, x0, b, delay) T = 1:n; X = zeros(1, n); X(1) = x0; for k = 1:(n-1) if (k>delay) xdelelayed = 1 - X(k-delay); else xdelelayed = 1; endif; X(k+1) = b * X(k) * xdelelayed; end; endfunction
function cameraParams = computeIntrinsicMatrix(image) %COMPUTEINTRINSICMATRIX Returns a cameraParameters object containing the intrinsic %parameters of the camera. data = imfinfo(image); sensorX = 22.3; sensorY = 14.9; x = data.DigitalCamera.CPixelXDimension; y = data.DigitalCamera.CPixelYDime...
function nominalFrequency = getNominalFrequency(signal, fs) % Determines whether the given signal is 50Hz or 60Hz % data: n by 1 array of the voltage % fs : sampling frequency L = length(signal); nfft = L; % Normally make this power of 2 Signal = fft(signal, nfft); mag = abs(S...
t = linspace(-4*pi,4*pi); y = sin(t)./t; plot(t,y)
%************************************************************************** % Fuzzy Random Impulse Noise Reduction Method for Colour Images % => (Compoent-wise) % % The FRINR method was proposed in: % % Stefan Schulte, Valérie De Witte, Mike Nachtegael, % Dietrich Van der Weken and Etienne E. Kerre ...
function [d] = batch_ArtefactRejection_TF(fname,script) % Function to perform multiple pre-processing operations such as artefact % rejection, time frequency decomposition, and averaging within a frequency % band using SPM batch tools. The options within the batch should be % modified depending on the question to inve...
%MÉTODO EXPLÍCITO DE ADAMS-BASHFORTH DE CUATRO PASOS % - Introduzca la ecuación diferencial : 'Dy=y-(x^2)+1' % - Introduzca la condición y(a)=b : 'y(0)=0.5' % - Introduzca la función de trabajo : y-(x^2)+1 % - Introduzca el valor de a : 0 % - Introduzca el valor de b ...
function plot3DTrajAnalysis(outputPath, generalProperty, imagingData, BehaveData) [labels, examinedInds, eventsStr, labelsLUT] = getLabels4clusteringFromEventslist(BehaveData, ... generalProperty.labels2cluster, generalProperty.includeOmissions); frameRateRatio = generalProperty.BehavioralSamplingRate/g...
function r = cat(dim, varargin) % CAT Concatenate arrays. % (Quaternion overloading of standard Matlab function.) % Copyright © 2005, 2009 Stephen J. Sangwine and Nicolas Le Bihan. % See the file : Copyright.m for further details. error(nargchk(3, inf, nargin)), error(nargoutchk(0, 1, nargout)) a = quaternion(vararg...
% Matt McDade % System Simluation % Final Exam Problem 5A clear; close all; clc; N = 100; t = linspace(0, N, N); a1 = 0.1; a2 = 0.3; A1 = 1.2; A2 = -1.9; R1 = @(x) (exp(x)-exp(-x)) / (exp(x)+exp(-x)); R2 = @(x) (2*exp(x)-2*exp(-x)) / (exp(x)+2*exp(-x)); x1 = zeros(1, N); x2 = zeros(1, N); fx1 = zeros(1, N); fx2 = ...
%%%Question 1%%% raw_data = xlsread('D:\ACADS\IDA\Assignment_3\Raw Data.xlsx'); data = knnimpute(raw_data); %%%%%Question 2%%%%% x=randperm(699); Training_data = data(x(1:500),:); Test_data = data(x(501:end),:); attr={'Clump Thickness','Uniformity of Cell Size','Uniformity of Cell Shape','Marginal Adhesion'... 'Si...
function [X,iter,t] = std_sdp_ADMM(C,A,b,rho,X0,Z0,U0,maxit,tol) % initializations [m,n] = size(C); f0 = trace(C*X0); iter = 1; Z = Z0; U = U0; % factorize to solve linear system later AA = [rho*eye(n) A'; A zeros(m)]; L = chol(AA,'lower'); R = L'; % main ADMM while...
function pr_loc_summary(cell_data_sub) figure(); set_print_page(gcf, 0); subplot(3,2,1:2:5); % colorcombine image, autoscale im_output = cat(3, imadjust(cell_data_sub.img_raw(:,:,1)),... imadjust(cell_data_sub.img_raw(:,:,2)), imadjust(cell_data_sub.img_raw(:,:,3))); % converts the intensity image I to double pre...
(** User Mathematica initialization file **)
function [w,h] = type2_dft(N,wc1,wc2) M=(N-1)/2; % Create vector of equally-spaced frequencies w= 0:0.01:2*pi; w1=0: (2*pi)/N: (2*pi)*(N-1)/N; % Create ideal amplitude response of low-pass filter (remember, it should be symmetric about w = pi) for i = 0: 1 : N-1 if( ((((2*pi)/N)*i)>wc1 && (((2*pi)/N)*i)<wc2) | ( (((2...
function img = reconShiftInvariantFBPShortScan( sino, geom, window, crop ) % Cone-beam CT filtered backpeoject reconstruction using FDK method % input: % sino - log sinogram % geom - geometry parameters % window - window function % output: % img - reconstructed attenuation image (1/cm...
%-------------------------------------------------------------------------% % % File: greedy(neigh,x0,N) % % Goal: script that computes greedy points in a neighborhood % % Inputs: neigh: the neighbors % x0: the original point (the seed) % N: number of greedy points % % Outputs: x:...
function generate_segmentation_masks_THUMOS14(slice_image_path, gt, thumos14_videos, segmentation_mask_path) if exist(segmentation_mask_path) return else mkdir(segmentation_mask_path) end img_file_list = dir(fullfile(slice_image_path,'*x145.jpg')); for i=1:length(img_file_list) filename = img_file_list(...
function [FDim] = FractalDim(X, k) % Fractal Dimension N = length(X); for i = 2:N/k y = abs(X.*(i*k) - X.*((i-1)*k)); end FDim = (sum(y)*((N-1)/(N)))/k; end