text
stringlengths
8
6.12M
chi = sqc.qfcns.processTomoData2Chi(CZTomoData); figure;bar3(real(chi));figure;bar3(imag(chi)); phi = toolbox.data_tool.fitting.fitCZPhase(CZTomoData) PIdeal = sqc.qfcns.CZP(phi); chiIdeal = sqc.qfcns.processTomoData2Chi(PIdeal); trace(chi*chiIdeal) trace(chi*chiIdeal)/trace(chi)/trace(chiIdeal) %% ax = qes.util.plot...
% Tested on Matlab 2019a disp('About to process data...') filePath = 'C:\Users\User\Desktop\Final Project\Statistics\statistic.mat'; data = load(filePath); statistic = data.statistic; %statistic = new_statistic; [x, y, z] = size(statistic); %for k=1:z % for i=1:x % for j=1:y % i...
function [vargrid, n0] = GenerateShifts(shifttype, N, K) % [vargrid, n0] = GenerateShifts(shifttype, N, K) % % Generate a shift sequence for an iterative algorithm. % % shifttype: One of % - 'none': no shifts; % - 'random': random shifts; % - 'cycle': shift by 1 sample per itera...
function obj=getHighpassFilter(obj,samplingFrequency) %calculate the highpass filter for sorting if ~isempty(obj.dataRecordingObj) samplingFrequency=obj.dataRecordingObj.samplingFrequency; elseif nargin==2 disp(['Building filter with sampling freq. :' num2str(samplingFrequency)]); %answer = inputdlg(prompt,...
%% Loading the Feature Extraction data in matlab ----------- data = readtable('/home/jairam/Documents/MATLAB/features/featMat.csv'); % Removing phone ID,user ID, and document ID from the data set. Frank et % al says this should not be used for testing data = data(:,[3:12,14:34]); % Removing missing bits of data and ...
function mfunc = minmodB(v,M,h) % function mfunc = minmodB(v,M,h) % Purpose: Implement the TVB modified midmod function. v is a vector mfunc = v(1,:); ids = find(abs(mfunc) > M*h.^2); if(size(ids,2)>0) mfunc(ids) = minmod(v(:,ids)); end return
function [beta,kappa]=betamim(X,y,h) % BETAMIM Kolmogorov Smirnov Moment Independent Measure % % B=BETAMIM(X,Y) computes the mean distance between Y and Y given X % using the two-sided KS test statistics % [B,K]=BETAMIM(X,Y) also returns the mean Kuiper distance K % % ...=BETAMIM(X,Y,H) ad...
% generate random templates %phones = {'iy', 'f'}; phones = {'ih', 'uh', 'ae', 'aa', 'ah', 's', 'pcl', 'p', 'gcl', 'g', 'hh'}; tmpl_t_size = 15; tmpl_f_size = 40; n_pos_per_phone = 4; n_tmpl_per_pos = 15; tmpls_all = zeros(tmpl_f_size,tmpl_t_size,length(phones),n_pos_per_phone,n_tmpl_per_pos); for ip = 1:length(phon...
function [poolTemp, totalQvals, poolData, airTemp, oceanTemp, serialDate, totalTemp] = thermalModel1_2_4_4 %% Notes % |thermalModel1_2_4_4| updated Dec 10 2018 by Tom Hata. % This function is designed to generate a heat and mass budget model of a % tidepool in the intertidal. Long-term weather data must be imported. % ...
function plot_xyground(x1,x2,y1,y2) res = 5; [x y] = meshgrid(linspace(x1,x2,res),linspace(y1,y2,res)); % Generate x and y data z = zeros(res,res); % Generate z data surf(x, y, z) % Plot the surface end
function [CFG] = MEM_config(CFG, test_idx) CFG.tests{test_idx}.long_name = 'Memory_Test'; CFG.tests{test_idx}.expected_user_input = 'mouse'; CFG.tests{test_idx}.num_min_target = 3; CFG.tests{test_idx}.num_max_target = 6; CFG.tests{test_idx}.num_trials_per_level = 7; CFG.tests{test_idx}.grid_size = 9; CFG.tests{test_i...
maxCost = 9999999999; jumlahGenerator = 6; jumlahPopulasi = 10; iterasi = 200; c1 = 1; c2 = 1; r1 = 0.4; r2 = 0.5; fitness1 = fitness(:,:,1); cost1 = cost(:,:,1); velocity1 = zeros(jumlahPopulasi, jumlahGenerator,1); costBest1 = cost1(:, 1); perjalananCostBest1 = cost1; fitnessBest1 = fitness1(:, 1); pBest1 = populasi(...
clc,clear all,close all; image = imread('eight.tif'); I = imnoise(image, 'salt & pepper', 0.1); ZERO_X = 3; ZERO_Y = 3; image_zerod = getZerodImage(I, ZERO_X, ZERO_Y); % Filtres. % M1 = [-1, 1; 0, 1; 1, 1; -1, 0; 0, 0; 1, 0; -1, -1; 0, -1; 1, -1]; M2 = [0, 1; -1, 0; 0, 0; 1, 0; 0, -1]; M3 = [-1, 0; 0, 0; 1, 0]; M4 =...
function [frq_esprit, damping_esprit] = esprit(x, n, K) %ESPRIT Algorithme Esprit % Renvoie les fréquence de résonance (en Hz) et les coefficients % d'amortissement d'un signal % Inputs : % x : Signal a analyser % n : % K : Nombre de modes a trouver N = length(x); l = N - n + 1; % Matrice correlation x_fir...
function [labels]=get_fuzzy_labels(index, index3, number_of_clusters) labels=zeros(13908,1); temp_labels = []; for i=1:number_of_clusters temp_labels = index{i}; for j=1:length(temp_labels) idx = temp_labels(j); labels(idx) = i; end end for i=1:...
function [ i ] = sekvenator(fMID,rMID, sek) %Sekvenátor regular_vyraz = ['^' fMID '.*' seqrcomplement(rMID) '$' '|' '^' rMID '.*' seqrcomplement(fMID) '$']; i = regexp(sek, regular_vyraz); end
function result = erfcore(x,jint) %ERFCORE Core algorithm for error functions. % erf(x) = erfcore(x,0) % erfc(x) = erfcore(x,1) % erfcx(x) = exp(x^2)*erfc(x) = erfcore(x,2) % C. Moler, 2-1-91. % Copyright (c) 1984-98 by The MathWorks, Inc. % $Revision: 5.9 $ $Date: 1997/11/21 23:45:28 $ % This is a tra...
function network_indices = extract_networks(maxr) % extract_networks.m % % Extract indices of different networks % % Inputs: maxr : maximum radius included for nearest neighbour % % Outputs: network_indices : structure of the indices of different networks % of the 513 nodes parcel...
function [X, info] = IRell1(A, b, varargin) % IRell1 Least squares solver with 1-norm penalization term % % options = IRell1('defaults') % [X,info] = IRell1(A,b) % [X,info] = IRell1(A,b,K) % [X,info] = IRell1(A,b,options) % [X,info] = IRell1(A,b,K,options) % % This penalized iterative method enforces sparsity on the s...
function [flag]=mymail(receiver,subject,content,fujian_dir); % mymail(receiver,subject,content,fujian_dir) % 个人邮件发送函数 % mymail(receiver,subject,content,fujian_dir) % 其中 % receiver为收件人邮箱,如receiver='********@126.com'; % 支持单显群发,此时receiver为cell类,例如receiver={'test1@**.**';'test2@**.**'}; % subject = ['ce...
%calling function function [node]=simple_matching(sellers,buyers,node) function [remainingBuyers] = getBuyers(node,buyers) remainingBuyers =[]; for i = 1:length(buyers) if((node(buyers(i)).request > node(buyers(i)).request_fullfilled) && length(node(buyers(i)).unProcessedList)>0) remainingBuyers = [re...
% % Westheimer's linespread formula cd /home/brian/book/01imgfor/fig/subWestheimer % % x is in minutes of visual angle x = -61:0.1:60; %minutes of arc ls = 0.47*exp(-3.3 *(x.^2)) + 0.53*exp(-0.93*abs(x)); plot(x,ls); grid on; xtick = [-6:2:6]; ytick = [0:.2:1]; set(gca,'xlim',[min(xtick) max(xtick)], ... 'x...
function path = find_files(folder, name, extension) % input: path - path to files, name - string contained in file name, % extension - file type of the file % output: image_path - all paths containing name string and extension file % type dirs = dir(folder); path = 0; num = count([dirs.name],name); if(num > 0) ...
%Pick number of signals n=10000; %Specify noise SD noiseSD=1; % Generate real and imaginary noises noiseReal = noiseSD*randn(n,1); noiseImag = noiseSD*randn(n,1); noise = noiseReal + 1i*noiseImag; %Scatterplot of data figure s=subplot(2,2,1) hist(real(noise),50) xlabel('Signal') ylabel('Frequency') set(s,'GridAlp...
function status=mtlwdir(filename,direction_matrix) % status=mtlwdir(filename,direction_matrix) % % MTLWDIR writes direction matrix of a mtlsig file % % status: negative values indicate error % % filename: name of the mtlsig file % direction_matrix: matrix with n-directions columns % first l...
function simulateMouselabLearningSavio(repetition,condition,with_PR) rng((1+repetition)^(1+3*log(abs((condition+1)*(with_PR+1))))) addpath('/global/home/users/flieder/matlab_code/MatlabTools/') %create meta-level MDP add_pseudorewards=true; pseudoreward_type='featureBased'; mean_payoff=4.5; std_payoff=10.6; weight...
% Finds the pose of a camera fixed in the world with respect to the base of % the robot given the known location of a checkerboard with respect to the % base of the robot. clear; close all; addpath('../class'); addpath('../utilities'); global dobot; global tftree; dobot = Dobot('dobot', []); tftree = rostf; %% ...
x=[1 2 0 1]; subplot(3,1,1);stem(x); title('signal x(t)'); y=[2 2 1 1]; subplot(3,1,2);stem(y); title('signal h(t)'); z=conv(x,y); subplot(3,1,3);stem(z); title('convalved signal');
function make_HPtheta_spikephase2(thisdir) disp('Start make_HPtheta_spikephase2') load(thisdir,'spikedata','pos','HP_Theta') s = spikedata(:,1:3); clear spikedata p = HP_Theta; clear HP_Theta s(s(:,1)<pos(1,1) | s(:,1)>pos(end,1),:) = []; p(p(:,1)<pos(1,1) | p(:,1)>pos(end,1),:) = []; clear pos [~...
% run Quant_Truss % run Optim_Truss % run GA_Truss load Quant_Truss load Optim_Truss %% Figure Fsz = 18; Fsz_label = 14; Msz = 9; Msz_diff = 2.5; Ngen = 500; % # of generations of GA Niter = length( Nsol ); % # of iterations of the proposed method eval( ['load GA_Truss_gen' num2str(Ngen)] ) figure; semilogx( EVsga,E...
%{ Args: - Set of N vectors packed as columns of a matrix Z - N dimensional vector containing the classes where each vector in Z belongs - The value for the parameter k of the classifier - Set of N vectors packed as columns in the matrix X Returns: - An N-dimensional vector whose ith component contains the class wh...
%LG3dBdata %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% backoff =3; Gain_pa_initial = Gain_PA( 1,:); Gain_pa_initial =Gain_pa_initial - backoff; B = abs(Gain_PA-repmat(Gain_pa_initial,size(Gain_PA,1),1)); % [x,index]=sort(B); SIZEB = size(B); %% data analysis %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for n=1:SIZEB(1,2) ...
function [] = util_show_progress_bar( percent ) %#codegen %UTIL_SHOW_PROGRESS_BAR Show the progress bar % Input: % percent: 0 - 100 % % Created on Sep/15/2012 By Pu Jiangbo % Britton Chance Center for Biomedical Photonics % % $Revision: % PJB#2012-09-15 Created. % PJB#2012-09-16 ...
function [div_segf] = amie_seg(Xabs, N, S, fs) % % % Objetive: this function implements the respiratory stage segmenter defined % in reference "Automatic Multi-level In-Exhale Segmentation and Enhanced % Generalized S-Transform for whezing detection". Specifically, this function % ...
function LBCN_plot_power_spectrum(fname, timewin, power, indchan, savespect,spectdata) % Function to plot the power spectrum of all (good) channels. % Inputs: % - fname : name of file to plot (optional) % - timewin : time window to plot spectrogram on (default: length of recording) % - power : flag to plot t...
function [spike_rate, spike_rate_std] = spike_rate_in_win(spikes, time_win) % function [spike_rate, spike_rate_std] = spike_rate_in_win(SPIKES, TIME_WIN) % % Returns SPIKE_RATE in Hz in a given TIME_WIN. Spike rate is average % for all channels and all trials in SPIKES. Also returns SPIKE_RATE_STD, % the standard de...
classdef Tid < handle % Tid - transformationally invariant dictionary % % John Bogovic % HHMI % August 2014 properties ( SetAccess = private ) D; % The dictionary elements Dxfm; % The full dictionary iMergeDxfms; % indicates which original dictionary ...
function [ output_image ] = imgtreatment( input_image, winsize ) %imgtreatment Convert images to gray, threshold it, inverse, remove small particules if (nargin<2) winsize=60;%default value for size if not specified end validateImage(input_image);%check if real image if ndims(input_imag...
% Spectral Method For Solving Heat Equation in 1-D % By: Chiyu 'Max' Jiang % Date: Sep 25, 2015 % Solve Heat eqn (\partial f)/(\partial t) = \nu \nabla^2 f % On the interval x = (0,2*pi) with periodicity of 2*pi % Advance in time using forward euler method clear all; close all; clc; %% Define Physical Constants nu =...
function [ code ] = ICV_q6_lbp_2_binary( m ) % Function: ICV_q6_lbp_2_binary % Input: 2-D matrix % Output: Local Binary Pattern, a 1x8 matrix % m should be 3*3 matrix, the center is the target point c = m(2,2); code = [m(1,1)-c > 0 m(2,1)-c > 0 m(3,1)-c > 0 m(3,2)-c > 0 m(3,3)-c > 0 m(2,3)-c > 0 m(1,3)-c > 0 m(...
function clk=readclk2(clockfilename) % % Function readclk % ================ % Reads precise clock file and stores all the information in a matrix % % Sintaxe % ======= % clk=readclk(clockfilename) % % INPUT % ===== % clockfilename -> string, file name % % OUTPUT % ====== % c...
% Toolbox Mcha Audio Playback and Recording % Version 0.0.1 08-Mar-2012 % % Files % getData - get audio data recorded into internal memory % getError - return the string containing the last error % getPosition - get the position from the beginning of the current playback % getVersion - get the version...
function data = load_subj001_2016_02_17() % Combines the fMRI data with stimulus and plotting information, for % ease of use %% Get current data fmri_fname = 'wl_subj001_2016_02_17'; load(fullfile(rootpath, 'data', 'fMRI_CBI', fmri_fname, 'GLMdenoised', 'roiBetas.mat')); data = roiBetas; data.fmri_fname = fmri_fname;...
function [V1, V2] = separate( L, a ) j=1; k=1; for i=1:length(L) if L(i)>a V1(k) = L(i); k =k+1; else V2(j) = L(i); j=j+1; end end disp(strrep(['V1: (' sprintf(' %d,', V1) ')'], ',)', ')')) disp(strrep(['V2: (' sprintf(' %d,', V2) ')'], ',)', ')')) end
function fdm_twod_validacao(pvc_def) % Caracteristicas do PVC pvc_def.debug = 0; pvc_def.coefK = 1; pvc_def.betha = @fdm_twod_validacao_coef_betha; pvc_def.gama = 0; pvc_def.temp0 = 10; % Definicao do dominio (a, b) x (c, d) dominio.a = -1.0; dominio.b = 1.0; dominio.c = -1.0; dominio.d = 1.0; hx = (dominio.b - domin...
function framet = getSbxMonitorFrames(nidaq, timestamps, nframes) % getSbxMonitorFrames gets the timing of monitor frames given a nidaq % channel and nidaq timestamps that have been sorted. % Use simple thresholding to get frame onset times from the analog frame % signal recorded by the NiDAQ system: thres...
function too_close = checkSpacing(x) ax = abs(x); tcidx = find(abs(diff(x)) <= 100*eps(class(x))*max(ax(1:end-1),ax(2:end)),1); too_close = ~isempty(tcidx); end % checkSpacing
% Function to highlight selected regions according to a bwlabel object % Input Required: % Samp = original image % BWLabO = bw labelled object function [L2] = SegArea(Samp, BWLabO) Lrgb = label2rgb(BWLabO, 'jet', 'w', 'shuffle'); Rchan=(0.75*Samp(:,:,1)+0.25*Lrgb(:,:,1)); Bchan=(0.75*Samp(:,:,2)+0...
function gx = Density_U(varargin) % DENSITY_U Calculates and plots the U-density (not to be confused with the % uniform density) % % gx = Density_U(Mu,Psi, resolution); %% % Examples of correct usage: % % Mu=[0 0 1];% Mu=[1 -1 1] ;% Mu=[0 -1 1]; % resolution=100; % % Examples of correct function constructi...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%% Laboratorijska vaja %%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%% 1. naloga %%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %velikosti posameznih nabojev v C Q1=1e-9; Q2=-Q1; Q3=4e-9; %koordinati naboja Q1 v m x1=4e-2; y1=4e-2; %koordinati naboja...
%Name: Matlab: Signals and Systems Lab 8th %Auther: Changgang Zheng %Student Number UESTC:2016200302027 %Student Number UoG:2289258z %Institution: Glasgow College UESCT %Question: 9.2 (a)(b) function problem_3rd %% Problem a zero = 1; a1 = [1 0 1]; a2 = [1 0.5 1]; a3 = [1 2 1]; a4 = [1 4...
% function to extract gist features from a list of image filenames function[features] = extractGistFeatures(folder, imageList,cat) % keep default parameters % % % param.imageSize = gistParameters(1); % % % param.orientationsPerScale = gistParameters(2:5); % % % param.numberBlocks = gistParameters(6); % % % para...
%% fn_pixelpos %% Syntax % pos = fn_pixelpos(hobj) %% Description % returns the position in pixels of any object without needing to % change any units values % % See also fn_pixelsize %% Source % Thomas Deneux % % Copyright 2011-2012 %
%% extract faces from load ./train_set/train_raw_img.mat % train_img load ./train_set_unlabeled/train_unlabeled_raw_img.mat % train_unlabeled_img desired_face_size = [50 50]; train_face.face_detected = zeros(size(train_img,1),1); train_face.face = zeros(size(train_img,1),7500,'uint8'); %% labeled data for i = 1:...
classdef TPA_TwoPhotonEventDetect < handle % TPA_TwoPhotonEventDetect - detects events/spikes on dF/F data % Make only one over entire project. % Inputs: % DffData - N x roiNum - dF/F traces % Outputs: % DffData - N x roiNum - dF/F detected events %--------------------------...
clc;clear all;close all; % The compact version % bnd = [-10,10; % -10,10]; % gridsize = [5,5]; % gnd = Ground(bnd,gridsize,1); % % [X,Y,V]=gnd.ground_gen_rand(0.0); % % mesh(X,Y,V) % % surf(X,Y,V,'EdgeColor','None'); % %% % for i = 1:20 % gnd.add_hole(rand(1)*0.5,'circle',(rand(2,1)-0.5)*10); % % gnd.add_...
% GPLVMOIL Model the oil data with a 2-D GPLVM. % Fix seeds randn('seed', 1e5); rand('seed', 1e5); load 3class Y = DataTrn; lbls = DataTrnLbls; % Centre the data meanData = mean(Y); Y = Y - repmat(meanData, size(Y, 1), 1); % Extract data dimensions and set IVM active set size numData = size(Y, 1); dataDim = size(...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 本函数用于计算omega系数 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function omegaC = omegaCoefficient( R,Rf) loc = isnan(R) | isnan(Rf); R (loc) = []; Rf(loc) = []; if size(R,1)>1 omegaC = mean(R-Rf)/PM(R,Rf,1,0)...
function chi0smat = applychi0s3(opt1D,umat, DNew,VNew,efermi,Npole) T = opt1D.temperature; Gap = 0.0; DeltaE = max(2.0, DNew(end) - DNew(1)); mu = efermi; hs = opt1D.hs; NsGrid = opt1D.NsGrid; [zshift, zweight] = getpole(Npole, T, Gap, DeltaE, mu); Nt = length(DNew); [~,m] = size(umat); ...
classdef makeEmailadresTest < matlab.unittest.TestCase %readAssignments_TestBench % https://nl.mathworks.com/videos/matlab-unit-testing-framework-74975.html properties end methods (Test) function giveWrongInput(testCase) testCase.verifyError(@()makeEmailadres([1111111; ...
function [] = primerjava (X, Y) [Q1 b1 pos1Y2] = postopek1(X, Y); [Q2 b2 pos2Y2] = postopek2(X, Y); #X clf reset hold on if(size(X, 1) == 2) plot([X(1, :), X(1, 1)], [X(2, :), X(2, 1)], 'r'); plot([Y(1, :), Y(1, 1)], [Y(2, :), Y(2, 1)], 'g'); plot([pos1Y2(1, :), pos1Y2(1, 1)], [pos1Y2...
function [] = util_plot_scatter_with_lines( x, y, varargin ) %UTIL_PLOT_SCATTER_WITH_LINES Plot scatter graphs with lines between them. % Input: % x,y: data points % z: if axis z is exist, the program will call scatter3 and % plot3 to get a 3d view % label...
function [sampled_particles updated_weights] = resample(particles,particles_w) N = size(particles,1); indices = randsample(N, N, true, particles_w); % can sample same indices with true replacement % resample particles sampled_particles = particles(indices,:); % update particles weights updated_weights = particles_w...
function SaveGraphFigureLR(inter, node_names, gtitle, fname, left_nodes, right_nodes) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here n_left_nodes = length(left_nodes); n_right_nodes = length(right_nodes); n_node = n_left_nodes + n_right_nodes; X = zeros(1, n_node);...
function db_gui(host, user, password, database) %% (1) gui setup % (1.1) parse input arguments p = inputParser; p.addRequired('host', @(x) ischar(x)); p.addRequired('user', @(x) ischar(x)); p.addRequired('password', @(x) ischar(x)); p.addRequired('database', @(x) ischar(x)); p.parse(host, user, password, database); ar...
function voxvec=fun_random_clustervector(cfg) tmp=reshape(cfg.img,cfg.size(1),cfg.size(2),cfg.size(3)); GetClusters=bwconncomp(tmp,26); clear tmp; numVoxels = cellfun(@numel,GetClusters.PixelIdxList); [~, ClOrder]=sort(numVoxels,'descend'); voxvec = zeros(cfg.vecsi...
function [object_out point_out] = next_object(line_in,line_objects,circle_objects) PREC=1e-10; Nline=length(line_objects); for ind1=1:Nline p1=calc_intersection(line_in,line_objects(ind1)); if ~isempty(p1) % check if intersection is in the direction of the ray in question % or distanc...
%====================================================================================== % Create_Compiled_Values_Petersen.m % % This script performs pairwise calculations on each of the selected 264 % nodes with every other node for every subject. These calculated values (matrices): % mean_non_zero % volume_non_zer...
function varargout = MATHSdaq(varargin) % MATHSDAQ MATLAB code for MATHSdaq.fig %% mathsdaq.m % This GUI code interfaces with TiePie oscilloscopes (Model HS3--> onwards) % using the LibTiePie SDI plugin. Measurements may be performed in a % continuous mode or a triggered mode according to typical oscilloscope % paramet...
function[r]=cdotonetwo(a,b) r=zeros(3,3,3); for i=1:3 for j=1:3 for k=1:3 r(i,j,k)=a(i)*b(j,k); end end end end
function magnitude = magnitude1x3( vector ) %magnitude1x3 COMPUTES THE MAGNITUDE OF A VECTOR SZE 1 ROW x 3 COLUMNS % Input: % vector: THE VECTOR THAT NEEDS ITS MAGNITUDE CALCULATED % Output: % magnitude: A SCALAR QUANTITY THAT REPRESENTS THE MAGNITUDE OF vector magnitude = sqrt((vector(1)^2+ve...
In het Command Window wordt 'hoi' afgedrukt: ======= Code ======= A = 1; B = 2; C = 0; if (A >= B) | (C) 'hoi' else 'dag' end ======= Code =======
function multiSurfaceOverlayOnMri_script(targetList, imgName, surfaceNames, outputDir, surfColor,... varargin) % Overlays many surfaces at a time on the MRI - detailed view. % % multiSurfaceOverlayOnMri_script(targetList, imgName, surfaceNames, outputDir, surfColor,... % <overlayFlag([0],1,2)>, <imgFormat>, <...
function [coef, bessel] = get_coef_bessel(beta, r) nu1 = beta(4); nu2 = beta(5); nu = (nu1+nu2)/2; a = beta(6); nu_vec = [nu1 nu2 nu]; coef = 2.^(1-nu_vec)./gamma(nu_vec)*a^2; r_vec = r(r~=0); bessel = zeros(length(r_vec), 6); bessel(:, 1) = (a*r_vec).^(nu1-1).*besselk(nu1-1, a*r_vec); bessel(:, 2) = (a*r_vec).^(nu2-1...
function [residual, g1, g2, g3] = US_RE09_rep_dynamic(y, x, params, steady_state, it_) % % Status : Computes dynamic model for Dynare % % Inputs : % y [#dynamic variables by 1] double vector of endogenous variables in the order stored % in M_.lead_lag_inciden...
%% read_allEco % read eco-codes in allEco.mat %% function [codes, entries] = read_allEco(varargin) % created 2018/05/10 by Bas Kooijman %% Syntax % [codes, entries] = <../read_allEco.m *read_allEco*>(varargin) %% Description % read eco-codes in allStat. Possible arguments are: climate, ecozone, habitat, embryo, migr...
function [PP_CFG, PP_DATA] = OT_postprocessing_multi(PP_CFG, PP_DATA, CFG_array, DATA_array, test_idx) P_DATA.tests{test_idx}.test_name = DATA_array(1).tests{test_idx}.test_name; num_data = size(DATA_array, 2); flag_all_data_valid = true; figure_count = 0; DATA_array2 = []; for idx = 1:num_data if ~isfield(DATA_a...
function wObj2file(wObj, waveFile) % wObj2file: Save wave object to a wave file % % Usage: % wObj2file(wObj, waveFile) % % Example: % waveFile='what_movies_have_you_seen_recently.wav'; % wObj=waveFile2obj(waveFile); % tempWaveFile=[tempname, '.wav']; % wObj2file(wObj, tempWaveFile) % dos(['start ', tempWaveFile])...
function idx = rank_tasks(ps,prob_t) empty_tasks = find(prob_t==-1); non_empty_tasks = find(prob_t~=-1); [~,sorted_non_empty_idx] = sort(ps(non_empty_tasks,1),'descend'); idx = [empty_tasks; non_empty_tasks(sorted_non_empty_idx)];
function generate_cropped_image_collage(expIDs, agent, generateAllFlag, overwriteFlag, collage_width) addpath(genpath('Z:\dianzhi\scripts\svens_matlab_code-master')) % add sven repo to the matlab search paths if nargin < 5 || ~exist('collage_width', 'var') collage_width = 2000; end if nargin < 4 || ~exist('overw...
function att = Initalign(Accelermeter,Yaw) %%初始对准函数 g = 9.81; att(1) = atan(Accelermeter(2)/Accelermeter(3)); %%横滚角 att(2) = asin(Accelermeter(1)/g); %%俯仰角 att(3) = Yaw; %%航向角 end
function [t2, celba] = celbaer(Pos,Spd,CelBal,CelJob) %Ha a Pos-ból húzott Spd vektor metszi a celvonalat (Szakasz(!), %nem egynes) akkor 1-et ad vissza (true) %t2 az az ertek ami mgmondja hogy a Spd hanyadánál metszi a celvonalat. Ha %t2=1 akkor a Spd vektor eppenhogy eleri a celvonalat. % CelBal = [250,60]; % ...
function y = get_psi(data, th, z, kk) % th=0..180 deg % z=-1..1 i1=(2:data.Nr+1) + data.Nr*round(data.Nthe*th/360); i2=(2:data.Nr+1) + data.Nr*round(data.Nthe*(th+180)/360); ii= [i1(end:-1:1) 1 i2]; zz=round((z+1)/2 * data.Nz); y = data.npsi_previous(ii, zz, kk)'; end
clf; domain = 16*pi; N = 512; x = domain*linspace(0,1-1/N,N)-domain/2; f = exp(-x.^2); % f = exp(-1./(1-(2*x/domain).^2)); % f = sin(x); f = f-mean(f); max (d(f,1,domain) - (-2*x.*exp(-x.^2))); max (d(f,2,domain) - ((4*x.^2-2).*exp(-x.^2))); max (d(f,3,domain) - ((-8*x.^3+12*x).*exp(-x.^2))); for a=linspace(0,2*pi,1000...
function PredictTrajectory( res_dir_name, out_file_name, print_flag ) %% Dictionary of actions file_name = 'action_label.txt'; fileID = fopen(file_name); data = textscan(fileID,'%s'); fclose(fileID); DICT = containers.Map; for i=1:length(data{1}) DICT(data{1}{i}) = i; end DICT2 = DICT; remove(DICT2,'MOVE'); remove...
In Matlab kun je de AND operator gebruiken m.b.v. &&, & en and().
function dp = cosscore(a, b) dp = dot(a,b)/(norm(a)*norm(b))
function [output] = processfile(filename, num_users, num_items) %PROCESSFILE Import file and process its data into a matrix %% process file data [userIds, itemIds, ratings] = importfile(filename); data = zeros(num_items, num_users); data(sub2ind(size(data), itemIds, userIds)) = ratings; %% generate the output outpu...
clc clear name='..\images\3.jpg';%改变数字为1,2或3,为训练图像 img=imread(name); subplot(221),imshow(img);title('original image')%显示原图 gray=img(:,:,2);%选取RGB图像的一个通道作为灰度图像 binary_image=binary(gray,150);%对图像以140为阈值进行二值化 subplot(222),imshow(binary_image);title('binary image')%显示二值化图像 corrode_image=inflate(binary_image);%先膨胀后腐蚀去除...
function [dio, AI] = MagstimDIO(StimModel, Port) %============================= MagstimDIO.m =============================== % This function initializes digital in/out connections necessary for Matlab % control of Magstim stimulators. % % INPUTS: % StimModel: 1) Any Magstim: BNC trigger I/O % ...
% tfSetup.m disp('Starting camera...'); camera(); disp('Starting flight computer...'); startArd; disp('Programming panels for 1 stripe 1 box mode...'); pause(10); progBox; pause(6); ardSetBox(6,32,1) disp('Running X output calibration...'); calibrateXOutput(); ardSetArenaBindings([1,0,-1,0]); disp('-----------------...
function C = MM6(A,B) % function C = MM6(A,B) % C is the 6-digit FP product of the 6-digit FP matrices A and B. [m,p] = size(A); [p,n] = size(B); for i=1:m for j=1:n C(i,j) = Dot6(A(i,:),B(:,j)); end end
function handler = Plot_Target_Estimated_Position (model, truth, est, meas,colorarray,varargin) % ---Input Parser p = inputParser; % Setup parsing schema addParameter(p,'K', truth.K, @isnumeric); addParameter(p,'Transparency', 1, @isnumeric); parse(p, varargin{:}); K = p.Results.K; Trans...
function settings = ibexLoadSettings(file) % Analyze IBEX settings information based on settings file. % % settings = ibexLoadSettings(filestring) % % IBEX uses a .mat file with FeatureSetsInfo struct. % If you don't have a valid file, generate one with % ibexGenerateSettings(). You c...
%This function calculates the streamfunction \psi and potential \phi %in the Helmholtz decomposition of a 2D vector field (u,v) defined on %the longitude/latitude grid lon,lat. % % u = \nabla\psi \times k + \nabla \phi % % \nabla^2 \psi = -\nabla\times u % % \nabla^2 \phi = \nabla\cdot u % % The resolution used on the...
function keyMat = AESRoundKeys(KeyHexStr) % % Input: KeyHexStr = a hex string of 16 bytes, representing the Full % AES system key % Output: RoundKeys = a hex string of 176 bytes, the adjacent groups of 11 % representing the 11 round keys. rcon = ['01', '02', '04', '08', '10', '20', '40', '80', '1b', '36']; x = 1; ...
function demo_segmentationASETS_3D() clear all; close all; fileName = mfilename; fullPath = mfilename('fullpath'); pathCode = strrep(fullPath, fileName, ''); cd(pathCode) %% INPUT DATA %fileName = 'slices10_16_timepoint3_denoised_NLMeansPoisson.mat'; fileName = 'slices10_1...
clc clear all armin=0.001; hr1=0.02; hr2=0.08; hr3=0.125; c=2:1:200; ar1=armin:0.01:0.4; ar2=armin:0.01:0.4; ar3=armin:0.01:0.4; ar4=armin:0.01:0.4; hm=1; scrit1=zeros(1,length(c)); scritloc1=zeros(1,length(c)); for i=1:length(c) cr=c(i); cm=1; [s1,s2,s3,s4]=PerfectlyBonded(ar1,...
function disp(var) %#ok<INUSD> s = evalc('disp(var);'); logger2.fputs(s); end
function [keyIsDown,secs, keyCode] = simResponse(sim, keyCode) if sim == 2 while ~keyCode; [keyIsDown,secs, keyCode] = KbCheck; WaitSecs(.001); end end end