text
stringlengths
8
6.12M
function newState = createHadamardState(n) %#codegen qc = qregister(n); gateArray = zeros(2,2,n); for qubitNum = 1:n gateArray(:,:,qubitNum) = standardGates.H; end qc = singleQubitGateArray(qc,gateArray); newReg = qregister(1,0,1,0); anotherReg = qregister(4,3); newState = qc.getState(); end
function CreateFootSpringMesh_v3 % This file will determine foot spring positions relative to the heel and toe % markers, which can be used to create a foot ground contact model. % Must specify % Wand trace TRC file % Wand marker names % Distance from wand tip to each marker on the wand (optional) % Foot marker...
function p=addxytrials(p) p2=segmentpupiltrials(p,0,10,size(p.ConditionMeans,2),0,round(median(p.StimLatencies)),4,1,p.YmCRYn); p.YmCRYnTrials=p2.PupilTrials; p.NormedYnTrials=p2.NormedPupTrials; p2=segmentpupiltrials(p,0,10,size(p.ConditionMeans,2),0,round(median(p.StimLatencies)),4,1,p.XmCRXn); p.XmCRXnTrials=...
%-------------------------------------------------------------------------- % LQR_Solution_Costate.m % Calculates the costate for the LQR problem % on page 126 of David Benson's PhD thesis %-------------------------------------------------------------------------- % Contributor: Victor Hakim %--------------------------...
%%%%% Optical fiber travel Propagation transmit %%%%% function dawdz = fiber12(~,aw,~,w,Beta2,Gamma,Dw_g) at = fft(aw); g = 0.62; % constant c=(0.5*1i)*Beta2.*(w.^2).*aw; d=-(0.5*g./(Dw_g)^2).*(w.^2).*aw; dawdz=c(end)+d(end)+g.*aw+ifft(+1i*Gamma*(abs(at)).^2.*at); end
function [AnimationTextures, frameToTrialMatrix]= AnimateNoisyGabor(AnimationTextures, gaborMatrix, noiseMatrix, crossLength, crossWidth, frameToTrialMatrix, trial, coherence, duration, ifi, window) %AnimateNoisyGabor2 takes a 2D gabor pixel matrix and animates it embedded in noise. Provide pixel value matrices for noi...
clear all; % Compare the Normalized Accumulated Distance root = 'D:\Corpus\GMU\output3\OutputCost'; kind = { 'N1W180R0S0EdN1' 'N3W180R0S0EdN1' 'N4W180R0S0EdN1' 'N5W180R0S0EdN1'}; refname = 'english]english10.female.N_english.R_usa.Y35.A35'; for k = 1:length(kind) allfiles = dir(fullfile(root, kind{k}, refname, ...
classdef CE5071C < handle %CE5071C 此处显示有关此类的摘要 %lt 2018.11.20 v1.01 properties fs; end methods function obj = CE5071C(address) obj.fs = instrfind('Type', 'visa-tcpip', 'RsrcName', address, 'Tag', ''); obj.fs=visa('AGILENT',address); ...
function dat = handle_classes(raw) uniques = unique(raw); uniques size_of_uniques = length(uniques); idx = 0; dat = zeros(1,length(raw)); for i = 1:size_of_uniques for j = 1:length(raw) if strcmp(raw(j),uniques(i))==1 dat(j) = idx; end end idx = idx + 1; end
% % kincontrol3linkfunc.m % ode function for kincontrol3link.m % function xdot=kincontrol3linkfunc(t,x,dummy,l1,l2,l3,c,r,xd,Kp,gamma) s1=sin(x(1));c1=cos(x(1)); s12=sin(x(1)+x(2));c12=cos(x(1)+x(2)); s123=sin(x(1)+x(2)+x(3));c123=cos(x(1)+x(2)+x(3)); % JT J=[1 1 1; -l1*s1-l2*s12-l3*s123 -l2*...
%***********************************************************% % INPUT: % DB = price data series % Asset = intial trading account asset %***********************************************************% % OUTPUT: % Asset = new trading account asset %***********************************************************% function Ass...
% store every settings given in settings.ini classdef Settings_ properties List % list of detected settings RASVar % Cell Array of RAS variables choosed by user XSlist % Cell Array of XS choosed by user end methods function obj = initVar(obj,rp) %...
classdef SparseMatrixStructure2d < SWEPreBlanaced2d %SPARSEMATRIXSTRUCTURE2D 此处显示有关此类的摘要 % 此处显示详细说明 properties SMSFile = 'Application\SWE\SWE2d\Benchmark\@SparseMatrixStructure2d\fort.14' end methods function obj = SparseMatrixStructure2d( N ) obj = obj@SWEPreBlana...
clear a b c for si=1:10 a(si)=(A1csERD{si}(2).out.tpr.dec(end,51)+(1-A1csERD{si}(2).out.fpr.dec(end,51)))/2; b(si)=(A2csERD{si}(2).out.tpr.dec(end,51)+(1-A2csERD{si}(2).out.fpr.dec(end,51)))/2; c(si)=(A3csERD{si}(2).out.tpr.dec(end,51)+(1-A3csERD{si}(2).out.fpr.dec(end,51)))/2; a(end+1)=mean(a); ...
%Read the first image Original_Image=imread('C:\NYU_SEM_2\Computer Vision\Assignment 2\Straight.jpg'); imshow(Original_Image); %select the 6 definite boundary points in the image [X_Original,Y_Original]=ginput(6) %Read the second image Shifted_Image=imread('C:\NYU_SEM_2\Computer Vision\Assignment 2\Shift.jpg'); imshow(...
% this function stimulates one retrograde step function[New_position]=JIP1_Motility(Current_position, retrogade_step) if Current_position >0; New_position = Current_position - retrogade_step; %um else New_position = Current_position; end end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Numerische Mathematik fuer Physik und Ingenieurwissenschaften 2018 %%% %% Programmierabgaben (Praktischer Teil des Uebungungsplattes) %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ...
function[Accuracy] = computeAccuracyBR() %% % fprintf('Reading data...; '); data = readtable('datasetBR.csv'); m = round(0.9*size(data,1)); idx = randperm(size(data,1))'; xT1 = table2array(data(idx(1:m),1:end-2)); temp = char(table2array(data(idx(1:m),end-1))); xt1 = str2num(temp(:,1:4)); xTrain = [xT1, xt1]; yTrain =...
%function takes in one or more lines of text, outputs that text in all caps function [] = python_q9(varargin) if(isempty(varargin)) fname = 'sample.txt'; else fname = varargin{1}; end T = readtable(fname,'HeaderLines',0,'ReadVariableNames',false,'Delimiter','\n'); S = T.Va...
function [ eles ] = queryElevationPointsFromUsgs(lats, lons, language) %QUERYELEVATIONPOINTSFROMUSGS Querry elevation data for input locations via %the National Map - Elevation Point Query Service. % % More information can be found at https://nationalmap.gov/epqs/ % % Inputs: % - lats, lons % Column vectors for t...
classdef PoissonProblem properties % right hand side f = @(x,y) 0*x + 0*y % boundary: left, right, bottom, up lb = 0 rb = 1 bb = 0 ub = 1 % boundary condition lf = @(y) 0*y rf = @(y) 0*y bf = @(x) 0*x uf = @...
function[Treat]=ExtractTailH(frame) Treat=frame; [~, t0] = edge(Treat, 'sobel'); fudgeFactor = .7; Treat = edge(Treat,'sobel', t0 * fudgeFactor); se90 = strel('line', 3, 90); se0 = strel('line', 3, 0); Treat = imdilate(Treat, [se90 se0]); Treat = imfill(Treat, 'holes'); Treat = bwareaopen(Treat,500); en...
clearvars; close all; clc; load('DEM_NSW.mat'); gps = [home_pos.lon,home_pos.lat]; [~,idx] = min(abs(gps(1)-xg(1,:))); [~,idy] = min(abs(gps(2)-yg(:,1))); elevation = zg(idx,idy); addpath('../GPS'); A = Calculate_GPS_distance_vect(home_pos,yg(:,1)',xg(1,:)); top_left = Calculate_Next_GPS_Mat(home_pos,[-505;505]); bo...
clc, clear, close all I = imread('issimple2_demo.png'); I = double(I); I = I(:,:,1); I = 1-I/max(I(:)); % Create a 3-slice volume with the image in the middle slice V = zeros(size(I, 1), size(I, 2), 3); V(:, :, 2) = I; figure; imagesc(I) colormap gray axis off axis square hold on tic; for i=find( V==1 )' if issim...
### Skript für die Vorwärtssubstitution einer LR zerlegten Matrix A mit rk(A) = n ### function y = forward_solve(LR, b) ### Rang der Matrix LR ### n = length(sum(LR)); ### Erstes Element des Lösungsvektors elementar berechnen ### y(1) = b(1); for i = 2:1:n y(i) = b(i) - sum(LR(i, 1:(i - 1)) .* y(1...
function bmp_batch; %have user select multiple images and apply bmp_blend T1 = spm_select(inf,'^*.png$','Select images that were used for normalization'); for i=1:size(T1,1), %repeat for each image the user selected [p,n,x] = spm_fileparts(deblank(T1(i,:))); a = fullfile(p, [n x]); b = fullfile(p, ['a' n ...
function [] = WriteDuct(Duct,varargin) if ((nargin == 1) || isempty(varargin)) FileName = [Duct.Name,'_CVH-FL_Model.inp']; else FileName = varargin{1}; end FileID = fopen(FileName,'w'); WriteCVHComponent(Duct,FileID) ; WriteSpacer (FileID) ; WriteFLComponent (Duct,FileID) ; fclose(FileID); ...
function [chiEffectiveAligned] = calculateChiEffectiveAlignedSpins(M1,chi1,M2,chi2) % Effective spin calculation % m1,2: masses % a1,2: dimensionless effective spins aligned with the orbit % Following Vigna-Gomez+2020b (eq. 5): % M1 = M_{BBH,in}, chi1 = \chi_{BBH,in} % M2 = M_{BH,3}, chi2 = \chi_{BH,3} chiEffectiveAli...
timeperiod=[1000 4000]; labels={'1sec'}; nomove='NO1'; immove='IM1'; ammove='AM1'; n_con_ex=6; clear dm Res_in Res_out code_louk_2_gen gzers1=ztype; gsR1o=Res_out; gsR1i=Res_in; timeperiod=[3000 6000]; labels={'3sec'}; nomove='NO3'; immove='IM3'; ammove='AM3'; n_con_ex=4; clear dm Res_in Res_out code_louk_2_gen gzers...
%% EECE 574 Self-tuning %% Author: Holguer A. Becerra %% assignment 1. %% Professor: Guy Dummont. %% RLS clear clc load data2017.mat u=data(:,1); %System Input y=data(:,2); %System Output n=4;% system order m=length(u); error=0; error_n=1; theta=zeros(1,2*n)'; % create a zero vector for the coefficients a and b, 2 ...
# Upon considering all the bigrams in the corpus of Leo Tolstoy work including letters, one found the following contingency table for bigram "snow falling"; # the first columns corresponds to bigrams in which "snow" is the first word, # the first row corresponds to bigrams in which "falling" is the second word. # # ...
%% IA 856 Controle Linear Quadratico Gaussiano Ex.1 clear all,close all,clc % Criacao das variaveis: syms d, syms f, syms q, syms x0, syms x1, syms x2 syms a % alpha syms b % beta % gerando S(j): s2 = q; % S(2) A = (a*s2*b + d*f); % A,B,C apenas para organizar S(1) B = (b*s2*b + f*f)^(-1); C = (b...
% % 模型为60类的训练模型--11个view-多multi % % 保存特征到文件夹的版本 % 选择不同层的特征+PCA+进行liblinear实验 % clc clear run(fullfile('F:\chenjun\dynamic','matconvnet-1.0-beta23\matconvnet-1.0-beta23', 'matlab', 'vl_setupnn.m')) ; net_view1 = dagnn.DagNN.loadobj(load('F:\chenjun\dynamic\exp\uwa_multi_view112\net-deployed-view1.mat')) ; net_view1...
%exercise 39 tic for i = 1:1000 for j = 1:4 if j ==1 resultat = 11; elseif j == 2 resultat = 22; elseif j == 3 resultat = 46; else resultat =6; end end end toc clear all tic for i = 1:1000 for j=1:4 switch j ca...
function array = selectionSort(array) arraySize = numel(array); for i = (1:arraySize-1) min = array(i); minIndex = i; for j = (i:arraySize) if array(j) <= min min = array(j); minIndex = j; end end i...
close all clear variables clc %% Notes % No need to use k-means to determine the center mu of each RBF %% Variables and parameters % System physic parameters h = 1; % Max height of the mountain [m] L = 4; % Length of the valley m = 1; % [kg] g = 9.81; % Gravity acceleration [m/s^2] maximumVelocity = sqrt(2 * g * h); ...
function OnRegisterRead_console(src,evtdata) regAddressString = char(evtdata.regAddress); regAddressInt32 = cast(evtdata.regAddress, 'int32'); regValueInt8 = int8(evtdata.regValue); if (evtdata.success) fprintf(' MAX30101.RegRead(0x%2.2x %s, 0x%2.2x);\n', ... regAddressInt32, regAddressString, regValueInt8...
function SP = simPerformance(T,trial,models,sim_length,n_sample) if nargin < 3 models = 1:5; end if nargin < 4 sim_length = [5 10 20 50 100 200]; end if nargin < 5 n_sample = 100; end SP.models = models; SP.sim_length = sim_length; n_t = size(T.D.X_dot,2); n_m = length(models); n_sl ...
function [] = color( phi) %phi is function handler,i.e., phi = @(z) z^3+1 %returns the RGB triplet for divergent orbit %if convergent, black count = 1; M = zeros(200); for x = 1:400 for y = 1:400 z = 0.01*(x-1)-2 - 0.01i*(y-1) + 2i; count = 1; bounded = false; while abs(z) ...
function [Vxc,Exc,rhoInt] = int_xc(basis,P,grid,ExchFunctional,CorrFunctional) % [Vxc,Exc,rhoInt] = int_xc(basis,P,grid,ExchFunctional,CorrFunctional) % % Input: % basis list of M basis functions % P MxM density matrix % grid molecular integration grid, as obtained by molecular...
% top level for tile based rasterizer v 2.0 % color buffer resolution is assumed to be 320x240 pixels % assuming tile size of 16x16 pixels % so we have 20x15 tiles (300 tiles) % depth testing is supported clear; % screen dimentions (x and y) used % Matlab understand 2d matrices as (rows, columns) >> (y_coord, x_coor...
function tracks_in_shot = read_tracks_via_shots(VideoStruct, Tracks) %READ_TRACKS_VIA_SHOTS Returns a list of track indices per shot % Uses the same index as the "Tracks" % % Author: Makarand Tapaswi % Last modified: 10-05-2013 [ShotStartEnd, ShotType] = videoevents_to_shots(VideoStruct); num_shots = size(ShotStartEn...
function metric = tensor_distance(X,Y,channel_idx,trial_idx,method) if nargin<5 method='eucl'; end flag=0; if norm(X(1,:,1))==0 flag=1; end if strcmp(method,'eucl') for i=1:size(X,trial_idx) x=X(:,:,i); y=Y(:,:,i); for ch=1:size(X,channel_idx) if flag==0 x(ch,:)=x(ch,:)/nor...
function BoltCalcs(hipWeightOfPartsLeft, hipWeightOfPartsRight, thighWeightOfPartsLeft, thighWeightOfPartsRight, ... shankWeightOfPartsLeft, shankWeightOfPartsRight) %% Determining Tensile Stress of the Thread % Determing At allows for the proper selection of screws % Screw selection is based on tab...
function k_means = UpdateMeans(im_array, k, clusters) % UpdateMeans returns the mean RGB values for each of 'k' clusters % Input(s): im_array = a 3D array containing 3 layers % k = a scalar specifying how many clusters % = there are ...
classdef enumSWEFriction < int8 enumeration None (1) Linear (2) Quadric (4) Manning (3) end end
clear; trainDir='../../train/tone_nodynamic_diag/sad/3mix6mix_3'; gmmFile=[trainDir '/neutral_sad.tone.gmm']; trainFile=[trainDir '/neutral_sad.tone_ar']; l=16; mixNum=6; order=0; vfloor=0.01; %% read gmm model gmmP=importdata(gmmFile); w=gmmP(1:mixNum); miux=zeros(l/2,mixNum); miuy=zeros(l/2,mixNum); ...
function S = imstack(I, J) % Resize an image J to the dimensions of I, and stack concatenate it to I. % Note that this function can be called repeatedly to generate a stack of % grayscale image with the dimesions of (w, h, n), where w and h are the width % and height of the first image, and n is the number of stacked i...
Met de help functie kan je alleen zien wat de input variabelen zijn van een standaard Matlab functie en niet de output variabelen.
clc, clear; A = zeros( 10,10 ); A( 6,5 ) = 1; A( 7,10 ) = 1; [x,y] = max2( A );
clc; clear; close all; figure hold on linsty = { '-', '--', '-.', ':' } ; for i = 5 : 6 x = 0 : 0.01 : i ; y = x ; for j = 1 : i y = y .* ( x - j ) ; end plot( x, y, strcat( 'k', linsty{ i - 4 } ) ) ; end axis( [0, 6, -100, 100] ) ; legend( 'n = 5', 'n = 6', 'Location', 'SouthWest' ) ;
function [ cv ] = util_calc_cv( vector ) %UTIL_CALC_CV Get the coefficient of variation of the given vector. % Input: % vector: Given vector; % Output: % cv: The ratio of the standard deviation to the mean. % % Comparison to standard deviation [wiki] % * Advantages: % ...
%% fn_saveasciimatrix %% Syntax % fn_saveasciimatrix(a[,filename]) %% Description % Save matrix in text file % % See also fn_readasciimatrix, fn_readdatlabview, fn_savebin, fn_savetext %% Source % Thomas Deneux % % Copyright 2005-2012 %
% Classifier tool net = patternnet(1, 'performFcn', 'mse'); net.divideFcn = 'divideind'; net.divideParam.trainInd = trainin; net.divideParam.valInd = valin; net.divideParam.testInd = testin; [net,tr] = train(net, NeuralDataValues, NeuralDataClass); % Use this to combinew all the data into one data set % for i...
function inrange = anginrange(a, lo,hi) if (mod(lo - hi,2*pi) == pi) warning('Results may be undefined for range = pi'); end Clo = cos(lo); Slo = sin(lo); Chi = cos(hi); Shi = sin(hi); C = cos(a); S = sin(a); locrosshi = Clo .* Shi - Slo .* Chi; locrossa = Clo .* S - Slo .* C; acrosshi = C .* Shi - S .* Chi; ...
% ==================================================================% % Copyright (c) General Electric Company. All rights reserved. % % This code is only made available outside the General Electric Company % pursuant to a signed Research Agreement between the Company and the % institution to which the code is made ava...
function [a,b,Smat,ll,Gamma0] = DCCestimate(resid,initvec,S,Gamma0) % C D bound.lo = [0.001 0 ]; bound.hi = [1-(1e-04) 1-(1e-04) ]; bound.which = [1 1 ]; if isempty(initvec), initvec=[0.05 0.93]; end if isempty(S), S=corr(resid); end S = Sy...
addpath('./MatlabTools/') addpath('../') % load(['../results/', num2str(nr_arms),'lightbulb_problem.mat']) states = nlightbulb_mdp.states; nr_states=size(states,1)-1; S=states(1:nr_states,:); nr_arms = size(states(1,:),2)/2; nr_observations=sum(states,2)-2*nr_arms; max_nr_observations=max(nr_observations); % valid...
function this = round(this, varargin) % round Round tseries values to specified number of decimals. % % Syntax % ======= % % X = round(X) % X = round(X, Dec) % X = round(X, Dec, 'significant') % % % Input arguments % ================ % % * `X` [ tseries ] - Tseries object whose data will be r...
global last_diagnose read_parameters; generate_constants(height, radius, dx, dz, nx, nz, dt, ... rdif, dif_perp_in, dif_perp_out, dif_z_in, dif_z_out, ... rconduct, conduct_z_in, conduct_z_out, viscosity, ... den_damp, momentum_damp, Te_tanhsrc_max, Te_tanhsrc_radius, ... Te_tanhsrc_incline, Te_gausssrc_magnitude...
%% Stelling 18 % % De OR-operator geeft bij twee logische nullen % (de operands) een logische 1 terug. % Antwoord = 0;
close all; t_0 = 33; % Must be >= qc_length (causal matched filter) ? D = 9; % random bits Nbits = 1e4; bits = round(rand(Nbits, 1)); bits(1:500) = ones(500, 1); bits(501:1000) = zeros(500, 1); SNR_target = 11; %lin. scale [r_c, s_c, w, sigma2_a, N0] = transmit_bits(bits, SNR_target, t_0 + D*4, 'zeronoise'); % ad...
Een for-lus gebruik je als je weet hoe vaak je iets kunt herhalen.
function [ essentialMatrix,score_max ] = EstimateEwithRANSAC( pointsImg1, pointsImg2, calibrationMatrix ) % RANSAC-based estimation of the Essential matrix. % pointsImg1: Matrix containing homogeneous points from the first % image. (One point per column!) % pointsImg2: Matrix containing homogeneous points from the ...
close all clear variables clc rng(55); %% XOR bias = -1; % Fixed value setted permanently to -1 dataset = [0,0,bias; 0,1,bias; 1,0,bias; 1,1,bias]; % Input dataset (u) row = length(dataset); column = length(dataset(1,:)); output = [0, 1, 1, 0]; % Output value(v: it's known cause it's a supervised learning problem) %% ...
function[x, uu, tt] = FEs_ks(N, m, Tf) % This functions solves the PDE % u_t = uu_x - u_{xx} - u_{xxxx}, x \in (0, 32*pi) % u(x, 0) = cos(x/16)*(1 + sin(x/16)) % and periodic boundary conditions with Fourier spectral in space and FE in % time. % % Key features: % + 4th order stiff term % + Kuramoto-Sivashin...
% SAMPLE9.M - Visual presentation synchronised with incoming serial bytes. config_display(1) config_log; config_serial(1); start_cogent; % Draw fixation point in display buffer 2 preparestring( '.', 1 ); loadpict('ralf.bmp',2); % Clear serial bytes buffer clearserialbytes(1); % Repeat the following stimulus 10 time...
function dumpDBN(bnet,fileName,header) NVARS = size(bnet.dag,1); dlmwrite(fileName,header); dlmwrite(fileName,bnet.dag,'-append'); eclass = reshape(bnet.equiv_class,1,[]); node_sizes = reshape(bnet.node_sizes,1,[]); dlmwrite(fileName,node_sizes,'-append'); for i = 1:NVARS a = struct(bnet.CPD{eclass(i)}); f...
function [xp, P, h] = mapToCircle(x, label, fig) if ~exist('fig', 'var') fig = 0; end % assume it's zero mean already coming ing % apply a zero mean formula first and see % x(:, 1) = x(:, 1) - mean(x(:, 1)); % x(:, 2) = x(:, 2) - mean(x(:, 2)); % ellipsePartStruct = fit_ellipse(x(:, 1), x(:, 2)); % x(:, 1) = x(...
% A = [1.5, 15; 9, 2; 1.5, 2; 2.5, 4]; % b = [350, 240, 80, 150]; % c = [-1100, -10600]; %A = [10, 6, 15, 22, 17, 14]; %b = 39; %c = [-52, -27, -50, -60, -31, -11]; A = [30 20; 10 20; 20 0; 0 30]; b = [120 85 62 105]; %orizzontale c = [8 11]; %orizzontale GomoryCut(c, A, b); function GomoryCut(fun, ...
function fluxRampOnOff(frEnable) %% Simple function for turning the flux ramp on or off. Default is to switch root=getSMuRFenv('SMURF_EPICS_ROOT'); rootPath=strcat(root,':AMCc:FpgaTopLevel:AppTop:AppCore:'); rtmRootPath = strcat(rootPath,'RtmCryoDet:'); rtmSpiRootPath = strcat(rtmRootPath,'RtmSpiSr:'); % read curre...
% test solver for complex BP clc; clear; close all; format long; opts.nonorth = 1; n = 40; m = floor(n/4); k = floor(m/2); fprintf('\nSize [n,m,k] = [%i,%i,%i]\n',n,m,k); xsize = [n n]; N = prod(xsize); % generate xs of sparse signal xs = zeros(N,1); p = randperm(N); p = p(1:k); xs(p) = randn(k,1) + 1i*randn(k,1)...
function [params,paramsmap] = getDKImap(mainDir,patientname,x,y,z,A,normdecay,b) % A---the size of orginal 3D images % x,y,z---the remembered coordinates of original 3D images % b--- b values; % mainDir and patientname are the dictionary to save IVIM % normdecay&onormdecay---onormdecay is the original decay data w...
function [MTRasym, freq_offsets] = MTRasym2(obj, freq_max, freq_step, w1, sat_time, pH, catalyst, pK_donor, concentration, pK_acceptor) freq_offsets = -freq_max:freq_step:freq_max; PI = obj.ZSpec2(freq_offsets, w1, sat_time, pH, catalyst, pK_donor, concentration, pK_acceptor); MTRasym = flipud(PI) - PI; end
function d = collision_check(x0, x1, x2, r) global numLink d = -1 * ones(1,numLink); x12 = x1 - x2; x20 = bsxfun(@minus, x2, x0); x10 = bsxfun(@minus, x1, x0); dist2link = sqrt(sum(cross(x12, x20).^2)) ./ sqrt(sum(x12.^2)); % colomn-wise norm dist2x1 = sqrt(sum(x10.^2)); dist2x...
clear all close all clc format long %N=100 M=2; N=4 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.430154537230...
function assignIC(N) % import the globally-scoped numerical solution u_h at previous time-step global u_h_prev_t; % import all the boundary functions on the borders of the domain global initial_condition; % import geometrical properties of the mesh global nodes; % loop over the nodes and in...
addpath('model'); addpath('model/przyblizeniaLiniowe'); addpath('model/macierze'); addpath('model/macierze/G'); addpath('model/warianty'); Stale(); genModel0000Lin(); genModel1111Lin(); [theta, ur] = planowanieRuchu(ones(1,2000),5); % generowanie wykresu bledow nt = length(theta); err = zeros(1,nt); for i=1:nt u...
function C = read_csv(file_location) % Read data from csv C = table2cell(readtable(file_location)); % Remove empty rows to_del = []; % Find the empty rows that we need to delete and delete them for i = 1:size(C, 1) row = C(i,:); if strcmp(row{1},'') to_del = [i, to_del]; end end for i = 1:size(to_de...
function [lzc, maxwords, maxlength] = LZc2(s) % LZC computes the complexity measure, LZc, of a given string, s, % consisting of of 1's and 0's. Complexity is given as the length of the % estimated codebook. Translated from python code supplied for [1]. The % function has been optimised wrt. the lookups in the codeb...
% This script file calculates and plots the surface charge of a grounded % sphere, induced by a single charge in the vicinity. The unit is q/(4 pi % a2)...a is the radius of the sphere clear gamma=linspace(-180,180)*pi/180; % angle between charge and observer a=1; x=[2,4,6,8]; % distance of sphere for(...
%converts pub_rec_bankruptcies because it got imported as a string (for no %obvious reason) function out = pubRecBank(pub_rec_bankruptcies) u = unique(pub_rec_bankruptcies(~isnan(pub_rec_bankruptcies))); out = nan(size(pub_rec_bankruptcies)); for o = 1:length(u), out(pub_rec_bankruptcies==u(o)) = u(o); end
% ASEN 2003 - Lab 6 - Control Theory with Rotary Position % 4/17/2019 - Group 5 - Jashan Chopra, Aiden Wilson, Hugo Stetz, Adam % Elsayed %{ This is the main script for the ASEN2003 Dynamics Lab #6 Function Goals 1) develop a MATLAB simulation of the closed loop behavior of the rigid arm ( Eq. 17 ) 2) deter...
% Feed in patient data and desired amount of rest, and it chops off unneeded time % Returns data without unneeded time function [newdata] = TimeCut(data, restTime) %% Calculate times % Calculate available time at start and end of maneuver timeAvailableS = data.val_start - data.Tdata(1); timeAvailable...
function [ret] = pif(bool, iftrue, iffalse) %% Script pif % % file: pif.m % author: Peter Polcz <ppolcz@gmail.com> % % Created on 2017. August 25. % %% if isscalar(iftrue) ret = iftrue(ones(size(bool))); else assert(all(size(bool) == size(iftrue)), 'Size of the arguments must match') ret = iffals...
function [hspace_mat] = gen_channel_model(a_n, flags) % Generate the channel model (h(n)) based on the a_n(beamforming), the % channel model also takes into consideration of the MPC lamda = 3e8 / flags.f_c; %wavelength of the carrier hspace_mat = zeros(flags.N_line,flags.N_line,flags.N_line,flags.tap_max); % iterate...
function [this, data, B, count] = myidentify(this, data, opt) % myidentify Convert reduced-form VAR to structural VAR. % % Backend IRIS function. % No help provided. % -IRIS Macroeconomic Modeling Toolbox. % -Copyright (c) 2007-2017 IRIS Solutions Team. %-----------------------------------------------------...
clear;clc; Data = csvread('Q2train.csv'); t = Data(:,1); h = Data(:,2); d = Data(:,3); plot(t,h,"ro-"); hold on; plot(t,d,"b*-"); legend("h","d"); xlabel("measurement time");ylabel("measurement component"); title("Measurement Display");
% GPLVMBRENDANAVI Make AVI files of faces data. % load data load frey_rawface.mat Y = double(ff)'; meanData = mean(Y); Y = Y - repmat(meanData, size(Y, 1), 1); load gplvmBrendan1D.mat [K, invK] = computeKernel(X(activeSet, :), theta); % Visualise the results M = gplvmmakeavi1D(X, Y, invK, theta, [], meanData, ac...
% using Meakin 2013 formulation for BIR-8 pulses % units are seconds, cm, radians, Gauss % this version is trying to simplify to BIR 4 clear all close all Npoints = 100; Tseg = 2e-3; % seconds Npoints = Tseg/8e-6; t=linspace(0,Tseg,Npoints); zeta = 15; kappa = atan(60); % 1.5541; tankappa = 60; wmax = 0.389e3 *2*pi; ...
Fs=30000; min_freq=2000; max_freq=12000; dur=1; % make a white noise base signal % [X,Xtime] = whnoise(min_freq,max_freq,Fs,dur); nTAPS=256; % snd=Xtime; % make a gammatone % [coefs]=makeGammaFIR(Fs,6000,'owl'); % snd=rand(1,Fs*dur); % snd=filtfilt(coefs,1,snd); % snd=snd./max(abs(snd)); %t=0:(1/Fs):dur; %snd=sin(2*pi...
function [ errs ] = plot_err (psi, noise, func) % psi is the third euler angle, which is held constant as the others vary. % noise is the percentage of noise added to G an H % func is a handle for the function used to convert G, H to rot % examples: % test direct.m, which computes euler angles directly % plot_err(pi,...
%有nan的行就删除 %输入,需要去nan的矩阵或列(一行中只要有一个nan,这一行就被去除了) %输出,去除之后的矩阵或列,以及去除的索引(为1则要去) function [ind ret]=nan_del(mm) [m n]=size(mm); ind=zeros(m,1); if isa(mm,'double') inds=arrayfun(@isnan,mm); ind=sum(inds,2); elseif isa(mm,'cell') for i=1:m for j=1:n if sum...
clear; close all; const; Tp_w = 0.1 : 0.1 : 1; for Tp = Tp_w system = ss(A, B, C, D, Tp); %%system space dyskretny Gz = tf(system); %%liczenie transmitancji dyskretnej system_continous = d2c(system); %%liczenie state space'a ciaglego Ac = system_continous.A; Bc = system_continous.B; Cc = sys...
function frames = vec2varframes(audiodata, OnsetIndex, WinParam) % Index for Voice onset and offset -- -asymmetric window requires the knowledge of onset and offset index values % for transition (low -> high, high -> low) % % See AsymWindowsInExcel.xls % % Length of Voiced Duration : L % (if Length(W1) = 120...
% Input: manually labeled binary tif % Output: skeleton points in .mat format by using segworm % %% add path of segworm algorithms segworm_path = 'C:\Kezhi\WormTrackingSoftware\SegWorm-master\SegWorm-master'; addpath(genpath([segworm_path,'.'])); % current path and folder folder = 'skeleton_segworm\'; path_from = [...
clc, clear, close; set(0,'DefaultFigureWindowStyle','docked'); addpath(genpath(pwd)); % --------------------------------- run metaheuristcs --------------------% load field field.drawField({1, 1, 1}); fitnessFn = field.fitnessFn; initial_soln = rand(1, fitnessFn.hSize); field.drawNewPath(initial_soln) solutions = ...
function [ ] = Graph1( Hzp,L,Tp,Sp ) %GRAPH1 Di seguito verranno stampanti a video tutti i grafici che possono % ritornare utili. I grafici utili al progetto a tempo continuo usano il % tratto VERDE. % Bode Chart di L figure,bode(Hzp,'g') title('Diagramma di Bode di L') grid on % Asintotic ...
classdef SpacecraftCapsule < Spacecraft methods function self = SpacecraftCapsule(data) self@Spacecraft(data); % In capsules, characteristic length = diameter % and, therefore, the reference area is: self.S = pi * self.L^2 / 4; end end end
% Group-Sparse Regression on 1d ODE with multi-data % xdot = alpha*x*(1-x), % where alpha is the bifurcation parameter. % Output: the probability of recovering correct terms and the relative error ranges % Copyright: Hayden Schaeffer, Giang Tran, Rachel Ward % More information can be found at: % H. Schaeffer...