text
stringlengths
8
6.12M
function [] = fourierBarbara (inp_img) [h w] = size(inp_img); padded_img = zeros(2*size(inp_img)); padded_img((h/2)+1:(3*h/2) ,(w/2)+1:(3*w/2) ) = inp_img; fim2 = fftshift(fft2(padded_img)); absfim2 = log(abs(fim2)+1); figure; imagesc(absfim2, [-1 18]); colormap(jet); colorbar; %filter = ones(256,256)*0.6; ...
% Compare refaced data with ground truth. Calculate L1 and L2 norm. Plot % convergence fo training across epochs. Create summary images. dataset = 5; switch dataset case 1 dirGroundTruth = fullfile('data','Dataset-blurred21-Guys-norm'); dirUnsup = fullfile('generate_images', '20181005-135815-blurr...
function txyzCalibrated = calibrateAccelerometer(txyz, mode) [accelerometerCalibrationData, ~] = loadCalibrationData(); % ellipsoid fitting disabled by default, because it does not seem to work that well if ~exist('mode', 'var') mode = 0; end if mode == 0 offset = acceleromete...
function canoParam = FuncLearnStruct(U,V,L,lambda,quiet) % Function to learn structure % % U: contNodeNum * sampSize, real/noisy continuous attributes data. % V: discNodeNum * sampSize, real/noisy discrete attributes data. % L: levels in each categorical variable % Requires UGM at http://www.di.ens.fr/~mschm...
%% Random Dot Motion Task % TMS version % Number of trials: nr_trial_per_cond 10 for 800 task trials % (10 => 400 trials per function (*coh*dir*bins)) %now: 24 conditions -> nr_trial_per_cond=17 =>408 trials %if error in disp a and b: make sure coherence is 0.3 not 3! %% Constants participant=input('p...
function [psth_final,raster,t_ms,t_ms_r,NPSP,total_spikes,edges_ms,psth_check] = plot_psth(bin_fullname,start_ix_ms,sweep_duration_ms,extra_time_ms,channel_no,start_time_s,end_time_s,method,probe,t_bin_ms) [spike_times_ms] = extract_spikes_pixels(bin_fullname,channel_no,start_time_s,end_time_s,method,probe); t_bin_m...
%% Assignment 2 %% Question 1(a) % The Finite Difference Method is used to solve for electrostatic potential % of a region, with $V=V_0$ on the left side and $V=0$ on the right side of % the region. The top and bottom of the region are not fixed, so the % problem is essential in one dimension. close all clear all nx=...
function hvcalibrate() % % %hvcalibrate - issue 1.1 (17/05/2006)- HVLab HRV Toolbox %------------------------------------------------------- % Script to initialise the calibration graphic interface. % "hvcalibrate()" display a window with channel parameters from % the structure 'HV' if it already exists in t...
function [] = plot_slopes_and_intercepts(data) % The data input to this function is from e.g. FULLDATASET_PV.mat session_inds = {}; session_inds{1} = 1; session = 1; for i = 2:size(data.orientation,1) if data.orientation(i-1,:) == data.orientation(i,:) session_inds{session} = [session_inds{session}, i]; e...
global MPI_COMM_WORLD; load 'MatMPI/MPI_COMM_WORLD.mat'; MPI_COMM_WORLD.rank = 103; Alluxio_Row_mv_version3;
% pop_groupSIFT_convertToGroupAnatomicalRois() % % History: 12/09/2019 Makoto. selectDipWithLargerMoment() is supported. % Copyright (C) 2016, Makoto Miyakoshi (mmiyakoshi@ucsd.edu) , SCCN,INC,UCSD % % Redistribution and use in source and binary forms, with or without % modification, are permitted provided that the fo...
% Première partie du TP, fonctionne uniquement avec IRIS disp('*** Lecture de la base ***'); [filename, pathname] = uigetfile( ... {'*.*', 'All Files (*.*)'; ... }, ... 'open data'); S = [pathname filename]; sD=som_read_data(S);%lecture de la base p=size(sD.data,2);%nb de colonnes dans la base (nombre...
classdef Rect %RECT Class for 2D rectangles % % A rectangle `[x,y,w,h]` is described by the following parameters: % % * Coordinates of the top-left corner. This is a default interpretation % of `[x,y]` in OpenCV. Though, in your algorithms you may count `x` and % `y` from the bottom-lef...
%% convert_mach_mtx2struct.m % convert our population arrays to population matrices in a struct to % quickly calculate makespan. % Matrices are m x n 0/1s (rows are machines, columns are jobs, % corresponding to the initial sorted job array). m_ij = 1 if machine i is % allocated to job j, and 0 otherwise. Each row sho...
%% input sphere_center = [0; 0;0]; sphere_radius = 0.55000000000000004; line_point = [0.7309, 0.73099, 0.730988]; line_dir = [-0.00212813 , 0.00404455 , 0.00391235]; particle_position = [0.499979; 0.50004; 0.500039]; particle_vel = [-0.00212813; 0.00404455; 0.00391235]; particle_radius = 0.4; contact_normal =...
function [ output_args ] = kendrickClass(mz,cl) %kendrickClass - visualisation plot % Calculate the KMD [nom,kmd] = kendrick(mz,[],'ch2'); % Now scatter through each type... [unq,~,ind] = unique(cl); numC = numel(unq); cols = parula(numC); ax = zeros(numC,1); figure; hold on; for n = 1:numC fx = ind ...
%BFGS method x1=linspace(-2,2,100); x2=linspace(-2,2,100); [X1,X2]=meshgrid(x1,x2); f = @(x1,x2)100*((x2-x1.^2)).^2+100*(1-x1).^2; f(X1,X2); Z=f(X1,X2); contour(X1,X2,Z,0:10:500) hold on %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% x=[0;0]; %starting point tol=0.0001; dx=0.01; a=1.61803; b=0.0005; f = ...
function LDOS = kmap(rs, d, V, npts, delta, dispersion) % Calculates the LDOS map for set of scatters. % inputs: rs = vector with the position of the scatters (in A) % d = size of the map in A. (200A by default) % V = bias voltage in V (0 by default) % npts = number of pixels of the ma...
function imgSeg = otsuBinarize(img) x = 0:5:255; [f,~] = ksdensity(img(:),x); [num, loc] = findpeaks(f,x); imgSeg = img; imgSeg(imgSeg==0) = loc(1); level = graythresh(imgSeg); imgSeg = imbinarize(imgSeg,level); end
function y = diffCoef(x) % y=ones(length(x),1); % y=(x.^2+1)'; y=((x<.5)+10*(x>=.5))';
% Vowel synthesis using the Z-domain % % HY370 - Digital Signal Processing % Laboratory Exercise #3 % % Winter Semester 2016 % % (c) G. Kafentzis, CSD, UoC, Greece % Sampling frequency fs =8000; % INSERT CODE HERE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
%clear all close all filename='no_grad2'; nimpertr=50; ntr=4; TR=2; noff=8-1; dthr=30; bim=2:7; aim=9:11; %[raw, lro, lpe, thk, total_tr, te, ti, ref_pos, ss, sli_val] = epirecon(filename); expLength = 419; stimLength = 10/2; raw2avw(abs(raw), 'mag.img'); raw2avw(angle(raw)*1000, 'pha.img'); reg1 = ones(expLen...
% Matt McDade % System Simulation % Midterm Exam Problem 4C Nt=20; Nr=17; theta=linspace(0,2*pi,1001); rho=linspace(0,1,1001); tvec=linspace(0,2*pi,Nt); rvec=linspace(0,1,Nr); figure(1) clf hold on plot(rho*0,4*rho-2,'k') plot(4*rho-3,rho*0,'k') hold off for k=1:length(rvec) z=rvec(k)*exp(i*theta); ...
% This demo loads two grayscale images and efficiently computes the emd_hat % between them in a similar to Peleg et al. paper: "A Unified Approach % to the Change of Resolution: Space and Gray-Level". % All computation here are done on dint32, which is a little more % efficient than working on doubles. % emd_hat is des...
function data = ksmooth(ArrayData, r, sigma) % smooths maps. % Input: ArrayData = matrix to be smoothed % r= radius of smoothing % sigma = intensity of smoothing % Outpot: data = smoothed version of data if nargin==1, r=1; sigma=1; end; if nargin==2, sigma=r; end; [m, n]=size(ArrayData...
function VMT_PlotShorelineFilled(Map) % Plots a shoreline map given the shoreline data structure 'Map' (see % VMT_LoadMap.m) on the current map % % Shoreline is is filled with channel cutout in this version. % % See Also: VMT_PlotShoreline % % P.R. Jackson, 12-9-08 brks = find(Map.UTMe == -9999); for i =...
clear;clc; in = '../example_video/fil_cat.avi'; in_dat = double(readVideo(in)); thresh1 = 10; thresh2 = -10; sh_mode = 1; filtMode = 2; w = 0; if filtMode == 1 lowFilt = [0 1/8 0; 1/8 1/2 1/8; 0 1/8 0]; elseif filtMode == 2 lowFilt = 1/16*[1 2 1; 1 2 1; 1 2 1]; elseif filtMode == 3 lowFilt = 1/9*[1 1 1...
%pth = '/Users/wil/Documents/Work/Projects/Stratified-Wakes/dat/x/x/'; pth = '/home/jose/Desktop/Stability/dat/x/x/'; analysistype = 'spectrumdirect'; ISsaveplots = 1; ISpatchloadmeshff = 0; Stmax = 1.00; shiftvecdirect = pi*linspace(0, Stmax, 11); %shiftvecdirect(1) = pi*1.0e-3; nevdirect = 5; Lx = load('x...
function [constrainedFoopsi, spikesReshaped, spikesMean] = plotStimResults(dF, constrainedFoopsi, stimParams, timeRadius, expName, expId, forceStackHeight) % If there are more than 4 stimulation positions, might need more colors. But 4 should be enough. if isempty(expName) expName = ''; end if isempty(expId) expId =...
function [bstat, k2stat] = subfnBootStrpv2(data) % run once to find our how many values get bootstrapped [ParameterToBS] = subfnProcessModelFit(data,0); % find the size of the different variables [Nmed, NParameters] = size(ParameterToBS.values); N = length(data.Y); NCov = size(data.COV,2); % initialize the output valu...
function [FspringsR, FspringsL] = calcGroundReactions(SpringPos, SpringVels,... numSpringsBody, mu_s, mu_d, mu_v, Kval, Cval, ECR, ECL, latchvel,tscale,BeltSpeed) % v3 implemented Fregly's springs nframes = size(SpringPos,1); Rhsprings = 1:numSpringsBody(1); Rtsprings = numSpringsBody(1)+1:numSpringsBody(1)+numSp...
function [W H] = nmf(V, w_size, num_of_iterations) % random start values W = rand(size(V,1),w_size); H = rand(size(W,2),size(V,2)); % repmat magic utility H_rep_index = reshape(repmat([1:size(H,1)],size(V,1),1),1,[]); V_rep_index = reshape(repmat([1:size(V,2)],size(W,2),1),1,[]); for i = 1:num_of_iter...
function [N] = newtonBase(x, x_n) %Berechnet das n-te Newtonbasispolynom for j = (1:1:length(x)) N(j) = prod(x(j) - x_n(1 : end - 1)); end end
function interpolateData(Tfreq,Duration,Variability) %This function will interpolate or average to create data points in-line with the specifid frequency (Tfreq) in s %It will add random variability to any interpolated data points %If the resolution of optimization is faster than the stored data it will interpolate and...
N=70; %the number of divisions c=3*10^8; %speed of light frequency= 2*10^9; %1 GHz wavelength= 2*pi*c/frequency; a=0.001; %radius prompt = 'Length of Antenna in terms of lambda '; %request user input len = input(prompt); total_length=len*wavelength; %total length of the antenna length=total_length/2; %length of one...
val = normrnd(0,1, 20, 1); %построение первого графического окна subplot(1, 2, 1); hist(val); x = -3:0.1:3; hold on; plot(x, normpdf(x,0,1), 'LineWidth', 5); subplot(1 ,2 ,1); %построение второго графического окна subplot(1, 2, 2); plot(x, normcdf(x , 0, 1)); hold on val = sort(val); stairs(val, normcdf(val, 0, 1)); ...
function [b, eta, lambda] = mth_cart2oblsph_efit(e, xyz) % MTH_CART2OBLSPH_EFIT comptues oblate spheroid coordinates given Cartesian % coordinates and an ellipsoid eccentricity as the fit parameter. % %----------------------------------------------------------------------- % Copyright 2017 Kurt Motekew % % This Source ...
% Create Poisson process as described in RD17 nC = 10; % Total # of cells T = 1200; % Total time (s) lam = 0.1; % Avg firing rate for background process fracVar = 0.1; % Fraction which is variable, vs. constant rate Poisson S = makeAR(nC,T,lam); S = fracVar*S + lam*(1-fracVar); % E...
close all %Code to make a masked video based on ROI position %Dependencies: % Must run this code with Ca_Preprocess.m and Ca_1_ROI.m File2 = strcat(Sample,VideoFileType); InfoImage=imfinfo(File2); mImage=InfoImage(1).Width; nImage=InfoImage(1).Height; NumberImages=length(InfoImage); FinalImage=zeros(nImage,mI...
function [c, ceq, X0] = test_optimality(ac, N) [~,x] = fourierdiff(N); t = ac.tf*x/(2*pi); % [~,x] = chebdiff(N-1); % t = 0.5*ac.tf*(1-x); state = zeros(N,6); control = zeros(N,3); for i = 1:N sig = get_traj(t(i), ac.tf, ac.coeffs, ac.N); state(i,4:6) = [sig(1), sig(2), sig(3)]; ...
function res = GetCandidatesFromRecState( RecState ) %GETCANDIDATESFROMRECSTATE Summary of this function goes here % Detailed explanation goes here res = ''; segmentationPoints = [RecState.SegmentationPoints]; for i=1:length(segmentationPoints) if (i==1) startIndex = num2str(1); else ...
function swcCallback(obj,figH,eventData) %% read swc file obj.dendReadSWC(); %% detect branches obj.dendAddBranches(); %% recalculate mask obj.dendMaskUpdate();
function writeStatsToFileClusterFirstV2( dataStructCategory, dataStructNumeric, fl, saveFilePath, save_file) %save_file: include path and folder %data to write to html format imgFolder = 'Figures/'; fid = fopen([saveFilePath, save_file], 'w'); fprintf ( fid, '<html>\n');%html tag fprintf ( fid, '<head> ...
function Kj=reinforce(t,y) R=8; L=6e-5; J=0.02; Kt=1; Kb=1; Tl=1; N=1; phi=0.0015; A=[-R (-Kt);(Kt) 0]; B=[1;0]; T=20; l=2; P=rand(2,2,T); Q=[1 0;0 1]; r=1; Kj=eye(1,2); P1=eye(2,2); for i=2:1:T P(:,:,1)=P1; P(:,:,i)=transpose(A-B*Kj)*P(:,:,i-1)*(A-B*Kj)+Q+transpose(Kj)*r*Kj; end Kj=pinv(r+transpose(B)*P(:,:,T)...
function [edge_list, nedges] = eid2adj_edges_usestruct(eid,edges,v2hv,sibhvs,usestruct) [edge_list, nedges] = eid2adj_edges(eid,edges,v2hv,sibhvs,usestruct);
function [s,ernst] = ernst_eq(tr,t1,flip) % function [s,ernst] = ernst_eq(tr,t1,flip) flip = flip/180*pi; E1 = exp(-tr./t1); s = (1-E1).*sin(flip) ./ (1-cos(flip).*E1); ernst = acos(E1)/pi*180; return
% top row initial positions and the bottom is velocities of sol0 tspan = [0, 20*pi]; m = [1, 100]; sol0 = [1; 0; 0; 0; 0; 0; 0; 10; 0; 0; 0; 0]; figure(1) [t,sol] = ode45(@(t,y) nbody(t,y,m), tspan, sol0); plot3(sol(:,1),sol(:,2), sol(:,3), 'm-'); title('ode45') figure(2) [t,sol] = ode23(@(t,y) nbody(t,y,m), ...
function measures=evaluateResult(Labels,PredictedLabels, batchSize,MethodName) n=size(Labels,1); T=ceil(n/batchSize); measures.precision=zeros(T-1,1); measures.recall=zeros(T-1,1); measures.accuracy=zeros(T-1,1); measures.F1=zeros(T-1,1); totalNumber=0; trueNumber=0; alpha=0.95; for t=1:T-1 index=(t)*batchSi...
% Distribution code Version 1.0 -- Oct 12, 2013 by Cewu Lu % % The Code can be used to evaluate your detection results in our Avenue Dataset, build based on % [1] "Abnormal Event Detection at 150 FPS in Matlab" , Cewu Lu, Jianping Shi, Jiaya Jia, % International Conference on Computer Vision, (ICCV), 2013 %...
function [Sig] = CMR_randMod_3AFC(noise_bands,target_f,SNRdB,n_mod_cuts,target_modf,fs,tlen,coh,bp_mod_fo) t = 0:1/fs:tlen-1/fs; if size(noise_bands,1) ~=3 error('Currently expect 3 noise bands') end bp_filt_mod = fir1(bp_mod_fo, [n_mod_cuts(1) n_mod_cuts(2)]*2/fs,'bandpass'); bp_fo = round(1/(min(min(noise_ban...
% HW 5 problem 1 % Steven Macenski last edited Oct 2, 2013 a = [4 -1 0 3;-2 3 1 -5;1 1 -1 2; 3 2 -4 0]; b = [10;-3;2;4]; x = a\b; fprintf('The solutions for variables are as follows:\n %f\n %f\n %f\n %f\n',x);
function out = main() switch getenv('ENV') case 'IUHPC' disp('loading paths (HPC)') addpath(genpath('/N/u/hayashis/BigRed2/git/vistasoft')) case 'VM' disp('loading paths (VM)') addpath(genpath('/usr/local/vistasoft')) end icvf = niftiRead(fullfile(pwd,'NODDI','AMICO','NODDI','FIT_ICVF.nii.gz')); od = niftiRea...
function H = hilmat(n) % % function H = hilmat(n) % % Hilbert matrix % % Input - % n: order of Hilbert matrix % % Output - % H: n-order Hilbert matrix %% Parameter check if nargin ~= 1 error('Error! Number of inputed parameter shoule be equal to 1.') end if numel(n)~=1 || ~ismatrix(n) error('Error! Inputed p...
%% init_gearbox.m global h;
function y=nextA(A,x) end
% 保存特征到文件夹的版本 % 选择不同层的特征+PCA+进行liblinear实验 % clc clear net1 = dagnn.DagNN.loadobj(load('D:\myself\matlab\matlab_documents\dynamic_image\exp\ntu\net-deployed.mat')) ; net1.mode = 'test' ; imdb = load('D:\myself\matlab\matlab_documents\dynamic_image\exp\ntu\imdb.mat') ; % imdb = imdb.imdb; b = 1; opts.dataDir = fullf...
% load('resultWorkspace500.mat'); gen = pop(1,:); % close all; % figure; % img = drawGAImage(gen, imageSizeX, imageSizeY, circlesNum); % imshow(img) % compare images figure(20); subplot(1,3,1); original = imread('fotoCustom.jpg'); % imageSizeY= 200; % imageSizeX = 200; original = imresize(original, [imageSizeY image...
function [ fullpaths ] = get_paths( default_folder ) %get_paths Ask the user for the folder containing iamges to analyse folder_name=uigetdir(default_folder,'Choose a folder to process'); % UI prompt if folder_name==0 msg='No folder selected, I quit'; error(msg); return; end y=dir(folder_name); %need to ...
function z = circular_conv(x, y) %debug % x = [5 1 -2 4]; % y = [1 2 3]; %end debug if (length(x)>length(y)) N = length(x); % zero padding to length N else N = length(y); end xpad = [x zeros(1,N-length(x))]; ypad = [y zeros(1,N-length(y))]; z = zeros(1, N); for k=0:(N-1) fo...
function phalgdt(varargin); % phalgdt( [...] ); % Gas Deck T h = timeplot({'Air_T','Gas1T','Gas2T','Gas3T','Gas4T','Gas5T'}, ... 'Gas Deck T', ... 'T', ... {'Air\_T','1','2','3','4','5'}, ... varargin{:} );
function W = STL_MLR(Xtrn, Ytrn, param,opts) no_trn_idx = []; for i = 1: length(Xtrn); if size(Ytrn{i},1) >=1 W(:,i) = regress(Ytrn{i},Xtrn{i}); % W(:,i) = lasso(Xtrn{i},Ytrn{i},'lambda',param); else no_trn_idx = [no_trn_idx,i]; end end tmp = setdiff(1:length(Xtrn...
%% V2 FLD classifier with posterior % variance normalization vnorm = @(x) bsxfun(@rdivide,x,std(x)); % get keys with V1-V2 recordings keys = fetch(StatArea.*StatsSites('exp_date>"2013-08-05"')); % intialize variables [ad, dv, ed, rd, mn, ps,cpV2] = initialize('cell',length(keys),1); parfor ikey = 1:length(keys);d...
function this = power(a, b) % times Overloaded power and mpower for sydney class. % % Backend IRIS function. % No help provided. % -IRIS Macroeconomic Modeling Toolbox. % -Copyright (c) 2007-2017 IRIS Solutions Team. persistent SYDNEY; if isnumeric(SYDNEY) SYDNEY = sydney( ); end %-----------------------------...
function [fx] = fi(in) % x = in(1); y = in(2); % fx = 100*(y-x^2)^2+(1-x)^2; % fx = in(1)^2+in(2)^2+in(1)*in(2)+in(1)*in(3)+in(3)^2; % Beale's function: % y = in(2); % x = in(1); % fx = (1.5-x+x*y)^2+(2.25-x+x*y^2)^2+(2.625-x+x*y^3)^2; %Rosenbrock fx = 0; for i = 1:3 fx = fx + 100*(in(i+1)-in(i)^2)^2 +...
function [] = parseTiles(scanFile, regions, wavelengths, varargin) p = inputParser; p.addRequired('scanFile', '', @ischar); p.addRequired('regions'); p.addRequired('wavelengths', @(x)validateattributes(x,{'numeric'})); p.addParameter('inDir', '', @ischar); p.addParameter('outDir', '', @isc...
function [vx, vy, vz] = mm2vox( hdr, mxyz ) %function [vx, vy, vz] = mm2vox( hdr, [mx,my,mx]) % % convert from mm to voxels using the AVW % header information (including the origin) % in AVW the origin is in voxels % % (c) 2005 Luis Hernandez-Garcia % University of Michigan % report bugs to: hernan@umich.edu % % mx =...
% cellDists.m % finds distance between outline and cell center at each outline pixel % Inputs: % r = row locations of outline % c = column locations of outline % cent = center of cell % % Outputs: % dists = vector of euclidean distances % % Written by Carolyn Pehlke % Laboratory for Optical and Computational Instrument...
b=2; c=1; i=1; A=[0 0 1 0 0; 0 b c 0 0; 1 c 0 c 1; 0 0 c b 0; 0 0 1 0 0]; for L=-2:0.001:2 [r,t]=comput(5,A,L); R(i)=r; T(i)=t; i=i+1 end L=linspace(-2,2,4001); subplot(3,2,1) plot(L,Real,'.'); xlabel('eigenvalue') ylabel('real(Det(M))') subplot(3,2,2) plot(L,Imag,'.'); xlabel('eigenvalue') ...
%{ Copyright (c) 2017 Raghvendra V. Cowlagi. All rights reserved. Copyright notice: ================= No part of this work may be reproduced without the written permission of the copyright holder, except for non-profit and educational purposes under the provisions of Title 17, USC Section 107 of the United States Cop...
%% This script contains a mouving boundary diffusion problem using an analytical solution clear variables; %% INPUT C_0 = 0.3; %initial concentration C_1 = 0.7; %boundary concentration t = 60000*60*60; %time in s dx = 1; %spatial resolution in um l = 1000; %profile length in um D = 1E-4; %diffusion coeffi...
function [TR, TT,p_idx,q_idx, ER, t] = corres_pfh(q,p,varargin) % Perform the Iterative Closest Point algorithm on three dimensional point % clouds. % % [TR, TT] = icp(q,p) returns the rotation matrix TR and translation % vector TT that minimizes the distances from (TR * p + TT) to q. % p is a 3xm matrix and q ...
function [ bestSAD_R, bestSSD_R, w , h ] = Dhuliya_Arjun_Wiki_TM( I,T ) % implementing template matching calculating the SAD, % Wikipedia was refered for the algorithm % https://en.wikipedia.org/wiki/Template_matching % I is search image and T is template image I = im2double(I); %resize image if too big, save tim...
function [y, echoPix] = getMeanROI(handles, mask) %GETMEANROI Beregner middelintensiteten af en ROI. % % INPUT: % handles: handle til elementer i gui % mask: maske for den ROI, som middelintensiteterne skal findes for % % OUTPUT: % y: Middelværdierne for ROIen % echoPix: % - echoPix.Pixels: hv...
function potentialOffspring = Random_Init_M400(angles_num) % $Rev: 690 $ % $Author: maxim $ % $Date: 2014-10-28 07:25:19 +0400 (Tue, 28 Oct 2014) $ potentialOffspring = []; num_sec_str=fix(angles_num/7); k = randi([1,num_sec_str],1,1); l=zeros(1,k); for i=1:(size(l,2)-1) %r=randint(1,1,[1,fix(angles_num/k/2.5)])...
% set up an array for the photons, % x, y, z, mu_x, mu_y, mu_z, weight, received % 0, 0, 0, 0 , 0 , 1 , 1 , 1 - initial values % 1, 2, 3, 4 , 5 , 6 , 7 , 8 - Position % photon(:,1) == X POSITION % photon(:,2) == Y POSITION % photon(:,3) == Z POSITION % photon(:,4) == ux % photon(:,5) == uy % pho...
function [dict, desc] = getFF49Classification() % DO NOT EDIT THIS TEXT % % 1 Agric Agriculture % 0100-0199 Agric production - crops % 0200-0299 Agric production - livestock % 0700-0799 Agricultural services % 0910-0919 Commercial fishing % 2048-2048 Prepared feeds fo...
clear all; close all; clc; TarPath = 'D:\文件夹1\'; [TarFileName,TarFileNum] = TargetFile(TarPath); SrcPath = 'D:\文件夹2\'; [SrcFileName,SrcFileNum] = SourceFile(SrcPath); destination = 'D:\结果'; FileExtraction(TarPath,TarFileName,TarFileNum,SrcFileName,SrcFileNum,destination);
astronaut = load_image('Astronaut.tif'); N = 1024; [spectrum, ~] = complex_image(astronaut, [N N]); imagesc(mag2db(spectrum)); saveas(gcf, "output/impl3_spectrum.png") close(gcf) % generate notch filter mask = ones([N N]); mask(:,476:485) = 0; mask(:,542:549) = 0; % generate band-...
lambdaS = 0.1; medFilterWL = 400; % length of the maj/med filters' windows (400 = 2s) majFilterWL = 2000; % don't forget to change this in the code... threshold = 6/nModules * majFilterWL; % empirically determined tic; fftTorques2('s',1,0.9,lambdaS,[1 2]); % figure 2 / 27650 fftTorques2('u',2,0.9,lambdaS,[3 4]); % ...
%Oppgave 2b nCell={}; for n=1:4; x=input(['Input string with a length of ' num2str(n) ' elements: '],'s'); if length(x)==n & isstrprop(x,'alpha') nCell(end+1)=cellstr(x); else if ~isstrprop(x,'alpha') error('Not a string. Try again'); else while length(x)~=n ...
function [rho_avg_c, C_c]=fn_get_cores_rho_C(X_le, r_ic, T_of_r, R_c, P_c, EOS_generator) C_c = nan(length(X_le), length(r_ic)); rho_avg_c = nan(length(X_le), length(r_ic)); [EOS_params_l, EOS_l, EOS_params_s, EOS_s] = EOS_generator(X_le); for i=1:length(X_le) for j=1:length(r_ic) ...
function [] = Image_Rotation(n,A) Resultant=[]; if n==length(A) for i=1:length(A) %disp(i) for j=1:length(A) %disp(j) x=(n+1)-j; Resultant(i,j)=A(x,i); end end end disp(Resultant) end
T = 300.0; edot = [0.001 0.002 0.02 0.085 1.1 8.5 30 1000]; load AlSigEpsEleiche0001s300F.dat a01 = AlSigEpsEleiche0001s300F; load AlSigEpsEleiche0002s300F.dat a02 = AlSigEpsEleiche0002s300F; load AlSigEpsEleiche002s300F.dat a03 = AlSigEpsEleiche002s300F; load AlSigEpsEleiche0085s300F.dat a04 = AlS...
load MFCCExpTest women=MFCC{4}; clear MFCC; load MFFCTrainingSampled output =DynamicTimeWarp(women(313:end),MFCC);
function [ J ] = Compute_loss( X_input, Ys_batch, convnet ) % [n_lend, N] = size(X_batch); % [n_len, ~] = size(Ys_batch); % d = n_lend / n_len; % % loss = 0; % for i = 1:N % X = reshape(X_batch, [n_len, d]); % X_batch1 = max(MFs{1} * X, 0); % X_batch2 = max(MFs{2} * X_batch1, 0); % S = W * ...
clear; voltage_points_313 = 0:0.01:1.8; %course for the entire voltage range, 10u voltage_points_324 = 0.8:0.001:1.0;%10u voltage_points_fine = 0:0.001:1.8; micro = 0.000001; %mu = 1e-6 pico = micro*micro; %normalised = extract_td_data("H:\FYP\Sigmoid stuff\sigmoidal_time_domain_output3.csv"); x_313 = extract_td_...
function r = tsrms(music0) [data,fs] = audioread(music0); md = mono(data); % 秒 t = 1; %最後の方のデータは切り捨て l = fix(length(md)/(44100*t)); r = zeros(1,l)'; for i = 1:l r(i) = rms(md((i-1)*44100 + 1:i*44100)); end
function [ snpo, err, errmsg ] = snpmodifydc( snpi, dcmat, fresol ) %% spinsertdc: modify existing DC point in S-parameter struct. % If snpi does not contain a DC point, an error will be returned % % input variables: % snpi (struct): SNP struct containing S-parameter without DC point. % dcmat ...
% FIFO % The script devises the simple FIFO schedule for v2x communication % Size of the packets in bits size = 8*[1300, 180, 180, 140, 140]; % Capacity of the channel in kbps C = 20000:5000:120000; % Number of objects created by the sensors per second num_of_objs = [10,10,10,10,10]; % Total number of objects to be s...
function [residual, g1, g2, g3] = NK_GLSV07_iclm_rep_dynamic(y, x, params, steady_state, it_) % % Status : Computes dynamic model for Dynare % % Inputs : % y [#dynamic variables by 1] double vector of endogenous variables in the order stored % in M_.lead_lag_...
%Mx =x has units cSt - centistoke - multiply by fluid density for visc % '1836' : deltattimelaps=120 % '1837' : deltattimelaps=48 % '1847' : deltattimelaps=150 % '1856' : deltattimelaps=120 % '1857' : deltattimelaps=180 clear close all nu=0.5; CurrentDir=pwd(); %visc = Pa.s %delta_gamma = ...
function DoChanFunctions(action,h) if (nargin == 1) h = gcbf; end switch(action) case 'SetCAxProp' set(h,'KeyPressFcn','DoChanFunctions KeyTrap'); %This seems to get overwritten haxc = getappdata(h,'haxc'); axcol = [0.6 0.6 0.6]; set(haxc,'Tag','ClustAxes', ... 'Box','off',... 'XColor',axcol,'YColor',axcol,.....
% --- Loads the rp2, rv8, and pa5s function [RP2,RV8,PA5x1,PA5x2] = load_circuits_gap() % Connects to RP2, RV8, PA5s, loads and runs RV8 circuit % Checks whether the circuits were loaded properly path='C:\Users\user\Documents\Jeff\'; %rp2circ='tdt circuits\RP2_Mixer.rco'; rv8circ='speaker sw...
% CLASSPERF Classification performance. % OUT = CLASSPERF(LPRED,LTRUE) measures distinct classification % performance indices, where LPRED are the predicted labels by the % classifier and LTRUE are the actual labels. OUT is a structure % containing the following indices: Matthews correlation coefficient (MCC), ...
%-------------------------------------------------------------------------- %% Deep Learning Basics : adjustInputImageSize %-------------------------------------------------------------------------- % % This function adjusts the size of the image as required by the input % layer of the CNN % % [in] : imgPath (image pa...
function [AUC, RT] = fnEP_SPAM_L2(X_train, Y_train, X_test, Y_test, options, optL2) % SPAM_L2: Stochastic Proximal AUC Maximization with L2 penalty term %-------------------------------------------------------------------------- % Input: % X_train: the training instances % Y_train: the vector of lab...
function assert_cell_with_strings(x) assert( iscell(x) && (isempty(x) || sum(cellfun(@(y) ~ischar(y), x))==0 ), 'Input must be a cell array of strings.'); end
delta=[zeros(1,7),ones(1,50)]; n=-7:49; y=filter(1,[1 -1.1],delta); stem(n',y);
function G = generalizationError(Xmat, Umat, Zmat, ratio ) % matrix sizes: % Xmat D x N % Umat D x K % Zmat K x N [ D, N ] = size(Xmat); % unique assignment sets Zmat = unique(Zmat','rows')'; N_assSets = size(Zmat, 2); % randomly choose a number of dimensions rperm = randperm(D); myDims = rp...
% Written by Patrick Strassmann % Graphical representation of different potential outcomes on timing % behavior following stimulatin--induced press inhibition stimCondStarts = [50, 950, 1850, 2750, 3650, 7250, 50, 1850, 50, 1850]/100; stimCondDurs = [500, 500, 500, 500, 500, 500, 1400, 1400, 1400, 1400]/100; stimEndTim...