text
stringlengths
8
6.12M
function h = mmn_plotERP_STDvsDEV(data,trials) %% Figure Settings h = figure; set(h,'Position',[493 214 807 709]) %% Create ERP and plot for all std cfgERP = []; cfgERP.trials = trials.std; ERP = ft_timelockanalysis(cfgERP,data); % subplot(2,1,1) hold on plot(ERP.time, ERP.avg, 'b') norm = ERP.av...
function [ f_out ] = f_t(s, a, b) %UNTITLED5 Summary of this function goes here % Detailed explanation goes here %f_out = a*(s.^2) - a*s + b; f_out = a*s.^3+ (s.^2) - a*s + b; end
%% Commodity carry clc; clear; load CommodityData %% Get 1-Month Futures for all indices monthsToExpiry = getFuturesMonthsToExpiry(FrontTickers, BackTickers, dates); %% Compute Carry %Get carry from interpolation formula Carry = (FrontMonthPrices - BackMonthPrices) ./ (BackMonthPrices .* monthsToExpiry);...
function penvec = leanings(C,E,nbins) [tstructE, countsE] = hist_extra(E,nbins); [tstructC, countsC] = hist_extra(C,nbins); binUpperE = zeros(1,length(tstructE)); binLowerE = zeros(1,length(tstructE)); binUpperC = zeros(1,length(tstructC)); binLowerC = zeros(1,length(tstructC)); for iter = 1:1:nbins, binUpperE(i...
function [F_buckle] = Buckling(R,L) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here E = 18*10^9; r = 0.61*R; %unit mm F_buckle =(E*((0.001*R).^4-(0.001*r).^4).*(pi^3))./(8.*((0.001*L).^2)) %unit N end
%close all; clc; clear; while(true) c1 = 0.5 * rand(2 ,1); c2 = 0.5 * rand(2 ,1); x1 = rand(1 ,1); x2 = rand(1 ,1); r1 = max(x1, x2); r2 = min(x1, x2); p = rand(2, 1); if norm(c1 - c2) > r1 break; end end indices = []; u = c2 - c1; v = p - c1; alpha = u' * v / (u' * u); t...
%% counterflow clear; format long; parameter_initialization; %delta_h_p=0.2*niu*R*T*(c_d0-c_f0)/10^5; %delta_h_p=niu*R*T*((1-volume_ratio)*c_d0-volume_ratio.*c_f0)/10^5;%delta_v_max1=delta_v_max2 delta_h_p=7; %delta_h_p=niu*R*T*((1-volume_ratio)*c_d0-volume_ratio.*c_f0)/10^5; delta_v_max1=1-c_f0./(c_d0-delta_h_p*10^5...
classdef GeometryGenerator < handle methods(Static) %tapered_end: if true, is tapered to a tip; if numeric positive, is %tapered at angle; if negative, width of extrusion is reduced on %both sides by that value (so total extrusion width is reduced by %double that value) % ...
clear; clc; close all; load('cellLR_LM_Perturbed_15.mat'); trials = 100; exp_to_json(cellL_LM, cellR_LM, trials, 'trials_json_perturbed.json'); % data_string = '{"trials":['; % for i=1:trials % data_string = strcat(data_string, '{"positions":'); % data_text = jsonencode(cellL{i}); % data_string = strcat(d...
function d = dy_dx(x,y,settings) %MAPMINMAX.DY_DX Derivatives of output with respect to input % Copyright 2012-2015 The MathWorks, Inc. Q = size(x,2); gain = settings.gain; gain = cast( gain, 'like', x ); d = diag(gain); d = repmat({d},1,Q); end
function k_out = subkey_cyclic_rotation(k_in) %SUBKEY_CYCLIC_ROTATION: generate i-th subkey by ciclic rotation % The function receives as input the (i-1)-th subkey and outputs the i-th % subkey, which is obtained by dividing it into left an right and % cyclicly rotate each part outwards by 1 bit position. ...
% text hf = axes; ht = text(1,1, 'Demo'); get(ht) get(ht) % text('String', '\int_0^x dF(x)', 'Position',[0.5, 0.5]); text('interpreter', 'latex', 'String', '$$\int_0^x dF(x)$$', 'Position', [0.8, 0.5])
function beta = cml_rpm( breaking, P, X,k) %data must be 1-based, namely the alternatives are 1,2,3,4,5,6 %optimization %x0 = 5*rand(1, m); lb = [-20*ones(1, k), 0]; ub = [20*ones(1, k), 1;]; betagamma0 = rand(1, k+1); options = optimoptions('fmincon','MaxFunctionEvaluations',36000); beta = fmincon(@(betagam...
function output = problem3(pFault) switch pFault case 0 arg = "Deteminisitic"; otherwise arg = "p = "+ string(pFault); end fprintf("3. Reinforcement Learning: %s\n",arg); obstacles = [2,2; 3,2; 4,4; 1,6; 2,6]; myMap= GridWorld(4,7,pFault); myMap.setObstacles(obstacles) myMap.setGoal([1,7]) output = myMap.valu...
function setFigureProprietes ( fig ) set(fig,'units','points','position',[400,125,430,400]); hold on ax = gca; ax.XAxisLocation = 'origin'; ax.YAxisLocation = 'origin'; xlabel('x1->'); ylabel('x2->'); grid on grid minor hold on end
[EmL EmI] = textread('absorption_gron_lampa', '%f %f'); [AbsL AbsI] = textread('emission_gron_lampa', '%f %f'); AbsL = AbsL'; AbsI = AbsI'; EmL = EmL'; EmI = EmI'; plot(AbsL, AbsI, 'r'); hold on; plot(EmL, EmI, 'g'); xlabel('Våglängd m'); ylabel('Intensitet');
function [unique_roots, multiplicity] = UNIQUE_ROOTS(r, tol) % % Finds the unique roots and their multiplicity for the roots in the vector r. % Two roots are considered to be equal and multiplicity = 2 if both the real % and imaginary parts are within the tolerance, tol. % % Toolbox for ANALOG FILTERS USING MA...
function createSpreadsheetFromData(dataIn, header, filename) [sizeY sizeX] = size(dataIn); dimY = ones(sizeY,1); dimX = ones(1,sizeX); if ~iscell(dataIn) dataCell = mat2cell(dataIn, dimY, dimX); else dataCell = dataIn; end dataCellOut = [header; dataCell]; xlswrite(filename, dataCellOut);
function [data params spikes spectro] = shared_coherence(data,spikes,params,spectro) params.flags.plot_online=1; if params.flags.plot_online==1 plotYN=1; else plotYN=0; end %% choices for strongest channel spectro.coherence_radius=[]; channel_index=1:64; %%% 1 choose mode stongest channel for sweep_id=data...
addpath common_innerdist; clear; %------ Parameters ---------------------------------------------- ifig = 1; sIms = {'01_01_m.bmp', '01_04_m.bmp'}; %-- shape context parameters n_dist = 5; n_theta = 12; bTangent = 1; bSmoothCont = 1; n_contsamp = 100; %-- Extract inner-distance shape context figure(ifig); clf; ...
function [x2,k] = hw1_1_fixed(gx,x0,delta,deltaf,M) k=0; shouldReturn=0; x1=feval(gx,x0); x2=feval(gx,x1); %random choice of x2 starting with x1+2delta so x1=x0; while(abs(x2-x1)>=delta && abs(feval(gx,x2)-x2)>=deltaf && k<=M-1) x2temp=x2; x2=feval(gx,x1); x1=x2temp; k=k+1; %Set flag to return if t...
function val = scurve(t,tend) frac = t/tend; if(frac > 1) frac = 1; elseif (frac < 0) frac = 0; end val = 3*(frac^2) - 2*(frac^3); end
#include "com_codename1_ui_list_ContainerList.h" const struct clazz *base_interfaces_for_com_codename1_ui_list_ContainerList[] = {}; struct clazz class__com_codename1_ui_list_ContainerList = { DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_com_codename1_ui_list_ContainerList ,0 , &__GC_MARK_c...
function p = Hermite(x, f_x, f_prime_x) %% Algorithm 3.3 in page 139 of Numerical Analysis (10E) % To obtain the coefficients of the Hermite interpolatory polynomial H(x) % on the (n+1) distinct numbers x_0, x_1, \ldots, x_n for the function f: % INPUT: column vector x, including numbers x_0, x_1, \ldots, x_n; %...
%MIT License %Copyright (c) 2019 Sherman Lo classdef NullIidMixture < NullIid methods (Access = protected) function setup(this) this.setup@NullIid(); this.randStream = RandStream('mt19937ar','Seed', uint32(1716164366)); end function yLim = getYLim(this, index) switch index ...
% AI4 project % File description: Constructs, trains, and computes the performance of a Feedforward network % Student: Ahmad Gheith % Supervisor: John Hallam function [network, performance] = NetPerf(input, target) n_i = size(input); n_i = n_i(1); n_o = size(target); n_o = n_o(1); n_h = floor(sqrt(n_i*n_o)...
%% RasterizePhantom_AB.m % % Function that rasterizes a 2D analytical phantom composed of ellipses, % polygons and Bezier-defined regions. Supports a sensitivity weighting. % If no ouput is required, displays the rasterized phantom. % % INPUTS: * phantom object % * resolution for rasterization % *...
function TNF3() % just a wrapper to call TNF2 with different Luminance and Contrast % sequences. % The luminance follows an m-sequence with base 4 and 2 frames (16 frames % with all possible combinations of 4 luminances, spaced by powers of 2) % The lumSeq = GetLumSeq(); for i=1:2 TNF2('...
%% delete_layer_callback.m % % TODO % %% Help % % *USE* % % TODO % % *INPUT VARIABLES* % % * |main_figure|: TODO % % *OUTPUT VARIABLES* % % NA % % *RESEARCH NOTES* % % TODO: complete header and in-code commenting % % *NEW FEATURES* % % * 2017-03-22: header and comments (Alex Schimel) % * 2017-03-21: first version (Yoan...
vectorSubliminal = ones(1,length(s)); vectorTresIm = ones(1,length(s)); vectorIncorrectoSubliminal = ones(1,length(s)); vectorIncorrectoTres = ones(1,length(s)); for i=1:length(s) vectorSubliminal(i) = sum(s{i}(:,5)); vectorTresIm(i) = sum(s{i}(:,6)); vectorIncorrectoSubliminal(i) = s{i}(:,2)'*s{i}(:...
path = '/Users/kristofferroise/project/patient_data/'; %load the dataset data = HdfImport (strcat(path, 'gr5_STolav5to8/p7_3d/J249J70M_proc.h5')); %number of loops (how many times the movie repeats) loopNo = 3; %number of frames in the recording frameNo = length(fieldnames(data.CartesianVolumes)); for l ...
function varargout = input_medit(V,F,C) % INPUT_MEDIT Display input mesh using medit, highlighting boundary % edges and non-manifold edges % % C = input_medit(V,F,C) % % Inputs: % V #V by 3 list of mesh positions % F #F by 3 list of triangle indices % Optional: % C #C connected compone...
import containers.Map dict_Map=Map(); %储存最后的用户聚类 dict=[]; %建立集合 u=0; clusters=1; %聚类数 alpha=0.3; %阈值,越大,越严格 p_i=0.05; %阈值,越小,越严格 tic; while u<10000 if ~ismember(u,dict) %遍历用户并且用户u并不在dict里面 Nu_p_i=length(user_interest(num2str(u)))/p_i; %计算Nu/p_i dict=unique([dict,u]); %将u加入dict里面,装载曾用过的用户 ...
function filter = fct_design_filter(model) % Design a Gaussian filter which enable to recover the initial smooth field % % Get parameters MX=model.grid.MX; PX=MX/2; dX=model.grid.dX; if any( mod(MX,2)~=0) error('the number of grid points by axis need to be even'); end % persistent idxref MXref dXref kidx % % if...
function [ stem ] = resolve_stem(xid,subject,game,varargin) stem = sprintf('s%d%02dg%d',xid,subject,game); end
function y = invmod(x,p) k = 0; m = 1; %cat timp m ~= 0, incrementez k si calculez m, pana cand este 0 %cand am gasit ca m = 0, k este factorul care da inversul multiplicativ while m k = k + 1; m = mod(k * p + 1, x); end %inversul modulo y = (k * p + 1)./x;
function draw_voronoi(V,span,pos,varargin) % 【Input】V : polyshapeセル配列, span : 対象インデックス, % pos : span毎に"r+","bx","go" で表示 % varargin : region : 描画領域, text = {pos, text} %% 描画 daspect([1 1 1]); if isfield(varargin,"range") region=varargin.range; xlim([min(region(:,1)),max(region(:,1))]); ylim([min(regio...
function varargout = guipreprocessing(varargin) gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @guipreprocessing_OpeningFcn, ... 'gui_OutputFcn', @guipreprocessing_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && isch...
function alpha_exp = getAlpha(rhs, wvec_sort) % getAlpha calculates the alpha value for the sorted weight. sum_weight = sum(wvec_sort); for i = 1:length(wvec_sort) alpha = (rhs * sum_weight) / (1 - i * rhs); curr = wvec_sort(i); if alpha > curr alpha_exp = alpha; return end sum_wei...
%you get the gradient of the first of the three of the layers and then %think of the other gradients.\ function probability = double_code(board_state,whose_turn,start_episode,who_won) % there is one unknown that I am missing here #Raghu % define the neural network parameters alpha=0.001; lambda=...
% E = calculateErrorMatrix(A, eigenvalues, eigenvectors) - funkcja % obliczajaca blad e = A * x - lambda * x dla kazdej wartosci wlasnej i % wektora wlasnego z nia zwiazanego. % % Wejscie: % * A - macierz dla ktorej wartosci wlasnych szukalismy % * eigenvalues - wektor znalezionych wartosci wlasnych macierzy A % * eige...
disp(['This is a test for a batch submission- start.']) a = 2; b = 5; c = a+b; disp(['This is a test for a batch submission.'])
function [test_image_res]=computed_morphology(test_image_res) test_image_res=bwareaopen(test_image_res,30); test_image_res=imclose(test_image_res,strel('square',3)); test_image_res=imfill(uint8(test_image_res),4,'holes'); end
%% Simulation parameters fsw=80e3; SampleTime=(1/fsw)/360; SampleTime=1e-8; Tfinal=0.002; phasePWM=180; %% DC SUPPLY VDC=100; LSource= 1e-6; RSource= 0.1; %% Full-Bridge Parameters C_DCA=1e-6; C_DCB=1e-6; ESRA=1e-7; ESRB=1e-7; %% Parasitics RA_parasitic=1e-3; LA_parasitic=1e-8; RB_parasitic=1e-3; LB_parasitic=1e-8; RA...
%==========================================================================% % % % READ ME % %COMPE 565 Project 1 % % ...
% Create a matrix A = [1 2; 3 4; 5 6; 7 8] sz = size(A) size(sz) % Create variables in Octave name = 'Byamasu Patrick'; age = 25; % You can also use format long and format short to print a string disp(sprintf('Hello %s', name)); disp(sprintf('Your age is %i', age)); V = 1:0.1:2 V = 1:6 W = 3 * ones(2,3) + 1.5 Z = z...
function [MAP,MP,NDCG,ERR] = computeRankingScores(trainT, testT, fpred, k) %COMPUTERANKINGSCORES [MAP,MP,NDCG,ERR] = computeRankingScores(trainT, testT, fpred, k) % % Compute the ranking scores MAP@k, P@k, NDCG@k, and ERR@k. % % Note that this function is implemented specifically for context-aware % evaluation: th...
function optimise(a,b,t1,t2,beta,col,del_sort2) u1=zeros(1,col); u2=zeros(1,col); for j=4:col-3 u1(j)=1/(1+abs((del_sort2(j)-t1)/t2)^2*beta); if(u1(j)<=a) u2(j)=0; elseif((u1(j)>a)&&(u1(j)<b)) u2(j)=abs((u1(j)-a)/(a-b)); elseif(u1(j)>=b) u2(j)=1; end end E=0;...
% Power Spectrum Density usin DFT/FFT % Effect of length (L) of signal (x_n) on the PSD. The importance of large L irrespective of large Nfft % For 2 nearby frequencies to be resolved properly, (omega1 - omega2) >= (2pi/L) , where omega = digital freq in rad % The fft length (Nfft) only calculates more points in the PS...
clear, close all, clc %%% Generate filter %%% fs = 1000; fL = 45; fH = 55; % Chebyshev [b_cheb,a_cheb] = cheby1(3,40,[fL*2/fs fH*2/fs],'stop'); [h_cheb, f_cheb] = freqz(b_cheb, a_cheb, fs); [h_che, t_che] = impz(b_cheb, a_cheb, 100, fs); % Inverse Chebyshev [b_cheb_inv,a_cheb_inv] = cheby2(3,40,[fL*2/fs fH*2/fs],'st...
function [interfaceDataInfo]=load_InterfaceDataSetting(fileName) fid=fopen(fileName); C1=textscan(fid,'%s'); interfaceDataInfo.functionName=cell2mat(C1{1}(1)); % functionName interfaceDataInfo.isCoded=cell2mat(C1{1}(2)) == '1'; % function is Embedded (MatLab code) interfaceDataInfo.linesNo=0; if (interfaceDa...
function BernBetaJAGSFull % BERNBETAJAGSFULL % % Original in R: Kruschke, J. K. (2011). Doing Bayesian Data Analysis: % A Tutorial with R and BUGS. Academic Press / Elsevier. % Modified to Matlab code: Marc M. van Wanrooij close all hidden clear all hidden %% THE MODEL. % Specify the model in winBugs lan...
% Run searchmight on the entire brain % function might(rsa_idx, radius, use_smooth, method, zsc) addpath(genpath('SearchmightToolbox.Darwin_i386.0.2.5/')); % for the cluster radius = radius / 1.5; % mm -> voxels %{ rsa_idx = 1; radius = 4 / 1.5; % 4 mm use_smooth = false; method = 'gnb_searchmight'; % lda_ridge, lda...
%% 参数设置 num=100; slot=96; %% 与平均值差值的平方和最小 cvx_begin quiet variable p00(r,c) minimize(sum((sum(p06)- averofenergy(1,i)).^2)) subject to p06*ones(c,1)*0.25==daydata{1,i}(:,1) zeros(r,c)<=p06<=rmax206{1,i} cvx_end %% 最大功率最小 cvx_begin quiet varia...
clear all; %将要逼近的非线性函数设为正弦函数,其频率参数 可以调节 k=1; p=[-1:.05:1]; t=sin(k*pi*p); %假设频率参数为1,绘制此函数的曲线 plot(p,t,':') %效果如图3-66 xlabel('时间'); ylabel('非线性函数'); %建立网络 n=10; net=newff(minmax(p),[n,1],{'tansig','purelin'},'trainlm'); y1=sim(net,p); %网络仿真 figure; plot(p,t,'r:',p,y1,'-') %效果如图3-...
function [ x_opt ] = svrg_method(x_t, Ai, s_hyp) A = s_hyp.A; eta = s_hyp.eta; alpha = s_hyp.alpha; n = s_hyp.n; d = s_hyp.d; %portolio optimization f = @(x) -Ai*x+(Ai*x - ones(1,n)*A*x/n)^2+alpha/2*(x'*x); g = @(x)-Ai'+ 2*(Ai*x - ones(1,n)*A*x/n)*(Ai' - A'*ones(n,1)/n)+alpha*x; problem = general(f, g, [], [], d);...
function GlobalTemp % GLOBALTEMP Explore global temperature history % Load the topographical data for the globe load('topo.mat', 'topo', 'topomap1'); % Load the temperature anomaly data global MonthlyTempAnom DataCount StartYear StartMonth %#ok -- lint warning load TempAnomData1880 % Create a unit sphere w...
function [L] = pModelLengthDist(Node) L(1,1) = 1; N = length(Node); for n = 1:N switch Node(n).type case 'Initial' A = zeros(length(Node(n).leftLengthDist),1); A(:,1) = Node(n).leftLengthDist; L = conv2(L,A); B = zeros(1,len...
%Jake Tully 100904392 % % TE Modes optical waveguide % circular Nano particals on core clear clc close all %Parameters c = 299792458; % m/s lambda = 1550*10^-9; f = c/lambda; up = lambda*f; n1 = 1.45; n2 = 1.44; nm = 0.5 ; DelNeff = 10^-5; Bo = (2*pi*1.447)/lambda; B =(2*pi)/lambda; epsilon1 = (8.8541878176*10^-12)*n...
function outData = parseEyeData(TS, left, right, First, Last) % these commands convert local timestamps to Tobii timestamps % Tobii is in microseconds, while local is in seconds % hence the 10^6. firstTS = tetio_localToRemoteTime(int64(First*10^6)); lastTS = tetio_localToRemoteTime(int64(Last*10^6)); % identi...
% Copyright 2018, by the California Institute of Technology. ALL RIGHTS % RESERVED. United States Government Sponsorship acknowledged. Any % commercial use must be negotiated with the Office of Technology Transfer % at the California Institute of Technology. % -----------------------------------------------------------...
function [x,niter] = LevenbergMarquardt(x0,b,A,maxiter,tol,S) % a function for the Levenberg-Marquardt method % inputs: % x0 - initial value % b - a vector % A - a matrix % maxiter - max iterations % tol - a tolerance level % S - a scaling factor of lambda (between 2-10) % outputs: % x - be...
function PlayCoreMovie(fm,mp,fps) % PLAYCOREMOVIE plays a movie from a collection of frames stored in a % structure element fm. % % Usage: PlayCoreMovie(fm,mp,fps) % % output % -- A movie sequence of the strong epsilon cores % to illuminate an important (pre-)kernel property. % inpu...
function [err] = checkp(net,p,Q,TS) %CHECKP Check P dimensions. % % Synopsis % % [err] = checkp(net,P,Q,TS) % % Warning!! % % This function may be altered or removed in future % releases of Neural Network Toolbox. We recommend % you do not write code dependent on this function. % Mark Beale, 11-31-97 % ...
function C = circularshift( in ) A=in(:); B=[A(2:end) ;A(1)]; C=reshape(B,size(in)); end
function p = poly_val( c0,c,x ) if isempty(c) p = c0; elseif isscalar(c) p = c0 + c*x; else if iscolumn(c) a = size(c'); p = c0 + sum(c(1:end)'.*(x.^(1:a(end)))); else a = size(c); p = c0 + sum(c(1:end).*(x.^(1:a(end)))); end end end
function [Fn,Ln] = fibs2(n) % fibs2: vpi tool to efficiently compute the n'th Fibonacci number and the n'th Lucas number % usage: [Fn,Ln] = fibs2(n) % % the "2*n" identities are employed here: % F(2*m) = F(m)*L(m) % L(2*m) = (5*F(m)^2 + L(m)^2)/2 % % coupled with the addition identities % % F(m+1) = (F(m) + L(m))/2 ...
x= -3.14:0.002:3.14; y=cos(x); p2=1-(1/2)*x.^2; p4=1-(1/2)*x.^2+(1/24)*x.^4; plot(x, y, 'r', x, p2,'b', x, p4, 'm'); grid on; set(gca,'fontsize',16); xlabel('x-axis'); ylabel('y-axis'); axis([-3.14, 3.14, -3, 3]); title('Partial sums of the Taylor series for f(x) = cos(x) at x_0=0'); legend('f(x)=cos(x)', 'p_2(x)=1...
addpath('..\optim\') addpath('..\forceModel\') %% el_num = 56; x = 500e-6*(2*rand(1)-1); y = 500e-6*(2*rand(1)-1); z = 130e-6; p = [x;y;z]; phases = 2*pi*rand(el_num,1); ur = cos(phases); ui = sin(phases); % % F_des = giveMeForce(p, ur, ui); F_des = [-10e-11; 10e-11; 3.3400e-11]; % % % profile on t...
clc clear all load Data_singleArrivalExpon_T_theta20.txt ; load Data_singleArrivalExpon_T_theta30.txt ; load Data_singleArrivalExpon_T_theta40.txt ; format long e m =[20 30 40]; %Give Credits lambda=5; T = [1 3 5 7 9 10 30 50 70 90 100 300 500 700 900 1000 3000 5000 7000 10000] ; %Timer lambda_unit = 0...
function varargout = HeatmapDisp(varargin) % HEATMAPDISP M-file for HeatmapDisp.fig % HEATMAPDISP, by itself, creates a new HEATMAPDISP or raises the existing % singleton*. % % H = HEATMAPDISP returns the handle to a new HEATMAPDISP or the handle to % the existing singleton*. % % HEATMA...
function cd = read_CORTEX_NEV_CTXCHECK(ctx,nev,sync_codes,mincodes,cndlist) %function cd = read_CORTEX_NEV_CTXCHECK(ctx,nev,sync_codes,mincodes,cndlist) % % read_CORTEX_NEV_CTXCHECK takes ctx and nev file data and produces a % matlab structure with EVENTS and CHANNEL numbers. % % This reads the encodes from both the c...
clear all; clc load('CI_front_OLS_all.mat') N = [11,31,51]; hn = [21,41,81,161,321,641,2*640+1]; order1 = zeros(7,1); order2 = zeros(7,1); for i = 1:7 width = zeros(3,2); count = 1; for j = 2:7:21 C = CI{i,j,5}; width(count,:)=diff(C,1,2); count = count+1; end p1 = polyf...
function [insert_axes_new] = insert_plot(main_fig, main_axes, insert_axes, x_insert, y_insert, insert_size) % % main_axes could be a subplot of main_fig % otherwise use main_axes = findobj(main_fig,'Type','axes') or main_axes = % get(gca) % Defualt position parameters if nargin == 3 x_insert = 0.6; % [0,1]...
function [area, diameter] = calculateAttributes(r) diameter = 2*r; area = pi*r^2; end
function simulation = ornsteinUhlenbeck(T, x_0, mu, lambda, n) times = T/n:T/n:T; [expected_value, cov_matrix] = distribution_parameters(times, lambda, mu, x_0); A = chol(cov_matrix); simulation = [x_0, expected_value + randn(1, length(times)) * A]; end function [expected_value, cov_matrix] = distribut...
clear all; close all; clc disp('*****************************************************************'); disp('** CITRA KEABUAN **'); disp('*****************************************************************'); disp(' '); %input file citra G = input('Masukkan nama gambar dengan...
function idst = myidst(vector) %Determines the inverse discrete sine tranform of a vector using an fft. % %Given a row vector, returns the inverse discrete sine transformation of %the vector. Uses a fourier transform to make the process more efficient. %Initializers sz = size(vector); vector = vect...
function lagre2 % ******************************************************************* % P r o g r a m LAGRE2 % ******************************************************************* % % PURPOSE: % Derive differential equations of motion of a mechanical system % w...
function y = am_ban(x) y = 255 - x; end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright 2010 - 2015 Moon Express, Inc. % All Rights Reserved. % % PROPRIETARY DATA NOTICE: % The data herein include Proprietary Data and are restricted under the % Data Rights provisions of Lunar CATALYST Space Act Agreement % No. SAAM ID#...
%session = daq.createSession ai = analoginput('nidaq','Dev1'); chans = addchannel(ai,0:1); %save('example.mat') %load('example.mat') %% Definir frequência de aquisição freqDeAquisicao = 10e3 % é a frequencia de aquisição de cada canal % individualmente % ai.SampleRate = freqDeAquisica...
% ============================================= % = GIC Non-uniform Condcutivity = % = Rui Sun, Dominion Technical Solutions = % ============================================= % ============================================= % ver perfect 1.0 % Last update: 7-2-2018 % Strcuture level: 4 % ====...
% mec_spring_energy.m % Ian Cooper % School of Physics, University of Sydney % https://d-arora.github.io/Doing-Physics-With-Matlab/ % In the section PLANET: comment / uncomment to select % stationary or moving planet clear all close all clc % Input and Constants +++++++++++++++++++++++++++++++++++++++++++++++ K =...
fprintf('\n') fprintf('\n') disp('-------------------------------------------------------------------') disp(' Technical Parameters LP ') disp('-------------------------------------------------------------------') for iw = 1: length(which_Z) if strcmp(which_Z{iw},'1') == 1 ...
dataSelection = 1; % AFL predict_AH(dataSelection) dataSelection = 3; % UK predict_AH(dataSelection)
clear all; tic; info = imfinfo('circle.png'); img_x = imread('circle.png'); if strcmp(info.ColorType,'indexed') == 1 img_x= logical(img_x); else img_x = rgb2gray(img_x); end size = 100; img_x = imresize(img_x,[size size]); img_x(:,:,:) = 255-img_x(:,:,:); new = ones(size,size,size,'uint8'); for y=1:size ...
clc;clear; %初始化变量 nyx = [ 54428 40.0333 117.4000 54525 39.7333 117.2833 54523 39.3833 117.0167 54529 39.3500 117.8167 54619 38.9167 116.9167 54527 39.0833 117.0667 54528 39.2333 117.1333 54517 39.1000 117.1667 54526 39.0833 117.3333 54622 38.9833 117.3333 54645 38.8500 117.4667 54530 39.2333 117...
function out = testsimp2D(table,a,b,c,d,NX,NY) % clc; clear; % a = 0; b = 1; % c = a; d = b; % NX = 512; NY = NX; % x = linspace(a,b,NX+1); % y = x; % func = @(x,y) cos(x.^2 + y.^2); % table = func(x,y); % for i = 1:length(x) % for j = 1:length(y) % table(i,j) = func(x(i),y(j)); % end % end % break; % Ensure the numb...
function [out_rows, missing_inds] = get_rows(rows, inds) out_rows = rows(inds(inds <= size(rows,1)),:); if nargout>1 missing_inds = inds(inds > size(rows,1)); end end
close all; clear all; clc; % load('stuvvalue.mat') load('stuvvalue2.mat') % errors=abs(Q(:,1)-pixelval2.s); % errort=abs(Q(:,2)-pixelval2.t); % erroru=abs(Q(:,3)-pixelval2.u); % errorv=abs(Q(:,4)-pixelval2.v); % error=sqrt( (errors).^2 +(errort).^2 +(erroru) .^2 + (errorv) .^2); % errorN=error./(max(error)); ...
function oran=oranbul(veri,sonuc,oran0,oran1) oran = []; boyut = length(veri); olumlu = 0; % 0 ve 0 % for(i = 1 : boyut) if(veri(i,1) == 0 && sonuc(i,1) == 0) olumlu = olumlu + 1; end end pay = olumlu/boyut; payda = oran0; oran(1,1) = pay/payda; olumlu = 0; % 0 ve 1 % for(i = 1 : boyut)...
clc; clear; x = [0 1 2 3 4 5 6 7 8 9]; y = [1 1 1 -1 -1 -1 1 1 1 -1]; [alpha, th, p] = adaboost(x, y); output = zeros(1, 10); for i=1:10 temp=prediction(i-1, alpha, th, p); output(i) = temp; end sum(output~=y) % ´يخَ¸ِت‎
function [EVa1,EVa2,EVa3]=EVAngles(EVec,EV,ConvMatrx,Temperature_List,xtalvect,lsfits,inUVW) % gets the angle between the eigenvetors of the thermal expansion matrix % and the crystallographic vector given. Inputs datin: the data output % from getPtTemp,datname: The name of the phase of interest,ordn: the order %...
classdef Var properties (SetAccess=public , GetAccess=public) sym ID UpperBound LowerBound Seed end methods function obj = Var(varID, varDim) arguments varI...
function [tBleachAcceptor,tBleachDonor] = tsqComparison(files,titles) % % Copyright 2007-2015 Cornell University All Rights Reserved. nBins = 40; % Get list of files to compare from user if nargin<1, files = getFiles; end nFiles = numel(files); % Make titles for files if none are provided if nargin<2 %...
function A = chem2(y1,y2,y3,k); i=1; dt=0.1; E=eps; y4=0; y5=0; k1=k(1); k2=k(2); k3=k(3); k4=k(4); A(1,1)=y1; A(2,1)=y2; A(3,1)=y3; A(4,1)=y4; A(5,1)=y5; while A(1,i)>E && A(2,i)>E && A(3,i)>E; A(1,i+1)=A(1,i)+(-k1*A(1,i)*A(2,i)*A(3,i)+k2*A(4,i))*dt; A(2,i+1)=A(2,i)+(-k1*A(1,i)*A(2,i)*A(3,i)+(k2+k4)*A(4,i))*dt...
volume_flux_diff=volume_flux*0; volume_flux_diff(2:Nradial)=volume_flux(2:end)-volume_flux(1:end-1); Btot_PR_map=sqrt(Bpol_PR_map.^2+Btor_PR_map.^2); Btot_radial_profile=mean(Btot_PR_map(1:NP-1,:),1); beta_e_profile=2*mu0*Ne_profile.*Te_profile./(Btot_radial_profile.^2) vA_radial_profile=Btot_radial_profile./(sqrt(mu0...
%% trying different learning rates - we use the old faithful dataset figure() colormap(winter) load('train_oldfaithful.mat') %load the testing data load('test_oldfaithful.mat') m = length(x_test); input = [ones(m , 1) , x_test]; n = length(x); t = t*0.5 + 0.5; %add row for bias values x = [ones(n,1) x]; alphas = [ ...
function acc=NNs(trainData,testData,trainLabel,testLabel) acc=0; [testnum,~]=size(testData); for i=1:testnum if testLabel(i)==NN(trainData,testData(i,:),trainLabel) acc=acc+1; end end acc=acc/testnum;