text
stringlengths
8
6.12M
clear clc disp('Projeto de filtro passa-baixas') disp(' ') wp = input('Entre com a frequencia da faixa de passagem, wp: '); ws = input('Entre com a frequencia da faixa de rejeiรงao, ws: '); disp(' ') disp('Escolha da janela') disp(' ') disp('Opรงoes') disp(' ') disp('1 - Retangular') disp(' ') disp('2 -...
function cost_aggr = graph_traversal(mst,cost,sigma) %% obtain leaf nodes deg = int8(degree(mst)); leaf_nodes = find(deg==1)'; deg = []; if isfile('graph_traverse.mexa64') || isfile('graph_traverse.mexmaci64') || isfile('graph_traverse.mexw64') cost_aggr = graph_traverse(mst.Edges....
function a = prediction(y,y_hat) correct = 0; [n m] = size(y); for i=1:n if((y_hat(i) >= 0.50) && y(i) == 1) correct = correct + 1; elseif((y_hat(i) < 0.50) && y(i) == 0) correct = correct + 1; end correct a = correct / n * 100; ...
function varargout = ConvergenceDetermination(varargin) % CONVERGENCEDETERMINATION MATLAB code for ConvergenceDetermination.fig % CONVERGENCEDETERMINATION, by itself, creates a new CONVERGENCEDETERMINATION or raises the existing % singleton*. % % H = CONVERGENCEDETERMINATION returns the handle to a new C...
clear clc H = [1, 0, 1, 0; 0, 1, 0, 1; -1, 0, -1, 0; 0, -1, 0, -1]; A = [0 1 0 0; -2.1 0 -0.69 0;0 0 0 1;-0.92 0 -4.308 0]; B = [0 0; -1 1;0 0;1.467 2.533]; f = [0; 1;0;12/9]; H0 = [1 1 1 1]; t0 = 0; tf = 15; N = 750; h = (tf - t0)/N; g_d = [-1;-1;-1;-1]; g_u = [1;1;1;1]; lb = -1*ones(2*N,1); x_h_values = zeros(4, N+1...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Title : run_DAUM_API % % Description : % - ์œ„์น˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ž…๋ ฅ๋ฐ›์•„ Daum API์ธ HTML ํŒŒ์ผ ํ˜•ํƒœ๋กœ ์ถœ๋ ฅ % - Daum API User Key๋ฅผ ํ• ๋‹น ๋ฐ›์•„ ์‚ฌ์šฉํ•  ๊ฒƒ! % % Written by : Jinwoo Jung % Last updated : 2017/05/24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% cle...
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This script is to perform the defect detection on ham images % % Reference: % xxxxx % % Matlab version was written and was tested on Matlab 2020a % If you have any problem, please feel free to contact Sze Te...
clear; Wprint(16);
function[dx]=geno_2_meta_dyn_t(t,x); % ode model for 2 genotype metapopulation dynamics % ensure all variiables >= 0 x(1)=max(x(1),0); x(2)=max(x(2),0); x(3)=max(x(3),0); x(4)=max(x(4),0); % import parameters global beta mu_M D_M psi1 u1 tu % interpolate control - for cts control remove 'previous' u=interp1...
% This script runs program rundivcrl % for nine coordinate systems and puts % the output in rundivcrl.tst if exist('rundivcrl.tst','file')==2 delete rundivcrl.tst end syms x y z vxyz=[x*y,y*z,z*x]; diary rundivcrl.tst % rundivcrl(vxyz,cordname,tn,noprint) call list rundivcrl(vxyz,@cylin,[10*rand,rand*2*pi,...
function cubeIds = getCubeIds(param, segIds) % cubeIds = getCubeIds(param, segIds) % This function returns the linear indices of the segmentation cubes % containing the segments in `segIds`. % % param % Parameter structure % % cubeIds % Matrix with the linear indices of the s...
function plotHypnogram(stageData, cycleBounds) % Stephanie Greer and Jared Saletin % Walker Lab, UC Berekeley 11/22/2010 winSize = stageData.win; srate = stageData.srate; onT = etime(datevec(stageData.lightsON), datevec(stageData.recStart))/60; offT = etime(datevec(stageData.lightsOFF), datevec(stageData.recStart))/6...
clc; clear all; train = csvread('big_train.csv'); test = csvread('big_test.csv'); [row, column] = size(train); train_reshape = reshape(train, row*column, 1); test_reshape = reshape(test, row*column, 1); ii = 0; jj = 0; for i = 1 : row*column if train_reshape(i) ~= 0 ii = ii + 1; idx(ii) = i;%่ฎญ็ปƒ้›† ...
function newImg = stich(imcyl1, imcyl2, Tx, Ty) % =============================================================================== % PURPOSE: % CREATED: % % imcyl1: Height x Width x RGB % imcyl2: Height x Width x RGB % Tx: Translation in x % Ty: ...
function [ surfacesScaled ] = scaleSurfaces(surfaces, scale) %SCALEPLOTS3D as the solutions to the PDE are linear in appplied voltage, %instead of recalculating the solutoin for different voltages, simply %rescale the solution starting with the solution for 1000V % scale is the ratio from Vapplied to V1000 surfacesSca...
function nexFileData = create_blank_nex() %create_blank_nex for WaveLimit v1.3 % Adam Rouse, 4/23/20 nexFileData.version = 104; nexFileData.comment = char(zeros(1,0)); nexFileData.freq = 40000; nexFileData.tbeg = 0; nexFileData.tend = 0; nexFileData.events = {}; nexFileData.markers = {}; nexFileData.neurons{1}.name ...
% a MATLAB script to extract the images from cuhk03 dataset rootFolder = './rawdata'; data = load('cuhk-03.mat'); dataLabels = {'labeled', 'detected'}; for dataLabelsIndex = 1 : length(dataLabels) % create a directory with the label only label = dataLabels{dataLabelsIndex}; subFolder = strcat(root...
% Gets best so far gap score and Rand index function [bestSoFarGapScore, bestSoFarRandIndex] = getBestSoFar(shapelets, RI) bestShLen = size(shapelets, 1); bestSoFarGapScore = zeros(bestShLen, 1); bestSoFarGapScore(1) = shapelets(1, 3); bestSoFarRandIndex = zeros(bestShLen, 1); bestSoFarRandIndex(1) ...
clear all; clc; tic % SOLVER OPTIONS verbose = 1; tolerance = 1e-8; % OUTPUT OPTIONS ssave = 1; % Save the results ? pplot = 1; % Plot the results ? folder = 'SaveData/'; % If results saved, name of the saving folder nname = 'FastGradientD2.dat'; % Name of the file % MINIMIZATION PROBLEM SETUP L...
clc; clear all; close all; % Name of the company: Think Soft Research % Project Name: parabola % Date: Feb 8, 2019 % Time: 1:25PM x=-10:1:10 % x=input('enter the inputs='); Y=(x.^2); disp('parabola of y='); disp(Y); % subplot(2,1,1); plot(Y); xlabel('values of x'); ylabel('value of y'); title('parabola Y=X^2');
function obj = SignalObject__filter(obj,varargin) params = struct(... 'filterType', 'zeroPhase', ... 'cutoffs', [2.5 250], ... 'order', 2 ... ); params = parsestruct(params,varargin); signals = obj.data; fs = obj.fs; %{ validation %} assert(numel(params.cutoffs) == 2,'''cutoffs'' must be a two-elem...
% bootstrap returns a bootstrap draw of a table, grouped by indeces. function data2 = bootstrap(data, indeces) % create vector of unique indexes [~, g, c] = unique(data{:,indeces}); g2 = datasample(g,length(g)); data2 = table(); for i = 1:length(g) newdata = data(c==g2(i),:); newdata...
function [xyz] = convert_uvd_to_xyz(tx, ty, fx, fy, uvd) uvd = double(uvd); P = [fx 0 tx; 0 fy -ty; 0 0 1]; Pinv = [1/fx 0 -tx/fx; 0 1/fy -ty/fy; 0 0 1]; d = uvd(3, :); uvd(3, :) = uvd(3, :) ./ uvd(3, :); XYZ = Pinv * uvd; z = d; x = XYZ(1, :) .* z; y = -XY...
% razliฤni barvni prostori so koristni pri upragovanju ( v RGB ฤe ลพelimo modro izolirati iz slike - dele slike, % kjer se pojavlja modra barva) % b) I1 = imread('trucks.jpg'); figure(1); hold on; colormap gray; subplot(2, 4, 1); imshow(I1); % Draw RGB channels as separate subplots R = I1(:,:,1); G = I1(:...
close all; clearvars; clc; img = imread('ertka.bmp'); se = strel('square',3); imgErode = imerode(img, se); figure(1); subplot(1,2,1); imshow(img); title('Obraz originalny'); subplot(1,2,2); imshow(imgErode); title('Erozja z elementem strukturalnym square 3'); se = strel('sphere',2); imgErode = imerode(img, se);...
function g_open(filetype, filename, pathname) % g_open opens the specified file in Gooselab % filetype 0: guess, 1: video, 2: image, 3: project file, 4: sound file % filename name of the file without path % pathname path to the file global goose if nargin < 2 [filename, pathname] = uigetfile('*.*'); ...
n = [-10:10]; % Generate ints from -10 to 10 r = -3; % Offset of ramp function unit = n >= r; % Create unit impulse at n=r ramp = n.*unit + -1*r*unit; % Create ramp from impulse stem(n, ramp) %Plot Ramp
%%Mohammad Mahdi Heydari %%9423045 %%Matlab HW1 Communication Systems 1 close all; clc; clear; %%Q4 x = [zeros(1,9) 1+1i 2-2i 3+3i 4-4i 5+5i 6-6i 7+7i 8-8i 9+9i 10-10i]; y = [1+1i 2-2i 3+3i 4-4i 5+5i 6-6i 7+7i 8-8i 9+9i 10-10i]; y = conj(y); a = repmat(x,10,1); for n=2:10 a(n,:) = circshift(x,1-n) ; ...
% read cameraman.tif, compute gx and gy using imgradientxy and compute gmag and gdir using imgradiet img=imread('cameraman.tif'); [Gx,Gy]=imgradientxy(img,'sobel'); %Uncomment the code below to visualize Gx and Gy imshowpair(Gx,Gy,'montage') %Uncomment the code below to visualize Gmag and Gdir [Gmag,Gdir]=imgradient...
function [ flag ] = visibility_quickCheck( world, xStart, xGoal ) %VISIBILITY_QUICKCHECK This is a quick visibility check to determine if %there is an unobstructed path between xStart and xGoal. We do this because %the visibility of xStart and xGoal to the environment world are each %computed separately, but they neve...
function dataStruct = fun_processOneExperimentFile( fileFullPath,varargin ) % ๅŠ ่ฝฝๅŒ—ๅŒบ็š„ๅฎž้ชŒๆ•ฐๆฎๅˆฐdataStruct้‡Œ % ๆ–‡ไปถ่ทฏๅพ„ if 1 == length(varargin) varargin = varargin{1}; end baseFrequency = 10;%ๅŸบ้ข‘ allowDeviation = 0.5;%่Žทๅ–ๅ€้ข‘ๆ—ถๅ…่ฎธ็š„่ฏฏๅทฎ่Œƒๅ›ด๏ผŒ้ป˜่ฎคไธบ0.5 multFreTimes = 4;%ๅ€้ข‘1x,2x,3x semiFreTimes = 4;%ๅŠๅ€้ข‘0.5x,1.5x,2.5x nullShiftDataPath = [];%...
function y = approx_sqrt(x) y = x; while abs(y^2-x)>0.001*x y = (x/y+y)/2; end end
% chaos11.m % Dynamics of Linear and Nonlinear Systems. % PHASE PLANE ANALYSIS: Linear and Non-linear Systems. % A finite difference method is used to solve the paired coupled D.E. % The number of calculations needs is enormous for stability N ~ 60e6. % The simulation time not too large else solution diverges tMax. %...
function [esf, corr ] = XuGetESF(edgedata,resampling_interval) l_s_f = XuGetLineSpreadFunction(edgedata); l_s_f_resample = XuSpreadFunctionResample(l_s_f,resampling_interval); l_s_f_resample(isnan(l_s_f_resample)) = 0; esf = cumsum(l_s_f_resample(2,:))*resampling_interval; corr = l_s_f_resample(1,:);
function [working_region] = Task53 () %% TASK42 () does step response in Lab 3 % Draws step response tests to find working region %% getData clc, clear all, close all getdata %% Parameters % General parameters %sftp = @simulateFanToPlate; % Because I'm lazy umin = min(u_step); % Minimum test v...
function [net, info] = mynet_train(imdb, expDir,varargin) % some common options opts.train.batchSize = 80; opts.train.numEpochs = 80; opts.train.continue = false ; % If set to true training will start where it stopt before (to start from zero use false) opts.train.gpus = [] ; opts.train.learningRate = [1e-2*ones(1,2...
#Simulacioncita function simu1 V0 = 1200 temps = [0 700] #el arroba para que es? [t, V] = ode45(@fder,temps,V0) #ode45 es la funcion que resuelve ecuaciones diferenciales ordenarias #la ecuacion a resolver se especifica entre parentesis (fder) #luego se especifica el rango de valores de la variable depend...
function FR = FbApply2d( I, FB, shape, show ) % Applies each of the filters in the filterbank FB to the image I. % % To apply to a stack of images: % IFS = fevalArrays( images, @FbApply2d, FB, 'valid' ); % % USAGE % FR = FbApply2d( I, FB, [shape], [show] ) % % INPUTS % I - 2D input array % FB - filterban...
function [Q, M] = rotate_xyz (P, roll, pitch, yaw) % % function [Q, M] = rotate_xyz (P, roll, pitch, yaw) % % Rotate P of roll radian among x axis, then pitch (tilt) radians among y axis % and yaw (pan, head) radians among z axis. M is the rotation matrix, given % by M = Myaw * Mpitch * Mroll. % % Rotation matrix %%%%...
function has_map = has_aerospace_toolbox() if usejava('jvm') addons = matlab.addons.installedAddons(); has_map = any(contains(addons.Name, 'Aerospace Toolbox')); else has_map = ~isempty(ver("aero")); end end
function varargout = gridmeshToQuadmesh(x, y, varargin) %GRIDMESHTOQUADMESH Create a quad mesh from a grid mesh. % % Deprecated: replaced by surfToMesh (2012.10.25) % % [V F] = gridmeshToQuadmesh(X, Y) % [V F] = gridmeshToQuadmesh(X, Y, Z) % Converts the surface grid given by two or three coordinate arra...
function m_dB = margin_availability(avail) p1_margin =-log(avail); margin = 1/p1_margin; m_dB = dec2dB(margin); end
function [plx events] = readPLX(filename, syncChannel); plx = plx_info(filename,'all'); [unit ch] = find (plx(2:end,2:end)); for i = 1:length(ch) [ch(i) unit(i)] [ct events{i}] = plx_ts(filename,ch(i),unit(i)); end [ct events{i+1}] = plx_ts(filename,syncChannel,0);
% Author: Jinxin Yang % Parameters: check the legality of NT and Anginc % they should be int and >0 function isLegal = check_num(num) isLegal = false; if int32(num)==num && num>0 isLegal = true; end end
% ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| % INFORMATION % ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| % % Does multiple runs of the nonparametric permutation version of Spearman's % correlation between fitted parameter values a...
% test the cmmfile c++ mathematica matlab data file interface function in = test_cmm() %create some data out = {int32([1 2 3 4]) 'hello' [10.1 100.5; 6.6 5.4; 2.2 2.1] {'hello' 'world'; 'doll' 'iset'}} cmm_write_file('test_mat.dat', out) in = cmm_read_file('test_mat.dat') %return % n...
function compressionTest import io.*; import transform.*; import quantize.*; import motion.*; [~,~] = mkdir('Test'); [~,~] = mkdir('Test/compression'); infile = 'foreman_cif.y'; isCIF = true; qBins = 100; searchRange = 16; outfile = sprintf('Test/compression/test_lossy%d_%s.bit', qBins, datestr(now,'yy-mm-dd(HH;MM...
%% ฮ‘ฮ‘ฮ†ฮ˜ฮฮŒฮŸฯ clear x = imread('../test_image/lena.jpg'); imshow(x); y = x(128:138,128:138); figure,imshow(y); y
function [newpara,outputsize] = checkpara(para) newpara = para; inputsize = 39; outputsize = zeros(1,length(para)/2); j = 1; for i = 1 : 2: length(para) tmp = (inputsize - para(i) + 1) / para(i+1); tmp = round(tmp); if(tmp < 0) error('Kernel size is too large!');end newpara(i) = inputsize + 1 -...
function [ out ] = data_scale_new( in, minin, maxin, minval, maxval) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here in = in - minin; in = (in/(maxin - minin))*(maxval-minval); out = in + minval; end
%{ Let I be variables to update, O be other variables min x^T Q x / 2 s.t. A x = b L(x, y) = x^T Q x / 2 - y^T (Ax - b) + beta / 2 ||Ax - b||^2 Dx L = Qx - A^T y + beta A^T (Ax - b) Dx L = Q_I x_I + Q_O x_O - A^T y + beta A^T (A_I x_I + A_O x_O - b) = 0 We want P_I Dx L = 0 where P_I projects onto variables I P_I [-...
function [sx, sy, se, ys, ye] = r_lowess(x, y, varargin) % use robust loess to smooth the data in y w.r.t. x % % Arguments: % x, y - same length vectors % % Name/Value Arguments: % p - percent of points to consider. default = .1. % % Returns: % sx - sorted x values % sy - sorted smoothed y values % se - sorted lo...
function [errorcode] = epanetclose() %EPANETCLOSE - close the dll library % % Syntax: [errorcode] = epanetclose() % % Inputs: % none % Outputs: % errorcode - Fault code according to EPANET. % % Example: % [errorcode]=epanetclose() % Original version % Author: Philip Jonkergouw % Email: pj...
clear all hold on axis equal a1 = 0; b1 = 14; a2 = 1; b2 = 10; axis([a1 b1 a2 b2]) mu1 = [2,3]; sigma1 = [0.3,0.05;0.05,0.3]; r = mvnrnd(mu1,sigma1,1000); dataset = r; mu2 = [5,6]; sigma2 = [0.3,0.1;0.1,0.3]; r = [r; mvnrnd(mu2,sigma2,500);] dataset = [dataset;r]; mu3 = [5,3]; sigma3 = [0.3,0.0...
function [gene,tf,net_prob,gene_names,tf_names]=prepare_data6(filename,control) % control=0 % denovo network % control=1 % sush net %control=2 % motif net % control=3 %bind net %control=4 % comb motif and bind % determining gene_names and tf_names a=open('gene_names.mat'); gene_names=a.gene_names; b...
function celltest % testowanie dzialan na tablicach komorkowych z lancuchami i liczbami tabkom1={}; tabkom2={}; tab_kom={}; tabkom1={ 'tablica komorkowa 1-sza' 1.1 2.2 3.3; }; disp('tabkom1'); celldisp(tabkom1); cellplot(tabkom1); pause(10); % tabkom2={ 'TablicaKom Wiersz 3-ci ' 111.1 222 333; ...
function [ safetyLog ] = lineBasedClearanceService( file_name ) %Service that computes clearance of road given data % Detailed explanation goes here %% ==================== Part 1: Vehicle info ==================== wheelbase = 1.78; vehicle_width = 1.58; track = 1.3; %% ==================== Part 2: Compute Clearanc...
% Matteus Legat % clear clc format long ANS_X = "RESPOSTA DO EXERCรCIO X NO ENUNCIADO" gauss(); seidelrelax();
gscatter(pos3(:,1),pos3(:,2),L); axis off legend off saveas(gcf,'full.png')
function x = qnan %QNAN Return a quiet (non-trapping) NaN. % % QNAN is the IEEE arithmetic representation of a quiet (non-trapping) NaN % (Not-a-Number). % % See also NAN, INF. % Author: Peter J. Acklam % Time-stamp: 2002-03-03 13:18:26 +0100 % E-mail: pjacklam@online.no % URL: http:...
function out = sigview(varargin) %SIGVIEW Plot one or several signals. % % SIGVIEW(X), where X is a (possibly multidimensional) signal in the % structure-with-time format used by Simulink, plots the signal in a new % plot window. % % SIGVIEW(X,Y,...) plots several signals in the same window, in % differe...
clearvars; close all; % ๊ณผ์ œ 3 ์Šคํฌ๋ฆฝํŠธ ํŒŒ์ผ %% ํ”ผ์•„๋…ธ ์†Œ๋ฆฌ ํŒŒ์ผ ์ฝ๊ธฐ InputSignal = audioread('Piano_D#.wav'); %% Fast fourier transform (FFT) tic; Input_FFT = FastFourierTransform(InputSignal); toc; %x=1:131072; %plot(x,abs(Input_FFT)); %% Piano key recognition NoteNumber = recognizePianoNote(Input_FFT); % ์Œ ์ด๋ฆ„ NoteName = [{'C'}...
% read in image clear all; image=imread('rozmyte.jpg'); load('allObjectsMask.mat') test = 2; %% show binary contour mask of all %imshow(allObjectMask); % contour of all contourOfAll = bwperim(allObjectsMask, 8); figure; imshow(contourOfAll); %% recognize colors if test == 1 %cut out background of image noBackgr...
innerCells = [ 5 6 7 10 11 12 16]; innerCells = [innerCells innerCells+19 innerCells+19*2]; %% Initial simulation parameters numberUEs = 1425; numberCells = 57; epochDuration = 0.001; bandwidth = 20*10^6/2; clear TPcdf SINRcdf scountMat scount sampleSize = 30; totInnerTP = 0; datacontrolRatio = 14/11; %includes contr...
function [OuputMatrix] = pca_project(InputMatrix,TranformMatrix) % InputMatrix is matrix N(neurons) by T(time) data OuputMatrix = InputMatrix'*TranformMatrix; end
for t=0:dt:tfinal U=zeros(1,length(x));%ๆฏไธ€ๆ—ถๅˆป็š„่ดจๅ…ƒๆŽ’ๅˆ— for n=1:100 omegan=sqrt(n^2*omega0^2-b^2/4); U=U+2*A*omega*sin(n*pi*x0/l)/(lambda*l*(b*omega^2+(omega^2-omegan^2)^2/b))... *(-(omega^2-omegan^2)/(b*omega)*sin(omega*t)+... (omega^2-omegan^2+b/2)/(b*omegan)*exp(-b*t/2...
function generate_bar_graph(wo_data, w_data, x_str) % chehra_c = 'cyan'; deva_c = 'yellow'; intraface_c = 'green'; rcpr_c = 'magenta'; wo_our_c = 'blue'; w_our_c = 'black'; bar(1, wo_data(1), chehra_c); hold on; bar(2, wo_data(2), deva_c);...
load('Features.mat'); load('CW09B.mat'); load('CW12B.mat'); load('GOV2.mat'); load('MQ07.mat'); load('MQ08.mat'); load('MQ09.mat'); load('NTCIR.mat'); load('WSJ.mat'); load('FeaturesTerm.mat'); load('CollectionStats.mat'); STEMMERS={'KStem'}; TWS={'BM25' 'LGD' 'DFIC' 'DFRee' 'DLH13' 'DLM' 'DPH' 'PL2'}; MEASURES={'NDCG...
clc; clear all; close all; %% t=linspace(-5,5,101); rect=zeros(1,101); a=find(t==-2.5); b=find(t==2.5); rect(a:b)=1; subplot(311) plot(t,rect) xlabel('time/[s]') ylabel('amplitute') title('rect function') hold on [Xk,f0,Series] = cefs(rect,10,t); % plot(t,Series) % legend('Signal','FourierSeries') % hold on % % %...
function [p, sol] = runSpectralModel(p, sol, nSteps) % Initialize computation time p.tc = tic; % Initialize iterate and time if not already initialized if ~exist('p.iit'), p.iit = 0; end if ~exist('p.t'), p.t = 0; end % Initialize saving if p.dnSave ~= 0 && ~exist('p.saveCount') ...
function q = DiscriminationTask(varargin) % PSychophysics expeirment for UFlicker. The oberserver is presented with a % fixation point. Then the background moves and at some variable time % defined by objDelays the two patches appear on either side of the % fixation point. THe task is to identify the highest contrast...
function [X] = dtft(x,nx,w) % Computes Discrete-time Fourier Transform % [X] = dtft(x,n,w) % % X = DTFT values are computed at w frequencies % x = finite duration sequence over n % n = sample position vector % w = frequency location vector M = 250; k = -M:M; % k = 501 points X = x*(e...
function multiply = expos(x, n, nmin) [~,m] = size(x); result = eye(m); while n ~= 0 %verific daca n este par/impar %mai exact, daca cel mai din dreapta bit este 1 sau 0 if bitget(n,1) ~= 0 result = strassen_algorithm(result, x, nmin); %n devine par n = n-1; end %inmultesc pe x cu el insu...
% This script shows a sublevelset persistence example - Section 7.6 clc; clear; close all; import edu.stanford.math.plex4.*; %% Example: Random input filename='random'; M=rand(100,100); intervals_sub = sublevelset_persistence(M,filename)
function argc = argScriptFromStructure(P) %re-creates SMARTS295 input argument cell vector from structure % takes advantage of the fact that the order doesn't matter fn = fieldnames(P); n = 0; for k=1:length(fn) value = P.(fn{k}).Value; name = P.(fn{k}).Name; nV = length(value); if nV==1 ...
% DEIM - Discrete Emperical Interpolation Method %input % B - reduced basis of problem, obtained e.g by greedy algorithm function [U,P,p] = DEIM (B) % max of first basis vector [val, loc] = max(abs(B(:,1))); %initialize U,P and p r = length(B(1,:)); % rank U = [B(:,1)]; P = zeros(length(B(:,1)),1);...
function [z_a,Rphi,W,s_moment,solver_time]=RobustPortfolio(z, alpha, lambda) % -z is the data set. Each row corresponds to a time slot and each column an % asset % -alpha is the confidence level for which we want to consider the % uncertainty set % -lambda is the risk-aversion coefficient %%% % -Rphi and W is the sol...
function k = next_prime(n) n1 = n + 1; while n1 > n if isprime(n1) k = n1; break; else n1 = n1 + 1; end end
function [f,MX]=extension_to_zero(f,MX,n) % Extrapole the function to zero outside the domain % f : N x M % if nargin <3 n=10; end n_add= 2*n; n=n-2; N=size(f,1); d=length(MX); f=reshape(f,[N MX]); for k=1:d MX_ = MX; MX_(k)=[]; M_=prod(MX_); M_=max(M_,1); f = permute(f,[1 ndims(f)-d+1+mod((k...
function [beta,st] = aic_sol(x,y,b0,rang,itr) % rag is the range for searching the solution. Suggestion area from 0.5 to 2; [n,p]=size(x); [p,d]=size(b0); IR=floor(rang*100)+1; for i=1:IR % the searching range [beta,st] = spar_sol(x,y,b0,i/100-0.01,itr); g=DistCorrVec(x*beta,y); f = -2*log(g) + 2*d*...
function numgrad = Num_Grad(J,theta,epsilon) % Computes the numerical gradient given a theta vector and a cost function pointer % which uses theta as the only input % J(theta) should give the cost at theta if nargin < 3, epsilon = 1e-4; numgrad = zeros(size(theta)); perturb = zeros(size(thet...
clear;clc;close all; load no_zero.mat %load all node in the result---- parameter: no_zero load skel1.mat %parameter : skel1 [r,c,s]=size(skel1); result=zeros(r,c,s); tic; % Distance matrix D=distanceMatrix(no_zero); [n,~]=size(no_zero); connect_matrix=zeros(n,n); threshold_number=10; %Choose the numbe...
function test_Cohesive_Law_mixedmode_cl [material, epsilon, NumPoints] = Cohesive_test_input; % Number of steps in the displacement vector NumSteps=200; %---------------------------------------------------------------- % Test Mixed mode positive shear with normal compression loading %===================...
%================================================================% % Chris Park % CSCD 409, Homework 1 % <4-2-2016> % clc, clear, close all ; %Clear variables, plots, and console diary cparkHw1.txt %Diary text output. disp('Chris Park - CSCD 409 Homework 1') ; disp('This assignment was te...
clear all format long n = 4; %n = 8; %n = 12; %n = 16; xd = linspace(-1,1,1000); %%fff = exp(-(xd-0.5).^2); fff = 1 ./ (16.*xd.^2+1); x1 = -1+2*(0:n) / n; %%%f1 = exp(-(x1-0.5).^2); f1 = 1 ./ (16.*x1.^2+1); [coef1,~] = divdif(x1,f1); y1 = evalnewt(xd,x1,coef1); k = (0:n); x2 = cos(k*pi/n); %%%f2 = exp(-(x2-0.5).^2)...
function sortAND3results(resultPoint, name) flowCalResult = strcat('C:\Users\David Zong\Dropbox\Rice\Bennett Lab\Data\Hybrid Promoter\Flow Cytometer\Flowcal\', resultPoint, '\result.csv'); d = csvread(flowCalResult); inducerConc = [0, 1e-3, 1e-2, 1e-1, 1e0, 1e1]; inducer1 = reshape([inducerConc;inducerConc;inducerC...
function [udata, out_copula]= gauss_copula_transform(data, in_copula) udata = zeros(size(data)); for dim=1:size(data,2), if nargin<2||isempty(in_copula), [ecdf_ x]= ecdf(data(:,dim)); %the precision of the extreme value is half way between the last two %values myeps = (ecdf_(end) - ecdf_(en...
clear;clc;close all; f=@(t,y) -20*(y-t^2)+2*t; y1=-1/3; h1=0.005; h2=0.005; t=[0:h1:0.2 0.2+h2:h2:1]'; y=t.^2-exp(-20*t)/3; % analytical solution yrk4=runge_kutta_4(f,y1,t); yab3=adams_bashforth(f,y1,t,3); yab4=adams_bashforth(f,y1,t,4); yab5=adams_bashforth(f,y1,t,5); yam3=adams_moulton(f,y1,t); ytrp=trapezoid(f,y...
clear all; close all %This script calculates elevation distributions for both the control and %treatment experiment. This data is used to create Figure 2b %%First, lets set our relative path, we should have opened this file from cd '..\' %We should have opened this code from 'C:\Users\XXXXXXX\Documents\GitHub\TDWB_1...
function isNonSucesseful = errorReport(mFileName,category) %errorReport categorize the error report into several classifications GNATboxName = 'GNAT'; errorMsgID = [GNATboxName ':' mFileName ':' category]; % errorMsgID = [ mFileName ':' category]; if strcmp(category,'NotEnoughInput') errorDetailedMsg='Not enough n...
function [a, b] = get_ab(ang, harmonicX, harmonicY) ang = ang*pi/180; for i = 1:1:2 for j = 1:1:2 a(i,j)=harmonic_function(harmonicX(i,j).beta,ang); end end for i = 1:1:2 for j = 1:1:2 b(i,j)=harmonic_function(harmonicY(i,j).beta,ang); e...
function newRegion = pruneConnectedComponents(cc) newRegion = zeros(size(cc)); cc = logical(cc); cc = bwconncomp(cc); regions = regionprops(cc); toBePruned = []; for i = 1:length(regions) bb = regions(i).BoundingBox; regArea = regions(i).Area; % Aspect R...
function [XYZ, Edge, NN] = FindNN(XYZ,Edge,BoxWidth,MaxEdgeDist,MinEdgeDist) %% Find Nearest Neighbors % Given XYZ, a list of points, and % Edge, a list of known edges between points NN = zeros(size(XYZ,1),4); ed = size(Edge,1); BondType = 3; % amorphous bonds only implemented here disp('Finding existing nearest nei...
function saveTightFigure(H,file,crop) %SAVETIGHTFIGURE save the figure as file % Inputs: % H Figure handle % file Filename of output file if nargin<3 crop = [0 0 0 0]; end set(0,'currentfigure',H); if strcmp(get(gca,'Visible'),'on') set(gca,'units','centimeters'); pos = get(gca,'Position'); ...
function geconfig(hfig,evnt) %#ok gd=guidata(hfig); hf = figure('units','normalized',... 'position',[0.253 0.323 0.134 0.301],... 'menubar','none',... 'name','geconfig2',... 'numbertitle','off',... 'color',[0.925 0.914 0.847]); uicontrol(hf,'style','pushbutton',... 'units','normalized',... ...
% lung_nodule_marked function [net, info] = lung_nm_train(varargin) % CNN_lung_nm_train Demonstrated MatConNet on lung_nodule_marked % 1 matconvnet setup matconvnet_dir='H:\dataset\matconvnet-1.0-beta8\matconvnet-1.0-beta8\matlab'; run(fullfile(matconvnet_dir,'vl_setupnn')); % 2 information for data and others ...
%#url http://www.stat.duke.edu/research/software/west/hiwsim.html %#author Mike West
function [A, G, H] = get_AGH(y, config) % Return the gimbal frame axes given their initial configuration and the % current gimbal axes % Full matrices for 3D applications gamma = y(config.model.id.gamma); G = config.model.G0; H = config.model.H0*diag(cos(gamma)) + config.model.F0*diag(sin(gamma));...
% Workaround for a bug in MATLAB when in that exists(x, 'file') and exists(x, 'dir') give incorrect and inconsistent results function b = FileExists(x, folder); if nargin < 1 || nargin > 2; error('FileExists must have 1 or 2 input arguments'); end if nargin < 2; folder = false; end [d,f,e] = fileparts(x); if strcmp(d,...
%in barnamei baraye miangin giri az tasavir noisi ba noise gausian miangin0 varianse0.1 ast.BARAYE %EJRAYE BARNAME HAME BARNAME RA ENTEKHAB KARDE(Ctrl+A & Ctrl+C)VA DAR Command %Window MATLAB PASTE KONID. %tasvire vorudi clc; clear all; close all; %tasvire vorudi IMG_IN = double(imread('7.tif')); %ezafe kardane noise n...