text
stringlengths
8
6.12M
%script to create voltage vs soc curves from battery models LoadCurrent_Max = 40; LoadCurrent_Step = .5; SimulationTime = 3600; LogSimData_FileName = "model_sim_12_v_vs_soc_"; hiddenLayerSize = 10; Load_Simulation = 'Load_Simulation_07'; % Array of Neural Net Structures containing performance data NNs = {}; % Run ba...
% CH2 Solving the real business cycle model % % ECON 6140, Karel Mertens, Cornell University %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear all; close all; % Utility function: u(C,L)=log(C)+thetal*log (L) % Production function Y = AK^(1-alpha) (XN)^alpha % The Euler conditions are: % 1/C(t) ...
function y = mvgaussian_pdf(x, mu, sigma) % MVGAUSSIAN_PDF Computes multivariate normal pdf % Inputs % @x Samples in a NxM matrix where N is the dimensions and M is the % number of samples % @mu The mean of the distribution % @sigma The covariance matrix for the normal ...
function [out,re_out,im_out,info1,info2,info3,ind]=filterraw(pfilename, bad_range ,fastrecflag, showData) % Usage ... [out,re_out,im_out,info1,info2,info3,ind]=filterraw(pfilename, bad_range ,fastrecflag, showData) % % this file zeroes the frequencies indicated in the range (a vector of % numbers) % in all the frames o...
function [optLambda] = getOptLambda(X, Y, setPara) % Get the optimal lamda % % INPUTS: % X(MxN) : trData(i,j) is the i-th feature from the j-th trial % Y(Nx1): trData(j) is the label of the j-th trial (1 or -1) % setPara : Initialized parameters % setPara.t % setPara.zeta %...
function [e] = R2(x, y, mask) %R2 [e] = R2(x, y, mask) narginchk(2, 3); if nargin < 3 x = vec(x); y = vec(y); else x = x(mask); y = y(mask); end e = 1 - sum((x - y).^2) / sum((y - mean(y)).^2); end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Author : Muhammad Nadzeri Munawar % % %This code is to create absolute_power variable of subject no. 20 such as : %delta, theta, alpha, beta, gamma with shape 32x5x40. 32 mean total of %channel, 5 mean total absolute power, 40 mean 40 trial % % project_path -> 'D:\TUGAS AKH...
%% ucb = ucboard('COM5'); %% delete(ucb); clear('ucb'); %% ucb.sendCmd('?VER'); %% N = 100; for k = 1:N ucb.sendRaw('?VER'); end % for k
function Nodes = GetChebyshevNodes(Number,Start,End) % Function Name: % GetChebyshevNodes % % Toolbox: % Integration % % Purpose: % Produce a vector of Chebyshev nodes for use in numerical integration. % % Uses: % % Nodes = GetChebyshevNodes(Number); % % Produces a vector %Number% long spanni...
%% example script AOADMM for CMTF with Frobenius loss % In this example, we create a synthetic dataset consisting of one CP tensor % of order 3 (modes 1,2,3) and size [50,30,40] with 4 components and a matrix (modes 4,5) of size [50,70] with 3 components. They are % coupled in the first mode, i.e. mode 1 and 4 have 3 ...
function result = micrographMRA_heterogeneous(y, sigma, L, K, list2, list3, ... X0, gamma0, gamma_fixed, n_init_optim) % Collect the moments from the micrograph. T = tic(); [M1, M2, M3] = moments_from_data_no_debias_1D_batch(y, list2, list3, 1e8); %! We normali...
%% Inclass assignment 2 % 1. a. fill in this loop with a conditional statement so that it displays % only the odd numbers for ii = 1:20 if mod(ii, 2) ~= 0 disp(ii) end end % b. Write a new loop to display the same odd numbers which doesn't use a conditional statement for ii = 1:2:20; disp(int2s...
[filename, pathname] = uigetfile({'*.txt'}); fname = [pathname filename]; filetext = fileread(fname); expr = '[^\n]*Image:[^\n]*'; matches = regexp(filetext,expr,'match'); sz = size(matches); coordinates = zeros(sz(1,2),3); % variable for holding coordinates for i = 1:sz(1,2) Str = char(matches(1,i)); ...
function [resp_obj_z,resp_obj_z_3D] = fun_ResZscoreRe(resp_reshape,face_idx,numCLS,numIMG) resp_obj = resp_reshape(face_idx,1:numCLS*numIMG); resp_obj_3D = zeros(length(face_idx),numCLS,numIMG); for ii = 1:numCLS resp_obj_ii = resp_obj(:,(ii-1)*numIMG+1:numIMG*ii); resp_obj_3D(:,ii,:) = resp_obj_ii; end ...
function lap=EffectiveLAP(deltavis,rg,mu0,Z,varargin) %solve for effective lap concentration of dust (ppmw) given deltavis %only scalar input/output %you must run this in a loop for images, cubes, etc %inputs, all scalars %deltavis, 0 to 0.40, expressed as a fraction, eg 0.05 %rg - grain radius, um, 30-1800 um, e.g. 50...
function [ExpOut,fjac] = ExpR(r,rf,W0,Wmin,alpha,gamma,w) %This function computes the expectation given parameters. % INPUT: % r: Txn matrix of returns % rf: scalar of risk-free rate % W0: scalar of initial wealth % Wmin: scalar of minimum wealth % alpha: nx1 vector of portfolio weights % gamma...
function DataMat=singleblock(window,windowRect,fresh_interval,instr_index,target_ctg_No,tgt_num,T,para_id) %Single Block Presentation %N:number of images in a single block %target_num:number of target images in a block %tgt_loc:location of target images in a block(1-2).1.not in first/last 5 %images;2.interval of at lea...
function varargout = band(varargin) % band Line-and-band graph for tseries objects. % % Syntax % ======= % % [Ln,Bd,Range] = band(X,Low,High...) % [Ln,Bd,Range] = band(Range,X,Low,High,...) % [Ln,Bd,Range] = band(Ax,Range,X,Low,High,...) % % Input arguments % ================ % % * `Ax` [ nume...
function deriv_wrt_Gd_conc = compute_deriv_enhancement_wrt_Gd_conc(Gd_conc, T10, flip_angle, TR, TE) deriv_wrt_Gd_conc = []; % Check that Gd conc is a row vector if size(Gd_conc,1) ~= 1 disp(sprintf('Gd conc should be a row vector', mfilename)); return; end T = length(Gd_conc); % Check that only a single T10 v...
function plot_car(x, y, theta, phi, l, w, color) if nargin < 7 color = 'y'; end scatter(x, y, ['+', color]); wheel_len = 0.25 * l; offset_w = 0.8 * w; offset_l_rear = 0.3 * l; offset_l_front = 1.3 * l; rot = [cos(theta), -sin(theta); sin(theta), cos(theta)]; lf = [x; y] + rot * [ offset_l_front; offse...
%求逆矩阵 %用法 B=inv(A) 其中A为数值或符号方阵,B返回A的逆 %例如 % inv([1 2;3 4]) %数值 % syms a b c d;inv([[a,b;c,d]) %符号 % %INV Matrix inverse. % INV(X) is the inverse of the square matrix X. % A warning message is printed if X is badly scaled or % nearly singular. % % See also SLASH, PINV,...
%generates a random impedance progress for the system and a random energy consumption. %nt: number of transmitting devices %nr: number of receiving devices %nSlots: number of time slots %maxId: vector where maxId(i) is the maximum discharge current for device i %sparsity: a scalar that varies between 0 (very sparce ind...
function E = EssentialMatrixFromFundamentalMatrix( F,K ) %ESSENTIALMATRIXFROMFUNDAMENTALMATRIX Summary of this function goes here % Detailed explanation goes here [U,~,V] = svd(K.'*F*K); % Enforcing essential matrix singular values E = U*diag([1 1 0])*V.'; end
% % 最大持续亏损次数,输入参数R是交易盈亏情况 function maxConLossTimeRet = maxConLossTime(R) R(R<0) = -1; if R(end) == -1 R = [R;1]; end indexMax = 0; maxTemp = 0; for i = 1:length(R) if R(i) == -1 maxTemp = maxTemp + 1; else...
function [network] = removeUnusedMetabolites(network) %% Author: J. Goldford % S = ~~network.S; to_remove = sum(S,2) == 0; network.S(to_remove,:) = []; if isfield(network,'compounds') network.compounds(to_remove) = []; else network.mets(to_remove) = []; network.b(to_remove) = []; end end
conf = dsp2.config.load(); epoch = 'targacq'; load_path = fullfile( conf.PATHS.analyses, 'onslow_pac', epoch ); mats = dsp2.util.general.load_mats( load_path ); pac = dsp2.util.general.concat( mats ); pac = pac.add_field( 'method', 'cfc' ); pac = pac.append( mi_pac ); mi_day = unique( pac('days', pac.where('mi')) ); ...
% CLASSIFYRF Classify data with random forest classifier. % OUT = CLASSIFYRF(MODEL) classifies out-of-bag data by using a random % forest classifier, where MODEL is a structure with the RF parameters. % OUT is a structure with both the votes and the class labels assigned to % each sample in the original datas...
%Syntax % [N, err] = PS_GetNStim() % Description % Gets number of available Plexon electrostimulators. The maximum number of stimulators you can work with is four % Returns: % 0 - OK % N - updated with the number of avilable Plexon Stimulators
function [ FSMC_L2 ] = FSMC_L2( control, SNR ) %This function creates an object containing all the information required %to describe a Markov chain per month. The Markov chain captures the %behaviour of the passed in SNR values. % INPUT: m x 1 SNR: vector containing the SNR values % OUTPUT: 1 x...
%> Khan AA, Lai W. Modeling shallow water flows using the discontinuous %> Galerkin method. CRC Press; 2014. %> classdef ParabolicBowl1d < SWEConventional1d properties(Constant) hmin = 1e-3 gra = 9.81 a = 3000 h0 = 10 B = 5 end methods function obj ...
function [ expanded ] = matrix_expand3( matrix , integer) %MATRIX_EXPAND Expands a matrix in size by a given integer in the 3rd %dimension % Given an N x M x P matrix, matrix_expand will convert it to % an N x M x integer * P matrix with entries duplicated % to fill the new space. % Michael Hutchins - 6/13/2012...
function [BvF, BvT] = cp_2dbv(Block_length, N_startf, N_finalf, NumDCS, NumDCTC, F_Warp_Fact, T_Warp_S, T_Warp_E, ... BVF_flag, BVT_flag, EnNorm_flag); % Advanced version of comp_feat.m by adding DCS_length changing paras % adding energy increasing % This comp_feat has a function to compute a [i, j, k] fea...
% author: Tyler Thompson % date: 2/6/2019 % description: ECE4550 Matlab Assignment #1 Problem 2 clear; close all; n = 0:60; f = 0.1; f1 = sin((pi*n/3)*f); f2 = n>=0; % unit step function figure(1) % part A plot subplot(1,2,1) stem(n,f1) grid on title('Part A: x(n)=sin((pi*n/3)*f)'); xlabel('n'); ylabel('x(n)'); %...
% 6. 已知y1=x*x,y2=cos(2*x),y3=y1*y3;,完成下列操作: % (1)在同一坐标系下用不同的颜色和线性绘制三条曲线。 % (2)以子图形式绘制三条曲线。 % (3)分别用条形图(bar)、阶梯图(stairs)、杆图(stem)和填充图(fill)绘制三条曲线。 % (1) x=-10:0.1:10; y1=x.*x; y2=cos(2*x); y3=y1.*y2; % figure % hold on % plot(x,y1,'r--') % plot(x,y2,'g:') % plot(x,y3,'b') %(2) % subplot(2,2,1) % plot(x,y1,'r--') % subpl...
function [x] = AffSub_solveNormal(w, Ais, Cis) numSubspace = length(Ais); A = zeros(size(Ais{1})); b = zeros(size(Cis{1})); I = eye(size(A)); for i=1:numSubspace Mi = (I-Ais{i}); A = A + w(i)*Mi; b = b + w(i)*Mi*Cis{i}; end x = A\b; end
%////////////////////////////////////////////////////////////////////////// % Computes CIF (clustering improvement factor) across syndrome_labels given an arbitrary struct of entries of interest % % adapted from ./PROJECT/PACS1_CASE/TEST_CODE_PROOF/MASTERSCRIPT.m % adapted 140319 to use SSRF_compute_factor_multiple.m w...
% adapt1_plotstim randStimFlag = get(H.Adapt1_randStimFlag,'value'); nEpochmsecs = XStimParams.epoch_duration; % durations for epochs1 and 2 SPLs_1 = 10 + XStimParams.SPL1; % SPLs for epoch1 and epoch2 SPLs_2 = 10 + XStimParams.SPL2; silence_lead_pts = (XStimParams.silence_lead * round(TD...
function nlp = Time(nlp, varargin) plant = nlp.Plant; T = SymVariable('t',[2,1]); tf = SymFunction(['time_' plant.Name],T(2),{T}); addNodeCost(nlp,tf,{'T'},'first'); end
function [ output_args ] = Helper_GetSpecificValue( tdb, value, output ) %Helper_GetSpecificValue get a specific .mat database, a searchvalue and %and output, to extract certain values out of the complete database % Helper_GetSpecificValue('textures_alle.mat', 'Zoom', % 'textures_Zoom.mat') % Changelog: - [07.0...
function[CD_LandP]= LandP(CD_Parasitic) %This function evaluates the Leakage and Protuberance Drag on the a/c CD_LandP=1.035*CD_Parasitic; end
% "an example where ugpdc3 is 6times greater than GC" A2d = -[0 0 0.1; 0 0 -5; 0 0 0.95]; D = diag([1 1 1]); ARroots(A2d); od = 200; fftlen = 8192; S = A2S(A2d, D, fftlen); R = S2cov(S, od); GC = RGrangerT(R) ugpdc = uGPDC_A(A2d, D, fftlen); ugpdc3 = real(mean(log(1+ugpdc.*conj(ugpdc)),3));ugpdc3 = ugpdc3 - diag(...
function plotYscale( maxFR, x, y ) if maxFR<30 halfRate = floor(maxFR/2); elseif maxFR > 140 halfRate = 60; elseif maxFR > 100 halfRate = 40; else halfRate = 20; end scaleHeight = (halfRate/maxFR); plot([x x],[y scaleHeight+y],'LineWidth',3,'Color','k') xRange = range(get(gca,'XLim')); text(x-.02*xRange, y...
function out=concatenatedatasets(in1,in2) % Append two struct-based datasets variable-by-variable % If the input data is not a struct, return error if ~isstruct(in1) || ~isstruct(in2) error('Error: requires struct input.') end if isempty(fieldnames(in1)) out = in2; elseif isempty(fieldnames(in2)) out = in...
function [result,remainder]=integer_div_mod_negs(m,n) remainder=m; result=0; if m>0 && n>0 while 1 if remainder-n > 0 result=result+1; remainder=remainder-n; else break; end end elseif m<0 && n>0 ...
function HabituationPhase_MC % This protocol presents the mouse with two stimuli, a valve click (from odor valve module) and a water click. % Written by Marco Colnaghi and Riccardo Tambone, 05.27.2021. % % SETUP % You will need: % - A Bpod. % - An Olfactometer. % - A Lickport. % To be presented on DAY 0. global Bp...
function [ ch ] = centroidDist( cenOne,cenTwo ) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here ch=sqrt((cenOne(1)-cenTwo(1))^2 +(cenOne(2)-cenTwo(2))^2); end
% % f: tone/sine frequency. % amp: amplitude of sine wave. % fs: sampling frequnecy of sine wave. % function [t,y] = create_sine_wave(f,amp,fs,T) ts=1/fs; t=0:ts:T; y=amp*sin(2*pi*f*t); sound(y,fs)
load('lsdata.mat','-ascii') x = lsdata(1,:)'; y = lsdata(2,:)'; ynoisy = y +.1*randn(size(x)); A = lsdata; plot(x,y,'.'); hold on D = A'*A; e = A'* ynoisy'; c = D\e; yfit = c(1).*x + c(2); plot(x,yfit,'X')
% stat plots script file load dump_stats_all_t dc=d.e.counts-d.s.counts; dur=d.e.time-d.s.time; dur=dur'; st=[d.s.v1t(:,1), d.s.v2t(:,1), d.s.v3t(:,1), d.s.v4t(:,1)]; et=[d.e.v1t(:,1), d.e.v2t(:,1), d.e.v3t(:,1), d.e.v4t(:,1)]; dt=et-st; % duration plot plot(d.s.time,dur) title('Dump Durations') xlabel('Date') ylab...
function Candidate_P = Find_Cadidate_P_in2GW(P1,P2,GW_Pathloss_perPixel,CoverRange_perPixel,GW_Serve_Limit,TxP_Thres,User_Served) % GW_Serve_Limit = (6-1)*3/0.25; [Sort_P1,~] = sort(GW_Pathloss_perPixel(P1,:),'descend'); ServedRange_Thres = max(TxP_Thres,Sort_P1(GW_Serve_Limit)); Served_P1 = find(GW_Pathloss_perP...
context = Z_C1(:,9); dC = diff(context); SwitchTrial = find(dC~=0); % switch occurs after this trial if length(SwitchTrial) == 1 RangeC1 = 1:SwitchTrial; RangeC2 = SwitchTrial+1:size(Z_C1,1); elseif length(SwitchTrial) == 2 RangeC1 = 1:SwitchTrial(1); RangeC2 = SwitchTrial(1)+1 : Sw...
function [b rsq p_sq beta_distMatrix] = eigenDMA(vox_pattern,modelRDM) %decompose voxel pattern into eigenvectors and run a regression on their %RDMs %Output %b = beta values for each eigen rdm %rsq = overall r-sq val for model %s = 'sparseness' val %Andreas Marouchos 2014 [U S V] = svd(vox_pattern); for n=1:leng...
function download(obj, varargin) % DOWNLOAD Method to download CloudAppendBlob(s) % Use this method to download a CloudAppendBlob or an array of CloudAppendBlobs if % a vector input is provided. If no argument is provided the current working % directory will be used as the download destination and the blob name will be...
function xout = lorenz96(xin) % xin should be a vector global F N=size(xin,1); xout=zeros(N,1); %first the 3 edge cases: i=1,2,N xout(1)=xin(N)*(xin(2)-xin(N-1))-xin(1); xout(2)=xin(1)*(xin(3)-xin(N))-xin(2); xout(N)=xin(N-1)*(xin(1)-xin(N-2))-xin(N); %then the general case for i=3:N-1 xout(i)=xin(i-1...
function [classCube, classLabels] = UpdateClassSampleCubes(className, dataCubeSample, dataLabels, existOnWs) % Combine training data cubes to prepare final traing data sets for % each class. dataCubeName = strcat(className, '_cube_Ref'); labelCubeName = strcat(className, '_labels'); ...
function [hmm,fe] = dropstate(hmm,k,X,T) K = length(hmm.state); no_k = setdiff(1:K,k); K = K - 1; hmm.state(k) = []; hmm.K = K; hmm.Dir2d_alpha = hmm.Dir2d_alpha(no_k,no_k); hmm.Dir_alpha = hmm.Dir_alpha(no_k); hmm.prior.Dir2d_alpha = hmm.prior.Dir2d_alpha(no_k,no_k); hmm.prior.Dir_alpha = hmm.prior.Dir_alpha(no_k); ...
load H2ext rout=int16(zeros(2,1024^2)); L=512*512; rout(:,1:L)=routxy; tem=[routxy(2,:)+512; routxy(1,:)]; %[tem(:,1) tem(:,262144)] rout(:,L+1:2*L)=tem; tem=[routxy(2,:)+512; routxy(1,:)+512]; %[tem(:,1) tem(:,262144)] rout(:,2*L+1:3*L)=tem; tem=[513-routxy(1,:); (513-routxy(2,:))+512]; %[tem(:,1) tem(:,262144)] ro...
function [mov5d, dimLabels] = parseScanimageTiff(mov, siStruct) % Nomenclature: frames and slices refer to the concepts used in % ScanImage. For clarity, the z-dimenstion in the tiff is therefore % called "tiffPage" here. [height, width, nTiffPages] = size(mov); fZ = siStruct.fastZEnable; nChannels...
function A = jac3DoF(x, u, trajData) prm.m = 4.5; prm.S = 0.473; prm.CD0 = 0.0173; prm.CD1 = -0.0337; prm.CD2 = 0.0517; prm.p_exp = trajData.p; % evaluate jacobian U = [u, trajData.VR]; Z = x; A = JacEval(Z, U, prm); if(trajData.p == 0.25) A = [A(1:3,1:3), A(1:3,6); A...
ts_conn = importdata('data/rsfmri-dataset2/sub015.txt'); test = standard_sliding(ts_conn, 50); figure imagesc(squeeze(test(1,:,:)))
%% %%###################################################################### %% %%################ Define Sizes Here ########################## %% %%###################################################################### dimx=2; %% number of states dimu=1; %% number of inputs dimec=0; ...
function [d,netcdfInfo] = loadByDate(startDate,endDate,varargin) %LOADBYDATE Loads the Amdar files for the date range of interest. % %INPUTS: % startDate - Integer in Matlab date format. % endDate - Integer in Matlab date format. % varargin - Optional arguments, passed to Amdar.load() % %OUTPUTS: % d - Structure c...
function main(sourcePath, destinationPath, visualize, smoothing, quantization) %MAIN Transcribe drums into a MIDI file given an audio file. % Create a MIDI file transcription of the drums contained in the input % audio file. sourcePath should be the path to an audio file, % destinationPath is the path to the crea...
% Inicio v = F(x0) M = inv(DF(x0)) % Inversa Jacobiano s = - M*v; x = x0+s; % Paso de Newton incr = norm(s); while incr > tol w = v; % F(x(k-1)) v = F(x); y = v-w; % F(x(k)) - F(x(k-1)) z = - M*y; % -inv(A(k-1))*y(k) p = - s' *z; q = s' *M; % s(k)'*inv(A(k-1) R = (s+z)*q/p...
% testing accessing a variable several levels outside of the scope var x:int; fun outer(a:int):int { fun middle(a:int):int { fun inner(a:int):int { begin return x * (1 / 2) - a; end }; var y:int; begin y := inner(a); if (x =< y) then y := x * x else y := x - 2; return y; end...
run('identification_init'); % Subspace model close all; disp('Testing SUBSPACE model ...'); nx = 3:20; [model, fit, aic_value, mag, wout ] = fun_subspace_model(nx,... preprocessed_prbs_est, preprocessed_prbs_val, true) figureNumber=5; fun_bode_plot(wout,mag,'subspace model',figureNumber);
% Timothy Smith % Averaging FFT analyzer figure subplot(2,1,1) plot(NFreq,1E3*DbV,'m') xlabel('Frequency') ylabel('Voltage Spectral Density (mVrms/{\surd}Hz)') t=title( 'Before Averaging'); set(gca,'XTickLabel',{'0','10kHz','20kHz','30kHz','40kHz','50kHz','60kHz','70kHz','80kHz','90kHz','100kHz'}) subplot(2,1,2) plot...
function stat = reconstructBurstStats(feat,support,featInd) stat = nan(2,numel(feat)); for i = 1:numel(feat) if ~isnan(feat{i}{1}) [ampMeanSTD(1),ampMeanSTD(2)] = pdfExpVal(feat{i}{featInd},support{featInd}'); stat(:,i) = ampMeanSTD; else stat(:,i) = nan; end end stat = nanmean(stat...
basedir = '/home/sheng/workspace/DeepCNNData/cifar/out/'; trainCostFilename = [basedir, '/train_totalCost.txt']; testCostFilename = [basedir, '/test_totalCost.txt']; costOutfilename = [basedir, '/totalCost.png']; trainCostFile = fopen(trainCostFilename, 'r'); if(trainCostFile < 0) disp(['Cost file ', trainCo...
% Ogrenci No: 185112007 % Ad Soyad : Gafur HAYYTBAYEV close all ; clear all ; clc ; % verilmis fonksyon %fx = (x^3) + (x^2) - (12 * x); % fonksyon turevi %fxd = (3 * x^2) + (2 * x) - 12; % aralik a = 2; b = 4; % durma kosulu h = 0.0001; iter = 0; while abs(a - b) > h fa = (a^3) + (a^2) - (12 * a); fb =...
function oddball_analyse(EEG, scaling, title_str, savefig, savestr) width = 4.25; height=3.75; % Select only relevent channels of data EEG = pop_select( EEG,'channel',{'Channel 1'}); EEG = pop_eegfiltnew(EEG, [],0.5,[],true); %HP filtering EEG = pop_eegfiltnew(EEG, [],20); %LP...
close all; clear all; fid = fopen('data_mgd2DKSE','r'); output = textscan(fid,'%*s %f %*s %f %*s %f'); fclose(fid); col1 = output{1}; col2 = output{2}; col3 = output{3}; M = col1(1); N = col2(1); dt = col3(1); Tfinal = col1(2); p = col2(2); q = col3(2); alpha = col1(3); beta = col2(3); gamma = col3(3)...
clear, close all; clc; addpath( 'kernel' ); addpath( 'numerics' ); addpath( 'helper' ); addpath( genpath('scripts') ); %###################################################### % This code is part of the Matlab-based toolbox % OPTIK --- Optimization Toolkit % For details see https://github.com/andreasmang/optik %###...
function pLabels = predictKNN(KNNmodel, testingF) %PREDICTKNN Function takes a K-nearest neighbour model as argument % and returns the predicted label(s) for input data. % % P = predictKNN(MODEL, TESTDATA) returns vector P containing 'n' % number of labels where 'n' is the number of examples inputed % % MOD...
function SortedInsDataArray = getSortedInsData(thisInsData) %getSortedInsData 获取数据文件不同排序后的更新数据 % 输入 % thisInsData 待排序的instance数据 % 输出 % SortedInsDataArray 排序后的instance数据 %% function getSortedInsData(thisInsData) idxCus = {}; idxVeh = {}; % NOTE 核心 修改customer和vehicle顺序 % idx : ...
function lower_layer = buildLowerLayer(gen_rules) num_rule = 2; num_category= size(gen_rules.W2,1); nlatent = num_rule*num_category; lower_layer = nnSetup([size(gen_rules.W1,3),nlatent]); lower_layer.W{1}(:) = 0; lower_layer.b{1}(:) = 0; %Set weights for i=1:num_category [~,idx]...
%The following script is for Math 6230: Differential Games and Optimal %Control. The script solves the first numerical problem. The problem is %implement the Marker/Particle Method in a programming enviorment of your %choice. Use it to advance (A) the curve y=sin(x) moving upwards with F=1 ; %(B) a unit circle expandin...
function [] = assert_mission_struct(mission) r = global_jess_engine(); if iscell(mission.instrument_list) instr_list_str = StringArraytoStringWithSpaces(mission.instrument_list); else instr_list_str = mission.instrument_list; end call = ['(assert (MANIFEST::Mission (Name ' char(mission.name) ')' ... ' ...
for k=4:length(STANDARD) cellContents=STANDARD{k}; RF_X{k-3}=cellContents(1:20); RF_Y{k-3}=cellContents(21:33); RF_Z{k-3}=cellContents(34:46); end
1; function [y, dy] = exactResult1(f, T, x) y = (f / (2*T)) .* x .* (1 - x); dy = (f / (2*T)) * (1 - 2 .*x); endfunction function [y, dy] = exactResult2(k, x) num = exp((x - 1) ./ k); denom = (exp(-1/k) - 1); % y = (num - 1) ./ denom; t1 = exp(x./k); t2 = exp(1/k); y = (t1 - t2) / (1 - t2); dy = (...
clear all; % close all; % cam_t = [-4,5,5]' % cam_r = [2.7,0.15,-1.7] cam_t = [-3,0,10]' cam_r = [3.14,0.35,1.57] rot = rotmat3d(cam_r(1),cam_r(2),cam_r(3)) t = cam_t K = camProjMat(609,609,305,225) points3d = [1,0,0; 0,-1,0; -1,0,0; 0,2,0; 0,5,0;]; points3d = [-0.33,0.1,0; 0.33,0.1,0; ...
function segments = getSegments(idx) % GETSEGMENTS % Returns the continous lines on an idx image % % Part of a *FAILED* approch to segmentation optimization by genetic % optimization. % % Writen by Markus Mayer, Pattern Recognition Lab, University of % Erlangen-Nuremberg, markus.mayer@informatik.uni-erlangen.de % Ini...
%Form_Directory_List %Required for Browser usage %Changes 'string' property to the current directory listing dlist = dir; set(hbrowser,'String',str2mat(dlist(1:length(dlist)).name));
clear close all clc x = load ('DataN.txt'); t = 1:2000; x = x(t); figure plot(t, x) title('ECG signal before filtering') ylabel('Amplitude') %plotting the raw ECG signal data print('Before_Filter.jpg','-djpeg') w = 50/(256/2); bw = w; [num, den] = iirnotch(w,bw); x_notch = filter(num, den, x); figu...
function y = iseven(n) if floor(n/2)*2 == n y = 1; else y = 0; end end
function move_dummys go_back = pwd; subs = 47:48; base_dir = '/projects/crunchie/hipp/wavepain/'; run_dir = {'run001/mrt/dummy/', 'run002/mrt/dummy/'}; for sub = subs name = sprintf('sub%03d',sub'); for run = run_dir path = fullfile(base_dir, name, run); cd(path{1}); ...
close all; clear all; clc; load('spikes.mat'); % Plot all spikes on same plot figure('Color','w'); for i=1:6000 plot(spikes(i,:)); hold on; end %verify axis labels set(gca,'XLim',[0 100],'XTick',linspace(0,100,9)); xticklabels({'0' '0.25' '0.5' '0.75' '1' '1.25' '1.5' '1.75' '2'}); xlabel('Features as Time');...
x = linspace(0,65,4000); load('speed_anna'); plot(distance_km, speed_kmph); hold on plot(x,velocity(x,'speed_anna'),'--'); xlabel('km'); ylabel('km/h'); hold off
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %manipulate the mutual information by injecting malicious data points addpath /home/hengl/matlab/bin/scripts/ITAFS/source/ index = 4; limit = 0.2; %maximal percent of points we want to inject fid = fopen('/home/hengl/matlab/bin/scripts/ITAFS...
% Visualises the HDM priors for comparison against Friston et al. 2000 % Get priors % ------------------------------------------------------------------------- n_inputs = 1; M.B0 = 3; M.age = 18; [pE,pC,D,is_logscale] = spm_hdm_priors_hdm2(n_inputs,M); is_logscale = logical(spm_vec(is_logscale)); % Unpack % -------...
function R = Fie0_packet_drop(beta,epsilon,N,k,kernel,RHS1,AbsTol,RelTol) %N is the truncation, some large number %k is the threshold, k << N rescaled_RHS1=@(x) RHS1(x)/beta; scalar=1/beta; %define discontinuous kernel due to packet drop kernel_packet=@(e,x) epsilon*kernel(e,x).*(abs(e)>=k)+kernel(e,x).*(abs(...
function varargout = ltr( glob ) if (nargin < 1) glob = '*'; end directoryName = pwd(); s = dir( fullfile(directoryName, glob) ); tf_isCWD = strcmp('.', {s.name}); tf_isParentDir = strcmp('..', {s.name}); s(tf_isCWD | tf_isParentDir) = []; if isempty(s) if nargo...
function [EVs, EC] = EvalObjGA( D,Px,Pl,Cd ) %{ Evaluate solutions INPUT: D: decision rules to be evaluated - Nsol x Nx matrix Px: probability matrix for comp's (members) Pl: probability vector for Load Cd: cost matrix for comp's OUTPUT: EVs: E[Vs|d] - Nsol x 1 vector EC: E[C|d] - Nsol x 1 vecto...
function [fin, x_steps, counter] = modPRalg(maxsteps, x0, eps, beta, sigma, delta1, delta2, f, g) % Test, ob alle Parameter im passanden Bereich sind if (eps<0 || beta<=0 || beta>=1 || sigma<=0 || sigma>=1 || delta1<=0 || delta1>=1 || delta2 <=1) error("one of your chosen parameters does not fit the re...
% Exercise4 % ソローモデルのダイナミクスをプロット %変数 g = 0.05; n = 0.1; alpha = 0.33; rho = 0.05; delta = 0.4; %s = 0.3; %k=0:0.01:0.1; %kplus = s*k.^alpha - (n + g + delta).*k; %for i=1:3 %s = 0.3; s=0.3 k=0:0.001:1; kplus = s*k.^alpha - (n + g + delta).*k; plot(k,kplus,k,k) hold on title('transition') xlabel('kt') ylabel('...
% Problem 2.1 - question 2 % x2(n) = sum_{k=-5}^{5} e^{-|k|}*dirac(n-2k), -10 <= n <= 10 n2 = [-10:10]; x2 = zeros(1, length(n2));%zeros create an array for k = -5:5 x2 = x2 + exp(-abs(k)) * impseq(2*k, -10, 10) end Hf_1 = figure; set(Hf_1, 'NumberTitle', 'off', 'name', 'problem 2 - question 2'); Hs = stem(n2, x...
function population = createInitPopulation(sizePop, length, values, mode, option) % CREATEINITPOPULATION % Implements various ways to create a initial population for a genetic % algorithm, as well as the possibility to create all possible combinations % (for a brute force method) % % Part of a *FAILED* approch to segm...
function u=Adams4i(dufun,h,a,b,u0) format long; N=(b-a)/h; u=zeros(1,N+1); t=a:h:b; u(1)=u0; u(2)=1.108960991057469; u(3)=1.160335224588050; u(4)= for i=3:N u(i+1)=u(i)+(h/24)*(9*feval(dufun,t(i+1),u(i+1))+19*feval(dufun,t(i),u(i))-5*feval(dufun,t(i-1),u(i-1))+feval(dufun,t(i-2),u(i-2))); end plot(t,u,'-rs'); hold ...
addpath('..'); u = @(x,y) sin(2*pi*x).*sin(2*pi*y); LapU = @(x,y) -8*pi*pi*u(x,y); NN = [64 128 256 512 1024]; L1 = 0*NN; L2 = 0*NN; max_e = 0*NN; i = 1; for N = NN x_side = linspace(0,1,N+1); y_side = linspace(0,1,N+1); x_cent = 0.5*(x_side(2:end)+x_side(1:end-1)); y_cent = 0.5*(y_side(2:end)+y_side(1:end-1)); [xx,yy]...
%% Funziona su Octave. Non provato su Matlab. % % analisi sull'ammissibilità del parametro k. % clc clear all close all ssave = 1; % parametri b0 = 25; gamma = 10; k = 1e-3; Nass = 100; % size of population costante I0 = 1; S0 = Nass-I0; x0 = [S0;I0]/Nass; %...