text
stringlengths
8
6.12M
function f = plot_sim(cfg,params_chain,energy_chain,sim_handle,step,true_param,t,lg) %% f = figure; ub = find(energy_chain(1,:)==0,1)-1; % find end point of energy chain if isempty(ub) ub = cfg.nswaps; end if step == 0 step = 1000; end for i = cfg.adapt_last:step:ub i...
function [result] = ZDT42(x) %ZDT42 gx = g(x); result = gx*(1-sqrt(x(1)/gx)); end function result = g(x) N = length(x); result = 1+10*(N-1)+sum(x(2:N).^2 - 10*cos(4*pi*x(2:N))); end
function [speedup dsize ksize] = testcudaconv() %TESTCUDACONV Benchmarks GPU vs CPU convolution. % [SPEEDUP DSIZE KSIZE] = TESTCUDACONV() runs 2-D % convolutions on random data using both CONV2 and CUDACONV. % % SPEEDUP contains the relative speed of CONV2 and CUDACONV. % Thus if SPEEDUP(i,j) = 10, CUDACONV co...
%ejercicio 1 RLC parte simbolica clc;clear all; syms R L C i vc vin ip vcp ip =(1/L)*vin-(1/L)*vc-(R/L)*i vcp = 1/C * i A = [[diff(ip,i) diff(ip,vc)] [diff(vcp,i) 0 ]]; B = [[diff(vcp,i)] [0]]; pretty(simplify(A)) pretty(simplify(B)) %% ejercicio 1 RLC simulaciones clc;clear all; %nota para el At en...
maxPrimes = [0,0,0]; for a = -999:999 for b = -1000:1000 n = 0; while n^2+a*n+b >= 0 && isprime(n^2+a*n+b) n = n+1; if n > maxPrimes(1) maxPrimes(1:3) = [n,a,b]; end end end end disp(maxPrimes(2)*maxPrimes(3))
% Cluster Fix algorithm for Ephiz Recordings % Seth König, January, 2015 % Runs the same as previous versions of Cluster Fix, but sets eye data % points outside of desired boundaries (i.e. outside of the image) to NaNs. % Code here is generically organized since everyone may have slightly % different ways of organizin...
% Quadratic equation function % determines coefficients of ax^2 + bx + c % input x,y arrays % by: Dr. Sherif Omran % % function [a,b,c]=Quadratic(x,y) p1=x(2)-x(3); p2=x(3)-x(1); p3=x(1)-x(2); p4=x(3)^2-x(2)^2; p5=x(1)^2-x(3)^2; p6=x(2)^2-x(1)^2; p7=x(2)^2*x(3)-x(2)*x(3)^2; p8=x(1)*x(3)^2-x(1)^2*x(3)...
% There is a frame with tao_max time slots % Packet arrives on the first time slot in a frame with some probability % No packet arrives in the middle of the frame % Whatever packet arrives at the beginning of the frame, has to be scheduled % by the end of the frame clc; clear all; close all; T= 10^5; % lam...
% verifyGrid validate Signal grid and check direction/uniformity % % This method verifies that the Grid array increases or decreases % monotonically. Increasing grids are labelled with a GridDirection of % "normal", while decreasing grids are labelled as "reverse". The average % grid spacing is also determined; if th...
%script v0600 while 1 if (x(k)==si)|(v==1) break end xk1=x(k)+1; yk1=y(k); if I(xk1,yk1) break end xk2=xk1;yk2=yk1+1; tr=1; if yk1<sj tr=(I(xk2,yk2)>0); end if tr per=per+1+I(xk1,yk1-1); pr=pr+1; if xk1==si per=per+1; else per=per+I(xk1+1,...
function H=H_Ja(x) [num,~] = size(x); UN = x(4-3,:); UE = x(5-3,:); UD = x(6-3,:); phi = x(7-3,:); theta = x(8-3,:); psi = x(9-3,:); if num == 15 || num == 12 la_x = x(10-3,:); la_y = x(11-3,:); la_z = x(12-3,:); la_p = x(13-3,:); la_q = x(14-3,:); la_r = x(15-3,:); % uwind = x(13,:);vwind ...
% y :: [D_A, D_R, Dp_A, Dp_R, M_A, M_R, A, R, C] % dy :: dy/dt function dy = CO_ODE(t, y, p) dy = zeros(9, 1); dy(1) = p.theta_A * y(3) - p.gamma_A * y(1) * y(7); dy(2) = p.theta_R * y(4) - p.gamma_R * y(2) * y(7); dy(3) = p.gamma_A * y(1) * y(7) - p.theta_A * y(3); dy(4) = p.gamma_R * y(2) *...
function patchCorrCov = fdr(patchCorrCov,p,alpha) %alpha=0.01; %this is the FDR level m=size(patchCorrCov,1)*size(patchCorrCov,2)*size(patchCorrCov,3); c=sum(1./(1:m)); pCurrent = p(:,:,:); patchCorrCovCurrent = patchCorrCov(:,:,:); [pCurrentSorted,pCurrentSortIds] = sort(pCurrent(:)); tmp=c*m*pCurrentSorted...
clear; clc ktype = 'laplace'; p = 5; ell = 1; sigma = 1; T = rand(1)*2 - 1; tt = 1500; T = [-1:2/tt:1]'; tt = length(T); n = 15; avg = @(x) zeros(size(x)); avg = @(x) x.^2; switch ktype case 'gaussian' d = repmat(T .^ 2, 1, tt); D = d + d' - 2*(T*T'); kappa = exp(-D/sigma) / ell; ...
%{ Runge-Kutta-Felhberg Method 10/9/1017 Jake Tully This Script is an example of the Runge-Kutta-Felhberg Method & Runge-Kutta 4th Order %} clear clc close all %///////////////////////////////////////////////////////////////////////// % Runge-Kutta- 4th-Order f1 = @(y) 1 +y^2; % function 1 f2 ...
% This is the disease model for Project 3 in MAT 306 Mathematical Modeling % This program generates graphs detailing the results of viral outbreaks % in institutions. Graphs are generated for different simulations % The program is currently optimized for swine flu, but can be easily % re-written. Note that thi...
function y = simpson(f,a,b,n) %SIMPSON Simpson's rule integration with equally spaced points % % y=SIMPSON(f,a,b,n) returns the Simpson's rule approximation to % the integral of f(x) over the interval [a,b] using n+1 equally % spaced points. The input variable f is a string containing the % name of a functio...
function [trainset, member_dict] = number_data(dataset_cell) trainset = zeros(size(dataset_cell)); member_id = 1; member_map = containers.Map(); unique_members = unique(dataset_cell(:,1)); for k = 1:length(unique_members) member_map(unique_members{k}) = member_id; member_dict{k,1} = unique_members{k}; memb...
% MODI - Projekt 2 - Zadanie 36 % Autor: Jakub Sikora % Skrypt wykonuje zadanie 2, podpunkt d, wyrazy mieszane % Przed rozpoczęciem należy uruchomić skrypt zad_d.m err_ucz_arx = zeros(2,1); err_ucz_oe = zeros(2,1); err_wer_arx = zeros(2,1); err_wer_oe = zeros(2,1); P = 2000; na = 2; nb = 2; deg = 2; for na=2:7 nb...
function varargout = plot_directed_edges(V,E,varargin) % PLOT_DIRECTED_EDGES Plot direct edges using quiver % % p = plot_directed_edges(V,E) % p = plot_directed_edges(V,E,LINESPEC,...) % % Inputs: % V #V by dim list of edge vertiecs % E #E by 2 list of edges % Outputs: % p plot handle % ...
function [Theta0,Re0] = lme_mass_fit_EMinit(X,Zcols,Y,ni,maskvtx,nit,prs) % [Theta0,Re0] = lme_mass_fit_EMinit(X,Zcols,Y,ni,maskvtx,nit,prs) % % Starting values at each location for the linear mixed-effects iterative % estimation. These starting values are based on the ordinary least squares % estimators plus some fa...
function trajectoryGlobal=ConvertTrajectoryToGlobal( trajectory, ... theta0, x0, v0, a0, jj0) time = trajectory.time; x = trajectory.x; v = trajectory.v; a = trajectory.a; jj = trajectory.jj; kappa = trajectory.kappa; tr=[cos(theta0) -sin(theta0); sin(theta0) cos(t...
function [flame,vox] = displaysinglecore(core,normm,norms,dens,max,unifo) flame.cores{1} = core; flame.normm{1} = normm; flame.norms{1} = norms; flame.scale{1} = dens; flame.maxim{1} = max; flame.unifo{1} = unifo; vox = displaysingleflame(flame); end
function [Im Io Ix Iy] = myEdgeFilter(img, sigma) hsize = [3 3]; if(ischar(img)) img = imread(img); end if(size(img,3)==3) img = rgb2gray(img); end image = im2double(img); %image = im2double(imread(img)); gx=[-1 0 1;-2 0 2;-1 0 1]; gy=[1 2 1;0 0 0;-1 -2 -1]; h = fspecial('gaussian', hsize, sigma); smoothImag...
function size_sp = ChooseSubplotSize(prn_all) % created in 11/24/2019 by LIU switch length(prn_all) case num2cell(1,2) size_sp = [1,length(prn_all)]; case num2cell(3,4) size_sp = [2,2]; case num2cell([5,6]) size_sp = [2,3]; case num2cell([...
global G path T p G = [ 0 300 360 210 590 475 500 690 300 0 380 270 230 285 200 390 360 380 0 510 230 765 580 770 210 270 510 0 470 265 450 640 590 230 230 470 0 515 260 450 475 285 765 265 515 0 460 650 500 200 580 450 260 460 0 190 690 390 760 640 450 650 190 0 ]/(100/3); % 邻接矩阵(行走...
function [ mapPoints ] = TPSMapping( points, TPSCoe, keyPoints ) %UNTITLED10 Summary of this function goes here % Detailed explanation goes here numPoints = size(points, 1); numKeyPoints = size(keyPoints, 1); tempPoints = reshape(points, [], 1, 2); tempPoints = repmat(tempPoints, 1, numKeyPoints, 1); tempKeyPoints =...
function R = Compute_R(I_MAX,J_MAX,D,FGS) R = zeros(I_MAX-1,J_MAX-1,4); for ii = 1:I_MAX-1 for jj=1:J_MAX-1 R(ii,jj,1) = sum(FGS(ii,jj,:,1))-D(ii,jj,1); R(ii,jj,2) = sum(FGS(ii,jj,:,2))-D(ii,jj,2); R(ii,jj,3) = sum(FGS(ii,jj,:,3))-D(ii,jj,3); R(ii,jj,...
function [ curr_ind ] = getindices(xValues, yValues, curr_loc) %UNTITLED8 Summary of this function goes here % Detailed explanation goes here % % curr_ind = [0 0]; % curr_loc = round(curr_loc, 3); % for i=1:size(grids,1) % for j=1:size(grids,2) % if abs(grids{i,j}.xLoc - curr_loc(1)) <= 0.05 && abs(grid...
close all; clearvars; clc; board = imread('plansza.bmp'); filter3 = fspecial('average', 3); convulsed = uint8(conv2(board, filter3, 'same')); figure(1); subplot(1,3,1); imshow(board); title('Obraz originalny'); subplot(1,3,2); imshow(convulsed); title('Obraz skonwolutowany'); subplot(1,3,3); absdiff = imabsdiff(boa...
clc; clear all; inputObj = VideoReader('../SAM_0562.MP4'); nFrames = inputObj.NumberOfFrames; T = 255; t = 10; fr = rgb2gray(read(inputObj,1)); [sy,sx] = size(fr); MHI = cell(1,nFrames); MHI{1} = fr.* 0; for i=2:(nFrames-1) I = rgb2gray(read(inputObj,i)); Ib = im2bw(I); for y = 1:sy for x = 1:sx ...
% Load signature for simulation scenarios % Enter 1 for Reflectance signature; 2 for Radiance signature % ImageCub1 for Scenario 1 % ImageCub2 for Scenario 2 % ImageCub3 for Scenario 3 % ImageCub4 for Scenario 4 % ImageCub5 for Scenario 5 % ImageCub6 for Scenario 6 function [TI1, TI2, TI3, TE1, TE2, TE3, M, GTm...
% File: Example2_13.m for Example 2-13 % Plot a Fourier series for square wave. % This file demonstrates the Fourier Series representation of a % 50% duty cycle square wave. That is To=2T. clear; % Time is evaluated (i.e. the waveform is plotted) over the time % interval [0,10] in increments of t_inc. % If you w...
function test_distance_point_to_line epsilon=0.1; % Point on line d = distance_point_to_line([2.1,2], [0,0], [1,1]); assert(almostequal(d,0,epsilon), ... 'Point on radial line is giving non-zero distance'); d = distance_point_to_line([2,-1.1], [0,1], [1,0]); assert(almostequal(d,0,epsil...
%% CLASS HEADER INFORMATION %By: QuocBao Vu %Created: Dec. 17, 2012 %Updated: Dec. 17, 2012 %Version: 3 % %This is the controller class for the DicomViewer. It handles all the %actions done by the user to the control and updates the model and view %depending on the button that was pressed. %% CLASS DEFINITION classdef...
function Doublefoci3D_wMASK(IM,Impath,Imfile,Imregion,Imf,analysis,thresh,MaskCrop,rect,rot,Zstack) Imreg = [Imregion,'_TempSubimage']; MaskCrop = uint8(MaskCrop); [Iheight,Iwidth] = size(MaskCrop); SizeofMask = size(find(MaskCrop>0),1)*64; ROIinUM = SizeofMask*0.0529; xstep = 1000; ystep = 1000; xrange =...
function [At] = Transp(A) %Transp determine transposition at A matrix A_size = size(A); At = zeros(A_size(2),A_size(1)); for i=1:A_size(1) At(:,i) = A(i,:); end for j=1:A_size(2) At(j,:) = A(:,j); end end
%% djicf-trajectories.m clear all; format long; close all; % close opened figures % Axes alw = 1.0; % AxesLineWidth set(0,'DefaultAxesFontSize',18); set(0,'DefaultAxesLineWidth',alw); set(0,'DefaultAxesFontUnits','points'); set(0,'DefaultAxesGridLineStyle',':'); set(0,'Defaul...
function y = sigm(x) y = sigmf(x, [1 0]); end
load('Parameters/sub1/ParWBa') plot(P(:,1),'o') hold on; plot(P(:,2),'o') hold on; plot(P(:,3),'o') legend('bk0','b100','b200') b= [0;100;200]; plot(b,P(1,:))
% Remove NN diretory paths if they still exist CleanUp2D; close all clear all clc model = 'Advection'; AdvectionVelocity = [1,1]; % Used for linear advection only test_name = 'Smooth'; InitialCond = @IC; BC_cond = {100001,'P'; 100002,'P'; 100003,'P'; 100004,'P'}; FinalTime ...
%% SET UP %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Clear the workspace and the command window clear; clc; ClockRandSeed; % All of the scripts utilized herein are added to MATLAB path cur_dir = pwd; addpath(genpath([pwd '/CodeLibrary_ET'])); % Color wheel load load('colorwheel360.mat', '...
function [A] = UDistMatrix(m, n) A = (rand(m, n) - 0.5) * 8 * sqrt(6 / (m + n)); end
function SpecDomainData= calculate_2D_fouriertrafo(PC_TimeDomainData,tau_vector,T_vector,t_vector) SpecDomainData=zeros(length(tau_vector),length(T_vector),length(t_vector)); for ii=1:length(T_vector) SpecDomainData(:,ii,:) = fftshift(fft2(squeeze(PC_TimeDomainData(:,ii,:)),length(tau_vector),length(t_vector))); end
% to find a parabolic curve clear all; clc; close all; x = [1.5 3 4.5 6 8 10.5]; y = [9 28 50 90 140 250]; n = length(x); for i=1:length(x) plot(x(i),y(i),'o'); hold on end sx = sum(x); sx2 = sum(x.^2); sx3 = sum(x.^3); sx4 = sum(x.^4); sy = sum(y); sxy = sum(x.*y); sx2y = sum(x.^2.*y); A = [n...
function f = iFGG_1d_type2(F,knots,accuracy) %Description: %This code implements the "accelerated" Gaussian-gridding-based NUFFT %described in Greengard and Lee [1]. The gridding approach is very similar %to previous work by Nguyen and Liu [2]; the only difference is the use of %a different convolution kernel ([1...
%简单main函数,用来测试基本的协同过程 tic nr_of_iterations=1000; %循环次数 SNR=[-13:2.5:12];%dB形式 use_direct_link=1;%直接传输 use_relay=1;%通过伙伴传输 global statistic; %statistic = generate_statistic_structure; global signal;%发送信号的全局变量 signal=generate_signal_structure;%发送信号结构体,包括传输比特数、传输字符数、每个字符包含的比特数、信号的调制方式、发送信号的比特序列、 ...
function [FinalFit,PeakLocations,PeakWidths,Amplitude]=FitNPeaks(x,y,locationGuess,widthGuess) %location here is the index, but it returns the actual location location=locationGuess(:); width=widthGuess(:); [location, SortIndex] = sort(location); width=width(SortIndex); FinalFit=x*0; PeakLocations=[]; PeakWid...
function A = tridiag(l,d,u,n) A = l*diag(ones(1,n-1),-1) + d*diag(ones(1,n)) + u*diag(ones(1,n-1),1); end
%% script start close all; clear; addpath('functions'); addpath('controls'); addpath('plants'); data.A1 = 505; data.a1 = 22; data.a2 = 16; data.C2 = 0.65; data.Fd = 13; data.F10 = 80; data.h20 = 33.7852; n = 5; rng = 0.5; [A_TS_U, B_TS_U, X0_TS_U, U0_TS_U, range_TS_U] = linAB_TS_U(data, n, rng); [A_TS_X, B_TS_X, X0...
function [v_i,v_f] = lambert_problem(r_i,r_f,delta_t) % P_i and P_f are identified by r_i and r_f % This script computes the time of fligth between P_i and P_f; norm_r_i = norm(r_i); norm_r_f = norm(r_f); delta_theta = asin(dot(r_i,r_f)/(norm_r_i*norm_r_f)); c = sqrt(norm_r_i^2 + norm_r_f^2 - 2*norm_r_i*norm_r_f*cos(...
function [optTheta, cost, exitflag, output, state] = minFuncGrad( fhandle, theta, options, lastState ) %MINFUNCRMSPROP Summary of this function goes here % fhandle is a function with two arguments: 1. theta, 2. patches learnRate = options.learnrate; if nargin<4 || isempty(lastSta...
function [x, y_evals, stopflag, varargout] = opt_xacmes(FUN, DIM, ftarget, maxfunevals, id, varargin) % minimizes FUN in DIM dimensions by multistarts of fminsearch. % ftarget and maxfunevals are additional external termination conditions, % where at most 2 * maxfunevals function evaluations are conducted. % fminsearch...
function rr = deg2rad(dd) % % replacement for matlab deg2rad rr = pi * dd / 180;
function [errelFitDLS,errelFitNN,errabsFitDLS,errabsFitNN]=estimateErrFitDLSVsNN(d,dFitDLS,dFitNN,typeG,dispMode) %------------------------------------------------------------------------------- % Version 20171223, Silviu Rei % function % The function % Input: % Output: % Example: % %-------------------------------...
% INPUT:1.Qt%the flow rate in the tubing sections l/min %2.Nt the number of the tubing section, Nt should always = length(L) % OUTPUT: Ut the average velocity in each tubing section(m/s) function Ut=Ut_c(Qt,area_aver,Nt) for i=1:Nt Ut(i)=Qt(i)*0.001/60/area_aver(i);%average velocity in each tubing secti...
function [efn]=efficency(act,meas) efn = abs(meas - act)./abs(act).*100; end
function [P,F] = eliteStrategy(newpop,newfitvalue,pop, fitvalue) % 精英策略,两规模为N的种群合并,筛选出规模为N精英种群 N = size(pop,1); total_pop = [ newpop; pop]; total_fitvalue = [ newfitvalue; fitvalue]; X = total_fitvalue; X = sort(X); threshold = X(N); P = total_pop(total_fitvalue>=threshol...
function [Costs] = targetViolationCostFcn(Outputs, States, Controls, Parameters) %#codegen % cost function interface created by falcon.m % Extract outputs % FDAD_x = outputs(1); % FDAD_y = outputs(2); % FDAD_z = outputs(3); % Extract states % x = states(1); % ...
function [VV,TT,FF,TN,IFF] = cdt(varargin) % CDT compute the constrained delaunay triangulation of a given mesh using % tetgen. % % [VV,TT,FF,TN,IFF] = cdt(V,F,'ParameterName',ParameterValue, ...) % % Inputs: % V #V by dim list of mesh positions % F #F by dim list of face indices % Optional: ...
clearvars; close all; clc; load funkcjeLUT.mat; figure(1); plot(kwadratowa); I = imread('lena.bmp'); figure(2); imshow(I); Ikw = intlut(I, kwadratowa); figure(3); imshow(Ikw); %% Pzy użyciu funkcji LUT(I,kwadratowa); LUT(I,log); LUT(I,odwlog); LUT(I,odwrotna); LUT(I,pierwiastkowa); LUT(I,pila); LUT(I,wykladnicza)...
function [out] = blp_produce_output(slices, BLP_WEIGHTS_TESS_THRESH, VOLUME) verbose = 1; n = slices; PATH = '../co_cluster_distrib/Comparisons/'; % relative path to directory with BLP scripts addpath(PATH); load(sprintf('blp_weights_tessthresh_%d_VOLUME_%d', BLP_WEIGHTS_TESS_THRESH, VOLUME)) if verbose fpri...
function vertex1 = compute_bending_invariant(vertex,faces,options) % compute_bending_invariant - compute bending invariants % % vertex1 = compute_bending_invariant(vertex,faces,options); % % Use out-of-sample interpolation to speed up the computation. % The number of landmarks used is set by options.nlandmarks. ...
clear; % instantiate the library disp('Loading the library...'); lib = lsl_loadlib(); % resolve a stream... disp('Resolving an EEG stream...'); result = {}; while isempty(result) result = lsl_resolve_byprop(lib,'type','EEG-ICA'); end vis_stream(); % create a new inlet disp('Opening an inlet...'); inlet = lsl_inlet...
function java_read_caxfile(cn,caxfile) global cs; cs.s(cn).readcaifile(caxfile); cs.s(cn).readcaxfile(caxfile); cs.s(cn).init; cs.s(cn).gettype; cs.s(cn).bigcalc; cs.s(cn).calcbtf; cs.s(cn).calc_u235; end
function [w] = kernel_linear(l,X,y) n = size(X,1); d = size(X,2); K = X*X'; cols_X = size(X,2); w = y'*pinv(K+l*eye(n))*(X); end
tic parfor i_file = 1:nFile data = datas{i_file}; n=length(data); i=1; m=floor(n/256); data=reshape(data(1:256*m)',[256,m]); data=data'; Count=binDecode(data,1,0,0); indexn=find(mod(Count,8)==1); if( indexn(1) >1 ) data=data(indexn(1):end,:); end [m,mm]=size(d...
% First Name: <Chengeng> % Last Name: <Xiao> % Stu. ID: <913186040> %% Part 1 x = linspace(-7,7,1000); % Use Linspace to create a vector x f = sin(10 .* x) .* x; % Set f(x) g = sin(10 .* x); % Set g(x) figure(1); % Initialize figure 1 plot(x, f, 'r', x, g, 'b'); % Draw f(x) in red & g(x) in blue axis([-7, 7, -...
function plot_tfcondition_blank(tfc) % % % % % % epochs = {'TF1','TF2','TF3','TF4'}; % Animal Median and Mad animal_med = [tfc.TF1.speed.blank_animal_median, ... tfc.TF2.speed.blank_animal_median, ... tfc.TF3.speed.blank_animal_median, ... tfc.TF4.speed.blank_animal_median]; animal_mad = [tfc.TF1.spee...
% written by NK,1406 % inspired by Greg Reeves, March 2009. % Division of Biology % Caltech % Inspired by "smooth2", written by Kelly Hilands, October 2004 % Applied Research Laboratory % Penn State University % Developed from code written by Olof Liungman, 1997 % Dept. of Oceanography, Earth Sciences Centre % ...
function [vector] = deHat(matrix) % map from a skew symmetry matrix to a vector vector = [matrix(3,2); matrix(1,3); matrix(2,1)]; end
% specify problem ul = 1; ur = -1; sigma = .1; if ~exist('S') SImport end % spacial discritization a = 0; b = 1; Nx = 200; deltaX = (b-a)/Nx; x = ((1:Nx)-(1/2))*deltaX; % set up exact solutions pExact = @(x, z, t) (x <= .5 + sigma*z*t)*(ul + sigma*z) + ... (x > .5 + sigma*z*t)*(ur + sigma*z); uExact = @(x, z,...
function [img,Pars] = swi47_recon(path_in,swi_ver) if ~ exist('path_in','var') || isempty(path_in) path_in = [pwd '/ge3d__01.fid']; end % if ~ exist('swi_ver','var') || isempty(swi_ver) % swi_ver = 'amir'; % end file=[path_in,'/fid']; parfil=[path_in,'/procpar']; Pars = Par_Read_Struct(parfil); % Generalize ...
file_path='.\train\';% 图像文件夹路径 img_path_list = dir(strcat(file_path,'*.jpg'));%获取该文件夹中所有jpg格式的图像 img_num = length(img_path_list);%获取图像总数量 imgTrain = []; Q = [];%列矩阵,一副图像 trainFace = [];%降维后的训练样本的矩阵 % 读取每一幅图像 %转化为灰度图像 并将每一幅图像转化为列向量 然后合并为矩阵T for j=1:img_num %逐一读取图像 image_name = img_path_list(j).name;%图像名 img = i...
function [ intIdxDelFeature ] = algBelsley(structParam, structData) % Find index the worst feature, the most collinear, through the Belsley algorithm % % Input: % structParam - struct of algorithms parameters with following parameters: % vecIdxFeatures - [1, k] - vector of indices selected features ...
% % from convolve_HRRs() in HRR.py % function [Xx, r_id] = convolve_HRRs(HRRs, ts, run_id, SPM) %nruns = length(SPM.nscan); nruns = double(max(run_id)); assert(nruns <= 6); Xx = []; r_id = []; for s = 1:nruns which = run_id == s; % from spm_get_ons.m % ...
% mex_build_mri % run matlab's "mex" command to "compile" the mri-related code % into mex files. % only users on unsupported systems, e.g., PCs, will need to do this dir_current = pwd; dir_mri = path_find_dir('mri'); cd(dir_mri) mex -g exp_xform_mex.c mex -g mri_exp_mult_mex.c cd(dir_current) cd('../mex/src'); irt_m...
function graph(cm) %% 绘图 %% 去除图中的权重为inf的边 for i=1:size(cm,1) for j=1:size(cm,2) if cm(i,j) == inf cm(i,j) = 0; end end end %% 设置图显示权重并可视化 bg=biograph(cm); bg.showWeights='on'; view(bg); end
clear all close all clc global path_img path_save format_img; % the tools used in algorithms are configured in the config_tool.m run('../config/config_tool'); % the parameter of algorithms is configured in config_para_do clear all run('../config/config_para_do'); global path_img path_save format_img; path_img =...
function results = mc_bbs_cs(featuremat,pheno,nuisance,folds,NumComp,varargin) n = size(featuremat,1); pcadone = 0; if (nargin > 5) Aa = varargin{1}; components = varargin{2}; pcadone = 1; end thresh = 1; if (nargin > 7) thresh = varargin{3}; end good = ~any(isnan(pheno),2) & ~any(isnan(nuisance),2...
[x,y] = orgFingerCoords(0.981309,-2*pi/3,0) plot(x,y) hold on scatter(x,y) grid on set(gca, 'XTick', [-100:2:100]) set(gca, 'YTick', [-100:2:100]) axis([-20 90 -4 40]) [x1,y1] = orgFingerCoords(0.4822,-1.15157,-2*pi/3) plot(x1,y1) scatter(x1,y1) % x = x % y = y % x1 = x1 % y1 = y1 man_dist = x-x1+y-y1
% book : Signals and Systems Laboratory with MATLAB % authors : Alex Palamides & Anastasia Veloni % Relationship between DFT and DTFT. % x[n] is random sequence x=randn(1,21); n=0:20; syms w Xdtft=sum(x.*exp(-j*w*n)); Xdft=fft(x); N=length(Xdft); k=0:N-1; wk=2*pi*k/N; ezplot(abs(Xdtft),[0 2*pi]);...
classdef Documentor < handle % DOCUMENTOR .m-bedded `doc`'s to .md text files % % Documentor (re)publishes embedded source code documentation to text files % (i.e. as [Markdown](https://daringfireball.net/projects/markdown/)). % % **Refer to the README for basic usage.** % % __CONSTRUCTOR SYNTAX__ % % Dr = Docu...
function T = SE3_exp(xi) %SE3_EXP generates the exponential map of SE(3) given a 6-vector in the twist coordinates. % % SYNOPSIS: T = SE3_exp(xi) % % INPUT xi is a 6-vector in the twist coordinates in the se(3) space. % % OUTPUT T is a 4x4 homogeneorus matrix for SE(3) rigid-body transformation. % % REMARKS % % created...
% Figure 3.30 Feedback Control of Dynamic Systems, 6e % Franklin, Powell, Emami % script to generate Fig. 3.30 % Pole-zero effects % t=0:.01:2.5; Den=conv([1 4],[1 6]); z=1; Num=4*6*[1/z 1]; [y1]=step(Num,Den,t); plot(t,y1); hold on; z=2; Num=4*6*[1/z 1]; [y2]=step(Num,Den...
load('iris2.data'); data = iris2(:,1:4); labels = iris2(:,5); epsilon=0.5; MinPts=10; IDX=DBSCAN(data,epsilon,MinPts); [~,RI] = RandIndex(IDX+1,labels); RI
function cost = PDFErrorAllParam( params ,OmigaCell, BoardCornerGap, BoardCornerXYNum,FrameIdUsed) weight =80; %32;% K1 = params(1); K2 = params(2); fx = params(3); fy = params(4); cx = params(5); cy = params(6); k1 = params(7); k2 = params(8); A = -1/K2; B = -K1/...
function MSE = calcMSE(Y1,Y2) Y1 = Y1(:); Y2 = Y2(:); %vectorize inputs MSE = mean((Y1-Y2).^2); end
classdef Students properties Height Weight end methods function r = BMI(obj) r = obj.Weight/(obj.Height/100)^2; end end end
function g = func14(c) % algebraic function for simple shooting example [tot,yot] = ode45(@func, [0 1], [0 c]); g = yot(end,1);
function [esDeEnergia,energia] = esFuncionDeEnergia(n,x) energia = sum(x.^2); if(energia>=0) esDeEnergia = true; else esDeEnergia = false; energia = 0; end end
% STAlagmite dating by Radiocarbon ; [star] version 02.02.2018 %The age model calculates accurate chronologies for stalagmites using 14C. %Suitable samples are characterized by: % i) the absence of long-term secular variability in DCF; % ii) long enough growth for measurable 14C decay to have taken place ...
clear; close all; init = [2e5,2e5,1e5]; b = 3e-8; b_scaled = b*1e8; f = figure; ax = axes('Parent',f,'position',[0.13 0.2 0.77 0.7]); start = plot_helper(init,b_scaled); P = plot3(start(:,1),start(:,2),start(:,3)); grid('on'); xlabel('Hunting cell population (N)','FontSize',15); ylabel('Tumor cell population (M)','F...
function aiMsg = String2Hex(~, achMsg) % Converts each char from a string into its hexadecimal ascii value aiMsg = ones(1, size(achMsg, 2)); for i = 1 : size(achMsg, 2) aiMsg(i) = uint8(achMsg(i)); end aiMsg = dec2hex(aiMsg); end
function labelThermalInds(thermalCam) disp('time to label those pixels! woo WOO') metaData.thermCalc = [.0051 -75.5]; thermalFrame = getsnapshot(thermalCam); sizeFrame = size(thermalFrame); temps_C = double((thermalFrame*metaData.thermCalc(1)) + metaData.thermCalc(2)); imagesc(t...
function [ R ] = check_symbols( varargin ) %CHECK_SYMBOLS Summary of this function goes here % Detailed explanation goes here %% process input arguments S=32; % number of bits per symbol switch nargin case 1, X=varargin{1}; case 2, X=varargin{1}; SD=varargin{2}; otherwise, ...
outputname = '../data/mrl/allSStrmrltok3.mat'; if ~exist(outputname, 'file') allSStrmrl = {}; path = '../data/mrl/train/pos/*.tod3'; names = dir(path); for i = 1:length(names) if isempty(strfind(names(i).name, '.tod3')) continue; end fid = fopen(['../data/mrl/train/pos/' names(i).name], 'r'); c...
function [rx, minFoM ] = dickson_optimizer_fsl (topology,opt) % dickson_optimizer_ssl(topology,mode,Io): Finds the optimal capacitor relative sizing fora a dkison % topology. The otpimtzation is done for a converter operatin in the FSL % % Based on Michael Seeman work %Input paramters: % + topology: dikson topo...
sal = input('Salário atual '); if (sal <= 280); porc = 0.2; novoSal = sal + sal*porc; else; if (sal <= 700); porc = 0.15; novoSal = sal + sal*porc; else; if (sal <= 1500); porc = 0.1; novoSal = sal + sal*porc; endif endif endif fprintf('O salário de R$ %.2f recebeu u...
function [uast, cK, logdet, Euuast] = ibpmultigpUpdateLatent(model, UpdateA) Kuu = blkdiag(model.Kuu{:}); if UpdateA == 1, model.P = 0; model.m2 = cell(model.nlf,1); for d = 1:model.nout, EZ2 = model.etadq(d,:)'*model.etadq(d,:) - diag(model.etadq(d,:).^2)... + diag(model.etadq(d,:)); ...