text
stringlengths
8
6.12M
clear load('wind.mat') savefile = 'samples_NMG.mat'; T = 108; p = 2; % number of bootstrap samples B = 200; % initial computation [r, h0_cell] = init_comp_NMG(n, theta, phi, x, y, z); beta_all = [0.016283 -0.004629 0.002649 0.011662 2.867271 14.523555 0.270156 0.343079 0.720569 0.830202 0.212515 0.194964]; a1 = be...
function evaluate_all(annotations_folder, output_folder) fprintf('%s\n', output_folder); output_files = dir(output_folder); Fscores = []; categories = []; threshes = [0.5 0.7 0.9]; scores = zeros(length(threshes),1); for j = 1:length(threshes) thresh = threshes(j); for i = 1:length(output_files) fil...
clf; s = get(0, 'ScreenSize'); figure('Units','normalized','Position',[0 0 2 2]) plot (rand (5)); title ('legend ("show") without inputs creates default labels');
%This function actually creates the TCP curve %Andrew Dhawan %9th April 2017 %Takes in the max dose given to the patient, alpha, beta radiosensitivity %parameters, the growth rate following radiotherapy, dose to the patient in %each fraction, the percentage of this dose in the AM (if hyperfractionated %schedule is cons...
%Rewritten program for HPB close; %clear all; clc; disp('IMAGING SIMULATOR by Kees Kroep'); %Initialize and process given values and parameters S_Resolution = 1E-3; %distance between voxels S_Start = [0,0,0]; % the s tartlocation of the sourcespace S_Directions = [32,32,32]; %V_Slices = [1,3,5,7]; % four slices out ...
function [geomData] = geomDataOfCircularHoles(holes) % holes are described by xc, yc and r nHoles = size(holes,1); geomData = zeros(12,4*nHoles); % each hole has 4 segments geomData(1,:) = 1; % circle geomData(6,:) = 0; % holes have domain to the right as we move clock wise geomData(7,:) = 1; xy = zeros(4*nHoles,2);...
function [vmap] = sol(nx,ny,left_b, right_b, bot_b, top_b, d) % -- Inputs % nx = length of region % ny = height of region % left_b = left boundary % right_b = right boundary % bot_b = bottom boundary % top_b = top boundary % -- Ouputs % vmap = potential map g = sparse(nx*ny, nx*ny); % g matrix f = zeros(nx*n...
function out=JacBdotgrad(arg,iota,Nperiods) %Assumes Boozer coordinates gr=grad(arg,Nperiods); out=gr(1)*iota + gr(2);
function fn = normal(mean_, std_, w_) % normal Create function proportional to log of Normal distribution. % % Syntax % ======= % % fn = logdist.normal(mean, stdev, w) % % % Input arguments % ================ % % * `mean_` [ numeric ] - Mean of the normal distribution. % % * `stdev` [ numeric ] - Std...
%% run_figs WD = pwd; nm = select; cd('../../entries/Homo_sapiens'); n = length(nm); for i=1:n cd (['../',nm{i}]) eval(['run_', nm{i}]); end cd(WD)
%{ vis2p.StatsSim (computed) # movie_num : varchar(20) # the number of the movie shown movie_type : varchar(10) # the type of movie shown sim_traces_opt : smallint unsigned # sim_opt : smallint unsigned # --- p_spars : mediumblob ...
function G = ft2(g, delta) % function G = ft2(g, delta) g1 = fftshift(g); g1(isnan(g1))=0; g2 = fft2(g1); g2(isnan(g2))=0; G = fftshift(g2); G(isnan(G))=0; G = G*delta^2; %G = fftshift(fft2(fftshift(g))) * delta^2;
function [MIlast]=MI_last_added(data,col_order) % [MIlast]=MI_last_added(data,col_order) % %calculates the mutual information of the last station in col order with %the combined information in the other stations in col order % input % data : quantized data, N rows (time steps), M columns (variables) % col_order: ...
function A=build_A(FV,P,loc,FF) % A=build_A(FV,P,loc,FF) % Function that evaluates FEM basis function at locations loc % % INPUTS: % FV : Facet-vertex matrix for 2D problem % P : mesh nodes % loc : locations where the functions should be evaluated % FF : Facet-facet matrix for 2D problems % OUTPUTS: % A : Mat...
Data = importdata(fullfile(fIno,f{iV},fstruct(iO).name)); [~,Maps ] = reshapeData([Data.data(:,1:2) ... zeros(length(Data.data(:,1)),1) Data.data(:,4:6)]); Maps.X = Maps.X1; Maps.Y = Maps.Y1; Maps.Z = Maps.Z1; Maps.Ux = Maps.Ux; Maps.Uy = Maps.Uy; Maps.U...
classdef rr_ring < qes.waveform.waveform % resonator readout with ring % Copyright 2017 Yulin Wu, USTC % mail4ywu@gmail.com/mail4ywu@icloud.com methods function obj = rr_ring(length, amplitude, edgeWidth, ringWidth, ringAmplitude) obj.jWaveform = com.qos.waveform.RRRing(length, amplitude, edgeWidt...
function BetaWaveAnalysis() %% Load the data load("Subject1_2D.mat") %% Create Topoplots loc = readlocs('standard-10-5-cap385.elp'); % Extract desired channels: % FP1 FP2 F3 F4 C3 C4 P3 P4 O1 O2 F7 F8 T3 T4 T5 T6 FZ CZ PZ desiredChans = {'Fp1', 'Fp2', 'F3', 'F4', 'C3', 'C4', '...
clc close all addpath ./Track track = Track(3, 2.2, 0.4); %%gear ratio Rp=0.025; %%pulley radius [m] m=0.3; %%mass of car [kg] G=m*9.81; mu=0.3; %% friction coefficient Tms=0.021; Icur=0.65; Tm=(Icur-0.021)*Tms/(1.8-0.021); %%motor load torque [Nm] - from characteristics x=0:0.1:7; slope = track.slope(x); Fn=G....
function [area_mask,area_names] = make_area_mask(fpath,params,save_dir) %Params max_x = params.max_x; min_x = params.min_x; max_y = params.max_y; min_y = params.min_y; um_per_pixel = params.um_per_pixel; size_pixels = params.size_pixels; zoom_largest_FOV = params.zoom_largest_FOV; %Get the file location and names ar...
%% Exploring discriminating image statistics: eyes vs stripes % % % To do % % redo the masks % % separate contour stats % % put stats measures in functions (options struct) % % get the images from the generations % % get the statistics on the images and compute averages % % shuffle the genes and ...
I = rgb2gray(imread('chess.jpg')); BW = edge(I,'canny'); [H,T,R] = hough(BW); P = houghpeaks(H,15,'threshold',ceil(0.3*max(H(:)))); x = T(P(:,2)); y = R(P(:,1)); %H = imadjust(mat2gray(H)) figure1 = figure ax = gca %xlim(ax,[-90,90]) %ylim(ax,[0,700]) hold on imagesc(H) plot(T(P(:,2))+91,R(P(:,1))+975/2,'s',...
function save_historical_data(obj, historical_save_pathname) % 保存historical_data %{ 输入: historical_save_pathname数据的保存路径 cd 或 'F:\myDriversFile\MyDriversMatlab\Mfiles12\optionStraddleTrading' %} if ~exist('historical_save_pathname', 'var') historical_save_pathname = [ pwd, '\historical\' ]; end % create path if is...
function os = iou(boxes, gts) % Given N1 boxes and N2 ground truth boxes, computes IoU (Intersection % over Union) score of each box wrt each ground truth box resulting in % an N1 x N2 score matrix. % % Parameters % ---------- % boxes : N1 x 4 matrix of box coordinates % gts : N2 x 4 m...
function Pats = MakePat(PatSize, PMaker, Pinit) %MakePat.m % e.g. for these values %PatSize = [8 8]; %NumFrames = 10; %PMaker(1).Command = 'ShiftMatrix(Min, 1, ''r'', ''y'')' %PMaker(1).Times = 3; NumSteps = length(PMaker); SumFrames = 0; for j = 1:NumSteps SumFrames = SumFrames + PMaker(j).Times; end SumFrames %...
function gst = FK_func(q1,q2,q3,q4,q5,q6) %FK_FUNC % GST = FK_FUNC(Q1,Q2,Q3,Q4,Q5,Q6) % This function was generated by the Symbolic Math Toolbox version 8.1. % 26-Sep-2018 17:51:45 t2 = cos(q1); t3 = cos(q2); t4 = cos(q3); t5 = sin(q2); t6 = sin(q3); t7 = cos(q4); t8 = sin(q1); t9 = sin(q4); t10 = t2.*t3.*t6...
datcom=readtable('datatable.csv') cn=readtable('cn.csv') ax1=subplot(5,1,1) plot(ax1,cn.Var1,cn.cn_b,'LineWidth',2) hold on plot(ax1,datcom.alpha,datcom.cn_b,'LineWidth',2,'Color','r','LineStyle','--') ylabel(ax1,'C_{n_{\beta}}') hold off leg=legend('estimated value','actual value','Orientation','Horizontal','Position...
%% Stelling 23 % % De else-statement van een if-else-statement wordt % uitgevoerd als de expressie false is. % Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
load('cells.mat'); data = cells; % Graphing Actual Tumor Cell Count global y global tumorPlot y = [0,10,12,14,16,18,20,22]; tumorCnt = 0; tumorPlot(1) = 100000; for k = 1:length(data(1,1,1,:)) for i = 1:length(data(1,1,:,k)) tumorCntInverted = sum(data(:,:,i,k))'; tumorCnt = tumorCnt + sum(tu...
function IRout = altphaseIR3 (IRin, minF, maxF, Fact) %function IRout = altphaseIR3 (IRin, minF, maxF, Fact) % adds noise to phase spectrum of IR within frequency band % argins: % IRin % minF % maxF % Fact (+/- radians to change, ranges from 0 to pi) % % in progress to allow multiple frequency bands i...
clc; clear all; x = input("Enter number: "); factorial(x)
%% DOCUMENTATION % OBJECTIVES % This code is used for extract TDD features based on "action recognition % with trajectory-pooled deep-convolutional descriptors' paper %% DEPENDENCIES % 1. Caffe % 2. ITF project % 3. Dense flow % 4. OpenCV 2.49 % All dependencies located in the same folder with my 'tdd ...
function [pot, force, walltime] = SE3P_Laplace_fourier_space(eval_idx, x, f, opt) % SE3P_LAPLACE_FOURIER_SPACE % Compute Fourier-space part of Ewald sum for 3-periodic electrostatic potential, % using the Spectral Ewald method. % % pot = SE3P_Laplace_fourier_space(eval_idx, x, f, opt) % Return potential % % [pot, for...
function [is_interactive, used_FEs, alpha, errub]=identify_interaction_by_best_worst(fname, func_num, src_group, des_group, lb, ub, lbFit, flag) is_interactive = 0; used_FEs = 0; dim = size(lb, 2); ind2 = lb; ind2(src_group) = ub(src_group); [val2, g2, h2] = feval(fname, ind2, func_num); ind3 = lb;...
%% Virtual Enigma AllChars=['ABCDEFGHIJKLMNOPQRSTUVWXYZ']; numChar=length(AllChars); CipherText=[]; %Use ComposePermutation(A,B) to compose %Database %All of the variables are compressed; When in use, expand using %VAR=[AllChars;VAR] where VAR is the variable to expand for composition %Rotors I=['EKMFLGDQVZNTOWYH...
%% Outflow.m % To create a vector of outlet volumetric flowrates for every flowtest sampling time % (i.e. 10s intervals from time of injection to time of termination) % NOTE: ' => ' indicates where user inputs are required % Requires: % 1. full flowtest sampling time vector - hrs since injection f...
function f = fminGoldStandardRadial(k, P, xy, XYZ, w) %reassemble P % P = [p(1,1:4);p(1,5:8);p(1,9:12)]; % factorize camera matrix in to K, R and t [K R t] = decompose(P); %compute squared geometric error with radial distortion xy_new = P * XYZ; % reprojection (XYZ has been homogeneous representation) xy_new = xy_new...
%% Frequency change of EMF with Velocity Variation %% Calculate Magnetic Field (without v (velocity of RBCs)) clear all clc N_p = 30; % number of particle d_int = 1e-4; % interparticle spacing N = 1; % Number of positive point charge consisting a group / (2.464e-12 / 1.6e-19) dura = 0.0005; interval = 1e-6; graphTy...
% Developed by Arian Shoari. Copyright 2017 John Foxe's Lab, University of Rochester. % Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at % http://www.apache.org/licenses/LICENSE-2.0 % Unless agreed t...
function [fval] = colourfulness(frame) height = size(frame,1); width = size(frame,2); colorfulImg = uint8(randi([0 255],height,width,3)); nbins = 4; ca = rgbhist(colorfulImg, nbins); cb = rgbhist(frame, nbins); ha = reshape(0:length(ca)-1,[length(ca),1]); hb = reshape(0:length(cb)-1,[length(cb),1]); % Features f1 ...
function [ distance_field ] = initialize_distance_field( size, center, margin, value) distance_field = zeros(size); distance_field(center(1)-margin(1):center(1)+margin(1),... center(2)-margin(2):center(2)+margin(2),... center(3)-margin(3):center(3)+margin(3)) = value*2; distance_field = distance_field - value...
l1 = 1; % length of first arm l2 = 1; % length of second arm theta1 = -(3*pi/2):0.1:(3*pi/2); % all possible theta1 values theta2 = -(3*pi/4):0.1:(3*pi/4); % all possible theta2 values [THETA1, THETA2] = meshgrid(theta1, theta2); % generate a grid of theta1 and theta2 values X = l1 * cos(THETA1) + l2 * cos(T...
%adding in flap deflection effects % Initialisation clear close all fclose('all'); addpath('../jsonlab-1.5/'); datapath = '..\data'; master_data = loadjson([datapath filesep 'master_data.json']); subsonic_aero_data = loadjson([datapath filesep 'subsonic_aero_data.json']); %data load('NACA64a_flap_data.mat'); %input...
% Program Analyze an Image and Get color %I = imread('yoo.png'); %imshow(I(:,:,3)) % Extracts the RGB of each pixel in the image %r = I(:,:,1); %g = I(:,:,2); %b = I(:,:,3); %r = reshape(I(:,:,1),1,[]); %There should be away to easilt index throughout the matrix %g = reshape(I(:,:,2),1,[]); %b = reshape(I(:...
classdef IQMixerCalibrator < Measurement % do IQ Mixer calibration % a wrapper that managers the mecessary waveforms and measurement, % uses the Optimizer class internally to do the real work. % Copyright 2016 Yulin Wu, Institute of Physics, Chinese Academy of Sciences % mail4ywu@gmail.com/mail4ywu@icloud...
% Returns the index of a mesh in the Mesh struct function meshIndex = findMesh(meshes,name) meshIndex = 0; for i=1:length(meshes.mesh) if strcmp(meshes.mesh(i).Comment,name) meshIndex = i; end end if meshIndex==0 error('Could not find mesh'); end end
function Jenkin_data = getData(field) %Clear data clc %Load xml_data_descriptor file by OS. xml_data_descriptor = 'data/data-descriptor.xml'; if ispc xml_data_descriptor = 'data\data-descriptor.xml'; end xmlDoc = xmlread(xml_data_descriptor); %Get root element ...
function Q = read_raw_EMP_data(caseNum) for j = 1:5 myString = append('Data/Case ', num2str(j), ' Empirical Data'); addpath(myString); myString = append('Case ', num2str(j), ' Empirical Data/FOV ',num2str(1)); T = readtable(myString); T = table2array(T); myString = append('Case ', num2str(j), ' Empirical Data/FOV ',num...
%% Opdracht 3 % In de onderstaande code staan fouten. Los de foutmelding op. Let op! Bij % het oplossen mag je geen variabelen verwijderen. balVast = logical([1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1]); Pos = [30 31 33 35 38 36 34 32 30 28 26 24 22 22 23 24]; relevantPos = Pos(not(balVast)); naarVoren = diff(relevantPos); [x,i...
%% Prework clear all; clc; load('outlier_tfs_vs_startdosis.mat'); outlier_tfs_vs_startdosis=table2cell(Patients3MbqPatientendaten); %% single ROI watch %% both ROI watch
Het is mogelijk Excel bestanden met Matlab te lezen door de functie xlsread() te gebruiken.
function a = readSPC fid = fopen ('c:\ryohei\matlab\image-bead.sdt', 'r') a.header.spc_revision = fread(fid, 1, 'int16') a.header.info_offset = fread(fid, 1, 'int32') a.header.info_length = fread(fid, 1, 'int16') a.header.setup_offset = fread(fid, 1, 'int32') a.header.setup_length = fread(fid, 1, 'int16') a.header.data...
%-------------------- % Initial Set-up Stuff %-------------------- % Clear the workspace and the screen sca; close all; clearvars; % Setup PTB with some default values PsychDefaultSetup(2); % Set the screen number to the external secondary monitor if there is one % connected screenNumber = max(Screen('Screens')); % ...
function [cartype,plaza,v,vmax,vave]=move_forward(cartype,plaza,v,vmax,Gsafe); [L,W]=size(plaza);% The size of the lane % Compute values to get type of cars: turn left or stay gap=zeros(L,W); for lanes=2:W-1; temp=find(plaza(:,lanes)==1); nn=length(temp);% The number of the cars in the...
function [maxAPnum,InstFR,totFR,maxInstFR,maxtotFR] = firingRateAnalysis(APnum,peakLoc) % This function calculates the instantaneous and total FR of the sweeps. % The inputs it needs are the APnum and the peakLoc % 1) Absolute number of APs during the 1 s stimulation maxAPnum = max(APnum); % sweep with max. APnum swe...
function [ out ] = parse_txt(path, bmp) bmp = 60 / bmp; strs = textread(path, '%s'); n = length(strs); keys = 'C D EF G A B'; out = zeros(0, 3); tot = 0; for i = 1:n str = strs{i}; cur = 1; a = str2double(str(cur)); cur = cur + 1; ch = str(cur); ...
%{ # reference.ProjectUser -> reference.Project -> reference.User %} classdef ProjectUser < dj.Manual end
aframes = Args.NumFrames; % check division of numframes into sub-bins sbinsperframe = framebins/aframes; if(rem(sbinsperframe,1)==0) % we can just do one histogram and reuse the values dafv = diff(afv); binsizes = dafv/sbinsperframe; mat1 = tril(ones(sbinsperframe)); mat2 = [afv...
satdata.epoch = app.Mjd_epoch.Value; %satdata.bulletin_number = ID; %satdata.classification = SC; % almost always 'U' %satdata.revolution_number = rNo; %satdata.ephemeris_type = Etype; ge = 398600.4418; % Earth gravitational constant satdata.xmo = app.MeanN.Value; satdata.xnodeo = app.raad.Value; satdata.omegao = app.o...
N=numnodes(Graph_Roads); J=numnodes(Graph_Inter); L=plot(Graph_Inter,'XData',Graph_Inter.Nodes.XData,'YData',Graph_Inter.Nodes.YData); L.NodeColor='k'; L.EdgeColor='k'; L.LineWidth=2; L.EdgeAlpha=1; L.MarkerSize=4; L.ArrowSize=12; L.NodeLabel={}; L.EdgeLabel=arrayfun(@num2str,1:N,'UniformOutput',0); axis equal Variab...
function [] = define_global_opt() % This function is used to define global variables used in the simulation. global iPO2 idPsi iH_x iATP_x iADP_x iAMP_x iGTP_x iGDP_x iPI_x iNADH_x iQH2_x ... iOAA_x iACCOA_x iCIT_x iICIT_x iAKG_x iSCOA_x iCOASH_x iSUC_x iFUM_x ... iMAL_x iGLU_x iASP_x iK_x iMg_x iCO2tot_...
function sl = slink(l) sl = Link(l); % clone the link if sl.alpha == pi/2 sl.alpha = sym('pi/2'); end if sl.alpha == -pi/2 sl.alpha = sym('-pi/2'); end if sl.alpha == pi sl.alpha = sym('pi'); end if sl.alpha == -pi sl.alpha = sym('-pi'); ...
r = 1; g = 2; b = 3; %Swap the red and blue pixels of image 1 img = imread('input/4.1.05.png'); tmp = img(:,:,r); img(:,:,r) = img(:,:,b); img(:,:,b) = tmp; imwrite(img,'output/ps0-2-a-1.png'); %Create a monochrome image (img1_green) by selecting the green channel of image 1 img1 = imread('input/4.1.05.png'); img_...
% ************************************************************ % % dijkstra.m % % The program computes the shortest path in a network % using Dijkstra's algorithm. % % The example and the Algorithm is taken from % Worboys, M. F., and M. Duckham, 2004. % GIS: A Computing Perspective, 2nd edition. T...
function line = getLine(p1,p2) if p1(1) == p2(1) % if it is a vertical line line = [NaN p1(1)]; % line(2) is x cross line else line = polyfit([p1(1) p2(1)],[p1(2) p2(2)],1); end
%% fn_imdistline %% Syntax % fn_imdistline %% Description % enhanced version of Malab IMDISTLINE %% Source % Copyright 2005-2012 The MathWorks, Inc. % % Copyright 2009-2012 Thomas Deneux %
function MultiMotorVisuals(hfig,betas,cIX_in,gIX_in) %% get coefficients from multiple linear regression % cIX_in = getappdata(hfig,'cIX'); % gIX_in = getappdata(hfig,'gIX_betas'); % betas = getappdata(hfig,'betas'); stimcorr = max(betas(:,1:end-3),[],2); motorcorr = max(betas(:,end-2:end),[],2); % figure;scatter(stimc...
function pattern_array = split_pattern( pattern, cuts, type ) %pattern_array = split_pattern( pattern, cuts, type ) % Function that takes a temporal pattern and splits it into a cell array % of patterns according to a given temporal segmentation % Inputs: % pattern -- A movie or a feature representation of f...
function WriteStarFileStruct(s,dataName,fileName,activeFlags) % function WriteStarFileStruct(s,dataName,fileName,activeFlags) % function WriteStarFileStruct(s,FID) % Write a STAR file from the fields of the struct s. These fields are % assumed to be numeric or cell arrays (of strings). The arrays must all % have the ...
clear all; addpath 'MATLAB' cd .. classes = cell(1,2);classes{1}='Happy';classes{2}='Sad'; for i=1:numel(classes) extractorForClass(classes{i}); end extractorForClass('Test');
x=0:.05:6; f = x.^3-6*x.^2+9*x-4; k=1; dz=10; z=6; r(k)=z; while abs(dz) >.1 Df= z^3-6*z^2+9*z -4; s(k)=Df; r(k)=z; J = 3*z^2-12*z+9; dz=-Df/J; z=z+dz; k=k+2; r(k-1)=z; s(k-1)=0; r(k)=z; s(k)=Df; end h=zeros(1,length(x)); plot(x,f,'-', x,h,'-', r,s,'-'),grid xlabel('x') text(3.0, 30,'f(x) = x^3-6x...
%% General dispersion relation maker proof of concept function CmprEigIsoDispVsGeneral CurrentDir = pwd; addpath( genpath( CurrentDir) ); Interactions = 1; Diffusion = 1; AnisoDiff = 1; SparseMat = 0; SaveMe = 0; ModeX = 0; ModeY = 1; vD = 100; bcE = 1.6; % Equilbirum bc bcP = 1.6; % Per...
% Parameter: lcavol lweight age lbph svi lcp gleason pgg45 lpsa train (F/T) function linreg % ======= % TASK 1 % ======= tra = dlmread('prostate-tra.mat', ' '); tes = dlmread('prostate-tes.mat', ' '); % Convenience traIn = tra(:,1:end-1); tesIn = tes(:,1:end-1); traOut = tra(:, end); tesOut = te...
% Calculate human links function [l1, l2] = cal_human_links(filename) % read file total_output = viz_convert_adulthuman(filename); ini_head = total_output.Head(1,:); ini_torso = total_output.Torso(1,:); ini_neck = total_output.Neck(1,:); ini_RShoulder = total_output.RShoulder(1,:); ini_RElbo...
clear; noise = load('../matnoise/eikonal_avg.mat'); xnode = noise.xnode; ynode = noise.ynode; selectperiods = 3:14 pnum = 0; for ip = fliplr(selectperiods) pnum = pnum+1; tomo(pnum).phV = noise.avgtomo(ip).GV; tomo(pnum).period = noise.periods(ip); tomo(pnum).avgphV = nanmean(tomo(pnum).phV(:)); tomo(pnum).nois...
function out = Function1(x) result1=0; result2=0; for i=1:5 result1 = result1 + i* (cosd( (i+1)*x(1) + 1)); end; for j=1:5 result2 = result2 + j* (cosd((j+1)*x(2) + 1)); end; out = -result1 * result2; end
%description: % find the best scale for each edge pixels (based on linderberg approach) %param: % edge_norm = normalized gradient norm scale space % deepness = deepness of the scale space %result: % best_scale_nb = image that store for each pixel its best scale number function best_scale_nb = best_scale...
%%%%% FIX METADATA by adding metadata that I really wish was there %%%%%%%% %% Stuff that I keep recomputing that I really ought to save imNumsDataset = 70:225; load(fullfile(rootpath, 'code/visualization/stimuliNames.mat'), 'stimuliNames') catToUse = {'pattern_space', 'pattern_central', 'grating_ori', ... ...
clear f0 =128 %Hz fe =100 %Hz T = 0.125 %s A = 5 Te = 1/fe N = round(T / Te) t = (0:1:N-1)*Te %vecteur de temps associé xt = A*cos(2*pi*f0*t) %Nfft = 2^nextpow2(length(xt)) Nfft = 10*N spectre = fft(xt, Nfft)/N spectre_ampl = abs(spectre) sectre_phase = angle(spectre) spectre_C = fftshift(spectre_ampl) subplot(...
clear a b c for si=1:10 a(si)=(cs1{si}(2).out.tpr.sav(end,51)+(1-cs1{si}(2).out.fpr.sav(end,51)))/2; b(si)=(cs2{si}(2).out.tpr.sav(end,51)+(1-cs2{si}(2).out.fpr.sav(end,51)))/2; c(si)=(cs3{si}(2).out.tpr.sav(end,51)+(1-cs3{si}(2).out.fpr.sav(end,51)))/2; a(end+1)=mean(a); b(end+1)=mean(b); ...
function y = QU1(x,b) xmax = max(x(:)); xmin = min(x(:)); bit = b; % Numero di bit N = 2^bit; % Livelli di restituzione delta = (xmax-xmin)/N; % Passo di quantizzazione y = delta.*(round(x./delta)); end
function [J] = costFun(X,y,w) % this function computes the cost given the parameters, input and output % varaibles N = size(X,1); % number of data points error_sq = []; % to caculate cost for i = 1:N error_sq = [error_sq ((w'*X(i,:)' - y(i,:))^2)]; % to caculate cos end error_sq = sum(error_sq); J = error_sq/(2*...
function P = clickStim(P, varargin); % clickStim - compute click stimulus % P = clickStim(P) computes the waveforms of click stimulus % The carrier frequencies are given by P.Fcar [Hz], which is a column % vector (mono) or Nx2 vector (stereo). The remaining parameters are % taken from the parameter struct P ret...
% % irpPixelToRay generates 3d vectors from 2d pixel coordinates. % % Usage: % x_r = irpPixelToRay(x,y,f,s,cc) % % return value: % x_r: 1 x 3 vector with length 1 pointing in direction of the pixel ray % % Variables: % - x: x position in image coordinates % - y: y position in image coordinates % - f: focal le...
clear all; close all; A =csvread("1541HelixZPos.csv"); %A =csvread("1540Helix.csv"); S = A(:,3); x0=A(1,1) y0=A(1,2) z0=A(1,3) X= A(:,1)'; Y= A(:,2)'; Z= A(:,3)'; %Initial Condition %Initial Guess Rperp=22; %Radius Rparl=-10; %Pitch %Produced by Hough Transform (Central Point) xp=-54; ...
function results = phase_diagram_absolute(model, I, alpha_lower, alpha_upper, beta_lower, beta_upper, nalphas, nbetas, plot_time_series, runtime) %% set up simulation and rate constants if nargin == 0 model = 'curr_model'; I = 1; alpha_lower = 0.1; alpha_upper = 10; beta_lower = 0.1; beta_upper ...
clear all MOTE = [{'0xc6'} {'0xbb'} {'0x5e'}]; MOTE = [{'0x15'}]; rootDir = './'; Channel = [1]; Collection = 2; for Collection = 17:17 for k= 1:length(MOTE) for j = 1:length(Channel) [float_data,sampleRecord] = openRawSampleRecord(sprintf('%sMote_%s_Channel_%d_Collection_%d', rootDir, ...
function [hrastfig,hrastaxes] = makerasterfig(position,... xvals,... yvals,... xtext,... ytext,... xoffset,... yoffset,... numreps,... tot_dur,... stim_dur,... startcount,... endcount,... row_space,... col_space) background = 'black'; foreground = 'blue'; textcol...
function VM = oneStepControl2(Tsample,DCMd,DCMc,wb_i,ww_b,Iw_b,sumMOI,Text,Kt,Ke,R,Tb_w1,Tb_w2,Tb_w3,projYZ,projZX,projXY,kxw,kyw,kzw) %UNTITLED Summary of this function goes here % Detailed explanation goes here %desired DCM in body coordinates, also known as the error between the %current orientation and the des...
function L = getRBFLaplacian(fea, opt) % Given feature vector data fea of size n*m, compute: % W: the affinity matrix using Radial Basis Kernel % L: the normalized Laplacian matrix of W defaults.s = -1; defaults.reg = -1; defaults.normalize = 1; if ~exist('opt','var') || isempty(opt) opt = struct(); end opt = mer...
function moviegogcf(src,eventdata,func_data,func_hdr,fmin,args,myfig,myRange,x,y,z,roi,doAVI,hSlider,hTxt) % moviegogcf.m - ortho code, executed when Play button pressed. % Author - Krisanne Litinas % $Id: moviegogcf.m 740 2013-07-31 14:13:15Z klitinas $ %for count=1:size(func_data,1) locSlider = get(hSlider,'Value')...
%read in images %I and I2 were taken by me I = imread("myimg1.jpg"); I2 = imread("myimg2.jpg"); I3 = imread("snow1.jpg"); I4 = imread("venice1.jpg"); %convert images to double Idouble = im2double(I); I2double = im2double(I2); I3double = im2double(I3); I4double = im2double(I4); %apply img2 function to images. function...
% open log file for deblocking for the time points of deblocking in a % format: t1_start t1_end % t2_start t2_end % ... load('log_deblock.mat'); log_deblock = segments; % sampling frequency is: sr = 20000; % list files to be deblocked: list = dir; % load each file and deblock i...
function d = resample(d,varargin) % resample eye position signal(s) using cubic interpolation % % available options are: % % fs - desired sample rate (default: 1kHz) % order - optional median (pre-)filter order % (default: 1, no median filtering) % debug - show debugging output (default: fals...
% AutoCorr: compute auto-correlations for spike-train data % [tac,indx] = AutoCorr(t,tmax): % "t" is the time of the spikes % "tmax" is the maximum absolute time difference to consider % "tac" contains all time differences less (in abs value) than tmax, % "indx" contains the indices that contribute to the sampl...
function [X_norm, mu, sigma] = featureNormalize(X) %FEATURENORMALIZE Normalizes the features in X % FEATURENORMALIZE(X) returns a normalized version of X where % the mean value of each feature is 0 and the standard deviation % is 1. This is often a good preprocessing step to do when % working with learning alg...
function [ mean_amplitude_diff, std_amplitude_diff, amplitudes_diff ] = pp_samplitude_diff( scanpath1,scanpath2, ff_flags ) if nargin<3, firstfixation_flag_default; end [~,~,amplitudes1]=pp_samplitude(scanpath1,ff_flags(1)); [~,~,amplitudes2]=pp_samplitude(scanpath2,ff_flags(2)); if leng...
% runs the entire learning loop with various models. Displays % results too -- good for comparing with Python implementaiton % addpath starter % uhh - I removed the starter folder, so I don't know what % dependencies that will break. % M = load('/shared/users/dstrauss/ant_net/multiArm/local1.mat'); if matlabpool('s...
% drug_svm takes: % master_file_struct % drug_selection (either SCH23390 or SKF81297, currently) % current: for that drug selection (usually either 20 or 50) % straps: the number of crossvalidation iterations to run % It will create one large matrix of trials from cells which were exposed % to the chosen drug at the c...
function [W, b] = learningRule(W, b, P, t) % The function learningRule implements the perceptron learning % rule by iterating through the input matrix, P, using the % perceptron function and comparing it against the target % values present in the target vector, t. The error is calculated % and then used t...
function [L1,L2,L3,P_plus,P_minus] = WellboreKernels(well_mesh,sig_pp,sig_pm,... sig_mp,sig_mm,Cl,q,Kc,area_ann,rho0,p0,p_atm,u,v,q1,q2,choke_position_ss,epsilon) well_mesh = well_mesh(2:end-1); dx = diff(well_mesh); dx = [dx,dx(end)]; dxi = diff(well_mesh); dxi = [dxi,dxi(end)]; n = length(well_mesh); P_uv = n...