text
stringlengths
8
6.12M
function img=rf_slicer(img) VO=spm_vol(img); img=spm_read_vols(VO); %repair order nslice=size(img,3); %order=reshape(reshape(1:nslice,nslice/2,2)',1,[]) order=reshape([11:20;1:10],1,[]); img=img(:,:,order); %repair dimensions mat=spm_imatrix(VO.mat); mat(9)=10; VO.m...
function QR % {block initial conditions} n = 3; A = rand(n); A1 = A; Q1 = eye (n); % {endblock initial conditions} % {block main} for k = 1:n-1 for i = k+1:n if A(i,k)~=0 d = sqrt (A(k,k)*A(k,k) + A(i,k)*A(i,k)); C = A(k,k)/d; S =...
function [Theta1, Theta2] = nninit(X_train, y_train) [m, n] = size(X_train); input_layer_size = n; hidden_layer_size = round(n*1.25); % 25 hidden units num_labels = 7; % 10 labels, from 1 to 10 fprintf('\nInitializing Neural Network Parameters ...\n') initial_Theta1 = nnrandinitializeweights(input_l...
function[]=MS2_TimeStampAll(Path,File,Name,manual); % BEFORE START DO manual = true %% if manual == true [File,Path] = uigetfile('*.*','select file for name / MAX.tif','/Volumes/JFS/MS2/'); Name = '_3D/' Nickname='m5m8peve Ez'; Rep = 1; end PathToSave = [Path,File,Name,File]; Flip = [0,0] % first...
%ATHELP generates the list of Accelerator Toolbox functions ATROOT = getenv('ATROOT'); disp('Physics Tools'); disp(''); help([ATROOT,'\atphysics']) disp('Lattice Tools'); disp(''); help([ATROOT,'\lattice']) disp('AT Demos'); disp(''); help([ATROOT,'\atdemos'])
torso_width = 111.490833/1000; pelvis_width = 135.213424/1000; pelvis_depth = 207.340833/1000; upper_length = 467.447184/1000; lower_length = 567.470264/1000;
function [inter, valid] = intersectEdgePolygon3d(edge, poly) %INTERSECTEDGEPOLYGON3D Intersection point of a 3D EDGE segment and a 3D polygon. % % INTER = intersectEdgePolygon3d(EDGE, POLY) % Compute coordinates of intersection point between the 3D edge EDGE and % the 3D polygon POLY. EDGE is a 1-by-6 row vector ...
disp("Problem 2") syms f(t, x) f(t, x) = 1 + x/t a = 1; b = 2; x = 1; n = 100; h = (b-a)/n; t = a; disp("n:") disp(n) [ x_out ] = abm(f, t, x, h, n); disp("x:") disp(vpa(x_out)) function [ x ] = abm(f, t, x, h, n) k = 1/6; for i = 1:n fprintf("Step %d\n", i); xd1 = x + (1/2)*h*(3*f(t,x) -...
% Name: Chenying Wang % Email: chenying.wang@usc.edu % USC ID: ****-****-** % Date: Friday, February 14, 2020 function optimalDec = evalEdgeImg(edgeImg, groundTruth, width, height, thrs) edgeImgFile = fopen(edgeImg, 'rb'); edgeImgData = fread(edgeImgFile, inf, 'uint8'); edgeImgData = reshape(edgeImgD...
function ConvertCsvToLibSVM( csvFile ) % example csv file % 1,0,52,0,0,73,66,72 % 1,72,62,69,67,78,82 % % First column labels seperated all by commas % rest columns features SPECTF = csvread(csvFile); % read a csv file labels = SPECTF(:, 1); % labels from the 1st column features = SPECTF(:, 2:end); % features from t...
src = imread('C.tif'); [row, col] = size(src); a = row / 2.0; b = col / 2.0; imshow(uint8(ellipseMask(a, b)) .* src);
function [z,w] = calfunV2 (x,y) w=3.*x+y; z=y-w.^2+x.^0.5;
function result = ex_SaccadeTask_remapping(e) % ex file: ex_saccadeTask % % Uses codes in the 2000s range to indicate stimulus types % 2001 - visually guided saccade % 2002 - memory guided saccade % 2003 - delayed visually guided saccade % % General file for memory and visually guided saccade tasks % % XML RE...
function outlayers=ExtremeFiltration(data,filtration) %outlayers=cell(1,length(data)); %if (strcmp(filtration,none)){} %if strcmp(filtration,'5sigma') % for (chromosome=1 :length(data)) [nrow,ncol]=size(data); chromOutlayers=cell(1,ncol); for tetranucleotide=1:ncol TetraOutlayers1=(find(da...
function [QEanalysis]=A_QE1(Deveq) global CONST a_init; Illum0.type='spectrum'; Illum0.top_or_bottom='top'; Illum0.spectrum='am1.5g'; Illum0.inc_angle=0; wl=linspace(.1,1.1,11); kk=0; for k=-7:3 kk=kk+1; if k == -7 Dev=A_applyOpCond(Deveq,'steady-state','V=',0,'Illum=','dark'...
clear; clc; global linkLengths; %Lengths of links (from body to tip) global body2LegTmat; %From body center to legs (4*4*4) global dhparam; %dh parameters of sigle leg global bodyDim; %Length and width of body global bodyTmat; %From ground to center of body transformation matrix bodyDim...
%% THE 2D AGENT BASE CLASS (agent.m) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Similar to the 'agent' class, this object class is intended provide % support for 2D simulation. The functions provided here % Author: James A. Douthwaite classdef agent_2D < agent %%% AGENT(2D) BASE CLASS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
function [files_in,files_out,opt] = multisite_brick_simu_power(files_in,files_out,opt) % FILES_IN % (string) the name of a mat file with the Y/X variables % % FILES_OUT % (string) the name of a .mat file to store the results % % OPT % (structure) with the following fields: % % RAND_SEED % (vector, default ...
function Hd = IIRgenerate(Fc1,Fc2,Fs) %IIRGENERATE Returns a discrete-time filter object. % MATLAB Code % Generated by MATLAB(R) 9.2 and the DSP System Toolbox 9.4. % Generated on: 20-Dec-2018 09:23:27 % Butterworth Bandpass filter designed using FDESIGN.BANDPASS. % All frequency values are in Hz. %Fs = 48000; % Sa...
%getallmij.m clear; close all; format compact addpath /Users/dkane/Documents/RESEARCH/SAM/picking/ % usedir = 'pickedevents_combinedunderTT'; usedir = 'pickedevents'; % usedir = 'pickedevents_deeper_badtrialmaybe'; % usedir = 'pickedevents_awesomeround1'; % usedir = 'pickedevents_awesome2and3'; % usedir = 'pickedev...
%% ANALYSIS WRAPPER % ==== TRIGGERS ==== % % -- Targets Present -- % Trial start (fixation): lag (1,2,3,4) % Entrainers: 61-68 % Target: 20+lag (21,22,23,24) % Mask: 90+lag (91,92,93,94) % Response screen: 40+lag (41,42,43,44) % Response: 80+lag (81,82,83,84) % % -- Targets Not Present -- % Trial start (fixation): 1...
clear; clc; load('Falmouth2004.mat'); % Choose proper wind speed data from all data set speed=Falmouth2004(51:800,1); speed=speed'; trainx=zeros(494,6); trainy=zeros(494,1); train=speed(1,1:500); for i=1:494 trainy(i)=speed(6+i+4); for j=1:6 trainx(i,j)=speed(i+j-1); end end [b,~,r]=regress(trainy,t...
close all clc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %GirvanNewman load('./DBLP.mat') ; cluster=GirvanNewman(A,4); outfile=fopen('DBLP_GirvanNewman.txt','wt'); for i=1:size(cluster) fprintf(outfile,'%d\n',cluster(i)); %fprintf(outCut,'\n'); end fclose(outfile); load('./football.mat...
function [ result ] = generate_consistent_assignment_likelihood_bypass( likelihood, ia, range, pedigree ) % quick method for simple families, not complete enumeration of all % tranmission patterns n_ind = ceil(sqrt(2*length(likelihood))); n_ind = length(range.family_range); assigned_list = 1:n_ind; % generate glob...
% This is material illustrating the methods from the book % Financial Modelling - Theory, Implementation and Practice with Matlab % source % Wiley Finance Series % ISBN 978-0-470-74489-5 % % Date: 02.05.2012 % % Authors: Joerg Kienitz % Daniel Wetterau % % Please send comments, suggestions, bugs,...
function varargout = get_config_bool(varargin) [varargout{1:max(1,nargout)}] = CoolProp_wrap(415,varargin{:}); end
function[op_indices,inp_index]=get_opindices_forward(sfg,nodenummer); % gets the operation nummer and input index number of % instrs whose input is the nodenummer. Performs delay tunnelling. %nodenummer = 9; %%sfg=sfg_recur; %Code logic is divided into two parts %In the first part nodenummer is searched for in the ou...
function cost = P_discrete(varargin) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Function to generate the discrete proportional model %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Possibility to add in controller constants switch nargin case 0 % I...
%% Draw curve for multi stage figure(100); clf; hold on; set(0,'DefaultAxesFontSize',16); set(0,'DefaultTextFontSize',16); range = 0:0.01:0.5; stages = [8, 4, 2, 1]; legendName = cell(length(stages),1); colors = [228, 26, 28; 55, 126, 184; 245, 170, 27; 128, 128, 22...
function [ threshold ] = estimate_threshold( frame ) %ESTIMATE_THRESHOLD Estimate a threshold for generating blink detection %features. % Detailed explanation goes here eyesDetector = vision.CascadeObjectDetector('EyePairBig'); filtered = imgaussfilt(histeq(rgb2gray(frame))); eyesBB ...
clear clc syms x1 x2 x3 alpha f(x1,x2,x3)=x1^2+2*x2^2+2*x3^2+2*x1*x2+2*x2*x3; k=0; x1=1; x2=1; x3=1; epsilon=0.0001; c=gradient(f); c_value=c(x1,x2,x3); c_length=sqrt(c_value(1)^2+c_value(2)^2+c_value(3)^2); d=-c_value; f_alpha(alpha)=f(x1+d(1)*alpha,x2+d(2)*alpha,x3+d(3)*alpha); df_alpha(alpha)=diff(f_alpha); alpha=so...
classdef opConvolve3D < opSpot %OPCONVOLVE One and two dimensional convolution operator. % % opConvolve(M,N,KERNEL,OFFSET,MODE) creates an operator for one or % two-dimensional convolution, depending on the size of the KERNEL, % and the matrix or vector (MxN) the convolution is applied to. The % convolution i...
function [ transformada, f ] = DFT_delta( signal,N,Fs,delta ) % [ transformada, f ] = DFT( signal,N,Fs,delta ) % DFT_plot realiza la transformada de fourier de signal, se debe % disponer previamente de la matriz base de la trasformada. %% Calculo de la base de la DFT [b R] = base_DFT_delt...
function rgb = dim_gray rgb = [0.41176, 0.41176, 0.41176]; end
classdef Status < double %STATUS % calc_lorenzが計算できたかどうかを表す列挙型 enumeration Failed(0) Incomplete(1) Succeeded(2) end end
% Database Toolbox % Version 3.4 (R2007b) 02-Aug-2007
function [ tree ] = Iris_tree(attrib,P) %P为子集最大样例所占比例,取值应在[0,1]内 tree = struct('value', 'null', 'left', 'null', 'right', 'null'); numberExamples = length(attrib(:,1)); num_class_1=sum(attrib(:,5)==1); num_class_2=sum(attrib(:,5)==2); num_class_3=sum(attrib(:,5)==3); I_parent=-((num_class_1/numberExam...
function [ morphed_im ] = morph_tps( im_source, a1_x, ax_x, ay_x, w_x, a1_y, ax_y, ay_y, w_y, ctr_pts, sz ) % Output image morphed_im = zeros(sz(1), sz(2), 3); %% Prepare x and y arrays for multiplying for all of fx and fy at once % I created an array called index, holding all the indeces to the pixels in % the images...
function transfo = createBasisTransform3d(source, target) %CREATEBASISTRANSFORM3D Compute matrix for transforming a basis into another basis. % % TRANSFO = createBasisTransform3d(SOURCE, TARGET) will create a 4-by-4 % transformation matrix representing the transformation from SOURCE basis % to TARGET basis. ...
close all clear clc %% setting up parameters nEchoes = 512 tE = 150e-6 nrPts = 69 nrBlank = 5 %% setting up directories % dir1= ('C:\Users\bmfortman\Documents\Data\MortarCuring\Brick Dust Experiments');% for the lab computer dir1 = ('C:\Users\benjamin\Documents\Data\Mortar Curing\Brick Dust Experiments')...
function [uout, vout] = rotatein2D(uin, vin, theta) % [uout, vout] = ROTATEIN2D(uin, vin, theta) % % inputs: % - uin % - vin % - theta % % outputs: % - uout % - vout % % % Olavo Badaro Marques, 13/Mar/2017. origsize = size(uin); uin = uin(:); uin = uin'; vin = vin(:); vin = vin'; ...
clear; clc; close; D = 3; [phalanges, dofs] = thumb_parameters(); %% Generate test Rx = @(alpha) [1, 0, 0; 0, cos(alpha), -sin(alpha); 0, sin(alpha), cos(alpha)]; Ry = @(alpha) [cos(alpha), 0, sin(alpha); 0, 1, 0 -sin(alpha), 0, cos(alpha)]; Rz = @(alpha)[cos(alpha), -sin(alpha), 0; sin(alpha), ...
function [signal_mod] = LoRa_Tx(message,Bandwidth,SF,Pt,Fs,df,varargin) % LoRa_Tx emulates a Lora transmission % % in: message payload message % Bandwidth signal bandwidth of LoRa transmisson % SF spreading factor % Pt transmit power in deicbels % Fs ...
% needs to be taken as an input parameter format compact disp('----------------------------------------------------------------------------------------') disp('The following parameters are critical for the') disp('proper representation of your tokamak. Please make sure they have been correctly defined ') disp('BEFORE ...
function [detections Files] = DetectDir(root_dir,img_dir,pffubfmodel_path,facemodel_path,det_pars,draw,verbose) % executes DetectStillImage on a directory with images % Input: % img_dir - relative/absolute path to an directory with images % pffubfmodel_path - relative/absolute path to the pretrained upper body ...
function [Ac] = cofactors(A) % This function computes the co-factors of an n x n matrix % [C]=COFACTORS(A) produces the cofactors C, of the n x n % matrix A % PROGRAMMER: Gordon Nana Kwesi Amoako % kwesiamoako@gmail.com % DATE: Sept 09, 2010 % INPUT: A - n x n matrix % OUTPUT: Ac -n x...
%--------------------------------------------------------------------------- % % days2mdh.m % % this function converts the day of the year, days, to the equivalent month % day, hour, minute and second. % % % inputs: % year - year 1900 .. 2100 % days - julian day of the ...
s = serial('COM1'); set(s,'BaudRate',9600, 'Parity', 'none','FlowControl', 'none','DataBits',8,'StopBits',1,'Terminator','CR'); fopen(s); while(1) %hex2dec('FF')==255; mhex=fscanf(s) try mbin=hexToBinaryVector(mhex) catch mbin=0 end end fclose(s);
task=1; fprintf('Test of syslyap \n'); %a=0.98; %r1=1; a=[-1.5 1;-0.7 0]; r1=eye(2); if task==1, % Check for correctness syslyap(a,r1,1,0) dlyap(a,r1) elseif task==2, % check for speed % for i=1:10, t5; end; tic syslyap(a,r1,1,0); toc tic dlyap(a,r1); toc end
%%%%%%%%%%%%%%%% CLUSTER MEASURES %%%%%%%%%%%%%%%% % Clusters the measures and plots a covariance plot %%%% List of Measures %%%% % 1: area % 2: perimeter % 3: mean radius % 4: minimum distance from centroid % 5: maximum distance from centroid % 6: minorAxisLength % 7: majorAxisLength % ...
function TransitTime_vals = TT_recalculator(PathData, CurrentPath ) %Recalculate VoG values to transit times %test VoG value % PathData.VoG = 5; %value velocity of gas path, unit m/s % PathData.VoS = 350; % value velocity of sound path, unit m % PathData.PL = 0.43; %value pathlenght in unit m, unit m % PathData.angle ...
% TEINTE egalise les niveaux de gris entres les images % % Utilisation: im2 = Teinte(im1,im2,R) % % Arguments: % im1 - la première image % im2 - la deuxième image % R - la zone de recouvrement % % Returns: % im2 apres egalisation des niveaux de gris function im2 = Teinte(im1,im2,R) %fo...
function [ output_args ] = Untitled( input_args ) %UNTITLED Summary of this function goes here % Detailed explanation goes here clc; f=2000; T=1/f; tmin=0; tmax=3*T; dt=T/100; t=(tmin:dt:tmax); x=sin(2*3.14*f*t); plot(t,x); xlabel('time'); ylabel('x(t)'); TITLE('SINE FUNCTION'); dt1=1/10000; dt2=1/300...
% Assume you have been given training data f(i1, i2)g where (0.7, 0.3), (0.4, 0.5) and (0.6, 0.9) % have passed the examination (i.e. have target output 1) and (0.2, 0.2) has failed the examination % (i.e. has target output 0). Train a perceptron on this data using eta = 0.1 and initial weight vector % (Theta, Wi1, Wi2...
% Plotting of differet Discrete time signals %Unit impulse u3 = [zeros(1,10),1,zeros(1,10)]; subplot (2,3,3); stem(n,u3,':r'); title('Unit Impulse'); xlabel('n'); ylabel('u'); %Ramp n = -10:1:10; u1 = [zeros(1,10),0:1:10]; subplot(2,3,1); stem(n,u1,'--g'); title('Ramp'); xlabel('n'); ylabel('u'); ...
function [avg,settling_index] = figure_avg_t( comparison,ansys_data,data,rubber,time,this_sim_name,ansys_sim_name) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here if (comparison) ANSYS_t=transpose(ansys_data(:,1)); ANSYS_T=transpose(ansys_data(:,2)-273); end avg = zeros(size(...
% function A = PartitionFunction(part) % Input : part - partition function data as Q(T),T % Output: A - coefficient A of the fit function Q(T)=A*T^(3/2) function A = PartitionFunction(part) partition = @(A0,x) A0*x.^(3/2); A0 = 1; A = nlinfit(part(:,2), part(:,1), partition, A0);
function obj = linkXML(obj,link) %LINKXML Parsing the XML to the corresponding classes and properties % %---------------------------------------------------------------------- % BSD 3-Clause License % % Copyright (c) 2020, Jonas Wurst, Alberto Flores Fernández % All rights reserved. ...
function dy = FunctionContainer_AfterCombustion(t,y) dy = zeros(1,1); % a column vector T = y(1); dy(1)= dT_dt_AfterCombustion(T); %m, d, T, V, 0, 0 end
% Order the edges/nodes in a given face so that the nodes % form a closed path and are ordered % clockwise if clcws = 1, or % counterclockwise if clcws = 0 % % ------------------- make an oriented local copy of the nodes % ------------------- use a relation Face_Node(:,iface,lvl) function [local_node_list,fl...
%% Model the tectal data with the AF10 data clearvars close all load('paths.mat') addpath(genpath(paths(1).main_path)) cluster_path = paths(1).stage3_path; fig_path = strcat(paths(1).fig_path,'Model\'); data = load_clusters(cluster_path); % define the color scheme color_scheme = [1 0 0;0 1 0;0 0 1;1 0 1]; %% Run th...
function [ Modulated ] = modulatorOFDM(ModulationSymbols,Param) sizeOfFFT = Param.N; numOfCarrier = Param.D; numOfSym = Param.numOfSym; overSampling = Param.OV; cp = Param.CP; CarrierIndexes = Param.CarrierIndexes; % Create the mapped symbols into a matrix nad insert pilots Modulated.dataSerial(:,CarrierIndexes) = re...
function ClearDataSet() global newdataset starttime endtime indFrictionValue ind1PrevFrictionValue formatIn cleareddataset %% Remove datapoint if there is no friction value % Copy newdataset cleareddataset = newdataset; % Get serial date number from start and end date %current = datenum(starttime,formatI...
function [wt,Finv,Ginv,Fvis,Gvis]=fRK44(w,Constant,Periodic,Enforce_Boundaries,Viscous) dx=Constant.dx; dy=Constant.dy; dt=Constant.dt; w2=cell(4,1); w3=w2; w4=w2; wt=w2; Rw1=cell(4,1); Rw2=Rw1; Rw3=Rw1; Rw4=Rw1; w1=w; if(strcmp(Enforce_Boundaries,'yes...
function handles = get_default_values(handles) %GET_DEFAULT_VALUES laden der Default-Werte für Simulationsprogramm % HANDLES = GET_DEFAULT_VALUES(HANDLES) fügt der HANDLES-Struktur des GUI % 'Simulation' alle wichtigen Default-Werte und Definitionen hinzu. Falls % keine anderen Programmeinstellungen (z.B. v...
%function [rval] = gff_matrix_fast(filename,seqname,source,feature_type,strand,len_sig,col_cfs) % % % Open filename for writting % % [fid,error_msg] = fopen(filename,'w'); if fid == -1,error('Error opening %s for reading\n',filename),end for level=1:length(col_cfs(:,1)) cur = 1; non_ones = zeros(length(xd(1,:)),1...
clear; OUTPUT_CNN_NAME='19s_rotation04'; boxsize=160; dim_x=1855; dim_y=1919; name_length=5; name_prefix='image_'; mic_path='19Sdata/mic/'; num_positive1=800; num_negative1=800; positive1_box_path='19Sdata/positive/'; negative1_box_path='19Sdata/negative/'; positive1_mic_start_num=30001; positive1_mic_end_num=30050;...
% PDI - Aula 04/09/2018 % Author: Xie Jiayu % Funções de transformação dos níveis de cinza (gamma usando função imadjust) % e imadjust) % Exerc. 4.5 close all; clear all; clc; img = imread('IF69D_Atividade_04_arquivos/radio.tif'); img = im2double(img); gama = 0.4; low_in = min(min(img)); high_in = max(max(img)); img_...
function pgs(hf) ss2=get(hf,'UserData'); status=ss2(1); status2=ss2(2); ssz=get(0,'ScreenSize'); set(status,'FontUnits','points','FontSize',8*ssz(4)/768); set(status2,'FontUnits','points','FontSize',8*ssz(4)/768); drawnow; printpreview(hf); set(status,'FontUnits','points','FontSize',10*ssz(4)/768); set(...
clc clear all % Find all windows of type figure, which have an empty FileName attribute. allPlots = findall(0, 'Type', 'figure', 'FileName', []); % Close. delete(allPlots); verbose = 5; format long %%%%%%%%%conditions figure_shape = 'ellipse'; dispersion = 'no'; n_points = 150; n_points_ellipse = 100; N_intervals_x ...
%% Generate Results % close all reportType = 1; % 0 == No Report, 1 == HTML, 2 == PDF plotType = 1; % 0 == QuickPlot, 1 == Individual, 2 == Both (Good for testing) [diagnostics, R] = genResults(dataTable, reportType, results, cs, plotType);
function err = naivePerfusionSSEIntegratoranmarP2X4(ton,toff,Ttot,amp,T,I) %#codgen; naive=getNaiveanmarP2X4(); V=-60*10^-3; err=errorIntegratoranmarP2X4(ton,toff,Ttot,amp,naive,T,I,V); end
function [X, z] = gausseanMixtureGenerator(d, c, n) w = rand(c, 1)'; z = categoricalDistribution(w,n); mu0 = zeros(d,1); mu = zeros(d,c); Sigma = zeros(d,d,c); X = zeros(d,n); sigma_1=1;sigma_2=1;rho=0.4; for i = 1:c idx = z==i; Sigma(:,:,i) = [sigma_1*sigma_1 rho*sigma_1*sigma_2; rho*sig...
%% Dialog example A : modal dialog object=SMASH.MUI.Dialog; object.Name='Example A'; object.Hidden=true; % temporarily hide dialog for speed h=addblock(object,'edit','Input something:'); % edit block set(h(2),'String','abc'); % place a default value in the edit box h=addblock(object,'edit','Input something else:',20);...
function nh=rewriteDiseased(nh,stats) nh.R.Contrast(end+1) = stats.R.Contrast(1); nh.R.Correlation(end+1) = stats.R.Correlation(1); nh.R.Energy(end+1) = stats.R.Energy(1); nh.R.Homogeneity(end+1) = stats.R.Homogeneity(1); nh.G.Contrast(end+1) = stats.G.Contrast(1); nh.G.Correlation(end+1) =...
function [] = ReqName_callback(block) % Callback processing function for mask parameter % - number of VF-s used in the Validation Functions Set set_param(block, 'LinkStatus', 'none'); load_system('Simulink'); % Load Simulink library (background) load_system('MIL_Test'); No = str2double(get_param(block,'No'));...
path(path,[cd,filesep,'csv_N2gram']); data=csvread("0_global_file.csv",1,2); fontsz=20; phoneme=readtable("0_global_file.csv"); phoneme=phoneme(:,1); phoneme_list=table2array(phoneme); fct1=data(:,133); % fct2=data(:,12); % fct=[fct1 fct2]; bar(fct1) % set(gca,'xtick',[1:length(phoneme_list)],'xticklabel',phoneme_lis...
clc; clear; %upload the database to the Matlab images = loadMNISTImages('train-images.idx3-ubyte'); labels = loadMNISTLabels('train-labels.idx1-ubyte'); % We are using display_network %display_network(images(:,1:100)); % Show the first 100 images %disp(labels(1:10)); %Given ?,?,n: rate=1;eta=100; errorsRate=0.15; n...
function invS = computeInvS(S) invS = rmfield(S, 'tensor1') ; for i = 1 : S.subNo invS.tensor1{i} = 1 ./ S.tensor1{i} ; end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % File to create training and validation set % % for ShanghaiTech Dataset Part A and B. 10% of % % the training set is set aside for validation % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clc; clear all; seed = 95461354; rng(seed) N = 1; data...
function [ output ] = get_branch(branches,property) not=length(property); newb=branches; c=1; [m,n]=size(branches); for i=1:m if branches(i,n-1)==i newb(c,:)=branches(i,:); c=c+1; end end property=property-1; for i=1:not for j=1:property(i) [m,n]=size(branches); ...
clc; clear all; close all; plotNum = 1; input = imread('cat3_LR.png'); % 讀取題目圖片 subplot(2,4,plotNum);imshow(input);title('Input');plotNum=plotNum+1; [M,N,H] = size(input); input = im2double(input); input_R = input(:,:,1); input_G = input(:,:,2); input_B = input(:,:,3); for hsize = [3,5,7] output = zeros(M,N,3,'do...
function response = TransHistory(varargin) % Get the transfer history % Properties: % fromparameter oblig? description it takes on the values standard value % from No The ID of the transaction to start displaying with numerical 0 % count No The number of tr...
% Calculates the gradient of the function from 1.1 function gradient = Gradient(x1, x2, mu) if x1^2+x2^2 <= 1 gradient(1) = 2*(x1 - 1); gradient(2) = 4*(x2 - 8); else gradient(1) = mu*(4 * x1^3 + x1 *(4 * x2^2 -4)) + 2 * x1 - 2; gradient(2) = mu*(4 * x1^2 * x2 + x2 *(4 * x2^2 -4)) + 4 * x2 - 8; e...
function l = logistic_loss(X,Y,w) %l = mean( log( 1./(1+exp(-Y.*(X*w)) ) ) ); %l = -sum(log((1./(1+exp(-Y.*(X*w)))))); l = sum(log(1 + exp(-Y.*(X*w)))); % l = sum(log(1+exp(X*w)) - Y.*(X*w)); end
% Calderon precondiioner with refined mesh disp(' ') N = size(Ze,1); % Refining the mesh [obj2, trian_ch, trian_pr] = refine_mesh6(obj); obj2 = get_edge(obj2); obj2.N = length(obj2.ln); N2 = obj2.N; %user_plot_geom3d(obj2); %plot_obj_numbers(obj2); % Obtaining RWG as lc of refined RWG lc_mat = linear_comb6(obj, ob...
function z=fisherz(r); % Z=fisherz(R) % % this function performs a fisher Z-transform of vector R and output the % transformed vector Z. This function is used to modify for example % correlations in [-1;+1] into a near gaussian population. It could be used % to transform any uniform population in the interval [-1;+1] ...
function px_gen_path(ip,in,op,on,flag) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Format px_gen_path(ip,in,op,on,flag) % Usegae generate the path of the file or the directories with the % user-specified name. % Input % ip - input path % in - input user-specified % op - output...
function medusaCmd32(nodeid, cmd, args32) % function medusaCmd32(nodeid, cmd, [args32]) % % This is part of the Medusa software suite. % Pascal Stang, Copyright 2006-2012, All rights reserved. % % $LICENSE$ global MEDUSA global sock concmd32(sock, nodeid, cmd, [args32]);
%DEMO_TWOPAREIGS_MP demo nonsingular two-parameter eigenvalue problem % % We solve a random complex two-parameter eigenvalue problem % % A1 x = lambda B1 x + mu C1 x % A2 y = lambda B2 y + mu C2 y, % % with random multiprecision matrices of size n x n (n = 100) using twopareigs % % First option, which is faster and ...
function [X_poly] = polyFeatures(X,p) % Takes data X matrix with n features/columns, then creates polynomial % features of each column to the pth power. % Don't add bias [m,n_old] = size(X); n_new = p*n_old; X_pvec = bsxfun(@power,X(:),1:p); % raise columns to exponents X_poly = reshape(X_pvec,[m,n_new]); % X_poly = ...
clear all ; close all ; subs = {'alex','dina','genevieve','jeremie','karl','russell','valerie','tegan'} ; freqranges = {[48,60],[45,60],[60,80],[50,70],[50,70],[50,70],[56,70],[55,70]} ; lowcomps = {[15,25],[35,30,18],[25,17],[35,20,7],[16,15],[14,33],[25,13,35],[37,14,33]} ; highcomps = {[26,25,21],[44,37],[39,...
classdef UnitSubclassify < matlab.apps.AppBase % UnitSubclassify class/figure. % A GUI for determining cell type subclassifications of spike sorted % units stored as SingleUnit class within a MultipleUnit class % % Merricks, EM. 2019-02-07 % Properties that correspond to app components ...
function [p,w,s] = WeightShapeDecompositionSingleChannel(im,sigma,sz) % im - a single channel image % sigma - given in pixel units % sz - size of filter, in units of sigma % p,w,s - psi, weight and shape % convert sz to pixel units, and make maximum 10 sz = ceil(sz*sigma); sz = max(sz,10); % create filter kernel...
function neuron_I_plot(R, pop_ind, sample_ind, current_type, seg, seg_size) % current_type can be any non-empty subset of % {'I_leak','I_AMPA','I_GABA','I_NMDA','I_GJ','I_ext'} marker = {'r','g','b','y','k','c','m'}; % for 6 different currents % Input check and default values if nargin < 6 seg_size = 4*10^4; % ...
function dump_modi_deva_fids(path, dataset) % addpath('deva/'); load face_p99.mat; model.thresh = -1 * realmax; model.interval = 1; load([path '/' dataset '_data/facemap.mat']); load([path '/' dataset '_data/parts_heat_map.mat']); % if(dataset == 'lfpw') face_list = [812:10...
function [] = update_ellipse( pos, radius, fig_handle) %UNTITLED Summary of this function goes here % Detailed explanation goes here tmp = get(fig_handle, 'children'); %get handle to ellipse delete(tmp(1)); % ellipse should be first entry b = ellipse(radius, radius, 0, pos(1), pos(2)); set(b, 'C...
function [tform,aborted,altered,f] = uifitgeotrans(movingPoints,fixedPoints,transformationType,varargin) %UIFITGEOTRANS Manually pair up points to apply FITGEOTRANS % See FITGEOTRANS help for documentation; inputs/outputs match. % Inputs; brackets indicate name,value optional pair % (additional to that of FITGEOT...
function O = LRbkInts(D) O=double.empty(0,3); %initializing output if length(D)<5 || min(D(:,1))>-3 return else [FO G] = fit(D(:,1),D(:,2),'poly1'); CI = confint(FO); O = [FO.p1 CI(1,1) G.rsquare]; % slope of regression, lower limit on % slope confidence interval; amt variance accounted for end
function dn = forwardprop(dz,j,z,n,param) %NETSUM.FORWARDPROP Propagate derivates from weighted input to net input % Copyright 2012-2015 The MathWorks, Inc. dn = dz; end