text
stringlengths
8
6.12M
function [segments, segment_locs] = segment_image(... img, BinThreshold, MinPeakProminence, MaxPeakWidth) % 二值化图像,以滤去噪声,增强对比度 img_b = imbinarize(img, BinThreshold); % 求水平方向的平均灰度值,并反色以便寻峰 row_avg = 1-mean(img_b, 1); % 寻峰,获得垂直分割线坐标 [~, col_locs] = findpeaks(row_avg, ... 'MinPeakPromine...
function d = dog_leg(grad,B,delta) % 狗腿法求解信赖域方法子问题: % min q(d) = f(x) + grad'*d + 0.5*d'*B*d, s.t. ||d||<=delta % input: grad是x处梯度,B是近似Hessian矩阵,delta是当前信赖域半径 % output: d是子问题的解 % case 1: 全局最优解在信赖域内,走全局最优解 % case 2: 全局最优解和沿负梯度方向最优解都在信赖域外,走负梯度方向直到信赖域边界上 % case 3: 全局最优解在信赖域外,沿负梯度方向解在信赖域内,先走负梯度方向解,再沿两最优解之差走,直...
% 例4,半波整流信号的频谱 % 北京邮电大学,尹霄丽 % 2018年12月 syms T t n; x=cos(2*pi/T*t); %被积函数 integrand=x*exp(-i*n*2*pi/T*t)/T; %积分 Xn=int(integrand,t,'-T/4','T/4'); Xn=simplify(Xn) Xn_1=int(x*exp(i*2*pi/T*t)/T,t,'-T/4','T/4'); Xn1=int(x*exp(-i*2*pi/T*t)/T,t,'-T/4','T/4'); Xnn=[subs(Xn,'n',-10:-2) Xn_1... subs(Xn,'n',0) Xn1... sub...
function lineout = alignLine(linein, blank_surround) if nargin < 2 blank_surround = 1; end %---> Format text: width = 80; line_len = width; lineout = linein; delimiter = '-'; blanks_before = round(line_len/2 - size(linein,2)/2); blanks_after = line_len - (blanks_before + size(linein...
function [Clasificador, PS, M, Sigma] = clasificador(Clase, DIMENSIONES, K_VAR, espacio) Tamano=size(Clase,1); for i=1:K_VAR M(i,:)=Clase(randi(Tamano),1:2); Sigma(:,:,i)=eye(DIMENSIONES); Pi_var(i)=1/K_VAR; end for z=1 for i=1:Tamano for j=1:K_V...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function []=FDTD_12m() %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% KSteps =200; Ex =zeros(KSteps,1); Hy =zeros(KSteps,1); Kc =floor(KSteps/2.0); T0 =40.0; spread =12; NSteps =400; ExBH =[0 0]; ExBL =[0 0]; Esi =[ones(Kc,1); 4*ones(KSteps-Kc,1)]; tStep =[ 1 10 20 30 40 50 100 120 140 16...
clc; close all; clear; %% path='C:\Users\Admin\Documents\MATLAB\Fusion Toolkit\SheetsFinal\'; avgA=zeros(10,7); for SheetNo=1:7 A = xlsread([path 'Dataset8.xls'], SheetNo, 'B2:H11'); avgA=avgA+A; end avgA=avgA./7; Sheet=8; xlswrite([path 'Final.xls'],avgA,Sheet,'B2:H11');
function [] = Lab7_Q3() clc; figure_i = 1; figure_name = 'Lab7_Q3-Figure'; % Parameters for classical BSM. T = 1; K = 1; r = 0.05; sig = 0.6; t_vec = 0:0.01:1; s_vec = 0.5:0.01:1.5; % Surface Plot for Call. c_s_t_var = zeros(length(t_vec), length(s_vec)); fig_name = ['Surface Pl...
%Matriz de refuerzos mixtos % Acciones vs estados % Acciones: 9 % Estados: 19683 %% RM = zeros(19683,9); for e = 1:19683 Estado_index = e; for a = 1:9 Estado = indexToState(Estado_index); [M, error] = ingresar(Estado, a, 1); if error == 0 if ganar(M) == 1 RM...
function [GIACENZA_MIN,dens_BS,dens_D,dens_B95,dens_GA,dens_BD,CARICA,SCARICA,SCARICALITRO,V_MEDIA,MINxKM,TEMPO_MAX,MAXDROP,KM_MIN,DISTANZA_MAX_PVPV,ELLISSE,beta,esponente] = CaricaSettings(baseCarico,conn) setdbprefs('DataReturnFormat', 'table'); setdbprefs('NullNumberRead', 'NaN'); setdbprefs('NullStringRead', 'nu...
function out=nodeg(u,u0) %node output out=0.5*(1+tanh(u/u0));
% Plots figure plot(CA,P*1e-5) hold on figure plot(CA,Tu, CA,Tb) legend('T_u','T_b') figure plot(V,P) yyaxis right plot(V,T) legend('Pressure','Temperature') figure subplot(2,1,1) plot(CA,P) yyaxis right plot(CA,Tu, CA,Tb) legend('Pressure','T_u','T_b') subplot(2,1,2) plot(CA,mu, CA,mb) legend...
clear all; %生成数据点 titles={'原始点'}; N=10; noise_sigma=0.08; x=rand(10,1); y=sin(2*pi*x)+randn(10,1)*noise_sigma; scatter(x,y); hold %拟合数据 for M=2:1:5 X=[]; for x1 = x row=[]; for i=0:1:M %生成行数据 row=[row x1.^i]; end X=[X;row]; end T=y; W=inv((X'*X))*X'*T; %画...
N = 12; highestPow = floor(log2(N)); bin = zeros(1, highestPow+1); rem = N; while rem > 0 power = floor(log2((1/rem)*exp(0.6931))); bin(power+(highestPow+1)) = 1; rem = rem - 2^-power; end bin
%% Initialization and Parameters close all, clear all, tic, InitMovieFiles, nSegments = 6; %Can only be 9, 6 or 4 at this point, but simple to modify code to allow more nPCs = 200; PCuse = 1:100; mu=.15; nIC = length(PCuse); maxshift = 5; %Maximum LOCAL (within acquisition) shift. Smaller than maximal GLOBAL shift (in...
function winmerge(varargin) % FUNCTION: winmerge - Run Winmerge. % % SYNTAX: winmerge(left, right); % winmerge(left, right, filtername); % winmerge(left, right, filtername, halt); % % DESCRIPTION: Run Winmerge. % % INPUT: - left (string) % Left...
function [line, shade, legend_labels] = waveplot2(y, condition,varargin) % Takes time series and wavepain condition and plots it colored according % to tasks to current axes. Condition must be specified with capital letter first. % optional arguments: % - varargin{1} specifies error must be of the same leng...
function varargout = VIS_IR_GUI(varargin) % VIS_IR_GUI MATLAB code for VIS_IR_GUI.fig % VIS_IR_GUI, by itself, creates a new VIS_IR_GUI or raises the existing % singleton*. % % H = VIS_IR_GUI returns the handle to a new VIS_IR_GUI or the handle to % the existing singleton*. % % VIS_IR_GUI('CALL...
function check_P(P,X,XC) n = size(X{1}); nn=prod(n); nc=size(XC{1}); YC = XC{3}; for i=nc(3):-1:1 YC(:,:,i)=YC(:,:,i)-YC(:,:,1); end for i=1:3; xmax(i)=max(XC{i}(:)); xmin(i)=min(XC{i}(:)); end f = @(x1,x2,y)(y-xmin(3))/(xmax(3)-xmin(3)); FC = f(XC{1},XC{2},YC); F = reshape(P*FC(:),n); p.no_error_title=1; ...
thedir='/Volumes/ice1/ben/sdt/KTL03/'; files=dir([thedir,'/ATL*.h5']); out_dir=[thedir,'/ATL06']; if ~exist(out_dir,'dir') mkdir(out_dir) end % read in the SNR F table: fields={'BGR', 'W_surface_window_initial','SNR', 'P_NoiseOnly'}; for kf=1:length(fields) SNR_F_table.(fields{kf})=h5read('SNR_F_table.h5', [...
classdef Animation < handle properties figure; paused; timer; frame; length; render; fps; end methods function this = Animation(fig) this.figure = fig; this.paused = true; this.timer = []; this.frame = 1; this.length = 0; this.fps = 25; th...
function [Model, Info] = linear_map_sparse_cov(X,Y,Model,parm) % Estimate linear weight matrix for input-output mapping % Automatic Relevance Prior for each input dimension % is imposed to get sparse weight matrix % % [Model, Info] = linear_map_sparse_cov(X,Y,Model,parm) % % --- Input % X : Input d...
function Pz=dongtai(v,range,dstartx,dstarty,vx,vy) global h1 global h2 global h3 persistent pstartx; persistent pstarty; if isempty(pstartx) pstartx=dstartx; end if isempty(pstarty) pstarty=dstarty; end pstartx=pstartx+v*vx; pstarty=pstarty+v*vy; Pz=[pstartx,pstarty,range]; Alpha=0:pi/1000:2*pi; x1=range*...
function f_result = dft(input) % discrete fourier transform for 1D or 2D input [M, N, C] = size(input); if ~(M>1 && N>1 && C==1) && ~(M==1 && N>1) error('input should be a row vector or a matrix') end f_result = zeros(M, N); x = repmat((0:M-1)',1,N); y = repmat(0:N-1,M,1); for u = 0:...
temp=struct2cell(Batch); xx=[temp{8,:}]; yy=[temp{7,:}]; for i=1:length(crash_array) if crash_array(i)==0 cc(i,:)=[0 0 1] else cc(i,:)=[1 0 0] end end % ccc(C==0,:)=[0 0 1]; % ccc(C==1,:)=[1 0 0]; scatter(xx,yy,50,cc,'filled') xlabel('Inclination') ylabel('VelocityImpact')
%% Creating working sample % % Input: % obj - subsampling object % X_s - Nx1 vector of discretized values % artX - Nx1 vector of artificially generated r.v. % id_s - Nx1 vector which contains the sub-sample's number % double_cond - scalar % true - calculate double conditional mean for FE % false ...
clear all; CHiMEInit; Nsource = 2; Nchan = 6; Lwindow = 256; Nfft = Lwindow; overlap = 0.75; powThresh = -10; cmin = 6400; % minimum context duration (400 ms) cmax = 12800; % maximum context duration (800 ms) EMITERNUM = 20; GAMMA = 20; sets = {'dt05'}; modes = {'real' 'simu'}; micFailFid = fopen([workRoot 'micfail....
% This function is from % http://www.mathworks.com/matlabcentral/fileexchange/31305-simple-solar-cell-and-panel-model % This cell is of % http://www.cs.wmich.edu/~sunseeker/files/A-300%20data%20sheet.pdf function Ia = solar(Va,Suns,TaC) % Ia,Va = current and voltage vectors [A] and [V] % G = number of Suns [] (1 Sun =...
classdef cs % CS 分类统计 Classified Statistics % 计算数据的分类统计属性 % 陆怀宝个人使用并维护 % Lu, Huaibao; 201307;  % Cheng, Gang; 20140124; 添加注释并检查 properties end methods (Access = 'public', Static = true, Hidden = false) [ category ] = categorize( data ); [ patterns,id ] = excldPa( patt...
function [ distn ] = prepScore( distn, dirinv ) %prepScore normalizes distn % Shifts the min of distn to zero, then normalizes to the max of distn % Inverts if higher values are detrimental %% Shift and normalize to 1, invert if necessary distn = (distn - min(distn)); distn = distn/max(distn); if strcmpi(d...
function gcd = naivegcd(a, b) gcd = -1; %if invalid inputs (-ve numbers) then return -1 if (a >= 0) && (b >= 0) && (a + b) > 0 %checking validity of inputs if a == 0 || b == 0 gcd = max_u(a,b); %checking if one input is 0 return the othe...
%% Problem Set 1 % CPNS 34231 %% Problem 1: Data visualization clear all; close all; % 1.1 Create a raster plot of the data in mtSpikeTimes.mat. load('mtSpikeTimes.mat'); figure; subplot(2,2,1); RasterPlot(mtSpikeTimes,'k'); xlabel('Time (s)'); ylabel('neuron'); title('Raster plot'); subplot(2,2,2); RasterPlot(mtSp...
h = kOpenPort(); kSetEncoders(h,0,0) p1 = [230,50]; p2 = [230,360]; rad = degtorad(90); avoid_obstacle(h,p1,p2,rad);
%genPEscript % [P, E] = PEInit(1,[10; 10; 0; 0],0,0,1,[60; 80; 1; -2]); % %Pn,Ppos,Pmeas_std,Pact_std,En,Epos % save examples/PE100x100_1.mat P E % % [P, E] = PEInit(1,[10; 10; 0; 0],0,0,1,[60; 20; 1; 2]); % %Pn,Ppos,Pmeas_std,Pact_std,En,Epos % save examples/PE100x100_2.mat P E % % % % [P, E] = PEInit(1,[5; 5; 0;...
%This code helps with the eigenvector test (cos? = (???)/????b?). The code %computes ??? and normalizes it (???)/????B?). The B represents the %control strategies (Bmatrix).The left eigenvectors(w) is obtained from %eigfolder (The eigenvalues in this folder were obtained from the %compute_eigs.m). The eigfolder also...
function [l, R] = findHpl_inf2( Iloc, P1, P1t, P2, P2t ) %{ removes the perspective distortion from an image at Iloc. this is also called affine rectification. we first find the image of the line at infinity (called Hp(l_inf)). with this, we can calculate the transformation that removes the perspective distortion. -...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 16833 Robot Localization and Mapping % % Assignment #2 % % EKF-SLAM % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear; close all; clc; %==== TEST: Setup uncertainity parameters (try different values!) === sig_x = 0....
function varargout = imshow6(varargin) % h = imshow6(x,y,I) % % imshow with the version 6 parameter layout % % Mercurial revision hash: $Revision$ $Date$ % Copyright (c) 2010, Eric Tytell v = ver('images'); if (str2num(v.Version) >= 5), if ((nargin >= 3) && all(cellfun(@isnumeric,varargin(1:3)))), xd = var...
function result = draw_line(image, point1, point2) % function result = draw_line(image, [y1, x1], [y2, x2]) result = draw_line_value(image, point1, point2, 255);
% this script was used to take data from compute shape and unroll the % particle in polar coordinates to get rid of double values functios, but % it was getting too hard to make that work, so i'll eliminate the fourier % analysis all together. function[tj_A, Rj_A] = unrollParticle(mP,X) y_bar = mP(2); x_bar...
function varargout = get(obj,varargin) if length(varargin) == 0 display(obj); return; % Nothing more to do end % Try to get properties one at a time getProps = pvget(obj,'getProps'); nProps = length(varargin); for i = 1:nProps % Get this prop propertyName = varargin{i}; if ~ischar(propertyNa...
% Pricing Asian Call Option with Locally One-Dimensional (LOD) numerical scheme % Input s0 = 5; K = 5; r = 0.1; sigma = 0.5; T = 1; dt = 0.001; ds = 0.5; dI = 0.5; % Locally One-Dimensional scheme s_max = 3*s0; nums = round(s_max/ds); numt = 2*round(T/dt); I_T_max = T*s_max; numI_max = round(I_T_max...
function [p,tab,chi2,labels] = mediantest(varargin) % [p,tab,chi2,labels] = mediantest(varargin) performes Mood's median test: % Mood's Median Test compares the medians of % two or more groups. The test counts how many observations in each group % are greater than the global median for all groups together and % calcul...
function [ hfig ] = plot_delta_S( self , S ) %PLOT_DELTA_S 画delta~S的图 % --------------------- % 吴云峰,20160129 % 吴云峰,20160229,构建一个比较新的复原方法 % 吴云峰,20160316,模仿刚哥修改了默认横轴的值, 加画当前点,略改标题 %% 预处理 % TODO: 相关预处理 % 将旧的变量进行保存 copy = self.getCopy(); [ L1, L2 ] = size( copy.optPricers ); %% 画图 % 横轴S默认值域 if ~exist( 'S' , 'var' ) ...
% watermark : _add watermark to figure : watermark(txt,FontSize); % % Call % watermark(txt); % watermark(txt,FontSize); % ax=watermark(txt,FontSize,position); % function [ax,t_handle]=watermark(txt,FontSize,position); if nargin<2 FontSize=6; end if nargin==0 txt='mGstat'; end if nargin<3 position=[.6 .0...
clear all eclipse_init % outpath = 'C:\Users\jaker\Pictures\Oregon_Eclipse\code\matlab\out'; % dirname = 'C:\Users\jaker\Pictures\Oregon_Eclipse\16bit\png'; % offsets = load(fullfile(outpath,'offsets.mat')); % etimes = exposure_times(); % Get the two test images % for fi = 6:2:15 img_num= 5; img_nums = [img_num,img_nu...
clc clear all map_definition start_pt = [17 2]; % the start point dest = [2 20]; % the destination plot(start_pt(1),start_pt(2),'r*'); plot(dest(1),dest(2),'g*'); numOfPts = 1; % number of points added to the map. % these points represent Node objects. n = input('How many other nodes do you want...
thisSession = meta(20,:); ops = io.loadOps(thisSession) %% ops.fslow = 3e3; ops.fshigh = 250; raw = io.loadRaw(ops, 120*30e3 + [1 30e3*10], true, false); % raw = raw / max(abs(raw(:))); if isfield(ops,'fslow')&&ops.fslow<ops.fs/2 [b1, a1] = butter(5, [ops.fshigh/ops.fs,ops.fslow/ops.fs]*2, 'bandpass...
%********************************************************************************************** %******************************* BASIC HELPER FUNCTIONS ************************************* %********************************************************************************************** function mag = Magnitude(V)...
function optpolicy = getOptPolicy_aPDM_R(params,optpolicy_dir) %Computes the value function using Bellman's equation for attention-based %perceptual decision making % Inputs: % params: task parameters % optpolicy_dir: directory where optimal policy is saved, in case this was % already computed. If not, the function wil...
%% Blob Detection demo % This program demonstrates how to use BLOB to detect and filter region. % % <https://github.com/opencv/opencv/blob/3.1.0/samples/cpp/detect_blob.cpp> % %% Image img = cv.imread(fullfile(mexopencv.root(),'test','detect_blob.png'), 'Color',true); img = rot90(img); %% Detector Parameters % this i...
function y = parseTags(x) % PARSETAGS Get rid of the HTML markup and keep the synapse names % % 1Oct2017 - SSP if ischar(x) x = {x}; end validateattributes(x, {'cellstr', 'cell'},{}); y = cell(0,1); % localNames = cat(2, localNames, regexp(tag, '"\w*\w*"', 'match'); fo...
function plottingEEGresults(dataEEG,dataEEGNull) m=20; xq=-1.7:0.05:1.7; logRatioInput=[]; logRatioInputNull=[]; fwValue=[]; bwValue=[]; fwValueSS=[]; bwValueSS=[]; binsHist=3:20; for ss=1:size(dataEEG,2) %here we combine all the sbj in one vector logRatioInput=[logRatioInput dataEEG(ss).logRatio]; ...
[t,y]=ode23(@ex5_dydt, [0 4], 0.5) ; options=odeset('RelTol', 1e-4) ; [t,y]=ode23(@ex5_dydt, [0,4], 0.5, options) ; %PB: je sais pas quoi mettre comme nom %d'axes !!!!!! ET je sais pas expliquer en détails !! stem(t,y)
function [cv, cr]=doe(lb,ub,active) % % Matlab-based Design of Experiments % % This routine will generate the candidate values and the candidate responses % for a full qradratic Koshal design with postive interactions % % doe type flag doe_type_flag=0; % 0=> Koshal design, 1=> alternative design % set flag for vdoc_...
%% Stelling 21 % % Je kunt een numerieke vector (met een lengte groter dan 0) % altijd plotten in Matlab. % Antwoord = 1;
load Mastermind % Loads Board (10x8 cell array), eight color blocks (red, green, blue, yellow, purple, pink, orange, turquoise), a white peg block and a black peg block. imshow([Board{1,:};Board{2,:};Board{3,:};Board{4,:};Board{5,:};Board{6,:};Board{7,:};Board{8,:};Board{9,:};Board{10,:}]) % Show all 10 rows and 8 c...
function transform3d(T, mode) % Coordinate frame transformation animation switch mode case 0 trplot(T) case 1 for i=1:length(T) trplot(T(i)) end end end
function pedigree_loader(pedigree_filename,outputfile) %% CONSTANTS CHILD = 1; FATHER = 2; MOTHER = 3; ORIGIN_PNUM = 4; RAISED_PNUM = 5; YEAR = 6; RECRUITED = 7; NESTBOX = 8; %% FILE LOADER fid = fopen(pedigree_filename); raw_data = textscan(fid,'%s'); fclose(fid); N = length(raw_data{1}); %% initialize containers b...
function mtlsimplesf(infile, outfile, new_sampling_rate) % function mtlsf(infile, outfile, new_sampling_rate) [file_type,info_blocks,n_channels,n_lines, sampling_rate,... first_line,last_line,n_directions,comment1, comment2] = mtlrh(infile) if (file_type ~= 2) error('Wrong filetype'); return; end; fac...
function shapes = sobel_operator(img) % use the sobel-operator on the raw depth image % this function returns a matrix of the same size as the original % matrix with on every position the gradiŽnt X = img; Gx = [1 +2 +1; 0 0 0; -1 -2 -1]; Gy = Gx'; temp_x = conv2(X, Gx, 'same'); temp_y = co...
clear; clc; close all; % % Consider n coupled second order dynamics % d^2 xi/dt^2 = -gamma dxi/dt + SUM_j A(i,j) * (x(j)-x(i)) + Pi; % % To use ode45, we convert the n second order equations 2n first order equations %coupling=full(BAgraph(100)); % Create a (random) matrix [coupling,P]=getNetwork('network1'); % Di...
% script for homework one % created by Jesse Jurman % load and show the orange flower image flower = imread('OrangeFlower.jpg'); figure, imshow(flower), title('Orange Flower') % assign the green pixel plane greenData = flower(:,:,2); figure, imshow(greenData), title('Orange Flower Green Pixel Data') % assign rows 16...
% Connect to bot Pb = PiBot('172.19.232.173', '172.19.232.11', 32); % Get Image image = getLocalizerImage(Pb); % make occupancy grid normImage = double(image) / 255; biColour = (normImage > 0.04) - (normImage > 0.2); %0.25 -> biColourClean = bwareaopen(biColour, 1000); occupancyGrid = imresize(biColourClean, 1/5); id...
%% SEL_compute_map_instrument_scores.m % This function evaluates for each instrument, 4 different architectures: % a single satellite carrying one copy, and then constellations carrying 2, % 3, and 4 copies in different planes. % Assume params structure has been created % Clear expl facility clear explanation_facility...
function irg = gtsirg(sp) %最後の方のデータは切り捨て l = length(sp); irg = zeros(1,l)'; for i = 1:l irg(i) = mirgetdata(mirregularity(sp{i})); end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function [points2] = transformPoints(points, dx, dy, scaling, rotation) % purpose : Rotate, translate and scale the given points. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
function [e] = test11(cleanup, level) %TEST11 Filter tests % Thomas Ruark, 5/10/2006 % Copyright 2006 Adobe Systems, Inc. [a,b,c,d] = psconfig('pixels', 'pixels', 100, 'no'); psnewdoc(512, 512); % top left is gray x = uint8(ones(256,256,3)) * 127; pssetpixels(x, 'undefined', 0, 0, 256, 256); % top right is ra...
clear all; warning off; clc; load myWiki; bit = 64; % the number of hash bits %% precessing if size(L_tr,2) == 1 S = zeros(size(L_tr,1),max(L_tr)); for i = 1:max(L_tr) ind = find(L_tr==i); S(ind,i) = 1; end else L_tr(L_tr <= 0) = 0; L_tr(L_tr > 0) = 1; % %normalize t...
clear; close all; clc; %% MLC Lab %% Quanser Aero Helicopter control quanser_aero_parameters; quanser_aero_state_space; s = tf('s'); Gunc = ss(A,B,C,D); Gnom = tf(Gunc); %% MIMO Poles and zeroes z = tzero(minreal(Gnom)); p = eig(minreal(Gnom)); fprintf('Poles of the nominal system are:\n'); disp(p); fprintf('Zeros of...
function [] = GenVarSequence_1 (path, ReqNr) % Sync. the partitioned variants using stateflow % for each set of generated variants a control part should be added % % design outside connection add_block('Simulink/Ports & Subsystems/Subsystem',[path sprintf('/TestDataVariants Sequence')]); iTestC = [path sprintf('/Tes...
global glv glv.Re = 6378160; %地球半径 glv.f = 1/298.3; %地球扁率 glv.e = sqrt(2*glv.f-glv.f^2); glv.e2 = glv.e^2; %地球椭圆度等其它几何参数 glv.Rp = (1-glv.f)*glv.Re; glv.ep = sqrt(glv.Re^2+glv.Rp^2)/glv.Rp; glv.ep2 = glv.ep^2; glv.wie = 7.2921151467e-5; %地球自转角速率 glv.g0 = 9.7803267714; %重力加速度 glv.mg = 1.0e-3*glv.g0; %毫重力加速度 glv.ug = 1.0e...
clear; clc; communityExample; graphPlot = plot(graph(adjacencyMatrix)); % highlight(graphPlot, 1:5, 'NodeColor', 'g'); [Q, grouping] = Split(adjacencyMatrix); sprintf('%0.6f',Q) elementsA = find(grouping == -1); elementsB = find(grouping == 1); [Q, groupingA] = SubSplit(adjacencyMatrix, elementsA); % [Q, grouping...
function draw_ellipsoids_3d(P,Ell,Ell_AA,exp_comp,palette_label) palette_size = length(palette_label); tuples = gen_tuples(1:palette_size-1,3); for i = 1:size(tuples,1) % PROJECTION BASIS idx_1 = tuples(i,1); idx_2 = tuples(i,2); idx_3 = tuples(i,3); % ORTHOGONAL MATRIX basis = zeros(palette_size-1,3); basis(idx_1,...
function mtl2mat(file) % MTL2MAT converts mtl2 file to matfile % mtl2mat(file) file is name of mtlfile without extension .mtl % The matlab-file will be file.mat % written by Klaus Hartung % Lehrstuhl fuer allgemeine Elektrotechnik und Akustik % Ruhr-Universitaet Bochum % % Date 26.09.1995 filename=[fi...
%% Proyecto LTDS %% Cargar imagen y dividir en planos % Cargamos imagen RGB Img = imread('blanco_negro2.png'); % Creamos tres variables cada una con un color R, G y B ImgR = Img(:,:,1); ImgG = Img(:,:,2); ImgB = Img(:,:,3); % Guardamos tamaño y número planos de colores [m n p] = size(Img); %% Transformada directa,...
function rot_elenum = find_rot_elenum(rot_mid, xmax, ymax, edgex, edgey, xelenum) xx = rot_mid(1,1); yy = rot_mid(2,1); if xx > xmax xx = xmax - 0.001; end if xx < 0 xx = 0.001; end if yy > ymax yy = ymax - 0.001; end if yy < 0 yy = 0.001; end xnum = floor(xx/edgex) + 1; ynum = flo...
clear;clc; %////////////////////////////////////////////////////////////////////// directory = 'R:\funded_projects\Grytz-R01EY026588-Scleral_remodeling_in_myopia\organ_culture\'; prompt_exp_number = 'Enter the exp number for this experiment: '; exp_number = input(prompt_exp_number); prompt_brx_number = 'Enter the brx n...
%{ Test Functions for rn. power_flow_f looks good. rn this is scrap to see if I can start figuring this out. %} clear all; import const.* a = 10; b = 4; testCase = 'case14'; h = 0.001; %Step Size %Graph size x0=10; y0=10; width=550; height=400; %read in Index values as paramiters idx = idxVal; %Initializ...
function anMocap(wsMoc) % Animate motion capture sequence. % % Input % wsMoc - mocap data % % History % create - Feng Zhou (zhfe99@gmail.com), 09-02-2010 % modify - Feng Zhou (zhfe99@gmail.com), 08-30-2014 prIn('anMocap'); % mocap [skel, QC, Conn] = stFld(wsMoc, 'skel', 'QC', 'Conn'); nF = size(QC, 3); ...
function processIncoming(src, ~) inStr = readline(src); fprintf('\n-> %s', inStr); end
%% Compute the PSNR for all restored vs original figures clear all close all clc fileDir = fileparts(mfilename('fullpath')); cd([fileDir,'\..\']) Folder = fullfile([fileDir, '/../']); addpath(Folder); %% Barbara barbara_o = imread('Good_images/barbara.png'); cd([fileDir,'\..\Results']) Folder = fullfile(...
function [shift1 shift2]=driftcorrection_core2D(im1,im2,iniguess) corrim=imgaussfilt(single(normxcorr2(im1,im2)),1); %old 1 if nargin>=3 shift_col=iniguess(2); shift_row=iniguess(1); rowval=shift_row+(size(corrim,1)+1)./2; colval=shift_col+(size(corrim,2)+1)./2; cropsz2=24; ori=[colval-cro...
function [actstates,hmm,Gamma,Xi] = getactivestates(hmm,Gamma,Xi) %ndim = size(X,2); K = hmm.K; orders = formorders(hmm.train.order,hmm.train.orderoffset,hmm.train.timelag,hmm.train.exptimelag); if isfield(hmm.state(1),'Omega'), ndim = size(hmm.state(1).Omega.Gam_rate,2); else ndim = size(hmm.state(1).W.Mu_W,...
% Convert an edge list of a general graph to the edge list of a simple % graph (no loops, no double edges) - great for quick data clean up % INPUTS: edgelist (mx3), m - number of edges % OUTPUTs: edge list of the corresponding simple graph % Note: Assumes all node pairs [n1,n2,x] occur once; if else see add_edge_weigh...
% Abstract class for black-box optimisers % % Author : Darwin LAU % Created : 2016 % Description : classdef (Abstract) BBOptimiserBase < handle properties numVars % Number of variables for x objectiveFn % Objective function for black box optimiser end m...
function [ToA] = find_start_frame(r, blockSize, CPsize) % FIND_START_FRAME finds the index of the beginning of a frame % contained in signal r by computing a block based auto-correlattion % and applying a moving average on it (with r being a stationnary signal) % - r is the received signal (corrupted by noise) % - bl...
classdef ProjHmNewton < handle properties x t CageX CageT newCageCoef edgeInfo p2p_weight smooth_weight pre_numPoint_constraints numPoint_constraints original_var variable isometric_sample_points lip...
clc; clear all; %%% Simulating a particle moving in a plane using Kalman filter estimate %%% INPUTS %dur - duration of simulation in secs %dt - Time step in secs %sigma_acc - SD of acceleration ms-2 %sigma_gps - SD of GPS measurement m dur = 10; dt = 0.1; sigma_acc = 0.5; sigma_dis = 2; %System Model A = [1 dt 0 0; 0 ...
function x = gaussExCal(A,b) %GAUSSEXCAL 高斯列主元消元法求线性方程组 % 输入:A b线性方程组系数和值 % 输出:x 求解结果 num = numel(b); x = zeros(numel(b),1); Ab = [A,b]; for j = 1 : num-1 temp = max(abs(A(j:end,j))); if temp == 0 error('矩阵非奇异'); end [posi1,~] = (find(abs(A(j:end,j)) == temp)); temp = Ab(posi1(1)+j-1,:);...
function makeOdorTrial() trial_duration_s=6+3+6; % total duration of the trial odor_on_s=[6 9]; % odor start/stop time odorId='odor_A'; % string - 'odor_A' or 'odor_B' dbstop if error ephysSettings % Create empty traces zeroCommand=zeros(1,settings.sampRate*trial_duration_s,1); A_valve_command=zeroCommand; B_valve...
function [dzdx, dzdb] = vl_nnST_der(x,b,dzdy) %VL_NNRELU CNN Soft thresholding, backward pass. % % [DZDX,DZDB] = VL_NNST(X, B, DZDY) computes the derivative of the block % projected onto DZDY. DZDX and DZDY have the same dimensions as % X and Y respectively. % bb = repmat(permute(b,[2,3,1]),size(x,1),size(x,2),1,...
function [p,Valore,od_dep_media]=AssegnazionePriorita(od_dep_pv,od_pv_dep,od_pv_pv,n_ordini,peso,maxcap,ordini,esponente,ELLISSE,beta,preferenza_pv_pv,DISTANZA_MAX_PVPV) p=zeros(n_ordini,1); od_dep_media=(od_dep_pv+ od_pv_dep); for i=1:n_ordini for j=1:n_ordini % normalizzo la coppia per la quantità ma...
function [ activated_sources ] = define_activated_source_space( Quads , source_nb , subjId ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Function to determine which sources are supposed to be activated %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
% function[C_table] = ContingencyTable(A,B) % This code calculates the Contingency Table for calculating the Rand % Indices % A = input cluster number 1 % B = Input cluster number 2 % Date 24 March 2013(Hemanta Medhi) function[C_table] = ContingencyTable(A,B) C_table = zeros(length(A),length(B)); for i =1:length(A) ...
%% Reachable set over-approximation based on sensitivity bounds of a continuous-time system % The sensitivities represent the matrices of partial derivatives of the % finite-time successors of the system with respect to either the initial % state or the input (assumed constant over the considered time range). % For eac...
% INVESTIGATEGROUNDROUGHNESS Investigate different approaches of testing % ground roughness. % % Yaguang Zhang, Purdue, 11/21/2019 clear; clc; close all; dbstop if error; % Locate the Matlab workspace and save the current filename. cd(fileparts(mfilename('fullpath'))); cd('..'); addpath('lib'); curFileName = mfilenam...
% load 064_0004_norm_16.mat; % load C_1-16-10.mat; % load feature/C-2.mat dd = zeros(length(test_f), 1); orl = zeros(224, 224); for i = 1: length(test_f) dt = pdist2(double(test_f(i, :)), CC{1}); dd(i, 1) = find(dt == min(dt)); end [w, h] = size(orl); dd_tag = 1; for wi =1 : 8 : w for hi = 1 : 8 : h ...
clear all; close all; clc odir = 'C:\Users\Tobias Hauser\Desktop\BEN\2017_05_25\'; structMRI = [odir 'sMP01857-0013-00001-000224-01_T1w.nii']; functMRI = [odir 'fMP01859-0006-00001-000001-01.nii']; ROI = [odir 'SNVTA_MP01857.nii']; options.out_fname = 'SNVTA_MP01857.roi'; ROI2TBV(structMRI,functMRI,ROI,options)
function pGlobal = trans(pOrigin,pBody) %pOrigin - Location of body-fixed frame origin in global frame and angles from body % fixed frame axes to corresponding global axes using 123 Euler angles [x y z al be ga] %pBody - Location of point on body in body-fixed frame [x1 y1 z1] %pGlobal - Location of point on ...