text
stringlengths
8
6.12M
%% Cross fold validation function for given parameters and training set % % Ke Ma & Chris Bodden % function [tune_accuracy] = llc_tune(filenames_train, labels_train, image_dir, data_dir, params) %% parameters if(~exist('params','var')) params.maxImageSize = 1000; params.gridSpacing = 8; params.patchSize =...
function samples=rejectionSampling(propose,q,p,M,nr_samples) %samples=rejectionSampling(propose,q,p,M,nr_samples) %Rejection sampling from P. %propose: samples from Q %q: proposal density %p: target density %M: normalization constant such that M*q(x)>=p(x) for all x nr_proposals=ceil(10*max(1,M)*nr_samples); nr_batch...
function Xk1 = FuncNonLinDTS(Xk, uk) Xk1 = 1/2*Xk^2+Xk-2*uk;
clear all; clc; N=20; [D,x]=cheb(N); a=1; b=3; t=0.5*(b-a)*x + (b+a)/2; I=eye(N+1); D1=D; D2=D1^2; A=D2 + diag(1./t)*D1 - diag((1./t).^2 )*I; R_t = zeros(N+1,1); A(N+1,:)= I(N+1,:); R_t(N+1)=5; %A(N+1,:)= 0;A(N+1,N+1)=1; A(1,:)= I(1,:); R_t(1)=2; %A(1,:)= 0;A(1,1)=1; y_sol=inv(A)*R_t; figure(1) plot(t,y_sol);
%% clean clear all close all clc %% Load and read files humanHEXA = genbankread('humanHEXA.gb'); mouseHEXA = genbankread('mouseHEXA.gb'); %% Retrieve the nucleotides and the coding region sequence humanSeq = humanHEXA.Sequence; humanCDS = humanHEXA.CDS.indices; mouseSeq = mouseHEXA.Sequence; mou...
clear all; close all; Q = 1; im_file = sprintf('Q%d.bmp', Q); im_file_d = sprintf('Q%dd.bmp', Q); cal_file = sprintf('SnellCalib-Q%d.dat', Q); out_file = sprintf('tmp_Q%d_o.dat', Q); in_file = sprintf('tmp_Q%d_i.dat', Q); %./test_CoordinateTransform 0 ../matlab/calibration/SnellCalib-Q1.dat t1.dat t2.dat no CTexe...
A=randn(1,10) %am generat vectorul v, cu elemente aleatoare, dupa o distributie gaussiana j=0 %am initializat un contor j pentru a numara cate elemente din v sunt negative for i=1:1:10 %parcurgem vectorul if A(i)<0 j=j+1 %de fiecare data cand intalnim un numar negativ, j-ul se incrementeaza ...
function [ recal ] = globalRecal(data,flag) %globalRecal - perform global recalibration of an imzML file using a few %sentinel ions if nargin == 1 flag = false; end % Define the ions for assessment ions = [255.2329 281.2485 465.3043 536.5047 744.5548 885.5498]'; hw = 15; % Extract images [mz,~] = getImages(data,...
clear all close all N1= 10; N2= 10 ; Moc=[]; Frecyklu=[]; Twyrury=[];Twyrecyklu=[];Twerecyklu=[];Frury=[]; Dane=importdata('Data.txt'); tryb=Dane(1,1); if tryb==0 a=Dane(:,2); b=Dane(:,3); c=Dane(:,4); d=Dane(:,5); e=Dane(:,6); for i=1:N2 p=(i-1)*N1+1; k=i*N1; Twyrury=[Twyrury; a(p:k)']; ...
classdef Dynamic < solver.blazer.Blazer properties end methods function this = Dynamic(varargin) this = this@solver.blazer.Blazer(varargin{:}); end end end
% function cam_calib() %FUnction Constants %Number original images to take Num_orig = 100; %Number of randomly selected to save Num_save = 10; %Get and save the images % [I, D] = get_images(Num_orig); % save_images(I,D,Num_save); %Now do image processing on the images addpath('Calib_tool2'); %Use the Bouguejt Ca...
function [output_name] = remove_extension(input_name) [pathstr, name, ext] = fileparts(input_name); output_name = [pathstr name]; end
function setBlockPosition(block, x, y, width, height) % Set block position and size % % setBlockPosition(block, x, y, width, height) % % Sets a block's position and size. If any parameter is specified as NaN or % not provided, preserves the existing value. if blockExists(block) posOrig = get_param(block, 'Position...
function X = uq_all_invcdf(F, Marginals) % X = UQ_ALL_INVCDF(F, Marginals): % Calculates the inverse Cumulative Distribution Function % given CDF values of a random vector collected in F matrix. % Each column of F corresponds to a component of the random vector that % follows some distribution with so...
% Ustawienia MATLABa clear all; close all; warning off MATLAB:divideByZero; warning off MATLAB:singularMatrix; format short; % e %clc; %% ------------------- Wstępne ustawienia ------------------- % global L M T SPS iS step_ step_time Ld Md Ywyj Yreg; % SPS - Samples Per Second % częstotliwość próbkowania SPS =...
function [x_n] = Particle_Locate_HostCell(N0, N5, Xp, x0, x1) x_n = floor((Xp-x0)/(x1-x0)*(N5-N0)) + N0;
function HeaderInfo=GetHeaderInfo(PlanDestPath, ReadCommentFlag) FileList=GetFileList(PlanDestPath); if isempty(FileList) HeaderInfo=[]; return; end FileList=char(FileList); FileList=strjust(FileList, 'right'); FileListEnd=FileList(:, end-5:end); FileList=strjust(FileList, 'left'); FileList=ce...
% pass in two matrices of i-vectors, compare each train vector against all % the test vectors to 'match' them. generate error/accuracy report function [pruned_result,t_p_percent] = findIvectorMatch(train,test) % row gives the number of LDA dimensions that were significant % column gives the number of original models ...
function colorimg = drawLinesOct(img, lines, varargin) % DRAWLINESOCT Draws a OCTSEG line on an oct image. Differences in % Z-direction are interpolated. % % COLORIMAGE = drawLinesOct(IMG, LINES, VARARGIN) % COLORIMAGE: Image with a line drawn onto, in RGB format. % IMG: Oct image, either RGB or grayvalues % LINES: Mu...
% Take an optimized solution and check performance, using parameters that % can differ from those used in the original calculations. This file % calculates lateral force Fx vs. x. % This file is part of the SPOT package, as described in % M. A. Taylor, “Optimizing phase to enhance optical trap stiffness,” % Sci. Rep...
function [sse,outparams] = fitGaussian(params,x,y) %% setup Gaussian peak = params(1); % amplitude of gaussian at peak fwhm = params(2); % width (aka standard deviation) cent = params(3); % x-axis point of peak lcation % predicted value predY = peak * exp( (-(x-cent).^2) ./ (2*fwhm^2) ); % predictors and sse (minim...
function [u p tlist]=Rightpass(b,D0,F0,Ldomain,Tau) %LEFTPASS2 Summary of this function goes here % Detailed explanation goes here diff=2.97e-10/D0*(Ldomain)^2; %2.97e-10m^2/s is D for the 1.5nm diameter sphear; domain=(1e-9)*(Ldomain);%unit is nm; strd=num2str(diff); strf=num2str(F0); strdom=num2str(domain); strL2=n...
function idx = FS_Premotor_WavPlot(song,align) ds = 1000; fs = 48000/ds; cfs = 25; % video framerate align = align/ds; figure(); song(song==0) = mean(min(song)); imagesc((1:size(song,2))/fs,[],song); colormap(bone); figure(); l = linkage(song(:,round(align):align+6*fs), 'ward', 'correlation'); % subplot(3,...
% RotaryEncoderPlotFullSession plots the position and velocity data % from a full recording session (see RotaryEncoderGUI.m) % % updated by Mai-Anh Vu, 10/24/2018 % updated by Mai-Anh Vu, 06/28/2019 to include 1 2d ball sensor function BehaviorPlotFullSession global session figure hold on % velocity (red, ...
%% plot SGD training path xaxis = 1:length(test_errors); fig_errors = figure; plot(xaxis,train_errors);hold; plot(xaxis,test_errors); legend('train errors','test error') title('errors vs epochs') fig_losses = figure; plot(xaxis,train_losses);hold; plot(xaxis,test_losses); legend('train loss','test loss') title('losses ...
function [ P1,L1 ] = CN2D( JPR,I,JPT,Z,RTS,ON,O2N,N2N,NOP,NE,N2PLS,DISN2D,UVDISN,NPLUS,N2P,N2D,OPLS,NNO,N2A ) %CN2D CN2D % %.................... KEMPRN.FOR ...................................... %.. This file contains the chemistry routines for ions and neutrals %:::::::::::::::::::::::::::::::::::::::::::::::::::::...
function filter = isObservable(fieldArr) filter = logical([fieldArr.obs]);
%构造合成数据集并送入hddcrp v2.0中进行训练,训练之后在这里显示训练结果 %% close all;clear all;clc; load ('./get_documents/docs76.mat') trainss=docs; for i=1:1:length(trainss); p{i}=1:i; q{i}=zeros(1,i); end cand_links=p'; log_priors=q'; save ('D:\code\mycode\HDDCRP_V3\synthetic\inputdata\synthetic_dat_76.mat','cand_links','log_priors','tr...
function set_splash(splash_image_filename) %try % create a figure that is not visible yet, and has minimal titlebar properties fh = figure('Visible','off','MenuBar','none','NumberTitle','off'); % put an axes in it ah = axes('Parent',fh,'Visible','off'); dat = imread(splash_image_filename); ih = imagesc(dat); daspect...
%% Josh Barrios 4/6/2019 % Visualize ROIs from an entry in fluo_data function plot_fig = ShowROIs(fluo_data,trial_ind) plot_fig = figure; imagesc(fluo_data(trial_ind).template); hold on for k = 1:length(fluo_data(trial_ind).ROI_locs) plot(fluo_data(trial_ind).ROI_locs{k}(1,:),fluo_data(trial_ind).ROI_locs{k}(2,:...
function SpinSingleFrame( capturePath, filePrefix ) %SPINSINGLEFRAME Summary of this function goes here % Detailed explanation goes here texTime = tic; fprintf('Capturing %s...',filePrefix) % Texture capture %D3d.Viewer.SetBackgroundColor([0,0,0]); D3d.Viewer.SetCapturePath(capturePath,filePrefix); if (exist(capture...
function [dbMean,dbStd,dbMedian,nSample] = subStaticsDeOutlier(cvData,dbOutlierZscore) % % 功能:获取没有 outlier 的统计量 % bCont = 1; nSample = length(cvData); cvHit = true(nSample,1); while(bCont==1) cvZ = zscore(cvData(cvHit)); cvH = (abs(cvZ)>dbOutlierZscore); if sum(cvH)>0 cvHit(cvHit==1)= (1-...
function assignment_3() close all; %to close all plots clear all; clc;cl %------------------------------------ % input Parameters in Functions % p_() is the ordinary differential equation (1) % p() is the analytical solution %------------------------------------ % given Values % p(0) = 20 (2) %initial v...
function [range] = findCommonTimeRange(timedht, timetemp) start = find(timetemp == timedht(1)); stop = find(timetemp == timedht(end)); range = start:stop; assert(all(timetemp(range) == timedht)); end
classdef object < dynamicprops % OBJECT Root Class for all Azure wrapper objects % Copyright 2016 The MathWorks, Inc. properties (Hidden) Handle; end methods %% Constructor function obj = object(~, varargin) % logObj = Logger.getLogger(); ...
function llk_trial=Exp4_TrialLikelihood(llk_responses) %% Collapse llk by trial llk_trial=squeeze(sum(log(llk_responses+eps),2));
A = imread('DanaHallWay1/DSC_0281.jpg'); A = rgb2gray(A) [y,x,m] = harris(A,1000,'tile',[2 2],'disp');
%% Prepare Acqknowledge data for SPM_FNIRS analysis function SPM_FNIRS_preparation_myrto_cogn_stroop() % EDIT BELOW HERE TO FIT YOUR DATA AND ANALYSIS REQUIREMENTS %------------------------------------------------------------------------- %------------------------------------------------------------------------- ...
function [ bestX, bestY ] = differentialEvolution( costFnc, options ) % Differential Evolution algorithm implementation % Tries to find the best value for the given function inside the specified % constrains % % costFnc - The cost function % options - Optimization options % numVars - Number of variabl...
function [rci, cci, minobj, rec] = ecc(mat, nrc, ncc, varargin) % ECC Bregman co-clustering algorithm using squared Euclidean distance. % % [rci, cci, minobj, rec] = ecc(mat, nrc, ncc, [[argID,] value, ...]) % % Examples: % [rci, cci] = ecc(mat, nrc, ncc) % [rci, cci, minobj] = ecc(mat, nrc, ncc) % % INPUT: % mat ...
classdef HorizontalStabilizerSimple < Helicopter %HORIZONTALSTABILIZERSIMPLE % 此处显示详细说明 properties (GetAccess = protected) a_0; % 升力线斜率 delta; % 阻力系数 s_HS; % 平尾面积 s_e; % 升降舵面积 xi; % 平尾后掠角 x_HS; y_HS; z_...
function PlotClassBalance(fignum, HLabels, labelmap, ClassBalanceFigureFileName,varargin) figure(fignum); clf; DockFigure(fignum); histogram(HLabels); xticks(unique(HLabels)) xticklabels(labelmap); xtickangle(45) ylabel('# Samples') mytitle = {}; [~,mytitle{1},~] = fileparts(ClassBalanceFigureFileName); mytitle{1} = st...
function [cfr] = rls_auto(X, y, opt) % rls_auto(X, y, opt) % computes a RLS classifier, with automatic selection of primal/dual procedure. % The regularization parameter is set to the one found in opt.paramsel. % In case of multiclass problems, the regularizers need to be combined with the opt.singlelambda function. % ...
function [bbSamp,imSeg,totNum] = sampOperations(im) rgb1 = get_color(im); vari = 20; imSeg = im(:,:,1)<=rgb1(1,1) + vari & im(:,:,1)>=rgb1(1,2) - vari & im(:,:,2)<=rgb1(1,3) + vari & im(:,:,2)>=rgb1(1,4) - vari & im(:,:,3)<=rgb1(1,5) + vari & im(:,:,3)>=rgb1(1,6) - vari; % imSeg = bwmorph(imSeg,'dilate',3); imSeg ...
function D = histD(tracks,params) % function D = histD(tracks, params) calculates the diffusion coefficient % for each track in "tracks" and plots a histogram of D. % % Stephan Uphoff. 09.09.11 % % params contains the following parameters: pixel = params.pixel; % length per pixel dT = params.dT; % time per frame sigma...
function varargout = addquiverc(varargin) charargs = find(cellfun(@ischar,varargin)); axopt = find(strcmpi(varargin(charargs),'axes')); axopt = charargs(axopt); if (~isempty(axopt) && (axopt < nargin)), ax = varargin{axopt+1}; else ax = gca; end; switch get(ax,'NextPlot'), case 'replace', isHeld = false; ...
function [ extr,rawmz,totsum ] = rawIonExtract(sp,xy2D,ions,ppmTol) %rawIonExtract - extract ions and things from a raw file % Read in the file entirely %[sp,numP,xy,xy2D] = desiReadRaw([file.dir file.nam],true); % Determine image size nColumns = imzML.getWidth(); nRows = imzML.getHeight(); nIons = numel(ions);...
function timemarker = time_simulation(myevent, ha_event, Fs) % Description: To perform time that the ssvep experience's % working for each trials % Input: % myevent : event vectors % ha_event : axes handles % Fs : sampling frequency % % Output: time_simulation % That the fig...
%Problema 5 %2ms subplot(3,1,1) x=0:0.002:4; f=0.25; w=2*pi*f; s=1.5*abs(sin(w*x)); plot(x,s) grid xlabel('t [s]') ylabel('Amp [V]') title('Graficul 1:2ms') %20ms subplot(3,1,2) x=0:0.02:4; f=0.25; w=2*pi*f; s=1.5*abs(sin(w*x)); plot(x,s) grid xlabel('t [s]') ylabel('Amp [V]') title('Graficu...
% Fix early sessions that a single alldata was saved for all imaging % sessions in a day.... Here we split alldata into n files, n=number of % sessions. %{ mouse = 'fni17'; imagingFolder = '150814'; %} % set this: nsess = 2; %length(alldata_fileNames); %% Set filenames [alldata_fileNames, ~] = setBehavFileNames(mou...
function [ r ] = combineBinnedMatrix( data ) %COMBINEANDRELABEL Convert a matrix into a vector % Call combineBinnedVector for each row of the matrix m = max(max(data)); l = size(data,1); r = zeros(l,1); for i = 1:l r(i,1) = combineBinnedVector(data(i,:), m); end end
close all clear; addpath('param') view = '4'; %rtype = 'i4t'; rtype = 't4i'; data = importdata([rtype, '_v', view, '.txt']); data = flipud(data); figure, bar3(data) colormap jet set(gca, 'XTickLabel', {'LinCCA', 'LinPLS', 'LinMvDA', 'LMvMDA', 'KCCA', 'KPLS', 'KMvMDA'}) set(gca, 'YTickLabel', {'200', '150', '100', '50'...
function p = getp(cube_point,u,v) % function: get P of one cube corner and its image coordinates % input: cube_point coordinate of a cube corner, 1*3 matrix % u x-coordinate of corresponding image % v y-coordinate of corresponding image % output:p matrix P, 2*12 matrix ...
%analyse data with suite2p %mag 5: diameter 35 and 100 components %mag 2: diameter 15 and 300 components %-> .proc file %register suite2p analysis across days registers2p %gui %--> .reg file %load last day (857_p41) as dataset 1 and register other days to it as %dataset 2. Save in file of dataset 2 %% %create li...
function [accuracy] = run_NaiveBayes( X_train, y_train, X_test, y_test ) model = NaiveBayes.fit(X_train, y_train); res = model.predict(X_test); accuracy = getAccuracy(res, y_test); fprintf('Accuracy : %0.2f\n', accuracy); end
function sbxPCACleanSpatial(path, pcs, pmt) %UNTITLED7 Summary of this function goes here % Detailed explanation goes here % ------------------------------------ % Parameters downsample_xy = 2; chunksize = 1000; % Parfor chunking % ------------------------------------ % Make sure tha...
% example: [a,b] = evaluateLevel2ObservableAgent('StraightLineAgent',7,1,8) function [randomacc,learnedacc] = evaluateLevel2ObservableAgent(name,nmaps,CSIZE,XSIZE) traces = cell(nmaps-1,1); for i = 1:nmaps traces{i} = ['trace-m' num2str(i-1) '-' name '.txt']; end correct1 = 0; correct2 = 0; total = 0; ...
function [O]= encode_msg(inp,message,c_bit); inp(size(inp,1),size(inp,2),1)=length(message); inp(size(inp,1),size(inp,2),2)=c_bit; %the output pixel is assigned the value of the pixel that the point falls within. No other pixels are considered. inp=imresize(inp,[size(inp,1) size(inp,2)],'nearest'); len...
function main() clc make clc dic_type = 'Rand_sign'; n = 512; redundancy = 4; sigma = 0.02; T = round(0.1 * n); lambda = 4 * sigma; A = getDictionary(dic_type, n, redundancy); max_iter = 1000; accuracy = 1e-4; % experiment.clean_signal = b; % experiment.noise = no; % experiment.sigma = ...
function Random_2P(k,gcf,aviobj) [v_x,v_y,x,y]=getvec(2) i=0; x_new=[]; y_new=[]; for a2=-0.5:0.1:1.5 i=i+1; x_new(i)=a2*v_x(1)+x(1); y_new(i)=a2*v_y(1)+y(1); % scatter(x_new,y_new,'.','b'); plot(x,y,'g','linewidth',2); plot(x,y,'+','MarkerFaceColor','red','MarkerEdgeColor','r',...
%This project works for coin flips clear all; clc %Question 1 coin_result1 = rand(1,50);%Simulate tossing a fair coin coin_result1(coin_result1 >= 0.5) = 1;%Heads coin_result1(coin_result1 < 0.5) = 0;%Tails num_heads1 = sum(coin_result1); run1 = stat_run(coin_result1); longest_run = max(run1); x1 = [0,1];...
% This is a box plot code of real world data experiment. Since the real world experiment time is too long, so we save the result and draw % the figure to show the performance. rng(2021); for fakeloop = 1 for i = 1:2 figure(i); for j =1:2 k = 2*i+j-2; if i == 1 && j==1...
function imu = imuclbt(imu, clbt, eb, Ka, db) % IMU simuation by adding calibration errors. % % Prototype: imu = imuclbt(imu, clbt) % Inputs: imu - ideal IMU simulation data % clbt - calibration struct % Output: imu - IMU simulation output % % See also clbtfile, imuadderr, imulvS, sysclbt. % Copyright(c) 2009...
X=imread('Grayscale_8bits_palette_sample_image.png'); Y(:,:,1) = X; Y(:,:,2) = X; Y(:,:,3) = X; [r,c] = size(X); XLim = [0 c] + 0.5; YLim = [0 r] + 0.5; hG = subplot(1,3,1); hC = subplot(1,3,2); hB = subplot(1,3,3); image(XLim, YLim, Y, 'Parent', hG); XTick = []; ...
function dx = switchedSubSys1(t,x) % global variables global gPi1; global gY; global gHatX1; global gHatM; global gTheta; global gTheta1; global gOdeTime; dx = zeros(size(x)); % parameters of the controller rp = 0.1; barRp = 0.08; c1 = 5; c2 = 6; a1 = 5; a2 = 1; rTheta = 1; barRTheta = 0.8; % parameters of switchd...
function [ L ] = rgb2lumi( RGB ) [n,~]=size(RGB); for i=1:n L(i,1)=(RGB(i,1)./255)^(2.2); L(i,2)=(RGB(i,2)./255)^(2.2); L(i,3)=(RGB(i,3)./255)^(2.2); end end
%% Example from the note fea_X = [4,2,2,3,4,9,6,9,8,10;1,4,3,6,4,10,8,5,7,8]; gnd_X = [1,1,1,1,1,2,2,2,2,2]; %% Scatter the point on the 2D fea_X1 = fea_X(:, ismember(gnd_X, 1)); fea_X2 = fea_X(:, ismember(gnd_X, 2)); [fea_Y, W] = new_lda(fea_X, gnd_X); fea_Y1 = fea_Y(:, ismember(gnd_X, 1)); fea_Y2 = fea_Y(:, ismem...
clear close all clc addpath('../PHY'); %% Fe = 20e6; % Frequence d'echantillonnage (imposee par le serveur) Rb = 1e6;% Debit binaire (=debit symbole) Fse = floor(Fe/Rb); % Nombre d'echantillons par symboles %% Cha�ne TX b = [1 0 0 1 0]; sl = modulatePPMperso(b,Fse); %% test de modulate t = (0:length(sl)-1)/Fe; plot...
clear all [xy_origin ima_pattern] = get_real_points_checkerboard_vmmc (9, 14 * 8, 1); image_name = 'Images/section1/720p/im'; xy_target = zeros ([10, 2, 9]); H = zeros ([10, 3, 3]); figure(1) hold on for i = 1:10 image = imread (sprintf('%s%d.jpg', image_name, i)); xy_target(i, :, :) = get_user_points_vmmc (...
classdef (Abstract) GSM_Euler_Real < GSM_Euler %GSM_Euler_Real Summary of this class goes here % Detailed explanation goes here properties sim_pca = PCA_Cent(); pca = PCA_Cent(); end methods function obj = GSM_Euler_Real(ann,alpha) obj@GSM_Euler(ann,alpha); end end...
function [ ww, iter, status ] = WWBP( A ) %WWBP obliczanie wartości własnych metodą rozkładu QR bez przesunięć % A - macierz wejściowa symetryczna % ww - wartości własne % iter - liczba wykonanych iteracji % status - sposób zakończenia maxIter=1e5; status=1; for i=1:maxIter b=A-diag(diag(A)); if max(max...
%% Estimator Variables % This file was derived from work by Fabian Riether. % Copyright 2017-2020 The MathWorks, Inc. Estimator.inverseIMUGain = [1./Sensors.IMUAccelGain 1./Sensors.IMUGyroGain]; %% IMU Estimator.IMU.filterAccel = designfilt('lowpassfir', 'FilterOrder',5, ... 'CutoffFrequency', 0.1); [Estimator....
function data = extractDataScatter(d, xid, yid, CLim, colormap, strip_style) % extractDataScatter - create a data struct for scatter plots % data = extractDataScatter(d, xid, yid, CLim, colormap) % d - a data struct from matlab describing a scatter plot % xid,yid - reference axis indices % CLim - a ...
function ImageCheck PatientFolder = 'L:\kirsten_thesis\data\patients\'; PatientList = dir( PatientFolder ); for i = 1 : size (PatientList) if ( 0 == strcmp( PatientList(i,1).name, '.') && 0 == strcmp( PatientList(i,1).name, '..') ) PatientPath = strcat(PatientFolder, PatientLis...
picture1 = imread('PicSample.jpg'); picture1 = rgb2gray(picture1); picture1=double(picture1); [M,N] = size(picture1); F_picture1 = zeros(M,N); F_picture2 = zeros(M,N); %原始图像作dct分块变换和逆变换 F_picture1 = blkproc(picture1,[8 8],'mydct2'); I_picture1 = blkproc(F_picture1,[8 8],'myidct2'); figure,imshow(uint8(F_pi...
rgb = imread('6.25image.png'); rgb = im2double(rgb); r = rgb(:, :, 1); g = rgb(:, :, 2); b = rgb(:, :, 3); mol = 0.5 * ((r - g) + (r - b)); den = sqrt((r - g) .^ 2 + (r - b) .* (g - b)); theta = acos(mol ./ (den)); if b > g H = 2 * pi - theta; else H = theta; end H = H / (2 * pi); mol = min(min(r, g), b); S ...
% We want to find an integer value a, taking values in the range from 3 to 5, % such that the polynomial ax4+y4+uxy+1 has a lower bound larger than t, % for any ?1¡Üu. A trivial and contrived example of course, but here is the compact YALMIP model. clear;clc; sdpvar x y t u a p = a*x^4+y^4+u*x*y+1; F = [uncertain(u...
% ber_ray % y=Hx+n % % % DEPRECATED function ber = ber_ray(SNR) load precision.mat x=zeros(1,BLOCK_SIZE); y=zeros(1,BLOCK_SIZE); x_hat=zeros(1,BLOCK_SIZE); errs=0; for ii=1:N_BLOCKS % random block coming from source (already modulated) x=randsrc(1,BLOCK_SIZ...
close all; clear autoRetrainWithThreholdANFIS; predicted1 = predictedV; autoRetrainWithThreholdNARX; LRMNewJob; predictedV3 = predictedV; figure(1) plot(predicted1); hold on; plot(actualV); hold off legend('Predicted values generated by ANFIS','Actual values') xlabel('Time with 1-Hour unit') ylabel('Mean of memory cons...
function analyzeData( dat, time_stamp, subplt_h, is_log ) %% Analyze data % Author: Yitian Shao % Date: 11/29/2016 %========================================================================== if nargin < 4 is_log = 1; % Plot spectrum in log scale by default end avg_kernel = ones(20,1)/20; signal_en = length(dat); i...
%% homework 1.2 clear; clc; image=imread ("002.jpg"); temp=im2double(image); results=mydct(temp); figure imshow(image); %% show dct figure imwrite(results,"dct.jpg"); imshow(results); %% show idct figure final=imydct(results); imwrite(final,"idct.jpg"); imshow(im2double(final)); function [out] = myd...
% Es 16 % Given a FIR filter h(n) = 1, n in [0, 19]. % Evaluate the DFT of the filter % Visualize the DFT versus normalized frequency [0.5, 0.5). % Pad the array with zeros until reaching 100 samples. % Evaluate the DFT of the padded h(n) and visualize it. % Are the two DFTs equal? Comment on the results. close all c...
%% Draw the result % Input: X -- data; C -- labels function Draw(X, C) figure('position',[300,300,250,250]); C_uq = unique(C); cm = colormap(jet(length(C_uq))); for j = 1: length(C_uq) IDX = find(C==C_uq(j)); plot(X(IDX,1),X(IDX,2),'.','color',cm(j,:)); axis equal; ho...
function ShoulderCalcs (personHeight, maxShaftMoment, maxTorsionFromSpring, ... shaftDiameter, shaft) maxShaftMoment = UnitConversion.NewtonM2PoundFInch(maxShaftMoment); maxTorsionFromSpring = UnitConversion.NewtonM2PoundFInch(maxTorsionFromSpring); %% Design Variables - Calcs 1 d = UnitConversio...
%Demographics Table %Initializing clc clear source = 'scorebook.xlsx'; pathOUT = 'D:\Box Sync\Box Sync\Clinical Scores\Stat\Demographics Figures\' %Load demographics tables into different datacubes dataCube_apple = readtable(source,'Sheet',1,'TreatAsEmpty','on'); dataCube_XsensC = readtable(source,'Sheet'...
function [y, dzdw, dzdb] = nnlinear(x, W, B, dzdy, varargin) %NNLINEAR linear mapping unit. % Y = NNLINEAR(x, W, B) calculates the linear mapping between two layers. % X is assume in dimension D x N; Y in d x N; W is the coefficient in d x D % and B is the bias vector of dimension d % % DZDX = NNNEWSVENDOR...
classdef FeaturesMatcher < handle %FEATURESMATCHER Feature matchers class % % See also: cv.Stitcher, cv.FeaturesFinder, cv.DescriptorMatcher % properties (SetAccess = private) id % Object ID end methods function this = FeaturesMatcher(matcherType, varargin) ...
function apply_stats_ranges_overlay(ax_handle, data_output, az, el) plot3(ax_handle,... data_output.positions.mean(1),data_output.positions.mean(2),... data_output.positions.mean(3),'xk','MarkerSize',10); % circle_plot(ax_handle, [0 0 0], data_output.distances.mean, az, el, 'k-'); circ...
% to be uncommented fileID = fopen('varin_3.txt','r'); % CoE Models varin_3 = fgets(fileID); fclose(fileID); %varin_3 = '/net/isi-backup/restricted/face/SITW_v2_parsed/controles_intensity_bl_man.mat'; % %varin_3 CoE models in here and in function_BELHUMER % %varin_4 Parts models LPFuCE function_BELHUMER %...
clear clc loop=20000; %% QAM Modulation order loog_M=6; % 4-QAM , N=130, HAZV=0,SISHMA=0.1231 %% Full subcarrier size N=62; hazv=2; 0.1969 0.1965 0.1961 for jj=1:loop jj b_2=randi([0 1],loog_M*(N/2-1),1); c_2=reshape(b_2,(N/2-1),loog_M); d_2=bi2de(c_2); in_2=qammod(d_2,2^loog_M); out_en=zeros(1...
function [perfmodel1_fitted, perfmodel_fitted, eps_estimate ,K_estimate, temp, BIC_ll,AIC_ll,BMC] = ILmodelfitting(humandata) load ILmodelpred % Simulate an experiment in which a monkey decides at which of two % locations an orientation change occurred % set size (N) and magnitude of change (Delta) were vari...
function [vertex,face] = read_ov(filename) % read_ov - read data from OV file. % % [vertex,face] = read_ov(filename); % % 'vertex' is a 'nb.vert x 3' array specifying the position of the vertices. % 'face' is a 'nb.face x 3' array specifying the connectivity of the mesh. % % OV format is "Object Table" format ...
function stderror = serr(input, dim) % function stderror = serr(input,dim) % % Quick and dirty standard error function. % Ignores NaNs. % Works on vectors or on first non-singleton dimension of input unless 'dim' % is specified. % If 'dim' is 'all', will operate on all elements of input. if nargin <2 % find stan...
function callVideoPlayer(handles, isCallback) %% Description % CALLVIDEOPLAYER Call video player show one frame of video. % This function can only be called in two circumstances / cases: % 1. called by playbutton callback funtion (play_Callback) % 2. called by slider2Video function % % Copyright 2014-2015 Int...
% Fiscal Policy Under Decentralized Fiscal Federalism: % Complications for Liquidity Trap Management % % Second Year Paper: Extension of Correia et. al (2013) with decentralized U.S. fiscal federalism % Andrew Fieldhouse % Cornell University % June 30, 2015 %% Code for Section III: Centralized vs. D...
%% Unit_analysis_new close all %% reload = 1; %% if reload == 1 clear all load_folder = 'F:\Synced\Synced_individual' group_folders = {'POM';'Cortical'}; reload =1; end; % bin_size = 0.005; spont_win = [0 0.05] resp_win = [0.0001 0.03]; % Max and min depth for units to include max_depth = -50; ...
% This is the repository for the Matlab codes of the numerical simulations % of plasmid dynamics in complex communities. The scripts can be used to % generate the figures in the main text and supplementary information of the article % "Variability of plasmid fitness effects contributes to plasmid persistence in bacteri...
clc; [ outarray, H, W, D, ID, scale] = pfmread_op('E:\程序代码\色调映射测试\pfm\gry\memorial_o876_gry.pfm'); input=outarray; %此函数是根据JPEGXT里面的profile c的TMO建立的tonemapping函数 % 输入分别为:亮度矩阵, 位深度, 以及是否是浮点数 % 输出为一个从ldr映射到hdr的表; isfloat=1; precision=16; max_ldr=256; max_hdr=double(2^precision - 1); count=size(input,3); input=double(inp...
%% Loading data close all; %datdir = ['D:\\documents\\ucb\\singapore\\data\\PMsensortest\\SWARM_02282013']; %datdir = ['D:\\documents\\ucb\\singapore\\data\\PMsensortest\\SWARM_03072013']; datdir = ['D:\\documents\\ucb\\singapore\\data\\PMsensortest\\DH_data']; pmdatafile = [datdir '\\data.mat']; opcdatafile = [datdir ...
function [R] = quaternionToRotationLH(q) % Converts a quaternion to a left handed (post-multiplied) % rotation matrix. % http://en.wikipedia.org/wiki/Rotation_matrix#Quaternion % fetch components w = q(1); x = q(1); % i y = q(1); % j z = q(1); % k % Check the trace ...