text
stringlengths
8
6.12M
function res = isOver(array) count = 0; for i=1:length(array) if (array(i).in_play == false) count = count + 1; elseif ((array(i).vx < 0.1 && array(i).vy < 0.1)) count = count + 1; end end %count if (count == length(array)) res = true; ...
%function to select flights that have similar rate of change per variable function ind_res = selectFlights(rates) [K, N] = size(rates); ind = true(K, N); for i=1:K D = rates(i,:); % ITS BETTER OT USE obj = gmdistribution.fit(D',2); edges = 0:100; step = 1; %max allowable difference betwee...
% Copyright (c) 2020, Alexander Huntley % All rights reserved. % % Redistribution and use in source and binary forms, with or without % modification, are permitted provided that the following conditions are % met: % % * Redistributions of source code must retain the above copyright % notice, this list of co...
function [Low_tracks_out] = TrackletsMergeMultiCamera_V2(TrackletsCamAll,ParaStructMultiCam) % duration criteria: 1)startpoint and endpoint threshould;2) duration % threshold % IoU criteria: 1) the difference between the most and secondly related % IoU ThreM(1); 2) the most related IoU > ThreM(2) % Low_tracks...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 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 [ctrl] = optMPC_c(Ad,Bd,Cd,Q,R,Qs,N,Ts) nx = size(Ad,2); nu = size(Bd,2);ny = size(Cd,1); u = sdpvar(nu, N, 'full'); x = sdpvar(nx, N+1, 'full'); y = sdpvar(ny, N, 'full'); w = sdpvar(ny, 1, 'full'); u_prew = sdpvar(nu, 1, 'full');s = sdpvar(ny, 1, 'full'); u_min = zeros(n-1,1); u_max = 127*ones(n-1,1); y_mi...
% Parameters defining experiment setting conf.NREPETS = 100; % Number of executions % Parameters defining the data generation (in @genDataInterp) conf.data.N = 2^7; % Signal length conf.data.Q = 15; % Impulse response length conf.data.typeNoise = 1; % 1: Gaussian noise, 2: Uniform, 3: Laplacian % Par...
function [Li, Lsig, Lmiu] = shot_detect(start_ind, end_ind, img_format, img_path, n) % 1. start_ind and end_ind are the starting and ending images, so we can trace % all of the images in a path % 2. img_path is a path containing all the images % 3. img_path is the image format % 4. n is the size of a n*n block for each...
function spikesort(filenames, readNewUnits) % This is the machine-generated representation of a Handle Graphics object % and its children. Note that handle values may change when these objects % are re-created. This may cause problems with any callbacks written to % depend on the value of the handle at the time the ob...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % To run: Edit user options in mtfcalc.m and execute the code. % % This code is intended to accompany the paper: % % S. N. Friedman, G. S. K. Fung, J. H. Siewerdsen, and B. M. W. Tsui. "A % simple approach to measure computed tomography (CT)...
function Mask = FiberMask(SP,W) load(SP) dim = IMS.Dim; [m n] = size(IMS.Gray); pixdim = dim/m; FW = ceil(W/pixdim); Mask = ones(FW*2,FW); Mask = [zeros(FW*2,round(FW/2)) Mask zeros(FW*2,round(FW/2))]; [mm nn] = size(Mask); Cen = floor(([mm nn]+1)/2); disp(Mask) end
% Henrik Grønbech; https://projecteuler.net/problem=3 function total = p003() n = 600851475143; biggest_factor = 2; while n > 1 for i = biggest_factor:(mod(biggest_factor, 2)+1):n if mod(n, i) == 0 n = n / i; biggest_factor = i; break ...
function[MRE,Cz]=runPCE(source,r0,IM,im,Nreal,ellip,hparam) pd = makedist('Normal'); t = truncate(pd,-2,2); zrnd = random(t,1,Nreal); gmpe = source.gmm; NIM = length(IM); Nim = size(im,1); NMmin = source.NMmin; gmpefun = gmpe.handle; switch source.obj case 1, [param,rate] = param_circ(r0,s...
function varargout = SearchNumberPlateMannully(varargin) % SEARCHNUMBERPLATEMANNULLY MATLAB code for SearchNumberPlateMannully.fig % SEARCHNUMBERPLATEMANNULLY, by itself, creates a new SEARCHNUMBERPLATEMANNULLY or raises the existing % singleton*. % % H = SEARCHNUMBERPLATEMANNULLY returns the handle to a...
function M1 = generate_constrained_map(M,nb_theta,obj,theta_max) % generate_constrained_map - generate a constraint map from a 2D map. % % M1 = generate_constrained_map(M,nb_theta,obj); % % M is the 2D map (binary image, 0 for background, 1 for objects). % M1 is a 3D array, M1(:,:,k) is the 2D map for ori...
warning('off','all'); % data sets to segment datasets_names = {... 'DIARETDB1\train' ... 'DIARETDB1\test' ... 'e-ophtha' ... 'MESSIDOR' ... }; % scale to downsample (it is expected that all the images in the data sets % has approximately the same resolution) scale_to_downsample = [ ... ...
function MPI_Send( dest, tag, comm, varargin ) % MPI_Send - Sends variables to dest. % % MPI_Send( dest, tag, comm, var1, var2, ...) % % Send message containing variables to dest with a given tag % % dest can be an iteger from 0 to comm_size-1 % tag can be any integer % comm is an MPI Communicat...
% orden convergencia del metodo rk4 haciendo el cociente de errores % para una sola ecuacion [t1,y1]=rk4('y',0,1,1,100); error1=abs(exp(t1)-y1); e1=max(error1); [t2,y2]=rk4('y',0,1,1,200); error2=abs(exp(t2)-y2); e2=max(error2); da=e1/e2; % esto seria 2 elevado a alfa...asi que alfa alfa=log2(da) ...
function ramp = readramp3Hz(varargin) %READRAMP3HZ - Read a binary ramp input file for SLS 3Hz Powersupplies % % INPUTS % 1. Filename {optional} % % OUPUTS % 1. Ramp - Booster ramp read from binary file % % See also write_ramp3Hz % % Written by Laurent S. Nadolski %% Default flags DisplayFlag = 1; AbcissaUnit = 80...
function ParamStruct = QuarterCarInit(side) %% SLAGeometryData % % This file contains all the kinematic and dynamic parameters % necessary to define the LEFT FRONT double wishbone - or short % long arm - suspension corner for a generic automobile. % This file needs to be loaded before running a simulation % wit...
function BC = createBC3D(meshvar) % Creates a boundary condition structure from a mesh structure % for a 3D structured mesh. The default boundary conditions on % all boundaries are Neumann; % The values of each boundary condition are defined as: % BC.<position>. : % a, b, c, where % a*grad(phi).e + b*phi ...
function color_rgb = dark_gray color_rgb = {'color', [0.66274, 0.66274, 0.66274]}; end
%Hannah Director %Prelim Exam, file conversion steps addpath('/users/hdirector/Documents/prelim/prelim/MatlabCode/Figs124') load drifterbetty2.mat save('/users/hdirector/Documents/prelim/prelim/Code/drifterbetty2.mat', '-v6') addpath('/users/hdirector/Documents/prelim/prelim/MatlabCode/Fig5') load newinertial.mat save...
function [] = plot_all_mms_B(jt,bx_int,by_int,bz_int,sc) for i = 1:sc plot(jt,bx_int(:,i),'r') plot(jt,by_int(:,i),'g') plot(jt,bz_int(:,i),'b') % plot(jt,by_int(:,i),'k') % plot(jt,bx_int(:,i)-mean(bx_int(:,i)),'r') % plot(jt,by_int(:,i)-mean(by_int(:,i)),'g') % ...
%% FUNCTION: svt % Singular value thresholding algorithm for low-rank matrix completion. % INPUTS: % Y = matrix with entries Y_ij = y_ij if (i,j) is observed and % Y_ij = 0 if (i,j) is not observed % M = matrix with entries M_ij = 1 if (i,j) is observed and M_ij = 0 % and M_ij = 0 ...
clc;clear all;close all; for j = 1:30 filename = 'UCI1'; N = 0.4; [X, Y, Yn, Init_Noise] = load_dataset_UCI(filename,N); A = fitcsvm(X,Yn,'ClassNames',[1,2]); SV_IND = find(A.IsSupportVector==1); NonSV_IND = find(A.IsSupportVector==0); SV_SET = X(SV_IND,:); NonSV_SET = X(NonSV_IND,:); SV_Lab = Yn(SV_IND,:); Non...
function y=Noiseditong(sig,fs,fp,fst) y=[]; %fp=1500;fst=2250;fs=15000; %输入设计指标 wp=2*fp/fs; %求归一化数字通带截止频率 ws=2*fst/fs; %求归一化数字阻带起始频率 % deltaw=ws-wp; %求过渡带宽 % N0=ceil(6.6/deltaw); %求窗口长度 % N=N0+mod(N0+1,2); %确保窗口长度N为奇数 % n=N-1; %求出滤波器的阶...
function [ C ] = findcorners( P, I, maxWidth) % DESCRIPTION % find coordinates of spine corners in an image % INPUTS % P = data from Neuron Studio. I = image. maxWidth = maximum neighborhood template size % OUTPUTS % C = coordinates of spine corners imshow(I) hold on % determine boundaries of image ...
count_face =0; count_noface=0; F_Train_Face = F_Train; testsize=150; prior; for k = 1: testsize k test_id = k; submatrix = F_Test_Face(test_id,:); likelihood_matrix =[]; likelihood_noface =0; likelihood_face=0; for i = 61 :4200 feature_id = i; ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright 2010 - 2015 Moon Express, Inc. % All Rights Reserved. % % PROPRIETARY DATA NOTICE: % The data herein include Proprietary Data and are restricted under the % Data Rights provisions of Lunar CATALYST Space Act Agreement % No. SAAM ID#...
%Katharin Jensen %This code creates a force vs. displacement plot for a model [describe %model better later] tic clear clc close all %initialize ea_t = 10; %other spring constant type thing, N k_t = 100; %spring constant, N/m H = 1; %max height, m %n = 100; %number of links m = 4; n_l = 10; i_max = 11; ea = ea_t/n_l;...
function [V,H] = qrstep(V,H,mu,k1,k2); % % Input: V -- a real square orthogonal matrix % % H -- a real square upper Hessenberg matrix % % mu -- a real or complex shift % % k1,k2 -- pointers to submatrix in k1:k2 block % % Output: V -- a real orthogonal matrix % % ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Coursework 1 - Hugo Germain % % Part H : Gabor Filter % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function PartH_computePosterior %% Load Images and Compute Posteriors % Nb: First launch PartB_training.m to create the Mixtures load('Est_Apples_Gabor.mat','Est_Apples_Gabor...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Author: Hamza Bourbouh <hamza.bourbouh@nasa.gov> % Notices: % % Copyright @ 2020 United States Government as represented by the % Administrator of the National Aeronautics and Space Administration. All % Rights Reserved. % % Disclaimers % % No Warranty:...
function plotStimulationRasterPlot(experiment, stimulusTypes, CSC) %% load basic info parameters = get_parameters; Path = get_path; for stimulusType=stimulusTypes binsize = parameters.plotStimulationRasterPlot.binsize; %sec nbins = (parameters.(['Window_' stimulusType{1}])(4)+abs(parameters.(['Window_...
%%************************************************************************* % This file when called will setup the workspace for the projects %{ %} %%************************************************************************* %% Load types/defines from hand code if exist('EnumFileNames','var') run Read...
%% Setting algorithm parameters running = 0; while running == 0 mtitle = 'Algorithm Parameters'; if (strcmp(cur_alg, '2-RSPG') == 1) || (strcmp(cur_alg, '2-RSPG-V') == 1) Input1; else Input2; end end common_prog;
%% current_object_info % fname, desc wobj = read_wobj(fname); [verts_v3,faces_f3,normals_f3] = wobj_verts_faces(wobj); [wrenches_f6,cents_f3,] = get_contact_wrenches3d(verts_v3,faces_f3,normals_f3); lengths1 = norms(verts_v3(faces_f3(:,1),:) - verts_v3(faces_f3(:,2),:),2,2); lengths2 = norms(verts_v3(faces_f3(:,1),...
function [] = draw_circle_sector_in_plane(c, r, n, t1, t2, color, varargin) line_width = 2; if ~isempty(varargin) line_width = varargin{1}; end D = 3; u = [1; 0; 0]; v = cross(n, u); u = cross(v, n); u = u/norm(u); v = v/norm(v); % figure; axis off; axis equal; hold on; % draw_sphere(o, r, 'c'); % myvector(o, ...
function [dX, u, debugResult] = ModelDynamics(time, X, options, simParam) time x = X(1); y = X(2); theta = X(3); %controller [u, controllerResult] = Controller( X, simParam ) v = u(1); kappa = u(2); %dynamics ct=cos(theta); st=sin(theta); dx = v*ct; dy = v*st; dtheta = kappa; dX = [dx; dy; dthe...
% Plotting close all time_vec = [50 40 30 20 10 1]; %load('sg_1f1p_fine.mat') %load('sg_seasonality_1p.mat') load('sg_zeta_min_gamma_min.mat') %load('sg_zeta_max_gamma_max.mat') ctrls= figure(); for tt = 1:numel(time_vec) V_plt = squeeze(V(time_vec(tt),:,:)); g_plt = squeeze(gen_opt(time_vec(tt),:,:)); t_p...
function kf = mfk_init(dim_x,dim_z,dim_u) %MFK_INIT Init of kalman filter matrixes % x : ndarray (dim_x, 1), default = [0,0,0…0] % filter state estimate % P : ndarray (dim_x, dim_x), default eye(dim_x) % covariance matrix % Q : ndarray (dim_x, dim_x), default eye(dim_x) % Process uncertainty/noise %...
function [d] = graphIt(emission,excitation, truncatedata)
function [ data, indexes ] = sequentialFs(data, target_number_of_features, forward, varargin) %SEQUENTIALFS Implementation of a Sequential Feature Selection approach for % feature selection % data is a stprtool data type, containing the features/observed data and % the respective classes, in the fo...
function [lda_model, y_hat, accuracy] = lda(X_train, y_train, X_test, y_test, discrim) lda_model = fitcdiscr(X_train, y_train, 'DiscrimType', discrim, 'SaveMemory','on','FillCoeffs','off'); y_hat = predict(lda_model, X_test); accuracy = evaluate(y_hat, y_test); end
%% Ascent Model % Philip Linden %% Assumptions % * Helium in balloon behaves as an ideal gas % * Atmosphere is homogenous and uniform composition at all altitudes % * Atmosphere is a static fluid (no convection or winds) % * Gas in the balloon is the same temperature and pressure as the % atmosphere % * Balloon main...
function convertOneImage2BW(image, outArea, showFlag, outputPath) % image, a string with a partial or full path to the image % outArea, [left top right bottom] % showFlag, 1/0 % outputPath, partial or full path to the output directory % 1. Make image sizeOut pixels % 2. Make t...
function [ binned_data, bin_avg, binIdx ] = bin_y(data_y, nbins ) %binning( data_x, data_y, num_bins ) % This takes in only y-data, as well as number of bins. % The data must be ONE COLUMN of size Nx1. % The y-data will be divided into num_bins # of bins. % Output is the average of each bin, size NUM_BINSx1 if ...
%The total number of patterns, by varying the w and phi parameters: %We have w = 0.3*pi and 0.5*pi and for all these w, we have phi = j*pi/4, %j=1...3; clear all close all total_patterns = 8; sgw_pattern_size = 3; sgw_pattern_image_size = 2*round(sgw_pattern_size/2) + 1; sgw_patterns = zeros(sgw_pattern_image_size,sgw_...
% plot g from T and fitted Gain devnums = flip([71:-1:69,65:-1:63,36:-1:27]); whichRow = 'B'; fn_patterns = {}; for devnum = devnums fn_patterns{end+1} =... sprintf('./fsw_scans_narrow/%sD%dO1_sweepAtten_side_R_atten*.mat', whichRow, devnum); fn_patterns{end+1} =... sprintf('./fsw_scans_narrow/...
function [ iam ] = getIAM( frame,M,N) hsv = rgb2hsv(frame); luminance_frame = hsv(:,:,3); iam = 0; iam1 = 0; iam2 = 0; for i = 1:(N-1) for j = 1:M iam1 = iam1 + abs( luminance_frame(i,j) - luminance_frame(i+1,j) ) ; end end for i = 1:N for j = 1:(M-1) iam2 = iam2 + abs( luminance_frame(i,...
% SCALE Multiply a Diffraction object by a scalar value % % Usage: % >> object=scal(object,coordinate,value) % The "coordinate" input may be 'Grid1' or 'Grid2'. % % See also Xray, Diffraction, shift % % % created August 27, 2015 by Tommy Ao (Sandia National Laboratories) % modified January 21, 2016 by Tommy Ao % fun...
function avgdata=adjavg(data,n) % This function averages adjacent data points to smoothen the data % n = number of points to average newdata=[]; for i=1:length(data) j=round(n/2)-1; while (i<=j)||(i>length(data)-j-1) j=j-1; end if j<=0 newdata(i)=data(i); else newdata(i)=mea...
clear image1 = imread('Enter image name here');%Reading the image into variable image1 N = size(image1);%N is an array holding the size of the image output1 = image1;%Assigning the output image to the original image. Will change as we go through the code %Assigning the random initial pixel to get the centres for cluste...
function [T,Y] = integratorFourP2X7(ton,toff,Ttot,amp,dt,y0) global a1 a2 a3 b1 b2 b3 g12 E12; %#codegen T=(0:dt:Ttot).'; nT=floor(Ttot)/dt; Y=zeros(nT,4); Y(1,:)=y0; for j=1:nT-1 A=amp*(heavi(T(j)-ton)-heavi(T(j)-toff)); Y(j+1,1)=(Y(j,1)+dt*(b1*Y(j,2)))/(1+dt*(a1*A));%C1 Y(j+1,2)=(Y(j,2)+dt*(a1*A*Y(j,1)+b2...
function AlphaCuedV2_train2(INFO,name) % clear % close all % addpath('./Functions'); % % name ='test2'; % % INFO.name = name; % INFO.logfilename = ['Alpha_Cued_Lateralization/Logfiles/' name '_Logfile.mat']; % INFO.P = get_parameters; %% ----------------------------------------------...
function materials = Materials() % % This function is for the definition of the materials and its material properties for Main simulation for % the gear design % % Material parameters: %% The array consists of material parameters which are needed for calculations %% The values represents: % Density [kg/m^3];...
function aRatio = computePerClassAspectRatios(posImgDir, posGtDir, pLoad, aRatioType, plot_orientation_dist) if nargin<5 plot_orientation_dist = 0; end % JMBUENA!! % Compute the average window size for every subclass of the % positive metaclass. We are going to keep this average window size % within the detect...
% Runs the STRFLab code on data generated from ECoG clear all; %% Define parameters for fitting nLags = 10; %% How many time lags do we use? useGPU = 0; %% Do we use GPU acceleration? numElectrodes = 109; %% How many iterations for this process? (should be total num of electrodes) numSpecBands = 32; % Forward/Rever...
MSG_SIZE = 1000*1024; Fs = 16e3; % Load data from file fid = fopen('buff'); x = fread(fid, inf, 'ubit8'); fclose(fid); % Fix Linux endianess for i = 1:4:length(x) x(i:i+3) = flipud(x(i:i+3)); end mic = zeros(8,MSG_SIZE/20); status = zeros(MSG_SIZE/20,1); for i = 1:MSG_SIZE/100 x_idx = (i-1)*100; mic_idx ...
%%Rand to optimize the parameter of PID controller clc; close all; clear all; k=1.5; n=2; T=40; r=1; if n==1 delta=0.5*k; else delta=0.92*k*sqrt(n); end ti=0.5*n*T; Min_delta=0.05*delta; Max_delta=delta + (delta-0.001)*10; Span_delta=(Max_delta-Min_delta); Min_ti=0.05*ti;; Max_ti=ti+ti*10;...
function [im_alt] = altertxt(im_tx1,im_tx2) % This function arrange the pixels alternatively from Text image 1 and 2, and % returns the interleaved Text image % im_tx1 - Input Text image 1,3,5 to be encoded % im_tx2 - Input Text image 2,4,6 to be encoded % im_alt - Output Interleaved Text image % Locate Text i...
function obj = element(obj,FEM) %% independent degrees of freedom (n set) % numbers and locations hn = find(FEM.gnum==obj.GN); if size(hn,2)~=1; error(['There should be one and only one GRID with ID#',num2str(obj.GN),'']); end obj.xn = [FEM.GRID(hn).X1;FEM.GRID(hn).X2;FEM.GRID(hn).X3]; % dof cm = str2num(...
function fnval = logstate_lik_fun(data,times,y,p,more) y = exp(y); fnval = more.fn(data,times,y,p,more.more); end
img = imread('a.tif'); avg = fspecial('average', 15); img_mean = imfilter(img, avg); figure('Name', 'Original'); imshow(img); figure('Name', 'Mean Blur'); imshow(img_mean);
function w_real = wheel_model(Tor_des, dt, prev_Tor) %quantize input ntBP = numerictype(1,8,4); y = quantize(fi(Tor_des),ntBP); % add noise y = add_noise(y,dt); %saturation minT = -3; maxT = 3; y = saturation(y, minT, maxT); w_real = y; end function y = saturation(y, minT, maxT) y = max(min(y, maxT), minT); end f...
function [ output_args ] = stuff_zeros( input_args,length ) %STUFF_ZEROS Summary of this function goes here % Detailed explanation goes here [columns,~]=size(input_args); output_args=zeros(length,1); %disp(size(input_args)); %disp(size(output_args)); if length>=columns output_args(1:columns)=input_args; else ou...
if ~verifySpmExists() return end StoreVariables tic aliveChecker = imlook4d_alive('spm'); % Print '.' while 'spm' in call stack (meaning that it is running). Stop-command: delete(aliveChecker) if ~exist('atlas','var') % Defaults atlas.atlasDefinitionFile = 'labels_Neuromorphometrics'; end % Set vari...
function [T,I,Y]=perfusionResponsepotentP2X4sub(y0,ton,toff,Ttot) ode=modelODEpotentP2X4sub(ton,toff); [T,Y]=ode15s(ode,[0 Ttot],y0,odeset('NonNegative',1:9)); I=getTotalCurrentpotentP2X4sub(Y); end
x=zeros(1,21); x(1)=1-exp(-1); for i=2:21, x(i)=1-(i-1)*x(i-1); end disp(x)
Anal_chan = 10; Digit_chan = 10; Total_chan = Anal_chan + Digit_chan; Title = 'MatlabSimulink'; Version = '1999'; An_max = 65535; An_min = 0; %value_number = 10000; frequency = 50; Anal_names = {'Ia', 'Ib', 'Ic', 'Ua', 'Ub', 'Uc', 'Uni', 'Unk','Temp1','Temp2'}; Digit_names = {'Пуск 1 ст. АОПО' 'Сраб. 1 ст. ...
% Create reference image function [ref_image] = reference_im(sigma,std) ref_image = zeros(128,128); for i = 1:128 for j = 1:128 vec = [j,128-i]; theta = acos(dot(vec-[64.5,64.5],std)/(norm(vec-[64.5,64.5])*norm(std))); ref_image(i,j) = (1/(1+abs(theta)^2))*cos(8*pi*theta); end end ref_im...
function [W, Z] = trideigs(D, E) % Calculates the eigenvalues and eigenvectors of a symmetric tridiagonal matrix. N=numel(D); IL=1; IU=N; M=N; LDZ=N; LWORK=20*N; LIWORK=10*N; INFO=0; VL=0.0; VU=1.0; ABSTOL=0.0; ISUPPZ=zeros(2*M, 1); IWORK=zeros(LIWORK, 1); W=zeros(N, 1); Z=zeros(LDZ, M); WORK=zeros(1, LWORK); if(narg...
function []=plotnonlinobjective(F,width,height,KT) params(1) = struct('name', 'focal','ymeasure','foc2' ,'xmeasure','foc1', 'yKrow', 1, 'yKcol', 1, 'xKrow',2, 'xKcol', 2); K=[width 0 width/2; 0 width height/2; 0 0 1]; numsl=200; numsols=numsl; usedFs=[]; for i=1:size(F,2) if(size(F{1,i},1)~=0) ...
%ÃèÊöº¯Êý·ÖÎö clear all; close all; clc; T1 = 0.1; T2 = 0.25; K=2; Astart=0.001; M=1; Aend = 1; A = Astart:0.001:Aend; lp1 = fix((Aend-Astart)/0.001); NA = zeros(lp1+1,1); for i = 1:lp1+1 NA(i) = 4*M/(pi*A(i)); end m_NA = -1./NA; num = [K]; den = conv([T1 1],[T2 1 0]); w = 5:0.1:100; [rem,img...
function []=test2_with_fminsearch () clc; close all; Exp_matrix=load('20K_per_minute.txt.txt'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% n=size(Exp_matrix,1); c=0.1002; % temp correction Beta= [20/60]; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% p=1; for i=1:15:n ...
function [coef_homogen_a, tra, lambda_min, lambda_max] = fct_vp_a(X_i,model) % Compute singular value of the quadratic covariation of the geostrophic velocity % a(x,x) %% Compute a a = fct_a(X_i,model);% n_x x d x d % Homogeneous part of a l_pixel=model.l_pixel_nugget; nugget = exp(model.kriging.lognoisevariance); coe...
function net = net(net) %UPDATENET Creates a current network object from an old network structure. % % % NET = UPDATE(S) % S - Structure with fields of old neural network object. % Returns % NET - New neural network % % This function is caled by NETWORK/LOADOBJ to update old neural % network objects when they...
clear all; E = load('outputAllNeurons.txt'); a = load('outputSpikes.txt'); figure; startNeuron = 1; endNeuron = 4*764; RS = a(a(:,3)==0,:); IB = a(a(:,3)==1,:); FS = a(a(:,3)==2,:); LTS = a(a(:,3)==3,:); subplot(6,1,1); start = 100; value = 20; sTime = 20; pickInput =[zeros(1,start),value*ones(1, sT...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Sudoku Generator % % Comments : Currently, created for a 3 x 3 x 3 grid % Author : Jebin Elias ( jebinelias@gmail.com ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Validate the grid at every substitution. %...
function [ roads] = plan_roads(map_size) %% The following part of code make the road-map on which traffic will flow figure; axis([0 map_size 0 map_size]); % traffic space i=1; while(~waitforbuttonpress) [x, y] = ginput(2); % take a 2-cli...
function conn=dbLocalConnect(databasename,username,passwd) %dbLocalConnect connect to a database running on a local server % % CONN = dbLocalConnect(DATABASENAME,USERNAME,PASSWORD) returns a % database connection object CONN. DATABASENAME is the local database name. % USERNAME is the user name. PASSWORD is the passwo...
function [evalues, repeats] = eigval(A) % eigval Eigenvalues and their algebraic multiplicity. % % evalues = eigval(A) returns the distinct eigenvalues of A, % with duplicates removed and sorted in decreasing order. % % [evalues, repeats] = eigval(A) also returns the row vector % repeats that gives the multipli...
function plot_T_scan(axeshandle,T_vector,T_scan_data) axes(axeshandle); hold on; ColorOrder=lines(10); ColorOrder=flipud(ColorOrder); for ii=1:size(T_scan_data,1) h=plot(T_vector,T_scan_data(ii,:),'Color',ColorOrder(ii,:)); h.LineWidth=1.5; end hold off; box on; ax=gca; ax.BoxStyle='full'; ax.LineWidth=1.5;...
% learn_qso_model: fits GP to training catalog via maximum likelihood rng('default'); % load catalog catalog = load(sprintf('%s/catalog', processed_directory(training_release))); % load preprocessed QSOs variables_to_load = {'all_wavelengths', 'all_flux', 'all_noise_variance', ... 'all_pixel_mas...
function blockingLanes = check_blocking_lanes(hBs,ha,hb,ii) %CHECK_BLOCKING_LANES returns currently blocking lane numbers % Given BS height, vehicle antenna height, blocker vehicle height, % current driving lane, returns the lanes blocking the current lane. blockingLanes = []; for jj = 1:ii-1 criticalHeight = h...
classdef Bond properties Principal Term Coupon MarketPrice end methods function obj = Bond(p,t,c,m) obj.Principal = p; obj.Term = t; obj.Coupon = c; obj.MarketPrice = m; end function disp (obj) printf("Principal: %f\nTerm: %f\nCoupon: ...
clc; close all; clear all; tic; % Image input im_in = imread('flowersc.png');% Color image size_temp = size(im_in); % Text inputs im_tx = imread('text.jpg'); % Text page 1 if( ~isequal(size_temp, size(im_tx)) ) error('All Input Images must be equal in size'); end size_temp = size(im_tx); im_in_tx1(:...
function autocol = newAutocol(config) % Starting the communication with the autocol (only used at IPAG) % return it as a Autocol object naomi.log('Starting Autocol communication...', 1, config.verbose); autocol = naomi.objects.Autocol(config.autocolCom); naomi.log('OK\n', 1, config.verbose); end
fullimageFileName = 'D:\Class\4.2\Lab\Degital Image Processing\DIPAssignment\carPlate\carplate5.jpg'; cd 'D:\Class\4.2\Lab\Degital Image Processing\DIPAssignment'; %% Input image % read image I = imread(fullimageFileName); % figure; fig = imshow(I); title('orginal image'); % saveas(fig, 'fig/1 orginal image.png'); ...
r = 100; count = 5000; x = zeros(1, count); y = zeros(1, count); z = zeros(1, count); tic; for i = 1 : count theta = rand * 2 * pi; phi = acos(1 - 2 * rand); x(i) = r * sin(phi) * cos(theta); y(i) = r * sin(phi) * sin(theta); z(i) = r * cos(phi); end plot3(x, y, z, 'ro', 'MarkerSize',2, 'MarkerFa...
function [F] = fundMatrix(idx,c1,r1,c2,r2) % Using SVD to solve x1 = c1(idx(:,1)); y1 = r1(idx(:,1)); x2 = c2(idx(:,2)); y2 = r2(idx(:,2)); a = [(x1-mean(x1)) (y1-mean(y1))]; b = [(x2-mean(x2)) (y2-mean(y2))]; s1 = 1/(std(sqrt(sum(a.^2,2))))*sqrt(2); s2 = 1/(std(sqrt(sum(b.^2,2))))*sqrt(2); a = a*s1; xx1...
function [ contribs ] = singleMetricContribution( metrics ) %takes in a set of metrics and returns a set of contributions %for each of those metrics based on distance from each other. metLen=length(metrics); % extract length of metrics. indices=1:metLen; Vals=[metrics;indices]; % indicies paired with metrics. Vals=...
% poidec4.m % calculate exponential decay for ensemble of particles with % poisson-distributed quenchers. This version uses tau_kww and beta % from the exciton diffusion model, and also differentiates between % defect-quenchers and dyes. %tau=3000; % lifetime without quenchers, in ps avedye=2.992; % average number ...
classdef Image % Constructs an image object from an input fits file. properties green1=NaN; % 1st green channel. red=NaN; % Red channel. blue=NaN; % Blue channel. green2=NaN; % 2nd green channel. end methods function obj = Image(filename, w...
function rgb = lime_green rgb = [0.19607, 0.80392, 0.19607]; end
%% Testing: whether two sequence represent the same person % process the first test seq personname1 = exterior_folders( test_index_set(1)+2 ).name; video_directory='../feature/'; cd(video_directory); cd(personname1); % you set personname1 interior_folders=dir; [num_interior_folders,~]=size(interior_folders); if num_int...
% **************************************************************** % PLOTTING % **************************************************************** % Code for the nonlinear model described in the Appendix B in the % "Sovereign Default Risk Premia, Fiscal Limits, and Fiscal Policy" % (Huixin Bi, 2012) % Aim : Plot time s...
% вариант 9 clear; load carbig; good_Acceleration = []; % первая характеристика good_Horsepower = []; % вторая характеристика n = 1000; % размер бутстреп выборки; 100 good = 0; for i = 1 : length(Horsepower) if and(not(isnan(Horsepower(i))), not(isnan(Weight(i)))) good_Acceleration = [good_Acceleration, Acc...
% This is a toy script to guide you to using CDMentropy % with a toy binary word observations. %% Add the library path startup %% Check if the package is downloaded/installed correctly if ~exist('words2multiplicities') disp('Did you forget to "git submodule update --init"? Let me try it.') disp('(Thi...