text
stringlengths
8
6.12M
function varargout = clipGraph(nodes, edges, varargin) %CLIPGRAPH Clip a graph with a rectangular area. % % [N2, E2] = clipGraph(N, E, BOX); % [N2, E2, F2] = clipGraph(N, E, F, BOX); % N is an array ov vertices, E an array of edges, containing indices of % first ans second vertices, and F (optional) is either a...
############################################################################################################# # Part of the Bayesian Spectrum Analysis (BSA) package in Octave, by Emma # Granqvist & Richard J. Morris, June 2011 # This code is only proof-of-principle, it is released freely and without any warranty # For ...
function [output1] = Jdq_AMBody_Pelvis(var1,var2) if coder.target('MATLAB') [output1] = Jdq_AMBody_Pelvis_mex(var1,var2); else coder.cinclude('Jdq_AMBody_Pelvis_src.h'); output1 = zeros(3, 20); coder.ceval('Jdq_AMBody_Pelvis_src' ... ,coder.wref(out...
function [xarr] = filter_freqbands (t,x,freq_band) xarr = zeros(length(t),size(freq_band,1)); for i = 1:size(freq_band,1) xarr(:,i) = qif(t,x,[0 freq_band(i,1); freq_band(i,2) Inf]); end end
function [F,X] = DFT_FFT(x,f_s) N = length(x); F = zeros(N, 1); X = fft(x); for k = 0:N-1 F(k+1)=(k/N)*f_s; end X = fftshift(X);
E = csvread('test_energies.csv'); V = csvread('test_variances.csv'); alpha = csvread('test_alpha.csv'); beta = csvread('test_beta.csv'); fig1 = surf(beta,alpha,log(V)); xlabel('beta') ylabel('alpha') zlabel('log(Variance)') fig2u3d
function [V,F] = equilateral_tiling(x); % EQUILATERAL_TILING Create a tiling of the unit hexagon using equilateral % triangles. % % Inputs: % x number of edges on each side of the hexgon (x=1 would produce 6 % triangles) % Outputs: % V #V by 2 list of vertex positions % F #F by 3 list of ...
function test_suite = testAssertExceptionThrown %testAssertExceptionThrown Unit tests for assertExceptionThrown % Steven L. Eddins % Copyright 2008 The MathWorks, Inc. initTestSuite; function test_happyCase assertExceptionThrown(... @() error('MyProd:MyFun:MyId', 'my message'), 'MyProd:MyFun:MyId')...
function [A,B,k,C,V]=ss2armax(As,Bs,Cs,Ds,R1,R2) % Usage [A,B,k,C,V]=ss2armax(As,Bs,Cs,Ds,R1,R2) % % Converts a state space description: % % x' = As*x + Bs*u + v v in N(0,R1) % y = Cs*x + e e in N(0,R2) % % into an ARMAX (external) form % % A(d)y = d^k*B(d)u + C(d)*err err in N(0,V) % Programmed 2...
function So=UTIL_rmsSpectAvg(Si) %media puntuale... TODO: fase???? So=zeros(size(Si,2),1); Sph=zeros(size(Si,2),1); for n=1:size(Si,1) So=abs(So)+(abs(Si(n,:)').^2); Sph=Sph+angle(Si(n,:)'); end So=sqrt(So).*exp(i*Sph); So=So./size(Si,1);
% Lu = 0 (2D) on a square domain [0,1]x[0,1] % neumann on south boundary % dirichlet on the other boundaries clear; clc; close all; rng(0); % used for reproducibility u = @(x,y) exp(x).*cos(y); phi = @(r,c) sqrt(r.^2+c^2); c = 1; % shape parameter a = 0; b = 1; nx = 25; h = 1 / (nx-1); xo = [a:h:b a:h:b rep...
function [U, V] = evaluate_velocity_on_surface(solution) %EVALUTATE_VELOCITY_ON_SURFACE evaluates the velocity at the quadrature %points on the surface of a domain. Adds on the jump corresponding to %approaching the boundary from the fluid part of the domain. % % inputs: % -solution: structure containing the following ...
clear all %% INITIALIZE TIME to=0; tf=120; inc=120; time = linspace(to,tf,inc); %% ODE KINETIC/TXN PARAMETERS % Obtained from Parameter Screen k1 = 166.8; % HSP-UP association k2 = 2.783; % HSP-Hsf1 disassociation k3 = k1; % HSP-Hsf1 association k4 = 0.0464; % HSP-Hsf1 disassociation k5 = 4.642e-7; ...
function restoration = shakeCorrection(v) % clear; % path = 'footage'; % prefix = 'footage_'; % first = 1; % last = 657; % digits = 3; % suffix = 'png'; % v = load_sequence(path, prefix, first, last, digits, suffix); [height,width,frame_num ] = size(v); v_d = double(v); % template reference_frame = v_d(:,:,1); templa...
function [y] = RRMSE(img1, img2) y = norm(abs(img1) - abs(img2), 'fro') / norm(abs(img1), 'fro'); end
function [X,freq]=centeredFFT(x,Fs) %this is a custom function that helps in plotting the two-sided spectrum %x is the signal that is to be transformed %Fs is the sampling rate N=length(x); %this part of the code generates that frequency axis if mod(N,2)==0 k=-N/2:N/2-1; % N even else k=-(N-1)/2:(N-1)/2; % N ...
load rk/feuler.mat; # Problem 8.1 load rk/beuler.mat; # Problem 8.1 load rk/cranknic.mat; # Problem 8.4 load rk/heun.mat; # Problem 8.7 load rk/rk3.mat; # Problem 8.12 fun = @(t,x) sin(t) + x; sol = @(t) (exp(t) - sin(t) - cos(t)) / 2; tab = rk3; for k = 1:10 t = linspace(0,1,2^k+1)'; x = s...
login = 'hydrosolution'; password = 'd8WmFgEGpZ'; cd('~/Dropbox/iMoMoPHASE1/model/iMoMoToolbox/dbase') javaclasspath('matlabSoapSecurity.jar'); secureSOAP = SecureSOAP(login, password); url = 'https://157.26.64.27/HydrosolutionWS_V2/HydrosolutionWS'; namespace= 'http://webservice/'; % values = secureSOAP.callHT...
function [H, dnH, dxH, dxxH, dxnH] = Hill_plus(theta,l,u) % function [H, dnH, dxH, dxxH, dxnH] = Hill_plus(theta,l,u) % % given l u and theta, returns the Hill function with appropriate parameter % as a function of theta, x and n, together with plenty of derivatives % % INPUT % theta,l,u positive floats % OU...
clear, close, clc files = ls('.\Data\tmp\*.csv'); min_date = datenum(2000,1,1); ignored = zeros(length(files),3); id = []; station = id; latitude = id; longitude = id; month = id; day = id; year = id; date = id; date_num = id; var = id; j = 1; for i = 1:length(files) file = fullfile('.','Data','tmp',char(...
function [xi,yi] = snakeinterp1(x,y,RES) % SNAKEINTERP1 Interpolate the snake to have equal distance RES % [xi,yi] = snakeinterp(x,y,RES) % % RES: resolution desired % update on snakeinterp after finding a bug % Chenyang Xu and Jerry L. Prince, 3/8/96, 6/17/97 % Copyright (c) 1996-97 b...
clc clear fprintf('\n'); %start menu because I'm a sucker for old games fprintf('\n**************************************************\n') fprintf('* *\n') fprintf('* Welcome to 4x4 Connect-4 *\n') fprintf('* ...
function rho56=rho56(h) sldata; limitpoints; slopes; rho2=rho1*(T2/T1)^-(1+(g/(m12*R))); rho3=rho2*exp(-g*(h3-h2)/(R*T2)); rho4=rho3*(T4/T3)^-(1+(g/(m34*R))); rho5=rho4*(T5/T4)^-(1+(g/(m45*R))); rho56=rho5*exp(-g*(h-h5)/(R*T5));
%% Reset matlab close all clear clc %% Initialize figure h = figure; h.Units = 'normalized'; h.Position = [0 0 1 1]; %% varRed = table; varRed.red = 10.^(0:0.01:5)'; varRed.green = 500*ones(size(varRed.red)); varRed.blue = 500*ones(size(varRed.red)); varRed.clear = zeros(size(varRed.red)); chromaticity = rgb2chro...
function p = feat_desc(I, y, x) %extract feature descriptor %let's get a 8x8 patch describing each corner %p is a 64xn matrix %first we start at each corner location and take a 40x 40 window window_size = 40; p_size = 8; sub = window_size/p_size; num_corner = length(y); p = zeros(p_size^2, num_corner); %gaussian kern...
function Rtilde = noisifyRotations(R, A, sigma) % NOISIFYROTATIONS Takes absolute rotations and computes noisy pairwise % % Other m-files required: none % Subfunctions: none % MAT-files required: none % % Author: Gabriel Moreira % email: gmoreira (at) isr.tecnico.ulisboa.pt % Website: https://www.g...
% This script executes the commands use to run the examples in Table ex = 'QPII'; certtags={'BSOS','SBSOS'}; % Second relaxation with k=1. k=1; d=2; %% % don't change anything below this line %load testfunction and generate pop % name of the function to be considered and placed in pwd/functions fname = 'QPII_9...
function[] = importGender()
clc;clear all;close all;echo off;tic; % ------------------------------------------------------------------- % 参数定义 % -------------------------------------------------------------- Fd = 1; % symbol rate (1Hz) Fs = 1*Fd; % number of sample per symbol M = 4; ...
function varargout=plotB0curlyh(varargin) %PLOTB0CURLYH Plot B and H % % USAGE: % >> atbaseplot(ring,@PLOTB0CURLYH); % >> atplot(ring,@PLOTB0CURLYH); (obsolete) % % See also atbaseplot if nargout == 1 % From atplot [lindata,ring,~]=deal(varargin{1:3}); spl=PhysConstant.speed_of_light_in_vacuum.value; ...
%% Cro el Robot: function arm = robo_init(pert) %Perturbacion if ~nargin pert=0; end % Links de revolucion 'd', 0 d=0; % Largos 1m l1 = 1; l2 = 1; % Masa 1kg m1 = 1 +(2*rand()-1)*pert; m2 = 1 +(2*rand()-1)*pert; % Centro de masa e...
function Sim21 %% Reset close all clear %% Load data load('GroupsWOAisles.mat'); %% Set names simName = '21 Groups without aisles, 20 min delay'; folderName = 'Sim21'; %% Set conditions [Sim.Luminaires.View] = deal('narrow'); [Sim.Zones.DimAfter] = deal(duration(0,20,0)); [Sim.Zones.OffAfter] = deal(duration(0,20,0...
function [e,f,totalcircle_num] = net_voltage (Yzheng,voltage) MAX_CIRCLE=20; accuracy=0.00000001; [Yzheng voltage] = PointTaxis(Yzheng, voltage); pqNum = PQNum(voltage); p=SimulationP(voltage); %p=Pg-Pl q=SimulationQ(voltage); u_2= Simu...
function [match_heap match_im_i match_im_j] = propagate_slow(initial_match, im_i, im_j, matchable_im_i, matchable_im_j ) %{ Please cite this paper if you use this code. J. Xiao, J. Chen, D.-Y. Yeung, and L. Quan Learning Two-view Stereo Matching Proceedings of the 10th European Conference on Computer Vision (ECCV2008)...
% this function plots a bar plot with error bars on it. function h = Pej_Bar_ErrorBar(x, xl, xu, Labels, varargin) L = length(x); h = bar(1:L, x, 'k', varargin{:}); hold on BV = get(h,'BaseValue'); for i =L:-1:1 if x(i)>BV errorbar(i, x(i), x(i)-xl(i) , xu(i)+nan, '.', 'linewidth', 1.5, 'color', 'w', 'Marker', '...
% Fig. 9.37 Feedback Control of Dynamic Systems, 5e % Franklin, Powell, Emami % % script to run the time optimal system % and plot the results sim('fig9_36') plot(tout,simout); title('Figure 9.37 limit cycle oscillations'); xlabel('Time (sec)'); ylabel('Output, y'); grid;
% volVectorField Ur(Ua - Ub); Ur = assign(Ua,Ub,'-'); % volScalarField magUr(mag(Ur)); magUr = assign(assign(Ur,Ur,'*'),constField(1/2,N),'^'); % % volScalarField Ka(draga->K(magUr)); % volScalarField K(Ka); K = dragmodel_K(magUr,InterfacialProperties,transportProperties); % % if (dragPhase == "b") % { % volScal...
function [all_vols]=get_all_vols(file) load(file); rois = sData{1,2}.scan.contour; for roiNum=1:numel(rois) %First iterate over all rois in order to determine the best common matrix size roiName=rois(roiNum); %Removing unused rois roiName=roiName.name; visPos = strfind(roiName,'1vis'); autoPos...
clear; load('Energy density of CDDF2 (Phi=0.2) calculated in 16-Sep-2014.mat'); n=4; m=4; if fai==0.5 e_single=[2.9022 1.5889 1.0671 0.8008]; else if fai==0.2 e_single=[4.6093 2.5240 1.6985 1.2746]; else e_single=[1.335 0.6267 0.4281 0.3228]; end end for i=1:5; e_opt_t=e_opt(i,:); deltaP...
%%Data analysis of Random network generation to test robustness of biological systems to %%constitutive signals %%Developed by Alvaro Martinez Guimera July 2019 %Specify time of model event (stimulus) EventTime=100; %Retrieve all files in current directory (where random network generation output should be saved to) ...
function [S,c,cindex,D,DX]=distortionMinimization(X,phi0,k,c_0,DspFlag,epsilon); % function [S,c,cindex,D,DX]=distortionMinimization(X,phi0,k,c_0,DspFlag,epsilon); % % Input: % X(n,d) --- diffusion coordinates (right eigenvecs % rescaled with eigenvals); each row is a data pt % phi0(n,1)...
function [iter_nums, beta] = iterate_beta(ret) iter_nums = 1:ret.nIterations; beta = ret.betaPred; end
clc; clear ; close all; %% Initialisation des variables image = imread('image/barcode_rotate2.jpg'); image = double(image(:,:,1)); ep = 0.2; N = 256; % Traitement de l'image % Recuperation des coordonnees de l'operateur ainsi que de l'angle de % rotation de l'image [xmin, xmax, ymin, ymax] = get_input(image); angle =...
function A = curve(x,fit) N = length(x); J = length(fit); phi = zeros(J,N); phi(1,:) = sin(x); phi(2,:) = cos(x); phi(3,:) = sin(3*x); phi(4,:) = ones(1,N); for j = 3:J/2 phi(2*j-1,:) = sin( (2*j-4)*x ); phi( 2*j ,:) = cos( (2*j-4)*x ); end A = zeros(1,N); for j = 1:J A = A + fit(j)*phi(j,:); end end
function [haxes] = xsubplots(int,T) % This function creates an amount of subplots dictated by the value of the % int input. Each subplot has x-axis limit of 0 to T, where T represents % the number of timesteps. The function returns a column vector, haxes, % which stores references to all of the subplots. This function ...
function s = path_to_tetgen() % PATH_TO_TETGEN Returns absolute, system-dependent path to tetgen executable % % Outputs: % s path to tetgen as string % % See also: tetgen if ispc % replace this with path s = 'c:/prg/lib/tetgen/Release/tetgen.exe'; elseif ismac || isunix [status,s] = sy...
%funcion que verifica el rango de una funcion para ver si es impar function b = esImpar(n,x) [n2,x2] = invertirY(n,x); [n2,x2] = invertirX(n2,x2); if(isequal(x,x2)) b = true; else b=false; end end
function config=configuration(fileName) %config.fileName = 'circuit-rc1.txt' ; %config.fileName = 'two_section_rc.txt'; %for ac-testign %config.fileName = 'amp_tran1.txt' ; %config.fileName = '741_amplifier.txt' ; config.fileName = fileName ; %config.fileName = 'diode.txt' ; %config.fileNam...
function [FitResults,LowestError,BestStart,xi,yi,BootResults]=Gaussfitbasepeakfit(signal,center,window,NumPeaks,peakshape,NumTrials,start,autozero,plots) %time = [1:31]; %h = plot(time,Vo4,'o','LieWidth',2); global AA xxx AUTOZERO format short g format compact warning off all NumArgOut=nargout; datasize=size(sign...
clc; close all; clear all; Parent1 = [round(rand()), round(rand()), round(rand()), round(rand()), round(rand()), round(rand()), round(rand()), round(rand()), round(rand()), round(rand()) ]; Parent2 = [round(rand()), round(rand()), round(rand()), round(rand()), round(rand()), round(rand()), round(rand()), round(rand())...
%% ECE549 HW2 % Question 2 Shape alignment close all clear all align_shape(imread('object2.png')>0,imread('object2t.png')>0); align_shape(imread('object2.png')>0,imread('object1.png')>0); align_shape(imread('object2.png')>0,imread('object3.png')>0);
clc; clear; close all; format long %parameters a = 1.1; b = 0.6; d = 0.07; f = 1.7; k = 1; m = 0.1; c = 0.25; %initialization h = 0.1; u(1) = 0.125; w(1) = 0.1; t = 0:h:20000; %time can be increased or reduced p = u(1); q = w(1); func1 = @(t,u,w) a*u*(1 - u/k)- b*u*w/(1+m*u); func2 = @(t,u,w) -d*w + f*u*w / (1 + m*u...
% Example 10.1 -- Figure 10.2 clf x1 = [1,1.5,2,3,4]; x2 = x1; c1 = [2,-1]; c2 = [-2,12,-7]/3; y1 = c1(1)*x1 + c1(2); y2 = c2(1)*x2 .* x2 + c2(2)*x2 + c2(3); xx1 = .3:.1:4.3; zz1 = c1(1)*xx1 + c1(2); xx2 = .3:.1:5.5; zz2 = c2(1)*xx2 .* xx2 + c2(2)*xx2 + c2(3); plot(x1,y1,'md',x2,y2,'ro',xx1,zz1,'b',xx2,zz2,'g') hold...
function pts=Find_Split_pts(cann_pts,list_ind,close_nonadj_pts,count_nonadj) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Find_Split_pts finds then splitting point pairs in a sub-candidate point % set % Params: % cann_pts is the candidate points % list_ind is the in...
clc clear all; close all; X=[0 0 1 1;0 1 0 1]; T=[0 1 1 0]; h=2; alfa=0.3; mf=0.2; [N,M]=size(X); [K,M1]=size(T); V=rand(h,N) V1=zeros(h,N); V0=rand(1,h) W=rand(K,h) W1=zeros(K,h); W0=rand(1,K) con=1; epoch=0; while (con~=0 && epoch~=10000) e=0; Yout=[]; for I=1:M for j=1:h Zin(j)=V0(j);...
% Expected risk minimization with 2 classes clear all, close all, % dimension of the vector under test n = 2; % number of iid samples for the data distribution N = 1000; mu(:,1) = [-2;0]; mu(:,2) = [2;0]; % Initialize and assume the variances to be identity matrices Sigma(:,:,1) = [1 -0.9;-0.9 2]; Sig...
X=csvread('Snapshot2Psx.csv') ; [m sigma2] = estiGaussian(X); % Training set p = multivarGaussian(X, m, sigma2); d=X=csvread('evilprofessorPsx1.csv') ; Xval=d(:,3); yval=d(:,4); % Cross-validation set pval = multivarGaussian(Xval, m, sigma2); [epsi F1] = selectThreshold(yval, pval); fprintf('Best epsilon v...
function d=deltaFun(i,j) if i==j d=1; else d=0; end
function Fortify(YesBtn,~, game, player) set(game.txtH, 'String', 'Select troops to send on the move') %% DELETE BUTTONS NoBtn = findobj('style', 'pushbutton', 'String', 'No'); delete([YesBtn, NoBtn]); %% TROOP BUFFER troops = uicontrol('style', 'text', ... 'Parent', game.figH, ... ...
function stats = optDynamic(returns, predictors, gamma, rf, accuracy) %OPTDYNAMIC: Calculate the optimal portfolio weight through the dynamic %strategy % % STATS = OPTDYNAMIC(returns, predictors, ...) uses both predictor % variables and returns to calculate the optimal portfolio. If possible, % the conditio...
%---------------------------PROBLEM 9--------------------------- figure(9); M = csvread('exampleSignal.csv',3); %Read the file plot(M) %Plot the signal itself. hold on %Wait for the peaks to enter. [pks,locs] = findpeaks(M); %pks are peaks, locations are locations of peaks. plot(locs,pks,'.r') %Add the peaks from findp...
%---------------- Simulation 2 experiment 2 %---------------- probability of detection vs radar snr load('tsp_radar_snr_comparison_v5.mat') M = 1e4; vu = 0:0.5:100; PD_co = zeros(length(SNR_rtr),length(vu)); PFA_co = zeros(length(SNR_rtr),length(vu)); PD_co_wc = zeros(length(SNR_rtr),length(vu)); PFA_co_wc = zeros(leng...
function [ v ] = probvelocidad(q, params) %definimos las coordenadas generalizadas x1=q(1); y1=q(2); x2=q(3); theta=q(4); %definimos las coordenadas que no varían con el tiempo xA=0; yA=0; %Llamamos a las funciones de las restricciones y el jacobiano pues nos %hacen falta para el cálculo de la velocidad J=jacob(q,par...
%-------------------------------------------------------------------------% % Isothermal flash calculation using Soave equation of state % Author: Arnulfo Rosales-Quintero % Email: arnol122@gmail.com % Main program calls function Flash_iso01 %This function solves the isothermal flash using two loops %The in...
RP = csvread('~/tmp/pyconcz2016-net-failures/naive_probe.csv'); RT = csvread('~/tmp/pyconcz2016-net-failures/naive_download.csv'); RJ = csvread('~/tmp/pyconcz2016-net-failures/naive_get_json.csv'); % MB total per each 0.1 sec interval AP = accumarray(floor(RP(:,1) * 10) + 1, RP(:,2)) / 10^6 / 100; AT = accumarray(flo...
function sthlm3_extractAnnotations(tissuemaskfile,penmaskfile,outputimagefile,varargin) % sthlm3_extractAnnotations - Extract annotated area and store label mask. % % sthlm3_extractAnnotations(tissuemaskfile,penmaskfile,outputimagefile, ...) % % Reads masks indicating tissue and pen markings and stores an image where %...
% function TrgFN=NormalizeWrite(FN,MatFN,Force,TrgP,DispW,DefiningSpaceFN) function TrgFN=NormalizeWrite(FN,MatFN,Force,TrgP,DispW,DefiningSpaceFN) if(~exist('Force','var')) Force=[]; end if(isempty(Force)) Force=false; end if(~exist('DispW','var')) DispW=[]; end if(isempty(Force)) DispW=true; end Tmp...
function indices = bipartitions2indices( Zs ) % % nRows_Zs = size(Zs, 1); indices = cell(nRows_Zs, 1); for i = 1:nRows_Zs indices{i} = find(Zs(i,:)); end end
function [ output_args ] = gbmapping(start_file, Bstart, delB, Bfinal) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here % Counters i = start_file; %File Counter counter = 0; %Loop Counter numfiles = abs((Bfinal - Bstart))./abs(delB)+1; %Number of Files B = Bstart; %Initial Magne...
Pos(1,:) = [10 10]; Goal = [270 270]; for i = 1:1000 dx = Goal(1) - Pos(i,1); dy = Goal(2) - Pos(i,2); adx = abs(dx); ady = abs(dy); if(adx>ady) newP = Pos(i) + (dx/adx)*[1 0]; elseif (adx<ady) newP = Pos(i) + (dy/ady)*[0 1]; else newP = Pos(i) + [(dx/adx) (dy/ady)...
function obj = cast_basic(obj, kind) % excentury.core.CAST_BASIC: Cast object to a basic datatype % % Transform the object to another basic object. % The allowed values for kind are: % % char, 'C1' ==> char % byte, 'I1' ==> int8 % ubyte, 'N1' ==> uint8 % short, 'I2' ==> int16 % ...
function clusters = pairwise_clustering(Z, varargin ) %PAIRWISE_CLUSTERING Summary of this function goes here % Detailed explanation goes here p = create_parser(); parse(p, varargin{:}); params = p.Results; cutoff = params.Cutoff; maxClust = params.MaxClust; mergeCriterion = params.MergeCriterion; if...
function [spectrum] = fct_spectrum(model,ft) % Compute the spectrum of a function % ft=abs(ft).^2; MX=model.grid.MX; dX=model.grid.dX; if any(size(ft)~=MX) error('wrong size'); end % [Mx,My]=size(ft); % MX=[Mx My]; % M=floor(sqrt(Mx*My)); M=min(MX/2); % M=min(MX/4); persistent idxref MXref dXref kidx if ~exist(...
function output = HistEqlize(histo, image) [row, col] = size(image); c = cumsum(histo)*255; output = uint8(zeros(row,col)); for i = 1 : col for j = 1 : row output(j,i) = c(image(j,i)+1); end end end
prompt=('Ingresa un número: '); x=input(prompt); if rem(x,2)==0 x=(x)^2 fprintf('El número es Par'); else x=(x)^3 fprintf('El número es Impar'); end
function wave = rotate(parameter, wave0) %* (x, y, z) --> (y, z, x) M = parameter.siteDimension ; A0 = wave0.A ; B0 = wave0.B ; A = rotateA(M, A0) ; B = rotateA(M, B0) ; wave.A = A ; wave.B = B ; wave.Lambda(1) = wave0.Lambda(2) ; wave.Lambda(2) = wave0.Lambda(3) ; wave.Lambda(3) = wave0.Lambda(1) ; w...
function RawImage = ReadL0Image(bandName, imageDir, lmin, lmax) % RawImage = ReadL0Image(bandName, imageDir, lmin, lmax) % This function read a raw image from L0 directory % The L0 filename is IMAGERY_[bandName].RAW % lmin is the first line of the block to be read % lmax is the last line of the block to be read % % War...
%Test wave generators for regular waves with random phase and random waves %sampled from a wave spectrum lineMarker = '-g'; % set(0,'DefaultAxesFontSize',16,'DefaultTextFontSize',10) global H chi H = 4.94; chi = 60*(pi/180); alpha0 = 0.73; omegaNPhi = 0.62; lambda = 221.94; omegaZ = 0.527; numSamples = 1000; numWaveC...
function response = Forgetful(n,p) persistent ncount trustcount roundstore if n==1; ncount=0; trustcount=0; roundstore=0; end if ncount==1 && (p==1 || p==5); trustcount=trustcount+1; end if n>5 if isequal( roundstore(end-3:end), [5 0 5 0] ); trustcount = 2; ncount = 5; end end if...
function []=rob_plot3(real_x,real_y,measurement_x,measurement_y,kalman_x,kalman_y) real_x=real_x(:,1); real_y=real_y(:,1); plot(real_x,real_y,'-','DisplayName','Real X,Y'); hold on; measurement_x=measurement_x(:,1); measurement_y=measurement_y(:,1); plot(measurement_x,measurement_y,'--','DisplayName','Measur...
function copy_unzip_func(fmriprep_dir, spm_dir) func_dir = fullfile(spm_dir, 'FUNCTIONAL'); if ~isdir(func_dir) mkdir(func_dir) end sub_dirs = cellstr(spm_select('FPList',fmriprep_dir, 'dir','sub-*')); % Copying all fmriprep functional files and mask files to a new directory and unzi...
%-------------------------------------------------------------------------- % Background theorique en fonction de nu_max d'apres Kallinger 2014. % % Pour l'instant, je ne mets pas le bruit blanc car pas tout a fait % photonique. % % Je ne mets pas non plus la composante super basse frequence: en gros je % ne mets que l...
#include "com_codename1_ui_table_TableLayout_Constraint.h" const struct clazz *base_interfaces_for_com_codename1_ui_table_TableLayout_Constraint[] = {}; struct clazz class__com_codename1_ui_table_TableLayout_Constraint = { DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_com_codename1_ui_table_...
function [ StreamlinesProximity2D, StreamlinesProximity3D, ... StreamlinesProximity2DNorm, StreamlinesProximity3DNorm, ... Proximity2DMin, Proximity2DMean, Proximity2DMax, Proximity2DStd, ... Proximity3DMin, Proximity3DMean, Proximity3DMax, Proximity3DStd] ... = computeStreamlines2D3DProximity( image3D,...
function anaT = analysis_table2(lfps, splittype) %% % generate a table to see how variables are related to one another % sessions x variables x stimulus type % if nargin < 2; splittype = 'drug'; end % single pair or more? =========================== ndrug = 1; switch splittype case 'drug' ndrug = 2; ...
initCobraToolbox % load('BesteGriffin.mat') %load('Beste7H9aa2.mat') % load('BesteMediaModels.mat', 'BesteRxns') %load('BesteMediaModels.mat', 'Beste7H9') %load('GriffinData.mat') %load('mtbPROMinputs2.mat', 'metRvFC2') %load('mtbPROMinputs2.mat', 'BIGtf_05_2013_Rv2621') %load('mtbPROMinputs2.mat', 'RvGeneIDs') %load('...
function [ LP ] = My_RLGC_fun( LG, US ) %Расчет параметров (R G L M C K) линии электропередачи: m0 = 4*pi*10^-4; % магнитная постоянная [Гн/км] ma = 1.000022; % относительная магнитная проницаемость Al e0 = 8.85*10^-9; % электрическая постоянная [Ф/км] % эквивалентный диа...
load fea; % load gnd; load idx; id = idx; test_idx = 1:size(fea, 1); data = fea; n = size(data, 2); X = data * (eye(n) - (1/n) * ones(n) * ones(n)'); size(X) % % g = size(gnd); % % i = size(idx); % % A = X' * X; % % A = (A + A')/2; % % % Step 2: perform eigenanalysis of dot product matrix % % [V,D] = eigs(A, size(...
clear all %Navigationloop initilization m = 1.17; g = 9.8; Ixx =2.754e-4; Iyy =2.5955e-4; Izz =5.7874e-4; L = 0.225; %PID parameters for x axis kpx = 0.8; kix =0; kdx =0.5; %PID parameters for y axis kpy = 0.8; kiy =0; kdy =0.5; %Innerloop initiliztion global Kpz Kdz Kpp Kdp Kpt Kdt Kpps Kdps...
classdef Secant<handle %UNTITLED Summary of this class goes here % Detailed explanation goes here properties i = 1; root; maxIterations = 50; eps = 0.00001; fun; data = []; signF = 5; ExTime = 0; l; r; precessi...
function catm = CatmSample(dataobj, catm) %% Initialize parameters. K = catm.param.K; D = catm.param.D; T = catm.param.T; beta = catm.param.beta; accept = zeros(K-1,1); Sigma = catm.var.Sigma; mu = catm.var.mu; %% Sample in random order through documents. nkw = catm.var.nkw; nkd = catm.var.nkd; nk = c...
function Pts3d_valid = field_geometry % ----------------------- Description ------------------------ % % % % Plot soccer field real-Geometry % % % % --------------------...
% view View Diffraction object graphically % % This method displays Diffraction objects as Image and Signal plots. % The default view is the measured Image. % >> view(object); % >> view(object,'Measurement'); % same as above % Results can be viewed *after* the analysis method has been used. % >> view(obje...
path=pwd; result=[]; average_number=1; flow_number_in_link=0; length_vector=[]; path_find=strcat(path,'/','bw*.txt'); file_list=dir(path_find); file_number=length(file_list); flow_number_in_link=file_number for i=1:file_number file_list(i).name; file_name_vector=(file_list(i).name); a=load(strcat(path,'/',file_nam...
function [fitdata] = qa_ampmem(filename,channel,sortcode,h) %function [fitdata] = qa_ampmem(filename,channel,sortcode,h) % % sortcode is optional list of valid sort codes (default is 1) % % h is an optional figure handle. If h is -1, this doesn't plot and % instead just spits out the results % % 2015/07/17 - M...
function [ final_alpha] = stratTest2q(filename) % stratTest2q - finds some optimal portfolio given extimated covariance matrix % and SVR predicted returns. % This is quick version with optimized loop size. Takes ca 30 sec per time step on my machine % With minor changes in code one could predict more then one time...
function data = customReadDatstoreImage(filename) % code from default function: onState = warning('off', 'backtrace'); c = onCleanup(@() warning(onState)); data = imread(filename); % added lines: data = data(:,:,min(1:3, end)); data = imresize(data,[128 96]); end
function u_trans_param = InputTransform_REFtoHL_drone(dt,varargin) %% Input transformer u_trans_param.type="REFtoHL_drone"; u_trans_param.name="p2hl"; if ~isempty(varargin) u_trans_param.param.P=varargin{1}; else u_trans_param.param.P=getParameter(); end u_trans_para...
function saveFigures(figs,file) %SAVEFIGURES Save multiple figures to a single MATLAB file. % SAVEFIGURES, by itself, saves all currently open MATLAB figures to a % single .mat file. A file dialog is opened for selecting the filename % and path. % % SAVEFIGURES(FIGS) saves all figures with handles FIG...
function w=obtainHyperplanePerceptron(X,w) [M,N] = size(X); xplus = []; yplus = []; xminus = []; yminus = []; for i=1:M if X(i,3)==1 xplus = [xplus, X(i,1)]; yplus = [yplus, X(i,2)]; else xminus = [xminus, X(i,1)]; yminus = [yminus, X(i,2)]; end; end; ...