text
stringlengths
8
6.12M
function [rc, sc, a, bits, wc, sigma2_a, N0] = QPSKtransmitter_random(Nbits, SNR, bits_seed, noise_seed) if nargin < 3 bits_seed = 'shuffle'; end if nargin < 4 noise_seed = 'shuffle'; end rng_oldstate = rng(bits_seed); bits = round(rand(Nbits, 1)); rng(rng_oldstate); [rc, sc, a, wc, sigma2_a, N0] = ...
clear addpath(genpath('../../../../Useful Functions/')); addpath(('../../../../Toolboxes/FAM_Biclustering')); addpath(('../../../../Toolboxes/cvap3.7')); %data path %path_d = 'C:/Users/dlmg4/Dropbox/data/uci dataset/auscredit/'; path_d = '~/Dropbox/data/autism/'; fileNames = dir([path_d '*.xlsx']); tempIndexF...
function [xm,iter,res] = weighted_ArnoldiPagerank(A,q,tol,dim,itmax) % The restarted adpative refined weighted Arnoldi process for computing % PageRank, which is proposed by J.-F. Yin, G.-J. Yin, M. Ng (2012), NLAA, % 19: 73-85. % --------------------------------------------------------------------- % Written by ...
root_guess_p = @(Rq,M) 1./(1+Rq./M).*(1+sqrt(abs(Rq)./M)); root_guess_m = @(Rq,M) 1./(1+Rq./M).*(1-sqrt(abs(Rq)./M)); M = [linspace(1,300,500),linspace(300,10000,50)]; Rq = linspace(-100,-1,100); root = []; for i = 1:length(M) root = [root; root_guess_m(Rq,M(i))]; end surf(Rq,M,root); shading flat;
function result = loadDataFromFile(user,input_control) log_dir=strcat(getenv('PWD'),'/logs/'); result=load(strcat(log_dir,'user',int2str(user),'-',input_control,'-maps-downup.log')); end
function timeTracesGenotypeCombo(timeTraces,cellTypes,stimDuration,timeTraceLims,figName) beforeStimDuration=-timeTraceLims(1); afterStimDuration=timeTraceLims(2); dataRate=60; numGenos=length(cellTypes); colors=lines(numGenos); f=MakeFigure('Name',figName,'NumberTitle','off'); set(f,'visible','off'); nflies=zeros(...
%% Bonus - run all data sets to get figures % Polynomial kernel for i = 1:6 a = SVMtrial_bonus(i); end % RBf kernel for j = 1:6 a = SVMtrial(j); end
close all clear clc t=-10:0.001:10; f=(-t+2).*(unit_step(t)-unit_step(t-2)); g=3*(unit_step(t+2)-unit_step(t-2)); figure subplot (2,1,1) plot (t,f) axis([-4 4 0 4]) subplot (2,1,2) plot (t,g) axis([ -4 4 0 4]) [to yo]=konvolusi(f,g,t); figure plot (to,yo) axis([ -4 6 0 7])
% Modified to slow down to eat classdef Arch5MotorControl < Neuron % Memory assicatied to this architecture % This is what must be saved and loaded properties cap = Cap(1.); % Food processing foodThresh = Perceptron(0.20); foodScale = Linear(0.1); energyFlip = Linear(-1.); ...
dock %% NumRows = 3; NumCols = 4; for r = 1:NumRows for c=1:NumCols plotnum = (r-1)*NumCols + c; disp([r,c,plotnum]) continue subplot(NumRows,NumCols,plotnum) title(plotnum) end end
%%% CONFIGURATION FOR IMPORTING ERP DATA %%% % -- process preparation config(1).preproc.eventtype = 'proc'; % label for processing triggers config(1).preproc.eventduration= 1 ; % duration of each contiguous epoch config(1).preproc.trimends = 3 ; % trim edges of data (filter/recording artifact)
#! /usr/bin/octave -qf # Funcion que aplica el metodo de gradiente conjugado basado en las formulas del Burden function [x, it, r_h] = cg(A, b, x0, maxit, tol, mensaje = false) # Valores iniciales r0 = b - A * x0; # Direccion de busqueda v = r0; for k = 1 : maxit # ...
format long %compute with "long" number of sig digits % Examine relationships of connections and weights C1 = [10; 20; 30]; w1 = [10 20 30]; Neuron(C1, w1) % NET = 1400, OUT = 1 C2 = [1;1;1]; w2 = [2 2 2]; Neuron(C2, w2) % NET = 6, OUT = 0.997527376843365 C3 = [.1;.1;.1]; w3 = [.2 .2 .2]; Neuron(C...
function StrArray = ExplodeString(String,Delimiter) N = length(String) ; NotDone = true ; Buffer = cell(N+2,1) ; Counter = 0 ; Bottom = 1 ; DelimStride = length(Delimiter) - 1 ; Top1 ...
function [ output_args ] = genNii( img, voxel_size, filename ) %GENNII Summary of this function goes here % Detailed explanation goes here save_nii(make_nii(single(img), voxel_size, [], 16), filename) end
function outdata = cleanASLglobals(root); % function outdata = cleanASLglobals(root); % % if the input data are not in a file with a header, % I'll just assume that each slice is 64 x 64 pixels % % This function removes the fluctuation of each % slice's global mean signal from the data by % fitting a linear model wit...
function spec = calc_spec(HH, dH, Imin, Rmin, sh1) % Spectrum calculation. Central field is 0, no additional Im is added % HH - mesh for calculation near the central field % dH - intrinsic line width % H00 if the field in the center % Rmin is effective radius of min coil 1.03 cm % Imin is Imin (shift is n...
clc;close all;clear; jd = 80; n = 5; S0 = 6000; T_b = 18; A_b = 0.6; T_w = 25; A_w = 0.2; Dr = 0.3; dt = 7; asw = 0; alw = 1; abb = 0.25; abw = 0.75; abs = 0.5; lat = -88:2:88; r = 90; zz = linspace(-88,88,89); theta = acos(zz/r); phy = linspace(0,2*pi,101); array = linspace(1,100,100); C_array = nan(89,100); for i = ...
%% read LAMMPS velocity dump file clc,clear,close all tic %% define defect type id to represente defect types % 1. random antisite % 2. neighbor antisite % 3. B substitute N % 4. N substitute B defect_type_id = 4; defect_type = defect_id2type( defect_t...
function vec_O_apex_s = apex_position(q, rot_sb, rot_sbprime, cone_params) %------------------------------------- radius = cone_params.radius; xA = cone_params.lateral_apex_offset; zA = cone_params.vertical_apex_offset; %------------------------------------- vec_GD_s = rot_sb*[-radius;0;0...
function [ lvl ] = untitled( input_args ) %UNTITLED Summary of this function goes here % Detailed explanation goes here %Cerramos cualquier ventana de figura que pueda estar abierta en Matlab %para evitar confusiones close all; %El proceso inicial es leer la imagen y darle un formato doble para %...
%% Interpretations % 不考虑高度 % 正侧视,斜平面成像chirp scaling算法 %% radar parameters clear all; close all; clc; c = 3e8; lambda = 0.03125; fc = c/lambda; Tp = 10e-6; B = 180e6; gama = B/Tp; Fs = 200e6; H = 0; Rs = 12.8e3; squint_angle = 0; squint = squint_angle/180*pi ; Rb = Rs*cos(squint) ; Da = 0.4;...
function [struct] = taxiSingleEventParser(file) % return struct %% % file = csvread(filename); num_records = length(file); %% id struct.id = file(:, 1); struct.len = num_records; %% xyz on_spots = file(:, 2:4); on_spots_lng = on_spots(:, 1); on_spots_lat = on_spots(:, 2); on_spots_alt = on_spots(:, 3); on_spots_ln...
function [y, fs] = jp_stringtogethersounds(files, Cfg) %JP_STRINGTOGETHERSOUNDS Make one long sound file from shorter ones. % % JP_STRINGTOGETHERSOUNDS(FILES) takes individual sound files and puts % them togehter into a long sound (e.g., for presenting during an % experiment). FILES is assumed to be a cell array of sou...
function g=gpoly(x0,z0,xcorn,zcorn,ncorn,rho) % g = gpoly(x0,z0,xcorn,zcorn,ncorn,rho) % This function computes the vertical attraction of a 2-D body with polygonal % cross section. Axes are right-handed system with x-axis parallel to long % direction of body and z-axis vertical, positive downward. % Based on Fortran ...
% subgradient method for group lasso function [x, iter, out] = gl_SGD_primal(x0, A, b, mu0, opts) % default parameters if ~isfield(opts, 'maxit'); opts.maxit = 100; end if ~isfield(opts, 'maxit_inn'); opts.maxit_inn = 500; end if ~isfield(opts, 'ftol'); opts.ftol = 1e-10; end if ~isfiel...
clear all dicomRENAME_params destination_folder = ['/Users/megan/Box/DATA/' project '/Dicom/sub-' subID '/ses-' ses]; if ~exist(destination_folder, 'dir') mkdir(destination_folder); end run_tasks = {'AAHead_Scout', 'gre', 'rest', 'mixed', 'slowreveal', 'ambiguity', ... 'T1w', 'T2w', 'MRA', 'MRV', 'Physio_re...
function PlotCIE1931xy(xy,Phospher,new_fig_flg,tri_flg,color_flg,marker_type) % function PlotCIE1931xy(xy,:Phospher,:new_fig_flg,:tri_flg,:color_flg,:marker_type) % (: is optional) % % Plot CIE1931 xy value(s) with a CIE1931 chromaticity diagram frame. % % [input] % xy : CIE1931 chromaticity value(s), [2 ...
y1 = zeros(500, 1); y2 = zeros(500, 1); y1res = zeros(100, 100); y2res = zeros(100, 100); for i = 1:100 for j = 1:100 u1 = i*ones(500, 1); u2 = j*ones(500, 1); y1 = zeros(500, 1); y2 = zeros(500, 1); for k = 9:500 y1(k) = symulacja_obiektu5y1(u1(k-7), u1(k-8), u2(k-2), u2(k-3)...
function [ rec ] = makeRecord( t,p ) global recX recY recZ recRoll recPitch recYaw recF recExist; global camC camZ camPsi_roll camPsi_pitch camPsi_yaw; %UNTITLED Summary of this function goes here % Detailed explanation goes here recX(t,p)=camC(1,p); recY(t,p)=camC(2,p); recZ(t,p)=camZ(p); ...
function x = average_consensus_test(N,x0,A,iters,Ts,times,titl) %% function average_consensus_test(...) can be used to simulate protocol P1 (look the technical report) %% inputs : % N : total number of agents. % x0 : a vector with the initial states of all agents. % A : matrix A has an amount of sub-matrices , one for...
function [ret] = queryEntrust(counter, e) % [ret] = queryEntrust(counter, e) % 查询委托状态 %--------------------------------- % 朱江 20160621 first draft counter_id = counter.counterId; entrust_id = e.entrustId; [dealinfo] = rh_counter_query_entrust(counter_id, entrust_id); % dealVolume@double = 0; % 成交数目 % ...
% exercise 3.1 %a h=
function [U, x, y] = PoissonSolver(problem, M, N, plotType) if nargin < 4, plotType = 0; end if nargin < 3, N = M; end h1 = (problem.rb - problem.lb) / M; h2 = (problem.ub - problem.bb) / N; x = problem.lb : h1 : problem.rb; y = problem.bb : h2 : problem.ub; kmax = (M + 1) * (N + 1); idx = 1:kmax; idx ...
% match descriptors % % Input: % descr1 - k x n descriptor of first image % descr2 - k x m descriptor of second image % thresh - scalar value to threshold the matches % % Output: % matches - 2 x w matrix storing the indices of the matching % descriptors function m...
% --- parse a filename function [animalID, fileNo, unit, stimType] = parseFilePath (filePath) % FileName should be a string of the format AnimalID#FileNo[StimName] % % AnimalID string for the animal ID % FileNo integer for the file number % Unit string for recording site / unit % StimName string describing t...
%======================= %寻求一个矢量中大于指定值的元素指引 %======================= A=rand(1,10); limit=0.75; B=(A>limit); if any(B) fprintf('值大于0.75的索引'); disp(find(B)) else disp('所有值都大于指定值') end
function PHI = AlternateOrderBasis(U_B,U,imod_stress); % See f_MatBT_ROM_II dbstop('7') PHI = zeros(size(U_B,1),imod_stress+size(U_B,2)); ipppl = 1; iUUU = 1 ;jUUU =1; SSS_DONE = 0 ; UUU_DONE = 0 ; while ipppl<=imod_stress+size(U_B,2) & (SSS_DONE == 1 | UUU_DONE == 0) try ...
%sobel锐化 I=imread('lenna.jpg'); %读取图像 if( ~( size(I,3)-3))%判断是否为彩色图 I1 = rgb2gray(I); else I1=I; end subplot(221),imshow(I),title('原图'); model=[-1,0,1; -2,0,2; -1,0,1]; [m,n]=size(I1); I2=double(I1); for i=2:m-1 for j=2:n-1 I2(i,j)=I1(i+1,j+1)+2*I1(i+1,j)+I1(i+1,j-1)-I1(i-1,j+1)-2*...
function exists = fileExistsOnDevice(filename) % exists = fileExistsOnDevice(filename) % % Checks if a file exists in the devCam directory on the attached device. % Returns a boolean indicator of the file's existence. % % - - Input - - % filename : a string indicating the filename and path relative to the main % ...
% NA_MODEL2 % % Volany z NA_MODEL na doplnenie vstupov, pre premennu TYP_ID==1 % Zadaju sa parametre vseobecneho prenosu regulovaneho modelu % % Vrati sa spat do NA_MODEL % Copyright is with the following author(s): % % (c) 2012 Juraj Oravec, Slovak University of Technology in Bratislava, % juraj.oravec@stuba.sk % (c)...
function [dump_stats]=flow_rate(dump_stats) %FLOW_RATE: calculates time dependent fuel flow rate from mom_dumps.mat % years since launch for each dump (start time - launch time)/(sec per year) ysl=(dump_stats.s.time-time(1999204))/(86400*365); % thruster counts at start of each dump sc=dump_stats.s.counts; %thrust...
%Problem 5 % Part a clc; close all; clear all; num = [0.038 0]; den = [1 0.039 0.053]; Air_dyns = tf(num,den) Eng_dyns = tf([10],[10 1]) Servo_dyns = tf([1],[0.1 1]) Sen_dyns = tf([10 1],[1]) sys = Servo_dyns*Eng_dyns*Air_dyns*Sen_dyns sys1 = Servo_dyns*Eng_dyns*Air_dyns; figure hold on ...
close all els = []; Fs = [];pots=[];adds = []; Fs1 = [];pots1=[];adds1 = []; Fs2 = [];pots2=[];adds2=[]; cols = [];cols1=[];cols2=[]; alpha=9; mats = {'steam1.mtx','steam2.mtx','nos3.mtx','ex7.mtx', ... 'ex33.mtx','crystm01.mtx', 'coater1.mtx','pesa.mtx'}; for i = 1 : size(mats,2) mat = strjoin(mats(i)); [req,pot...
% n = modrz(x,y) % % Modulus after division, with reassignment of zeros. % % Returns mod(x,y) for all mod(x,y) ~= 0. If mod(x,y) == 0, returns y % rather than 0. % % Thus, modrz(x,4) is 1, 2, 3, or 4, rather than 1, 2, 3, or 0. % % 02.05.11 - S.Fraundorf - first version function n = modrz(x,y) n = mod(x,y); if n == ...
% matlab script bowmass.m % finite difference scheme for a bowed mass-spring system % soft friction characteristic w/iterative Newton-Raphson method %%%%%% begin global parameters SR = 44100; % sample rate (Hz) f0 = 200; % oscillator frequency (Hz) FB = 500; % bow force/mass (m/s^2) TF = 0.1; % simulation duration (s) ...
% THIS SCRIPT IS BASED ON THE WINNER CODES IN THE TEST BED 2 ON THE % IEEE 2014 OPF problems (Competition & panel): Differential Evolutionary Particle Swarm Optimization (DEEPSO) % http://sites.ieee.org/psace-mho/panels-and-competitions-2014-opf-problems/ function [Fit_and_p,FVr_bestmemit, fitMaxVector] = ... DE...
ind_pivotset = 1; maxiter = 1:30 tol = 1e-16; lala = []; lele = []; for ind_iter = maxiter param_opt.maxiter = ind_iter; param_opt.TolFun = tol; param_opt.TolX = tol; param_opt.TolCon = tol; % run lsqlin Mesoptions = optimset('Algorithm', 'interior-point', ... ...
function hdr = read_gehdr(id) %READ_GEHDR Read the header of a GE raw data file into a structure % % usage: hdr = read_gehdr(id) % % id: integer file identifier obtained from fopen() % % hdr: a structure containing the following elements: % % hdr.rdb - a structure equivilant to GE's rdb_hdr_rec % ...
%MECH 568 HW2 Problem 6.12; %Author: Thomas Andreano %Version 1: 10/28/2019 %------------------------------------------------------------------------- % Solution to the one-dimensional linear convection equation using 4th % order centered difference and 4th order Runge-Kutta clear all; close all; clc; a = ...
% plot velocity function QC_01_12_CheckVelModel(dbpath, dbname, ID) disp('By default reads r3huber catalogue from the database') dbname_relocate = [dbpath 'relocate/relocate_use/' dbname '_r3huber']; run('/opt/antelope/5.6/setup.m') % open origin and associated phases database db = dbopen(dbname_relocate, 'r'); d...
function l_bc = pump_bc_plant(qh_ann,Qvec_ann,L_eigv,q_pump_initial,area_ann,xi,matA,matB,press_res,in_res,dr,Cl,rho0,p0,rho_ss) % Function to generate left boundary condition % The boundary conditions are implicit in q1 and q2 in this case. % Arguments are the q1/2 (n+1), Q1n and parameters u = (Cl/2)*qh_ann(1)+(1/2...
classdef policyConstant < Policy %POLICYCONSTANT Chooses a random action in the beginning and holds on %to it properties chosenAction end methods function init(self, nbActions) % randomly choose an action in the begin self.chosenAction = randi(nbActions)...
function [tn_Pal,tn_Seq,I,J] = otnodes(t,~) %OTNODES Ordered terminal nodes for a 1-D wavelet packet tree. % [TN_PAL,TN_SEQ] = OTNODES(T) returns two vectors of % ordered terminal nodes of a binary tree. % TN_PAL contains the terminal nodes ordered using % Paley (or natural) order, and TN_SEQ contains the % ...
% Homework #6b % function [x,L,U,porder] = ludecomp(A,b) % % Performs LU decomposition % input: % A : (n,n) matrix % b : (n,1) vector % output: % x : solution (n,1) vector % L : lower triangular matrix % U : upper triangular matrix % porder: permutation vector % comment: (1) Note that ...
function x1=Range_compress(x1,Fs,Tp,gama) %¾àÀëѹËõ³ÌÐò [nrn,nan]=size(x1); fr=[-nrn/2:nrn/2-1].'/nrn*Fs; tp_num=ceil(Tp*Fs/2)*2; win_sref=hamming(tp_num); win_sref=ones(tp_num,1); win_sref=win_sref./max(win_sref); tp1=((0:tp_num-1)'-tp_num/2)/Fs; phi=pi*gama*(tp1.^2); sref=exp(i*phi).*win_sref; sref_f=zer...
function res = bc_bvp(ya,yb, beta) global xp z0 r0 ds = 1e-4; %{ res=[yb(2)-z0/r0; ya(3)-pi/2; ya(2); yb(1) - xp; yb(5); yb(3)-pi/2; ya(6)-1/4 ]; %} res=[ya(5); yb(3)-pi/2; ya(2); ya(1) - xp; yb(2)-z0/r0; ya(3)-pi/2; yb(1)-1 ]; end
clear all; load H.mat; load V.mat; load n.mat; D=H+V; clear H V; %D=sparse(D); %D = blkdiag(D(1:size(D,1),1:size(D,2))); [Cmn,E]=eigs(D,5,0.5); save EigenVector.mat Cmn; save EigenEnergy.mat E; E=real(diag(E)); [E,index]=sort(E); E index save index.mat index;
function [N, F] = compute_bw_stats(feaFilename, ubmFilename, statFilename) % extracts sufficient statistics for features in feaFilename and GMM % ubmFilename, and optionally save the stats in statsFilename. The % first order statistics are centered. % % Inputs: % - feaFilename : input feature file name (string) or...
% sBoxFix.m % Constants global ts; center = 0; % Format: {time, visStim} % [Mode, K0, K1, K2] visStim0 = [0, 90, 0, center]; visStimN = [1, 0, -2, center]; LaserOn = 'ff00'; olf1 = '0000'; olf2 = 'ff00'; olf3 = '0000'; olfOff = '0000'; LaserOff = '0000'; histogramBounds = [5,1*120;... ...
function [Y] = CActFunc(type, X) % Complex-valued activation functions. switch type case 'splitTanh' R = tanh(real(X)); I = tanh(imag(X)); Y = R + 1j*I; case 'splitSigm' R = 1./(1 + exp(-real(X))); I = 1./(1 + exp(-imag(X))); ...
%% get_zip % gets zip names from archive %% function zip = get_zip(my_pet) % created 2017/10/25 by Bas Kooijman, modified 2019/12/25 %% Syntax % zip = <get_zip *get_zip*>(my_pet) %% Description % Gets acceptance dates (= version numbers) of zips in ../entries_archive % % Input: % % * my_pet: character string with na...
function [linelist] = FindDetectedConnections(rdclseglist) lcnt = 0; linelist = []; nseg = size(rdclseglist,2); % # of segments for i=1:nseg nline = (size(rdclseglist{i},1) - 1); % # of lines in the segment for j=1:nline lcnt = lcnt + 1; linelist(lcnt...
function [out confidences] = BayesianClassifier(testset, trainset, traingroup ) %calculate covariance matrices h = waitbar(0,'Bayesian Classifier Training Phase'); for i = 1:10 indexes = find(traingroup == i-1); T = trainset(indexes,:); S{i} = cov(T) + eye(size(T,2))*0.13; MU{i} = mean(T,1); ...
function H6_matrix_eq = H6_matrix(L4,L5,theta1) %H6_MATRIX % H6_MATRIX_EQ = H6_MATRIX(L4,L5,THETA1) % This function was generated by the Symbolic Math Toolbox version 7.0. % 22-Oct-2018 17:07:15 t2 = cos(theta1); t3 = sin(theta1); H6_matrix_eq = reshape([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0...
function [d] = summ_d2m(varargin) DATA = varargin{1}; r = varargin{2}; type =varargin{3}; time = varargin{4}; contrasts =varargin{5}; pstr = {'acquisition', 'extinction'}; half = {'FirstH', 'SecondH'}; cstr = {'harm', 'safe', 'rev'}; ostr={'shock', 'noshoc'}; d=[]; switch type case 'chp' for c = 1:3 ...
function square=top_right(N,n) square = N(1:n,end-n+1:end);
function [epsilon,phi_hat,channel]=LLH_estReal(rx_data_reshaped,train,nr_car, PHN_cov,sigma_sqr,L,rho) %This function tries to estimate the Channel Impulse Response trying to %mitigate the effect of CFO and PHN in the estimate. It can be shown that %for low SNR it reaches de CRLB. It uses joint loglikelihood functio...
function [neighbors,result]=simulation(nop,maxneighbor,nor,prophet) tic result=zeros(10,maxneighbor); neighbors=zeros(nop,nop); for j=1:maxneighbor if(mod(j,1)==0) fprintf("ÁÚ¾Ó£º%d\n",j); for i=1:10 for k=1:nop %neighbors(k,:)=two_net(nop,k); %neighbors(...
% This function performs the maximum likelihood association and outlier detection given a single measurement. % Note that the bearing error lies in the interval [-pi,pi) % mu_bar(t) 3X1 % sigma_bar(t) 3X3 % z_i(t) 2X1 % Outputs: % c(t) ...
clear ; close all; clc matrix = load('training/matrix/data.txt'); window = load('training/window/data.txt'); % training inputs, X X = matrix; % training labels, y y = window; % training size m = size(X, 1); y(y!=0) = 1; % example for y = 0 % label = 0; % y0 = y; % y0(y0 == label) = 100; % y0(y0 != 100) = 101; % y0...
cd /Users/Juraj/Dropbox/USI/PhD/various/GridTools %size of the problem N = 40; ni = N/2; % partitioning in I nj = N/2; % partitioning in J nk = N; % no partitioning in K npart = 4; %iteration count max_iter = 20; %build global 3D laplace matrix [~,~,A] = laplacian([N N N]); %figure(); spy(A); title('Laplacian A');...
function A_r = GF(X,sigma) %clc % X=imread('33.pgm'); X=uint8(X); % sigma=1; normalize = 1; %theta = 3*pi/4; Y=[];all=[]; [a,b]=size(X); X1=normalize8(X); % X1=double(X); %% Gaussian smoothing % %F = fspecial('gaussian',2*ceil(3*sigma)+1,sigma); %XF = imfilter(X1,F,'replicate','same'); %} %% Construct derivatives ...
R = 50:1000/256:1050 - 1000/256; for i = 1 : 256 % textString{i} = strcat(num2str(R(i)), ', '); fprintf(num2str(R(i))) fprintf(', ') end fprintf('\n\r') for i = 1 : 256 % textString{i} = strcat(num2str(R(i)), ', '); fprintf(num2str(1/R(i))) fprintf(', ') end fprintf('\n\r')
function [ output ] = calcDFT( input ) %UNTÝTLED4 Summary of this function goes here % Detailed explanation goes here n=length(input); for k=0:n-1 %for each outputelement s=0; for t=0:n-1 %each input s=s+input(t+1)*exp(-2i*pi*t*k/n) end output(k+1)=s; end end
%Explicit MPC for Iris 3DR Quadcopter for z,theta,phi and psi control clear all % close all clc %Iris 3DR Parameters g = 9.81; m = 1.37; lx = 0.13; ly = 0.21; KT = 15.67e-6; KD = 2.55e-7; Im = 2.52e-10; Ixx = 0.0219; Iyy = 0.0109; Izz = 0.0306; Ax = 0.25; Ay = 0.25; Az = 0.25; wo = 463; %Angular vel...
Wanneer je het element behorende bij index 2 opvraagt van de vector v=[ -3 -2 -1 0 1 2 3], krijg je geen foutmelding.
clear clc % Algoritmo de interpolação por Splines cúbicas: % Represente a funçao f(x)=x^3-3 com x entre 0 e 4, de forma continua e suave a=0 %valor inicial do intervalo b=4 %valor final do intervalo n=4 %numero de subdivisões do intervalo [a, b] para n+1 pontos x=a:(b-a)/n:b; y=f4(x); % valores exatos da funçã...
function trialseq = ALTS_sequence(settings,id) trialseq = []; % SHORTCUTS col = length(fieldnames(id)); % BUILD TRIAL SEQUENCE for ib = 1:settings.general.blocks % GET TRIAL NUMS go_nov_a = (settings.general.trials * settings.general.go * settings.general.nov_a); go_nov_v = (settings...
function sol = prob3(x) sol = x(1) + x(2); end
% Este programa retorna a resposta do exercício 3 da lista 1. disp('3) Calcular o módulo de uma engrenagem cilíndrica de dentes retos cujo diâmetro externo é igual a 45 mm e o número de dentes é 28.') de=45 % diâmetro externo em mm. Z=28 % números de dentes. disp('3)A resposta do exercício 3 da lista 1 é : o módul...
clear clc %chance here for different images x = imread('einstein.jpg'); %initializing filter of mean filter 3x3 h3 = [1 2 1; 2 4 2; 1 2 1]; sum3 = sum(h3(:));%coefficient of the matrix h3 = (1/sum3)*h3; %using filter with my image y3=myconv(x,h3); %show original image imshow(x) figure %show 3x3 filtered image imshow(...
%% Integer Search function [xGrid,yGrid,uGrid,vGrid,cc] = funIntegerSearchMg(f,g,gridx,gridy,winsize,winstepsize,varargin) gridxBackup = gridx; gridyBackup = gridy; % may lose boundary regions, backup first borderGapx = 1+round(0.75*winsize); borderGapy = borderGapx; if gridx(1) < borderGapx, gridx(1) = borderGapx; e...
% Script for pupil-based 3D localization % (C) Copyright 2019 The Huang Lab % % All rights reserved Weldon School of Biomedical Engineering % Purdue University % West Lafayette, Indiana % U...
function short_path=GraphDist(LeafNodes,NeighborSeed,L) %Construct the graph supk=L; Nnode=size(LeafNodes,1); weight=zeros(Nnode,Nnode); dist=pdist2(LeafNodes,LeafNodes); for i=1:Nnode % if isnoise(i)==0 for j=2:supk+1 x=NeighborSeed(i,j); weight(i,x)=dist(i,x); end % end end % %...
classdef Slice3D < Unfolding & FabOutput & Mesh3D % Slice an STL and create a pleat-folded 3D shape %% PROPERTIES properties (Constant = true) DEBUG = false; end properties thickness = 1; % height of each slice (cm) minattach = 0.1; % 0.6; % max length of crease ...
function scores = compute_fitness_population(x,store,daySlot,countEmployee,genderEmployee,experienceEmployee,salaryEmployee,dayWeek) %% COMPUTE_FITNESS_POPULATION % % Main fitness function. Computes the whole population fitness % % Copyright (C) 2020 % % This program is free software; you can redistribute it and/or % ...
function [Q] = L_xor_R(cfg_in) % Last 2.4 second, dt = 50ms, or last 41 bins (after all choice points) for TC cfg_def.w_len = 48; % Number of neurons cfg_def.n_units = 30; % Number of iterations cfg_def.n_iters = 100; mfun = mfilename; cfg = ProcessConfig(cfg_def,cfg_in,mfun); for ...
classdef Export < handle %EXPORT Summary of this class goes here % Detailed explanation goes here properties data; info; path; Excel; Workbook; end methods function self = Export(data, info) self.data = data; ...
function M = CRRharmonicDemod8(f0,f1,p0,p1,d0,d1,I,t,polAng1,polAng2) % Equations 22. % vectorized (as in MatLab syntax vectorization) complex harmonic demodulation % This new version generalizes to arbitrary polarizer angles, and also % demostrates applying the phases after the harmonic demodulation. M = zeros(4); a ...
%% fn_axis %% Syntax % ax = fn_axis([ha,]'tight|image|tightimage',sidefactor,'y0') %% Description % set a nice range to axes % % Input: % - flag 'tight' stretch the axis as much as possible % 'image' set an equal ratio between x and y % 'tightimag' stretch...
function [data,V,SV]=dimreduction(data,method,options) % calculates the dimensionality reducted time series by using either the % singular value decomposition or the averaging process across the voxels. % input: data: % matrix of dimension Tx(n), where T is the number of % time-point...
function [distanceFromBot] = beaconDistance(centroid) % Only feed this one image at a time or it'll get mad and explode % Bottom centroid: 50mm % Middle centroid: 100mm % Top centroid: 150mm focalLength = 3.04; %mm realHeight = 100; %mm imageHeight = 240; %px objectHeight = centr...
function distmat=euclidean_distance_similarity(x,y,mu,dist_xn,dist_yn) % % Syntax: distmat=euclidean_distance_similarity(x,y,mu,dist_xn,dist_yn) % % Inputs: svar signal variance hyperparameter is an (n x d) matrix of traning set containing n samples of d-dimensional % ...
function [Dac, kcr, flag] = Darcy_compaction(eta_0, A, B, phi_i, alpha, T, mean_wf, sigma) %% Critical permeability threshold % This function computes the timescale ratio between compaction and Darcian flow. flag = 0; % Fracture permeability at intial porosity kfj = A*((100*phi_i).^B); % Call pore fluid visco...
classdef LinearSolver < ether.optim.Solver %LINEARSOLVER Summary of this class goes here % Detailed explanation goes here properties end methods function this = LinearSolver() this.name = 'Linear'; this.description = 'Linear Regression'; end function result = solve(~, problem, x, y) if ~isvec...
function makegif(img,filename,fps,varargin) % Transform a 3D matrix into an image based GIF file % Note that computer vision toolbox is required for the counter (varargin). % % Tom Bruijnen - University Medical Center Utrecht - 201609 % Handle input if nargin < 4 counter=0; else counter=1; end img=abs(squeeze...
imgoringe = imread('brains.pgm'); background = wiener2(imgoringe); I = imgoringe-background; imgEnhanceBrain = imadjust(I); imshow(imgEnhanceBrain,[]); axis on; title('Original picture'); uiwait(msgbox('left click to choose the area')) %draw the are to do the binary and get the roi location drawing = drawfreehand(); bi...
function gps_plot clear all close all filepath = '/media/My Passport/ford_drivehistory/2011-09-23-download4/extracted_files/' %filepath = '/media/My Passport/ford_drivehistory/sample/' filenames=dir([filepath '*.mat']); colours = 'bgrcmyk'; for i=1:size(filenames,1) disp([ num2str(i) ' ' filenames(i).name]) ...
function [binned_avg,bin_sem]=binnedAverage(data,bin_width) nr_points=length(data); lower_bounds=1:bin_width:nr_points; upper_bounds=bin_width:bin_width:nr_points; nr_bins=numel(upper_bounds); binned_avg=NaN(nr_bins,1); bin_sem=NaN(nr_bins,1); for b=1:nr_bins binned_avg(b)=nanmean(data(lower_bounds(b):upper_bound...