text
stringlengths
8
6.12M
% Runge-Kutta simulation of flow experiment: warning off % frequency of sinusoidal activation paradigm: freqHz = 0.1; % hz Ttag = 0.9; % seconds phase = 0; doFigs=1; waveform='sinusoid' freq = freqHz*2*pi ; % change to rads/ sec. SECONDS = 1000; % step size =10 points / second dt = 1/SECONDS...
function image = filterim( im ) % Performs some image filtration im = medfilt2(im,[2,2]) - imgaussfilt(im, 900); im = mat2gray(im); im = ordfilt(im, 4, true(2)); im = im - stdfilt(im); im = im -rangefilt(im); level = graythresh(im); h = special('gaussian'); se = strel('sphere',6); im= imdilate(im, se); im = imerode(i...
%Volumen de cinco esferas for r=1:5 vol = (4/3)*pi*r^3; disp([r, vol]) end;
function skinColorRatio = skinColorRatio(I) height = size(I,1); width = size(I,2); %Convert the image from RGB to YCbCr img_ycbcr = rgb2ycbcr(I); Cb = img_ycbcr(:,:,2); Cr = img_ycbcr(:,:,3); %Detect Skin [r,c,v] = find(Cb>=77 & Cb<=129 & Cr>=125 & Cr<=173); skincolor = size(r,1); %Mark Skin ...
function [r, var, Rmeans] = varRatio(NVec, vertPotCell, SolCell) var = zeros(length(NVec) + 1); idx = cumsum(NVec); idx = [0 idx]; Rmeans = cell(length(NVec)+1,1); for i = 1:length(NVec) [var(i), Rmeans{i}] = var_SO3(SolCell(idx(i)+1:idx(i+1)), vertPotCell(idx(i)+1:idx(i+1)) ); end [var(end), Rmeans{end}] = var_S...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This is the sub-function for calculating the frequencies for the % complementary elements, because the frequency for the underlying % parameter has been set as the OmegaMax % % Input: % paraDim: ...
function plot_log_int(h,t,x) % Plotting the L1 norm of the solution y1 = h(1:end/2,:); y2 = h(end/2+1:end,:); xStep = x(2)-x(1); plot(t, log10(abs(sum(y1,1).*xStep))); xlabel('t'); ylabel('L_1'); title('The evolution of \int \eta_i dx in time') %figure; ...
function [wellLog] = stp8CalcWellLog(fileName, targetDep, distInv) % 这是一个计算测井曲线的函数 % % 输出 % wellLog 输出的测井曲线,当前是一个3列的矩阵,[深度,vp(m/s),vs(m/s),密度] % % 输入 % fileName segy文件 % targetDep 目的层深度 % distInv 采样间隔,上下各扩张多少米 % timeInv 采样时间,每隔多少毫秒输出一次 % % 范例 % stpCalcWellLog('E:\苏里格\SuligeInversion\SU59-13-4...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Vortex_var: basic statistics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Compute association between medication and learning rate in patients %% LOAD DATA clc clear close all % More variables Vortex_load; Vortex_variables; % create some variables %% Define more stuff signif ...
%Convert complex diagonal form to real block diagonal form function [V,D] = complexDiagToRealDiag(A) [V D] = eig(A); [V D] = cdf2rdf(V,D);
classdef PolygonsManagerMainFrame < handle %POLYGONSMANAGERMAINFRAME Class that creates the main frame of the application % % Creation : % figure = PolygonsManagerMainFrame; % %% Properties properties % PolygonsManagerData that contains all the data of the application model; % struct containing the h...
clear f1 = 1000; f2 = 4*f1; fs = 44100; tlen = 1; fm = 4; phi_deg = 90; dichotic = 0; risetime = .125; [stim_fm] = FM_phi(f1,f2,fs,tlen,fm,phi_deg,dichotic,1); [stim_am] = SAM_phi(f1,f2,fs,tlen,fm,phi_deg,dichotic,0); phi_rad = (phi_deg/360) * 2*pi; t = 0:1/fs:tlen-1/fs; x = 0.5+ 0.5*sin(2*pi*fm.*t); y = 0.5+ 0.5*si...
classdef location_holder < handle properties loc_table; loc_index; number_of_active_locations; active_locations; locations_in_database; end methods function obj = location_holder(location_filename) fid = fopen(location_f...
% Michael Miller % ENGR 297 - MATLAB Project Part 2 % April 26, 2016 clear all; close all; clc; bone = imread('mouse_femur.jpg'); binary = zeros(496); lower = input('enter lower threshold percentage limit[0-100]: ')/100; upper = input('enter upper threshold percentage limit[0-100]: ')/100; %Determin...
% Seleccionar ficheiro de dados e interpretar a matriz fornecida: % O programa apresenta ao utilizador os nomes de todos os % ficheiros .mat disponíveis na directoria de trabalho, pede ao % utilizador para introduzir o nome (com extensão .mat) de um deles. % Em seguida carrega o ficheiro pretendido para o processar, e ...
function[result]=PCR(X_train,Y_train,X_test,Y_test,k) %% IV. 主成分分析 % 1. 第一主成分vs.第二主成分 figure [PCALoadings,PCAScores,PCAVar] = princomp(X_train); plot(PCAScores(:,1),PCAScores(:,2),'r+') hold on [PCALoadings_test,PCAScores_test,PCAVar_test] = princomp(X_test); plot(PCAScores_test(:,1),PCAScores_test(:,2),'o') xlabel('1s...
global epsZero; epsZero = 1000*eps; r = 1; G = @(x,y) 0.1*x.^2+y.^2-r^2 dGx = @(x,y) 0.2*x dGy = @(x,y) 2*y stepwidth = 10^-2 phi = 0 x0 = 0 y0 = 1 h = 10^-1*2 [x y] = implicitCurve(G, dGx, dGy, x0, y0, 4.5*pi*r, h,h); % hier geht was schief, bei 100 geht's noch plot(x,y); hold on [x y] = implici...
omega = 7.2921150E-5; phi = 0.872665; g = 9.81; l = 8; wo = sqrt(g/l); r = 6371397; %m time = 2*60*60; %2 hours in sec h = 0.1; t = 0; x = zeros(time/h+1,0); y = zeros(time/h+1,0); x_actual = zeros(time/h+1,0); y_actual = zeros(time/h+1,0); m = zeros(time/h+1,0); n = zeros(time/h+1,0); t_vector = zeros(time/h+1,0);...
close all load('Data') % Parameters inferred from data scaling mu{1} = 0.5; mu{2} = 3.5; % Parameters inferred from cumulative velocity lambda{1} = 1; lambda{2} = 3; % Initialization GroupsNumber = length(fieldnames(Data))-1; GroupsNames = fieldnames(Data); flux = cell(length(GroupsNumber),1); PrimStartFlux = cell(...
function img = backProjectMex( sino, geom, M, i, projType, map ) % Backward projection using distance driven method with ordered subset in 2D % and 3d. Exact traspose to the forwardProjectDistanceDrivenMex % input: % sino - projection result aka sinogram % geom - system geometry % M - number ...
function S = sumNN(spins, i, j) S = spins((i-1), j) +... spins((i+1), j) +... spins(i, (j-1)) +... spins(i, (j+1)); end
function analyzeMultiFiles(field) %% Get paths to data files [fName,fDir,fFilter] = uigetfile('*.txt;*','Open data file',... 'C:\Users\debivort\Documents\MATLAB\Decathlon Raw Data','Multiselect','on'); %% Iterate through each data file if iscell(fName) nGroups=length(fName); else nGroups=1; end if nGrou...
% Clayton Kirberger % Final Project % PY 525 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This program is designed to return optimal launch parameters for a % spacecraft leaving from Earth %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % !!!!!! TO DO !!!!!...
function [ output_args ] = copyFileFolder %copyFileFolder - do stuffto copy a folder, and also a specific file from %the Z drive to the local drive. % Where from? %orig = '/Volumes/Seagate Expansion Drive/PhD DATA/SOTON -ve/'; %orig = '/Volumes/Data/Lab Data/Liver/PBC/H5 files and row data/'; orig = '/Volumes/Data/Lab...
function out = funk4(funk3, a, b) % This function references our class lecture from 7/7/15 -> the function plots funk3, with a and b as xmin and xmax, and also takes funk3((-6 + 6) / 2), which returns -8 since x becomes 0 fplot(funk3, [a b]) out = funk3((a+b) / 2) end
clear all close all dx=.2e-6;dy=.2e-6; length=20e-6; breadth=10e-6; N=round(length/dx);M=round(breadth/dy); l_core=10e-6;b_core=5e-6; a=dx^-2;b=dy^-2; lambda=1.550e-6; k=2*pi/lambda; x=[1:N]*dx; y=[1:M]*dy; n0=1; p0=k^2*n0^2-2*a; n1=3.5; p1=k^2*n1^2-2*a; A=zeros(N*M); for i=1:N*M A(i,i)=p0; end for j=1:(M...
function ContactDetection_PW(dGap) %-------------------------------------------------------------------------- % All copyrights reserved @ 2014-2050 Dr. Gaofeng Zhao % TIANJIN UNIVERSITY (China) % Email: dicetju@qq.com %-------------------------------------------------------------------------- % P2W Contact Dete...
%Example 3.24 % clf reset; setfsize(400,400); echo on clc P = [-3 -2 -2 0 0 0 0 +2 +2 +3; 0 +1 -1 +2 +1 -1 -2 +1 -1 0]; C = [1 1 1 2 2 2 2 1 1 1]; T = ind2vec(C); pause % Strike any key to plot these data points... clc colormap(hsv) plotvec(P,C) title('Input Vectors') xlabel('P(1)') ylabel('P(2)') pause % ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Developer: Kartik S. Pandya, PhD (email: kartikpandya.ee@charusat.ac.in) %Professor, Dept. of Electrical Engg., CSPIT, CHRUSAT, Gujarat, INDIA % Improved Chaotic Differential Evolutionary Particle Swarm Optimization (I-C-DEEPSO) algorithm as ...
function [T1, T2] = ExtractTSFromRamaPrelim(ramaname, ChipodDepth) rama = load(ramaname); [z1,z2] = ChooseDepthLevels(floor(rama.depth), ChipodDepth); disp(['RamaPrelim: Choosing depths at ' ... num2str(rama.depth([z1, z2]), '%d m ')]) T1.time = rama.time; T1.S = rama.sal(z1,:); T1....
% 05-2012 % Victor Barres % USC Brain Project % Script to display dipoles boxcar functions function disp_dBoxcar(varargin) if isempty(varargin) simName = getSimName(); else simName = varargin{1}; end simPath = sprintf('simulations\\%s',simName); load(sprintf('%s\\dBoxcar',simPath)); numPlot = length(dBoxcar...
function [all_theta] = oneVsAll(X, y, num_labels, lambda) % Trains logistic regression for multiple classifiers and returns all % weight parameters of classifiers in a matrix all_theta % Input: X - training dataset (row = training examples, columns = % features) % y - training labels (r...
%steady state values for mediumscale.mod load param_mediumscale; %Tech Shock A_ss = 1; %MEI Shock Z_ss = 1; %Inter Pref Shock nu_ss = 1; %gross inflation Pi_ss = 1; %price level P_ss = 1; %gross interest R_ss = Pi_ss/beta; %capital utilization (imposed) u_ss = 1; %multipliers are equal in SS. lambda_1_ss = lam...
function processAnimation(gates,initialState) % ... % Copyright 2017 Yulin Wu, University of Science and Technology of China % mail4ywu@gmail.com/mail4ywu@icloud.com rotStep = 2*pi/100; if nargin < 2 initialState = sqc.qs.state('|0>'); else if ~isa(initialState,'sqc.qs.state') ...
%Example 3.28 % clf; figure(gcf) setfsize(600,400); echo on clc % INITLIN - 对线性层进行初始化 % ADAPTWH - 采用Widrow-Hoff规则对线性进行训练 pause % 键入任意键继续.. clc time1 = 0:0.05:4; % from 0 to 4 seconds time2 = 4.05:0.024:6; % from 4 to 6 seconds time = [time1 time2]; % from 0 to 6 seconds T = [sin(time1*4*pi) sin(time2*8*p...
%% SCRIPT_Test_distSegmentSegment clear all close all clc %% Create figure fig = figure; axs = axes('Parent',fig); hold(axs,'on'); view(axs,3); daspect(axs,[1 1 1]); xlabel(axs,'x'); ylabel(axs,'y'); zlabel(axs,'z'); sg1 = plot(axs,0,0,'o-r'); % Segment 1 sg2 = plot(axs,0,0,'o-b'); % Segment 2 dst = plot(axs,0,0,'-...
%% Stelling 22 % % De and-operator geeft ook een true (logische 1) terug als % de twee operands bestaan uit een string en een nul. % Antwoord = 0;
clear all; close all; %% % Correction of Example 2 using SYMBOLIC COMPUTING just to be close from % the correction. OF COURSE DO NOT USE IN FEA, E A L will have values !!! % % syms E A L alpha=E*A/L k=alpha*[1 -1;-1 1] %2 orientations 45;135° %can also use symbolic here %theta1 = sym([pi/43]) theta1=pi/4; l1=c...
% $Header: svn://.../trunk/AMIGO2R2016/Postprocessor/Post_Plot/AMIGO_plot_sens_old.m 770 2013-08-06 09:41:45Z attila $ % AMIGO_plot_sens: plots parametric sensitivities vs time % %****************************************************************************** % AMIGO2: dynamic modeling, optimization and control of biolo...
function disp_ellipse_stats(P,x0_AA,E_AA,x0,E) x0_AA = [x0_AA,1-sum(x0_AA)]; x0 = [x0,1-sum(x0)]; palette_size = length(x0_AA); % DISPLAY FINAL PROPERTIES disp('AA center'); disp(num2str(x0_AA)); if (sum(x0_AA(1:end-1))>1) disp('Do not use center. Other feasible points exist'); end disp('Intervals'); disp(num2str...
function VY=coeficienteV_Y(a,b,c,d,gamma,tol) %-------------------------------------------------------------------------------- % Propósito : Esta función calcula el valor del coeficiente que acompaña a % la varianza del termino de error en el calculo de la % varianza de la desviacion del pro...
%[t,x] = ode45(@fun,[0 20],[2; 0]); %plot(t,x(:,1),'-o',t,x(:,2),'-o') %title('Solution for (\mu = ) with ODE45'); %xlabel('Time t'); %ylabel('Solution x'); %legend('x_1','x_2'); ni=0.2; [t1, x1]= ode45(@(t,x) fun(t,x,ni),[0 10], [0 1]); ni=1; [t2, x2]= ode45(@(t,x) fun(t,x,ni),[0 10], [0 1]); ni=5; [t3, x3]= ode45(@...
function incre_pose = twistexp(increment) % calculate the increment pose % % INPUT: % increment: a vector as [wx, wy, wz, tx, ty, tz] % % OUTPUT: % incre_pose: a [4, 4] matrix about the rigid transformation wx = increment(1); wy = increment(2); wz = increment(3); incre_pose = eye(4); incre_pose(1:3, 4) = incremen...
% Demo for IGARSS 2018 paper 'COVARIANCE MATRIX BASED FEATURE FUSION FOR REMOTELY SENSED SCENE CLASSIFICATION' % written by Nanjun He (henanjun@hnu.edu.cn) clear;clc; %% load data dataset_name = 'UCM21'; img_type = '*.tif'; rt_img_dir = ['D:\matlab_work_folder\classification\Scene_classification\Scene_data\',dataset_n...
laser=load("laserdataset.m"); %measurement matrix Z=zeros(4,size(laser,1)); Z(1:2,:)=laser'(1:2,:); Z(3:4,:)=laser'(3:4,:); %COMPUTE ERROR BEFORE fullerror=0; for i=1:size(laser,1) fullerror+=(laser(i,1)-laser(i,3))^2; endfor fullerror %initial guess solution x=[0.001,0.001]; %alignement loop iterations=100; plo...
function value = statistic(varargin) value = feval(varargin{:}); function value = initialise value = -1; function value = fetch_data(expname); global rsc sp = StatPacket; source_offset = num2str(sp.offset_source); amtype_offset = num2str(sp.offset_amtype); data_length = sp.DEFAULT_MESSAGE_SIZE - rsc.amsize...
% clear; % clc; ncoil = 1; rootdir = '/home3/HWGroup/wangfw/BSTry2/B1000Multi_Coil_Co/'; tnames = {'di_yuchang','gao_ning','liang_jianqing','liu_yan','yan_jinlong','zhou_xiaofeng'}; b1K = []; b1k = []; for i = 1:length(tname) for j = 1:length(tname) tname = tnames(i); load([rootdir,t...
%% Scientific Computing HT Assignment 4 % Name: Aili Shao %% Q1 Smallest eigenvalue of quartic Schrodinger problem % -u_xx+x^4u=lambda u format compact; % Build the operator matrix using finite difference h = 0.001; % small gird size to ensure higher accuracy x = (-5:h:5)'; m=length(x...
%% Analise results mkdir(directoryoutputresults); directoryoutputlist = dir(diroutput); binsfolders = []; for binfolderind = 1:max(size(directoryoutputlist)) binfolder = directoryoutputlist(binfolderind); binfoldername = binfolder.name; if ~(strcmp(binfoldername, 'results') | strcmp(binfoldername, '.') |...
function [fig1, fig2, fig3] = ov(h,d,x,y,z,roi,cmap) %function [fig1, fig2, fig3] = ov(h,d,x,y,z,roi) stretch = h.zsize/h.xsize; fig1=subplot (221); image(squeeze(d(:,:,z))); colormap(cmap); axis ([1 h.ydim 1 h.xdim]); axis xy; fig2=subplot (222); image(squeeze(d(:,y,:))'); colormap(cmap); axis ([1 ...
clear; close all; clc; % Fix stream of random numbers s1 = RandStream.create('mrg32k3a','Seed', 50); s0 = RandStream.setDefaultStream(s1); p = 150; % number of variables nc1 = 100; % number of observations per class nc2 = 100; % number of observations per class nc3 = 100; % number of observations per class ...
x0 = -3/4; y0 = 1; m_iteration=10000; x=zeros(2,m_iteration+1); gradient=zeros(2,1); gamma=[]; v=[]; record_lost = []; record_1 = []; record_2 = []; alpha = 0.3; beta = 0.5; for i =1:m_iteration if(i==1) x(1,i)=x0; x(2,i)=y0; end gradient(1) = -400*x(1,i)*(x(2,i)-x(1,i)^2...
function statusLogging(log_listbox_handle, log_text) % This function pushes the text in log_text to the log window specified by % its handle log_listbox_handle. This function appends the log window text. % % The input log_text should be formated as a cell array, containing each % line of text as a row in the arra...
% This is the main file, it will run findVanishingPoint() function on all % the images in 'dname' folder and save the results to the avi file % in the working folder. clear all; close all; dname = '../../images/frames/asphalt'; % dname = '../../images/frames/indiana'; files = dir(dname); files(1) = []; files(1) ...
function visualize_filters() input_file = '/data/mamdouh/nist/c3dmodel/p12w1n1c0/io/test/test167_balanced_features.dsbdn6'; input_file = '/data/mamdouh/nist/scripts/filters_visualization/io/visualize_features.txt'; input_file = '/data/mamdouh/nist/scripts/filters_visualization/io/synthetic_ucf_features.dsbdn6'; f...
function Animatrik2LabTRC( trcInFile, MarkerRotateList ) %ANIMATRIK2LABTRC Scales Animatrik TRC file into meters % More importantly, the list passed in as a second parameter will % enforce a -90 degree rotation about x on those markers. % mm -> m TRCPreScale = 0.1 * FbxModel.PreScale; ...
function output_construct_names( construct_names, construct_name ) keys_file = [construct_name,'_keys.txt']; fprintf( 'Creating Keys file: %s\n',keys_file); fid = fopen( keys_file,'w'); for i = 1:length( construct_names ) fprintf( fid, '%s\n', construct_names{i} ); end fclose( fid );
function log_norm = log_normal(x,mu,variance) %log normal up to a constant of proportionality log_norm = -((x-mu).^2)./(2.*variance); end
% 给每一个运行结果都画一张xz图片 clear figure mkdir('../pictures') d = dir('../orbit_results'); isub = [d(:).isdir]; % returns logical vector name_folds = {d(isub).name}'; name_folds(ismember(name_folds,{'.','..'})) = []; var1_num = 2; % 第一个自变量的数目, 这里是磁面 var2_num = 6; % 第二个自变量的数目, 这里是磁面 % poin_dir = './poincare.plt'; % poincare = l...
function S = int_overlap(basis) % S = int_overlap(basis) % % Input: % basis basis information, as obtained by buildbasis % Output: % S MxM matrix of overlap integrals M = numel(basis); S = zeros(M); for i = 1:M for j = 1:M % Loop over primitives for each i,j pair for k = 1:num...
function [metaSample,metaClass]=computeMetaSample(trainSet,trainClass,option) % Compute metasamples for each class using SVD. This function is used by % MSRC. % trainSet: matrix, each column is a training sample % trainClass: numeric column vector, the class labels of the training samples % option: struct, with fi...
function [sssMACD] = macd(price,short,long,signal) % Function to calculate the KDJ [allMACD]= indicators(price,'macd',12,26,9); MACD=allMACD(:,1); Signal=allMACD(:,2); T=length(price); S=zeros(T,1); for i=1:T; if (MACD(i)< Signal(i)) S(i)=-1; elseif(MACD(i)>Signal(i)) S(i)=1; else S(i)=0; ...
%% gradx=@(x) [zeros(size(x,1),1),x(:,2:end)-x(:,1:end-1)]; grady=@(x) [zeros(1,size(x,2));x(2:end,:)-x(1:end-1,:)]; prepdivx=@(x) [x(:,2) , x(:,3:end)-x(:,2:end-1),-x(:,end)]; prepdivy=@(x) [x(2,:) ; x(3:end,:)-x(2:end-1,:);-x(end,:)]; div=@(x,y) prepdivx(x)+prepdivy(y);
function lineMenu = plot_timeseries(timestamp,data,sensor_index,tmin,tmax,datmin,datmax,bound,zeroJan1,t_unit,linestyle) %plot_timeseries(timestamp,data,sensor_index,tmin,tmax,datmin,datmax,bound,zeroJan1,t_unit) %plots cell array time series data for multiple sensors %Input format: %timestamp: a structure correspondin...
Connect = fred; data = fetch(Connect, 'DEXUSEU','01/01/2014','06/01/2014');
function [fm,ide,obs, sa, om]=optical_pointing(d, filename) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % [fm,ide,obs]=optical_pointing(d, filename) % function should give us an optical pointing model. % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % create some easi...
%ZEITLÍSUNG: %ohne Anfangswerte! function [x]=trajectorie(A) [eigenvector, eigenwert] = eig(A) lambda1 = eigenwert(1,1) lambda2 = eigenwert(2,2) %eigenwert1: v = eigenvector(1, 1:2) w = eigenvector (2, 1:2) hold on for i = -20:1:20 C1 = i; C2 = C1; t = -30:0.1:30; x1 = C1*v(1)*exp(lambda1*t)...
% WPCUTREE ウェーブレットパケットツリーのカット % % T = WPCUTREE(T,L) は、レベル L のツリー T をカットします。 % % 加えて、[T,RN] = WPCUTREE(T,L) は、再構成側のノードのインデックスを % 含むベクトル RN を出力します。 % % 参考 WPDEC, WPDEC2. % M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 12-Mar-96. % Last Revision: 23-May-2003. % Copyright 1995-2004 The MathWorks, Inc.
classdef Display < handle % Creates a figure depicting a model % % @author omar @date 2017-06-01 % % Copyright (c) 2017, UMICH Biped Lab % All right reserved. % % Redistribution and use in source and binary forms, with or without % modification, are permitted only in compliance wit...
function ran = AddHiddenUnit(ran, input, current_error, current_min_distance) ran.hidden_dimension = ran.hidden_dimension + 1; ran.unit_centers = [ran.unit_centers input]; ran.Wout = [ran.Wout current_error]; ran.spread_constants = [ran.spread_constants; ... ran.parameter.OVERLAP_FACTOR * current_min_dist...
function flag = scenario_test(scenario) whole_num = size(scenario,1); range = scenario(1); range_rate = scenario(2); v = scenario(3); a_list = scenario(4:end); flag = value_function3_test_FVDM(range,range_rate,v,a_list); end
function [xy, uv, scaledBaseline] = get3D(imgA, imgB, x, y, descript, siftsize) % imgsize imsize = size(imgA); matched = 0; matchedIndexes = zeros(2, siftsize); for keypointA = 1:siftsize % 1xy = [round(x(1,keypointA)) round(y(1,keypointA))]; distances = descript(2, :, :) - descript(1, keypointA, :); ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Visualization: Generate a full prediction curve for *means* and *stdev* % of contrast images at different divnorm parameters % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Set up params and figure r = 1; s =...
nInstances = length(unique(imdb.images.sid)); nViews = length(imdb.images.name)/nInstances; nDescPerShape = size(feat.x,1)/nInstances; shapeGtClasses = imdb.images.class(1:nViews:end); shapeSets = imdb.images.set(1:nViews:end); nDims = size(feat.x,2); % train & val trainSets = {'train','val'}; testSets = {'t...
%%compute error from confusion a = [83 246 301 60]; d = max(a, [], 2); s = sum(a, 2); e = mean( d./s)
clc ; clear; %close all; load train_model_new.mat work_path = pwd; max_stage = 5;%迭代最大阶段数 Radius = [0.4 0.3 0.2 0.15 0.1]; %dbnames={'Helen','LFPW','IBUG'};%选择要测试的数据库 dbnames={'LFPW'};%选择要测试的数据库 num_points=size(meanshape,2)/2;max_depth=5; disp('step1:读pts及图片'); %[imgTr,realshapes,imgpathlists]=resizeimg(dbnames,'test'...
function [H,theBin,rho] = houghVotes(edgeImg) %Define the theta bin theBin = -90:89; % Find the maximum possible d: diagnol length of the image d = sqrt(size(edgeImg,1)^2 + size(edgeImg,2)^2); % Define step size for rhoBin matrix rStep = 1; % Define rho range rho = -d:rStep:d; % Rescale rho rhoBin = 0:rStep:c...
clc;clear;close all; %% 问题1 A = [10^-8 2 3;-1 3.712 4.623;-2 1.072 5.643]; b = [1 2 3]; x11 = gaussCal(A,b); % 高斯消去法 x12 = gaussExCal(A,b); % 高斯列主元消去法 %% 问题2 A = [4 -2 4;-2 17 10;-4 10 9]; b = [10 3 7]; x21 = gaussCal(A,b); % 高斯消去法 x22 = gaussExCal(A,b); % 高斯列主元消去法
% Base class for uncertainties associated with external wrench disturbances % % Author : Chen SONG % Created : 2017 % Description : % Base class for uncertainties associated with external wrench disturbances classdef (Abstract) ExternalWrenchUncertaintyBase < PreUpdateUncertaintyBase properties ...
function [kmer,kmernor] = Kmercount(k) Seq=Seqread(); L=['A','C','G','T']; num = 4.^k; F=[]; for ii=1:num; E = []; r = ii-1; for jj=1:k; A(jj)=L(mod(r,4)+1); r=floor(r/4); end E=A; F=[F;E]; end kmer = []; for i = 1:length(Seq) i W = []; for z = 1:4.^k ...
function target_order = tsp(number, gimbal_position, X, k, first_number) data = []; % Compute each angle between current camera orientaton and targets for j = 1:number data(j,1)=0; data(j,2)=j; oa = sqrt(gimbal_position(1)^2 + gimbal_position(2)^2); ob = sqrt(X(j,1)^2 + X(j,...
function flattenedVertices = flattenSurface(vertices, faces) % Code for mesh flattening is based on (copied from) the Numerical Tours % http://www.numerical-tours.com/matlab/meshdeform_3_flattening/ % and Graph toolbox linked there. % G. Peyr, The Numerical Tours of Signal Processing - Advanced Computational Sig...
classdef conv2d_advection < conv2d %CONV2D_ADVECTION Summary of this class goes here % Detailed explanation goes here properties(Constant) x0 = -0.5; y0 = -0.5; u0 = 0.5; v0 = 0.5; end %% private methods methods(Access=protected) function [ sp...
function [ r ] = Lambda( x_i, F, D ) %x_i: index of x %F: attributes of all samples %D: all decisions % Canculate lambda r = 1; for i=1:size(D,1) if i == x_i continue end if D(i) == D(x_i) continue end r = min(r, Theta_M(R(F...
classdef Util % fragments signal and analyse the two different framents methods (Static) function ret = regions(locations, length_) % Create AF_Util with qrs location and signal length ecg = false(length_, 1); for I = 1:length(locat...
clear load 3Dinitmod load seiscmap load png_topo.mat load tomo.mat sedlayernum = 1; crustlayernum = 4; mantle_layer_thickness = [10*ones(1,10)]; vpvs = 1.8; depth_prof = [1:1:50, 55:5:100, 110:20:150]; [xi yi] = ndgrid(xnode,ynode); topo = interp2(grdxi,grdyi,grdtopo,xi,yi); periods = [tomo.period]; [m n] = size...
function Int = trapzD(x,F,lower,upper,dim) %--------------------------------------------------------------------- %--------------------------------------------------------------------- % % This function performs a trapezoidal integration but with the % definite integration limits lower and upper. % % INPUTS: % % x -> ...
function [ Lhat ] = lda_loocv( features, classes, discrim, whiten ) %lda_loocv Does LOOCV and reports performance for discrim classifiers % Features is a dxn matrix, classes an 1xn vector of class labels and % discrim is a struct containing which classifiers to build: lda, dLda, % qda. Returns Lhat which is a nx1...
addpath(genpath('helper')); addpath(genpath('demo')); addpath(genpath('eigen')); addpath(genpath('integral')); addpath(genpath('interpolation')); addpath(genpath('linear')); addpath(genpath('nonlinear')); addpath(genpath('approximation')); addpath(genpath('ode')); addpath(genpath('stochastic')); addpath(genpath('optimi...
%%%%%%%%%%%%%%%%%%%%%%%%%% % % Sam Feig % Vladimir Zhdanov % % CSCI 4831/5722 % Homework 2 % Instructor: Ioana Fleming % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Task 1: Getting Correspondences % Function modified for Task 4 to take n-parameters instead of % defaulting to 10 function [ output ] = getPoints(img1, img2, n) ...
% Function to mix two images together using upper and lower contents of the % frequency space. % % This does not work well with the given square and triangle. Use two % faces. % % This was inspired by the following paper but implemented without it: % http://cvcl.mit.edu/publications/OlivaTorralb_Hybrid_Siggraph06....
clear variables; close all; clc; %% Variables N = 50000; a = 1/log(6); x = -2 : 0.1 : 3; Fx = a./log(x+4); Y = rand(1,N); %% Affichage des courbes plot(x,Fx); hold on, [h_emp,xout] = hist(X,10); I = trapz(xout,h_emp); bar(xout,h_emp/I); %% exo2 n = 100000; Y1 = 1/2 * rand(1,n); Y2 = 1/2 + 3/2*rand(1,n); ##X1 = ; ##X...
r = reshape(I(:,:,1),1,[]); %There should be away to easilt index throughout the matrix g = reshape(I(:,:,2),1,[]); b = reshape(I(:,:,3),1,[]); mumberofP = size(r) points = cell(3,mumberofP); color = jet(50); points(1) = r; points(2) = g; points(3) = b; for i = 1:50 %Getting a weird error with my...
bw1 = imread('esquejeBw3.bmp'); figure(1); subplot 121; imshow(bw1); bw = im2bw(bw1); subplot 122;imshow(bw); bw = bwareaopen(bw,1000); prop= regionprops(bw,'all'); hold on pe = prop.Extrema; p1 = pe(1,1); p5 = pe(5,1); if (p1 > 700) && (p5 > 700) bw = imrotate(bw,180); hold on imshow(bw); end prop= regio...
function fem1ode(N) %FEM1ODE Stiff problem with a time-dependent mass matrix if nargin < 1 N = 19; end h = pi/(N+1); y0 = sin(h*(1:N)'); tspan = [0; pi]; % The Jacobian is constant. e = repmat(1/h,N,1); % e=[(1/h) ... (1/h)]; d = repmat(-2/h,N,1); % d=[(-2/h) ... (-2/h)]; % J is shared with t...
clear ; img = imread('apple.jpg'); [H,W,Z] = size(img); % 获取图像大小 I=im2double(img);%将图像类型转换成双精度 res = ones(H,W,Z); % 构造结果矩阵。每个像素点默认初始化为1(白色) tras = [1 0 0; 0 -1 W; 0 0 1]; % 水平镜像的变换矩阵 for x0 = 1 : H for y0 = 1 : W temp = [x0; y0; 1];%将每一点的位置进行缓存 temp = tras * temp; % 根据算法进行,矩阵乘法:转换矩阵乘以原像素位置 ...
function [matVertices] = FindMatVertices(dim, eps) %FINDMATVERTICES find the vertices of an inf-norm ball of radius eps in the %matrix space whose dimension is specified by dim. if nargin < 2 eps = 1; end % n: row size; m: column size. n = dim(1); m = dim(2); if eps == 0 matVertices = cell(1,1); matVertice...
function [ErrsWZD, dErrsdp, BB] = WJMODEL_BBFUN_LOOP(pars, mdi, expdat, K, M, X0, Fv, L, QuadMats, CFUN, Npatches, Nqp, opt) %WJMODEL_BBFUN_LOOP returns the backbone by doing a full hysteresis loop to %obtain damping. % %Uses quadrature to integrate along the hysteresis loop % Prestress - From WJ with modifications ...
%%%%% Optical fiber travel Propagation transmit %%%%% function dawdz = fiber11(~,aw,~,w,Beta2,Gamma) at = fft(aw); m=(0.5*1i)*Beta2.*(w.^2).*aw; dawdz=m(end)+ifft(+1i*Gamma*(abs(at)).^2.*at); end
%% get_id_AnAge % gets id of AnAge %% function id = get_id_AnAge(my_pet, open) % created 2021/08/03 by Bas Kooijman %% Syntax % id = <../get_id_AnAge.m *get_id_Ange*>(my_pet, open) %% Description % Gets identifier for Animal Ageing and Longevity Database % % Input: % % * my_pet: character string with name of a taxon...