text
stringlengths
8
6.12M
function svd_clean(name, Ncomps) [a h] = read_img(name); [u,v,w] = svd(a,'econ'); X = u(:,2:Ncomps+1); R = a - X*pinv(X)*a; write_img(['clean_' name], R, h); return
function NP_makeFigure4(params_comp,cur_roi,opt,dirPth) fontSize = 1.1; % in centimeters lineWidth = 3; MarkerSize = 5; roi_idx = cur_roi.roi_idx; roi_comp = cur_roi.roi_comp; % fitted line to the mean of bins x_param_comp_1 = params_comp.fit.xfit; y_param_comp_1 = params_comp.bin.binValFit_comp_1; % binned values...
function [prob,output,classifier,smoothed_probabilities] = apply_classifier_nestedCV(training,varargin) %TEST_CLASSIFIER extract features that will be used later by the %classifier % YPREDICTED = TEST_CLASSIFIER(TRAINING,TESTING). training and testing % are structures where the temporal features(training.features.t...
% intro close all clear %% colorImage = imread('test4.jpg'); I = rgb2gray(colorImage); ocrtxt = ocr(I); czarno_bialy = [ocrtxt.Text] ocrtxt = ocr(colorImage); kolorowy_obraz = [ocrtxt.Text]
function varargout = inEnvelope(MWS) % This function determines if the engine is within the flight envelope % cond = inEvelope(MWS) % cond = 1 - IC is within the flight envelope % cond = 0 - IC is not within the flight envelope % ************************************************************************* % written by Je...
function [ trendSeries, filledTimeStamps, filledSeries, nRunMn ] = tsEvaRunningMeanTrend( timeStamps, series, timeWindow) [ filledTimeStamps, filledSeries, dt ] = tsEvaFillSeries( timeStamps, series ); nRunMn = ceil(timeWindow/dt); trendSeries = tsEvaNanRunningMean(filledSeries, nRunMn); trendSeries = tsEvaNa...
function [yu yl x] = Airfoil_interp(Coord,Position,Y) n = length(Position); nx = length(Coord(1,:,1)); Xi = Coord(1,:,1); Yi = Position; Zui = zeros(nx,n); Zli = zeros(nx,n); for i = 1:n for j = 1:nx Zui(j,i) = Coord(i,j,2); Zli(j,i) = Coord(i,j,3); end end x = Coord(1,:,1); yu = interp2(Y...
% calculate distance betweet two points in space function d = distance(a, b) d = ((sum(((a - b).^2)')).^(1/2))'; end
% evaluation - FBPConvNet % modified from MatconvNet (ver.23) % 22 June 2017 % contact : Kyong Jin (kyonghwan.jin@gmail.com) clear restoredefaultpath reset(gpuDevice(1)) run ./matconvnet-1.0-beta23/matlab/vl_setupnn load('./pretrain/net-epoch-151.mat') % cmode='gpu'; % 'cpu' cmode='cpu'; if strcmp(cmode,'gpu') n...
function final_cords = make_all_mirrors(cords, r, lower_bound, upper_bound) final_cords = []; for idx2 = 1:size(cords,1) dummy = make_mirror_3D(cords(idx2,:), r, lower_bound, upper_bound); final_cords = [final_cords;dummy]; end end
clear; sigma=5; Nrand=10; N=100; x=map2colvec(0:2*pi/(N-1):2*pi); % y=1 + 1*x + 2*x.^2 + randn([1 N])*sigma; for ind1=1:N y2(ind1,:)=1*ones([1 Nrand]) + 1*x(ind1)*ones([1 Nrand]) + 2*x(ind1).^2*ones([1 Nrand]) + randn([1 Nrand])*sigma; end y=mean(y2,2); sigma2=1/sqrt(Nrand)*map2rowvec(std(y2,[],2)); %% ...
clc;clear all;close all; tic %% Load and process the data frequency = 4; % 1 for year, 4 for seasons, 12 for months hold_fraction = 0.20; % fraction to Divide data into training and testing part offset =7 ; span = 1; t_xfirst = 1914; t_xlast = 2013; t_xl=2005; features = {'globalCO2','globalpop...
% MEXIHAT Mexican hat ウェーブレット % % [PSI,X] = MEXIHAT(LB,UB,N) は、区間 [LB,UB] 間で N 点等間隔グリッド上で、 % Mexican hat ウェーブレットの値を出力します。出力引数は、グリッド X 上で % 計算されたウェーブレット関数値 psi とグリッド X です。 % % このウェーブレットは、区間[-5 5]で効率的なサポートです。 % % 参考 WAVEINFO. % M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 12-Mar-96. % Last Revision: 14-May-20...
function COMM_STATS = get_daily_community_stats(output,randomisations) T = length(output); Q = zeros(randomisations,T); Q_NULL = zeros(randomisations,T); NMI = zeros(randomisations,T); C = zeros(randomisations,T); C_NULL = zeros(randomisations,T); %KL = zeros(randomisations,T); for t=1:T t At = decompress...
function dsfquery = importDsfquery(path2zip) % IMPORTDSFQUERY Imports the zipped CRSP dsfquery dataset into a table % % IMPORTDSFQUERY (PATH2ZIP) % % Missing codes (Ret): % % CRSP code | SAS code | Description % -44 .E No valid comparison for an excess return % -55 .D No listing ...
function out1 = rho2theta(rho) %function out1 = rho2theta(rho) % % Takes a kxk correlation matrix and returns % a k*(k-1)/2 x 1 vector of the correlation coeffs % % INPUTS: rho, a kxk correlation matrix % % OUTPUTS: out1, a kx(k-1)/2 x 1 vector of correlations [rho12,rho13,...rho(k-1)k] % % Andrew Patton %...
classdef RZ < sqc.op.logical.operator % Z rotation % also RX = exp(-1j*theta/2*sigmaZ) % Copyright 2015 Yulin Wu, Institute of Physics, Chinese Academy of Sciences % mail4ywu@gmail.com/mail4ywu@icloud.com methods function obj = RZ(theta) obj = obj@sqc.op.logical.operator([exp(-1i*theta...
function m = min_u(a,b) if(a>=b) m = b; else m = a; end end
close all clear all clc data = readtable('0015_20 Xfoil Data graphs.xlsx','Range','B4:J36'); noRead = [5,6,7]; data(:, noRead) = []; dataArray = table2array(data); alpha = dataArray(:,1) ; alpha = -1*alpha; CL = dataArray(:,2); CL = -1*CL; CD = dataArray(:,3); CLCD = dataArray(:,5); CLCD = -1*CLCD; ...
classdef VikingFrame < handle % VIKINGFRAME % % Use: % Place an exported frame in Illustrator. The export parameters in the % notes below mean the image will be placed as 26.0453 inches square. % Create a scale bar by creating a line with the following size: % % ScaleBarInches = sbfsem.images.VikingFrame(ScaleBarMicro...
function ncreplace(filename,varname,value) % ncreplace(filename,varname,value) % replace variable value in netcdf file % the number of entries in the variable must match fprintf('ncreplace: open %s\n',filename) ncid = netcdf.open(filename,'NC_WRITE'); fprintf('replacing variable %s\n',varname) varid = netcdf.inqVarID(n...
function [J, grad] = costFunctionReg(theta, X, y, lambda) %COSTFUNCTIONREG Compute cost and gradient for logistic regression with regularization % J = COSTFUNCTIONREG(theta, X, y, lambda) computes the cost of using % theta as the parameter for regularized logistic regression and the % gradient of the cost w.r.t. ...
clear, close all load('finnstats.merged.corrected.mat'); data = trigrams; gutenb = data(strcmp(cellstr(squeeze(meta(:,2,1:9))), 'gutenberg'), :); punk = data(strcmp(cellstr(squeeze(meta(:,2,1:9))), 'punkinfin'), :); yle = data(strcmp(cellstr(squeeze(meta(:,2,1:3))), 'yle'), :); sample_size = 100; ...
load mri fid = fopen('126_1_20.img','r'); out = fread(fid,[256,256],'int16'); %readanalyze('IBSR_01_ana'); image(out) axis image colormap(map)
function [min_dist output_img_index] = face_recognition(image_path, m, A, eigenfaces, pr_img) M = double(rgb2gray(imread(image_path))); M = M'; row = M(:); this_A = row - m'; this_primg = eigenfaces' * this_A; min_dist = norm(pr_img(:, 1) - this_primg); output_img_index = 1; for i = 2:length(pr_im...
clc;clear; addpath('../data') addpath('../functions') % Mosek setup % javaaddpath('C:\Program Files\Mosek\8\tools\platform\win64x86\bin/mosekmatlab.jar') % addpath('C:\Program Files\Mosek\8\toolbox\r2014a') addpath ~/mosek/8/toolbox/r2014a % Read in data & some general setup file_name = 'electricitydata'; disp(['Simu...
%ESTIMATEPOSEBOARD Pose estimation for a board of markers % % [rvec, tvec, num] = cv.estimatePoseBoard(corners, ids, board, cameraMatrix, distCoeffs) % [rvec, tvec, num] = cv.estimatePoseBoard(..., 'OptionName',optionValue, ...) % % ## Input % * __corners__ cell array of already detected markers corners. For eac...
Wls=[]; for i=1:1:size(X,2)-l sY=X(sEEG_idx,i:i+l-1); iY=X(iEEG_idx,i:i+l-1); sY=detrend(sY,2); iY=detrend(iY,2); w=inv(sY*sY'+1*norm(sY,'fro')*eye(size(sY,1)))*sY*iY'; Wls(:,:,i)=w; end
function [varargout] = AtomicGeometryWarper(varargin) % THIS FUNCTION WARPS THE GEOMETRY OF THE ATOMIC SYSTEM ACCORDING TO THE DESIRED WARPING FUNCTION % VERSION - 1.00 STARTED ON 17-01-2014. AUTHOR: SUNIL ANANDATHEERTHA sunilanandatheertha@gmail.com switch varargin{1} % which geometry to warp case 'G1' %--...
function [p_plus] = G_explicite(p_moins,gamma, zeta) %traduction du code de Jeffery (ligne_a_retard_jeff.ipynb) %p : vector %gamma, zeta : scalar %change of variables Y = gamma + 2 .* p_moins; X = zeros(1, length(Y)); %extra useful variables psi= 1 ./ zeta .^ 2; eta = (3 + psi) .^ (1 / 2); mu = 9 ./ 2 .* (3 .* Y - 1)...
%% input data user10final = removevars(user10finalfile,{'VarName1'}); gt = user10final(:,{'groundtruth'}); array = table2array(gt); gt_new = cellstr(array); gt_class_labels = grp2idx(gt_new); user10final = removevars(user10final,{'groundtruth'}); user10final = table2array(user10final); user10final = transpose(user10fin...
function pos_d = genDesiredPos(current_pos, current_pos_desired, last_pos_desired, K_CURRENT, K_PERP) % GENDESIREDPOS 根据先后两个航路点生成期望的位置 % current_pos 当前位置 % current_pos_desired 当前航路点 % last_pos_desired 上一个航路点 % pos_perp 当前位置到航路上的垂直交点 Distent = norm(current_pos_desired - last_pos_desired); if Distent>0.1%0.1m ...
%% Write out solution for each subject % Related to txt2nii.sh, blurFMRI.sh, sumFMRI.sh clc; clear; % Set label label = 'TrueFaces'; % Set the lower bound for CV consistency consistency = 0; % decided if write the data to text files writeToTextFile = false; %% For each subject, Get coordinates and heatmap for voxe...
function d = read_arcSouth_nojunk(start, finish, regs, arcdir, calfile) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function d = read_arc(start, finish, regs, arcdir, calfile) % % start/finish=start finish times as strings with format e.g.: % 01-Jan-2005:00:00:00 % optional regs=regs to extract if ...
function dockAllFigures() % Docks all the figures into the main window. % Biafra Ahanonu % started: 2013.12.09 [20:49:04] % adapted from mathworks site last_fig_no=get(0, 'Children'); for fig_no=1:last_fig_no' figure(fig_no) set(gcf, 'WindowStyle', 'docked') end clear last_fig_no fig_no end
function yearByYearFigs(C, T95prime, GHCND_clustered, summerTime, yrs, summer_doy, ... lag_range, fig_folder, predictand) nyrs = length(yrs); T95summer = reshape(T95prime(ismember(GHCND_clustered.doy, summer_doy)),[length(summer_doy) nyrs]); % add stippling when value is above 80th percentile C80 = prctile(C, 80, ...
% 潘其超, 20140706, V1.0 % 示范一个含有不同标的的tradeList的操作过程 clear; clc; %% addpath(genpath('V:\root\qtool\framework')); load StocktestPack; %初始资金 config.initNav = 0; % 合约种类 config.instrType = [1,2]; % 合约代码 config.instrID = {'a','b'}; % 手续费率 config.cmsnRate = [0.0001,0.0001]; % 保证金比率 config.marginRate = [1,1]; % 合约乘数 config.mult...
function [ip,jp]=Tgetipjp(np) ip=ceil(0.5*(1+sqrt(1+8*np)))-1; jp=np-ip.*(ip-1)./2; endfunction
function [Primal,OptDataMng,Results] = ... prototype(stepTol,actualRedTol,maxOptItr,maxSubProbItr) % Prototype for surrogate based topology optimization % NOTES: % - Based on C.T. Kelley and E.W. Sachs 1999 paper: a trust region method % for parabolic boundary control problems clc; % Problem interface directories...
function deinterleave_write(directory, svec, mics) % deinterleave_write - load all wav files in a directory and interleave % deinterleave_write(directory, svec, mics) % the opposite of load_interleave % takes a row vector with blocks of size <mics> and unfolds it into % an output matrix with <length> / <mics> row...
function [X1,Y1,R1,T1,MAT1]=ReadFromFile(sfile) %-------------------------------------------------------------------------- % All copyrights reserved @ 2014-2020 Dr. Gaofeng Zhao % TIANJIN UNIVERSITY (China), UNSW (Australia) % Email: zhaodlsm@gamil.com %------------------------------------------------------------...
function [state,currentDate] = check_state(startDate,endDate) % Checks the current time and changes state % update currentDate currentDate = datetime('now'); % dateTaken = datetime('now'); % Check if state has changed and change if has if (currentDate < startDate) state = 1; % before it is s...
%SCRIPT TO GENERATE CALCIUM IMAGING DATA FOR %A POPULATION OF COUPLED GLM NEURONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %INITIALIZATION short=0; %use 1 if adjusting firing rate if(exist('T')~=1) T = 600; end %recording time if(exist('N')~=1...
function [circ,stats] = circulation(x,y,u,v, varargin) % function [circ,stats] = circulation(x,y,u,v, varargin) if (ischar(varargin{1})), method = varargin{1}; varargin = varargin(2:end); else method = 'circle'; end; dx = diff(x,[],2); dy = diff(y,[],1); dr = nanmean(abs([dx(:); dy(:)])); switch lower(me...
function receipt = getPopReceipt(obj) % GETPOPRECEIPT Gets the message's pop receipt % The receipt is returned as a character vector % Copyright 2019 The MathWorks, Inc. receipt = char(obj.Handle.getPopReceipt()); end
function align_trials = align_sample_trials_by_zero_cross(t, trials, rep, n_samples, first_region, stretch, second_region, show_res) set_default('stretch',false) set_default('first_region', [0,400]) set_default('second_region', [400,600]) set_default('show_res', false) erp = squeeze(mean(trials,3)); shifts = get_shift...
load data; [M,N]=size(A); % get the size of matrix A %*************************** output 1 output1=sum(sum(A.^2))/(M*N); %display output1 disp('Output 1 is'),output1 %*************************** output 2 output2=0.5*sum(sum(A.*(1+0.2*B)))/(M*N); %display output2 disp('Output 2 is'),output2 %*************************...
%% Exercise 4: % % Now, use the hyperparameter-optimization functionality of fitrsvm() for % finding even better training parameters. No sampling is needed here, % since the hyperparameter-optimization uses a 5-fold cross validation by % default. Therefore, use directly the trainData from "heating-train.mat" % for trai...
% RSMA SNR % Using CVX for optimization (download from: cvxr.com) function [WMMSE,p_1,p_2,p_3,p_123,X_1_123,X_2_123,X_3_123]=RS_1layer_CVX_Optimization(H,SNR,weight,g,u_opt,Rth) u1 = weight(1); u2 = weight(2); u3 = weight(3); [Nr,Nt,N_user] = size(H); h1 = H(:,:,1); h2 = H(:,:,2); h3 = H(:,:,3); g_1_123 =...
% This programs tests RBF for a given function clear all; clc;% close all; %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ % GENERATE THE I/O PATTERN %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ train_pts = 150; test_pts = 150;...
function s1 = dproxW(x) global N0 MTraj K MR CorM delta; function y = minu(v0) y=1-v0; end; function y = plu(v0) y=-(1-v0); end; i00 =(N0+1)*N0/2+1; i01=(N0+1)*N0/2+N0; InVec = x(i00:i01); % Filling 1st colum of trajectory by Init conditions MTraj(1:N0,1...
% related to highlight patch and ROI patch correlation measure: % but instead of correlatin, I am looking at the mean pixel intensity of % highlightPatch for pixels that fall inside and outside the ROI mask. % The idea is that ROIs with high mean hightlightPatch pixel outside the % mask are problematic. % % The foll...
function [h]=vevaiometricPlot(data,varargin) %% plots the vevaiometric % inputs % - data: a table of real or simulated data containing the variables 'evidence', % 'confidence' and 'outcome', if there is a variable 'percept', data % is plotted as a fit, if there is no variable 'percept', data is % ...
function [POP] = mlFilterPredict(POPULATION, numFiltered) % Parameters: % POPULATION: the structures of the new generation % numFiltered: number of structures left after filtering % Return values: % POP: the filtered structures global ORG_STRUC; assert(ORG_STRUC.mlPeerFilter > 0, ... 'mlFilterT...
function fd = div(Px,Py, options) % div - divergence operator % % fd = div(Px,Py, options); % fd = div(P, options); % % options.bound = 'per' or 'sym' % options.order = 1 (backward differences) % = 2 (centered differences) % % Note that the -div and grad operator are adjoint % of each other suc...
function varargout = horizplot(varargin) % function horizplot(y,linestyle...) % Adds horizontal lines at particular y values % % Mercurial revision hash: $Revision$ $Date$ % Copyright (c) 2010, Eric Tytell <tytell at jhu dot edu> if ((numel(varargin{1}) == 1) && ... ishandle(varargin{1}) && strcmp(get(varargin...
function addbedlog %ADDBEDLOG Add bed logs to data that is already cropped % Detailed explanation goes here % Enable dependecies initializedependencies; % Have user select project location and session location = gui_locationselect; session = gui_sessionselect; % Construct project paths Paths = initializepaths(loc...
function p = pmf(p) % Tabular Factor has a pmf method, which returns the factor as a Matlab double % matrix. When the input p is a TabularFactor object, that function is % dispatched. When p is already a double, this function is called and nothing % needs to be done. warning('pmf not a method') end
function k = mygausskernel( std , nstds ) maxi = round(std * nstds); a = [ normpdf(0,0,std) zeros(1,maxi) ]; for i = 1 : maxi a(1+i) = normpdf( i , 0 , std ); end k = [ a(end:-1:2) a ]; k = k / sum(k);
N = 10; index = 200:200+N; index = 1:251; scale = 300; x = scale*xData(index)'; y = zxData(index)'; Ns = 1000; xs = linspace(min(x), max(x), Ns)'; %meanfunc = []; % empty: don't use a mean function meanfunc = @meanConst; % empty: don't use a mean function covfunc = @covSEiso; ...
% Initialise model T = 1; F = kron(eye(2),[1 T; 0 1]); Q = 0.01*kron(eye(2),[T^3/3 T^2/2; T^2/2 T]); H = kron(eye(2),[1 0]); R = 4* eye(2); chol_R=chol(R)'; p_d=0.90; p_s=0.99; Area=[300 300]; Nsteps=81; %Considered number of time steps in the simulation %Negative binomial clutter parameters l_clutter=10; %Mean ...
function matNI_extractROIsfromSPM12labels(label_nifti_file) %matNI_extractROIsfromSPM12labels Grab ROIs from SPM12 Atlas % Loads labelled NIFTI file and finds matching xml file and outputs all % of the ROIs as separate files for ROI extraction. % % Syntax: matNI_extractROIsfromSPM12labels(label_nifti_file) % % Inp...
function rm_idx = detect_high_variance_epochs(X_epo, threshold, show_plot, perc_factor) % % rm_idx = detect_high_variance_epochs(X_epo, threshold, show_plot) % % Displays epoch-wise variance and detects epochs with variance higher than % a given or internally computed threshold. This is useful for the % detection of a...
% Funçãoo que recebe aposição do Satelite em xyz, o pseudorange e a posição da Ground Station em xyz. Devolve o erro do pesudo-range para este satelite. function satellites_prerror = gs_error(sat_pos,pr,base_pos) for i=1:size(sat_pos,1) for j=1:size(pr,1) if sat_pos(i,1) == pr(j,1) r=[sat_pos(i,...
% Matlab script to process the outputs of SPARTACUS-Surface run on % five "actual" RAMI-V scenes numbered 0-4 is_rami4 = 0; for iscene = 0:4 process_spartacus end
function getSpectrum(source,eventdata) global panels displayStatus [p d] = selectedSensor(); [yData time] = timeSubset(displayStatus.tLims,panels(p).data(d).time,panels(p).data(d).yData); %resampling delta time dt=5/1440;%5 minutes doDetrend=1; keepMean=0...
function [Cn Rn]= reorderStages(data, labels, v, C) %reorderStages %labesl = {0, 1} %v is rejection distribution vector %C is array of structures representing the stage classifier, numel(C) == %numel(v) %total stages T = numel(v); %positive rejection fraction p = 0; %execution time m = 0; labels = labels(:)'; b = su...
function [HHH,Sig, NsigMAP]=GaussianSTD_MAP(ima,ps) % Pierrick Coupe - pierrick.coupe@gmail.com % Brain Imaging Center, Montreal Neurological Institute. % Mc Gill University % % Copyright (C) 2010 Pierrick Coupe double(ima); s=size(ima); if(min(ima(:))<0) ima = ima - min(ima(:)); end % Estimation of the zeros p...
clear all; close all; clc %% 071917 % datafolder='C:\Users\A. K. Moore\Desktop\ALL MATLAB\071917_001'; % mVLineAt=0; % % filename='daqout_071917_001_004.mat' % snippets(1).sec=[10 20]; % snippets(1).sec=[30 60]; % % filename='daqout_071917_001_005.mat' % snippets(1).sec=[1 30]; % snippets(2).sec=[30 60]; % % fil...
function [newimg] = focusOnCenterRemove(img,window,slide) width = size(img,2); height = size(img,1); colordepth = size(img,3); windowsize = window*window; centerwidth = width/2; centerheight = height/2; maxdistance = ((width/2)^2+(height/2)^2)^.5; newimg = img; window_r = 0; window_g = 0; window_b = 0; p_blackthresh...
function [varargout] = pdwtsMM(n,varargin) %------------------------------------------------------------------------------- % USAGE of "pdwtsMM". % % L = pdwtsMM(n) % L = pdwtsMM(n,xyrange) % [L1,L2,L] = pdwtsMM(n) % [L1,L2,L] = pdwtsMM(n,xyrange) % % Compute the cubature weights L so that, if Pad is the % matrix of P...
function F = LowerRotorS(State) % 旋翼特性基本测试:模拟旋转塔,无线速度,角速度,横纵变距为0。给定总距,计算受力。 global rho global Rotor b m_b R A Omega s theta_t I_beta a_0 delta c K_beta e M_beta gamma_s h_R1 x_cg global theta_0 v_0 = State; %% 操纵量 theta_1c=0; theta_1s=0; u_H=50; v_H=0; w_H=0; u_dot=0; v_dot=0; w_dot=0; p=0; q=0; r=0; p_H=0; q_H=0; ...
function a = fcn_1(a,b,c,d) global z global u global N global dt z= a; u= b; N=c; dt=d; % disp(dt) end
%addpath(fullfile(pwd,'TOOLBOX')); %addpath(fullfile(pwd,'images')); %Sobel Edge Detection I = imread('5EJJH.jpg'); I_gray = rgb2gray(I); I = im2double(I_gray); f_ori = figure,imshow(I); message = sprintf('Sobel Edge Detection'); f_c = figure, I_sobel = sobelEdgeDetection(I); imshow(I_sobel); %uiwait(msg...
function [FinalFileName, FinaleDirectoryName] = Look_For_TIFF_Files dim = 0; AllDirectories = {}; FinalFileName = {}; FinaleDirectoryName = {}; dirinfo = dir(); % Select the folder where to look for tiff files % ----------------------------------------------- DirectoryName = uigetdir; cd(DirectoryName) ...
function [ output ] = root2( a, b, c ) %Solving quadratic equation numerical coefficients as input (a, b, c) syms x x1 x2 y = a*x^2 + b*x + c; x = sqrt(b^2 - 4*a*c); x1 = (-b + x) / (2*a) x2 = (-b - x) / (2*a) end
% LIFTFILT フィルタに基本的なリフティングステップの適用 % % [LoDN,HiDN,LoRN,HiRN] = LIFTFILT(LoD,HiD,LoR,HiR,ELS) は、 % 4つのフィルタ LoD, HiD, LoR and HiR から、 % "基本的なリフティングステップ (elementary lifting step)" (ELS) により % 得られた LoDN, HiDN, LoRN, HiRN を出力します。 % 4つの入力フィルタは、完全再構成の条件を満たします。 % % ELS は、つぎのような構造体です: % - TYPE = ELS.type は、基本的なリフティングステップの ...
global MCPI_ID MCPI_NM MCPI_TM MCPI_AI MCPI_TI MCPI_MI MCPI_RI MCPI_MP; MCPI_ID = 1; MCPI_NM = 2; MCPI_TM = 3; MCPI_AI = 4; MCPI_TI = 5; MCPI_MI = 6; MCPI_RI = 7; MCPI_MP = 8;
clear all close all clc format long %N=100 M=2 ; N=6 A=[zeros(1,N-1) 0; eye(N-1) zeros(N-1,1)]; % stem N=length(A); I=eye(N); I1=eye(M); B=rand(N,M); B=orth(B); %B=I(:,1:M) %B=[-0.666549601221895,0.258757856602330;-0.529674783868792,-0.240268472171118;-0.300205473874438,0.714625909757013;-0.43015453723087...
function x=ifftGPU(x,m,FH,NX) %IFFTGPU Configurable GPU-based IDFT computation % X=IFFTGPU(X,M,{F},{NY}) % * X is the array on which to apply the IDFT (Inverse Discrete Fourier % Transform) % * M is the direction along which to apply the IDFT % * {F} is a IDFT matrix (or any other square matrix) provided b...
%% In this code, we illustrate the use of the linear topology for % the cluster units in a Kohonen self-ofganizing map to sole a classic % problem in constrained optimization, the so-called traveling salesman % problem(TSP). The aim of the TSP is to find a tour of a given set of % cities that is of minimum length. A to...
function sensingOrder = determineSensingOrder(SRBM, nb_act, nb_ADC) %DETERMINESENSINGORDER Determines in what order channels should be digitzed %for this specific SRBM sensingOrder_prep = []; for i=1:size(SRBM,2) c = SRBM(:,i); c = (c~=0); ind = find(c); for j = 1:nb_act if (~ismember(ind(j),se...
function podpis(x,y) xlabel(x,'interpreter','latex') ylabel(y,'interpreter','latex')
varZ=1; %[1]Use your own a and b. a=0.2699; b=0.032; n=2000; maxlags=150; % m=1; h = -maxlags:maxlags; yx = zeros(size(h)); yx(maxlags) = (varZ^(2)*(a*(1.36-0.6*a)-0.6*(1-0.25*b^(2))))/((1+0.5*b)*a^2-(1-0.25*b^(2))*(1-0.5*b)); yx(maxlags+1) = (0.6*varZ^(2)-yx(2)*(1-0.5*b))/a;
function defineTestbedPortMapping() %defineTestbedPortMapping() % %This function will set the portmapping of any node %that you hardcoded into this file % % "Copyright (c) 2000 and The Regents of the University of California. All rights reserved. % % Permission to use, copy, modify, and distribute this soft...
function [d_s] = beam_gen_exhaustive(RX_measure_report,Beam_index_report, RX_full_measure) %BEAM GROUP GENERATION USING EXHAUSTIVE SEARCH load global_params_incr.mat; N_u = size(RX_measure_report,2); clients = 1:1:N_u; [~,ind] = sort(Beam_index_report(Nap_bw,clients)); clients = clients(ind); ...
function rgb = red rgb = [192,0,0]/255; end
function analyze_cwd(OPTS, TEST_DATA) % Analyze complex impulse responses from measurements % Author: Rick Candell % Organization: National Institute of Standards and Technology % Email: rick.candell@nist.gov set(0,'DefaultFigureWindowStyle','docked') set(0, 'DefaultFigureVisible', 'on') TESTING = false; if nargin ==...
function [ new ] = desiRawFilter( mz,fq,rp ) %desiRawFilter - using a fixed resolving power, determine the frequency of %specific peaks... % Determine HWHM for each m/z hw = (mz / rp) / 2; ll = mz - hw; hl = mz + hw; % Convert to indices (considering that mz is fixed Da width) df = median(diff(mz)); idx = round((mz-m...
figure(); L=256; m=L/2; r = linspace(0, 256, 256); hold on; xlim([0,256]); for E = [1/5, 1/10, 1/20, 1/30, 1/40] s = 0.5-0.5*(1./(1+exp(-(r-m)*E))-0.5)./(1./(1+exp(m*E))-0.5); plot(r,s,'DisplayName',strcat('E=', num2str(E))); end legend; print('figures/problem3','-dpng');
function Resamples = subfuncBootStrapResamples(Nboot,NSub,Stratification) Resamples = uint16(zeros(NSub,Nboot)); if ~isempty(Stratification) Gr1 = find(Stratification == 0); NGr1 = length(Gr1); Gr2 = find(Stratification == 1); NGr2 = length(Gr2); else NGr1 = []; NGr2 = []; end for i = 1:Nboot...
function [phan, map, roi] = loadMaterialsPhantomKvmv(p ) % Load Materials Phantom % % Copyright (c) 2010-2012 by Andreas Keil, Stanford University. % Modified by Meng Wu at 2012.9 fprintf(['Loading material phantom "' p.Phantom.materialsFileName '" with material mapping "' p.Phantom.materialMappingName '"... ']); % r...
function L = ddf(f,ff) % DISTINCT DEGREE FACTORIZATION L = {}; h = ff.rem(ff,[-Inf 0],f); k = 0; [p,n] = ff.gfgetpn(ff); q = p^n; while ~isequal(f,ff.one) hacum = ff.one; for i = 1:q hacum = ff.prod(ff,hacum,h); end h = hacum; h = ff.rem(ff,h,f); k = k + 1; g = euclid_u(ff.minus(ff,...
% the r values created R = linspace(0, 3, 1000); % xVec contains the values of xns to be plotted xVec = zeros(1,1000); % loop goes through every single r value for m = 1:1000; % r value and coefficients defined r = R(1,m); rVec = linspace (r,r,1000); poly = [-R(1,m), 1+R(1,m), 0]; x0 = 0.1; % th...
%% Stelling 1 % % Programmeurs gebruiken nooit logische operatoren % bij het maken van beslissingen m.b.v. code. % Antwoord = 0;
function varargout = construct_image_from_scan(filename) data_dot = load(filename); data1 = data_dot; data1(:,1:3) = roundP(data_dot(:,1:3),0); N = size(data1,1); % fix irregularities in stepsize in A1 pos_A1_round = roundP(data_dot(:,1),0); % vec_stepsize_A1 = 0:max(diff(unique(pos_A1_round))); vec_stepsiz...
function parameters = mesh_constructCGALparameters(paramIn) fieldNames = fieldnames(paramIn); for i = 1 : length(fieldNames) if i == 1 parameters = [' ', num2str(paramIn.(fieldNames{i})), ' ']; else parameters = [parameters, num2str(paramIn.(fieldNames{i})), ...
profile on run Basic_Demo.m profile off profile viewer
% % CONTROLOPTIMIZATIONSIMPLE.M % Summary: This script demonstrates how one could optimize turbine control % settings offline or in real time for the FLORIS model using a known % ambient condition (wind speed, direction, TI). In this example case, % first the yaw angles are optimized under greedy torque control, and % ...
function f = f214(x) % Computes the output to both objective functions for Q2.14 in Optimization % textbook by Belegundu et al. A = 15 * cos(x); B = 15 * sin(x); x_min = min(-5, A - 10); y_min = min(-5, B - 10); x_max = max(5, A + 10); y_max = max(5, B + 10); AA = x_max - x_min; BB = y_max - y_min; f1 = AA * BB; % ...