text
stringlengths
8
6.12M
// code snippet // Appledoc code snippet // // IDECodeSnippetCompletionPrefix: code // IDECodeSnippetCompletionScopes: [StringOrComment] // IDECodeSnippetIdentifier: 7A79A727-BE3B-4399-B9B1-FF1CC26741DC // IDECodeSnippetLanguage: Xcode.SourceCodeLanguage.Objective-C-Plus-Plus // IDECodeSnippetUserSnippet: 1 // IDECodeS...
function imgSeg = kmeansCluster(img,blockSize, nOL,tVote) [ballotBox1,ballotBox2] = vote(img,blockSize,nOL); imgSeg1 = false(size(ballotBox1)); imgSeg2 = imgSeg1; imgSeg1(ballotBox1 >= tVote * nOL^2) = 1; imgSeg2(ballotBox2 >= tVote * nOL^2) = 1; imgSeg = imgSeg1&imgSeg2; end
clear; T = 147; for i=4:4 K = i * T; s = 0; for j=1:50 %循环20次取均值 s0 = BP_no_noise(K); s = s+s0; end s = s/50; %fprintf('i = %d , s = %d \n',i,s) fid = fopen('tim_p01.xls','a'); fprintf(fid,'%d \t',s); fprintf(fid,'\r\n'); fclose(fid); end
function SimpleSpeechRecognition(filename) fs = 22000; % Sampling Frequency [x,fs]=audioread('e2.wav'); voice=cov(x); [y0,fs]=audioread('o1.wav'); %reference [y1,fs]=audioread('red1.wav'); [y2,fs]=audioread('green1.wav'); [y3,fs]=audioread('blue1.wav'); ref=cov(y0); delta0 = abs(ref - voice); sel = 'noise'; ...
function plotX(x, param) figure; for j = 1:5:size(x, 2) % clf i = 3; prevX = x((1:3) + (i-1)*3, j); for i= 4:6%1:param.NF currX = x((1:3) + (i-1)*3, j); hold on if mod(i, 2) scatter3(currX(1), currX(2), currX(3), 'o') ...
%% Set up image size parameters screenres = 800; % native resolution that we construct at (pixels) screenfov = 12; % height of screen (deg) cpd = 3; % target cycles per degree maskFrac = 0.95; % what fraction of radius for the circular mask ...
function[a] = Perceptron_training(x_75_by_type_and_classes,k_max) a = cell(size(x_75_by_type_and_classes,1), size(x_75_by_type_and_classes,2) ); for i = 1:size(x_75_by_type_and_classes,1) for j = 1:size(x_75_by_type_and_classes,2) data_positive = x_75_by_type_and_classes{i,j}; ...
function g = mrf_grad_log_student_prior(T, sigma, alpha) [m,n] = size(T); a = (1/sigma^2) * (T(1:m-1,:) - T(2:m,:)); b = 1 + (1/ (2 * sigma^2)) * (T(1:m-1,:) - T(2:m,:)).^2; H1 = -alpha * a ./ b; H2 = -H1; a = (1/sigma^2) * (T(:,1:n-1) - T(:,2:n)); b = 1 + (1/ (2 * sigma^2)) * (T(:,1:n-1) - T(:,2:n)).^2; V1 = -alpha ...
function [traces, out, traceOpt] = R2G_ratio(traces,fps,traceOpt) traces = traces(:,:,2)./traces(:,:,1); if isfield(traceOpt,'highPass') if traceOpt.highPass>0 k = hamming(round(fps/traceOpt.highPass)*2+1); k = k/sum(k); % make sure everything is positive traces = traces + abs(min(...
function batmodelControl(action) if nargin==0 batmodelFig; %set everything normalized h=findobj('type','uicontrol'); set([h],'units','normalized') %_______set the figure size and location screensize=get(0,'screensize'); %this should be in pixels(the default) figsize=[(screensize(3)-504...
%求上架时间与故障率的关系. %根据上架时间(已服役时间)对所有故障机分类,求出每个月上架的机器的在上架之后每个月的故障率. %输入:故障单,故障机,总机,硬盘统计,故障单目录,总机目录,计算几次故障 %输出:retall是所有故障的上架时间与故障率关系,每一行第一个元素代表这一行表示的是第i个月前上架的机器 %retset是分第i次故障的,从上到分是第i次故障的数据.最后一列是所有故障的. function [retall retset]=reg_frate(raw_f,raw_t,raw_a,num_dc,itm_f,itm_a,f_count) tic; disp('reg_frate processing.....
function [Orec, Crec] = ss_get_OC(sys, varargin) %SS_GET_OC Get observability and controlability matrix of LTI SS system % Detailed explanation goes here if(~isempty(varargin)) ip = varargin{1}; else if(isempty(sys.e)||(rank(sys.e,1e-6)==size(sys.a,1))) ip = 'p'; else ip = 'i'; end en...
function playFlyMovie(flyTracks, startTime) if nargin < 2, startTime = 0; end for k = 1:flyTracks.nFlies for i = 1:size(flyTracks.centroid,1) r = flyTracks.majorAxisLength(i,k)/2; x = r* cos(flyTracks.orientation(i,k)*(pi/180)); y = r* sin(flyTracks.orientation(i,k)*(pi/1...
% Reconstruction process main script % Settings showPlots = true; alphabet = 3; numSim = 500; % Data File % data_file = 'Data/IBM.csv'; % data_file = 'Data/FB.csv'; data_file = 'Data/GOOG.csv'; % Open the file [ T0, P0, ~ ] = getPricesFromFile(data_file); % Detred the data with a given polynomial degree poly = 3; [...
close all x1all = load('class_1','-ascii'); x2all = load('class_2','-ascii'); x3all = load('class_3','-ascii'); %g = W*x + w_0; %W := [W w_0] (4x4) W = zeros(3,5); %initializing weight matrix as zeroes %inserting one column of ones for the offset, and one column with the %target class x1all = [x1all ones(50,1) ones...
% Accuracy % Change default axes fonts. set(0,'DefaultAxesFontName', 'Times New Roman') set(0,'DefaultAxesFontSize', 14) % Change default text fonts. set(0,'DefaultTextFontname', 'Times New Roman') set(0,'DefaultTextFontSize', 14) set(0,'defaultlinelinewidth', 1); set(gcf, 'PaperUnits', 'centimeters'); %...
function Rrh = restriction(rh, nh) Rrh = zeros( (nh + 1)/2, (nh + 1)/2); dim = size(Rrh); for i = 1:dim(1); for j = 1:dim(2); Rrh(i, j) = rh(2 * i-1, 2 * j -1 ); end; end; end
pres_inp = [0.00689476, 0.01723689, 0.0344738, 0.05171068, 0.0689476, ... 0.137895, 0.344738, 1.37895]; % pressure in bar pres_table = pres_inp*1e5; % onvert to Pascal m = length(pres_table); % matrix of zeros to store result H_f_table = zeros(m); % Enthalpy of sat water H_v_table = zeros(m); % En...
clc clear all % in a 10x10x10 cube start = [1,5,0,0,9,5,0,0]; goal = [9,5,0,0,1,5,0,0]; radius = .2; state_limits = ... [0,10; 0,10; -1,1; -1,1]; state_limits = [state_limits;state_limits]; sampling_limits = state_limits; input_limits = ... [ -1,1; -1,1]; input_limits = [input_limits;inpu...
function [KK0,KKg] = fGKBeamStraight(s_span,EIx,EIy,EIz,PhiK,bOrth,PhiV,m,Mtop,gravity,xLumped,MLumped,bStiffeningMtop,bStiffeningSelfWeight) % % OUTPUTS % KK0: Stiffness matrix without geometrical stiffening % KKg: Geometrical stiffeness matrix. % The total stiffness matrix should then be KK0+KKg % --- Option...
function Hd = FIR_Kaiser2(N,Fs,Fc1,Fc2,flag,Beta) %FIR KAISER 2 Returns a discrete-time filter object. % MATLAB Code % Generated by MATLAB(R) 9.8 and Signal Processing Toolbox 8.4. % Generated on: 18-Jul-2020 19:42:56 % FIR Window Bandpass filter designed using the FIR1 function. %{ % All ...
%conv 사용하기 % 1 1 % G = ----- U = - % s + 1 s numG = [1]; denG = [1 1]; G = tf(numG, denG); G numR = [1]; denR = [1 0]; U = tf(numR, denR); U G*U num = conv([1], [1]); den = conv([1, 1], [1, 0]); GU = tf(num, den); GU
function copySession(source,destination) % % Copyright 2017 Yulin Wu, University of Science and Technology of China % mail4ywu@gmail.com/mail4ywu@icloud.com if ~isvarname(destination) throw(MException('QOS:copySession:invalidDestinationName',... sprintf('invalid destination name: %s', destinatio...
clear all %% Create variant maps in X minute increments with odd numbered sessions for test split-half using combined task data % % This script requires CIFTI timeseries that have been converted to the % surface (numvertices x timepoints), temporal masks for "high-quality" % data points (timepoints x 1 binarized file...
% use online method to find best patch residents time in random order close all; clear all; more off; SUM_COL = 3; %PATCH = [50 100 200 300]; %PATCH = [300 200 100 50]; PATCH = [50 300 100 200]; PN = 4; TAU = [10 50 100 500 1000 5000 10000 50000 100000 500000]; TN = 10; TAUFILT = 0.001; G = zeros(100*PN, TN); T...
% returns equivalence conditions corresponding to Spekkens' parity % oblivious constraints from Phys. Rev. Lett. 102, 010401 (2009) function [oblivious,A] = parityConSpekkens(AS,n,d) %------------------------------------------------------------------------------- % convert alice's setting to n,dits. A = zeros(AS,n); fo...
num = 232; back_ground = imread('close/1.JPG'); back_ground_gray = rgb2gray(back_ground); for i = 1:num file = '/'; outfile = 'close_gray/'; number = num2str(i); fmt = '.JPG'; file_name = strcat(file, number); file_name = strcat(file_name, fmt); out_file_name = strcat(outfile, numbe...
clc clear all close all n = 210; N_run = 100; errors = zeros(n,3); errALL = zeros(n,N_run); for ex = 1:1 load(['signals4/signal_' num2str(ex)]) % k = 10+ex; k = 21+ex; for m = 5:n err = 0; for r = 1:N_run % % Create dictionary by deleting rows ...
function [] = w_csv(cell_in, csv_path) fid=fopen(csv_path,'wt'); [rows,cols]=size(cell_in); for i=1:rows fprintf(fid,'%s,',cell_in{i,1:end-1}); fprintf(fid,'%s\n',cell_in{i,end}); end fclose(fid); end
% This function Simulates the swing equation of a one-machine system % and returns the critical clearing time for stability. % % Copyrigth (C) 1998 H. Saadat % function cctime(Pm, E, V, X1, X2, X3, H, f) Pe1max = E*V/X1; Pe2max=E*V/X2; Pe3max=E*V/X3; d0 =asin(Pm/Pe1max); dmax = pi-asin(Pm/Pe3max); cosdc = (P...
function initialize %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Initialize the HRP file pulldown % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% global HANDLES REMORA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %HRP file operations REMORA.hrpmenu = uimenu(HANDLES.remmenu,'Label','HRP File'); %...
clear clc folder_sor_name = '/home/byx/openface-master/test_acc/db/alignedtrain/'; dir_sor_Output=dir(folder_sor_name); Sor_fileNames={dir_sor_Output.name}'; n = length(Sor_fileNames); for i=1:n if strcmp(Sor_fileNames{i},'.') || strcmp(Sor_fileNames{i},'..') continue end med_...
classdef RF %RF Summary of this class goes here % Detailed explanation goes here properties ref_ann tc n_vert res n_pixels uv uv_vec mask1 n_face_pixels1 mask2 n_face_pixels2 parts n_parts end methods ...
function varargout = spc_main(varargin) % SPC_MAIN Application M-file for spc_main.fig % FIG = SPC_MAIN launch spc_main GUI. % SPC_MAIN('callback_name', ...) invoke the named callback. % Last Modified by GUIDE v2.5 28-Jan-2015 12:02:52 global gui; global spc; if nargin == 0 % LAUNCH GUI fig = openfig(mfilena...
% We are implementing a multiple object motion tracking system that % MathWorks developed. Our initial/personal implmentation can be found in % Tests/videoRendering % Using Kalman Filter and Motion Based tracking to determine and track % vehicles %function runs video detection with the assitance of mini helper functi...
classdef UgmGaussJointGaussInfEng < JointGaussInfEng %UGMGAUSSJOINTGAUSSINFENG properties model; end methods function eng = UgmGaussJointGaussInfEng(varargin) % end function computeLogPdf(eng,varargin) % notYetImplemented('UgmGaussJointGaussInfEng.computeLogPdf()'); end function comp...
function [txt] = anova1_multcomp_auto(x,g) [text,T,p,s,t,ST] = anova1_autoresults(x,g); [tt,gnames] = multcompare_convt22016v(s); result = multcompare_text2016b(tt); %% txt = sprintf('%s\n%s',text,result);
A = @(L_0) [0, 1, 0, 0; 0, -1/param.T_K, 0, 0; 0, 0, 0, 1; 0, 1/(param.T_K*L_0), -9.81/L_0, 0]; B = @(L_0) [0; param.eta_K; 0; -param.eta_K/param.L_0]; C = [param.k_AWG_K, 0,0 ,0; 0, 0, 360/(2*pi), 0]; % L_0 = 0.5m A_05 = A(0.5); B_05 = B(...
clear all clc close all; % Load a sample 3-D RGB image rgb = imread('Lenna.png'); imshow(rgb) hold on M = size(rgb,1); N = size(rgb,2); %Vector of coordinate point of the mesh points=[]; index=1; lx=round(M/10); ly=round(N/10); % i is is along x axis % j is along y axis for i=1:lx:M for j=1:ly:N points(ind...
% n = 0; % jointInd = [1, 2, 4]; % % aux.initJointAngles(2, :) = zeros(1, aux.numJoints); % % f1 = fopen('j3drand.csv', 'w'); % f2 = fopen('j3drand-spatial.csv', 'w'); load matlab/trans.mat pt = [0, 0, 0, 1]'; ang = -0.25; s0 = [cos(ang), 0, sin(ang), 0;... 0, 1, 0, 0;... -sin(ang),0, cos...
function [xtrain,xtest]=getdata(Ntrain,Ntest,noise) %function [xtrain,xtest]=getdata(Ntrain,Ntest,noise) % % Creates 2D data with 3 clusters of width noise % % (c) Lars Kai Hansenn % x11=0.75+noise*randn(round(round(Ntrain/3)),1); x12=0.25+noise*randn(round(round(Ntrain/3)),1); x13=0.5+noise*randn(round(round(Ntrain/3...
function [PC_back,cycle_back]=JMPACCDPTR(PC,cycle,intmem) DPL=intmem(131,1);%DPTR low DPH=intmem(132,1);%DPTR high DPTR=DPH*(2^8)+DPL;%DPTR ACC=intmem(225,1);%ACC PC_back=ACC+DPTR+1; %cycle count cycle_back=cycle+3; end
classdef AdvAbstractVarFlow2d < NdgPhysMat properties %> Number of physical field Nfield = 3 %> Number of variable field Nvar = 1 %> field index of variable field varFieldIndex = 1 outputFieldOrder = 1 end methods function ob...
function N = Newgeneration_with_natural_selection( Old_generation , Num_matings , Natural_selection_advantage ); N = []; for k = 1:Num_matings F = Old_generation(randi( length( Old_generation ) )); M = Old_generation(randi( length( Old_generation ) )); if F+M == 2 if rand(1) < Natural_selectio...
function [SSpoints,Nsample,RHSmat]=readrhs(plt,nb,data_folder) rhs_file = strcat(data_folder,'/RHS.txt'); Spoints_file = strcat(data_folder,'/Spoints.txt'); fidrhs=fopen(rhs_file,'r'); Nsample=fscanf(fidrhs,'%f \n1',1)%number of samling points RHSmat=cell(nb,2);%FF matrices fidsp=fopen(Spoints_file,'r'); SSpoints=zero...
clc; clear all; close all; a=imread('images.jpg'); b=im2bw(a,0.5); figure; imshow(b); [m, n] = size(b); w=[1,1,1; 1,1,1; 1,1,1]; dil=zeros(m,n); erod=zeros(m,n); for i=2:1:m-1 for j=2:1:n-1 list = zeros(1,9); count=1; for k=1:1:3 for l=1:1:3 list(count)=w(k,l)*b...
function SetModelParam %Sets Common parameters for all experimental conditions: Initial state, %time, noise... % for use with MasterFile or simulationEulerVTD_12hourMes_v5 global ModelParam; fprintf(1, '%s called to define params\n',mfilename); ModelParam.modelName = 'VTD_landscape_model_v6'; ModelParam.t0 = 0; ...
% Wiener Filter for Image restoration clc; clear all; img = imread("C:\Users\DELL\Desktop\Study\DIP\Lab_exp\cameraman.jpg"); figure(1); imshow(img) title("Orginal Image"); PSF = fspecial("motion",20,10); imgd = im2double(img); blurred = imfilter(imgd,PSF,"conv",'circular'); figure(2); imshow(blurred); tit...
function build811(n,fs) plot(n); Ln=length(n) m=1:2:Ln; y=n(m); %sound(y,fs) Ly=length(y) %y=round(n); y=round(n*256); y=y/256; plot(y); fs=22050; f=7000; n=0:436191; x=sin(2*pi*f*n/fs); sound(y,fs) x=x'; wavwrite(y,fs,'outwave111.wav');
function [r1, r2] = get_CA_relaxivities(CA_type, MR_field_strength, log_file, log_window_handle) r1 = []; r2 = []; if nargin == 1 disp(sprintf('%s: missing MR_field_strength (should be the second argument passed', mfilename)); return; elseif nargin == 2 log_file = []; log_window_handle = []; elseif nargin == 3 ...
function [ varargout ] = make_latex_table( T, varargin ) %MAKE_LATEX_TABLE Create a Latex table environment % TABLE_STR = MAKE_LATEX_TABLE( T ) Returns a string representation of % T that includes \begin{table} and \begin{tabular} (and corresponding % \end commands) environments. T may be an array, a table, or a ...
function [reduce] = mds(data,k) % mds: Perform classic Multidimensional Scaling(MDS) % data - MxN matrix of input data (M dimensions, N trials) % k - the dimension [m,~]=size(data); t = zeros(m,m); %Calculate the distance matrix of data points in the original space for i = 1:m for j = 1:m t(i,j)=(norm(data...
function Luma = ClosedLoopLumaAdjust(Luma, ChromaA, ChromaB, OriRGB, Stream, MaxLuma) %ClosedLoopLumaAdjust - adjust the luma according to m36184 % % Syntax: NewLuma = ClosedLoopLumaAdjust(Luma, ChromaA, ChromaB, ChSampling, ChFilt, BitDepth) % % Inputs: % -Luma: Luma channel % -ChromaA: first chroma chan...
function showfft(src,sample_fs) % fft example % input: % src -- souce % sample_fs -- sample frequence SRC=fft(src); SRC=abs(SRC); SRC=SRC/length(SRC); FS=linspace(0,sample_fs,length(src)); len=floor(length(src)/2); figure plot(FS(1:len),SRC(1:len)); grid on
%% demo_sisal_large_n_p % % This demo illustrates SISAL algorithm [1] runnig with a 20000 pixels % and p = 15. % % This is not, by far, the maximum size the algorithm can work with. Try, % for example, N = 100000. % % % SISAL: Simplex identification via split augmented Lagrangian % % [1] J. Bioucas-Dias, "A variable...
% Load the library xps_load_drivers ; % Set connection parameters IP = '192.168.1.254' ; Port = 5001 ; TimeOut = 60.0 ; % Connect to XPS socketID = TCP_ConnectToServer (IP, Port, TimeOut) ; % Check connection if (socketID < 0) disp 'Connection to XPS failed, check IP & Port' ; return ; end ...
function digits = index2factoradic(ind, n) % Find factoradic representation of decimal number ind which indexes the % permutations of n elements. The permutatons are lexicographically ordered % and their indices start at zero. % % The elements that are permuted are assumed to be '1', '2', . . ., 'n' % f = factorial(n-...
function powerspectrum(f_signal) [NC]=epocher(f_signal,2); av=mean(NC,1); av=artifacts(av,10); %Limits artifacts to a maximum of 10 if sum(av)>=10 av=artifacts(av,20); end av=not(av); %Removing artifacts. NC=NC(:,av); [pxx,f]= periodogram(NC,hann(size(NC,1)),size(NC,1),1000); %[pxx,f]=pwelch(NC,[],[],[],1000); %h...
function im_E = image_energy(images) N_frame = size(images,3); im_E = zeros(N_frame,1); for k = 1:N_frame im_line = images(:,:,k); im_line = im_line(:); im_E(k) = sqrt(sum(im_line.^2)); end end
function demod_sig = QAM_demod(sig) x = (0:15) q_x = QAM(x) for i=1:length(sig) [minVal,minArg] = min(abs(sig(i)-q_x)) demod_sig(i) = x(minArg) end
%sample script to calculate phi clc; clear all; close all; b=2 % 1<b<=2 phi=quadl(@(x)f4(x,b),0,40,1.e-9)/log(b) ; phi % Sample output % % b = % 2 % phi = % 0.914217701315935
clc; clear all; close all; %% Read the image img_origin = double(imread('flowers.bmp')); %% The R,G,B components are as follows: R_img = img_origin(:,:,1); G_img = img_origin(:,:,2); B_img = img_origin(:,:,3); %% Reconstruction of image from the components: I(:,:,1) = R_img; I(:,:,2) = G_img; I(:,:,3) = B_img; %% ...
fn = 'LED1206'; folder = '/usr/brlcad/bin/'; delete([fn '.g']); fid = fopen([fn '.mged'], 'w'); %% chip body H = [-1.6 -0.8 0.5, -1.6 0.8 0.5, 1.6 0.8 0.5, 1.6 -0.8 0.5]; H = [H, H + [0 0 -0.5, 0 0 -0.5, 0 0 -0.5, 0 0 -0.5]] * 0.393700; fprintf(fid, 'in body1s.s arb8 %g %g %g %g %g %g %g %g %g %g %g %g %g %...
function x = gen_dist(N,tail,xsig,xbar,slew); % x = gen_dist(N,tail,xsig,xbar,slew); % % Function to generate a generalized distribution by adding % multiple offset gaussians together. % % INPUTS: N: The total number of particles % tail: The width of the rising and trailing pulse % edges (0 < tail < 1) ...
X = randn(1,1000); plot(X, '.') [m, v] = meanvar(X) title('samples of X') xlabel('numbers 1 to 1000') ylabel('randn(1,1000)')
% He Feng & Huihao Chen % Section 4.3 of the final project clc; close all; m=0.3; v=0.1; % Define the ideal filters and other variables. t = 0:1:14; f = 20*exp(-t); h = -200*exp(-t); b = -15; d = 15; % List the time samples. num_sample = [1000,3000,10000,30000]; figure(1) %% Display each errors as the function of s...
function duration = hoursPeakCS(time1,CS,threshold) %HOURSPEAKCS Average hours per day that CS is above the threshold % time1 is an array of either datenum values or in units of days. % CS is an array of circadian stimulus values equal in length to time. % threshold is one value [0 to 0.7] where duration is calcu...
%% % % Solves a linear system where the DM object manages the mesh--solver interactions % % Set the Matlab path and initialize PETSc path(path,'../../') PetscInitialize({'-ksp_monitor','-pc_type','none','-ksp_converged_reason'}); %% % Create a DM object da = PetscDMDACreate2d(PetscDM.BOUNDARY_GHOSTED,PetscDM.BOUND...
function [ll] = computeCompleteDataLogLikelihood(residual, precision) error_sum = 0.0; error_acc = 1.0; c = 1; for ii = 1 : length(residual) error_acc = error_acc * (1.0 + 0.2 * (residual(ii,:)*precision*residual(ii,:)')); c = c+1; if mod(c, 50) == 0 error_sum = log(error...
function unit_tangent_point = ... Unit_tangent_from_spline( para_point , spline_sturct ) %Compute the unit tangent point form a given para point. The struct is %base on the matlab curve fitting toolbox %% Getting the tangent using differentation form matlab diff_spline = fnder(spline_sturct,1); %% Getti...
%% Read the required data in % phantom data has e fields files named as_Ex while the VHM has _ex close all; SAR_type = 'Local'; if(parpool('local') == 0) parpool local 8; end %% t0 = cputime; switch SAR_type case 'Global' clc;disp('SAR type: GLOBAL'); %% Get Philips Q values ...
function [ranking, bad_rank, fitness] = degradeSimilar(tolerance, ranking1, fitness1, Step) % this function produces an order in which best structures are clustered: % that means all structures from 1 to bad_rank will have distance bigger than tolerance % For this we choose the best structure and then the next in rank...
tcount=0;FF=[];EE=[]; for ncomps=5:5:25 tcount=tcount+1; INECO_tensorfact_complex_noep FF{tcount}=FT; EE{tcount}=EV; end
function FlylabDeleteDeadFlyFiles (dirspec, filespec) % FlylabDeleteDeadFlyFiles (drivespec, dirspec) % Determine which files in the given drive & dirs contain dead flies, and delete those files. % filenames = GetFilenames(dirspec, filespec); for k = 1:length(filenames) filedata = FlylabRe...
function fre=color_frequency(im) [r,c]=size(im); idensity=0:255; [fre,~]=hist(im(:),idensity); fre=fre/(r*c); end
function Xtable = convert2able(X) % Written by: Filippo Amato, July 2015 % % This function adds Row and Column labels to a numeric matrix. % The row labels are of the form 'R#' (e.g., R1, R2, ...). Analogously, % for the columns the labels have the form 'Y#'. % Table = istable(X); if Table == 1 disp('ERROR...
%% the actual approximation of any input via rounding to nearest node function f = optionPrice(S0,K,T,r,sigma,N_time,N_space,xmax) i = ceil((1/(2*xmax/(N_space))*((K/S0)+xmax))); A = Asian_CN(T,r,sigma,N_time,N_space,xmax); f = S0*A(i+1); end
function dz = dynamics(z,u,P) qf = z(1,:); qm = z(2,:); dqf = z(3,:); dqm = z(4,:); Tm = u; %Motor torque [ddqm,ddqf] = autoGen_dynamics(qm,dqm,qf,dqf,Tm,P.Jm,P.Ks,P.Jf,P.Kf); dz = [dqf; dqm; ddqf;ddqm]; end
v_r=var(rr2(1000,:)) k=1 for xbin3 = -sqrt(v_r)*4 : 0.001 : sqrt(v_r)*4 normal3(k)= exp(-xbin3^2/(2*v_r))/sqrt(2*pi*v_r); k = k+1; end xbin3 = -sqrt(var(rr2(1000,:)))*4 : 0.001 : sqrt(var(rr2(1000,:)))*4 [n3, x3] = hist(rr2(1000,:), xbin3) z=trapz(x3,n3); figure bar(x3,n3/z, 'hist') hold on plot(xb...
%% Test neural networks read_from_file = false; if read_from_file % Image source is the camera type. image_source = 'specim'; directory_path = uigetdir; directory_path = strcat(directory_path,'\'); %% Get the data file paths from the data directory. % RG...
% $Header: svn://.../trunk/AMIGO2R2016/Kernel/OPT_solvers/sres/sres_PEcost.m 770 2013-08-06 09:41:45Z attila $ function [f,h,g] = sres_PEcost(x,inputs,results,privstruct) for i=1:size(x,1) [f(i,1),h(i,:),g(i,:)]= AMIGO_PEcost(x(i,1:size(x,2)),inputs,results,privstruct); end
function varargout = analyzer3d_qualityspeed(varargin) % analyzer3d_QUALITYSPEED M-file for analyzer3d_qualityspeed.fig % analyzer3d_QUALITYSPEED, by itself, creates a new analyzer3d_QUALITYSPEED or raises the existing % singleton*. % % H = analyzer3d_QUALITYSPEED returns the handle to a new analyzer3d_Q...
function [Cost,idx_cluster] = cluster_assignment(data, centroids) Nrecords = size(data,1); K=size(centroids,1); Cost = 0; idx_cluster = []; for i=1:Nrecords % for each record, find the nearest centroid current_data = data(i,:); %calculate the distance to each centroid diff = ones(K,1)*current_data...
addpath(genpath('./utils/')); addpath(genpath('../data')); %% load parsed all hitmap data (x, y, t) % details are in parse hitmap data or main3_fft_pred_seperated_figs taxi_hitmap_history_3d = load("taxi_hitmap_history_3d.mat"); taxi_hitmap_history_3d = taxi_hitmap_history_3d.taxi_hitmap_history_3d; %% get pixel hi...
function [a, ase, p] = getML_LIPModel(Monk, recompute) savepath = ['/work/mirror_jeff/code/matlab/tmp-mat/getML_LIPModel_' Monk '.mat']; if recompute a = getML_txt([Monk 'TRain_LIP.txt']); fn = a.data{strcmp(a.name,'dat_fn')}; ses = a.data{strcmp(a.name,'session')}; usable = a.data{strcmp(...
De code hieronder bevat een syntaxfout. Merk het verschil op tussen een syntaxfout en een programmeerfout. ======= Code ======= % Optellen van een variabele a = %%2; b = 2; som = a * b; ======= Code =======
% Note: MSE = mean square error; % RAD = Relative Absolute Difference tic rept_for_MSE_mean = 100; MSE_buffer = ones(1, rept_for_MSE_mean); RAD_buffer = ones(1, rept_for_MSE_mean); target_max_nbSamplePath = 50; MSE = ones(1, target_max_nbSamplePath); RAD = ones(1, target_max_nbSamplePath); nbStepIn...
%% Problem 1 %Program to estimate K and Km in rate expression for Enzymatic Reaction clc clear all close all % r=KS/(Km+S) S=[1.233;0.540;0.442;0.258;0.198;0.162;0.130;0.128] r=[5.970;3.319;2.253;2.547;1.493;1.182;1.095;0.869] x=1./S; % x=1/S y=1./r; % y=1/r % Writing in the form y=a1+a0x % y=(Km/K)*x+(1/K) % A =[...
%% WFTdualPulse5.m % % Constants global ts; center = 0; % Format: {time, visStim} % [Mode, K0, K1, K2] visStim0 = [1, 0, 0, center]; visStimN = [1, 0, -1, 0]; LaserOff = '0000'; histogramBounds = [1,8*60]; trialStructureList = [... {0, visStimN, LaserOff, '0000','0000','0000'};... %nb. Fi...
%Author:Eduardo Alho %date:01/10/2016 %Applies 3D transforms of to 3D registered masks or other 3D volumetric %data stored in a folder named 3Dvolume %root_dir1 is the folder where the 3D transforms and the reference volume are stored %eg:'/Users/erichfonoff/Desktop/Eduardo_Alho/Wrapper/' %ref0 is the name of the refer...
function [ data_div ] = data_divide( data, multiscale,n_fft ) n = length(data); tf = 2^multiscale; for i = 1 : tf data_pre(i,:) = data(((n*(i-1)/tf)+1):((n*i)/tf)); end data_fft = fftshift(fft(data_pre,n_fft,2)); for i = 1 : tf data_ = data_fft(i,:); for j = 1 : tf data_div(i,j,:) = data_(((n_ff...
function dst = IntraDecode(image, img_size , qScale) % Function Name : IntraDecode.m % Input : image (zero-run encoded image, 1xN) % img_size (original image size) % qScale(quantization scale) % Output : dst (decoded image) im_vs = img_size(1); im_hs = img_s...
function [Y m]=meanNorm(X,meanVec) if nargin==1 m=mean(X,2); else m=meanVec; end Y=bsxfun(@minus,X,m); end
% [score pct maxtime] = ospan(mainwindow,fgcolor,bgcolor,datafolder,subjno, % maxtime) % % Operation Span task based on Unsworth et al (2005). % % Participants read a 3-term equation and have to calculate the answer. % After solving the equation, they press a key and see a probe answer, and % have to decide whether thi...
clc; clear all; close all; len = 1000; e = normrnd(0, .01, len, 1); sys = [0.6 -0.4]; y = zeros(len, 1); y(1:2) = 1; for k = 3:len y(k) = sys*[y(k-1); y(k-2)] + e(k); end figure autocorr(y) figure plot(y) hold on grid on %Ident phi = [y(2:end-1) y(1:end-2)]; sys_hat = phi\y(3:end); y_hat = zeros(len, 1); y_ha...
% Lec 8.4 : Some Practical Examples function fval = cricketFun(t,Y) % Get variables x = Y(1); y = Y(2); u = Y(3); v = Y(4); % Constants g = 9.81; kappa = 0.006; % Describing dY/dt fval = zeros(4,1); fval(1) = u; fval(2) = v; fval(3) = -kappa*u; fval(4) = -g; end
function [Qsim, param, varargout] = HydroMod1( P, E, param ) % % [Qsim, param, varargout] = HydroMod1( P, E, param ) % % BUCKET hydrological model % % INPUTS (time series of daily observations [n,1]) % P = mean areal rainfall (mm) % E = mean areal evapotranspiration (mm) % Q = stream flow (mm...
classdef Np755GlmDirectorComponent %% NP755GLMDIRECTORCOMPONENT % $Revision$ % was created $Date$ % by $Author$, % last modified $LastChangedDate$ % and checked into repository $URL$, % developed on Matlab 8.1.0.604 (R2013a) % $Id$ properties (Abstract) dsa thickn...
function varargout = AlexMenu(varargin) global PDR trials_handle sounds_handle % Begin GUI initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @AlexMenu_OpeningFcn, ... ...
%% This code reads curvature and interfacial data computed in Avizo, post-process them and plot versus time clear all close all clc file_path = 'E:\Diamond19\processing\DK_WF1\1280x1284x1080\curv_ia'; %% Mean curvature between oil and water % list of names data of mean curvatures (km) % change folder fi...