text
stringlengths
8
6.12M
function plot2subSimul(sub1, sub2, varargin) % this is a main function that plots multipanel figure with % kernels, time-domain, and frequency-domain representation %%%%%% figure f = figure('color','white','position', [436 559 1072 208]); pnl = panel(f); pnl.pack('h',[10,20,35,35]); p...
%This line should be run before entering this script %[ratio_data,dR_data] = TDTR_Ani3D_EvalSweep(tdelay,lambda_tensor,C,h,f,tau_rep,wp,Qp,ws,TCR,Offset_vect) %initialize some stuff, only allow offset value. M_tdelay = length(tdelay); L_C = length(C); dR_temp = zeros(M_tdelay); ratio_temp = zeros(M_tdelay); S_C = zer...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function displayBoundaries(figHandle, boundaries, color, lineWidth) % % % Input parameters: % % Output parameters: % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function displayBoundaries(figHandle, bounda...
function [tree,data,err] = binaryTreeTrain( data, varargin ) % Train binary decision tree classifier. % % Highly optimized code for training decision trees over binary variables. % Training a decision stump (depth=1) over 5000 features and 10000 training % examples takes 70ms on a single core machine and *7ms* with 12 ...
FileExtn = '.txt'; ExcludeFiles = {'ProcSettings'; 'coords'; 'Coords'; 'Summary'; 'WithDistances'}; xCoordCol = 1; // x coordinates column yCoordCol = 2; // y coordinates column areasCol = 3; // area represented by each xy pair (e.g. area of a cluster if...
function [epsFileName, pngFileName] = dimredPrepPlot(ax, name) % DIMREDPREPPLOT Dimensional reduction plot preparation. % FORMAT % DESC prepares a dimensional reduction toolbox plot by formating axes % etc. % ARG ax : the axes to format. % ARG name : a string to be used. % % COPYRIGHT : Neil D. Lawrence, 2008 % % S...
%% Compare marginal likelihood and BIC score on all decomposable GGMs function ggmChordalMarglikVsBic() folder = []; %'C:\kmurphy\Students\Baback\qualityOfBic'; d = 4; graphType = 'chain'; ns = [10 20 50]; priors = {'eb', 'vague'}; firstFig = true; for ni=1:length(ns) n = ns(ni); seed = 0; setSeed...
% Copyright (c) 2020 Gabriele Gilardi % First derivative of the sigmoid activation function (Ch. 3) function A = f1_activation(Z) A = f_activation(Z).*(1 - f_activation(Z)); % End of function
function ind = get_ind_range(a,s) %GET_IND_RANGE Creates index ranges from structure S with fields: % type -- string containing '()', '{}', or '.' specifying the % subscript type. % subs -- Cell array or string containing the actual subscripts. % % Author: Nadya Travinin if len...
function char = result(index) % RESULT 根据index读取结果 switch index case 1 temp = '一饼'; case 2 temp = '二饼'; case 3 temp = '三饼'; case 4 temp = '四饼'; case 5 temp = '五饼'; case 6 temp = '六饼'; case 7 temp = '七饼'; case ...
% load('../B_maps/B0001.mat') % deltaB_B0=max(max(max(sqrt(BsX_map_phi.^2+BsZ_map_phi.^2+Bsphi_map_phi.^2))))/Bavg time_stamp_go=length(WTAE_evol); % list_pos =find(WTAE_evol==0); % time_stamp_go=list_pos(1)-1 % [wmax time_stamp_go ]=max(WTAE_evol) % time_stamp_go=length(WTAE_evol)*(time_stamp-1)/length(time_scale) % ...
%% Initialise parameters params_for_wrapper = 'Parameters/file_for_wrapper.mat'; Temperature_in_Kelvin = 300; system_parameters_file= 'parameters/dimer_CD_parameters.mat'; file_name = 'saved_data/10degset_HEOM_pt40pi.mat'; %file name to save under [t_scale, B, ~]= inv_cm_unit_sys(Temperature_in_Kelvin); %...
function out = gs3_bufwait(serobj, wtime) if nargin == 1 wtime = 5; % wait 5 seconds at most end clockflag = 0; t0 = clock; while (serobj.BytesAvailable<290) | clockflag if etime(clock, t0) >= wtime; warning('gs3_bufwait: timeout') pause(1); clockflag = 1; end end if clockflag out = -1; e...
clear all close all clc %% Load data imported_dataset = importfile('Heart_2009-0110_Jacob.csv',1,393684);%Importerer datasættet der bruges imported_dataset.Properties.VariableNames{1} = 'Date';%Sørger for at kolonnerne har variabelnavne til scriptet imported_dataset.Properties.VariableNames{2} = 'heart'; [minute_numbe...
% Function to read raw data from an ABS file. % NaN is asigned when flag(i)==0 a % % data3D is the 3D data structure % I is the associated intensity image % Need to keep NaNs in place, so that we can downsample % Reads data in from top row, left to right and then down the scan lines. function [data3D,I] = readAbsToLi...
function out = reshape_p(in,p) [sx,sy,~,~] = size(in); % pad with symmetric px = mod(p - mod(sx,p), p); py = mod(p - mod(sy,p), p); in = padarray(in,[px,py],'symmetric','post'); aa=1:p:sx; bb=1:p:sy; [ii,jj]=ndgrid(aa,bb); out=arrayfun(@(x,y) in(x:x+p-1,y:y+p-1,:),ii,jj,'un',0); out = cat(4,out{:}); end
function [RHO,PVAL] = Pej_Corr_withNaNs(X,Y, varargin) if ~isvector(X) || ~isvector(Y) error('I was too lazy to write this for more than 1-D') end if isempty(X) RHO=[]; PVAL=[]; end F = ~isnan(X+Y); if ~any(F) RHO = nan(2,2); PVAL= nan; return end if nargin > 2 [RHO,PVAL] = corr(X(F), Y(F)...
FXSpotRates = readtable('Data/FX_Spot_Rates.xlsx', 'TreatAsEmpty',{'#N/A N/A','NA','N/A'}); FXFwdRates = readtable('Data/FX_1M_FWD_Rates.xlsx', 'TreatAsEmpty',{'#N/A N/A','NA','N/A'}); % FXSpotRates(:, 1) = datetime(FXSpotRates(:, 1)); % FXFwdRates(:, 1) = datetime(FXFwdRates(:, 1)); FXSpotRates = table2timetab...
function wt = swt16dec3_GPU(x, level, waveletName) %SWT16dec3 Stationary wavelet-based 2-level frame in 3-D. % swt16dec3_GPU performs a multi-level 3-D stationary wavelet analysis % using a specific waveletName. % % wt = swt16dec3_GPU(x, level, waveletName) computes the frame % coefficients for the 3-D ...
%% RECTIFICADOR DE UNA SEŅAL %% FUNCION function [rect_x]=Rectificador(x) rect_x=zeros(1,length(x)); for i=1:length(x) if x(i)>=0 rect_x(i)=x(i); end end end
% Part (a) % theta_1 = pi/4; theta_2 = 3*pi/4; L_1 = 0.3; L_2 = 0.3; % Tau = Js' * F Js = [-L_1*sin(theta_1), -L_2*sin(theta_2); L_1*cos(theta_1), L_2*cos(theta_2)]; Jt = Js'; % Part (b) % % Mu = T'*Tau = T'*Jt*F T = [1,0;1,1]; Jm = T'*Jt; % Part (c) % CommentA5P3c = 'Through Gaussian Elimination, it is clear that no...
function T = binArray(array,binFactor,dim) % Bins an array horizontal/vertical by averaging binFactor columns arraySize = size(array); newLen = round(arraySize(dim)/binFactor); newSize = zeros(1,2); T = zeros(arraySize(1),newLen); for i=1:newLen T(:,i) = mean(array(:,(binFactor*(i-1)+1):binFactor*i),2); end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Sahebeh Dadboud: % Explicit Euler methods and plotting the results %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%% Explicit Euler methods y1(1) = 0.6; y2(1) = 0.3; % Initial Condition h1 = 0.002; % step size t = 0:h1:20; % t go...
global MPI_COMM_WORLD; load 'OctMPI/MPI_COMM_WORLD.mat'; MPI_COMM_WORLD.rank = 1; PruebaOctaveMPI;
x=[1,2,4,6,8]'; y=[100,140,160,170,175].'; g = fittype('a-b*exp(-c*x)'); f0 = fit(x,y,g,'StartPoint',[[ones(size(x)), -exp(-x)]\y; 1]); xx = linspace(1,8,50); plot(x,y,'o',xx,f0(xx),'r-');
b=load('12.txt'); p=load('13.txt'); % b = delBackground( b, 500); p = delBackground( p, 500); % p(:,2)=-p(:,2); % p(:,1)=-p(:,1); p(:,2)=p(:,2); p(:,1)=p(:,1); % p(:,3)=p(:,3)+100; a=[p;b]; % figure(1); % scatter3(b(:,1),b(:,2),b(:,3),1,b(:,3),'filled'); %plot della superfic...
function dist=stan_cadata_stability_v_space() %% load in the stability analysis ext='con'; [options,dirs]=stan_preflight; load(fullfile(dirs.agg_dir,dirs.datastore_dir,['mu_ca_timecourse-' ext '.mat'])) %roi_dir=dir(fullfile(dirs.agg_dir,dirs.ca_dir,['roi_' ext],'*.mat')); %roi_files=robofinch_dir_recurse(fullfile(di...
%% This is to finc the eigenmodes of activity based on gap junction/chemical, or mixed connectivity load('Data/SynapticHermMaleSexSpec.mat')% load this to get all different connectivities %% deriving Laplacian operator controlling gap junction networks Gap = AllConnMatSexspec.hermGap; ConnGap = Gap.Conn; g = 0;%parame...
psf = @(coord,x,y)(0.05*rand+.95)*exp(-((x-coord(1))^2+(y-coord(2))^2)/(2*150^2)); pxsz = 100; winsz = [1500,3000]; img = zeros(winsz/pxsz); smr = 100; lgr = 2*smr; smp = 100; lgp = smp; smcent = [750,750]; lgcent = [2250,750]; % area = []; % for iter = 1:1000; smcoord = zeros(smp,2); for i = 1:smp...
function v=gSeidelOne(y,pq,v) % v(1)=v(1) already %% Iterate through gauss for each row in the matrix, assigning output to input variable for next row (Gauss Seidel Method) for n=2:size(y,1) v(n)=gauss(y,pq,v,n); end end
function [arraymap] = readcmp(cmpfilename) % READCMP reads CMP map files from the Cerebus software and returns % a matrix which allows you to convert between the array's geometrical % 10x10 layout and the amplifier inputs (3x32 ribbon cables). % % Matthew A. Smith % Revised: 20070906 % Array Layout: % 91 92 ...
function [t,y,stat] = Euler(f,y0,trange,deltat,method) %EULER solves dy/dt=f(t,y),y(0)=y0 % %input arguments: % f The function. If y returns vectors of length n, % then f(t,y) should take scalar values for t and % column vectors of length n for y, and retu...
m = 200; s = 2 * ones(m); r = makerule(0.00001, 0.02); pause('on'); pausesec = 0.1;
clear * hold off %runlist = ['S5'; 'S6']; runlist = ['S6']; run = ['S6']; %windowlist = ['Hann ';'Tukey']; windowlist = 'Tukey'; %ifolist = ['H1'; 'L1']; ifolist = ['H1']; plotcolor = ['RED '; 'GREEN']; bandlolist = [40 40 69.9 199.9 119.9]; bandhilist = [2000 70.1 700.1 2000 120.1]; ylolist = 1e-6*[1.e-23 6.e-2...
function [P_k, r_rank, R_k, Q_k] = NuMax_Dict_v1(Dict, mu, alpha, opt) [M, N] = size(Dict); DDT = Dict*Dict'; P_k = zeros(M, M); R_k = zeros(M, M); DRD = zeros(N, N); S_k = zeros(M, M); Q_k = zeros(N, N); L_k = zeros(N, N); r_rank = 0; for iter = 1:opt.outer_iterations for ee = 1:opt.inner_...
function ls_fl = list_of_fl(wd,sfx) %% Description % Returns the list of files for given directory and file suffix % To Call: % [ls_fl] = list_of_fl(wd,sfx) % % wd : path of interest // char % sfx : suffix of files of interest // char % % ls_fl : structure with the filenames i...
function [ m ] = shedulebytable( g,s,p ) %% 通过调度时间表调度间歇作业 %s:开始时间 %p:处理时间 %g:处理器个数 %m:需要的机器台数 %作业的个数 num=length(s); %机器个数 m=1; %调度表,每g行代表一个 complete=s+p; scheduletable=zeros(num,g,max(complete)-min(s)+1); %逐个调度剩余的不等长度的作业,以释放时间为开始时间 if num>0 for i=1:num ...
%%in barnamei baraye OPTIMUM NOTCH FILTER ast,BARAYE %EJRAYE BARNAME HAME BARNAME RA ENTEKHAB KARDE(Ctrl+A & Ctrl+C)VA DAR Command %Window MATLAB PASTE KONID. clc clear all; close all; I=imread('10.tif'); I=rgb2gray(I); I=imresize(I,[400 400]); FFT = fft2(double(I)); FFT1=fftshift(FFT); figure(1); subplot(2,2,2);imsh...
function BootStrapVaR = BootVaR(logreturns, nine, m) n=length(logreturns); per = (1-nine)*n; perfl = floor(per); perflpone = perfl +1; gamma = per-perfl; VaRSum=0; ESSum=0; for i=1:m for j=1:n randomnumber = randi([1, n]); bootstrap(j) = logreturns(randomnu...
% BIVARIATE GRANGER CAUSALITY OLS % % INPUT: % data = column-wise data % Window Size % Leave Point (shift the window by leaving the no. of points) % Lag (Autoregressive order) % Normalization = 'temporal' or 'entire' or 'none' % % OUTPUT: % Direction_MAT = window-wise causality matrix % DI = Directionality ...
% Exercise 3.4 % Data from dropout voltage in an electric circuit. % Estimation and hypothesis testing on mean, variance and hypothesis % testing for goodness of fit to normal distribution. datdir = 'c:\MyFiles\Teach\DataAnalysis\Data\'; dattxt = 'DropoutVoltage'; sigma0 = 5; varalpha = 0.05; mu0 = 52; mualpha...
function [lost cost assignment price reserve user_bid]=auctionmatch(dis,radius,f2uratio,w)%assig是一个列向量,表示每个用户连接的基站,lost是未建立连接的用户个数 %proportional match maxiter=1e4; numuser=size(dis,2); %size(A,n)如果在size函数的输入参数中再添加一项n,并用1或2为n赋值,则 size将返回矩阵的行数或列数。其中r=size(A,1)该语句返回的时矩阵A的行数, c=size(A,2) 该语句返回的时矩阵A的列数。 numfemto=size(di...
function [cost,grad,features] = sparseAutoencoderLinearCost(theta, visibleSize, hiddenSize, ... lambda, sparsityParam, beta, data) % -------------------- YOUR CODE HERE -------------------- % Instructions: % Copy sparseAutoencoderCost in sparseAutoencoderCos...
clear all; close all; [alien, Fs] = audioread('sound/alien_bruit2.wav'); debut = 6*Fs; fin = 15*Fs; noise = alien(debut:fin); % Trois fréquences parasites présentes Fc1 = 1050; Fc2 = 810; Fc3 = 484; Wn1a = (Fc1-1)/(Fs/2); Wn1b = (Fc1+1)/(Fs/2); Wn2a = (Fc2-1)/(Fs/2); Wn2b = (Fc2+1)/(Fs/2); Wn3a = (Fc3-1)/(Fs/2); W...
function [ average_hip_rotation_fun ] = average_hip_rotation( nlp ) %average_hip_rotation constraint for average_hip_rotation % Creates SymFunction for a average_hip_rotation constraint % % Author: Ross Hartley % Date: 2018-03-19 % Compute function for average_hip_rotation constraint X = cell(1,nlp.Num...
load('parametryWielomianuPWMPompy.mat') load('parametryWielomianuPWMZaworu.mat') load('parametryWielomianuC1Zaworu.mat') load('parametryWielomianuC2Zaworu.mat') % h0 = 30;
function [x,u] = oneHeatSS( Nx,iOption,cOption ) %% % Nx: number of grid points % iOption: selects source function % cOption: selects coefficient variation %% set some parameters xa = 0; % left of domain xb = 1; % right of domain dx = (xb-xa)/(Nx-1); %% set up spatial grid % on...
clc; clear all; close all; addpath('Data') %Fait par : PHIL %Date : 2019-11-11 load('Linearisation'); load('Identification_MC'); load('Constantes'); load('equilibre'); %Ces variables seront remplacées par celle dans banc d'essai si elle sont disponibles % Position à l'équilibre de la sphère (pour test...
function [handle]=plot_contours(triang_faces,vertices,sf, options) % [handle]=plot_contours(triang_faces,vertices,sf,Nlines); % Draws isolines (also called contour lines) of a scalar function linearly % interpolated on a triangulated surface by its sf at vertices. % NOTATION: % 'Ntriangles' denotes the number of triang...
function plot3d_write(filename,x,y,z) imax = size(x,1); jmax = size(x,2); kmax = size(x,3); nodes = imax*jmax*kmax; nblocks = size(x,4); fid = fopen(filename,'w'); fprintf(fid,'%3.0f\n',nblocks); fprintf(fid,'%4.0f %4.0f %4.0f \n',imax,jmax,kmax); xvec = reshape(x,nodes,1); yvec = reshape(y,nodes,1); zvec = resha...
function [res] = CalculateDimensions(res, phys, coil, settings) % CalculateDimensions Calculates the mayor radius, plasma volume, total cost, the total magnet thickness and the normal % stress to which the structural material in the TF field coils is subjected if settings.roger res.R_0 = (4/5 * phys.E_f * re...
% [y]=Jacobian(x); % This function calculates the jacobian of the model equations (partial first % derivative of equation in "Thpmodel.m" w.r.t. elements in x). This is used to % estimate the posterior error covariance matrix. function y= JacobianThP(x); % Declare equation normalizing factors as global global sumTh23...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright 2014 Analog Devices, Inc. % % Licensed under the Apache License, Version 2.0 (the "License"); % you may not use this file except in compliance with the License. % You may obtain a copy of the License at % % http:/...
function [var_eps,VAF] = AOloopAR(G,H,Cphi0,sigmae,A,Cw,K,phiSim) % This MATLAB routine closes the loop of the Vector Auto-Regressive model % and computes the variance of the residual wavefront var_eps, from system % matrices A, G, H, covariance matrices Cphi0, sigmae*I, Cw, Kalman-gain % matrix K and the wavefront dat...
function TuneSetpoint(obj,setpoint) %TuneSetpoint Sets the wavemeter setpoint % frequency = desired setpoint in THz or nm if obj.debug f_debug = UseFigure([mfilename('class') '.TuneSetpoint'],'name','TuneSetpoint',true); figure(f_debug); % Bring to front (and gcf) ax_debug(1) = subplot(3,1,1,'parent',f_d...
function zoomedFrames = zoomFrames(refFrame,scaleFactor,blurSigma) % ZOOMFRAMES: Zooms in on a reference frame. % Usage: zoomedFrames =zoomFrames(refFrame,scaleFactor,blurSigma) % % Input parameters are as follows: % refFrames = reference image. % scaleFactor= vector of zoome scale factors. %...
function kmeansDemo close all doPrint = 1; X = load('faithful.txt'); figure(1);clf; plot(X(:,1), X(:,2), '.', 'markersize', 10) title('old faithful data') grid on if doPrint, pdfcrop; print_pdf('faithful'); end; if doPrintPmtk, printPmtkFigures('faithful'); end; seed = 4; rand('state', seed); randn('state', seed); ...
function [new_trace, logC] = remove_line_noise(trace,phi,a_s,theta,obs) new_trace = trace - a_s*sin(((1:length(trace))*theta + phi)*2*pi); logC = -sum((new_trace - obs).^2);
% Use a desktop-validation approach to create a synthetic dataset % This dataset assumes a 4-cell battery pack comprising Panasonic 25 Ah % cells. The cells have different series resistances, different capacities, % and different initial states of charge. They are all exercised with the % same profile of current versus...
function pos = sample_location_in_mask(mask, sample_step) [y, x] = find(mask); idx = find(mod(x, sample_step)==0 & mod(y, sample_step)==0); pos = [x(idx), y(idx)];
% create axes clc figure(1) clf axis([0 100 0 100]) 1 % get input poly = impoly(); % interactive placement of polygon on axes positions = poly.getPosition(); % matrix with rows representing vertices cells = num2cell(positions, 1); [x, y] = cells{:}; % x is vector of x coordinates. Same for y. [X, Y] = draw_curve(x, y...
function [optweight,current_err,converge_flag]=prohorovit_spline_r_indy_GLS(titles,param,fullsol,agg_sol,init_guess) % % PROHOROVIT_SPLINE_RK_INDY_GLS finds the optimal weights for the inverse % problem for the parameter 'r' in the reaction-diffusion equation under % the Prohorov Metric Framework using continuous/spl...
function CreateRGBOffsetIMDB( ) % This script will create IMDB with train:validation ratio as configured in % the script using opts.partitions %The offsets will be loaded from directory clear; close all ; run RGBObjectDetectionSetUp; % Variables (that you might want to change) opts = struct; opts.data_dir=['dat...
function plotMultiExperimentSummary(dirStruct, printDir, figName) numExps = length(dirStruct); distTraveled = nan(numExps, 11); z2_speed = nan(numExps, 11); fracz_z2 = nan(numExps, 11); transSucP = nan(numExps, 11); homeDir = pwd; %% collect data to plot for aa = 1:length(dirStruct) cd(dirStruct(aa).director...
D = 2; range = 5; xmin = -range; xmax = range; ymin = -range; ymax = range; x_opt_val = zeros(D,1);%x_opt(D); f_opt_val = f_opt(); [Q, R] = qr(randn(D)); f = f20(D, x_opt_val, f_opt_val, R, Q); ran = xmin:0.1:xmax; N = length(ran)*length(ran); X = zeros(D, N); Y = zeros(N, 1); i = 1; for x_1 = ran for ...
function obs = measMask(obs,PARAMS) if PARAMS.measUse.dfOnly obs.range.obs(obs.range.sig < 100) = 0; end % remove doppler measurements that don't have associated pseudoranges. % actually also only keep L1 doppler measurements obs.doppler.obs(2:end,:) = 0; obs.doppler.obs(:,~any(obs.range.obs)) = 0; % obs.range.o...
function clr = evergreen % function evergreen % % Make the color evergreen % % KIM 05.15 clr = [ 0.1992 0.7969 0.1992];
function y_Write(Data,Header,OutName) % Write NIfTI file (3D or 4D) Based on SPM's nifti or Write GIfTI file (1D or 2D) Based on SPM's gifti or Write DPABINet Matrix files % %------------------------------------------------------------------------ % 1. For NIfTI % Write data (Data) with a specified header (Header) into...
push 1 push 2 push 3 push 23 push 343 pall rotl pall rotl pall rotl pall
% INTRODUCTION % Script to investigate the effect of radiation damage on dark current. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % PREPERATION % Prepare workspace: clear close all hidden clc ...
function result = f_npManova3(n,m,H,I,G,iter,model) % - utility function called by f_npManova % - 3-way MANOVA with interaction % % n = # rows/colums in distance matrix % m = array of # parameters for each factor % H = cell array of hat matrix for each factor % I = I matrix % G = Gower's centered matrix % iter = # ite...
function [total_time] = concatenate(query_path,reconstruct_tensor) %Query Path is the path of which travel time has to be calulated %reconstruct_tensor is the tensor formed after tucker decomposition and %reconstruction average_travel=[]; for i=1:length(query_path) x=query_path(i,1); y=double(reconstruct...
% An example of Lagrangian duality problem for solving constrained % non-convex optimization problems
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % heat_pump_function % This a thermodynamic model of a pumped thermal energy storage cycle. It % is based on the Joule-Brayton cycle and employs liquid storage media. % Author: Pau Farres-Antunez (pf298@cam.ac.uk) % % This function is based on ...
function main_example_constant_current(varargin) % Do it!!! % Find it!!! % Hunt it down!!! % varargin is for PBS arrary job if nargin == 0 clc;clear all;close all; cd /import/yossarian1/yifan/Project1/ addpath(genpath(cd)); cd tmp_data end % Basic parameters N = [4000; 1000]; %!!! dt = 0.1; sec = roun...
function Nimg_gt = normalFromD(D) [Nx, Ny, Nz] = surfnorm(D); Nimg_gt = zeros(size(D, 1), size(D, 2), 3); Nimg_gt(:,:,1) = Nx; Nimg_gt(:,:,2) = -Ny; Nimg_gt(:,:,3) = Nz;
function theta_ref = findAngle(RGB) imshow(RGB) img_size=size(RGB); %Note that the image size is given as Y,X, so this must be reversed img_cntr= [img_size(1,2)/2, img_size(1,1)/2 ]; first=getrect; second=getrect; first_centre= sqrt((first(1)-img_cntr(1))^2 + (first(2)-img_cntr(2))^2); second_centre= sqrt((second(1)...
% Paramteres K = 1; c = 2*pi/2; b = 2*pi/20; w = 2*pi/40; a_dith = .05; % Values sim_time = 400 refine_factor = 1; r = 0.55; p = 2; k1 = 1.5; k2 = 3.0; % Initial Conditions x1_0 = 0.1; x2_0 = 1; % input u = 0.275; % Low Pass Filter s = tf('s'); LPF = c/(s+c) bode(LPF) % High Pass Filter figure HPF = s/(s+b) b...
%% Conv UDF % Purpose: Converts angles to values between 0 and 512 % Inputs: % Outputs: function [ddposition] = Conv(dposition) ddposition = dposition*(64/45)+512; end
function value = core_keys(argument) size = length(argument); value = zeros(1,size); for n=1:size if(argument(n) == 0) value(n) = 1; elseif(abs(argument(n))<=0.5) value(n) = sin(argument(n)*4*pi)./(argument(n)*4*pi); else value(n) = 0; end end end
function maskGDS(filename,x,y,offsetx,offsety) outputFile=fopen(filename,'wb'); nameof6=double(filename(1:6)); gdspreamble = [ 0, 6, 0, 2, 0, 7, 0, 28, 1, 2, 230, 43, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0,... 230, 43, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 10, 2, 6, 110, 111, 110, 97,... 109, 101, 0, 20, 3, 5, 61, 104, 219, 1...
%in barnamei baraye Local Histogram Equalization ast.BARAYE %EJRAYE BARNAME HAME BARNAME RA ENTEKHAB KARDE(Ctrl+A & Ctrl+C)VA DAR Command %Window MATLAB PASTE KONID. %tasvire vorudi IMG_IN=imread('6.tif'); IMG_IN=im2double(IMG_IN); XX=input('size e panjere : '); k=input('meghdar sabete k(beyne 0 va 1) : '); M=mean2(IMG...
function info = make_info(depid,tagtype,species,owner) % info = make_info(depid,tagtype,species,owner) % make an info structure % or % make_info % shows a list of recognized tags, species and researchers % % Inputs: % depid is a string containing the name assigned to this deployment, % e.g....
function [out] = loadLocalConfig( confFile ) %LOADLOCALCONFIG Summary of this function goes here % Detailed explanation goes here out.dir.muo = -1; out.dir.ele = -1; str = xml2struct(confFile); K = size(str.Children,2); names = cell(K,1); for k = 1:K names{k} = str.Children(k); end for k = 1:K if s...
clc clear x=imread('workshop.tif'); imshow(x) x=imresize(x,0.2); [H,W]=size(x); B=x(10:floor(H/3),:); G=x(floor(H/3):floor(H/3*2)-10,:); R=x(floor(H/3*2)+11:H,:); [hei,wid]=size(R) %OFF=10 OFF=50 pad_size=[OFF OFF] EdgeB = edge(B,'Canny'); EdgeG = edge(G,'Canny'); EdgeR = edge(R,'Canny'); CropR=R; CropG=G; CropB=B; [c...
function [result, result_wpsnr] = dwtsvd_detection(original, watermarked, attacked) %function result = dwtsvd_detection(original, watermarked, attacked) orgn = imread(original); wtrm = imread(watermarked); atck = imread(attacked); result_wpsnr = WPSNR(wtrm,atck); [~,OLH,OHL,~] = dwt2(orgn,'haar');...
%% Setting up workspace close all; % Close all figures and windows clear; % Clear workspace clc; % Clears screen %% Initializing parameters tf = 1; % Final time in simulation T = 2e-5; % Sample rate t = 0:T:tf; % Time vector n_m = 2; % Number of states m_m = 1; % Number of measurements p_m = 1; % Number of inputs num_...
%% We use 0.01(s) steps for this plot t =-1:0.01:10; T=1; u=heaviside(t); x1=(1-exp(-t*T)).*u; plot(t,x1); xlabel('t'); ylabel('x1(t)'); title('Diagram 1, x1(t)=(1-e^(-tT)).u(t)'); legend('x1(t)'); axis([-1 10 0 1]);
% Program that acccepts two numbers, compares, and prints the larger % number. clc num1 = input('Enter your first number here: '); num2 = input('Enter your second number here: '); if(num1 > num2) fprintf('The greater number is %d.', num1); elseif(num1 < num2) fprintf('The greater number is %d.', num...
function transxyz = transxyz(x,y,z) % devuelve Matriz de translación 4x4, para un movimiento (x,y,z) como % entradas. transxyz=[1,0,0,x;0,1,0,y;0,0,1,z;0,0,0,1]; end
function dy = ONEIZNETWORKQSSAD5(C,klow,khigh,vt,vreset,vpeak,vr,a,d,Tmax,G,I,Er,alpha,beta,tbar,NS,t,y) s = y(1:NS,1); h = y(NS+1:2*NS,1); w = y(2*NS+1:3*NS,1); TS = 1./(alpha.*Tmax+beta); sinf = (alpha.*Tmax)./(alpha.*Tmax+beta); TR = TS; TD = 1./beta; A = sinf.*(tbar + (1./beta-TS).*(1-exp(-tbar./TS))); fo...
% PROBLEM 1. You've Got Mail! %-------------------------------------------------------------------------- function emailGen(file) fh = fopen(file, 'r'); name = strtok(file, '.'); wf = fopen([name '_email.txt'], 'w'); go = true; line = fgetl(fh); while go [username line] = strto...
function start_LearnSimulink(varargin) %{ This function simply opens an HTML document to guide you in this way to learn Simulink. Created by Roni Peer, Dec-2011. %} cd(fullfile(pwd, 'files')); open(fullfile(pwd,'html','LearnSimulinkScript.html')); % Open the HTML.
function [slice_order] = fcon_get_slice_order(file,order,nb_slices,first); % Gets the slice order to be used in the fcon_fmri_preprocess. % % [slice_order] = fcon_get_slice_order(file,order,nb_slices,first) % % IN: % file: % A file to get the zstep of the database. Use Nifti or Minc file. % order: % The ...
function [ force, idxforce ] = copse_find_force( model, forceclassname, allowempty ) % Find a forcing in list % looks for forcing of class 'forceclassname' in cell array model.force if nargin < 3 allowempty = false; end idxforce = find(strcmp(cellfun(@class, model.force,'UniformOutput',false), forceclassname)...
function [out1,out2,out3] = rgb_normalize(image) org_R = image(:,:,1); [h,w] = size(org_R); normalize_R = zeros(1,256); normalize_G = zeros(1,256); normalize_B = zeros(1,256); [org_r_hist,org_g_hist,org_b_hist] = RGB_histogram(image); for l=1:1:255 normalize_R(l)= org_r_hist(l)/(h*w); normali...
function a = payoffAsianCallTest(subyacentPrice, maturity) persistent accumulatedValue persistent numberOfValues strike = 20; if isempty(accumulatedValue) accumulatedValue = 0; end if isempty(numberOfValues) numberOfValues = 0; end accumula...
function ind = forestIndsMatlab(treeData, thrs, fids, child) % function ind = forestIndsMatlab(treeData, thrs, fids, child) % fids is 1-indexed, child is also 1-indexed N = treeData.getNumPoints(treeData); F = treeData.getFeatureDim(treeData); ind = zeros(N,1); id{1} = 1:N; for i = 1:length(child), % We ...
function [EVENTS SYNCS channels]= nev2events(nev) %function [EVENTS SYNCS channels]= nev2events(nev) % % Finds the spike times and sync times in the NEV file and returns them % disp('Locating valid channels...'); % look through the NEV data to find out which channel/sort code % combinations produced spikes channels ...
function mu = optimizeMu(self, wzu, C) % Solve the quadratic optimization to update mu % mu = optimizeMu(self, wzu) % % Returns: % mu [D x T x K] optimized estimate for cluster locations % Required arguments: % wzu [N x K] weight w * posterior likelihood Z * t-dist scaling U % C [D x D x K] estim...