text
stringlengths
8
6.12M
function [C,f] = op_coherence_2continus_f(data1,data2,Fs,window,band,fpass) % 利用coherence 工具包计算两个连续序列的coherence关系 TW = window*band; % 窗长度为 2 s,半频带宽度为 4;TW = 2*4 = 8; K = 2*TW - 5; % K = 2*TW -1 = 15 tapers = [TW,K]; params.tapers = tapers; params.Fs = Fs; params.fpass = fpass ; % show results between 0 and 100 Hz param...
function [ dominanteFace ] = getMostDominanteFace( boxes ) %return the most dominante face in image if(isempty(boxes)) dominanteFace=[]; return; end maxArea=0; for i=1:size(boxes,2) if(iscell(boxes)) %cell type handle currArr = cell2mat(boxes(1,i)); %convert cell to matrix currArea = ...
% Set the wecSimPath variable to the location of the WEC-Sim source directory % Copy the code in this file and place it in your'startup.m' file wecSimPath = "C:\Users\user\Documents\FYP-2020"; addpath(genpath(wecSimPath));
function uff1 = ReviseMOL(uff, atomType) uff1 = uff; tmp = find(uff.bound==1); if length(tmp) ~=2 disp('For polymers, there must exist 2 active atoms in MOL_1 ...') disp('Please go back and recheck the MOL_1 file...') quit; else format = uff.format; coords = uff.molecule; bound = u...
function fde=fd(imagename) img=imread(imagename); if(size(img,3)==3) img=rgb2gray(img); end level=graythresh(img); bimg=imbinarize(img,level); limg=bwareafilt(bimg,1); bound=bwconncomp(limg); ll=size(img,1); mm=size(img,2); [x,y]=ind2sub([ll mm],bound.PixelIdxList{1}); ...
function [ Miu, Sigma, P, U, S, V ] = MFGMulMF( Miu1, Sigma1, P1, U1, S1, V1, FM ) % Multiply a MFG density and a matrix Fisher density, and match the % resulting density to a new MFG. % See W Wang, T Lee, https://arxiv.org/abs/2003.02180, 2020 % Inputs: Miu1, Sigma1, P1, U1, S1, V1 - parameters for the MFG % F...
function auc = evaluation_AUC(decision_values, label) L = length(label); pos = sum(label == 1); neg = sum(label == -1); error = 0; for t = 1:10 rp = randperm(L); dv = decision_values(rp); lb = label(rp); [value,inx] = sort(dv,'descend'); flag = 0; for i = 1:L if lb(inx(i)) == -1 ...
function [L,U,P] = LUdispPiv(omega,lambda,R,S) % function [L,U,P] = LUdispPiv(omega,lambda,R,S) % Fast LU factorization of a Cauchy-like matrix with partial pivoting. % omega and lambda are column n-vectors with no common entries. % R and S are nxr matrices. % L is nxn unit lower triangular. % U is nxn upper t...
clear variables; x = linspace(0, 7, 10001); x0 = 1.0; m0 = 2.4; f0 = (m0/x0).*((x./x0).^(m0-1)).*exp(-1.*((x./x0).^(m0))); legendname0 = 'Southern HWK'; x1 = 2.5; m1 = 2.0; f1 = (m1/x1).*((x./x1).^(m1-1)).*exp(-1.*((x./x1).^(m1))); legendname1 = 'Southern SWK'; x2 = 0.67; m2 = 1.4; f2 = (m2/x2).*((x./x2).^(...
%% Bonus Problem addpath('/home/derek/Tools/MATLAB/'); q =sym('q', [3 1], 'real'); p =sym('p', [3 1], 'real'); r =sym('r', [3 1], 'real'); A1 = cross(q,r)/(dot(r,r)); A2 = cross(r,p)/(dot(r,r)); A3 = cross(p,q)/(dot(r,r)); U1 = -skewsym(cross(A1,p))+(dot(A1,p))*eye(3); U2 = -skewsym(cross(A2,q))+(dot(A2,q))*eye(3); U3 ...
%%%%%%%%%%%%%% %% Vortex: BIC %%%%%%%%%%%%%% % Runs 4 possible models of the two main regression models presented in the % Supplementary Material (Table S3 and S4), calculates the BIC for these % models and produces the plots S1 and S2. % Requires function from SPM toolbox (spm_BMS). %% LOAD DATA clc clear close al...
w = 15; x = 0:0.1:15; y = exp(-0.7*x).*sin(w*x); plot(x,y); xlabel("x"); ylabel("y"); title("y(x) = e^-^0^.^7^x sin\omega x");
function [ ] = afficherKeypoints(image, listPoints ) % Affiche des cercles correspondants aux points clés avec leurs orientations. %La taille et la couleur varient selon le sigma. figure; imshow(image); % Affichage des points clés sur l'image [t,u] = size(listPoints); totalSizeListPoints = t*u; ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Codes for estimating lattice constant of ABX using PLSR and PCR. % Dataset can be seen in data_ABX.mat. Dataset contains experimental % lattice constant [C1], ionic radii [C2-C4], atomic number [C5-C7], % electronegativity [C8-C10], and dens...
function url = gendemolink(name, text) %GENDEMOLINK Generate a weblink for a demo % Author(s): Nico Vervliet (Nico.Vervliet@esat.kuleuven.be) % % Version History: % - 2015/07/10 NV Initial version baseurl = 'http://www.tensorlab.net'; url = sprintf('<a href="matlab: web(''%s/demos/%s.html...
% tent map example % %%%% generate training and testing time series for ESN training % The learning-and-testing script learn.m expects data to be contained in % two matrices named sampleinput (of size inputdim x samplelength) and % sampleout (of size outputdim x samplelength). Such two matrices must be % the result of...
% edited for amplitude Cara Stepp 08-15-2013 %edited by Liz Heller Murray 6/3/2014 %edited by Defne Abur 4/7/2015 to normalize sound, 65dB on MOTU line 179 %edited by Defne Abur 4/9/2015 to add in 'order' and 'ordersave' variables to %randomize presentation order - see lines 93 - 99 % edited by Liz Heller Murray 5...
function fdetect(filepath) FDetect = vision.CascadeObjectDetector(); I = imread(filepath); BB = step(FDetect,I); figure, imshow(I);hold on for i= 1:size(BB,1) rectangle('Position',BB(i,:),'LineWidth',5,'LineStyle','-','EdgeColor','r'); end title('Face Detection'); ...
function [neighbors,D,loc] = nearestNeighbor(S,T,K) if nargin < 3, K=size(S,1);end D = zeros(size(S,1),1); loc = zeros(size(S,1),1); for k=1:size(S,1) dk = sqrt(sum((bsxfun(@minus,S(k,:),T)).^2,2)); [D(k),loc(k)] = min(dk); end neighbors = T(loc(1:K),:); end
function [flag, test] = isstationary(this, varargin) % isstationary True if model or specified combination of variables is stationary. % % % Syntax % ======= % % Flag = isstationary(M) % Flag = isstationary(M,Name) % Flag = isstationary(M,LinComb) % % % Input arguments % ================ % %...
function [xU,yU,zU] = UniformVelocity(x,y,z,Time) xU = 3; yU = 0; zU = 0;
warning off rmpath(genpath(fileparts(mfilename('fullpath')))); warning on addpath(genpath('helpercode')); % % % % % % % % % % % % InitAll %% Specific student assignments that need to be checked for nw = 1:4 weekName = ['week' num2str(nw)]; cd(con.STUDENTSUBFOLDER) apSubmitted = pwd; postfxZipped = '_un...
function [hmask] = make_hmask(mbb_par, bb, sz) mbb_pnts = double(mbb_par - [bb(1:2)]'+1); hmask = logical(poly2mask(mbb_pnts(1,:), mbb_pnts(2,:), sz(1), sz(2)));
% Represents the kinematics and dynamics of a single cable segment % % Author : Darwin LAU % Created : 2011 % Description : % Cable segments are fundamental for MCDMs since cables can pass through % multiple links and hence have multiple segments. classdef CableSegmentModel < handle properties ...
function X = outlierlim(d,gname,varargin) multiplier = 2; vararginProcessor T = grpstatsTable(d,gname,{'gname','mean','std'}); X = table; X.gname = T.gnameu; X.upperlim = T.mean + (T.sd.*multiplier); X.lowerlim = T.mean - (T.sd.*multiplier);
% This function executes a Min intra- and max inter-class distance dimension reduction. function LocMat=GetMemdCorrIndex(Num_imf,NumSub_MCI,NumSub_NC) CorrMeanImf_MCI=CorrGroupMeanImf('MCI',NumSub_MCI,Num_imf); CorrMeanImf_NC=CorrGroupMeanImf('NC',NumSub_NC,Num_imf); corrtmp=abs(CorrM...
function dec = bytes2dec(bytes) %dec = bytes2dec(bytes) % %this function will take a string of bytes and %turn it into a decimal value. % %USE BIG_ENDIAN to determine the endianness % "Copyright (c) 2000 and The Regents of the University of California. All rights reserved. % % Permission to use, copy, modify...
function [iter,x,ea] = mjacobi %Función para solucionar un sistema de tres ecuaciones lineales syms x1 x2 x3 x0=input('Digite f(x0)='); tol=input('Digite el porcentaje de tolerancia='); ecu=leerecu; %subfunción de las ecuaciones a resolver y(1)=solve(ecu(1),x1); y(2)=solve(ecu(2),x2); y(3)=solve(ecu(3),...
function example_coch(data,fs,time_step) fmin = 200; fmax = fs/2; total_no_freq = 70; freq_step = 3; dt = 5; [X_ft, t, params] = cochleagram(data, fs, dt, 'log', fmin, fmax, total_no_freq); figure('units','normalized','outerposition',[0 0 1 1]); imagesc(flipud(X_ft)); time_s = t(1:time_step:numel(t)); xticks(1:time_s...
function varargout = ceo_tool(varargin) % CEO_TOOL MATLAB code for ceo_tool.fig % CEO_TOOL, by itself, creates a new CEO_TOOL or raises the existing % singleton*. % % H = CEO_TOOL returns the handle to a new CEO_TOOL or the handle to % the existing singleton*. % % CEO_TOOL('CALLBACK',hObject,ev...
addpath(genpath('feature-extraction')); addpath(genpath('liblinear-1.94')); %% STEP 1 % Compile the feature-extraction toolbox % - cd to feature-extraction folder % - type compile (there will be warnings printed - ignore them) %% STEP 2 % Compile liblinear (only for non-Windows machines) % - cd to liblinear-1.94/m...
function Main(varargin) %% BC-VARETA toolbox v1.0 %%%%%%%%%%%%%%%%%%%% % Includes the routines of the Brain Connectivity Variable Resolution % Tomographic Analysis (BC-VARETA), an example for real EEG analysis. % BC-VARETA toolbox extracts the Source Activity and Connectivity given % a single frequency componen...
function [ ] = plotAngles( queue ) %PLOT1D Summary of this function goes here % Detailed explanation goes here a = zeros(8,200) while(1) a(1:end - 1) = a(2:end); % blocks until new data is available a(end) = queue.take; queue.getQueue.clear; plot(a); getframe; end end
clear clc format compact %% System Model %need NB, Parent(i), jtype(i), X_T, Ii [P, PARENT, KINE, INER, CNCTPTS] = PendModel(); [RobotLinks,RobotParam] = PendRobot(P, PARENT, KINE, INER, CNCTPTS); NB = P.NB; %% Dynamics q = zeros(3,1); dq = zeros(3,1); ddq = zeros(3,1); q = [0 -0.3 0.6]'; dq = [1 1 1]'; ddq = [1 ...
function [outfile] = label_videobbox(indir) %-------------------------------------------------------------------------- % % Copyright (c) 2014 Jeffrey Byrne % %-------------------------------------------------------------------------- [bbox, is_occluded] = bobo.annotate.videobbox(indir, 1, fullfile(indir, 'detections....
function blo = prepa_num_cifrar(tama, bloque) %prepa_num_cifrar - Description % % Syntax: blo = prepa_num_cifrar(tama, bloque) % % Función que convierte una cadena numerica en bloques % de un tamaño dado, despues convierte dichos bloques en % numeros y los almacena en un vector. Si es necesario para % completar el u...
function [classes_avg] = get_class_avg_falpha_measure(conf_matrix) classes_avg = zeros(1,6); for i = 1:6 recall_rate = get_recall_rate(conf_matrix); prec_rate = get_precion_rate(conf_matrix); classes_avg(i) = get_falpha_measure(recall_rate, prec_rate); end end
function [t,d]=propagate_init(tign,distance) % [t,d]=propagate_init(tign,distance) % create the initial state before the first call of propagate [m,n]=size(tign); t=zeros(m,n,3,3); for i=1:m, for j=1:n t(i,j,:,:)=tign(i,j); end end d=distance; end
function ShowStimulusMovie(input,settings) %ShowStimulus % %version 0.1 %08/16/2007 %written by Gert Van den Bergh % %Shows a stimulus with the required parameters if nargin<1 %ScreenData settings.screendistance = 25; %distance from eyes to screen settings.pixelsize = 47/1280; %pixelsize in centimeters: screen width...
function [ targets, track_candidates, confirmed_tracks, deleted_tracks, target_id ] = target_tracking( targets, total_clusters, step,... dimensions, precision, Re_width, radius_t, n_memory, n_confirm, n_max_confirm, n_delete, target_id, track_candidates, ... confirmed_tracks, deleted_tracks) %TARGET_TRACKING Su...
present = true; %I AM HERE I SWEAR
function Solitarywave(obj, mesh) syms x t; H0 = 0.32; d = H0; A = H0 * obj.Ratio; l = H0*sqrt((A+H0)/A); C0 = l/d*sqrt(obj.gra * H0^3/(l^2-H0^2)); h = H0 + A * ( sech( (x-C0*t)/l ) )^2; U = C0 * (1 - d/h); W = -( A * C0 * d )/( l * h ) * sech( (x - C0 * t)/l )*( diff( sech( (x - C0 * t)/l ), x ) * l ); % P = A*C0^2...
function img = extendVoi( img, k ) if length( size(img) ) == 2 return; end for i = 1:k img(:,:,i) = ( img(:,:,i) + img(:,:,k+1) * ( k + 1 - i ) ) / ( k + 2 - i ); img(:,:,end-i+1) = ( img(:,:,end-i+1) + img(:,:,end-k) * ( k + 1 - i ) ) / ( k + 2 - i ); end end
classdef Merton properties T; mu; sigma; riskyAsset; risklessAsset; initialWealth; utility; end methods function o=Merton(initialWealth,T,mu,sigma) o.initialWealth=initialWealth; o.T=T; o.mu=mu; ...
%-------------------------------------------------------------------------- % Gauss_weights.m % determines Gaussian quadrature weights using Gauss nodes %-------------------------------------------------------------------------- % w = Gauss_weights(tau) % tau: Gauss nodes % w: Gaussian quadrature weights %----...
clear; sampleMount=40;%分类数 imageMount=10;%每个分类的样本数 n=112*92;%特征数 %读入数据 y=zeros(sampleMount*imageMount,1); x=zeros(sampleMount*imageMount,n); for i=1:sampleMount for j=1:imageMount x((i-1)*10+j,:)=double(reshape(imread(['orl_faces/s',num2str(i),'/',num2str(j),'.pgm']),1,n)); y((i-1)*10+j,1)...
%COMPUTEINITIALPOTENTIALS Sets up the cliques in the clique tree that is %passed in as a parameter. % % P = COMPUTEINITIALPOTENTIALS(C) Takes the clique tree skeleton C which is a % struct with three fields: % - nodes: cell array representing the cliques in the tree. % - edges: represents the adjacency matrix o...
function x = jacobifun(A,b,tol,n) % Mètode iteratiu de Jacobi if nargin == 2 n = 100; tol = 0.5e-5; end if nargin == 3 n = 100; end D = diag(diag(A)); L = tril(A-D); U = triu(A-D); DI = inv(D); BJ = -DI*(L+U); cJ = DI*b; rhoJ = abs(eigs(BJ,1)); if rhoJ < 1 k = 0; x = zeros(size(b))...
function [P,F]=updatesecondaryvariables(Fhat,GradNref,unmas1i,pgausselem,nnodes) % la i que acompaña a unmas1 en las variables de entrada viene a % recordar que los valores de entrada Piola1i y unmas1i, para esta función son los de la % iteración i de N-R para el tiempo n+1.. global lambda mu ...
function Score=GetScore(A) % function Score=GetScore(A) % Input A: A sequence need to sort % Output Score: the sort index % eg: % if A=[1 2 4 1 5] % then Score=[1 2 3 1 4] SortA=sort(A); N=length(A); ScoreA=zeros(1,N); for i=1:N for j=1:N if A(i)==SortA(j) ScoreA(i)=j; break; ...
%\\zubjects\Subjects\FR141% i =0; i =0; i = i+1; db(i).mouse_name = 'FR141'; db(i).date = '2019-05-03'; db(i).expts = [2 3 5 7 8]; db(i).waveL = [1000 1000 1000 1000 760]; db(i).expID = 1:4; db(i).stimType = {'spontaneous', 'spontaneous', 'spontaneous', 'oris', 'oris'}; % grey...
%{ tp.TraceVon (computed) # VonMises tuning fits for traces -> tp.TraceOri ----- von_r2 : double # fraction of variance explained (after gaussinization) von_fp : double # p-value of F-test (after gaussinization) sharpness : float # tuning sharpness pref_dir : float # (radians) preferred direction peak_a...
function [Melem] = ElemAcouMass(XYZ,mat) % (1-ig)/b if isfield(mat,'cs') && ~isempty(mat.cs) Keff = mat.K_s; rho0= 1; else rho0 = 1;%mat.rho; Keff = mat.c^2*mat.rho; end NPE = size(XYZ,1); if NPE == 8 IP.XI = [-1 -1 -1;... 1 -1 -1;... 1 1 -1;... ...
function [SkipList,lftloc,rgtloc,lftamp,rgtamp,lftwid,rgtwid,avgwid] = ... func_guesspeaks(data1D,TPH,frames,sensitivity,graph,trim) global yBin %Height of data global yBotEnd global xRgt %% ---------------- Fitting parameters trimStart = trim; trimEnd = xRgt-trim; clear rgtloc; clear lftloc; %Intialize/Reset ...
function [output] = model_stats(lin_corrs, fft_corrs) %% Function input % lin_corrs: Matrix of linear correlations. Rows are test data, columns % are database entries % fft_corrs: Matrix of fft correlations. Rows are test data, columns % are database entries assert(size(lin_corrs, 1)==size(fft...
% trainModel.m % train model for metric learning % all model data are saved in ./data/model/ clear all; close all; tic; setInitial; dataSetName = 'msramm'; featureName = 'EHD'; scale = true; imgClassNo = get_dataSetInfo(dataSetName,'imgClassNo'); imgClass = get_dataSetInfo(dataSetName, 'imgClass'); labels = get_dataS...
function [remtimes,remidx]= RemoveCrosstalk(g,ch1,ctchannels,h) sortchannels=getappdata(h,'sortchannels'); handles = getappdata(h,'handles'); % nfiles=size(g.spikefiles,2); nfiles = length(g.snipfiles); chindices=find(ismember(g.channels,ctchannels)); if g.pwflag global sptimes else %Load in times for ch=1:size(ctch...
function net_int = train_2_layers(s,r) %function takes sample data an trains a neural network to aaproximate the %integral used to compute the fuel fraction. %inputs - % s -- samples from gauss_samps(1000,0.8), etc % r -- responses from fuel_quad(s,50), etc %create CNN with two hidden layers of size 10 net_int = f...
function [ fig ] = plot_test_train_same_plot( one_over_lambda,train_erros,test_errors ) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here fig = figure; plot(one_over_lambda,train_erros) hold on plot(one_over_lambda,test_errors) legend('train','test') % title('iterations vs train,test err...
close all; clear all; tic; subfolders = dir( 'data\zz\' ); kk = 1; %ignore the . and .. for i = 1 : numel( subfolders ) if( isequal(subfolders(i).name, '.')||... isequal(subfolders(i).name, '..')||... ~subfolders(i).isdir) continue; else specimen_index(kk) = subfolders...
%% read image 256 x 256 im=double(imread('D:\Users\Lenovo\Desktop\pic\lena_256.bmp')); subplot(3,3,1); image(im); im2=double(imread('D:\Users\Lenovo\Desktop\pic\car.jpg')); subplot(3,3,4); image(im2); colormap(gray(256)); %% lowpass mask lp_mask = zeros(256,256); lp_bound = round(256/10); N = 0; for ...
function smap=saliencyimage_convolution(img,scale) % function smap=saliencyimage(img,scale) % Calculate saliency map for color image, at certain scale % each filter is zero summed % load ICA basis functions load stats; d=size(B1,1); % number of filters D=size(B1,2); % color filter streched length fsize=D/3; % length...
dataFilePath = 'D:/RFID/groundtruth/a2'; fileNmae = ''; EPCData=[dataFilePath, '/EPC_1','.data']; fid=fopen(EPCData, 'r'); epc=fscanf(fid,'%f %f',[2,inf]); fclose(fid); epc=abs(epc(1,:)+epc(2,:)*1i); plot(epc)
function [subj] = raicar_reformResult (subj) % % function [subj] = raicar_reformResult (subj) % % Author: Zhi Yang % Version: 2.0 % Last change: June 28, 2007 % % Purpose: % Z-normalize the component maps and corresponding mixing matrix, % and then reshape it to 4D matrix (x, y, z, numComp) % % Inp...
function [ k ] = Cal_Curvature( x , p ) %syms x y; y = zeros(length(x),1); k = zeros(length(x),1); for i = 1:length(x) %Generating all y values y(i) = p(1)*x(i)^4 + p(2)*x(i)^3 + p(3)*x(i)^2 + p(4)*x(i) + p(5); %% Method one: Calc curvature based on polynomial equation % k(i) = abs(12*p(1)*(x(i).^...
function photons = hDetectorEnergyResponseFunction(photons, energy) scintillatorThickness = 1.5; % cm scintillatorMaterial = 'CWO'; % detectorGeometryLoss = 0.90; % mu = materialAttenuation( energy, scintillatorMaterial ); photons = detectorGeometryLoss * photons .* ( 1 - exp( - mu .* scintillatorThickness )) ; e...
function [pos,neg] = significant_cluster_time_freq_channel(stat,sig) % find relevant clusters pos=[];neg=[]; if (isfield(stat,'posclusters')) if not(isempty(stat.posclusters)) ipos = 1:length(stat.posclusters); % loop over all sig positive clusters for i=1:length(stat.posclusters) ...
function t = FEMLinElement2d() %TELEMENT TElement class constructor. % t = TElement() creates a element object; t.kxxc=[]; t.kyyc=[]; t.masselec=[]; telement2d=TElement2d(2); t = class(t,'FEMLinElement2d',telement2d);
function [answer]=getwordlist i=1; answer=[]; while 1 word = input('enter word:','s'); if isempty(word) return end answer{i}=word; i=i+1; end end
%% For a set of surface wave ASCii files process the data to filter out bad data and %% remove the first twenty seconds as well as any data that does not fit within %% a certain standard deviation of the mean %% %% Created by Nick Talavera on October 26, 2015, modified from swmod by Anibal Sosa %% %% To run, type: %% S...
close all waveFile='18.wav'; [y, fs, nbits]=wavread(waveFile); y=y(:,1); frameSize=256; overlap=0; framedY=buffer(y, frameSize, overlap); volume=sum(abs(framedY)); plot(volume); [segment, threshold]=splitVector(volume, 10*fs/frameSize, 0.5*fs/frameSize, 1); for i=1:length(segment) sampleIndex1=(segment(i).beginIndex...
GT = readpfm(['MiddEval3/training',imgsize,'/',image_names{4},'/disp0GT.pfm']);%Modify d = DisparityMap_sparse{1}; o = hole_filling(d,3); df = Occ_fill(DisparityMap_sparse{1},40,0); D_full = BGF(o); % Error5(~mask) = 0; % GT(~mask) = 0; p = psnr(D_full, round(GT),1) % Erroro = abs(o - GT) > bad; Errordf = abs(D_full...
% ------------------------------------------------------------------- % Generated by MATLAB on 13-Dec-2016 20:34:28 % MATLAB version: 9.0.0.341360 (R2016a) % ------------------------------------------------------------------- saveVarsMat = load('PalmesBogdan_sp_t2.mat'); C_0 = 0; D = 21; Duty = 52.5; ...
%Script to set up a neural network to solve the ILDAlone specint problem %Specifically set up for Batch Training of a Static Network (see manual) %Architecture: % 2-Layer network % Input(16x21 ILD/freq spec) --> Layer 1 (numfreqs X numILDs) --> Layer 2 (1 ICCls or ICx unit) % \ / ...
%% Main Simulator Script clc;clcl; % Initalizaiton %---------------------------------------------------------------------- % Set current directory compName=getComputerName; setCD(compName); params = setParams(); % Create fitting operator -> E %---------------------------------------------------------------------- ...
%Author: Kartik S. Pandya, PhD (email: kartikpandya.ee@charusat.ac.in) %Professor, Dept. of Electrical Engg., CSPIT, CHRUSAT, Gujarat, INDIA %Co-Author: Dharmesh A. Dabhi, PhD(Pursuing) (email: dharmeshdabhi.ee@charusat.ac.in) %Assistant Professor, Dept. of Electrical Engg., CSPIT, CHRUSAT, Gujarat, INDIA % Enhanced V...
function this = trim(this) % trim Remove leading and trailing NaNs from time series data. % % Backend IRIS function. % No help provided. % -IRIS Macroeconomic Modeling Toolbox. % -Copyright (c) 2007-2017 IRIS Solutions Team. %-------------------------------------------------------------------------- this...
function resourcesDir = getResourceDir %GETRESOURCEDIR Summary of this function goes here % Detailed explanation goes here p = mfilename( 'fullpath' ); p = fileparts( p ); p = fileparts( p ); resourcesDir = fullfile( p, 'resources' ); end
% profile_cell.m (beta) % copyright: Brian Drawert 2010,2011 function profile_cell(varargin) % if(nargin==0) % input_file_mask = {... % 'Ste20Spa2.1m.1_C001T%.3d.tif',... %red channel % 'Ste20Spa2.1m.1_C002T%.3d.tif'}; %green channel % tspan=1:21; % else % %TODO...
%% ----------------------------------------------------------------------- % % Title : test.m % Author : Alexander Kapitanov % Company : Insys % E-mail : sallador@bk.ru % Version : 1.0 % %------------------------------------------------------------------------- % % Description : % Top le...
function [ W ] = meanvalueWeights( mesh, vertices ) % W = meanvalueWeights(mesh, vertices) % Compute mean-value weights % - if vertices is undefined/empty, compute for entire mesh % % [Ryan Schmidt rms@dgp.toronto.edu 09/2009] if ~ exist('vertices', 'var') || numel(vertices) == 0 vertices = mesh...
clc clear all close all %% Filtering x % We have the audio signal x, and % we filter through H(z)=B(z)/A(z), obtaining y [x, Fs]=audioread('Toms_diner_16.wav'); b=[1, -1.5173, -0.0121, 0.7863, 0.1440]; a=[1. 0, 0.5 0 0.24, 0, 0.12]; y=filter(b,a,x); %% what kind of filter is H? % your code and answer...
% Copyright (c) 2017, Amos Egel (KIT), Lorenzo Pattelli (LENS) % Giacomo Mazzamuto (LENS) % All rights reserved. % % Redistribution and use in source and binary forms, with or without % modification, are permitted provided that the following conditions are met: % % * Redistributions of source ...
% Finds the indices of the cell that holds the minimum cost % costs : The matrix that contains the estimation costs for a block % dx : the motion vector component in columns % dy : the motion vector component in rows function [dx, dy, min] = minCost(costs) [row, col] = size(costs); % we check whether the current % v...
# # Find Quetelet index for females who spent 100$ each and express it per cent. # # my answer = 313 INCORRECT! data = load("spendings.dat"); num_people = sum(sum(data)) gender_amount_probs = data ./ num_people gender_probs = sum(data, 2) ./ num_people amount_probs = sum(data) ./ num_people # p(Gender|spent amount)...
clear clc %5.5a) n=4 Consumo=[ 5 5.7 6.2 6.7 7.0 ] tempo =[ 85 89 93 95 96 ] difdiv1=fdifdiv(n,Consumo,tempo) Consumo1=7.5 tempo1=fgregoryn(n,Consumo,tempo,difdiv1,Consumo1) xp=Consumo(1):0.01:7.5; yp=fgregoryn(n,Consumo,tempo,difdiv1,xp); plot(Consumo,tempo,'*k','markersize',20,xp,yp,'k','LineWidth',2,[...
clc; fprintf('===================================[ tsdrect.m ]===================================\n\n'); fprintf('This example calculates the transient pressure field of a rectangular piston using\n'); fprintf('the Fast Nearfield Method with Time-Space decomposition. It outputs an animation\n'); fprintf('of the pre...
function [no_InTerms,InTerms,no_OutTerms,OutTerms,Rules,Rules_semantic] = RuleGen_FRIE(TrainData_IN,TrainData_OUT,Alpha,Beta,Forgetfactor,numSamples) % Partitioning using CLIP InTerms = CLIP(TrainData_IN(1:numSamples,1),Alpha,Beta); %%% % passes col 1 of TrainData_IN (values of 1st input variable)Interms stores the ...
function result = javaFromMatlabStruct(value) if ~strcmp(class(value), 'struct') throw(MException('MDSplus:javaFromMatlabStruct', 'only struct allowed')); end if isscalar(value) fields = fieldnames(value); result = MDSplus.Dictionary(); for fieldIdx = 1:length(fields) f...
t = (0:0.1:10)'; x = sawtooth(t); %Apply white Gaussian noise and plot the results. y = awgn(x,10,'measured'); plot(t,[x y]) legend('Original Signal','Signal with AWGN')
function pattern = aoctanary(h,w,d) sz = [h,w,d]; b1 = [-1;1;-1i;1i]; b2 = [1;1;1;1;realsqrt(6)]; pattern = b1(randi(4,sz,'uint8')).*b2(randi(5,sz,'uint8')); end
function output = quatroFVNresponseAnalysisQ(fvnSet, xRec, xRef, fs, nRepeat, nto) % Acoustic analysis using four unit FVNs % output = quatroFVNresponseAnalysisQ(fvnSet, xRec, xRef, fs, nRepeat, nto) % % Input argument % fvnSet : matrix with four unit FVNs as its column % xRec : response to the mixed FVN s...
function [err phv_fwd] = disperr(periods,phv,phvstd,grv,grvstd,initmodel) % Write model file writemod_surf96(initmodel,'start.mod'); % Write dipersion file outfp = fopen('disp_obs.dsp','w'); for ifreq=1:length(periods) fprintf(outfp,'SURF96 R C X 0 %6.4f %6.4f %6.4f\n',... periods(ifreq),phv...
% Homework #7a % Driver for jacobi.m clc clear; close all; %=================================== % (6a) %----------------------------------- tol=1e-4; % Here go the three matrix definitions A1=[1.01 0.99; 0.99 1.01]; b1=[2.0;2.0]; A2=[1.5 .5; .5 1.5]; b2=[2.0;2.0]; %making the a3 matrix and b3 rhs x...
function simdata = sim_noPenalty(nS, chunk, chunk_freq, agent) rng(24); nA = nS + 1; theta = zeros(nS,nA); % policy parameters V = zeros(nS,1); % state value weights p = ones(1,nA)/nA; % marginal action probabilities blockstruct.chunk = chunk; blockstruct.len...
%% Check that we can find the dataset opto_data_file = fullfile(files_path, 'preprocessed_data', 'ofc_learning_choosing_dataset_opto.mat'); assert(exist(opto_data_file, 'file') == 2, ... 'Unable to find opto dataset. Please find "ofc_learning_choosing_dataset_opto.mat", and place it in the Matlab path.') %% Check...
function [N,D] = design_lowpass(fp, fs, Rp, Rs, Fs) Wp=(fp/Fs)*2*pi; Ws=(fs/Fs)*2*pi; c=power(tan(Wp/2),-1); Op=1; Os=c*tan(Ws/2); sc=sqrt(power(10,Rp/10)-1); A=sqrt(power(10,Rs/10)); m1=log10((power(A,2)-1)/power(sc,2)); m2=2*log10(Os); M=ceil(m1/m2); for k=1:M pp=exp(pi*i*(1/2+(2*k-1)/(2*M))); P(k)=power(p...
function writeTriFile(V,F,triFile,comment) % writes 3 column tri-files % % writeTriFile(vertices,faces,filename,comment) % vertices = vertex matrix [ +right, +anterior, +superior ] origin @ volume center % faces = triangular face matrix [ inward normals ] ???zero-indexed??? [fid,msg] = fopen(triFile,'w'); if f...
function data_filepath = save_variable_data(subject_id, variable_name, data) % data_filepath = ''; if isempty(data) error('Input data is empty. Cannot save empty data to csv files.'); % return; end if has_variable(subject_id, variable_name) warning('Subject %d already save data file %s.csv. It will be re...
function result=mydetrend( data) % function result=mydetrend( data) % % disp('detrending with 3rd order polynomial') % disp('detrending with 3rd order polynomial') t=[1:length(data)]; [coeffs, error] = polyfit(t,data,3) result = data ... -coeffs(4) ... - coeffs(3)*t ... - coeffs(2)*t.^2 ... - coeffs(1)...