text
stringlengths
8
6.12M
function net = entrenamientoRedes(Xent,Yent, capas_neuronas, ep ) net = patternnet(capas_neuronas); net = configure(net,Xent',Yent'); net.trainParam.epochs=ep; [net, tr]= train(net,Xent',Yent'); plotperform(tr); end
% This script finds the optimal delta by solving critical point of % blocklength based on delta function [opt_delta]=delta_finder(A) com_term = (sqrt(3)*sqrt(16*A^3+27*A^2)+9*A)^(1/3); term11 = 2^(1/3) * com_term / ((3)^(2/3)*A); term12 = 2*2^(2/3) / (3^(1/3) * com_term); term21 = 2^(1/3) * com_term / ...
function RDM=RDM_calc(type,model) %Saves a heatmap of calculated RDM. %Inputs: %type=keyword representing data model type. They are: 'NM' and 'DNN' %model=keyword representing model. %If model is a DNN, two RDM heatmaps are saved. One calculated using DNN model features and the other calculated %using IT model featur...
%sacar eficacia tic % dinfo = dir(['Variables\', '*.mat']); % n_data = length(dinfo); load('ValoresMaximos.mat'); limitesC = linspace(MinC, MaxC, resolucion + 1); limitesI = linspace(MinI, MaxI, resolucion + 1); Mirar = 4; % Mirar = 1:n_data-2; % figure(2) for J = 1:length(Mirar) % K = Mirar(J); %...
%% SYS800 - Reconnaissance de formes et inspection % M'Hand Kedjar - December 2016 function [indr1 , indr2] = index_reduce(ind1 , ind2, n_classes , rate) if(rate > 1) rate = rate / 100; end if(rate > 100 || rate < 0) error('rate should be a postive number less than or equal to 100') end I1 = ...
% Matlab script to communicate with the Teensy 3.6 when it is in closed % loop OMR mode % % Calling closed_loop_omr without arguments opens the GUI and initializes % the threshold of burst detectioin to 100 % % The GUI calls the subfunctions by passing arguments. % % Last modified 06/11/17. function [] = closed_loop_...
% Random masking function function [tsPerS, tElapsed] = GetRandomProjectionsMatrix(data, sLen, sNum) dimensionality = 16; cardinality = 4; [shapeletsHash, shapeletsStorage] = GetSaxHash(data, cardinality, sLen, dimensionality); R = 10; %10 maskedNum = 3; masks = zeros(R, maskedNum); A =...
load frieddelve data = frieddelve(:,1:10); label_true = frieddelve(:,11); clear frieddelve
function y = dh_sys(x) y = 1; end
function [dist1, dist2] = dist_between_parts(v1, v2) dist1 = distBetweenParts(v1, v2); dist2 = distBetweenParts(v2, v1); function dist = distBetweenParts(v1, v2) n1 = size(v1,1); n2 = size(v2,1); dist = 0; for i = 1:n1 minErr = 999999; pt1 = v1(i,:); for j = 1:n2 pt2 = v2(j,:); ...
function res=forcast(rates, prev, future, n=1) use=rates(end-prev+1:end); changes = [use; 0] ./ [0; use]; changes = changes(2:end-1); for i=1:n for t=1:future # forcast a single target rate s=ceil(sqrt(prev)); for j=1:s p=randperm(prev-1,s); res(end+1)=prod(changes(p)); ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This file bias the prefrontal cortex in two different ways: % In the cortical schemas and in the basal ganglia unit % The script is run each timeStep %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% averaging_int = (tt - counter.tt_trial_num(counter.trial_n...
function [output] = blur(A,w) [row, col] = size(A); A=uint8(A); B=nan(size(A) + (2*w)); B(w+1:end-w,w+1:end-w)=A; output = 0*A; for i=w+1:row+w for j=w+1:col+w tmp=B(i-w:i+w,j-w:j+w); output(i-w,j-w)=mean(tmp(~isnan(tmp))); end end output=uint8(output);
% MCLCALC.M % Script for calculation of roots (b) % of a Polynomial only % Called by mclcm % First clear any error messages**************** set(mcltxter,'String', ' ') ; % Check for existance of needed polynomials **** if exist('mpgb1') ~= 1 ; set(mcltxter,'Color','red','String', ... 'Error: B1 pulse does not ...
function testAll(nmax) for i=0:1:nmax testThis(i); end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright 2012 Analog Devices, Inc. % % 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:/...
function [b,g] = legendre_1D(ord,x) nx = size(x,1); if ord == 0 b = ones(nx,1); g = zeros(nx,1); elseif ord == 1 b = x; g = ones(nx,1); elseif ord == 2 elseif ord == 3 elseif ord == 4 elseif ord == 5 elseif ord == 6 elseif ord == 7 elseif ord == 8 elseif ord == 9 ...
function tool_phi_plot( r_int,r_ext,phi_int,phi_ext,phi_int_lt,phi_ext_lt,n_th,label_opt,cur_time_i,par_dt ) %TOOL_CPM_PLOT Summary of this function goes here % Detailed explanation goes here [N_int,M]=size(phi_int); [N_ext,~]=size(phi_ext); psi_int_lt_m=zeros(N_int,M); psi_ext_lt_m=zeros(N_ext,M); psi_int_lt_m(:,2)=...
function data = collect_data(directory) testfiles = dir([directory '/' 'strain*.json']); for f = testfiles' fullfilename = [directory '/' f.name]; data(end+1) = loadjson(fullfilename); end
clear all; load('Rome_classification'); % Parameters alpha = 1.0; %% Dummy encoding classifiedFeatures = [3 16 25 28 34]; classifiedRows = []; for i = 1:length(classifiedFeatures) classifiedRows = [classifiedRows dummyvar(X_train(:,classifiedFeatures(i)))]; end X_train(:,classifiedFeatures) = []; X_train = [X_trai...
function copyExistingDatabase %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright 2006-2007 Jean-Francois Lalonde % Carnegie Mellon University % Do not distribute %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% addpath ../xml; addpath ../../3rd_party/LabelMe...
%========================================================================= %This is an implementation of the video quality metric described in %the following paper: % % Songnan Li, Lin Ma, King Ngi Ngan, "Video quality assessment by % decoupling additive impairments and detail losses", The third International ...
% ppA01.m clear all close all clc hold on N = 2000; x = zeros(N,1); y = zeros(N,1); L = 20; x(1) = -10; y(1) = 9; tMax = 5; t = linspace(0,tMax,N); dt = t(2)-t(1); A = [1 4;2 -1]; x(2) = x(1) + dt*(A(1,1)*x(1) + A(1,2)*y(1)); y(2) = y(1) + dt*(A(2,1)*x(1) + A(2,2)* y(1)); flagS = 0; c = 3; while flagS == 0 ...
%Phu Tran %Homework #4 %AMATH 481 %11/19/15 clc; close all; %setup L = 10; n = 64; dx = 2*L/n; dy = dx; x = -L:dx:L; x = x(1:n); y = x; dt = 0.5; tEnd = 4; tSpan = 0:dt:tEnd; %Make A e1 = ones(n,1); subA = spdiags([-4*e1 e1 e1 e1 e1], [0 -1 1 -(n-1) (n-1)], n, n); e2 = ones(n^2,1); A = spdiags...
lpFilt = designfilt('lowpassiir','FilterOrder',8, ... 'PassbandFrequency',35e3,'PassbandRipple',0.2, ... 'SampleRate',200e3);
%{ 05/18/2022 Purnanand Elango Plot dual variable error for each exPIPG iteration until convergence for feasible and infeasible problems %} clc clear variables close all addpath ../ addpath ../solvers addpath ../solvers/expipg addpath ../utils n = 32; m = n/2; N = 20; x_max = 1; u_max = 0.5; omg = 200; alf = nan;...
function [energy, hess, block]= block_energylambda_c(alpha,c,block,sigma_alpha,opt) extract(block); sigma=block.sigma; in = mat2cell([sigma, nSample],ones(L,1),2); sigmaall = cell2mat(cellfun(@(x)x(1)*ones(x(2),1), in, 'UniformOutput',0)); N=length(alpha); lambda_nucl = exp(alpha); if ~isempty(c) %% Compute the...
function disparity = lbpToDisparity(leftImage, rightImage, windowSize) width = size(leftImage,2); height = size(leftImage,1); labels = 60; propagations = 5; messages = zeros(height, width, 5, labels, 2); disp = zeros(height, width); progressBar = waitbar(0, 'Initialising Loopy Belief Propagation...'); ...
function outputs = get_op(gen1, gen2) % output(i, 1) has the output of gen1(MSB) and gen2 when 0 is pushed at LHS % output(i, 2) has the output of gen1(MSB) and gen2 when 1 is pushed at LHS m = 9; outputs =zeros(2^m, 2); for i=1:2^m % matlab, by default, produces binary vecto...
function test_corellations() sdata = csvread('features_fileid_sex_sexpredictiondnn_duration_avgfreq_avgvol_direction_peaks_breaks_broadband_tremolo_complex.csv'); data_path = './conv_activations/'; dirs = dir(data_path); female = []; male = []; for d =...
function [rowPartitions1, rowPartitions2] = partitionTrials(data, numPartitions) rng(0, 'twister'); rowPartitions1 = cell(numPartitions, 1); rowPartitions2 = cell(numPartitions, 1); subjects = unique(data.subject); for p = 1:numPartitions subjectHalf1 = subjects(randperm(length(subjects), ... round(length(...
%short routine to calculate amplification factors for quads/dipoles clear all; mag(1).name='QF '; mag(1).l=0.34; mag(1).k=1.815761626091; mag(1).bx=10; mag(1).by=5; mag(2).name='QD '; mag(2).l=0.15; mag(2).k=-1.580407879319; mag(2).bx=8; mag(2).by=8; mag(3).name='QFC'; mag(3).l=0.5; mag(3).k=1.786614951331; mag(3).bx...
clear addpath('../RJMCMC') %% model S.z = [-1d6, 0]; S.zMax = 100; S.rho = [1d12]; x.z = [20 50]; x.rhoh = [1 0 2]; x.rhov = [1 0 2]; writeData = false; % won't overwrite %% SkyTEM polygon and receiver xy details S.xyPolyTx = [ -15.09 -2.00 ; -8.11 -10.16 ; 8.11 -10.16 ; ...
% wav_tube_matrix.m % Eigenvalues and eigenfunctions for standing waves in tubes % Ian Cooper % School of Physics, University of Sydney % email: ian.cooper@sydney.edu.au % https://d-arora.github.io/Doing-Physics-With-Matlab/ % 20140718 clear all close all clc % INPUTS ==============================================...
%% clear % load net612/testet612_batch512_newalldata_steplr2_iter_600000label_cal % load net612/testlabel_grt cpath='/home/tangy/caffe-master/python/'; load ([cpath , 'net612/test0000label_cal.mat']); load ([cpath , 'net612/testlabel_grt.mat']) z=(label_grt(:,1)=='1').'; l=round(1-label_cal); truem=sum(l==z&l=...
function[centers_y,centers_x,widths,heights,contri]= find_centers_4dhough_voting(offset,bbox_size,bin_size,size_bin_size,threshold,sup_size,size_non_m_win_size) tStart=tic ; %generate heat map h=ceil(size(offset,1)/bin_size(1)); w=ceil(size(offset,2)/bin_size(2)); w1=ceil(size(offset,2)/size_bin_size(2)); h1=...
%-------------------------------------------------------------------------- % version 1 % function plotLineDotDirVec(Line) % global axisRange; % vec=Line.DirVec/sqrt((Line.DirVec(1))^2+(Line.DirVec(2))^2); % unit % length=Line.length/2; % plot([Line.dot(1),Line.dot(1)+length*vec(1)], [Line.dot(2),Line.dot(2)+length*...
function [ diff ] = calc_diff(data, frame, centers) M = []; frameSizeHalf = size(frame, 2)/2; for i = 1:size(centers, 2) range = (centers(2, i) - frameSizeHalf + 1):(centers(2, i) + frameSizeHalf); if min(range) < 1 || max(range) > size(data, 2) M(:, i) = -frame; %(centers(1, ...
classdef TimeSteps < handle %CalcTimeSteps Berechnet die einzelnen Zeitschritte properties OriConfig@Config; WQTraj@DoubleEllipHeatSource; CaliWQ@Calibration; TimeStepArray = []; TFieldTimeStep = []; AdaptMeshDiscr...
[final_loss, objective_value , gg, gg_smooth] = evaluation_oracle(final_solution,data);
p = 1; for imageN = 1:482 name = ['Image',num2str(imageN),'.jpg']; %normImage = im2double(name); I = imread(name);%I = imread('~/Desktop/StormsOf/Jupiter/Image%.jpg'); %I = %Im = imadjust(I); data(p,:) = reshape(I,1,28*28); %data(p,:) = I; p = p + 1; end csvwrite('imag...
function B = a A=[]; for i = 1:22 A{i} = imread(num2str(i,'rr%d.bmp')); end B = zeros(22,22); for i = 1:22 for j = 1:22 if i ~= j B(i,j) = sim(A{i}, A{j}); end end end C = zeros(1,22); for i = 1:22 ...
classdef SigmoidImageReg < handle % % Sigmoid image regularisation function object. % % % @author: Jeffrey Chan, 2013 % properties(GetAccess = 'public', SetAccess = 'protected') % default values (make sure they match with EucTriFactBM) m_gamma = 0.001; m_beta...
function rad = deg2rad(deg) rad = deg * pi/180; end
function [nR, nC] = BestSubplots(nP) % [nR, nC] = BestSubplots(N) % % Calculates the best distribution of subplots for N plots % % INPUTS % nP = number of subplots to place % % OUTPUTS % nR, nC = number of rows and columns % % ADR 2013 nR = ceil(sqrt(nP)); nC = ceil(nP/nR);
% Se1_1.m. % This is a 1D FDTD simulation of psi. clear close all clc NN = 400; % Number of points in the problem space hbar = 1.054e-34; % Plank ?s constant m0 = 9.1e-31; % Free space mass of an electron meff = 1.0; % Effective mass: Si is 1.08, Ge is % 0.067, GaAs is 0.55 melec = meff *m0; % Mass of a...
% em_emf_1.m % Animation of a magnet moving through a coil % Ian Cooper % School of Physics University of Sydney % email: cooper@physics.usyd.edu.au clear all; close all; clc xmax = 40.1; xmin = -30; % limits for X axis N = 200; % steps Ni = round(N * 12 / 50); % location of curr...
function [opttheta] = minFuncSGD(funObj,theta,data,labels,options) % Runs stochastic gradient descent with momentum to optimize the % parameters for the given objective. % % Parameters: % funObj - function handle which accepts as input theta, % data, labels and returns cost and gradient w.r.t % ...
function writeMesh_off(fileName, vertices, faces) %WRITEMESH_OFF Write a mesh into a text file in OFF format. % % writeMesh_off(FNAME, V, F) % % Example % writeMesh_off % % See also % meshes3d, writeMesh, readMesh_off, writeMesh_ply % ------ % Author: David Legland % E-mail: david.legland@inrae.fr % Crea...
function D = District_feature(district,PD,n) [a,~] = size(PD); D = zeros(n,a); [~,pos] = ismember(district,PD); for i=1:n D(i,pos(i)) = 1; end
% do lqr-lptv control design try tic compsoc_lqr_based; toc catch ME error_flag = 1; warning('LQR-LPTV ERROR!!!'); end % TODO: working on this section!!!!!!!!!!!!!!!!!!!!!!!!!!!! % when there are no errors finding the controllers if error_flag == 0 % adjust feedback control m...
%% Circular Convolution of discrete signal clc; clear all; close all; %% Taking input signal x=input('enter x(n): '); h=input('enter h(n): '); n=length(x); w=exp(-2i*pi/n); %% Finding DFT of input signal for k=1:n X(k)=0; H(k)=0; for j=1:n X(k)=x(j)*w^((j-1)*(k-1))+X(k); H(k)=h(j)*w^((j...
function [pts markers fpts] = loadMarkedData2(dataPath, maskPath) %Ładuje plik oraz maskę. Następnie wykorzystuje maskę do wyboru części %punktów z danych. pts = ioLoad3dData(dataPath); mask = imread(maskPath); markers = markData(pts, mask, 0, 0, 0); fpts = pts(markers, :);
%PRO-RO clear; y=.01:.1:.5; c_f=600; niu=2; R=8.31; T=298; pi_f=niu*R*T*c_f/10^5; eff_hp=1; eff_ht=1; eff_erd=1; %constraint 1 to make sure delta_p1>0 %fai1=eff_erd/(eff_ht*eff_hp)-1;%delta_q/qb %constraint 2 to make sure delta_p1<delta_p %fai2=(1-eff_erd.*(1-y)-(1-y).*(eff_ht*eff_hp-eff_erd))./((1-y).*eff_ht*eff_hp);%...
function [c,h]=polrfl(ai,dom,hs) % Spectral Reflection of a Polynomial % % Usage: [c,h]=polrfl(ai,dom,hs) % % Testfile: t54.m if nargin<2, dom='z'; end a=ai(:)'; n=max(size(a))-1; if dom=='z', disp('Z-domain') c=fliplr(a); h=zeros(n+1,n+1); for i=1:n+1, h(i,n+2-i)=1; end elseif dom=='s', ...
%% get Euclidean distances between points along a path function [cumd,d] = cumulativeDist(p) % For n points in p (n x m), get the distances from p_i to p_{i+1} and % return d as an n x 1 vector d = diff(p,1) ; d = [0;sqrt(sum(d.*d,2))] ; cumd = cumsum(d) ; end
function X_pred = PredictMissingValuesWNMF(X, nil) global k persistent Y A W xnil = X == nil; xnotnil = X ~= nil; if(isempty(Y)) Y=rand(k,size(X,2)); Y=max(Y,eps); A=X/Y; A=max(A,eps); W=X==nil; X(W)=0; W=~W; end %k = 10; %min_val = min(min(X)); %X = X - min_val; %option = struct(...
function [f, df] = STFuncCost(params,v) %This funciton is a combination of a Gaussian in the spatial dimension and %a Gamma function in the temporal dimension. Appropriated from DeAngelis et %al 1993 paper. [tf,sf] = meshgrid(1:tf_width,1:sf_height); tf = tf(:); sf=sf(:); A0 = params(1); sf0 = params(2); tf0 = par...
function idx = f_sub(jdate) % - subsample data every 6 hrs % % USAGE: idx = f_sub(jdate); % % x = vector of julian dates % idx = index to elements that occur every 6 hrs. % % SEE ALSO: f_julian % -----Author:----- % David L. Jones, Oct-2004 % % This file is part of the FATHOM Toolbox for Matlab and % is released und...
function LatexMatrices(d) % LatexMatrices(d) spews forth Latex versions of P and Q LatexMatrices for % B-spline wavelets of degree d, from level 1 until the general pattern % appears. disp(['% B-spline scaling function and wavelet matrices of degree ' ... num2str(d)]); disp('% (automatically generated by Matlab c...
function [delta, error] = GFC_Softmax_loss(active, GT, mode) bz = size(active,4); cha = size(active,3); dt_loss = zeros(size(active)); loss = 0; for i = 1:bz output = active(:,:,:,i); t=max(output,[],3); for s=1:cha output(:,:,s) = output(:,:,s)-t; end output = exp(output); p=zeros(size(ou...
% README: % The following three code sections generate band structures for TBLG % The first is a standard angle-sweep % The second adds symmetry-breaking terms % The third modifies the effective AA and AB interlayer couplings % After this is a band-plotting utility, followed by code for DoS/IDoS %% Get bandstruc...
hand = imread('handdd.JPG'); back = imread('bacc.JPG'); diff = abs(hand - back) > 10; diff = rgb2gray(255 * uint8(diff)); % median filtering med_hand = medfilt2(diff); gau_hand = imgaussfilt(diff,2); % graythresh can be used to compute the level argument automatically binary_hand = im2bw(med_hand,graythres...
function results = nlrm_ncp(y,X,b0,V0,s02,nu0,Xstar) %Funkce pro normalni linearni regresni model s priorzene konjugovanou %apriorni hustotou % y ... vektor vysvetlovane promenne (n x 1) % X ... matice vysvetlujicich promennych (n x k) % b0 ... vektor apriornich strednich hodnot parametru b [k x 1] % V0 ... apr...
function out=jacknife(data,candidate) %this function runs the jacknife procedure seed=20200709; rng(seed); M=1000; betas=zeros(M,1); ctry='AUSTRIA'; ctrytbl=nustable(strcmp(nustable.ctry,ctry),:); varlist={'SIZE','BM','fht','ivol','ret','roe','cash','invop','capex','ppe','rdratio','DIV','dy','close','lev','ADR','analy...
function [ mask ] = getSamplingMask( strucNum,mask3M,rate ) %UNTITLED Summary of this function goes here % Detailed explanation goes here sV = size(mask3M); if ~exist('planC') global planC; end indexS = planC{end}; [scanNum, relStructNum] = getStructureAssociatedScan(strucNum, planC); [x,y,z] = getUniformScanXY...
function info = winsoundhwinfo % WINSOUNDHWINFO % % Function to provide separate lists of AI and AO channels. % Work around for toolbox assumption that one list fits all. % % Output boards do not have to be in the same order as the inputs in % Windows Multimedia Settings (Control Panel). % % New fields added t...
function [Planes, PlaneSupports] = fitStairPlaneuvd2(points,edgeCandidates,epsilon,trials, gp, disparityThreshold) global intrinsics baseline; Num_inliersMax = 0; Num_inliers=0; IDinliersMax=[]; loopNO=1; uvdGP=uvdPlane2(gp, intrinsics, baseline); uvdGP4=uvdPlaneExpand(uvdGP); PointsOnEdge=zeros(0,3); for n=1:le...
function nps = cross_talk_noise(P, varargin) % nps = cross_talk_noise(P(chi, sigma2, px), f) % % Returns the noise-power spectrum (NPS) for a fraction chi cross talk % between detector pixels in a rectangular matrix. Cross talk is along % the first dimension and the noise is uncorrelated in the perpendicular % ...
while i<=n %Run all the nodes %if solution found if (P(i,1:4)== goal) NSol=NSol+1; SolPos(NSol)=i; if NSol==1 Sol(1:i, :)=P(1:i, :); %Solution Array m=size(Sol,1); %make Solution Graph Matrix for j=2:m B(j-1, j)=1; end end ...
%% init % format compact; % clear all; % close all; % clc; % parameters function imdb = prepareData() pathToData = '/home/kraki/Documents/WSW/Projekt/PRZEKROJE'; pathToLabels = '/home/kraki/Documents/WSW/Projekt/2015_etykiety.txt'; image_h = 256; % pierwsza wspolrzedna image_w = 256; % druga to_gray = ...
function OUCOMPInitialize() current_path = fileparts(mfilename('fullpath')); cd(current_path); slash_index = regexp(current_path,'\'); parrent_path = current_path(1:slash_index(end)-1); run([parrent_path,'\GI_PVTI\PVTinitialize.m']); run([parrent_path,'\mrst-2017a\startup.m']); end
function L = stdgibbs_logjoint(theta,phi,Adk,Bkw,Mk,... I,D,K,W,di,wi,ci,citest,Id,Iw,Nd,alpha,beta); % standard gibbs log joint probability over everything prior_dk = D*(log(gamma(K*alpha))-K*log(gamma(alpha))); prior_kw = K*(log(gamma(W*beta))-W*log(gamma(beta))); dk_ll = sum(sum((alpha-1+A...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% This function is used to support user query based on a particular %%% sentence and return KL or LR result, plot distribution graphs %%% To run the query, you must run "gradient_kl.m" or "gradient_lr.m" %%% firstly %%%%%%%%%%%%%%%%%%%%%%%%%%%...
function y = BSIV(v,Price,S,K,r,q,T,PutCall); d1 = (log(S/K) + T*(r-q+v^2/2)) / v / sqrt(T); d2 = d1 - v*sqrt(T); call = S*exp(-q*T)*normcdf(d1) - exp(-r*T)*K*normcdf(d2); put = call + K*exp(-r*T) - S*exp(-q*T); if PutCall=='C' BSPrice = call; else BSPrice = put; end y = (Price - BSPrice)^2; if v...
function I = LoadTif(tifFile) % Load tiff file to array info = imfinfo(tifFile); tampon = imread(tifFile,'Index',1); F = length(info); I = zeros(size(tampon,1),size(tampon,2),F,'uint8'); I(:,:,1) = tampon(:,:,1); tic wait_bar = waitbar(0,['Loading ',tifFile]); ind = 0; for i = 2:F ...
% function [s]=cytotrace(X,genelist) % %see also: sc_potency % % % @title cytoTRACE % % % % @description This function generates single-cell predictions of differentiation status from scRNA-seq data. % % It takes in a matrix of gene expression values where columns are cells and rows are genes.\cr\cr % % (Optional) Tec...
function vp = CalculezValProprii(d, s, m, eps) R = IntervaleValProprii(d, s, m); [n n] = size(diag(d)); if(m > n) m = n; end for i = 1:m %pentru fiecare interval Ri - Ri + 1 calculez cu precizia eps val proprie, stim ca avem sigur o radacina %deci putem aplica bisectie fara alte verificari %pratic avem va...
function n = saveFigure(s,dir,name,number) %modelo de documentacao a partir de: %http://www.engin.umd.umich.edu/CIS/course.des/cis400/matlab/oop.html %SIMULATOR simulator class constructor. % s = Simulator(m) creates a simulatort object from the mesh object %Name: saveSol %Location: <path>/@Simulator %Purpose: save...
function SetParms(self, varargin) % % SetParms for convex hull cluster self.SetParms@MClust.ClusterTypes.DisplayableCluster(varargin{:}); if isa(varargin{1}, 'MClust.ClusterTypes.CvxHullCluster') self.CopyHulls(varargin{1}); elseif isa(varargin{1}, 'MClust.ClusterTypes.Cluster') S = varargin{1}.GetSpikes(); MCC ...
function result = f_disprof_clust_bin(A,B) % - compare 2 DISPROF binary connectivity matrices % % USAGE: result = f_disprof_clust_bin(A,B); % % A,B = binary connectivity matrices (BIN) created by f_disprof_clust % % result = structure of results with the following fields: % .n = # of objects in A that differ from B...
useMex = true; if ~useMex fid = fopen('F0.bin','rb'); raw = fread(fid, inf, 'float'); F0 = raw(1:2:end) + 1i.*raw(2:2:end); F0 = reshape(F0,3,[])'; figure; plot(abs(F0)); else nrf = 3*50; nz = 50; tr = single(0.018); te = single(0.006); tau = single(0.0028); tgap ...
%%%% Initialize %%%%% pic_filename = 'Orl'; % pic_filename = 'Orl_shelter'; % if getting sOrl picture, uncomment this line, % comment the upper line cow_choose = 4; % choose the picture to show picture_save_format = '.eps'; % format of picture to save %%%% Main %%%%% load([pic_filename,'.mat']); row_num = 112; % ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function [skyMask, sceneMask, groundMask, verticalMask] = loadSceneSkyMasks(skyMaskPath, seqInfo) % Useful function which loads the sky and scene masks for a given % image sequence. % % Input parameters: % - skyMaskPath: path to the sky (an...
%% testscript: % I have implemented all this stuff, now I'm going to test is to see how it % works and find any syntax errors or bugs... clear, clc; close all; % configuration variables: n = 10; % number of samples d = 4; % dimension of samples L = 100; % number of iterations in PRank algorith...
function [rhoG,uG,vG,preG] = BC(ckey,time,gas_gamma,gas_const) % function [rhoG,uG,vG,preG] = BC(ckey,time,gas_gamma) % Purpose: Set Boundary Condition rho_L = 1.0; u_L = sqrt(gas_gamma); v_L = 0; p_L = 1.0; p_R = 1.3; rho_R = rho_L*((gas_gamma+1)*p_R + gas_gamma-1)/((gas_gamma-1)*p_R + gas_gamma+1); u_R = ...
function varargout = adjustwocircles(x, y, initval, config, axes_image, axes_monitor) %% Preferences opt = config; % Debug debug_flag = opt.Debug; % Optimization cycles fit_cycles = opt.FitCycles; % Optimization tolerance tol_fun = opt.Tolerance; tol_x ...
function WriteIntTextFile(A, file) if ischar(file); id = fopen(file,'w'); else; id = file; end; fprintf(id,[repmat('%d ',1,size(A,2)) '\n'],A); if ischar(file); fclose(id); end;
% The fitting fuction: function fit = SNumOnes(num) % Iterating on the 32bit number: fit = sum(dec2bin(num)=='1');
function grad_Phi = twodimensional_gradient(X,Y,Phi) M = inv([ones(3,1) X Y]); %A_e = abs(1/(2*det(M))); b = M(2,:); c = M(3,:); B = [ b(1) b(2) b(3) ; c(1) c(2) c(3) ]; grad_Phi = B*Phi; end
function [Img1, Img2] = readImg(fn1,fn2) Img11 = imread(fn1); Img22 = imread(fn2); Img1 = im2double(Img11(:,:,1)); Img2 = im2double(Img22(:,:,1)); % Img1 = double(Img11(:,:,1)); % Img2 = double(Img22(:,:,1)); end
% This program aims to deal with classify the Character catalog. clc clear all close all DIRETORY = 'C:\Users\Administrator\Desktop\postrain - Rp\'; cd(DIRETORY) numDirunRed = 0; % Directory dirDat = dir([DIRETORY]); numDir = length(dirDat); t = 0; numMostPixes = 4 %% Step1:find the image contain the most red pixe...
function wmremove(varargin) %WMREMOVE Remove overlay on web map % % Syntax % ------ % WMREMOVE % WMREMOVE(H) % % Update Description % ----------- % WMREMOVE removes the vector overlay most recently inserted into the % current web map. % % WMREMOVE(H) removes the overlay or overlays specified by the we...
function ListTen(neuronNames,kTot,ix) for i = 1:10 fprintf(1,'Neuron %s: k = %u\n',neuronNames{ix(i)},kTot(ix(i))) end end
function showTrBound(tr, IDX, boundTrLabels, imname, lLen) % show the boundary trajectories tmpTrColor = zeros(length(tr),1); tmpTrLabels = [1:length(tr)]; tmpLabel1 = boundTrLabels(IDX==1); tmpLabel2 = boundTrLabels(IDX==2); tmpTrColor(tmpLabel1) = 0.5; tmpTrColor(tmpLabel2) = 1; ...
function [r, x] = stochastic_nonst_env(R, breakpoints, tt, a) phase = 1 + sum(tt > breakpoints); n_arms = size(R, 2); all_r = rand(1, n_arms) < R(phase, :); r = all_r(a); x = [];
function [val, grad] = funJ(dx, dt, Nx, Nt, w) rho = reshape(w(1:Nx*(Nt+1)), Nx, Nt+1); q = reshape(w(Nx*(Nt+1)+1:Nx*(Nt+1)+(Nx+1)*(Nt+1)), Nx+1, Nt+1); val = J(dx, dt, Nx, Nt, rho, q); if nargout > 1 [gradrho, gradq] = gradJ(dx, dt, Nx, Nt, rho, q); grad = [reshape(gradrho, Nx*(Nt+1), 1...
function [nomdist] = nomdistance3(K, trainsize, database, descriptor) nomdist=[]; for i=1:1:trainsize dist = 0; for j=1:1:K dist = dist + (database(i,j)-descriptor(j))^3; end nomdist=[nomdist; nthroot(dist,3)]; end end
function [x,ierr] = myj(AA,AC,AI,b,x0,Kmax,tol) %l'algoritmo suppone una matrice A con diag(A) senza elementi nulli n = length(AI)-1; k = 1; x = zeros(size(x0)); ierr = 0; while true for i = 1:n j1 = AI(i); j2 = AI(i+1)-1; sumi = AA(j1:j2) * x0(AC(j1:j2)); ...
%% calculating and evaluating the jacobian of the DIP model function jac_evN = evalJac_dip(R_k, H_k) syms hx hy hz rx ry rz H = [hx; hy; hz]; R = [rx; ry; rz]; model = symfun((3*dot(H,R)*R)/(norm(R)^5) - H/(norm(R)^3), [R; H]); jac = jacobian(model,([R;H])); e_rx = R_k(1); e_ry = R_k(2); e_rz = R_k(3); e_hx = H_k(1...