text
stringlengths
8
6.12M
pkg load quaternion; close all; DATA_FILE = "/home/h3lgi/code/grSDK/build/firs.txt"; data = load(DATA_FILE); axis equal axis([-2, 2, -2, 2, -2, 2]); ylabel("y axis"); xlabel("x axis"); zlabel("z axis"); x = quaternion(1, 0, 0); y = quaternion(0, 1, 0); z = quaternion(0, 0, 1); for i=1:rows(data) delete(get(gca, 'C...
Directory = '.\20160606\'; ASDIrrad = ASD([Directory 'Irrad*.asd.irr.txt']); % Print the dates and times of measurements (Computer clock should be set % to UTC). The overpass time is 07:16:36 %% Find measurements near the overpass time disp(strvcat(ASDIrrad.DateTime)); ASDSerialDates = [ASDIrrad.SerialDate]; % Want to ...
% Main driver program which prompts the user for their encoding method % and returns the corresponding code word generated by that method. % Inputs: Requires the message polynomial, generator polynomial and % gf_matrix % Output: Returns the codeword associated with the chosen encoding method % Example Input: Encoderm([...
% Crea la matrice di filtraggio 2D di una immagine con filtro separabile % per righe e colonne % % A = MATRIX_FILTER2D_SEP( HC, HR, EXT, M, N, TC, TR ) % % HC = coefficienti del filtro per colonne % HR = coefficienti del filtro per righe % EXT = variabile carattere per il tipo di estensione al bordo % 'e' = estens...
intrlvrIndices4096 = randperm(4096); intrlvrIndices2048 = randperm(2048); intrlvrIndices1024 = randperm(1024); save('interleaverIndices', 'intrlvrIndices4096', 'intrlvrIndices2048', 'intrlvrIndices1024');
function [D] = dipoleKernel(sz, vsz, bdir, space, T) %DIPOLEKERNEL Generate kspace dipole kernel. % The dipole kernel can be constructed in image space or in k-space. The % kspace kernel will be shifted such that the DC component is at index % (1,1,1). % % [D] = DIPOLEKERNEL(sz, vsz, [bdir], [space], [T]); % % ...
function HW1_ImageTampering() clc,close all % Original image im_original = rgb2gray(imread('../images/starry-night-reference.jpg')); disp(size(im_original)); % Tampered image im_tampered = (generate_tampered_image(im_original)); % Generate difference image % without typecasting im_d...
function [A_temp,r_temp] = GenerateBubble3D(P,obstacle,obstacle_bounds) global ru rl %%find closest edge point on obstacle for i = 1:length(obstacle) distance(i) = norm(obstacle(i,:) - P); end %%find min distance to obstacle from point P [M,I] = min(distance); if M > ru %%if distance to obstacle ...
function [ delta_n ] = getdelta( N, x_n) %GETDELTA Summary of this function goes here % Detailed explanation goes here r=1; delta_n = zeros(1,N); for k=1:N for l=1:N if l~=k dif_x_n = x_n(l,:)-x_n(k,:); b=dif_x_n/norm(dif_x_n); b1=(norm(dif_x...
function t = fusing(II,II1,target,rec,dmin,dmax,B) [m,n] = size(II); t = target; x0 = target(1); y0 = target(2); x1 = rec(1); y1 = rec(2); if (x1==0 && y1==0) return; end d = (x0-x1)^2+(y0-y1)^2 if d<dmin return; end II = II.*II1; if d>dmax %{ if B==1 return; end ...
function line_handle = pretty_scatter(x,y,color,varargin) % define default options opts = {'Marker'; 'o'; 'LineStyle'; 'none'; 'MarkerEdgeColor'; 'none';... 'MarkerSize'; 2; 'LineWidth'; 2}; % scatter data line_handle = plot(x, y, 'MarkerFaceColor', color, opts{:},varargin{:});
function waveWithPitchCurve(waveFile, outWaveFile, showPlot) % waveWithPitchCurve: Read a wav file, perform pitch tracking, display the signals and the pitch in cooledit % % Usage: % waveWithPitchCurve(waveFile, outWaveFile) % % Example: % waveFile='whenWillYouBeBack.wav'; % outWaveFile='whenWillYouBeBack_combined.w...
classdef SysMat % PUBLIC PROPERTIES properties (Access=public) %System sys=[]; % cost function V= []; %Scenario tree tree=[]; %Options sys_ops=[]; %Verbosity (TODO...
%DISP WPTREE オブジェクトの情報を表示 % % 参考 GET, READ, SET, WRITE % M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 01-Jan-97. % Copyright 1995-2004 The MathWorks, Inc.
function[bic] = AMIGO_bic(R,D,s,npar,llktype) % Bayesian information criteria fprintf('\n*************************************\n') fprintf('**** Bayesian Information Criteria ***\n'); fprintf('***************************************\n') fprintf('In statistics, the Bayesian information criterion (BIC) or Schwarz\n') fp...
%% *********************** Problem 1 ************************** % initial input syms t a1 a2 syms theta1 theta2 real q1 = [0; 0]; q2 = [a1; 0]; w = 1; w_hat = [0,-1;1,0]; I = eye(2); g02 = [I,[a1+a2;0];0,0,1]; % compute xigma hat v1 = w_hat * q1; v2 = w_hat * q2; xi1_hat = [w_hat, -v1;0,0,0]; xi2_hat = [w_...
%> @brief Standard line class. % %> And here we can put some more detailed informations about the class. % ====================================================================== %> This class is part of the NDGOM software. %> @author li12242, Tianjin University, li12242@tju.edu.cn % ===================================...
function [log_likelihood,prop_vpsc] = log_likelihood(S,N,D,curr_theta,curr_Delta,curr_delta,sigma_obs,strain_inc,sigma_vpsc,block) curr_re_tau0 = curr_theta(1:D:S*D); curr_re_tau1 = curr_theta(2:D:S*D); curr_re_theta0 = curr_theta(3:D:S*D); curr_re_theta1 = curr_theta(4:D:S*D); curr_inv_delta = 1/curr_delta; err_pr_m...
declims=[0 1]; out1=calperf(A1csERD,'out','dec'); out2=calperf(A2csERD,'out','dec'); out3=calperf(A3csERD,'out','dec'); figure, subplot(1,3,1),imagesc(out1.tpr{2}),colorbar,caxis(declims) xlabel('number of combined trials'),ylabel('FPR') subplot(1,3,2),imagesc(out2.tpr{2}),colorbar,caxis(declims) xlabel('number of c...
function ne = nnz_elements( elems) %NNZ_ELEMENTS the number of nonzero elements. % NNZ_ELEMENTS(ELEMS) returns the number of elements with nonzero entries. %#codegen -args {coder.typeof(int32(0), [inf,27], [1,1])} % Skip elements with zero entries. if size(elems,1)==0 || elems(1,1)==0 ne = int32(0); elseif size(e...
load timepath_average.mat fig_corr = figure; set(fig_corr,'Position',[0 0 700 500]); subplot(2,2,1) plot(time, rel_wage_l_mat(5,:),'b','LineWidth',1.5); hold on plot(time, rel_wage_l_mat(1,:),'b:','LineWidth',1.5); hold on plot(time, rel_wage_l_mat(9,:),'b--','LineWidth',1.5); hold on plot(time, rel_wage_s_mat(5,:),'C...
clear all clc close all % script for value iteration with chain MDP c = Chain_MDP_class(0.9,15); tol = 1e-5; maxIter = 1e3; [V_Exp,Pol_Exp,err_Exp] = VI_Exp(c,tol,maxIter); % % [V,Pol,err] = Value_Iteration(c,tol,maxIter); %%% an index that controls the solver for inner optimization problem, %%% either fmincon or C...
function [ pt ] = p( t ) %UNTITLED this function is the analytical solution for the third assignment pt = 200./( 20 - ( 10 * exp(-7*t) ) ); end
% Convert ROIs exported with the "ExportROIs" plug-in from Horos into pairs % of points that draw a polygon close all; % csvfile = '/Users/preston/Desktop/ROIs_from_plugin.csv'; [filename, pathname] = uigetfile('*.csv'); csvfile = fullfile(pathname, filename); M = readmatrix(csvfile); slice_number = M(1, 1); % img =...
% Course - Matlab programming for numerical computation % Lec 3.2 : Differentiation in single variable % Double differentiation for f(x) = tan-1(x) ,x = 1; a = 1; h = 1.0e-4; trueVal = -2*a/(1+a^2)^2; % f"(x) = -2x/(1+x^2)^2 numDiff = (atan(a+h) -2*atan(a) +atan(a-h))/(h^2); % f"(x) = f(x+h)...
function p=polyfitcoef(x,y,powers) % Finds the optimal coeficnets for the 'powers' specified. the rest are zero. % % Inputs: % powers: A vector of integers containing all the desired powers of % the polynomial in, eg [5,3,1] will fit the polynomial y = ax^5+ bx^3+cx % x: x axis input % y: y axis input % % Outpu...
% plot supplemental figure 1 % Matlab script for plotting Fig S1 (Model parameters) % for submission to Nature Neuroscience % % created by jcl on 08/07/08 %% % create figure fh = figure; mm2inch = 25.4; pw = 170/mm2inch; % paper width, make it nature size of one column, 85mm x 85mm ph = 130/mm2inch; % paper he...
function xdrawgraph(xs,yrange,method_list,field,ti,lx,ly, ws, do_legend, w, h) %the legend is at upper right in default if (nargin < 9) do_legend = 0; end box('on'); hold('all'); p= zeros(size(method_list)); for i= 1:length(method_list) mname = method_list(i).name; if (ws(i) ~= 1.0) mname = [mname...
function [new_pns] = InterpolateScattered(fP,fPLocation,xns,yns,zns,pns2) x = fPLocation(:,1); y = fPLocation(:,2); z = fPLocation(:,3); v = fP; xq = xns; yq = yns; zq = zns; % vq = abs(griddata(x,y,z,v,xq,yq,zq,'nearest')); p = [x,y,z]; q = [xq,yq,zq]; vq = griddatan(p,v,q); vq2 = pns2.*isnan(...
function [Errout,Errin,w] = validation(w, xtest, ytest, xtrain, ytrain) %for errorout Errout = 0; for k = 1:500 tempErrorout = (( ytest(k) - ( sign( dot( w,xtest(k,:)))))^2) /2; Errout = tempErrorout + Errout; end Errout = Errout/500; %for errorin ...
function [J,M] = gl2c(p_iso,p) % Computes the exponential map for the general linear group with complex % parameters, GL(2,C). % J is an element of GL2C, a Jones matrix % M is the mapping to a scaled element of SO(3,1), a Mueller-Jones matrix % p_iso is the isotropic parameter, \chi % p is the anisotropy vector [L, L...
% test function posfd N = 101; x = linspace(0,1,N)'; y0 = exp(sin(4*pi*x)); sigma = 0.2; y = y0 + randn(N,1).*sigma; plot(x, y, 'o', x, y0, '--') nbasis = 13; norder = 4; basis = create_bspline_basis([0,1],nbasis,norder); basismat = getbasismatrix(x, basis); cvec = basismat\log(y); Wfd0 = fd(cvec, basis); L...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Technische Universität Berlin % Fakultät Verkehrs- und Maschinensystem % Fachgbiet Kraffahrzeuge % M.Sc. Osama Al-Saidi % % Fahrzeugregelung: Übung - Einführung in Matlab/Simulink % Aufgabe: Schleifen (if, for, while) % Datum: 21.1...
S=randn(4096); M=ones(size(S)); K=gaussian(-3:3, 0, 2); K1=ones(2)/4; %K1=gaussian(-12:12, 0, 4); K=K/sum(K); K1=K1/sum(K1); rtot=zeros(size(S)); m0=M; s0=S; tic for k=1:6 s1=conv_corrected(s0, K, true); m1=conv2_separable(m0, K ); r1=conv_corrected((s1-s0).^2, K1, true); rtot=r1(2:2:end, 2:2:end)+rtot...
% % initialize_windows.m % % This function is called once when intializing the windows at the begin- % ning of both of the two main functions. Windows are essentially an array % with cells containing parameters of the segment of the snake within that % particular window. This allows sections of the snake to move inde...
function x=gtsp0(Pk) % generate a permutation from P_t % generation using node transitions [n,m]=size(Pk); % n==m x(1)=1; Pkp=Pk; for k=1:(n-1)%, Pkp(:,x(k))=zeros(n,1); for i=1:n%, if(sum(Pkp(i,:)~=0))%, Pkp(i,:)=Pkp(i,:)/sum(Pkp(i,:)); end end r=rand(1); cc=0; c=0; ...
function v = piecelin( x,y,u ) delta = diff(y)./diff(x); n = length(x); k = ones(size(u)); for j=2:n-1 k(x(j) <= u) = j; end s=u-x(k); v=y(k) + s.*delta(k); fileid=fopen('output1.txt','w'); fprintf(fileid,'%s','Interpolated values of y* at given x* '); fprintf(fileid,'\n'); fprintf(fileid,'%s','Linear ...
function [gtonestackL,gtonestackR] = MakeGammaToneStackmissing(Fs,tonestackfreqs,stim_dur,targ_freq) %[tonestackl,tonestackr] = MakeGammaToneStack_missing(Fs,tonestackfreqs,stim_dur,targ_freq) %Fs, sampling rate in Hz %tonestackfreqs, a vector containing the frequencies to be included %stim_dur, the stimulus durati...
function imageLR = fp(d, s) % Create the stereo images that serve as input stimuli % d: start with uncrossed (+) disparity % s: gives slant of elements % -1: back slant % 0: no slant % 1: front slant global p; imageL = zeros(p.N1Y, p.N1X/2); imageR = zeros(p.N1Y, p.N1X/2); %35x35 % left image imageL(1:12:25, [9:2...
function hmain=setup(outfile,datafiles,snipfiles,channels, noise_channels,pwflag) numch=length(channels); numfiles=length(snipfiles); if (~pwflag) if (isempty(dir('proj.bin'))) %subsetbutton=questdlg ('Define spikes on a subset of data', '', 'yes', 'no','no'); subsetbutton='no'; %Default Filters %deffiltbutton...
function dx = dynamics(x,u,p) mu=p.mu; pmee = x(1,:); fmee = x(2,:); gmee = x(3,:); hmee = x(4,:); xkmee = x(5,:); xlmee = x(6,:); Thrust=u(1,:); azimuth=u(2,:); elevation=u(3,:); pert_1=Thrust.*cos(elevation).*sin(azimuth); pert_2=Thrust.*cos(elevation).*cos(azimuth); pert_3=Thrust.*sin(elevation); smovrp = ...
function rasterplots(t,doprint,selectedDays,file,groupname) [a,s30]=fly_sleepthresh(file,t); [x y]= size(a); % This will create a separate figure for each group that you choose in the % analysis dialog box. The dimensions of subplot are determined by the % number of flies in the group (rows) and the number of days sel...
function indexout = lindex(Na,indexin,dim) % Na=size(A); Nl=size(lindex); Nl2=cumprod(lindex) if Nl2(end)==length(lindex) else indexout= end
function phandles = plotGEV3D( X, timeStamps, epsilon, sigma, mu, varargin ) avgYearLength = 365.2425; args.nPlottedTimesByYear = 180; args.xlabel = 'levels (m)'; args.zlabel = 'pdf'; args.minYear = -7000; args.maxYear = 11000; args.dateFormat = 'yyyy'; args.axisFontSize = 22; args.labelFontSize = 28;...
%% README % We have 4 formants, which acts as our features. % For each formant, 4 different modes can be used % Fx20: vowel is held at 20% the original length % Fx50: vowel is held at 50% the original length % Fx80: vowel is held at 50% the original length % Fxs: vowel is held at 100% the original length % % We have 12...
function diff = RSS_diff(X, ind, labels) % The purpose of this function is to calculate the difference in Residual % Sum of Squares (RSS) before and after removing data object 'ind' from the % cluster that it belongs to. The regression is build for the data objects % that lie in the same cluster as 'ind'. % Inputs: %...
function VPFmodelpredH_forcluster(J1barind) % This code creates VPF (VP + IL) model predictions tic Nvec = 2:5; %set size deltavec = 10:10:90; % change magnitude in degrees nsteps = 100; Kvec = 1:5; alphavec = linspace(0,3,50); %Parameter ranges for monkey data % J1barvec = linspace(0,30,nsteps); % tauvec...
1 function result = factorial( ip ) if( ip == 0 ) result = 1; return; else result = prod( 1:ip ); endif endfunction n = 4 ; display(factorial(n));
function fn_displayarrows(varargin) % function fn_displayarrows([[x,y,]img,]arrows,sub,flag) %--- % Input % - x,y vectors % - img array % - arrows array (...) or 2-element cell array % - sub scalar or 2-element vector % - flag '' % % USES MATLAB CONVENTIONS FOR IMAGES (i.e. rows <-> ...
function T_recover=main_noisyor1bit_TC(TE,E,p_cc,doingmax,doing1bit,f,fprime,iter,alternations,infbound) %main_noisyor1bit_TC: outputs T_recover from the measurements TE. %Inputs: %TE: The mesurements tensor on the observed indices(E) can be 1-bit or noisy %E: Binary tensor indicaiting observed indices....
% function [x_output] = process(x,s,alpha,b_rand,a_rand,hm_rand,param) % % next move after passing through the process equation. % % input is a vector of state variables, x is a column vector % % model.b = random(b_dist); % % dynamic equation % x1_dot = x(2); % if x1_dot < 0 % disp('negative velocity');...
function[xx] = unshsca(x,l,u,DS); %UNSHSCA Unshift and unscale % % xx = UNSHSCA(x,l,u,DS); vector x is shifted and scaled to yield xx. % Copyright (c) 1990-98 by The MathWorks, Inc. % $Revision: 1.2 $ $Date: 1998/03/21 16:29:01 $ n = length(x); arg1 = (l== -inf) & (u == inf); arg2 = (l== -inf) & (u < ...
function new_prior = apply_gaussian_filter(dims, sigma, prior) % APPLY_GAUSSIAN_FILTER - apply a gaussian filter to the estimate of the % label probabilities. % % Input: dims - the size of the gaussian kernel % sigma - the standard deviation (isotropic) of the gaussian kernel % pri...
function L_eta = reliable_num_attacks(r,eta) % Obtain reliable number of attacked nodes % Reliability (eta) % % Inputs: % - r [N+1-by-1] : Poission-Binomial pmf of estimate % Outputs: % - L_eta [scalar] : trust number % % @Written by Yu Zheng, Tallahassee, Florida, Aug. 2020 % defin...
%BEST ACCURATION clc; clear all; close all; %deklarasi konstanta jml_gambar = 40; se = strel ('square',15);%fix jangan diubah se5 = strel ('disk',2,0); k = 1; for i = 21 : jml_gambar %membaca data citra retina untuk ditampilkan di kanal hijau retina =imread([num2str(i),'_training.tif']); data_vessel = imread([n...
function ShowROCPlus(RocStructure, extrastring, Color, LineWidth) %function ShowROC(RocStructure, extrastring, Color, LineWidth) % EER = RocStructure.EqualErrorRate; if(nargin == 1) subplot(2,2,2); plot(RocStructure.normfp, RocStructure.normtp); axis([0,1,(1-EER),1]); subplot(2,2,3); plot(RocStructure.normfp...
%% DBF Foamcutter for Wing % This code is modified by Yuting Huang (ythuang96@gmail.com) based on % Dr.Anderson's code written on Scilab. % Please report all bug to the author's email address. % Last updated: 1/13/2019 % This is written for DBF foamcutting, to generate G-code from wing % prameters. clear all; close al...
pkg load symbolic function matriz_x = eliminacion_gaussiana(matriz_a, matriz_b) % Funcion para realizar una sustitucion hacia adelante % :param matriz_a: matriz triangular inferior % :param matriz_b: matriz columna % :return: matriz con el resultado de realizar la sustitucion [n, m] = size(matriz_a); l...
% This is a runscript for automatized simulation on any system % Simple test cases based on Properties_Base run('data\Properties_Base.m'); % Load the properties into memory, make copies and modify them on the go % The testcases: % 1. all flowers % 2. no spring flowers % 3. no summer flowers % 4. no autumn flowers P...
%------------- BEGIN CODE -------------- % ekran ve bellek on temizleme close all ; clear all ; clc ; a = [3 -0.1 -0.2 ; 0.1 7 -0.3 ; 0.3 -0.2 10] b = [7.85 ; -19.3 ; 71.4] n = size(a,1) aa = [a b] for i = 1:n-1 aa(i,:) = aa(i,:) / aa(i,i); for j = i+1:n aa(j,:) = aa(j,:) - (aa(i,:) * aa(j,i)) / aa(...
classdef bar2plot %class to make all the bar graph stuff easier. properties Data;%the numbers a;%the average value for plotting err;%the SEM end methods function obj=bar2plot(DataToStore) obj.Data=DataToStore; obj.a=mean(DataToStore); obj.err=std(DataToStore)/sqrt(numel(DataToStore)); ...
function process_fista_main(filename) %% See cell access before concatenate them together process_cell_opening(filename); %% Concatenate recordings together for events detection pad_multi_mat(filename,range); %% Events detection using a two-template sparse deconvolution method(fista_2tem) process_fista_2tem_detect(file...
function [MatrixOut] = extractexcel(SearchString,varargin) %EXTRACTEXCEL create cell array from data structures to paste into excel % Extract any number of vectors or 1d cell arrays inside any number of % structures and put them all in a cell array which can be pasted into excel MatchingVars = findbasevars(SearchStrin...
function [imageOut] = flippedY(imageIn) %flippedY Flip imageIn on Y axis % Detailed explanation goes here imageOut = imageIn(end:-1:1, :, :); end
clc; close all; clear all; format compact matlabpool %% PRE-PROCESSING %% Initialization of Data Structures PROCESS = struct('EEG',{},'KINE',{},'CLASS',{},'CLASSIFIER',{}); disp('Initialization of Data Structures') %% Initializing and Assigning directory paths.... InfantDataJohn_dir = '\\bmi-nas-01\Contrer...
%Script to implement the spiking network model found in %%% %Correlation-based model of artificially induced plasticity in motor cortex by a bilateral %Brain-Machine Interface, Guillaume Lajoie, Nedialko Krouchev, John F. Kalaska, Adrienne Fairhall, %Eberhard E. Fetz, under review, (2016), preprint: https://arxiv.org/a...
% tic % mat1 = zeros(360000,25,3); % for first = 1:360000 % for second = 1:25 % for third = 1:3 % mat1(first,second,third) = 1; % end % end % end % toc tic index=1; mat2 = zeros(3,25,360000); for first = 1:3 for second = 1:25 for third = 1:360000 mat2(index) = 1; inde...
function []=prueba() Ks= [1 10 20 30 40 50 60 70 80 90 100 ] n=prod(size(Ks)); mat=round(rand(Ks(end),Ks(end)).*200); for i=1:n tic; mysvd(mat(1:Ks(i),1:Ks(i))); myTimes(i) = toc; tic; svd(mat(1:Ks(i),1:Ks(i))); ocTimes(i) = toc; end close all hold on plot(Ks,myTimes,'r') plot(Ks,ocTimes,...
function [D,D2] = DD2(N) % Function returns a D matrix and D*D of dimensions N*N D = zeros(N,N); for i = 1:N for j = 1:N D(i,j) = 2*((j>i)*0.5*(1+(-1)^(i+j+1))*((i==1)*0.5*(j-1)+(i>1)*(j-1))); end end D2 = D*D;
% breakLinkCopyFcn % This script file kills (renders inactive or destroys depending on setting) the library link to a block when you copy it. % if 0 SET='inactive'; DEBUG=0; % none % Block is not a reference block. % % resolved % Link is resolved. % % unresolved % Lin...
function Yp = predictLogisticRegression(x, w, b, lps) XW = x*w(:); prob1Expression = lps + (1 - 2 * lps)./(1.0 + exp(- (XW + b))); % expression of logistic function (prob of 1) Yp = prob1Expression>0.5; end
% Using hmmestimate. The function hmmestimate requires that you know the sequence of states states that the model went through to generate seq. % The following takes the emission and state sequences and returns estimates of the transition and emission matrices: params_featExtraction.timeBeforeEvent = 4; params_featEx...
function Y=blending(SX,SY,EX,EY,target,source,slope) % % Target % target = double(imread('Data/test1.jpg')); % % % Source % source = double(imread('Data/text1.jpg')); % girl=double(source); target=double(target); girl=source; [Lh, Lv] = imgrad(target); X = target; Fh = Lh; Fv = Lv; LY=SX; LX=SY; %...
function [Xk] = dft1(xn,N) L = length (xn); if (N<L) error ('Nmust be > =L') end x1=[xn zeros(1,N-L)]; for k = 0:1:N-1; for n = 0:1:N-1; p = exp (-i*2*pi*n*k/N); x2(k+1,n+1) =p; end end Xk = x1*x2.'; end
function [ outImg ] = invert_NL( inImg ) x = inImg; x(:,:,1) = 255 - x(:,:,1); x(:,:,2) = 255 - x(:,:,2); x(:,:,3) = 255 - x(:,:,3); outImg = x; end
function [ PEFLUX,IMAX,AFAC,DE,EV ] = FLXCAL( context,IDIM,ALT,SZADEG,TE,TN,XN,XNE,XN2D,XOP2D,IMAX ) %FLXCAL evaluates the photoelectron flux %:::::::::::::::::::::::::: PHOTOELECTRON MODEL :::::::::::::::::::::::: %....... This subroutine evaluates the photoelectron flux using the concept %....... production frequen...
load('/home/juan/self-propelling/code/coverage/RS_core/saved/qr_qr_safe_V_circle_Radius_2_Speed_10_SafetyTime_1.mat') load('/home/juan/self-propelling/code/coverage/RS_core/saved/analytical_qr_qr_safe_V_circle_Radius_2_Speed_10_SafetyTime_1') %% evaluate analytical ttr i = 0; ATTR = single(zeros(size(ttr))); for v1 = ...
classdef stage<handle properties controller % controlador del stage axis % numero de eje del controlador position % posicion respecto a la posicion de home resolution % resolucion en las unidades units units % unidades en las que se mide la posicion speed end methods functio...
function X_denoised = denoising_by_low_rank_factorization(W, A, X, n_components) % % Denoising by low-rank factorization. Computes a low-rank approximation of % the input data, given a set of spatial filters and corresponding spatial % patterns. % % X_denoised = denoising_by_low_rank_factorization(W, A, X, n_compone...
function Awind_j_xm_t = func_18(x2, x1, y1, y2, zxMinus, zyPlus, tanh_Sdt, cosA_ZWjdt, tanA_ZWjdt) if tanh_Sdt > 0 inputAo = [zyPlus, x1, x2, y1, y2, tanh_Sdt, cosA_ZWjdt, tanA_ZWjdt]; inputAs = [zxMinus, x1, x2, y1, y2, tanh_Sdt, cosA_ZWjdt, tanA_ZWjdt]; Awind_j_xm_t = (x1 + x2) * (y1...
for g=1:length(gazes) params_folder_gazewise=params_folder; % params_folder_gazewise.scanpaths_subfolder = [params_folder.scanpaths_subfolder '/gbg/' num2str(g)]; params_folder_gazewise.scanpaths_subfolder = [params_folder.scanpaths_subfolder]; params_folder_gazewise.bmaps_subfolder = [par...
I=imread('flowers1.ppm'); figure(10); imshow(I) I=im2double(I); IR=I(:,:,1); IG=I(:,:,2); IB=I(:,:,3); [m,n]=size(IR); Theta=zeros(m,n); for i=1:m for j=1:n acu=((IR(i,j)-IG(i,j))^2 +(IR(i,j)-IB(i,j))*(IG(i,j)-IB(i,j)))^(0.5)+0.00000001;%El 0.00000001 es por los casos en que quedaria una divisi...
function [dag,sc_star,conv,last_gen] = esl_ga(ss,data,N,M,MP,alpha,d,scoring_fn,bnet) % Elite-based Structure Learner using GA %% Init n = size(bnet.dag,1); % #nodes ns = bnet.node_sizes; % node sizes conv = struct('f1',zeros(1,M),'se',zeros(1,M),'sp',zeros(1,M),'sc',zeros(1,M)); last_gen = M; % #generati...
function varargout = Testing(varargin) %TESTING MATLAB code file for Testing.fig % TESTING, by itself, creates a new TESTING or raises the existing % singleton*. % % H = TESTING returns the handle to a new TESTING or the handle to % the existing singleton*. % % TESTING('Property','Value',...) c...
function [DCThat] = ComputeDCThat( data, Q, Q_scalar ) q_handle = @(A) Quant8x8_custom(A.data, Q, Q_scalar); quantCoeff = blockproc(data,[8 8],q_handle); % for checking if result correct: deq_handle = @(A) DeQuant8x8_custom(A.data,Q,Q_scalar); DCThat = blockproc(quantCoeff,[8 8],deq_handle); end
function network = initalize(X, layers) % Initialize the network D = size(X, 2); no_layers = length(layers); numconn = 5; decay = 0.25; network{1}.bias_upW = zeros(1, layers(1)) + 0.1; network{1}.W = zeros(D, layers(1)); for j = 1 : D idx = ceil(layers(1) * rand(1, numconn));...
run('vlfeat/toolbox/vl_setup') names = dir('vehicles/*/*.png'); % names = names(1:1000); vimages = {}; for i = 1:length(names), if rem(i,100) == 0, fprintf('Loading vehicle image %d\n',i); end vimages{i} = imread([names(i).folder,'/',names(i).name]); end names = dir('non-vehicles/*/*.png'); % names = names(1...
% Clear previous iterations clear close all % Axis Ranges x_max = 25; % Maximum range of x axis y_min = 0; % Minimum y axis range y_max = 10.2; % Maximum y axis range % Vectors to plot x = 0:1:5000; % Create vector for x values - arbritrary length y = zeros(size(x)); % Vector for y values %...
% imhist(); clear; close; clc; img = imread('T.jpg'); imshow(img); figure(); imhist(img); % Find T value % T = 100;
function out = loadMNIST(filename1,filename2) %Caricamento del dataset MNIST fp = fopen(filename1, 'rb'); assert(fp ~= -1, ['Could not open ', filename1, '']); magic = fread(fp, 1, 'int32', 0, 'ieee-be'); assert(magic == 2051, ['Bad magic number in ', filename1, '']); numImages = fread(fp...
%%%%%%%%%%%%%% Question2 %%%%%%%%%%%%%% tic; alpha0 = 1.0; n = 20; x = rand(n,1); f = fun(x); g = grad(x); d = -g; k = 1; while ( 1== 1) [retcode, x, f, g, alpha] = linesearch(x, f, g, d, alpha0); if (norm(g, inf) < 1e-2) break; end; d = -g; k = k + 1; sprintf('k=%d fval=%f err=%f alpha=%f\n',k,f,norm(g, inf)...
clear global clear all clc close all addpath(genpath('../lti_toolbox')); %% 1. Connecting an augmented plant % Simple continuous time controller design for the X-stage of the XYtable % at PMA. Special thanks to Dora for supplying the model and testing the % toolbox. %% 1.1. Let's define the systems we w...
clear all L = 200e-9; W = 100e-9; Lb = 40e-9; Wb = 40e-9; meshspace = 1e-9; nx = round(L/meshspace + 1); ny = round(W/meshspace + 1); cond1 = 1; cond2 = 1e-2; %This section creates a conductivity map witch assigns a conductivity to %each node in the mesh. This will be used to create the G matrix condMap = zeros(nx,...
%config = 1 -> R manipulator %config = 2 -> P manipulator %config = 3 -> RR manipulator %config = 4 -> RP manipulator %For 2-link manipulator %X(1) = q1 %X(2) = q2 %X(3) = q1' %X(4) = q2' %X(5) = q1'' %X(6) = q2'' function xdot = xdot(X, t) config = 3; g=9.81; if (config < 3) l = 10...
function Moments = uq_lognormal_PtoM( Parameters ) % Moments = UQ_LOGNORMAL_PTOM(Parameters) returns the values of the % first two moments (mean and standard deviation) of a Lognormal % distribution based on the specified parameters lambda = Parameters(1) ; zeta = Parameters(2) ; mu = exp(lambda + 0.5 *zeta^2) ; sig...
function [F, M] = computeActingForcesAndGeneralizedInertia(mass, Jb, quat, angularVel) % computeActingForcesAndGeneralizedInertia returns generalized inertia matrix M % and acting forces F for body b. % % mass is the mass of body b. % Jb is the inertia tensor of the body b expressed in the body b frame. % qua...
function [quit,PDR] = setupTrialSeq_spatialPDR(PDR) % function to set up trial sequence for spatialPDR setup=1; while setup % Setup randomized scale and loc sequences: scales = PDR.TEST_scales; outlier_scales = PDR.TEST_outlier_scales; mu = mean(scales); scales = sort(scales); % rand...
function figure_stuff global REMORA PARAMS %% load dfs fig prompt = inputdlg('Enter desired decimation factors (comma separated):',... 'DF Selection', 1, {'1, 5, 10'}); prompt = strsplit(char(prompt), {',',', '}); REMORA.hrp.dfs = []; for k = 1:length(prompt) df = str2num(prompt{k}); REMORA.hrp.dfs = [REM...
function D_fill = hole_filling(D1,cross_radius) ind = D1==0;%Find holes in the given disparity map D_fill = D1; shifteded_D1 = zeros(size(ind)); max_cross = zeros(size(ind)); min_cross = Inf(size(ind)); for i = -cross_radius:cross_radius %Shift the image in vertical direction shifteded_D1(:,:) = 0; if ...
function initpulldowns %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % initpulldowns.m % % generate figure pulldown menus % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% global HANDLES PARAMS % 'File' pulldown HANDLES.filemenu = uimenu(HANDLES.fig...