text
stringlengths
8
6.12M
N_states = 8; %% run MPC controller if size(x_save) == [7,1] %adding initial value for euler parameter n eta = sqrt(1 - x_save(5:7)'*x_save(5:7)); x_save = [x_save;eta]; x_LQR = [x_LQR;eta]; end if flag_MPC_type %nonlinear model uses the extra (uncontrolable, unobservable) euler parameter %the ...
function [in_comb,high,high_CELL] = balCal_algEqns(model_FLAG,in,series,intercept_FLAG,voltagelist,normFLAG) %Function creates matrix of predictor variables for algebraic model by %combining measured variables (voltages). Combined terms are determined by %the model selected %INPUTS: % model_FLAG = Flag for model sel...
%% Example : INI file reading % Creation of an example file called "Configuration.ini" Example_write(); % Initialization File = 'Configuration.ini'; I = INI('File',File); % INI file reading I.read(); % Sections from INI file Sections = I.get('Sections'); % Sections names fprintf(1,'Sections of "%s" file :\n',File)...
function Matrix = sudReduceTransferMatrix( S_in,S_out,a,varargin) %急速变径传递矩阵 % S1进口截面积 % S2出口截面积 % S1BigThanS2 s1比s2大,说明是缩颈,否则为扩径 % a声速 if ~isa(S_in,'sym') && ~isa(S_out,'sym') if(S_in < S_out) error('S_in 需要大于 S_out'); end end mach = 10/345; coeffDamping = 0.03; pp = varargin; notMach = 1; whi...
classdef ReportScheme < handle %REPORTSCHEME Summary of this class goes here % Detailed explanation goes here properties Scheme end methods function obj = ReportScheme(varargin) obj.Scheme = varargin; end function r = report(ob...
function [SGF,u_star,ReB] = calc_Troit_SGF(U10_desired,eq_N,Omega,r) %{ Author: Sydney Sroka Implementation of equation 24 in Troitskaya et al. (2018) Usage: [SGF] = calc_Troit_SGF(U10_desired,eq_N,Omega,r) INPUT: r = an Nx1 vector of drop radii in [m] Omega = wave age parameter usua...
clc close all clear all load Tamp %% 1 2 3 4 5 6 7 8 10 11 12 13 14 15 16 17 18 % name = [ "Er","Ax","Ay","Pz","Px","Py","Vx","Vy","Za","Zb","Zc","Zd","Ze","Zf","Va","Vb","Vc"]; t_des = [0:1:8]'*5; x_des = [t_des, [0 0 0.5 1 0 -1 0 1 0]'*0.05]; y_des =...
function err = error_euclideanloss_test(opts, labels, res) % ------------------------------------------------------------------------- errTemp = res(end-1).x - labels ; err = sum(errTemp(:).^2)/numel(errTemp);
function [X,Y]=bezier(x,y) %用法: %bezier(x,y) % 生成n-1次贝塞尔曲线,其中x和y是n个点的坐标 %h=bezier(x,y) % 生成n-1次贝塞尔曲线并返回曲线句柄 %[X,Y]=bezier(x,y) % 返回n-1次贝塞尔曲线的坐标 %例子: %bezier([5,6,10,12],[0 5 -5 -2]) n=length(x); t=linspace(0,1); xx=0;yy=0; for k=0:n-1 tmp=nchoosek(n-1,k)*t.^k.*(1-t).^(n-1-k); xx=xx+tmp*x(k+1); yy=yy+tmp*y(k+1); end h=p...
%MIT License %Copyright (c) 2019 Sherman Lo %ABSTRACT CLASS: DEFECT RADIUS EXPERIMENT %Investigate the performance of the empirical null filter with different kernel radius on a defect %image pre/post contamination with a plane and a multiplier %For a given radius, produce defected image pre/post contamination. Us...
%If-statement practice %Write a function called picker that takes three input arguments called condition, in1 and in2 in this order. The argument condition is a logical. If it is true, the function assigns the value of in1 to the output argument out, otherwise, it assigns the value of in2 to out. See the examples belo...
function [DLcomm_op, radar_DL_op,cov_DL_op] = tsp_altermating_projection_DL_wo_coop... (DLcomm, radar_DL,radar_comm_DL,cov_DL) ell_max = radar_DL.ell_max; ell = 1; radar_DL_op = radar_DL; DLcomm_op = DLcomm; I_total = zeros(ell_max,1); I_total_op = zeros(ell_max,1); I_max = sum(DLcomm.MI_DL(:))+ sum(radar_DL.MI_radar)...
Q = zeros(2,2,4); Q(1,1,:) = [1 1 1 1 ]; Q(1,2,:) = [2 1 0 -1]; Q(2,1,:) = [1 0 -1 2]; Q(2,2,:) = [3 2 -2 1]; A = qua2com2(Q); [Uc, Sc, Vc] = svd(A); Sq = sum(Sc); Sq = Sq(1:2:end); Uq = com2qua2(Uc); Vq = qhermitian_trans(com2qua2(Vc)); qmul(squeeze(Uq(2,1,:)),squeeze(Vq(1,2,:)))*Sq(1)+qmul(sq...
function [im1]=spfcm(img,nc) % % fuzzy c-mean image segmentation with weighted % % membership functions with spatial constraints; % % refer to KS Chuang et al. / Computerized Medical % % Imaging and Graphics 30 (2006) 9–15 % % % [MF,Cent,Obj]=SFCM2D(img,ncluster,max_iter,expo) % % inputs:...
% eg_trisurf % % If texture is needed, use Gabriel Peyre's plot_mesh in toolbox_graph % % Copyright (c) 2013 Junjie Cao clear;clc;close all; %MYTOOLBOXROOT='E:/jjcaolib/toolbox'; MYTOOLBOXROOT='../'; addpath ([MYTOOLBOXROOT 'jjcao_mesh']) addpath ([MYTOOLBOXROOT 'jjcao_io']) addpath ([MYTOOLBOXROOT 'jjcao_...
function [gamma,llm]=em2r(r,k) load ('data.mat') x=dataset2; L=size(x); l=L(1); zc=zeros(r,40);llm=-inf; for zzz=1:r sigma=zeros(2,2,k); mu=zeros(k,2); sigma(:,:,1)=cov(x); n=zeros(1,3); pik=ones(k,1)/k; while (~(n(1)~=n(2)&&n(2)~=n(3)&&n(3)~=n(1))) n=ceil(rand(1,3)*1500); end for ii=1:k mu(ii,:)=x(n(ii),:); ...
function s = war_dim( p, t) %WAR_DIM - Warren and Root (1965) solution % % Syntax: s = war_dim( p, t) % % p(1) = a = slope of Jacob Straight Line % p(2) = t0 = intercept with the horizontal axis for % the early time asymptote % p(3) = t1 = intercept with the horizontal axis for % th...
function tdis = totaldistance(route,distance_matrix) %TOTALDISTANCE=sum(distance(ij)) %break the cycle tdis = distance_matrix(route(1),route(end)); for i=1:1:length(route)-1 tdis = tdis + distance_matrix(route(i),route(i+1)); end
function [normals albedo] = optComputeNormals(img1, img2, img3, lv1, lv2, lv3, threshold) % gives weighted least-squares to handle shadows [m n] = size(img1); normals = zeros(3, m*n); albedo = zeros(m, n); s = 1; for j=1:n for i=1:m I = [img1(i,j)*img1(i,j) ; img2(i,j)*img2(i,j) ; img3(i,j)*img3(i,j)]; ...
function [ RGBPlane ] = RGBFromMonoPlane( monoPlane, colorMap, cutOff, contourOverlay) %Creates RGBImage from MonoImage %contourOverlay: Dateiname der Contourdate, die mitangezeigt werden soll. %cutOff: Z-Wert, der als oberes Limit der color-LUT angzeigt werden soll. %cutOffMax: Maximaler Z-Wert-Threshold, der im Out...
function demoDrawArrow3d %DEMODRAWARROW3D Demo of drawArrow3d % % Example % demoDrawArrow3d % % See also % % ------ % Authors: Shawn Arseneau, oqilipo % History: % Created: 2006-09-14 by Shawn Arseneau % Updated: 2020-02-08 by oqilipo % Output a collection of arrows with various color and shape options fi...
function sorted_data = sort_by_2col(exceldata, col1, col2, title, title1, title2) % This function takes in data from the spreadsheet created by 'L_CombSeg' % scripts and returns a cell where data has been sorted based on the % category in column number 'col'. col1_unique = unique(exceldata(:, col1)); % G...
function MixedSig = MixSignal(Sig,t_axis,Pattern,Tp) % random mixing M = length(Pattern); Ind = mod( floor(t_axis/(Tp/M)) , M) + 1; MixedSig = Sig .* Pattern(Ind);
% Seeker Optimition Algorithm for f(x1,x2) optimum clear all; close all; format long % Parameters sizepop=100;%种群规模 maxgen=100;%最大迭代次数 m=2;%空间维数 Umax=0.9500;%最大隶属度值 Umin=0.0111;%最小隶属度值 Wmax=0.9;%权重最大值 Wmin=0.1;%权重最小值 popmax=5; popmin=-5; % 初始化种群个体 for i=1:sizepop pop(i,:)=5*rands(1,2); fitness(i)=rastrigin(pop(...
function hfigs=display_map_input_cl(obj_tot,varargin) p = inputParser; addRequired(p,'obj_tot',@(x) isa(x,'map_input_cl')); addParameter(p,'hfig',[],@(h) isempty(h)|isa(h,'matlab.ui.Figure')); addParameter(p,'main_figure',[],@(h) isempty(h)|isa(h,'matlab.ui.Figure')); addParameter(p,'echomaps',{},@(h) iscell(h)); addP...
function [ output_args ] = getAAPVs( wildcard ) %getAAPVs Retrieves pv names from the archiver appliance %getPVs Retrieve the list of pv names %Retrieves a 1xN array of pv names, limited by an optional %wildcard. %Examples: % lst = AA.getPVs() % Returns all pv names in the archiver appliance. Note % that...
function res = exp_average(x,b) persistent avg; persistent alpha; if isempty(avg) avg = x; alpha = 0.1; end if nargin == 2 avg = x; alpha = b; end avg = x * alpha + avg * (1-alpha); res = avg; end
function z=iscwf(cwf) %ISCWF Check for valid color weighting function specification % Part of the OptProp toolbox, $Version: 2.1 $ % Author: Jerker Wågberg, More Research & DPC, Sweden % Email: ['jerker.wagberg' char(64) 'more.se'] % $Id: iscwf.m 23 2007-01-28 22:55:34Z jerkerw $ z= isstruct(cwf)... &...
function PlotMicData (fileNameBare, sampIntervalMilli) fileName = [fileNameBare, '.data']; Fid = fopen(fileName, 'r'); if (Fid < 0) disp('Could not open file'); end Data = fread(Fid, inf, 'int16'); fclose(Fid); N = length(Data); % Ignore FFFF samples (read as -1) if Data(1) < 0 || Data(1) > 4096 Data(1) = 0; ...
function f2b = converFloatToBinary(x,pop_size,dim) for i = 1:pop_size for j = 1:dim s = 1/(1+exp(-x(i,j))); if rand < s f2b(i,j) = 0; else f2b(i,j) = 1; end end end end
%tspan = linspace(0, (2* iter * 3 * 10^(-4)),iter*2); tspan = linspace(0, max(t), max(t) * 100); % t used here comes from output of gillespie simulation. For independent use the above command % tspan = linspace(0, 5, 10^4); k_max = max(sum(G)) sus_0 = zeros(k_max+1,k_max+1); inf_0 = zeros(k_max+1,k_max+1); for(...
all_txt=dir('/home/scw4750/github/IJCB2017/liufeng/data/bbox/gallery/*/*.txt'); img_dir='/home/scw4750/github/IJCB2017/liufeng/data/gallery'; output_dir='/home/scw4750/github/IJCB2017/liufeng/data/gallery_croped/gallery' for i=1:length(all_txt) i folder=all_txt(i).folder; idx=strfind(folder,'/'); data_c...
function [ Y ] = Window_Triangular( x ) % Ventana Triangular % x: Seņal de entrada % W: Ventana calculada % Y: Seņal de salida N = length(x); W = zeros(1,N); for i = 1:N W(i) = (2/(N+1)) * (((N+1)/2) - abs(i - ((N-1)/2))); end Y = x .* W; end
dxarc = .07; dyarc = .3; [SecondCubeLeftArc] = get_Curve(-90*deg, 90*deg, 1, 5, .72, 5.8 + dxarc, 6.3 + dyarc); % x = [(Field.RSwitch.LeftP.tl_x+Field.RSwitch.LeftP.tr_x)/2,(Field.RSwitch.LeftP.tl_x+Field.RSwitch.LeftP.tr_x)/2, (Field.RSwitch.LeftP.tl_x+Field.RSwitch.LeftP.tr_x)/2 + .3, SecondCubeLeftArc.x + Seco...
function [Fo,Qo] = get_poles(top,Cx,Lx,varargin) %% function Fo = get_poles(top,Cx,Lx,[ Ron,Cesr] ) % Returns the list with the natural freqnecies produced by the parastic % inductaonces in the capacitors. % % JuliÓ Delos julia.delos@philips.com % % Philips Research 2015 % Copyrights % Fo = zeros(top.n_phases,lengt...
classdef O15ResolveBuilder < mlfourdfp.AbstractTracerResolveBuilder %% O15RESOLVEBUILDER % $Revision$ % was created 27-Oct-2016 22:21:08 % by jjlee, % last modified $LastChangedDate$ % and checked into repository /Users/jjlee/Local/src/mlcvl/mlraichle/src/+mlraichle. %% It was developed on Matlab 9....
%%%% Payne d44Ca %%%% clear all % close all global Friv Fhyd Fpw driv dhyd dpw epsc kcarb MCa0 Friv0 Fcarbv kt Frivv... Moc phflag k1k2flag Mgm Cam ksp omgCv flag epscv kcarb2 drivv; addpath('myode'); kt =1; %%%Simulation Flags flag = 1; %% 0: standard Payne et al sim, 1: weathering only (no acid.) %% ...
% Erode surface patch (cdata) projected on surface mesh, for example one whose gaps were closes using GiftiDilate. % Intended for application on SPM surfaces (e.g. as obtained via CAT12). % % Download demoMesh.gii and demoPatch.gii for demo purposes. % % Also see companion function GiftiDilate.m. % % GiftiDilate(meshPa...
% function M = Jacobian(F,x,A,B,o) % calculates the Jacobian Matrix of a vector valued function F at a given x % possible calling sequence: % - Jacobian(F,x) % - Jacobian(F,x,h) % - Jacobian(F,x,D,h) % - Jacobian(F,x,D,h,o) % With the following arguments: % - F: a n to m dimensional function, represented by a function ...
%% Birth Certificate % ===================================== % % DATE OF BIRTH: 2021.03.10 % NAME OF FILE: CodeInsert % FILE OF PATH: /ForestAndTree % FUNC: % DCT系数奇偶嵌入实例。 % 加密: % 图片CL变换 -> 通道一LL1/HL2分量DCT变换 -> 奇偶嵌入隐藏信息 -> % -> IDCT变换 -> 重写部分后逆CL变换 -> 承载信息图片 % 解密: % 图片CL变换 -> 通道一LL1/HL2分量DCT变...
% Solving the wave equation in 1D: % % d^2 u/dt^2 = c^2 (d^2 u/dx^2) % % for 0 <= x <= L. And with fixed BC: % u(0) = u(L) = 0 % % with IC @ t = 0 % u (x, 0) = f(x) % u'(x, 0) = g(x) % % where f(x): a simple Gaussian pulse and g(x) = 0 clear close all % Input parameter L = 4*pi; % Len...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % David A Smart % University of Maryland, College Park % ENPM 661 - Planning for Autonomous Systems % Project #2 - Path Planning % 3/3/18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [Que, GoalReac...
function [P_stop_index,P_start_index,P_length_AVR,P_amplitude_AVR]=fun_P_parameters(Q_index,P_index,P_value,ekg) % obliczanie długości i amplitudy załamka P fs=1000; X=ekg/max(ekg); clear P_stop_ind; j=1; while j<length(P_index) clear wart_test clear wart_test2 wart_test(1)=X(P_index(j)-1); for i=2:150 war...
% Einstellungen für komb. Struktur und Maßsynthese mit Kollisionsprüfung % Ergebnis: % Während der Optimierung werden Bilder zur Plausibilisierung der % Nebenbedingungen gezeichnet % Moritz Schappler, moritz.schappler@imes.uni-hannover.de, 2020-05 % (C) Institut für Mechatronische Systeme, Universität Hannover clc cl...
%Name: David George %Student Number: 251004930 %Start of Excercise 2 %Question C) u = [1;7;3]; v = [-3;0;0]; w=[-4;2;9]; %Question D) z = u -2*v + w; %Question E) m=[u v w]; %Question F) temp = [-4;12;9]; m=[u v temp]; %Question G) a =temp; b = [m(1);m(3)]; %Question H...
%% Data Parser datadir = '/data'; nRarr = 1:5; hRarr = [1.5, 2, 3, 4, 5]; for NAI = 0:length(nRarr)*length(hRarr)-1 hRidx = floor(mod(NAI,length(nRarr)*length(hRarr))/1/length(nRarr)) + 1; nRidx = mod(mod(NAI,length(nRarr)*length(hRarr)), length(nRarr)) + 1; hBs = hRarr(hRidx); % BS antenna height (in meters)...
k=0.1; ks=-0.3; w_r=150e3*2*pi; Lp= 107.42e-6; rp=0; Cp=1/(Lp*w_r*w_r); Ls=68.8e-6; rs=0; Cs=1/(Ls*w_r*w_r); M1= k*sqrt(Ls*Lp); M2 = M1; Ms= -ks*Ls; R1=40*8/(pi^2); R2=40*8/(pi^2); len=1e4; f=logspace(4.1,5.4,len); w=2*pi*f; Zp1=(rp+(1./(1i*w*Cp))+1i*w*Lp); Zs1=(R1+rs+(1./(1i*w*Cs))+1i*w*Ls); Zs2...
function [params] = baselinecoherogram(prefix, days, epochs, tets, ... do_wrtgnd,varargin) % Shantanu - Nov 2012. % From Kenny and Maggies - event_spectrograms .m and calcriptriggerredspectrograms.m respectively % This is for getting baseline values for given eeg tets for normalization when needed. Save These. % sj...
function out = MJLS_StaticOutputCheckFeasibilityLMI(A,B,C,H,Q,R,T) %========================================================================== % CheckFeasibilityLMI: evaluates the LMI feasibility conditions for static % output-feedback control of Markov jump linear systems without mode % observation. % % Input paramete...
% Inputs: % ts: array of size N containing times to settlement in years % dfs: array of size N discount factors % Outputs: % curve: a struct containing data needed by get RateIntegral function curve = makeDepoCurve(ts , dfs) InputChecking.checkDepoCurve(ts, dfs); % interest rate from 0 to t_i cu...
function [Z_horse,Z_human] = ApplyPCAcombined() %%Load data from folders Humans And Horses data_horse_X=double(LoadHorseImages()); data_human_X=double(LoadHumanImages()); data_horse_X=data_horse_X(:,1:20:end); %%Note :: to match the octave index dimensions of the image is reduced data_human_X=data_human_...
% Computes scale-covariant and scale-invariant heat kernel signature (SI-HKS) % % Usage: [sc,si] = sihks(evecs,evals,T,Omega) % % Input: evecs - (n x k) Laplace-Beltrami eigenvectors arranged as columns % evals - (k x 1) corresponding Laplace-Beltrami eigenvalues % alpha - log scalespace...
function [freqs, pows, SParams] = VNAPowerSweep(vna, varargin) % scan VNA power % Parameters: % Required: the vna object % Optional: see the inputParser p = inputParser; p.addParameter('minPow',-40,@isnumeric); p.addParameter('maxPow',0,@isnumeric); p.addParameter('numOfPowers',20,@isnumeric); p.addParameter('conf...
image = imread('/Users/joe/dom.png'); image = im2double(rgb2gray(image)); orig = imread('/Users/joe/dom_img.jpg'); image = imresize(im2double(image), 0.5); %image = imrotate(image, 0); cc = bwconncomp(image); main_region = false(size(image)); idx = 1; main_region(cc.PixelIdxList{idx}) = true; edges = edge(main_regio...
clear; clear figs; load('bcidistance.mat'); load('bciacqtime.mat'); load('blockshamacqtime.mat'); load('blockshamdistance.mat'); load('bcishamacqtime.mat') load('bcishamdistance.mat') load('sessindindex.mat'); unique_sessidx = unique(sessindindex); if not(isfolder('hist_figs')) mkdir('hist_figs') end unique_ses...
function [result] = testindepfromsimpledb_pars(i,j,k,pathindep,perc) %This function is returning the indepedence between i and j conditionally %on k querying an oracle csvfile where x,y,z1,z2,....,results %input % i : dimension of x % j : dimension of y % k : possibly empty dimension(s) of z % pathindep: csvfil...
function [T,I,Y]=perfusionResponseP2X4Inactsub(y0,ton,toff,Ttot) ode=modelODEP2X4Inactsub(ton,toff); [T,Y]=ode15s(ode,[0 Ttot],y0,odeset('NonNegative',1:10)); I=getTotalCurrentP2X4Inactsub(Y); end
function inst = gtrack_unitCreate(params) %/* Parameters */ inst.ec = zeros(4,4); inst.gatingParams = params.gatingParams; inst.stateParams = params.stateParams; inst.allocationParams = params.allocationParams; inst.unrollingParams = params.unrollingParams; inst.variationParams = params.variationPar...
function adjM = edges2Adj( edges, weights, fun, triangular, symmetric ) %EDGE2ADJ Create sparse adjacency matrix from edge list. % INPUT edges: [Nx2] array of integer specifying the edges of an undirected % graph. % weights: (Optional) [Nx1] array of double specifying the edge % weights...
function [dwtfile,outModel,idl] = runParamOptimizer(model,trcfile,options) % batchKinetics: run parameter optimization % Remove intermediate files from previous runs. warning('off','MATLAB:DELETE:FileNotFound'); delete('resultTree.mat','bwmodel.qmf'); % Load data data = loadTraces(trcfile); if isfield(options,'dataF...
function path = getPathName(str, varargin) % Returns path name for the color statistics project. % % path = getPathName(str, varargin) % % Here, 'varargin' works as in the matlab built-in 'fullfile', i.e. it % concatenates other strings into paths. % % See also: % fullfile % % ---------- % Jean-Francois Lalond...
function [El, Er, Ml, Mr, boxes, I1] = get_eyes_from_skin_mask(I, skin_mask) %[hue,sat,val] = rgb2hsv(I); [H, W] = size(skin_mask); im1 = ~imclose(~skin_mask,strel('disk',5)); imshow(im1) im2 = ~imopen(~im1,strel('disk',4)); imshow(im2) im3 = ~imclose(~im2,strel('disk',5)); imshow(im3) [L,n] = bwlabel(~im3); s = regi...
%% [chi,localField,totalField,fieldmapSD]=SepiaIOWrapper(inputDir,outputDir,varargin) % % Input % -------------- % inputDir : input directory contains DICOM or NIfTI (*magn* and *phase*) files % outputDir : output directory that stores the output (Unwrapped total field and fieldMapSD) % vararg...
function [hyp, px, hyper_traj] = hyper_pseudo_commonInputs(x, y, m, steps, hyp, px) % Calculates the hyperparameters and pesudo inputs of a GP model % (Requires Ed Snelson's 'SPGP_dist' library, assumed to be in the path) % It uses the same pseudo inputs for all output dimensions. % % Input: % x: training samples [n, ...
function rgb = beige rgb = [0.96078, 0.96078, 0.86274]; end
function [update,upindexlist,upmeshlocslist] = initialize_constantcoefficient_update(data) % written by Pierson Guthrey switch data.space_dims case 1 [update,upindexlist,upmeshlocslist,LHS2,predictor_update2,corrector_update2] = initialize_constantcoefficient_update_1D(data); case 2 [update,upi...
%gamble_mega [script] clc; %================================================= USER % Sua aposta de 6 números em ordem crescente aposta = [1 11 22 44 49 50]; %============================================= END USER %Se variável 'sorteios' já existir no Workspace, %não é necesário ler novamente. if (~exist('sorteios', 'v...
X=run{1}; sizee=size(X); sizee=sizee/32; s_run=spectrogram(X, sizee(1), 0); s_run=abs(s_run); % figure; % imagesc(s_run); s_run3_log=log(s_run); % figure; % imagesc(s_run3_log); E_run3 = mean(s_run); E_run3_log = mean(s_run3_log); % figure; % plot(E_run);
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [output_net_norm]=sim_exe(NN,input_rete_norm2) %20141121-ET new function to...
function [W_hist] = get_hist(randpart_seed,parms) clear inited; init clear do_force do_plot parms_inner = parms; %z if ~isfield(parms_inner,'metric_method') disp('Please choose among ITML, OASIS, OASISC, SYMOASIS, PROJSYMO, POSSYMO and SEMISYMO \n'); disp('PROJSYMO and POSSYMO will be based on the OASISC res...
close all clear all clc % i=imread('./AppleDatabase/apple15.jpg'); i=imread('/home/sugandha/Downloads/img1.png'); figure, imshow(i) gray=rgb2gray(i); figure,imshow(gray) se=strel('disk',20); hy = fspecial('log',[9 9], 0.9); %log worked pretty well hx = hy'; Iy = imfilter(double(gray), hy, 'replicate'); Ix = imfilter(...
clear load('EREEFS_GBR4_H2p0_B3p1_Cq3b_Dhnd_SURFACE_SSC.mat'); %% NOTES % 1) CarbSand and Mud have exact same values % 2) TSS does not correspond to the sum CarbSand + Mud + FineSed % so don't know what is it. Better to calculate the sum rather than using TSS % Updates (Sep 2019): % - Mark: Don’t use TSS (which is ...
clear all; clc; % simulation's parameters n = 4; k = 1; dist = 4; % temporal horizon H = 100; % step size step = 0.1; T = [0:step:H]; equilibrium = [0:n-1]'*dist; % initial conditions q0 = [1;zeros(n-2,1);-1]; x0 = equilibrium + q0; v0 = zeros(n,1); % exact solution x = hooke_exact_solution(n, k, dist, H, step, T, x0, ...
function [acc]=eval_acc(imdb,net) % run the CNN setL=3; % 3 is the test set net.eval({'input', imdb.images.data(:,:,:,(imdb.images.set==setL))}); net.mode='test'; %netstats=extractStatsFn(net) % obtain the CNN otuput scores = net.vars(net.getVarIndex('prob')).value; scores = squeeze(gather(scores)); [~,pred_label]=...
function copyfiledebug(src, dest) fprintf('Copying:\n'); fprintf('\t%s\n', src); fprintf('\t%s\n\n', dest); end
% clc % clear all % X = reshape([1:24],8,3); % idx=[1 1 3 3 4 4 2 2]'; % K=4; % [m,n] = size(X); % centroids = zeros(K, n); % Xnew=sortrows([X idx],n+1); % u=unique(idx); % % % s=1; % for i=u' % A=Xnew(:,n+1)==i; % A1=Xnew.*A; % N=sum(A); % centroids(s,:)=(1/N)*(sum(A1(:,1:n))); % s=s+1; % end clc...
function out = sphproj(xv,yv,r1,r2,camPhi,camTheta,outDim) %add notes. %first, do the inverse stereographic projection from voltage space onto %the sphere: xv = xv./r1; yv = yv./r1; x = (2.*xv)./(1+xv.^2+yv.^2); y = (2.*yv)./(1+xv.^2+yv.^2); z = (-1+xv.^2+yv.^2)./(1+xv.^2+yv.^2); ...
Xagent=[0,0]; Xang=0; algN=1; Ball=[000,000]; Opponent=[250,-400; 400,600; -700, -300; -450, 900]; Cang=pi/4; BallDangArea=4; C_dist=100; C=Ball-C_dist*[cos(Cang),sin(Cang)]; MAX_WEIGHT=3000; Stop_Range=300; %% Полиморфизм if (isstruct(Xagent)) if ~isempty(Xang) warning('use Xang=[] if Xagent ...
function y = real48_as_uint8_to_double(x) %REAL48_AS_UINT8_TO_DOUBLE Convert Borland 6 byte reals (Real48) to doubles. % % REAL48_AS_UINT8_TO_DOUBLE(X), where X is an M-by-6 matrix of integer values % in the set {0,1,...,255} (uint8 values), returns an M-by-1 vector of % doubles. Each row vector in X is converte...
clc, clear all data = inriaData; names = {'Go','Si'}; names = {'Si'}; for i = 1:numel(names) params = load(['results/optimize/inriaParameters' names{i}]); params.loggerParameterResults = handler(emptyLogger); % set gridsize values r = struct(params.method.descriptorArgs{:}); % Triangle mink...
function strassen(fisier_in,fisier_out) input = fopen(fisier_in, 'r'); N = fscanf(input, '%d', 1); A = dlmread(fisier_in, ' ', 1, 0); nr = length(A); %elimin coloana de zerouri de la sfarsit n = nr - 1; A = A(:, 1 : n); %conditia de oprire nmin = 32; %apelez functia de ridicare la puterea N C = expos...
function [ f, i ] = fibonacci_floor ( n ) if ( n <= 0 ) i = 0; f = 0; else i = floor ( log ( 0.5 * ( 2 * n + 1 ) * sqrt ( 5.0 ) ) ... / log ( 0.5 * ( 1.0 + sqrt ( 5.0 ) ) ) ); f = fibonacci_direct ( i ); if ( n < f ) i = i - 1; f = fibonacci_direct ( i ); end end ...
clear all, close all, clc; addpath('./data/'); addpath('./equitability-code/'); load metabolicrelation idx = [8,9,13,15,19,21,22,23,24]; data = metabolicrelation(:,idx); clear metabolicrelation clear idx flag_randomsample = false; [n_instances,n_features] = size(data); if flag_randomsample idx_sel = randsample(n...
data = csvread('new_data2.csv'); data_2 = zeros(4100,240068); for i = 1:4100 disp(i); data_2(i,1:240068) = data((i-1)*240068+1:i*240068); end data_3 = data_2*data_2'; [V,D] = eig(data_3); [Vsorted, Dsorted] = eigsort(V,D); data_mean = mean(data_2,1); data_mean_dup = repmat(data_mean,4100,1); da...
function [Xk]=dft(xn,N) % Rotina para computar a transformada discreta de Fourier %--------------------------------------- % [Xk] = dft(xn,N) % Xk = coeficientes da DFS sobre 0 <= k <= N-1 % xn = sequencia finita de N-pontos % N = Comprimento da sequencia n = [0:N-1]; k = n; WN = exp(-j*2*pi/N); nk = n'*k; ...
function [] = trainred() %TRAINRED Used to train the red bayesian classifer model. Assumes that %there is data prestored in properties/heart and properties/diamond %according to the convention specified in readSymProps % The file reading was used to speed up the training since the symbol % dectection process can be...
function S=delauS(x,y) a=sqrt((x(1)-x(2))^2+(y(1)-y(2))^2); b=sqrt((x(1)-x(3))^2+(y(1)-y(3))^2); c=sqrt((x(2)-x(3))^2+(y(2)-y(3))^2); p=(a+b+c)/2; S=sqrt(p*(p-a)*(p-b)*(p-c)); end
ssh = ncread('/project/expeditions/eddies_project_data/ssh_data/data/h/dt_ref_global_merged_msla_h_qd_19930106_19930106_20100503.nc', 'Grid_0001'); lat = ncread('/project/expeditions/eddies_project_data/ssh_data/data/h/dt_ref_global_merged_msla_h_qd_19930106_19930106_20100503.nc', 'NbLatitudes'); lon = ncread('/project...
function [CenterOfMass] = y_CenterOfMass(AtlasFile) % Extract Center of mass. % Input: % AtlasFile - the Atlas File % Output: % CenterOfMass - the Altals region table %___________________________________________________________________________ % Written by YAN Chao-Gan 120917. % The Nathan Kline Institute for Psyc...
% test suite for problem 1 %% Create the test suite test_samples = 1000; no_constant_noise = 0; no_scaled_noise = 1000; lb = [1, 25, -1000, 0.5, -5]; ub = [8, 75, 1000, 1.5, 5]; x = -20:2.5:20; sd_max = 5; sd_fix = 0.0; fid = fopen('SP_test_5.dat', 'w'); %Iterating over no_constant_noise for sample = 1:1:no_const...
%========================================================================% % Take each file from completeDataDirectory, one at a time and extract % % landmarks using the readLdmkFile. Once you have the landmarks, take the% % landmark for the nose and find the spin image for it. Extract all spin % % images for t...
% Maximal supression function outputimage= MaxSupr(Mag,Ang) %image size [rows,columns]=size(Mag); %Max supression image outputimage=zeros(rows,columns); %Compute max suppresion for x=2:columns-1 for y=2:rows-1 if Mag(y,x)>0 t=Ang(y,x); %angle of edge if (t<.57 && t>-.57) ...
clc; clear; close all; file_filters = ... [ "250_13"; "500_09"; "750_04"; "1000_08"; ]; source_folder_name = 'ola05/out/'; dest_folder_name = 'ola05/jsci6_pics/'; for n = 1 : length(file_filters) disp(file_filters(n)); nsga_ii_file = source_folder_name + file_filters(n) + '_binary_nsgaii.out'; ...
function [ h_hd_rm_removed ] = remove_headroom(h, mode, safety_factor, w) % Usage set impulse response to be reduced so peak gain is less than 2 % default safety factor is 0.999 if nargin < 4 || isempty(w) w = linspace(0, pi, 1000); end if nargin < 3 || safety_factor == 0 s...
function y = myidwt(cA,cD,lpr,hpr) % 函数 MYIDWT() 对输入的小波分解系数进行逆离散小波变换,重构出信号序列 y % 输入参数:cA —— 平均部分的小波分解系数; % cD —— 细节部分的小波分解系数; % lpr、hpr —— 重构所用的低通、高通滤波器。 lca=length(cA); % 求出平均、细节部分分解系数的长度 lcd=length(cD); while (lcd)>=(lca) % 每一层重构中,cA 和 cD 的长度要相等,故每层重构后, ...
clear clc syms f(x, y); % ############## Providing necessary information ############## f(x, y) = (sin(x-0.9))^2 + (atan(y-0.2))^2 + 0.1 * x^2; %f(x, y) = (x-0.5)^2 + (y-0.5)^2; % OK %f(x, y) = (sin(x-0.5))^2 + (atan(y-0.5))^2; % OK %f(x, y) = (sin(x-0.5))^2 + (sin(y-0.5))^2; % OK %f(x, y) = acot(x-0.5)^2 + (atan(y-0....
function [img_2] = mySharpen(img_1) img_1 = im2double(img_1); size_1 = size(img_1); h = size_1(1); w = size_1(2); img_2 = zeros(h, w); % 这里讲 拉普拉斯和 图像增强相结合 weight = [-1 -1 -1; -1 9 -1; -1 -1 -1] data = zeros(3, 3); for i = 1: h for j = 1: w %% 这里获得周围的9个像素点的位置, 这里使用min,max来防止边缘处的越界错误, 相当于是近邻值得padding ...
clc; close all; clear all; x=input('Enter the sequence 1: '); y=input('Enter the sequence 2: '); y=xcorr(x,y); figure; subplot(2,1,1); stem(x); ylabel('Amplitude->'); xlabel('n->'); title('Input sequence'); subplot(2,1,2); stem(y); ylabel('amplitude'); xlabel('n->'); title('Output sequence'); disp('the resultant is ');...
clc; clear all; close all; load('rec_1m.mat'); x=val(1,:); ecg=x'; figure(1); plot(ecg); grid on; title('ecg wave'); xlabel('time (msec)'); ylabel('amplitude(mV)'); hold on; f2=zeros(1,2160); Fc=10; Fb=8; M=500; t = -10:1:10; a = sqrt(Fb).*sinc(Fb*10*t/M); b = sqrt(-Fb).*sinc(Fb*10*t/M); ...
function varargout = ExperimentEnter(varargin) % EXPERIMENTENTER MATLAB code for ExperimentEnter.fig % EXPERIMENTENTER, by itself, creates a new EXPERIMENTENTER or raises the existing % singleton*. % % H = EXPERIMENTENTER returns the handle to a new EXPERIMENTENTER or the handle to % the existing si...