text
stringlengths
8
6.12M
% 逐次超松弛迭代法求解线性方程组; % A为方程组的系数矩阵; % b为方程组的右端项; % delta为精度要求,默认1e-5; % max为最大迭代次数,默认100; % w为超松弛因子,默认为1; % x为方程组的解; % k为迭代次数; % flag = 'failure'表示失败,flag = 'success'表示成功 function [x, k, flag] = SOR(A, b, delta, w, max) n = length(A); k = 0; x = zeros(n, 1); y = zeros(n, 1); flag = 'succe...
function [ W ] = matEvaluateVerticalVelocity( obj, mesh3d, fphys2d, fphys3d ) %MATEVALUATEVERTICALVELOCITY Summary of this function goes here % Detailed explanation goes here % fphys3d(:, :, 6) = mesh3d.Extend2dField( fphys2d(:, :, 1) - fphys2d(:, :, 5) ); % HUt = mesh3d.Extend2dField( fphys2d(:, :, 2) ) - fphys3d(...
function [resY , resX] = CoROMP3(D , Y , X , param) % Modified Orthogonal Matching Pursuit % Based on a CoSaMP_SB with Two_Solve and HSS % % Inputs : % D : dictionary (normalized columns) % Y : set of vectors to run on (each column is one signal) % X : Initial set of coefficients (one column for one signa...
function [SS_e,s_e,SS_total,r_sq,r_sq_adj] = validation_test(matrix,b,y) % Statistical calculation for i = 1:length(matrix) x1v = matrix(i,1); x2v = matrix(i,2); x3v = matrix(i,3); xv = generateData(x1v,x2v,x3v); yv(i,:) = xv*b'; end y_real = y; df_e = 10; df_total = 19; y_mean = (sum(y_re...
function S = LoadStackRawMulti(filedir) %function S=LoadStackRaw(filedir) % %Imports STXM raw data from input directoy filedir %filedir needs to contain the STXM header file (.hdr) and the STXM data files (.xim) %R.C. Moffet, T.R. Henn February 2009 % %Modified by Matthew Fraund November 2015 % %Inputs %-----...
1; function [c]=myQuadratur1D(f,w,x) sum = 0; for k=1:length(x) sum += w(k)*f(x(k)); endfor [c] = sum; endfunction f = @(x) exp(x) + 1; x1 = [0 1]; w1 = [1/2 1/2]; x2 = [0 1/2 1]; w2 = [1/6 4/6 1/6]; myQuadratur1D(f,w1,x1) myQuadratur1D(f,w2,x2)
function DM=mat_gen_wind_flux_div(X,type) % get matrix of flux divergence % input: % X mesh % type 'D' create divergence matrix D % 'M' create wind to flux matrix M % 'DM' create D*M (default) % output: % DM flux divergence matrix % % Error checking check_mesh(X); if ~exist('type','var...
classdef View < handle % SBFSEM.UI.VIEW % % Description: % Generic single panel interface. % % Protected properties: % figureHandle handle to figure window % ui structure to hold ui handles % % History: % 8May2018 - SSP - simplified version of Interface % --------------------------------...
function d = detection_list(g,r) %d = detection_list(g) %inputs : % g struct, satellite data from subset_detections % r struct, fire data from subset_domain %output ; % d nx2 array with lon,lat of detections min_con = 7; mask = zeros(size(g(1).fxdata)); for i = 1:length(g) mask = mask + d...
function [] = WriteFLDeck(Path,FileName) FileID = fopen(FileName,'w'); fprintf(FileID,'AllowReplace\r\n!\r\n'); fprintf(FileID,'FL_INPUT\r\n'); String = GetFormatStrings('Flow Path'); for k = 1:length(Path) PrintHeader(FileID,Path(k).ID); Info.Geom = [Path(k).FlowArea,Path(k).Length,Path(k).OpenFrac]; ...
function PlanesofPlot(node,elem,k,xns,yns,zns) z0=mean(node(:,3)); plane=[min(node(:,1)) min(node(:,2)) z0 min(node(:,1)) max(node(:,2)) z0 max(node(:,1)) min(node(:,2)) z0]; [cutpos,cutvalue,facedata]=qmeshcut(elem(:,1:4),node,node(:,1),plane); figure(6); trisurf(k,zns,xns,yns, 'Facecolor','...
clear; close all force; clc; %% Informações da base % Base retirada do repositório UCI datasets, pode ser encontrada no link : % <https://archive.ics.uci.edu/ml/datasets/Computer+Hardware>. % Informações Gerais : Dados Relativos de Desempenho de CPUs de 30 fabricantes. % 1. Nome: Dados relativos de desempenho da CPU % ...
function s=big(a) % s=big(a) % max absolute value of any array, arbitrary number of dimensions s=big2(abs(a)); function s=big2(a) if isvector(a), s=full(max(a)); else b=max(a,[],ndims(a)); s=big2(b); end
function writeBoozerfile(Geom,filename,varargin) if filename(end-2:end)=='.bc' filetype='bc'; else if filename(end-3:end)=='.dat' filetype='dat'; if nargin>2 Nradii=varargin{1}; %HM's W7X calculations usually has 7 else Nradii=Geom.nsurf; end else filename=[filename,'.bc']; fi...
%% % 1(a) normdistr = randn(4) %1(b) positivevector = normdistr(normdistr>0) %1(c) [row,col] = find(normdistr>0) %1(d) wherepositive = normdistr>0 %% %2 first = ones(4,4)*normdistr(1,1); Eucliddist = abs(normdistr - first) %% %3(a) I = imread('/Users/utkarsh/Downloads/img_001.ppm'); size(I) %605 represents the height...
%for papers ===================================================================================== infile='\SignifProp\lena512.bin'; fid=fopen(infile); a=fread(fid,[512 512],'uint8')'; fclose(fid); %infile='\SignifProp\barbara.bin'; fid=fopen(infile); a=fread(fid,[512 512],'uint8')'; fclose(fid); %infile='\SignifProp...
% Script that computes the backwards error calculating the eigenvalues % using the explicitly shifted QR iteration. sim = 1000; for j = 1:sim n = randi([5,30]); A = exp(randn(n)*1i + randn(n)); [T,Q] = complexschur(A); eigenval = abs(eig(A)); semilogy(j,norm(eigenval - abs(diag(T)))/norm(e...
%%precision and recall testLabel1_output= xlsread('5th.xlsx'); testLabel1=testLabel5; [s1 s2]=size(testLabel1); tp0=0;fp0=0;fn0=0; tp1=0;fp1=0;fn1=0; tp2=0;fp2=0;fn2=0; tp3=0;fp3=0;fn3=0; tp4=0;fp4=0;fn4=0; tp5=0;fp5=0;fn5=0; tp6=0;fp6=0;fn6=0; tp7=0;fp7=0;fn7=0; tp8=0;fp8=0;fn8=0; tp9=0;fp9=0;fn9=0; for i = 1:...
% Simulation Logic: % Creating the environment: Tank % Creating the Agents % When iterating in the loop: % tank.addFood() % For all Agents: % agent.consumption() % agent.outcome() % bacteria.convert() % For all Agents: % agent.behaviour() % STOP function simul...
% subplot(2,2,1) % spectrogram(yhigh(:,test_case),512,64,128,16000,'yaxis'); % subplot(2,2,2) % spectrogram(yhigh(:,13),512,64,128,16000,'yaxis'); % subplot(2,2,3) % spectrogram(yhigh(:,12),512,64,128,16000,'yaxis'); % subplot(2,2,4) % spectrogram(yhigh(:,11),512,64,128,16000,'yaxis'); subplot(2,2,1) spectrogram(yhig...
% regularization parameter tester % tests: % modesolver_reg % modal_filter % % 08/11/14 % mics = 2; order = 4; winsize = 1000; mscale = 0.1; mshift = 0.9; alpha = 0; base = "/media/joe/Milarepa/experiments/2014_08_11/reg_eigs/"; directory = [base, "a", num2str(alpha), "/"]; mkdir(directory)...
clear clc load AW.mat; %% Reading image inImg = im2double(imread(strcat('img/27.jpg'))); inImg = imresize(inImg, [80,120]); [imgH, imgW, imgDim] = size(inImg); %% Building Saliency Saliency myEnergy = im2Energy(inImg, W); mySMap = vector2Im(myEnergy, imgH, imgW); %% Visualization mySMap = mySMap.^2; mySMap = imfilte...
function [Copt Res] = get_cv_krr(Xtr,Ytr,C,folds) % Xtr--input data matrix % Ytr--output data matrix % C --values to test if nargin<3 C=[ 5.^[5:-1:-1]]; end C=.1*dataVarEst(Xtr,1)*C; if nargin<4 folds=5; end Fi=gennFold(ones(size(Xtr,1),1),folds); for fold=1:folds fidxs=Fi(:,fold); for i=1:numel(C) ...
function [n2sgram,nsgram]=straightBodyC03ma(x,fs,shiftm,fftl,f0raw,f0var,f0varL,eta,pc,imgi) % [n2sgram,nsgram]=straightBodyC03ma(x,fs,shiftm,fftl,f0raw,f0var,f0varL,eta,pc,imgi) % n2sgram : smoothed spectrogram % nsgram : isometric spectrogram % x : input waveform % fs : sampling frequency (Hz) % shiftm : frame ...
function y = cauchy_rand(a, b, n) % Cauchy Random function y = a + b*tan(pi*(rand(1,n)-0.5)); end
function [noise_bandwidth, noise_bandwidth_chan] = mrir_noise_bandwidth(noise, varargin) %MRIR_NOISE_BANDWIDTH % % bandwidth = mrir_noise_bandwidth(noise) % % % references: % % Kellman P, McVeigh ER. % Image reconstruction in SNR units: a general method for SNR measurement. % Magn Reson Med. 2005 Dec;54(6):1439-47....
function success = emailResults(filenames, emailaddress) % success = emailResults(filenames, emailaddress) % % THIS FUNCTION ONLY WORKS AS-IS ON THE UIUC CAMPUS. (But, all you'd have % to edit is the first line, to change the name of the SMTP server). % % E-mails experiment results (or any other file!) to yourself as...
function [stockCode, startDate] = fetchOptCodeByFeature(CP, strike, ExpireDate, xlsPath) %输入参数 % OptHistoryInfo期权合约列表 % CP Call Put % strike 执行价格 % ExpireDate到期日期 写法 '2016-09'(9月份到期) %输出参数 % stockCode合约代码 % startDate合约的起始日期 %Demo % [stockCode, startDate] = OptInfo.fetchOptCodeByFeature( 'call', 2.3, '2016-12') % [stock...
% Calculate inertial parameters regressor of coriolis joint torque vector for % %RN% % Use Code from Maple symbolic Code Generation % % Input: % %INPUT_QJ% % %INPUT_QJD% % %INPUT_PKIN% % % Output: % tauc_reg [%NQJ%x(%NQJ%*10)] % inertial parameter regressor of coriolis joint torque vector % %VERSIONINFO% function...
function require_dirs( arr ) % REQUIRE_DIRS -- Create directories if they do not exist. % % IN: % - `arr` (cell array of strings, char) dsp2.util.assertions.assert__is_cellstr_or_char( arr, 'the paths' ); arr = dsp2.util.general.ensure_cell( arr ); for i = 1:numel(arr) dsp2.util.general.require_dir( arr...
function plot_u(Uout) figure; cmap = colorcube(400); colors = cmap([171 233 80 135 30 200 111],:); T = 1:size(Uout,2)-1; t = T(end); subplot(3,1,1) plot(T,Uout(1,1:t),'-','Color',colors(1,:),'linewidth',2); grid on; hold on; xlabel('time (s)'); ylabel('U_x (N)') set(gca,'fontsize',14); subplot(3,1,2) plot(T,Uout(2...
%% INIT clear all; close all; clc GPS = load('Grundriss_GPS.mat'); vorgabe = load('Vorgabe.txt'); imaqreset %% Data Aquisition (i) colorDevice = imaq.VideoDevice('kinect',1); depthDevice = imaq.VideoDevice('kinect',2); step(colorDevice); step(depthDevice); colorImage = step(colorDevice); depthImage =...
function boxedDim = packaged_objec(boxedObjec, angle, flag) % Function which will return either the dimensions of the new boundary % box after rotating the image (if flag == 1) or returns the whole % image after it has been cropped to the new boundary box of the % rotated object (if flag == 0) % In...
%compute thrust command for theta using LQG controller %EWG 2014 function [control1, control2, control3, xest, utheta, loss, gsim, psisim] = HeadingControlMIFconstY(x1,xestin,uthetain,gsimin,psisimin) %Define system model %model parameters a=1.4; b=4; Kmodel=50; A = [0 1 0; 0 0 1; 0 -(a+b) -a*b]; B = [0 0 ...
function tf = gitUpToDate() [a, b] = system('git status --porcelain'); if isempty(b) tf = true; else tf = false; end end
function [measures, best] = distilate_2d(Z, param1_name, param2_name, ref_fsimc) if nargin < 4 comp_fsimc = false; else O = rescale(ref_fsimc, 0, 255); comp_fsimc = true; end [S, N] = size(Z); measures.param2 = zeros(1, N); measures.param1 = zeros(1, N); measures.psnr = zeros(S, N); measures.fsim = zeros...
% Rechnerunterstuetzte Mechanik I % Wintersemester 2018/19 % % Uebung 3: % Grosse Lineare Gleichungssystem % % Inhalt: % - LUP Faktorisierung % - CG Verfahren % clc; disp('3. Uebung zur Vorlesung Rechnerunterstuetzte Mechanik I (WS 2018/19)'); %%%%%%%%%%%%%%%%% %%% AUFGABE 1 %%% %%%%%%%%%%%%%%%%% disp('Aufgabe 1'); ...
%% % Function that finds intersection of 3 planes % Each Plane is in the form: % A * X + B * Y + C * Z + D = 0 % Author: Geometry by Bowyer andf Woodwark, Butterworths, 1983 %% function p = planes_intersect_point( plane1, plane2, plane3 ) a1 = plane1(1); b1 = plane1(2); c1 = plane1(3); d1 = plane1(4); a...
% Generate Time-Changing Frequency and Time N = 1500; f_n = frequency_n(); phi = integrateFrequency(f_n); figure; plot(1:1500,f_n,'b','LineWidth',2); hold on; xlabel('Time Index [n]');ylabel('f(n)'); title('Frequency of signal over time');grid on;grid minor;set(gca,'FontSize',18); figure; plot(1:1500,phi,'r','LineWidth...
function rm_old_mk_new_dir(dir_) if isdir(dir_) assert(rmdir(dir_,'s')); end assert(mkdir(dir_)); end
classdef (Sealed = true)sweep < qes.qHandle % sweep an array of values for one or multiple % ExpParam(experimental parameter) class objects or functions. % Copyright 2015 Yulin Wu, Institute of Physics, Chinese Academy of Sciences % mail4ywu@gmail.com/mail4ywu@icloud.com properties % values of pa...
function psinsuartcallback(obj, event) % Copyright(c) 2009-2018, by Gongmin Yan, All rights reserved. % Northwestern Polytechnical University, Xi An, P.R.China % 17/08/2018 global glb [recbuf, cnt] = fread(obj, glb.recbuflen/4, 'float32'); if ~ishandle(glb.hfig) if glb.fid>0 fclose(glb.fid);...
% Read in wine dataset wine = dlmread('winequality-red.csv',';',1,0); % Randomly split data into train and test sets N = size(wine,1); ind = randperm(N); train_ind = (ind<(N+1)/2); test_ind = (ind>=(N+1)/2); train = wine(train_ind,:); test = wine(test_ind,:); mean_train = mean(train); std_train = std(train); %Sta...
MAT_DIR = 'p-sys-resp'; if isempty(regexp(pwd, strcat(MAT_DIR,'$'), 'ONCE')) error(strcat('Your current working directory must be: ', MAT_DIR)); end results = dir('*.mat'); for file = {results.name} if ~isempty(regexp(file{1}, 'STEP', 'ONCE')) data = load(file{1}); data = data.ans; figu...
function SDMantra(varargin) switch varargin{1} case 'saraswati' SCMD('seperator','type03',5,1) fprintf('saraswati namasthubhyam varade kAmarUpiNi\nvidhyAraMbham karishyAmi siddhirbhavathu me sadA\n') SCMD('seperator','type02',5,1) disp('may dEvi saraswati bless you with awesome prog...
% this script generares the results of the latex table of the syntethic experiments close all; clear; clc directory = 'data/power_profile_tests'; files_and_folders = dir(directory); files = files_and_folders(~([files_and_folders.isdir])); errors = [[0, 1, 0, 1, 0]; [0.05, 1.01, 0.005, 1.001, 0]; [0.05, 1.01, 0.005, ...
%% Initialization section clear all; close all;clc; prompt1 = 'Please enter the subject ID given for the user: '; SUBJECTID = input(prompt1); markers = ["lef","lbd","lelb","lelb1","lie","ref","rbd","relb","relb1","rie"]; %Kinect initialization script addpath('F:\github\wearable-jacket\matlab\KInectProject\Kin2'); ad...
function [] = parseHK(data) hk.bootCount = swapbytes(typecast(data(1:2), 'uint16')); hk.imagesTaken = swapbytes(typecast(data(3:4), 'uint16')); hk.temperature = typecast(data(5), 'uint8'); hk.framStatus = typecast(data(6), 'uint8'); hk.medipixStatus = typecast(data(7), 'uint8'); hk.bootTime = s...
function [res] = precision(preds,labels) %PRECISION measure K = max(labels); %number of classes precs = []; for k=1:K precs = [precs; length(find(labels == preds & preds==k))/length(find(preds==k))]; end precs(isnan(precs))=1; % one for not prediciting any of class that was not involved precs(isin...
function varargout=mnlistgrad(Fmn,Nperiods) if strcmp(class(Fmn),'mnmat') varargout{1}=grad(Fmn,Nperiods); else cind=find(Fmn.cosparity & not(Fmn.m==0 & Fmn.n==0)); sind=find(not(Fmn.cosparity) & not(Fmn.m==0 & Fmn.n==0)); dduFmn.m = [Fmn.m(cind), Fmn.m(sind)]; dduFmn.n = [Fmn.n(cind), F...
function [ new_features ] = im_scale_features( features ) total = size(features, 2); new_features = zeros(size(features)); for i = 1:total all end end
function RehedgerStocks2(aBot,aTime,aStrikeVec) myDeltaPosition = DeltaPosition(aBot,aStrikeVec); myPercentage = 0.01; if myDeltaPosition>myPercentage*sum(aBot.ownTrades.volume(find(strcmp(aBot.ownTrades.ISIN,'ING')))), myBidStockV=abs(round(myDeltaPosition)); myBidStockP=aBot.StockDepth.bidLimitPrice(1); ...
%Katarzyna Pencak simulink; J = [-1,0;0,1]; P = eye(2); %P = [1,0.1;0.5,1]; A=P*J*P^-1; figure; xlabel('x1'); ylabel('x2'); grid on; hold on; %wektory własne x1 = -1.5:0.1:1.5; y1 = -1.5:0.1:1.5; x2 = -1.5:0.1:1.5; y2 = -1.5:0.1:1.5; plot(x1*P(1,1),y1*P(2,1),'b'); plot(x2*P(1,2),y2*P(2,2),'b'); ...
function [kp_new2]=sobel_op(A,B) %NOTE:REPLACE CONVOLUTION INBUILT %A=imread('cameraman.tif'); %B=[5 5 10 55 34 38]; %B=keypoints_loc; [r2 c2]=size(B); Dx=[-1 -2 -1;0 0 0;1 2 1]; Dy=[-1 0 1;-2 0 2;-1 0 1]; % Dxpad=[0 0 0 0 0;0 -1 -2 -1 0;0 0 0 0 0;0 1 2 1 0;0 0 0 0 0]; % Dypad=[0 0 0 0 0;0 -1 0 1 0;0 -2 0 2 2;...
function mat=escanear2(z,o,poly1,poly2) linea = zeros(o,3); for i=1:1:o % Measure the time to acquire 20 frames. linea(i,3) = z; linea(i,2) = (((2*pi)/o)*i); linea(i,1) = distanciaop(poly1,poly2); end mat = linea;
A = importdata('train.txt'); B = importdata('test.txt'); [numTrainSamples, numTrainDim] = size(A); [numTestSamples, numTestDim] = size(B); x_test_id = B(:,numTestDim); y_train = A(:,numTrainDim); x_train = A(:,1:numTrainDim-1); x_test = B(:,1:numTestDim-1); x_train = zscore(x_train); x_test = zscore(x_test); ...
function A = get_A(ac, t, X) I = eye(6); A = zeros(6); for i = 1:6 h = 1e-6; f1 = ac.non_flat_model(t, X - h*I(:,i)); f2 = ac.non_flat_model(t, X + h*I(:,i)); A(:,i) = (f2-f1)/(2*h); end end
% in programs written before august 21, 2009, PCAproj outputs weighted and % centralized features. but after this date, varargin determines ifthe % fatures should be weighted&centralized or not. function varargout = pcaProj( egnFace , egnVal , meanFace , varargin ) % ftrW, meanFace, prbFace: each row for a sample. eg...
% This is a test script for the function file bunnyEars2 % Antonio Cancio bunnyEars2(0) bunnyEars2(1) bunnyEars2(2) bunnyEars2(3)
function c = mult(a,b) % MULT calculates c=a*b for each value of each column of a. b has one column % written by Klaus Hartung % Lehrstuhl fuer allgemeine Elektrotechnik und Akustik % Ruhr-Universitaet Bochum % % Date 27.09.1995 c = diag(sparse(b)) * a; 
function [Ax, Ay] = CrystalID2LocalPosition(cID) %CRYSTALID2LOCALPOSITION Summary of this function goes here % Detailed explanation goes here %% % sub_array_bias = 8.9; % mm % % array_width = 16.8; % mm panel_width = 34.7; %mm array_width = 16.8; % mm sub_array_bias = panel_width/2-array_width/2; sub_array_edges...
%Low Speed Lab 1 %the purpose of this script is to import our raw data and formate the data %in graphs clc; clear all close all %read in and format data data = csvread("data2.csv"); rundata = zeros(57,3,2); runNum = 0; counter = 1; for i=1:length(data) if(data(i,4) ~= runNum+1) rundata(:,:,runNum+1) = da...
function learn_all_BLSregressors( Data,LearnedDistribution ,options) n_cascades = options.n_cascades; rms = zeros(n_cascades,1); BLS_regressors{n_cascades}.R = []; %%%start to learn the BLSregressors depending on the deltX distributions for icascade = 1:n_casca...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% %%%%% %%%% NICTA Energy System Test Case Archive (NESTA) - v0.7.0 %%%%% %%%% Optimal Power Flow - Typical Operation %%%%% %%%% ...
function y = normSubDiv(x, getX, getNData) if nargin < 2 getX = @(x,idxs) x(:,:,:,idxs); end if nargin < 3 getNData = @(x) size(x,4); end nChannels = size(getX(x,1),3); nn = GNN(lossMSE()); nn.addLayer(layerSubtractiveNormalization(nChannels),actLinear(),1,2) nn.addLayer(layerDivisiveNormalization(nChannels)...
function varargout = wtbxexport(varargin) % WTBXEXPORT MATLAB file for wtbxexport.fig % Last Modified by GUIDE v2.5 22-Jun-2009 17:14:45 % % M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 01-Mar-2007. % Last Revision 17-May-2012. % Copyright 1995-2012 The MathWorks, Inc. % $Revision: 1.1.6.14 $ $Date: 2012/06/...
%% 3-30-2018 - DJC generate sine waves to test TDT filtering abilities % using white matter (c) output to bnc % generate sine waves between 12 and 20 Fs = 24414; % sampling rate Hz % time each frequency timeFreq = 8; tTotal = timeFreq*Fs; t=0:1/Fs:timeFreq; t = t(1:end-1); freqVec = [12:20]; for freq = freqVec ...
clc; close all; clear all; t= [1 2 3 4 5 ]'; X = -1*t; Y = [ 0.7 0.43 0.32 0.19 0.15]'; Ys = log(Y); % MC [ theta ,Ym ] = mc( X,Ys ) Ymodi = exp(Ys); J = sum((Y-Ymodi).^2) J2 = sum((Ys-Ym).^2) % mcR [ theta,Yest ] = MCR( X,Ys ) Yest_reel = exp(Yest); figure; plot(Y,'g') hold on plot(Ymodi,'r') hold on plot(Yest_r...
%construct networks function [] = Networks(w) village = csvread(strcat('village',num2str(w),'.csv')); % Household ID's and Person ID's hhids = mod( village(:,1), 1000 ); pids = village(:,2); numHouseholds = max(hhids); households = zeros(numHouseholds,9); persons = 100*village(:,1) + village(:,2); %number of person...
function [v, f, n, name] = stlRead(fileName) %STLREAD reads any STL file not depending on its format %V are the vertices %F are the faces %N are the normals %NAME is the name of the STL object (NOT the name of the STL file) format = stlGetFormat(fileName); if strcmp(format,'ascii') [v,f,n,name] = stlReadAscii(fileN...
function [rxy] = CoordReal2Relative(xy,imsize) %function [rxy] = CoordReal2Relative(xy,imsize) % %intent: represent xy as a loctation relative within an image of imsize % the location xy = [1,1] would be the topleftmost pixel, and is representative of the % value of the image function at the absolute posi...
function [ReducedFeaturesMatrix, COEFF, NumOfPCs] = DimensionalityReduction( FeaturesMatrix, Labeling, varargin) %DIMENSIONALITYREDUCTION Reduces the dimensionality of N-by-P FeaturesMatrix matrix dimensionality. % Rows of FeaturesMatrix correspond to observations, columns to variables. % varargin{1} is the PCAD...
function statsLayoutChange(src,~,fig,datatype) %statsLayoutChange - switch between the two layout modes % Get the state of the button if ~isempty(src) value = get(src,'State'); switch value case 'on' % 'detail' % ...if on the change to the max detail view [locn] = statsLocatio...
function varargout=connectAlicat(aliComm) % function aliComm=connectAlicat(aliComm) % % Form a connection to the Alicat controller. If an argument is given then % the connection to the specified device is closed. % % % Rob Campbell - 20th March 2008 - CSHL if nargin==0 global aliComm aliComm=serial('COM1',.....
clear all; close all; clc; % Air/Physical properties bar = 1e5; k = 1.4; cp = 1000; R = 8.3144/(28.9647e-3); % Given values m_cor = 54.4; pp_total = 23; n_ad = 0.86; n_pl = 0.906; T01 = 304.8; P01 = 0.60496*bar; % Real mass flow rate, stage number and stage pressure ratio m = m_cor*(P01/101325)/sqrt(T...
function a=markov_map(seq,K,alf) % % function a=markov(seq,K); % a(j,k)= prob ( x(t)=k and x(t-1) = j) % alf = alpha-1 % ht=seq(1:(end-1)) + K*(seq(2:end)-1); n=hist(ht,1:(K*K)); a=reshape(n,K,K)+alf; asum=sum(a,2); a=a.*repmat(1./asum,1,K);
function Fsweep=FrequencyStepperHP(T, EXP); % FrequencyStepperHP - frequency stepper panel for HP stimulus GUI. % F=FrequencyStepperHP(Title, EXP) returns a GUIpanel F allowing the % user to specify a series of frequencies, using either be logarithmic or % linear spacing. The Guipanel F has title Title. EXP is ...
function makeConfMatPredict(cm,txtAct,txtPred) % Make a uniform looking confusion matrix % Calculate percentages prc = 100 * bsxfun(@rdivide,cm,sum(cm,2)); % Size of the matrices [sz1,sz2] = size(prc); % General colour map cmap = flipud(gray(100)); if sz1 >= 5 fs = 18; else fs = 24; end figure; hold on; i...
R=25:25:500; Rd1 = 100; bandwidth = NPowerdB = -174+10*log10(bandwidth); BSPower = 20000; freq = 3.4; power = 200; powerdB = 10*log10(power); C0 = zeros(3,20); SINR = 0; for i=1:20 SNR_BS_dB = BSPowerdB+121-pathloss(R(i),freq); SNR_BS = 10^(SNR_BS_dB/10); C0(1,i) = bandwidth*log2(1+SNR_BS)*1...
function [features] = eegFeatures(x,lf,uf,fs,varargin) %Let x be an row vector of eeg trials %features : Number of Trials x Number of features(Bands) Nf = 2048;%Number of Samples N = length(x);%number of trials features = zeros(N,uf-lf+1); df = fs/Nf;%band size bandSize = 1; if nargin == 5 ch = varargin{1}; else ...
function lcod_train_script(depth,t0) DATASET='USPS'; LEARNING_RATE.alpha=1; LEARNING_RATE.t0=t0; LEARNING_RATE.max_change=0.1; MAX_ITER=4000; ALPHA=0.5; NET_DEPTH=depth; NUM_CLASSES=1; CONV_THRES=1e-2; CONV_COUNT=Inf; ERROR_CHECK_ITER=100; if strcmp(DATASET,'USPS') n_sample=Inf; train_data=load('USPS Data/train_dat...
clc; clear; %%Team 2, Matlab and SparkFun Integration Code for Social Media Game %% Made by Jeffrey zhang Contact at zhang.junhe@husky.neu.edu %%Identifying the connected Arduino Board COM='COM3'; a=arduino(COM,'uno'); %%Reading the point images - for the code, not displayed point0=imread('point0.png'); point5...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Symmetry Based Analysis of Facial Expressions Partially Occluded Due to Head Motions % Version : 1.0 % Date : 01.2.2017 % Author : Mehdi Ghayoumi %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
function makeTuples( obj, key ) import vis2p.* % params shuffle = 5000; names = {'Out','In'}; % get traces [oriOut oriIn cells trials] [traces,oris] = getTraces(CenterSurOri,'key',key,'compute',1); % control error if isempty(traces) display('Nothing to compute!') return end % insertTraces key.oriTraces = t...
%% Find good clusters clear good_clusters; count = 0; for ii = 1:numel(psth_sahani) if psth_sahani(ii).NPSP < 40 count = count + 1; good_clusters(count,1) = ii; good_clusters(count,2) = psth_sahani(ii).NPSP; end end good_clusters = sortrows(good_clusters,2); %% Plot the results row = 5; ...
% checkabort % check whether abort key was pressed % % Hanneke den Ouden % Donders Institute for Brain, Cognition and Behaviour % h.denouden@gmail.com % % version 02-08-2012 %========================================================================== [keyIsDown,~, keyCode]= KbCheck; if keyIsDown && any(find(keyCode)...
% This file contains parameters used to % 1) Configure the scripts to the lab % 2) Prepare labels for plotting % ---------------------------------------- % LAB: SET UP FOR YOUR OWN LAB! % ---------------------------------------- % ================================= % SECTION 1: LAB CONFIGURATION % ======...
%========================================================================== function [out]=f_charge_e(mesh,kgrid,SB1,EFn,eDensity_target) %========================================================================== % kB = 1.38D-23; % Boltzmann constant, J/K Q = 1.6021917D-19; % electron charge T = 300; ...
%---------------------------------------------------------------------- % Experimemtal setup %---------------------------------------------------------------------- % check for operating system os = computer; % determine the OS if strcmp(os(1),'P') % check if PC or mac and change path accordingly...
function [m, bl] = model_add_block(m, varargin); % Add a block of parameters to the model. % [m, bl] = model_add_block(m, varargin) % % Return values % m Updated model % % Arguments % m Model to update % varargin (key, value) pairs that can specify the following: % key v...
function Vnn = nucnucrepulsion(atoms, xyz_a0) % Vnn = nucnucrepulsion(atoms, xyz_a0) % % Input: % atoms list of element numbers (array with K elements); e.g. [6 8] for CO % xyz_a0 K×3 array of Cartesian coordinates of nuclei, in bohr % Output: % Vnn total nuclear repulsion energy, in hartrees Vnn = 0; for...
%% Stelling 11 % % De onderstaande code om een bestand genaamd 'output.asc' % aan te maken werkt niet omdat het functie argument % '-ascii' ontbreekt. % % ======= Code ======= % tijdve...
classdef NdgQuadFreeStrongCentralVisSolver3d < NdgAbstractVisSolver % At present, only the vertical diffusion term is considered, both the % wind term and the friction term need to be added here and not the % source term part properties( Access = protected ) M invM end metho...
function [testOutcome] = testRCNN(testTable, RCNNModl, FrameData, imgPerm, ... labelsName, bbox, score, label, nTest, startIndx) % runs detect over all images in test-batch, and returns frames with % labels. Shows a few examples with boxes detected and real side by side % and allows to save them...
%% Atmosephere Modeling %% Variables P_SI=1.01325*10^5;%pressure in SI RO_SI=1.225;%density in SI T_SI=288.16;%temperature in SI g_SI=9.81;%garvity const in SI R_SI=287; P_EN=2116.2;%pressure in English Unit RO_EN=0.0023769;%density in English Unit T_EN=518.69;%temperature in English Unit g_EN=32.174;%garvity const in...
function [ mapTrain ] = introTSNE(xy,idx) %introTSNE - starting point for tSNE analysis % Determine the input arguments [xy,idx,train] = generateData; % xy = rand(2000,10); % Set some tSNE parameters numDims = 2; initDims = 2; perplex = 100; %[xy,idx,train] = generateData; %xy = rand(2000,10); % Set some tSNE parame...
function [dXdt,u,F] = dyn_stance(t,X,p) % --- parameters --- params = p.params; tTD = p.tTD(1,end); % touchdown time ptTD = p.ptTD; % touchdown toe position Tst = p.Tst; M_r = p.M_r; B_EMF = p.B_EMF; if ~p.isMotorDynamics % if not adding motor dynamics M_r = 0*M_r; B_EMF = 0*...
function [q,out_param] = integralsim_g(varargin) %INTEGRALSIM_G 1-D guaranteed function integration using Simpson's rule % % Description % % q = INTEGRALSIM_G(f) computes q, the definite integral of function f on % the interval [0,1] by Simpson's rule with in a guaranteed absolute % error of 1e-6. Default starti...
function s_toe_con = s_toe_con(in1,s_toe,th) %S_TOE_CON % S_TOE_CON = S_TOE_CON(IN1,S_TOE,TH) % This function was generated by the Symbolic Math Toolbox version 8.4. % 24-Jun-2020 17:51:34 q1 = in1(:,1); q2 = in1(:,2); q3 = in1(:,3); q4 = in1(:,4); q5 = in1(:,5); q6 = in1(:,6); t2 = q1+q2; t3 = q3+q4+t2; t4 ...
load('WSOurilandia90-97NovasNuvens.mat','Magnitude'); [c1,c2,Ourilandia9097fase1]=fcm2(Magnitude); binOurilandia9097 = ones(size(Magnitude)); binOurilandia9097(Magnitude <= (c1+c2)/2) = 0; figure,imshow(binOurilandia9097,[]) binOurilandia90972 = zeros(size(Magnitude)); binOurilandia90972(Magnitude > c2) = 1; figure,...