text
stringlengths
8
6.12M
function isValid=isValidPath(start,goal,data) isValid=true; start1=start; goal1=goal; [x,y]=bresenham(start1(1),start1(2),goal1(1),goal1(2)); X=[x';y']; for i=1:length(x) if(checkLimitViolation_carBot(data, X(:,i)) || checkCollision_carBot(data, X(:,i))) isValid = false; return; end ...
function BB = getBurstStatsXConds(BB,syncflag) % This function gets statistics of burst samples for each condition for cond = 1:size(BB.segAmp,2) BB.condstat.ssAmp(:,cond) = [nanmedian(BB.segAmp{cond}) iqr(BB.segAmp{cond}) npCI(BB.segAmp{cond})]; BB.condstat.ssDur(:,cond) = [nanmedian(BB.segDur{cond}) iqr(BB.se...
n=8; x=rand(n); p=poly(x); disp(Pol2Txt(p)); disp(polyvalm(p,x)==x);
function [match mindist] = match_bruteForce(q, p) m = size(p,2); n = size(q,2); match = zeros(1,m); mindist = zeros(1,m); for ki=1:m d=zeros(1,n); for ti=1:3 d=d+(q(ti,:)-p(ti,ki)).^2; end [mindist(ki),match(ki)]=min(d); end m...
function [ F ] = corrupt( F, epsilon ) %UNTITLED Summary of this function goes here % Detailed explanation goes here F = F + normrnd(0, epsilon, size(F)); end
function [D]=sml_trial(MOV,D,fig,varargin) sample = 5; forceThres = 0.25; minDist = 100/sample; % ------------------------------------------------ % extract data if (isempty(MOV)) return; end; fingernames = {'Thumb','Index','Middle','Ring','Pinky'}; handnames = {'LH','RH'}; state = MOV(:,1); ...
classdef TrialSync < WBTrial properties block = 0; end methods function start(this) this.block = this.flow.variable(['BlockNum']); %doFMRI = this.flow.variable('forFMRI'); this.design.loadScene('SYNC SCREEN'); this.design.startAllTasks(); ...
function SR = ComputeSelfRemblance_global(varargin) % Compute Self-Resemblance % [RETURNS] % SR : Saliency Map % % [PARAMETERS] % img : Input image % LARK : A collection of LARK descriptors % param : parameters % [HISTORY] % Nov 23, 2011 : created by Hae Jong img = varargin{1}; LARK = varargin{2}; param = vara...
function [Psignal] = CrePreSig(U,y) %It creates a matrix(using lpc) who's %columns contain the predicted signal %for every window. %Input: %U = StimuladedMatrix %y = WindowedSignalMatrix %Output: %Psignal = PredictedSignalMatrix %Usage: %pSignal = CrePreSig(u,Y); Psignal = zeros(480,570); for i = 1:570 ...
function [decision] = calulate_class(theta1, theta2, theta3, x) % theta : Parameters % x : Input vector % decision: Class 1,2 or 3 % C : Covariance % M : Mean C1 = theta1(:,2:end); M1 = theta1(:,1); C2 = theta2(:,2:end); M2 = theta2(:,1); ...
result = checkpositive([4 1 1; -1 0 0; 0 0 0; .1 .2 .1]); result
% % Batch Effect Removing % Gene Standardization % % Input: % idata -- The expression matrix, (samples are in columns) % ilabel -- the batch labels,column vector, start from 1, continues. % function [data] = GeneStandardization(idata,ilabel) size_label = size(ilabel); size_data = size(idata); if size_label ~= siz...
function IS=simpson(fun,a,b) %funkcija simpson računa približek IS integrala funkcije fun na intervalu %[a,b] po simpsonovem pravilu na točkah a, (a+b)/2 in b. h=(b-a)/2; %korak pri simpsonovem pravilu IS=h/3*(fun(a)+4*fun(a+h)+fun(b)); end
clear %% RF=1; %Average Force L=1; %Distance F1 = 23; % Initial Force row = 9;column = 9;% For square Thruster_Number = row * column; data = 0; % dynamic transfer number for line segment Fig = 3; [Array] = Draw_Thruster(row,column,Fig); % Initial Thruster Array Figure Fig = 2; [Array] = Draw_Thruster(row,column,Fig)...
function [R,nPoints] = resistance(IData,VData) minPoints = 4; if length(IData) ~= length(VData) fprintf(2,'Inputs must be the same length.'); return; end N = length(VData); [minP,S] = polyfit(IData(N-minPoints:N),VData(N-minPoints:N),1); minS = S.normr; nPoints = minPoints; %Try to achieve better fit with additi...
%% measure correlation between slowphoto handedness and arena circling handedness [photodat,labelNames]=extractField_multiFile({'handedness';'Light';... 'labels_table'},'Keyword','Slow Phototaxis'); %% [arenadat,labelNames]=extractField_multiFile({'handedness';'Speed';... 'labels_table'},'Keyword','Arena Circl...
% This is a code of FFNN x = load('lienard_intermittency.dat'); data = [x(:,2)]'; inputData = (data(1:end-1)); targetData = (data(2:end)); trlen = 45000; tslen = 5000-1; trX = inputData(1:trlen); tsX = inputData(trlen+1:trlen+tslen); % Remove initial points from target! trY = targetData(1:trlen); tsY = targetDat...
function k_corr_m = f_epi_phase_corr_phc(k_m,phc_data,DATAFLAGparams, ... DWIparams,ind_sl,ind_ec,ind_coil,ind_avg,ind_dw) %[f_epi_phase_corr_phc] does EPI echo phase correction using PHC data. % % USAGE % k_corr_m = f_epi_phase_corr_phc(k_m,phc_data,DATAFLAGparams, ... % DWIparams,ind_sl,ind_ec,ind_c...
function [pValue] = mcn(x,varargin) p = inputParser; addRequired(p,'x',@(x) validateattributes(x,{'numeric'},{'real','finite','integer','nonnegative','nonnan','size',[2 2]})); addOptional(p,'alpha',0.05, @(x) validateattributes(x,{'numeric'},{'scalar','real','finite','nonnan','>',0,'<',1})); parse(p,x,varargin{:}); x=p...
%{ mice.Requests (manual) # requests for transgenic mice$ request_idx : int # request number --- requestor="none" : enum('Jake','Manolis','Dimitri','Shan','Keith','Cathryn','Fabian','Deumani','Matt','Megan','Paul','Shuang','Federico','Jiakun','Other','Available','none') # person wh...
% input - input data. % target - target data. load input.csv %loading input.csv data into work space with name as 'input' %checking for NaN values in loaded data and replacing it with mean value of %that column with help of function interpl. These can be treated as data %pre-processing steps. xdata2=(1:size(input,1...
function y = mul_t(a,b) %saida em dec %multiplica pela tabela E_table e L_table %a em decimal %b o valor decimal %ja transforma o b em hexa E_table = ['0103050F113355FF1A2E7296A1F81335'; '5FE13848D87395A4F702060A1E2266AA'; 'E5345CE43759EB266ABED97090ABE631'; '53F5040C143C44CC4FD168B8D36EB2CD'; '4CD467A9E03B4DD762...
% calculate network peroperties and save them clear all; close all; clc; addpath('D:\work\eeg\Final\last15s\2019_03_03_BCT'); addpath('D:\software\eeglab14_1_2b'); %% average all trials for cooperation and copition: undirected weighted network % replace cop with cop; load('data/useful/conn/conn_phase_pli','conn_phase...
function [ ts, Sflag ] = dbDayTicks(conn, secID, req_date, levels, type) %% 该函数至少有两个参数 % secID 为证券代码 '600000.SZ'或者 'IF1312.CFE' 前六个代码不能错 % type为证券类型'stock'表示股票 或者 'future'表示期货 % levels 为行情的档数, 如股票一般为5档行情 % req_date行情的日期 %HeQun 2013.12.23 % 程刚,20131223;添加注释。 % 数据灌入有大缺陷:当前IF只有level1,故只灌入一档 %% 预处理 if nargin <3 e...
function [r, s] = signing(hm, k, q, p, g, x) %% menghitung k-1 (invers modulo) [G, C, ~] = gcd(k,q); if G==1 % The inverse of a(mod b) exists only if gcd(a,b)=1 InvK = mod(C,q); else disp('Modular multiplicative inverse does not exist for these values') end %% menghitung r r = mod...
img = imread('pout.tif'); %J = imadjust(f,[low_in high_in],[low_out high_out], gamma) J1 = imadjust(img,[],[],3); J2 = imadjust(img,[],[],0.4); J3 = imadjust(img,[],[],1); imshow(J1);
classdef splitsampling < handle %% Class for sub-sampling methods properties % Type of creating the split sample boundaries type % Number of split samples S % Number of choice values M % Lower bound for class boundaries a_l % Upper boun...
function string = GetEchoStringDisplay(windowPtr, msg, x, y, textColor, bgColor) % string = GetEchoStringDisplay(window, msg, x, y, [textColor], [bgColor]) % % Get a string typed at the keyboard. Entry is terminated by % <return> or <enter>. % % Typed characters are displayed in the window. The delete % character is h...
% [O, X] = facade_sp(1, 0.3); figure subplot(6,3,1); ddisp(best.brtf.psnr.L); title('BRTF'); subplot(6,3,2); ddisp(best.ten_rpca.psnr.L); title('RPCA'); subplot(6,3,3); ddisp(best.ten_brpca.psnr.L); title('BRPCA'); subplot(6,3,4); ddisp(best.ten_orpca.psnr.L); title('HORSVD'); subplot(6,3,5); ddisp(best.ten_rcpd.psnr....
% matrix exponent of a 2nx2 matrix function c=f_exp(s) [s1,s2]=size(s); if (s2~=2) error('f_exp: looks like your matrix has a wong size!'); end n=round(s1/2); idxa=1:n; idxb=n+1:2*n; c=zeros(2*n,2); for i=1:n ma=...
function res=day_diff(month1,day1,month2,day2) days = [31,28,31,30,31,30,31,31,30,31,30,31]; if ~isscalar(month1) || ~isscalar(month2) || (month1 ~= floor(month1)) || (month2 ~= floor(month2)) res = -1; return end if (month1 <= 0) || (month1>12) || (month2 <=0) || (month2 >12 ) res = -1; ...
function scans_to_process = LONG_DARTELregistration_to_existing( scans_to_process, templatepath) %LONG_run_LONG_DARTELregistration_to_existing - SPM12 DARTEL registration %to existing template based % % Syntax: scans_to_process = LONG_DARTELregistration_to_existing( scans_to_process, templatepath) % % Inpu...
function result=PCAFilter(csidata,pcstream) ResultforPCA=csidata'; [coeff,score,latent]=princomp(ResultforPCA); len2=length(score); score2=zeros(len2,30); score2(:,pcstream:30)=score(:,pcstream:30); PCAResult=(score2*coeff)'; result=PCAResult; end
% DESCRIPTION: EVSI estimation for experimental approach to monitoring % DATE: 28/10/2014 clear % LOAD INPUT DATA load_data % DEFINE GLOBAL VARIABLES global s t B c1 c2 q pr_prob Start_m1 sp_monit manage s = 3; t = 2; B = 0:10:100; c1 = (real_c1/(real_c1+real_c2))*100; % Standardising costs c2 = (real_c2/(real_c1+...
filename='monkey.jpg'; grayIm=rgb2gray(im2double(imread(filename))); display('- Image blurring...'); blur = blurInImageSpace(grayIm,7);
function genomMut = mutateGenomIdx(genom, genomIdx, values) % % Part of a *FAILED* approch to segmentation optimization by genetic % optimization. % % Writen by Markus Mayer, Pattern Recognition Lab, University of % Erlangen-Nuremberg, markus.mayer@informatik.uni-erlangen.de % Initial version some time in 2012. geno...
function ha = shBox(box, varargin) % Plot box in 2-D. % % Input % box - box, 2 x 2 % varargin % show option % lnWid - line width, {1} % % Output % ha % haBox - handle % % History % create - Feng Zhou (zhfe99@gmail.com), 07-10-2012 % modify - Feng Zhou (zhfe99@gmail.com), 07-10-2012...
function writeMetaImage_mhd(filenameMhd, meta) % writeMetaImage_mhd(filenameMhd, meta) is a helper function and % writes the MHD header file using the given file name and meta % information. % % Instead of using this function, better use writeMetaImage for % writing your files. % % Andreas Keil, keila@in.tum.de, 2...
function orbits = get_repeat_tracks() RE = 6378140; MU = 3.986004418e14; PE = 86400; PRECISION = 60/6000; h = 1000*(400:25:1225); P = 2*pi./sqrt(MU./((RE+h).^3)); revs = PE./P;%e.g. 14.325 drevs = revs - floor(revs);%e.g. 0.325 % drevs = round(drevs*PRECISION)./PRECISION; orbits = zeros(length(drevs),3); ndays = 1:200...
function [ Q q Qn qn ] = util_calc_synchrony( spif, chlist, varargin ) %UTIL_CALC_SYNCHRONY Measure the synchrony between selected channels % Input: % spif: Spike information structure % chlist: 'all' - All channels % [11 22 ... 88] - Selected channels, must >=...
function result=turbo_lsq03( est , tr_vec, consts, data ) % function result=turbo_lsq03( est , tr_vec, consts, data ) % % this version uses a gamma function uses Greg's analytical solution... % % Ttrans=est(1); f=est(2) ; R1art=consts(1); R1t=consts(2); alpha = consts(3); del = consts(4); M0 = consts(5); T1a = 1/R1a...
classdef FishImage % FishImage % This class is a simple wrapper that contains information for a fish % species and should be used in conjunctionwith fishData.mat. properties species; image; end methods function obj = FishImage(species, image) %...
function text3d() addpath textures [z r p a b ps] = textread('text3d.dat', '%f %f %f %f %f %f',... 'commentstyle', 'shell'); a=reshape(a, 50,51,50); % ph, r, z b=reshape(b, 50,51,50); a = permute(a, [2 1 3]); % -> r,ph,z b = permute(b, [2 1 3]); % figure(); clf; hold on; % plot(1:...
function result = L(r, d, phi) if abs(phi) < pi/2 eps = 1; elseif abs(phi) > pi/2 eps = -1; else printf("Phi equals pi/2!\n"); end squared_diff = r*r - d*d; result = (squared_diff*tan(phi))/(eps*(sqrt(r*r + squared_diff*tan(phi)*tan(phi)))+r); end
function psnr = PSNR_CAL(im,im_11) PSNR = sum(sum(sum((double(im)-double(im_11)).*(double(im)-double(im_11))))); PSNR = PSNR /(numel(im)); psnr = 20 * log10(255/ sqrt(PSNR)); end
function [S_DSM,E_DSM,single_scores,single_costs,single_subobjective_scores,pair_scores,pair_costs,pairs_subobjective_scores] = RBES_update_DSMs() global params N = length(params.instrument_list);% num of instruments RBES_set_parameter('WATCH_ONLY','no'); if strcmp('CASE_STUDY','IRIDIUM') orbit = get_Iridium_orbit(...
%% Test event localization % by Hideki Kawahara % 25/Jan./2020 %matName = 'fvn44k20200123T224712.mat'; matName = 'fvn44k20200125T053950.mat'; tmp = load(matName); hh = tmp.output.averagedResponseWaveform; fs = tmp.output.samplingFrequency; hl = length(hh); fc1 = 10000; n1 = round(fs * 0.001); w1e = hanning(2 * n1 + ...
%{ tune.DotRFMethod (lookup) # options for dot maping. rf_method : tinyint # method number --- onset_delay : float # response onset delay in msec response_duration : float # response window in msec rf_filter : float ...
clc clear all close all Im1 = imread('boat1.pgm'); Im2 = imread('boat2.pgm'); [imy,imx] = size(Im2); [matches, scores, fa, fb] = keypoint_matching(Im1,Im2); N = 10; K = 10; [M, T, inliners] = RANSAC(fa,fb,matches,N,K); xgrid = meshgrid(1:imx, 1:imy); ygrid = meshgrid(1:imy, 1:imx)'; rotx = M(1,1).*xgrid + M(1,2).*y...
function [mpc, weak_result, med_result, strong_result] = case9_histograms() mpc = 'case9.m'; subset = 1:9; %% clear m; m.mpc = mpc; m.subset = subset; m.gamma_max = 2.5; m.K = 3; m.Lnorm = 1; m.obj_type = 'angle'; m.opf_obj_mult = 0; %% %fw_attack_20150211(m); %% mpc = loadcase3(m.mpc); n = length(m.subset); o = one...
train_data = importdata('trainingData.txt',' '); classes = train_data(:, 1); features = train_data(:, 2:6); prob_class_one = sum(classes)/size(classes,1); prob_class_zero = (size(classes,1) -sum(classes))/size(classes,1); prob_A1 = [0 0; 0 0]; prob_A1(1,1) = conditional_prob(0, 0, 1);%p(A1=0 | 0) prob_A1...
function [PC_back,intmem_back,idatax_back,cycle_back]=DecUnd(PC,cycle,intmem,idatax,i) intmem_back=intmem; idatax_back=idatax; %load PSW PSW=loadPSW(intmem(209,1)); if (PSW(4,1)==0 && PSW(5,1)==0) rn=intmem(i,1); elseif (PSW(4,1)==0 && PSW(5,1)==1) rn=intmem(i+8,1); else...
clear % xMax is the maximum normalized speed used in each plane of the figure. xMax = 3; % N is the number of grid points used in each plane of the figure. N = 300; % A good value is 30-100 for testing things out, but you might want to go % up to 300 for a "production" figure. This script starts to take a long % time...
% Run time of Program is 53.07 sec on windows 10 system with i5 processor clc close all tic; Input_Image = phantom(256); [out0, out1a, out1b, out2a, out2b, out3a, out3b] = Question2_a(Input_Image); close all [S0, S1, S5, R0, R1, R5, rrmse_array ] = Question2_b(Input_Image); close all [rrmse0,rrmse1,rrmse5] = ...
function [ fM, fP ] = matEvaluateSurfValue( obj, fphys ) %MATEVALUATESURFVALUE Summary of this function goes here % Detailed explanation goes here m = obj.FToM; [ fM, fP ] = mxEvaluateSurfValue( obj.FToE, obj.FToN1, obj.FToN2, fphys{m} ); end
pwd ls; contents = ls whos contents parent = 'D:\Backup\git\Coursera\MatLab-Intro\hw8\' %cd(parent) %cd('..') %parent save podaci %clear
%%%%%I mudy open the reading.txt file with read only permissions clear fileID = fopen('readings.txt','r'); %%%%%Fscan the file into the variables formatSpecString = '%s'; %formatSpec = '%d %d %d %d %d %d %s %f'; formatSpec = '%d %s %s %s %s %s %s %f'; %formatSpec = '%d'; %sizeB = [8 Inf]; %B = fscanf(fileID,formatS...
clc; clear; trainData = importdata('./data_EM/train.dat'); attrOrder = cell2mat(trainData.textdata); trainData = trainData.data; m = size(trainData,1); testData = importdata('./data_EM/test.dat'); testData = testData.data; % defined for holding number of parents for each boolean variable numParents = co...
%%% Post-processing Code for Qucs %%% Eindhoven Unversity of Technology %%% Authors: Prof. Dr. Peter Baltus %%% Dr. Carlos Mendes Jr. %%% Circuit: LPF %%% SYSTEM STARTUP %%% % Initialize clear all; close all; clc; % Add path for Qucs handling functions (Use / instead of \) %addpath ("C:/Program Files (x...
function d = fhpkg_sparsify(d) % D = fhpkg_sparsify(D) converts a dictionary of "dense" features to "sparse" % features as described in Section 2.3 of [Mutch & Lowe 2006]. % % See also: fhpkg_sample. %*********************************************************************************************************************...
function [ remaining, plane ] = backgroundsub( depth_cloud ) % figure(1) % plot3(depth_cloud(:,4),depth_cloud(:,5),depth_cloud(:,6),'k.') % pause [L,~] = size(depth_cloud); while L > 100000 [L,~] = size(depth_cloud); [oldlist, plane] = select_patch(depth_cloud); % plot3(oldlist(:,1),oldlist(:,2),oldlist(:,...
function [p,t]=an_interp_nak(g,x,y) % Interpolante spline cubica (not-a-knot) di (n+1) % (n>=3) punti (x,y) risolvendo il sistema lineare; % function [p,t]=an_interp_nak(g,x,y) % g --> grado della spline di interpolazione % x --> vettore delle ascisse % y --> vettore delle ordinate % p <-- vettore dei coefficienti det...
function properties=evaluateMouselabMDP(T,R,s0,horizon,myopic_first_move,... optimal_planning_horizon) if not(exist('optimal_planning_horizon','var')) optimal_planning_horizon=horizon; end nr_locations=size(T,1); nr_actions=size(T,3); R_hat=-10^4*ones(nr_locations,nr_locations,nr_actions); %impossible actions...
clc; clear all; close all; a=imread('SpecifyGammaWhenAdjustingContrastExample_01.jpg'); a=rgb2gray(a); figure; imshow(a); a=double(a); [x y]=size(a); c=input('Enter value of c:'); gam=input('Enter value of gamma:'); max=a(1,1); for i=1:1:x for j=1:1:y a(i,j)=c*(a(i,j))^gam; if(max<a(i,j)) max=a(i,j); end end end ...
function [J, grad] = linearRegCostFunction(X, y, theta, lambda) %LINEARREGCOSTFUNCTION Compute cost and gradient for regularized linear %regression with multiple variables % [J, grad] = LINEARREGCOSTFUNCTION(X, y, theta, lambda) computes the % cost of using theta as the parameter for linear regression to fit the % ...
function G = inertia(robj, q) % Syntax % % G = inertia(robj, q) % % Description % % Returns the manipulator gravity vector. toMex = createStructForMex(robj); G = mex_gravity(toMex, q);
function [ xCoord,yCoord,width,height,image] = faceDetectionArea(image) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here %face recognation faceDetector = vision.CascadeObjectDetector; %Create a detector object. I = image;%Read input image. bboxes = step(faceDetector, I);%Detect faces...
function [V] = CliquePotentialsLL(linelist, labels, Cliques, mrf) V = zeros(size(Cliques)); for c=1:size(Cliques,1) if(mrf.sorm == 1) V(c) = SormCliquePotential(linelist, labels, Cliques{c}, mrf); else V(c) = CliquePotential(linelist, labels, Cliques{c}, mrf);...
% He Feng % EE 440 HW 1 Problem 3 close all; clear all; % Read the photo and its associate colormap. [X,map] = imread('1_2.tif','tif'); % Show the original photo X. figure(1) imshow(X,map); % Transfer the photo X into gray scale. Y = ind2gray(X,map); figure(2) imshow(Y); % To make sure the type of image. % Y is a 2...
%% mask visualization figure(90); imshow(mask_in_loop.*current_frame); %imshow(mask_in_loop); title('Current Mask'); mask_converted1 = mask_converter(mask_in_loop); mask_converted2=mask_converted1+mask_converted2; figure(85); imagesc(mask_converted2); title('Mask update history'); %% Visualization of grid...
function [di,dv] = parsedigitalinanalog(stream,n,ht,lt) %PARSEDIGITALINANALOG Get digital rising and falling edges in a analog stream % Detailed explanation goes here di=[];dv=[];cs=stream(1)>ht; for i=2:n t=stream(i); if t > ht && ~cs cs=true; di=[di,i]; dv=[dv,cs]; elseif t < lt...
%LUPivoteo([1 2; -3 4]) function LUPivoteo(A) %Factorizacion LU con pivoteo parcial [n, n1] = size(A); L=eye(n); %Matriz L triangular inferior inicializada como identidad P=eye(n); %Matriz permutacion P inicializada como identidad U=A; for j = 1:n [pivot m] = max(abs(U(j:n, j))); m = m+j-1; if...
%script testAmplSweepOverlayBands %sweeps a full band %updated SRS 15Dec2017 Nread = 2; dwell = 0.02; freqs = -10:0.1:10; %frequencies in MHz resp = zeros(32, size(freqs,2)*Nread); f = zeros(32, size(freqs,2)*Nread); band_centers1 = circshift((0:1:15)'-8, 8); band_centers2 = circshift((0.5:1:15.5)'-8, ...
% Recover all system properties possible from two subsequent trials of a % disk in free vibration with different known masses attached to it as % required by problem Q5 in the rotational section. function [sys1, sys2] = rot_q5() % PRIOR KNOWNS: % Masses of Blocks [kg]: mb1 = 501.5e-3; mb2 = 501.0e-3; ...
%% [x, t, delta] = ReconTV(a, A, lambda, x0, Nit, Ninter, P) % % Performs Total Variation penalized reconstruction trying to solve the % linear system % Ax = a, % with A a Hermitian symmetric and positive-definite matrix. % % Optionally, an image reprensenting a diagonal matrix P can be used for ...
function Integral = TrapezoidalRuleQCS(Dx,Phi) % % TrapezoidalRuleQCS: Quick trapezoidal rule for constant spacing % % Performs trapezoidal rule integration with no input checking (quick). % Dx must be a scalar value (or a dimension mismtach may arise). Phi is % expected to be a column vector of two or more elem...
function mip2(filename) % Copyright 2019, Gurobi Optimization, LLC % % This example reads a MIP model from a file, solves it and prints % the objective values from all feasible solutions generated while % solving the MIP. Then it creates the associated fixed model and % solves that model. % Read model fprintf('Readin...
%世任:期末考不會比作業簡單 clear;clc for i=[2 3;12 13] %將變數i依序設定成矩陣裡的每一個直行,然後執行敘述主體 i %size(i)是2*1 fprintf('i=%d \n',i) end size(i)
function success = uq_test_perturbation(level) % PASS = UQ_TEST_PERTURBATION(LEVEL): non-regression test for perturbation % method on the toy function: x1 + x2 + 0.1*x3 + 0.1*x4 % % See also: UQ_PERTURBATION_METHOD,UQ_SENSITIVITY success = 0; %% Start the framework: uqlab('-nosplash'); if nargin < 1 level = '...
function [ Clock_Cycles,Energy,Num_of_memristors ] = organize_result_matrix_penalty(dim1,dim2,dim3,Ron_energy,NOR_energy,Num_of_bits,num_of_matrices ) %bug? revise vector_size=Num_of_bits+round(log2(dim2)); %log(num+num+....)= log(dim2*num)=Num_of_bits+log(dim2) Clock_Cycles=vector_size*dim3+dim1*dim3*num_of_matrices+...
format long dydt=@(t,y) t-y; t0=0; y0=2; h=[0.4; 0.1; 0.01]; tn=0.4; yn_exact=1.41096; n=size(h,1); fprintf('Método de Runge-Kutta 2 ordem\n'); for i= 1:n % testa para todo valor de h [yn]=RK2aordem(dydt,t0,y0,h(i),tn); % calcula o valor fprintf('Com h = %.2f\nO valor de y(%.2f) é %.5f.\n',h(i),tn,yn); fp...
function archs = SCAN_assert_random_archs(NRANDOM) global params levels = cellfun(@length,params.options,'UniformOutput',false); values = cellfun(@(x)randi(x,NRANDOM,1),levels,'UniformOutput',false); archs = cell2mat(values); for i = 1:NRANDOM SCAN_assert_arch(archs(i,:),[]); end end
function dpnOptImg(~,~,fig) %dpnOptImg - upload an optical image or use one of the ion images... % Gather the guidata dpn = guidata(fig.fig); if isempty(dpn) return; end % Ask the user... switch dpn.mode case 'dual' choice = questdlg('Chose an optical image...',... 'Optical Image',... ...
function [x, cost, info, options] = arc(problem, x, options) % Adaptive regularization by cubics (ARC) minimization algorithm for Manopt % % function [x, cost, info, options] = arc(problem) % function [x, cost, info, options] = arc(problem, x0) % function [x, cost, info, options] = arc(problem, x0, options) % function ...
% Input: % distro a row vector. It is generated by a Dirichlet Process. % n a scalar. The size of the data set. % Output: % data a row vector of length n. function data = data_generate(distro, n) if nargin < 1 distro = gem(100, 5); end if nargin < 2 n = 500; end r = rand(1, n); d =...
function varargout = hitungLVBalok(varargin) % HITUNGLVBALOK MATLAB code for hitungLVBalok.fig % HITUNGLVBALOK, by itself, creates a new HITUNGLVBALOK or raises the existing % singleton*. % % H = HITUNGLVBALOK returns the handle to a new HITUNGLVBALOK or the handle to % the existing singleton*. % % ...
function [carved, mask, seams] = carveHorizSeamsMask(img, n, mask) carved = img; seams = zeros(n,size(img,2)); for seam=1:n disp(seam); horiz = accMinHorizPathMapMask(carved, mask); h = findHorizSeam(horiz); carved = horizSeamCarve(carved, h); mask = horizSeam...
x = linspace(0,1); y = exp(-x); plot(y);
function pt1 = Cal_pt1(vj_users) %in function pt1 ra mohasebe mikonad len=size(vj_users,2); wji=0; rr=CreateRandom(); WSum=0; for i=1:len wji=CreateRandom(); WSum=WSum+wji; end pt1=(WSum/len)+rr; end
clc;clear all;close all; weight=rand(50,1)*3; lenght1=rand(50,1)*6; rabbit=[weight lenght1]; weight=rand(50,1)*4+1.5; lenght1=rand(50,1)*5+2; dog=[weight lenght1]; % All the training data dfeat=[rabbit;dog]; dclass(1:50)=-1; dclass(51:100)=1; figure, subplot(2,2,1), hold on; axis equal; plot(rabbit(:,1),rabbit(:,2)...
function s = createStruct(names,values) % usually to create a struct you have to interleave the names and values like % struct('name1',val1,'name2',val2,...) - here you can pass in the names and % values as two cell arrays. If values is not specified, it just assigns {}. s = struct; if(nargin < 2) ...
function ReadXL_bond(FileName, Sheet1, Range1, Sheet2, Range2, formatData, reference, floatFrequency) % Read the bond data from the file Excel and filter them, compute the dates % in which payments occur. Store all the results in 'bond.mat', which % contains all data about bond in the struct 'bond' and 'payments....
% trova il k-albero di costo minimo function ret = k_albero(A, k, archi_SI) % trova i due nodi piu` vicini a k, estraendone gli archi % eventualmente prima da archi_SI arco1 = trova_vicino(archi_SI,k); if arco1(1) == Inf arco1 = trova_vicino(A,k); end A = elimina_arc(A, arco1); ...
%P(k) f = @(n,k,p) nchoosek(n,k)*p^k*(1-p)^(n-k); %possibility array qA = 0:0.01:1; E = []; for q = qA e1=0; e2=0; for a = 0:arg.n-1 e1 = e1+f(arg.n-1,a,q).*Eci(a+1,1); e2 = e2+f(arg.n-1,a,q).*Eci(a+2,2); end E = [E;e1,e2]; end
function [Resultado]=corelacion(b,a) Numprocesos=length (a); Resultado=zeros(1,((Numprocesos*2)-1)); for contadoringreso=1:((Numprocesos*2)-1) for contadordeoperaciones=1:Numprocesos Resultado(1,contadoringreso)=Resultado(1,contadoringreso)+b(1,Numprocesos+1-contadordeoperaciones)*a(1,contador...
% readParameters is a script that reads the parameters defined below from % 'parameters.ini' in the current path and stores them in the workspace % % Copyright (c) 2012 by Andreas Keil, Stanford University. % define parameters parameterDefs = { ... 'Spectra', '', 'spectrumKeV', ...
function f = gaussfunc( p, x ) % parameters p (mx3) vector mu,sigma,A % x is nx1 vector % f is nx1 vector %f = ((p(1)/((4*pi*p(2)).^1.5))*exp(-((x-p(3)).^2)/(4*p(2)))); sigma=p(:,2); amplitude = p(:,3)./(sigma * sqrt(2*pi)); gaussval = arrayfun(@(A,c,s)A*exp(-0.5*((x-c)/s).^2),amplitude,p(:,1),sigma,'UniformOutput',fa...
function [hp] = CreateHealthProfile(nombre, apellido, genero, fecha_nacimiento, altura, peso) % HEALTHPROFILE. Crea una estructura para representar el perfil de % salud. % Params: % nombre (String). El nombre de la persona % apellido (String). El apellido de la persona % ...
function [PI, PS] = ZSpecWater2(obj, freq_offsets, w1, sat_time, pH, pK_donor, concentration, pK_acceptor) % w1 = [w1x, w1y] in rad/s concentration_ = obj.HendersonHasselbach(pK_donor, pH, concentration); % exchange rate [krate] = obj.rateReactionInWater2(pK_donor, pK_acceptor, pH); [PI, PS] = obj.NumericalSolution(...
function createORG_AbinitCode(inputFile) % USPEX Version 9.3.0 % new tags: dimension/varcomp/molecule % deleted tags: supercomputer name global ORG_STRUC getPy=[ORG_STRUC.USPEXPath,'/FunctionFolder/getInput.py']; %[nothing, abinitioCode] = unix(['./getFromTo abinitioCode ENDabinit ' inputFile]); %ORG_STRUC.abinitioC...