text
stringlengths
8
6.12M
% n # no. of Bob's input or # of Alice's dits % d dimension of Bob's and Eve's output. % mode = 0 for unconstrained maximization, mode = 1 for maximization given % Bob's success is fixed to Pb, mode = 2 for security analyiis when success = Pb % OC = 0 for Spekkens' parity conditions, OC = 1 for even parity oblivious % ...
function [ output ] = applyFunctionOnFiles( path, funct, resultDir ) %APPLYFUNCTIONONFILES applies a given function to all .jpg files in path. % files = dir(fullfile(path, '*.jpg')); files = transpose({files.name}); if resultDir ~= '' resultingDirectoryPath = strcat(path,'\',resultDir,'\'); else resultingDir...
function [d_s,better] = beam_gen_swirl(RX_measure_report, Beam_index_report,RX_full_measure) %BEAM GROUP GENERATION SELECTING WEAKEST CLIENT FIRST load global_params_incr.mat; N_u = size(RX_measure_report,2); %Initial Solution = Only Finest Beams d_s_finest = 0; for b=1:1:Ncodewords_...
for i = 5:12 runContinuumCaseWithPenalty(1, 20, 10, 1/7, -0.1 * i, i, true); end
function nt = newton(fnc,x0,er) dfun=diff(fnc); f=subs(fnc,x0); df=subs(dfun,x0); c=1; x1=x0-f/df; ab=abs(x1-x0)/abs(x1) while ab>er x0=x1; f=double(subs(fnc,x0)); df=double(subs(dfun,x0)); x1=double(x0-f/df); ab=double(abs(x1-x0)/abs(x1)); c=c+1; end nt=x1 c end
% Machine Learning HW#3 % By: Seyed Mohammad Hossein Oloomi function monte_carlo() data = get(gcf,'UserData'); % Q(s,a) = 0 for all s in S, a in A(S) Qsa = zeros(data.rownum, data.colnum, 4); QsaCount = zeros(data.rownum, data.colnum, 4); % Random e-soft policy policy = zeros(data.rownum, data.colnum, 4); for i = 1 ...
function [X,T,X_te,T_te] = format_data(TD,np,N_tr,N_te) load MK30 %Load Mackey-Glass chaotic time series 5000 point MK30 = MK30+np*randn(size(MK30)); %Adding white noise mean 0 and std=np MK30 = MK30 - mean(MK30); %Substracting MK30 = MK30(1500:end); %...
% precompute operators for block with 16 for level = 2:7 xi = zeros(1, 6); ACell = {}; xi(1) = 1; [ACell{1}, f] = genOperators2D(@(X, Y)coeffFun2DBlocks6(xi, X, Y), level); for i=2:length(xi) disp(num2str(i)); xi = zeros(1, 6); xi(i) = 1; ACell{i} = genOperators2D(@(...
%% Plot Predictive Distribution of a KNN Classifer %#testPMTK load knnClassify3C figure; hold on; colors = {'or','ob','og'}; for c=1:3 plot(Xtrain(ytrain==c,1),Xtrain(ytrain==c,2),colors{c},'LineWidth',2.5,'MarkerSize',8); end set(gca,'box','on','LineWidth',2); title('Training Points','FontSize',12); legen...
function SE0P_warnings(key) % SE0P_warnings(['on' | 'off']) warning(key, 'FSE:OversamplingIncreased');
function [outputString] = getLayerTranslationString(layerNumber, W, R) currentTranslation = [0 0 0]; lengthR = length(R); lengthW = length(W); % comparing number of non-empty elements of R and W if(lengthR==lengthW) fprintf('R-W = 0, building translation string...\n'); for i=lengthR...
clc clear all close all im = (rgb2gray(imread('/Users/INNOCENTBOY/Downloads/videos/Imageprocessing/week6/original_cameraman.jpg'))); im = imresize(im,[256,256]); k1 = 1:1:size(im,1); k2 = 1:1:size(im,2); [k1,k2] = meshgrid(k1,k2); %% Filter h = (1/8)*ones(3,3); h(3,3)=0; l1 = h.'; vector_h = l1(:); vector_h = vector_...
% item_cpy.m val=get(h_lst1,'Value'); str=get(h_lst1,'String'); set(h_lst2,'String',str(val,:));
function fh = mlbAutoPlot(wins,losses,teams,region) %MLBAUTOPLOT plots the data for fh = figure; barh([wins,losses]) legend('wins','losses','Location','E') title(['American League Baseball - ',region,' - 2007']) xlim([60,100]) % Update the tick labels set(gca,'YTickLabel',teams)
function [stack,info] = aux_stackread(filename) %AUX_STACKREAD Read a stack of images (.tif) as a 3D matrix % [stack,info] = AUX_STACKREAD(filename) reads the stack named 'filename' % and returns a 3D double matrix 'stack' and the stack info 'info'. % % Input: % - filename: string containing the name of the sta...
function Y = uq_ishigami(X,P) % UQ_ISHIGAMI is a simple version of the ishigami function. % % See also: UQ_EXAMPLE_PCE_01_COEFFICIENTS, % UQ_EXAMPLE_MODEL_01_MODELDEFINITION, % UQ_EXAMPLE_KRIGING_ISHIGAMI % processing the parameters switch nargin case 1 a = 7; b = 0.1 ; case...
% Load the data, extracted from the text file and organized load data2000_organized % Define the wind speeds for the boundaries of the Saffir-Simpson scale SSscale = [39,74,96,111,130,157]; % Determine the category for each wind measurement % Set aside space ctgry = zeros(size(windSpeed)); % Loop over each measureme...
%% Set up Data clc clear %Input Data here Fs = 4000; n = 0:1/Fs:1; data = sin(2*pi*1000*n); % data = [1, -1, 1, -1, 1, -1, 1, -1, 1]; %% Test Data disp('Weak Definition DFT') tic FFT_S = MyOldDSP.weakfft(data); toc disp('KISS Cooley-Turkey FFT') tic [FFT_Result,f] = MyOldDSP.SuperFFT(data,Fs); toc disp('MatLAB FF...
function [ value ] = globalConfig( name ) % [ value ] = globalConfig( setting ) % returns global configuration value for string name % 'enableMeshCaching' : 1/0 enable/disable mesh caching % 'meshVersion' : mesh format version number if strcmp(name, 'meshVersion') value = 1; end switch name ...
% SETPOSITION set the position of the current playback % % [err] = setPosition(delayInSeconds) % % Parameter delayInSeconds is the delay from the start of the file or audio % data matrix measured in seconds. The output parameter is empty on success % or a string descibing an error. % % Examples: % % audiodata = r...
function [curr_x,curr_y]=check_2() fileid = fopen('Pb.txt','r'); filespec = '%d %d'; A = fscanf(fileid, filespec); fclose(fileid); curr_x=A(1); curr_y=A(2); end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 本函数用于将handle(1)对应的slider的value向下四舍五入后, % 传递给handle(2)对应edit的string %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function set_slider_num(handle) Num=get(handle(1),'value'); set(handle(2),'string', num2str(floor(...
clc clear close all I1=imread('amrit1.jpeg'); I1 = rgb2gray(I1); I1=imresize(I1,[900 643]); I2=imread('sherlock2.jpeg'); I2 = rgb2gray(I2); I2=imresize(I2,[900 643]); figure(1), imshow(I1,[0,255]) figure(2), imshow(I2,[0,255]) dft_1=zeros(size(I1)); mag_1=zeros(size(I1)); phase_1=zeros(size(I1)); dft_2=zeros(size(I1))...
function ind = chooseGoodComposition(tournament, POP) count = 0; goodComposition = 0; maxTime = length(POP)*10; while ~goodComposition toMutate = find (tournament>RandInt(1,1,[0,max(tournament)-1])); ind = toMutate(end); numBlocks = POP(ind).numBlocks; if ~isempty(numBlocks) %% for fix co...
%%%%%%%%%% Equilibrium data %%%%%%%%%%%%%%%%%%%%% equilibriumfile=[getenv('SFINCS_HOME'),'/equilibria/w7x-sc1.bc']; addpath ~/sfincs/sfincsProjectsAndTools/tools/Hakan/BoozerFilesAndGeom Geom=readBoozerfile(equilibriumfile); rind=24; %Geom.rnorm(rind) G=Geom.Bphi(rind); I=Geom.Btheta(rind); iota=Geom.iota(rind); B00=G...
function scaled_img=linearStretching(input_img,start_intensity,end_intensity,stretching_x) scaled_img=input_img; [R,C]=size(input_img); range=end_intensity-start_intensity; %Range of values whose value is not going to be 0 nor 255 for i=1:R for j=1:C if input_img(i,j)>=0 && input_img...
clear all; clc; % a3(wd_coefficient, n_hid, n_iters, learning_rate, momentum_multiplier, do_early_stopping, mini_batch_size) %% Question 1, without any training a3(0, 0, 0, 0, 0, false, 0) %% Question 2 a3(0, 10, 70, 0.005, 0, false, 4) %% Question 3 for learning_rate = [0.002, 0.01, 0.05, 0.2, 1.0, 5.0, 2...
% Kaja Coraor % Comp 590 % Assignment 4 % Load images numImages = 4; im1 = imresize(imread('1a.jpg'), 0.5); im2 = imresize(imread('1b.jpg'), 0.5); im3 = imresize(imread('1c.jpg'), 0.5); im4 = imresize(imread('1d.jpg'), 0.5); % Show images together space = ones(size(im1, 1), 5, 3); pair12 = [im1, space, im2]; % Manu...
function err = ... errorfun_spectralintegration7(V,IA_fullspec,IA_piece1,IA_piece2,ILD_piece1,ILD_piece2,IA_bestloc) %This function takes only ILDAlone mean arrays %errorfun_spectralintegration7(V,IA_fullspec,IA_piece1,IA_piece2,ILD_piece1,ILD_piece2,IA_bestloc) %V: variables to fit %IA_fullspec: ...
function [vert,index] = closestVertexEuclidean(rrt_verts,xy) dimensions = size(rrt_verts); N = dimensions(2); minimum = 0; vert = [0;0]; index = 1; for i = 1:N version1 = rrt_verts(:,i) - xy; version2 = version1; version2(1) = 2*pi - version1(1); if i == 1 minimum = min(norm(version1),norm(vers...
function [dFdy,fac] = Jacobian(F,y,Fy,thresh,fac,vectorized) % Initialize. Fy = Fy(:); br = eps ^ (0.875); bl = eps ^ (0.75); bu = eps ^ (0.25); facmin = eps ^ (0.78); facmax = 0.1; ny = length(y); nF = length(Fy); if isempty(fac) fac = sqrt(eps) + zeros(ny,1); end if(~exist('thresh', 'var') || isempty(thresh)) ...
% date numerice m = 4.81; l = 1.73; zeta = 5.33; g = 9.81; params.m = m; params.l = l; params.zeta = zeta; params.g = g; %% % implementarea modelului matematic in simulink si ilustrarea % raspunsului la o intrare treapta - model3.slx % magistrala params_info = Simulink.Bus.createObject(params); params_bus = eva...
function PatternTypeTwo_SFLA_result=PatternTypeTwo_SFLA_Find(FunctionName,TH_num,RunTimes,MAX_Iterations) % function PatternTypeTwo_SFLA_result=PatternTypeTwo_SFLA_Find(FunctionName,TH_num,RunTimes,MAX_Iterations) % The PatternTypeTwo_SFLA,proposed by Eusuff and Lansey in 2003,is try to minimize some optimization p...
% iseven(number) % % Returns whether or not a number is even. % % Note that both odd integers and non-integer numbers are "not even". If % you want to test whther something is an odd integer, specifically, use % ISODD % % 06.02.10 - S.Fraundorf % 06.30.10 - S.Fraundorf - return boolean rather than integer function it...
%% Stelling 25 % % Variabelen in Matlab mogen beginnen met een % willekeurig symbool. % Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
%解方程例3 图解法sin(x)=0.1*x close; fplot('sin',[-10,10]); hold on; fplot('0.1*x',[-10,10]); grid; zoom
%% HW 5.6.7 %% Initial-boundary-value Problem % * $v_t - v_x = 0, x \in (0, 1), t > 0$ % * $v(x, 0) = 1, x \in [0.4, 0.6]$ % * $v(x, 0) = 0, x \in [0, 0.4) \cup (0.6, 1]$ % * $v(0, t) = v(1, t), t \geq 0$ % * One Analytic Solution: $v = v_0(|\{ x + t \}|), v_0 = v(x, 0)$ %%% ts = [0.0, 0.5, 1.0, 2.0]; dx = 0.01; dt = 0...
function [catted] = horzcat_fields(structs, ensure_double) % Take a struct array and return one structure with all fields horizcontall % concatenated. if nargin < 2 % Ensure that horizontal concatenation makes all numeric values double % Otherwise integers take precedence on horzcat ensure_double = false; ...
clear all; % close all; % clc; % profile on; Config(); db = @(x)20*log10(x); functPlot = @(x)abs(x); theta = 0; Sys.pOrd = 2; Sys.hOrd = 1; Sys.k = 2*pi;%*1.5e9/299792458; Sys.z0 = 120*pi; Sys.kEinc = [cosd(theta) sind(theta) 0]; Mesh = IOrPoly('ModelScatteringSquare', 'q34a0.001A', Sys.hOrd, 1); % PlotMesh...
function [p] = proba_bis(input, ref, sigmaSquare_Epsilon,i) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here if i==0 p=1/sqrt(2*pi*sigmaSquare_Epsilon)*exp(-((input-(2*ref-1))^2)/(2*sigmaSquare_Epsilon)); %ref =0 if the symbole is -1 and is equal to 1 if the symbole is +1 else if...
function theta = thetafunct(t,td) % if t>=td+0.5 % theta = 90; % elseif t>=0.5 % m = 90/(t-0.5); % theta = m*t; % else % theta = 0; % end theta = (45*(1 + tanh((t-td)/.05)))*pi/180;
function img = eliminaObiect(img,ploteazaDrum,culoareDrum) imgInitiala = img; imshow(img) rect = getrect; close(gcf); xmin = round(rect(1, 1)); ymin = round(rect(1, 2)); xmax = round(rect(1, 3) + rect(1, 1)); ymax = round(rect(1, 4) + rect(1, 2)); if xmin <= 0 xmin = 1; end if ymin <= 0 ymin = 1; end [y, x, c]...
function output = avg_hop_dist(varargin) output = feval(varargin{:}); function output = init global rsc output = -1; function output = caption global rsc core('html_print', ['<p><b>Mote Versus Average Hop Histogram</b>']); core('print_br');; output = -1; function pic_name = graph global rsc output{1}...
%% main addpath('fcns') k_w = 1; k_t = 1 [N,s,M,Nq] = getParams(); %% initial guess z0 = 0.1; alpha0 = [3 6 9 12 15]; T_st0 = 0.1; q0 = [-0.5738*ones(1,N),-2.3664*ones(1,N)]; dq0 = zeros(1,2*N); x0 = [z0 alpha0 T_st0 q0 dq0]; % initial condition %% bounds Lbalpha = [0 1 1 1 1]; Ubalpha = [100 300 300 300 300]; G...
function x = CVC( src_data, weights, wSize, K ) % ------------------------------------------------------------------------- % An implementation of "Contextual and Variational Contrast enhancement." % T. Celik and T. Tjahjadi, "Contextual and variational contrast % enhancement," IEEE Trans. Image Image Process., vo...
fprintf('\n----------------------------------------------------------\n') fprintf('%s:: Clear environment path.\n', mfilename); rmpath( genpath( 'lib' ) ); rmpath( genpath( 'NdgCell' ) ); rmpath( genpath( 'NdgMesh') ); rmpath( genpath( 'NdgEdge') ); rmpath( genpath( 'NdgPhys') ); rmpath( genpath( 'Utilities') ); rmpath...
% MNIST Matlab demo % matcaffe needed clear caffe_root = '../../caffe/'; %add matcaffe to matlab path addpath(genpath([caffe_root,'matlab/'])); %use gpu use_gpu = 1; % Set caffe mode if exist('use_gpu', 'var') && use_gpu caffe.set_mode_gpu(); gpu_id = 0; % we will use the first gpu in this demo caffe.set_devi...
% This function generates the output for the HED tag validation warnings. % % Usage: % >> warning = generateWarningMessage(type, line, tag, units); % % Input: % % type The type of warning that is generated. % % line The line that the warning was generated on. % % tag The tag o...
function norm = normalize(img) a = 0; b = 255; c = min(img(:)); d = max(img(:)); norm = (img - c).*( (b-a)/(d-c) );
function [Q,r] = mult_div(f,F,ffmp,order) s = length(F); r = ffmp.zero; p = f; for i = 1:s Q{i} = ffmp.zero; end while ~isequal(p,ffmp.zero) divisible = 0; ltp = ffmp.lt(ffmp,p,order); for j = 1:s ltf = ffmp.lt(ffmp,F{j},order); [div,rem] = ffmp.mon_quo(ffmp,ltp,ltf); if isequal...
w=0.1:0.1:10000; clc; Kl=1; Tl=2.2*10^-4; Kx=4*10^-4; Ex=0.2; %Всего 3 варианта Tx %Для M1-M18 Tx: 7 * 10^-4, 1.1*10^-3, 1.2*10^-3 %Для M19-27 Tx: 0.69 * 10^-3, 1.15 * 10^-3, 1.25 * 10^-3 %Tx=0.7e-3; %Tx=1.1e-3; Tx=1.2e-3; Kgp1=3508; Kgp2=615.6; Kdv=19300; Ip=0.1; Il=0.00167; W7=tf([Kl],[Tl 1]); W8=tf([Kx],[Tx^2 2*Ex...
%Load cameras from function [vid video_input] = resetCameras; %% Load thermal probes (DS18B20 via Arduino) a = arduino('COM8', 'Uno', 'Libraries', 'PaulStoffregen/OneWire'); sensor = addon(a, 'PaulStoffregen/OneWire', 'D2'); therm1 = sensor.AvailableAddresses{1}; therm2 = sensor.AvailableAddresses{2}; %% Test loop co...
load('DistrictsViz.txt'); load('TimeslotsViz.txt'); load('RidesViz.txt'); scatter3(DistrictsViz, TimeslotsViz, RidesViz,[], RidesViz); title("Number of Rides for Start District and Time Slot"); xlabel("District"); ylabel("Time Slot");
function[exp_coverage, active_count] = delta_soc_2(G, init_active,p, full_soc, niter, install) %{ Same as delta_soc with different definition on immunzation In this model, a node that is immuzited can still spread information however, it cannot be infected with a virus that resets it's time-to-live counter %} out = z...
function Res_score = func_getScore(T,Nums,signalType) % %% haifen's code % % global signalType; % nICM = Nums(1); % nPE = Nums(2); % nEPI = Nums(3); % % Res_score = 0; % % % if signalType==2 % % toICM = T(:,1:nICM); % % toPE = T(:,nICM+1:nICM+nPE); % % ...
function [maxRad,maxRadOrigin]=maxCircleInConvexPoly(xPoly,yPoly,shrinkage) % 07-17-20 Mitchell Tillman %% WORKS FOR 2D CONVEX SHAPES ONLY!!! % %% Overview: % "Inflates" (translates and increases size) multiple "balloons" (circles) through an iterative process % incrementing along the vectors that bisect two sides u...
% Simulate Geometric distr. Geo(p) variables, using the Discrete % % Inverse Transform, i.e. X = ceil(ln(U)/ln(1 - p)-1). clear all p = 0.5; err = 1e-02; alpha = 0.05; N = ceil(0.25 * (norminv(alpha / 2, 0, 1) / err) ^ 2); fprintf('Nr. of simulations N = %d \n\n', N) for i = 1 : N X(i) = ceil(log(1 - rand)/log(1 ...
clear; close all; clc; %% TEST % Assert that the full Elastic Net model and Ridge Regression are equal n = 100; p = 25; X = normalize(rand(n, p)); y = center(rand(n,1)); beta_en = larsen(X, y, 1e-9, 0, [], false, false); beta_ridge = (X'*X + 1e-9*eye(p))\X'*y; assert(norm(beta_en - beta_ridge) < 1e-12)...
function tform = projective_tform(points) % Riordina i punti in senso anti-orario. convex = convhull(points); movingPoints = points(convex(1:4), :); fixedPoints = [0 0; 1 0; 1 1; 0 1]; % Costruisci la matrice di trasformazione prospettica. tform = fitgeotrans(movingPoints, fixedPoints, 'pr...
close all clear all % indexPath = '.\pick_indexs_radom_1025.mat'; index = load(indexPath); pick_indexs = index.pick_indexs; n_data = size(pick_indexs, 2); global result % init myData label_results = cell(1, n_data); tem_labelResults = struct(); result.tem_labelResults = tem_labelResults; result.label_results = labe...
function [ ] = saveEpsFigForPaper(hFig, fullPathToSaveFig, flagFixTicks) %SAVEEPSFIGFORPAPER Save an .eps version for figure hFig at %fullPathToSaveFig. % % Note: In order to use export_fig, one needs to install ghostscript at % http://www.ghostscript.com % and manually locate pdftops (if asked) at % NistMe...
function runFuncBlockScan2(params,varargin) % General script to run a block design fMRI experiment. % Allows you to adjust the block length and stimulus length by % adjusting the first few parameters. The stimuli should be saved in a % separate directory for each condition. % % I am working on...
function y = ctoy(C) %------------------------------------------------------------------------------------ % Usage: % y = makeclassindex(C) % % Input: % C: vector of indices giving the number of samples per class % % Output: % y: n dimensional vector of class labels %------------------------------------...
function filelist=ls2list(filter) % ls2list creates a list of files that meet the filter requirements % filelist=ls2list(filter) % filelist= matlab list of the files that match the filter requirements. % filter= string to used with unix ls command to select files. % Note: This is unix dependant code. if nargin<1, filt...
clear all close all clc % SEAS1001 MATLAB Problem Set 1 % Melody Lee 9/8/17 %% Problem 1 p = [1 9 -37 -357 -36 1620]; r = roots(p) %% Problem 2 A = [1 2 0; 2 5 -1; 4 10 -1]; B = [20; 46; 95]; X = inv(A)*B C = [13; 24; 53]; X2 = inv(A)*C %% Problem 3 Y = sin(cos(exp(log(25)))) + (100 * ((55/7) - (1000 * tan(....
clc clear all close all x = [158,151,157;151,153,150;158,151,157]; x1 = [158,21,157;151,22,150;158,23,157]; var = (sum(sum((x-mean2(x)).^2))); var1 = (sum(sum((x1-mean2(x1)).^2))); v1 = 1/var; v2 = 1/var1; % % a =2; % b = 2; % c = conv2(a,b); % d = a*b; % h = (1/8 )*ones(3,3); % h(3,3)=0; % h = h*c; % e = fft2(h...
function [hNew,hGen]=testErgodicHMMGMM %test HMM design, %using GaussMixD output distributions %Arne Leijon 2009-07-21 tested c='rbgk';%state color coding, max 4 states %ergodic generator HMM: % nStates=2; % A=[.95 .05; .05 .95]; % p0=[0.5;0.5]; nStates=3; A=[.98 .01 .01; .01 .98 .01;.01 0.01 0.98]; p0=[1;1;1]; mc=Ma...
function session = demo_response(session) trials = length(session.x); neurons = length(session.x(1).spike_times); for t=1:trials flashes = length(session.x(t).flash_time); if strcmp(session.x(t).trial_type, 'ball_strikes') & (flashes > 0) for f=1:flashes time = session.x(t).flash_time(f); xpos = ...
function t = CheckUserType(user,Dataset) %in tasbe barresi mikonad ke Aya yek user %P(positive),N(Negative),I(Inactive) ast ya kheir chk=ismember(user,Dataset(:,1)); %Inactive User=0, Positive User=1 ,Negative User=-1 ru=0; related_Users=0; if(chk==0)%karbar inactive ya I ast ...
function [Position] = SortNoteHeads(NoteHeadsPos,StaffLinesPos, Length, BW) %Set the positions of the different notes NotePositions = zeros(1,20); NotePositions(1,1) =StaffLinesPos(1,1)-Length*3; NotePositions(1,2) =StaffLinesPos(1,1)-Length*3+Length/2; NotePositions(1,3) =StaffLinesPos(1,1)-Length*2; NotePositions(1,...
function [pointX, pointY] = breadthSpot(imageGS, spotX, spotY) if (spotX == 0 || spotY == 0) breadthX = 0; breadthY = 0; return; end pxH = length(imageGS); pxW = length(imageGS(1, :)); breadthX = spotX; breadthY = spotY; pointX = 0; pointY = 0; flag = ...
function nextyBuff = IIR_filter(yBuff, aCoeff, x) a0 = a(Coeff1); a1 = aCoeff(2); a2 = aCoeff(3); %Filtrado por ecuación de diferencias output = a1*yBuff(1) + a2*yBuff(2) + x; %Actualización del Buffer para siguiente señal de entrada yBuff(2) = yBuff(1); yBuff(1) = output; ...
function Integral = ContinuousSimpsonsRule(Function,Start,End,Intervals) error(nargchk(3,4,nargin)); if(nargin == 3) Intervals = 1; end IntervalSpacing = (End - Start) / (Intervals) ; SubIntervalSpacing = 0.5 * IntervalSpacing ; Values = Start : SubIntervalSpacing : End ; Ph...
%Generowanie map bitowych z cyferkami %Raz wygenerowane literki są wielorazowego użytku, zatem %wystarczy je wygenerować tylko raz i umieścić np w pliku .mat!!!! literki = createCharMaps('Helvetica', 14, 1, 1); rysunek = zeros(200,200); %liczby = [ 12 43243.5322 432432 432 0.4324343243 52342 ]; %liczby = ...
function [columnNames, data] = mocapManuelRead(fileName) % MOCAPMANUELREAD Read in data which has column titles in the first line and separated values in each other line. if nargin < 2 separator = ','; end fid = fopen(fileName); numMarkers = str2num(fgetl(fid)); numLines = str2num(fgetl(fid)); framesPerSecond = ...
%function [n0,N0]=modifyHilbert3D_BlockDeformation(n,k0,k,H,p2s) H=88; k0=3; k=6; W=64; p2s=[1 2 4 8 16 32 64 128 256 512 1024 2048 4096]; %Find the 'base square': ----------------------------------------------------------- load H3L3 %m=double(H3cutted(3,3,n)+1)'; n=m; n=n'; m(1,:)=n(2,:); m(2,:)=n(3,:); m(3,:)=n...
function visualizeT(kp,T) % % plot T's PDF on the Extended alpha-beta hemisphere % if isempty(kp) %generate the standard mesh if size(T,1) == 9 T = vectorizeT(T); elseif ~(size(T,1) == 3 && size(T,2) == 3) error('unrecognized input T'); end n = 1000; [x,y,z] =...
function ImageInfo=UpdateImageProperty(DataFormat) if ~isempty(DataFormat.XStartV9) ImageInfo.XStart=DataFormat.XStartV9; ImageInfo.StartV9=1; else ImageInfo.XStart=DataFormat.XStartV8; ImageInfo.StartV9=0; end if ~isempty(DataFormat.YStartV9) ImageInfo.YStart=DataFormat.YStartV9; ...
clear; load('RobotRecordData.txt'); data1=RobotRecordData(:,1); plot(data1); figure data2=RobotRecordData(:,2); plot(data2);
close all; [rc, sc, a, bits, wc, sigma2_a, N0] = QPSKtransmitter_random(100, 11, 1e5, 1e8); t0 = 33; [rr, rr_sampled, gm] = matched_filter(rc, t0); [qc_b, qc_a, qc_length] = transmitter_tf(); qc = impz(qc_b, qc_a, qc_length); figure; subplot(1,2,1); stem((-length(gm)+1:0) + t0, gm); subplot(1,2,2); qR =...
%******************* %% UNIT CELL %**************** L1=0.3; L2 =0.4; %******************* %% DASHBOARD %**************** % Nx = 200; % Ny = 200; dx = 1/Nx; dy = 1/Ny; xa = [0:Nx-1]*dx; xa = xa-mean(xa); ya = [0:Ny-1]*dy; ya = ya-mean(ya); x0=0;y0=0; [X, Y] = meshgrid(ya, xa); %******************* %% UNIT...
function out = tmp_read(fname, conf) % TMP_READ -- Read contents of the tmp text file. % % out = ... tmp_read() reads the file 'tmp.txt' in % `conf.PATHS.job_output`. % % out = ... tmp_read( 'tmp1' ) reads the file 'tmp1' in the above % directory. % % out = ... tmp_read( ..., conf ) uses the conf...
function output = mySTFT(audio, blockSize, hopSize, plot) % [X, Fs] = wavread(audio); Y = audio; L = length(Y); nHops = (L-blockSize)/hopSize; startIndex = 1; for i = 1:nHops output(:,i) = abs(fft(Y(startIndex:startIndex+blockSize-1))); startIndex = startIndex + hopSize; end if plot == 1 t = 1:blockSiz...
close all; clear all; code_folder = pwd; exp_folder = 'D:\GoogleDrive\retina\Chou''s data\MB'; cd(exp_folder) XOwf =0; XOdark = 0; direction = 'RL'; sorted =0; special = 0; num_peak = 1 if XOwf HMM_former_name = '0224_OU_G'; HMM_post_name = ['_5min_Q100']; OU_former_name = '0224_OU_wf_G'; OU_post_name =...
function varargout = nonlinear(varargin) % NONLINEAR MATLAB code for nonlinear.fig % NONLINEAR, by itself, creates a new NONLINEAR or raises the existing % singleton*. % % H = NONLINEAR returns the handle to a new NONLINEAR or the handle to % the existing singleton*. % % NONLINEAR('CALLBACK',hO...
function y = optim_parabolic(func, lower, upper, max_iter, max_error) % Finds the maximum of a one-dimensional function between % two bounds using the parabolic interpolation approach. % The inputs are the function(anonymous), lower and % upper bounds, maximum number of iterations, and the maximum % relative erro...
function a = tl_acq_drawTrialAssignments(n,p) % n: number of assignments % p: 1x4 vector with probabilities % a: 1xn vector with assignments x = rand(1,n); p = p/sum(p); e = [0 cumsum(p)]; [~,a] = histc(x,e);
function [c2n,ptr,z]=de_2n_code(bin,len,thd,ptr) n=log2(thd); [z,ptr]=de_z0(bin,len,ptr); lenw=sum(z); lenk=len-lenw; if n>=1 flg=bin(ptr); ptr=ptr+1; if flg==1 %fprintf('\naaaaaaaaaaa\n') [zk,ptr]=de_z0(bin,lenk,ptr); if n>1 [ck,ptr]=de_2n_code_sub(bin,n-1,zk,ptr); else ...
function [y] = fitPoly2d(x, n, mask, vsz) %FITPOLY2D Fit 2d polynomial of order n to 3d multi-echo data % % [y] = FITPOLY2D(x, n, [mask], [vsz]); % % Inputs % ------ % x multi-echo data, 3d/4d array. % n order of polynomial to fit. % % mask binary mask of voxels to include in fit....
function M = nmodeM_3(in1,in2,in3,g,in5,in6,in7) %NMODEM_3 % M = NMODEM_3(IN1,IN2,IN3,G,IN5,IN6,IN7) % This function was generated by the Symbolic Math Toolbox version 8.1. % 11-Dec-2018 13:25:26 I1 = in1(1,:); I2 = in1(2,:); I3 = in1(3,:); L1 = in2(1,:); L2 = in2(2,:); d1 = in3(1,:); d2 = in3(2,:); d3 = in3...
function fitness = EvaluateIndividual(weights, thresholds, dataSet) %Limits minVelocity = 1; maxVelocity = 25; maxTemperature = 750; maxSlope = 10; if (dataSet == 1) numberOfSlopes = 10; else numberOfSlopes = 5; end slopeOrder = randperm(numberOfSlopes); fitnessVector = zeros(numberOfS...
function [upcount,downcount] = ContinTrend(bars, tol, uppercent, downpercent) % v0.0 by Zehui Wu % v1.0 by Yang Xi % 通过连涨连跌来表现出市场的趋势状态 % tol表示可以容忍的反趋势个数 % uppercent表示连涨所要求的最低上涨率 % downpercent表示连跌所要求的最低下跌率 % 返回值 upcount downcount的第一列记录实际上涨或下跌天数(去除回撤)第二列记录趋势的起点 第三列记录趋势终点 open = bars.open; close = bars.close; ntotal = le...
function plotClassROC(tag,prob,N) %plotClassROC %by Pan Zeng %email:q64545@sina.com %2015,11,4 %% %tagΪ²âÊÔ±êÇ©(ÁÐÏòÁ¿)£¬probΪԀ²âµÄÿһÀàµÄžÅÂÊ£¬NΪROC»æÍŒãÐÖµ²ÉµãÊý£¬·¶Î§Îª[0,1] %p_0ΪãÐÖµ p_0=linspace(0,1,N); %ÏÈÇó³öÒ»¹²ÓжàÉÙÀ࣬ÓÃn±íÊŸ£¬²¢ÓÃprobClassi±íÊŸµÚiÀàµÄÑù±Ÿ·ÖÀàžÅÂÊ,tagi±íÊŸµÍiÀ౟µÄÕýÈ··ÖÀà [l,n]=size(p...
%% Data processing for headplot generation %by: Julian Y. Cheng 12/19/2012 % %Adapted from SC script "Headmap.m" for MC/PC % %This script conditions the ERSP outputs from the wavelet analysis to %produce datasets that can be plotted directly or can undergo permutation %(bootstrapping) before plotting. %% Extract el...
function [GNCout] = ChooseSensors_2types(GNCin) % GNC = ChooseSensors(GNC) % Generates all possible architectures with combinations of sensors of type % A, B or C global SENSORS M_SENS j = 1; for i = 1:length(GNCin) if GNCin(i).NS == 1 for sen = 1:2 GNCout(j) = GNCin(i); ...
%% sVBM_config % Sets up paths that will be used by sVBM_setup using the second revision of the % pipeline. Create a copy of this file to make edits to for a specific data % set. %path to data: (set scan data folder where image were placed using %image_finder.sh) scandatafolder = '/mnt/macdata/groups/rosen/longitudi...
function INVCDFX = uq_invcdfFun(F, Type, varargin) % UQ_INVCDFFUN returns the inverse CDF values of the CDF values of samples % of a random vector given the distribution it follows and the distribution's parameters switch lower(Type) case 'constant' %do nothing case 'gaussian' ...
Cauchy = zeros(3,3); %define cauchy stress tensor Cauchy(2,2) =BStress(9.81*100*0.246,0.014,ICT(0.028)) ; %if only diagonals non zero then product of diagonals is det... det = o non real solutions %Cauchy(1,2) =SStress(9.81*100,0.025,IRT(0.05,0.02,0.002)); %Cauchy(2,1)= Cauchy(1,2) Cauchy(2,3) = (9.81*...
function [ ] = parsave(absPathToSave, varargin) %#ok<INUSD> %PARSAVE A helper function to enable save in parfor loops. % % Inputs: % - absPathToSave % The absolute path for saving the variables. % - varargin % The variables to be saved. % % Note: % all the inputs should be independent and complete variabl...
function [x_traj, u_traj, cost_traj] = ddp_ddr(params, state, goals, init) % ddp: Differential Dynamic Programming for Differential Drive Robot % ACRL Homework 3 - Spring 2019 - Caleb Harris l = params.length; w = params.width; wb = params.wb; l_rad = params.l_radius; r_rad = params.r_radius; d_theta_nom = params.d_t...