text
stringlengths
8
6.12M
sn = [675, 578, 600, 559, 563, 540; 14000, 55000, 58000, 61000, 165000, 270000]'; log_sn = log10(sn); X = [log_sn(:, 2), ones(size(log_sn, 1), 1)]; a = (X' * X) \ (X' * log_sn(:, 1)); A = 10^(a(2, 1)); B = a(1, 1); x = 4:0.1:5.5; y = a(1, 1) * x + a(2, 1); disp("3(a)"); figure(1); plot(log_sn(:, 2), log_sn(:, 1)...
function comparison = SEL_compare_archs(arch1,arch2) %% SEL_compare_archs.m % % a1 = SEL_get_arch_from_results(results,3) % Usage: SEL_compare_archs(a1,used_params.ref_sel_arch) global params fprintf('************************************************************\n'); fprintf('*******************************************...
%% AML-Reflex Model Project % Authors: % Gaia Carparelli % Marion Claudet clc; clear all; close all; %% Load data load('data1.mat'); load('data2.mat'); load('data3.mat'); %% Extracting footfall patterns nbr_data = 3; FF.foot_falls1 = data1.footfall.data; FF.foot_falls2 = data2.footfall.data; FF.foot_falls3 = data3.fo...
function [abort] = TimerDisplay(t, Haplo, Text, movie) %========================== TimerDisplay.m ================================ % % Plays a countdown from 't' seconds (displayed in MM:SS format) and an % animated icon while displaying 'text'. Can optionally be exported as % an .avi movie. Quits if user p...
function y=multiedge(obraz,s); a=rgb2gray(obraz); %utworzenie 3 mask dla operatora Sobela h1=[1 0 -1; 2 0 -2; 1 0 -1]; h2=[1 2 1;0 0 0;-1 -2 -1]; v=[1 2 1;2 4 2; 1 2 1]; %Splot obrazu z powyższymi maskami a1=filter2(h1,a); a2=filter2(h2,a); ns=h1; for ii=1:s nsh=conv2(ns,v); p=max(max(ns))/max(max(nsh)); ...
function obj = gsparsity(varargin) %@gsparsity Constructor function for gsparsity class % OBJ = gsparsity('auto') attempts to create a gsparsity object by ... Args = struct('RedoLevels',0,'SaveLevels',0,'Auto',0,... 'stimInfoDir',['..' filesep '..' ],'ClusterDirs',{''},... 'Normalize',0,'Su...
function [ posesLearning,posesService ] = showTrajectories( tangoPose ) %SHOWTRAJECTORIES Summary of this function goes here % Detailed explanation goes here figure; idx = 1:size(tangoPose,1); posesLearning = tangoPose(:,5)>0; posesService = tangoPose(:,5)<0; timediff = tangoPose(2:end,5) - tangoPose(1...
%Parameters are %bornes, %steps, %aMax : maximum aspect ratio skew %sMax : shear value %dMin : minimal determinant matrix we want %dMax : maximal determinant matrix we want function transfos = genTransfos(bornes, steps, aMax, sMax, dMin, dMax) I1Min = bornes(1,1); I1Max = bornes(1,2); I2Min = bornes(2,1); I2Max = ...
% Snipet 4 fprintf('Fibonacci Series \n') fmm=1; % f_{n-2} fm =1; % f_{n-1} fprintf('number: %f \n',fmm) fprintf('number: %f \n',fm ) for n = 3:10 fn = fm + fmm; fprintf('number: %f \n',fn) % preparing for the next step fmm = fm; % f_{n-2} <- f_{n-1} fm = fn; % f_{n-1} <- f_{n} en...
% Plot the figure of R_m versus alpha alpha = linspace(-pi/2,pi/2,100); l = 4e-6; theta = 1*pi/3; R = 1e-6; gama = 7e-2; R_m = -(l/2-R*cos(alpha))./cos(-alpha+theta); plot(alpha*180/pi,gama./R_m) xlabel('alpha (degree)') ylabel('P') title('Relationship between pressure and alpha') xlim([-90,90]) shg
%% clear;clc;close all; % 可以尝试修改的参数,便于加深理解,获得更优的性能。 n_hid =35; % 隐层神经元数量 n_iters = 8000; % 迭代次数 learning_rate = 0.46; % 学习率 mini_batch_size = 1; % batch大小 %22 3000 0.45 % 初始化 if exist('page_output_immediately') page_output_immediately(1); end more off; model = initial_model...
function rename_even_better(root_dir) mask_dir=root_dir; dirData = dir(fullfile (mask_dir,'*.jpg')) ; %dirData = dir(fullfile (mask_dir,'*.tif')) ; %# Get the selected file data fileNames = {dirData.name} ; num_files_to_rename = numel(fileNames); TF=isstrprop(fileNames,'digit'); for ii=1:num_files_to_ren...
function [cbr] = compute_weights(cbr) for emotion = 1:6 for attr = 1:45 cbr.class_weights(emotion, attr) = 1/(abs(cbr.active_count(emotion, attr) / cbr.class_count(emotion) - 0.5)*2); end end end
function [SR,y,deltaP] = laitteistoparametrit(dp) % Ratkaise saturaatiosuhteet, sek� adiabaattisessa laajenemisessa % vaadittavat painesuhteet ja -erot. Ti = 23 + 273.15; % alkul�mp�tila, K Pf = 990 * 1e-3 * 1e5; % loppupaine, Pa gamma = 1.4; % ilman adiabaattivakio % ratkaistaan painesuhteet % p...
%CSDN:http://blog.csdn.net/sinat_30071459 %% clc; clear; source_txt1='/home/lc408/cub_bird/VOC/VOC2007/img/output.txt'; source_txt2='/home/lc408/cub_bird/VOC/VOC2007/img/output.txt'; dest_txt='/home/lc408/cub_bird/VOC/VOC2007/img/output.txt'; imname=textread('CUB_200_2011/images.txt','%s'); flag=textread('CUB_200_201...
if (x==zeros(1,3)) & (a==5) y=1 else y=0 end
classdef lineScan % last edit: Perry Spratt 01/17/2017 %An object for saving and manipulating line scan data properties % Basics name = []; date = []; xmlData = []; imagingParams = []; scan_image = []; % Parameters that vary between exper...
function [ f1prob, f1probl ] = F1_PROB( sza,glat,rz12 ) %F1_PROB Occurrence probability of F1 layer % % subroutine f1_prob (sza,glat,rz12,f1prob,f1probl) %-------------------------------------------------------------------------- % Occurrence probability of F1 layer after Scotto et al., Advances in % Space Resea...
function [x_prime, y_prime, theta_prime] = monte_carlo_localization(... x, y, theta, delta_t, v, omega) x_prime = x + v * delta_t * cos(theta); y_prime = y + v * delta_t * sin(theta); theta_prime = theta + omega * delta_t; end
% MyKeyWords clear all load('allKW201712Collaps_Deg0Removed.mat') load('nums2017.mat') CalculateSortedallKW padding='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; ReadMyAbstracts % Remove brakets, for example: Clauser-Horne (C...
function d = markov(h1, h2) % MARKOV calculates the MARKOV similarity between the two histograms % note: Markov is not symmetric, one sequence becomes the model % -h1 is the sequence % -h2 is the model cond=log(build_cond(h2)); d=sum((h1-1).*cond); end
function [T] = heat(BC,IC,L,Nnodes,t_final) % This function solves 1D heat equation using finite difference method. % Input arguments % BC Boundary condition % IC Initial condition % L The length of interest % Nnodes Number of nodes % dt Time step % t_final F...
function h = trueVsModelSpikes(v) Y = v.Y; Yh = v.Yh; Yh1 = v.YhAR; ix = ~isnan(Y); Y = Y(ix); Yh = Yh(ix); Yh1 = Yh1(ix); Fs = 5; h(1) = figure; hold on; set(gcf, 'color', 'w'); set(gca, 'FontSize', Fs); xlabel('trial'); ylabel('spike count'); title(v.name); xx = [1 1:numel(Y) nume...
% Find the optimal number of features featR = 1:30; time = -2.5+ws:1/64:0.5; timeOfInterestIndex = find(time >= 0,1,'first'); [p_SCP,p_SCP_train] = features_number_study(training,testing,... 'cvType',{'KFold'},'nFold',10,'timeOfInterest',timeOfInterestIndex,... 'feature2Use',{'temporal'},'featureRange',featR,'...
%% Import Video % This code imports a video object and then reads the frames. clear all; close all; set(0,'DefaultFigureWindowStyle','docked') % INPUT the filename of your video vid_in = '/Users/joshsalvi/Documents/Lab/Lab/Videos/Tungsten/20160302/Composite_(NTSC)_20160302_1630.mov'; % Be sure that you use one of the ...
% 05-2012 % Victor Barres % USC Brain Project % Script to display fwdActive function disp_fwdActiv(varargin) if isempty(varargin) simName = getSimName(); else simName = varargin{1}; end path = sprintf('simulations\\%s\\',simName); load(sprintf('%s\\fwdActiv.mat',path)); numBC = length(fwdActiv.brainCircuit)...
function theta = ista_c_haar(y,phi) %random init for k=0 theta = normrnd(0,1,[64,1]); %get the alpha alpha = 178.0; % eig_vals = eig(A'*A); % alpha = max(eig_vals)+1; diff = 10; %rand value c_norm = norm(theta); %start loop % for k=1:10 count = 0; while diff > 0.05 term_2 = 10/(2*alpha); at = phi*get_psi(the...
function [ring2,radelemIndex,cavitiesIndex]=atradoff(ring1,varargin) %ATRADOFF switches radiation and cavity off % % [RING2,RADINDEX,CAVINDEX] = ATRADOFF(RING,CAVIPASS,BENDPASS,QUADPASS) % Changes passmethods to turn off radiation damping. % % INPUTS % 1. RING initial AT structure % 2. CAVIPASS ...
close all clear all Fs = 4000e3; N = 1024; t = [0:N-1]/Fs; F0 = 150e3; f = 4e3; ff = [-N/2:N/2-1]*Fs/N; ff = ff(N/2+1:N); fi = pi/4; m = 6; s = sin(2*pi*f*t); S = sin(2*pi*F0*t); PM = sin(2*pi*F0*t+fi*sin(2*pi*f*t)); FM = sin(2*pi*F0*t+m*sin(2*pi*f*t)); SPM = abs(fftshift(fft(PM))); SFM = abs(fftshift(fft(FM)));...
% for the treadmill the distance are expressed in millimiter % select the files interested in function importTMdata = importfile(pathDir, timeWindow, preShock) addpath(genpath('C:/git/rumLab/treadmill')) % default for the function % if nargin<=2 % %pathDir= '/home/rum/Dropbox (Scripps Research)/RumScripts/Scipts fo...
function corespondencesPlane = matchingPlane(planePoints_1,... planePoints_2,... eigenPlane_1, eigenPlane_2,... barycenterMap_1, barycenterMap_2,... barycenterThreshold) % matching the planes and creating the weight array corespondencesPlane = []; % idenx list to prevent from double match idxList = [...
function L = first_principles_liouvillian(lda, g, N, C) M = sqrt(N*(N+1)); dC = 2; % extra Fock states to avoid truncation errors a = spdiags(sqrt(0:C+dC)', 1, C+1+dC, C+1+dC); % annihilation operator [aR, Ra] = raise(a); [AR, RA] = raise(a'); L = lda/2*(AR^2 - RA^2 -aR^2 + Ra^2) ... + g^2/2*(2*aR^2*RA^2 - AR...
clear T0rng = 5:5:50; NT0 = length(T0rng); dts = 0.05; trng = 0:dts:72; Nt = length(trng); E = zeros(1,Nt); T_Rps = zeros(NT0,Nt); T_Res = zeros(NT0,Nt); DegEff_Rp = zeros(1,NT0); DegEff_Re = zeros(1,NT0); Km = 0.1; E0_Rpm = 1.7203; dE_Rpm = 0.1010; E0_Rem = 3.0161; dE_Rem = 0.1342; cnt = 0; for ...
function triggerModel() global complete_pre_data_train; global complete_post_data_train; global complete_pre_data_validation; global complete_post_data_validation; global complete_pre_data_test; global complete_post_data_test; global student; numStudent = 24; % for i =1:numS...
load("stack.mat") a=eval(['frame',sprintf('%.3d',15)]) size(a) % eval(['focus',sprintf('%.3d',1)]) = zeros(size(a,1),size(a,2)); A1 = zeros(size(a,1),size(a,2)); % b=eval(['focus',sprintf('%.3d',1)])
acer=1; Rat=24; st=0; %Include Standard deviation. if acer==1 cd('C:\Users\addri\Dropbox\Window') else cd('/home/raleman/Dropbox/Window') end cd(num2str(Rat)) cd('all_rip') %% load('Mdam.mat') n=201*101; Mdam([2,4,6],:)=Mdam([2,4,6],:)./sqrt(n); %% Region= {'HPC';'PAR';'PFC'}; if st==1 NoLearning={ ...
Function [sample_val_Arr_for_Elements]= convert_to_sample_values(distance_of _all_pixels_Arr, speed_of_sound, sampling_Start_time, Sample_Num_Arr); Tim_Arr=( distance_of _all_pixels_Arr*10^-3)/speed_of_Sound – Sampling_Start_Time; Sample_Num_Arr = round(sampling_rate*time_Arr)+1; S = size(sample_Num_Arr); Sampl...
clear variables path = 'C:\Users\60069978\Documents\MATLAB\scan24\'; % acá elijo el paso (más grueso que el original) que quiero usar. Debe ser % múltiplo de 5 mm paso = 35; % cargo el txt que tiene las coords medidas archivo = [path 'coord_pedidas_vs_medidas.txt']; datos = importdata(archivo, '\t', 1); d...
% % BoFベクトルと非線形SVMによる分類 % function classify = BoF(list) addpath('/usr/local/class/object/MATLAB/sift'); run('/usr/local/class/object/MATLAB/vlfeat/vl_setup'); % % codebook生成 % %sift特徴の計算 siftvec=[]; for i=1:size(list,1) I=im2double(rgb2gray(imread(list{i}))); [pnt,desc] = sift_rand(I,'randn',500); siftvec = ...
function soln = maxgraddescbt(f, g, i, e, t, alpha, beta) % gradient descent % f -- function % g -- gradient % i -- initial guess % e -- initial step size % t -- tolerance gi = feval(g,i) ; while(norm(gi)>t) % crude termination condition step = e .* alpha; while(feval(f,i + step .* feval(g,i)) < feval(f,...
function W = trainInterference(signal, alg, maxitr) % % Author: Dakota Murray % Version: 26 June 2014 % % This function trains a model representing the interference of a signal by using one % of several algorithms. The algorithms are defined as: % % - A supervised algorithm where by ...
function [Vstr, Theta, Nspikes] = cycle_Vstrength(data, modPer) % function [Vstr, Theta, Nspikes] = cycle_Vstrength(data, modPer) % calculates Vector strength and best angle for % modulation periods in usec provided as argin % - data should be a [nReps, nMaxSpikes] matrix of spiketimes in usec % - modP...
A[i j] += B[i k] C[k n] D[n j]
function Nop = getNonlinearPart2(pdeobj) %GETNONLINEARPART2 Get the nonlinear part of a 2D time-dependent PDE. % Nop = GETNONLINEARPART2(PDEOBJ), where PDEOBJ is a string or a % function handle, outputs a cell-array NOP that reprents the nonlinear part % of the PDE specified by PDEOBJ. NOP{1} reprents the non...
clc; clear all; close all; healthy_samples_norm = []; for i = 1:18 healthy_samples_norm = [healthy_samples_norm organizedatahealthy(i)]; end csvwrite('C:\repos\ann-arrhythmia\dataproc\healthy_samples_norm.csv',healthy_samples_norm);
%Basic given Features Extraction in cells of FT for every sign fid = fopen('1-2.txt'); FT{1} = textscan(fid,'%d %f %f %f %f %f %f','delimiter',','); fclose(fid); fid = fopen('1-20.txt'); FT{2} = textscan(fid,'%d %f %f %f %f %f %f','delimiter',','); fclose(fid); fid = fopen('1-22.txt'); FT{3} = textscan(fid,'%d %f %f...
I = sinusoid2d(10,10,512,64,1); fm = max(2* (1/64) * cos((pi*10)/180), 2 * (1/64) * sin((pi*10)/180) ); Ie = sinusoid2d(10,10,512,64,1/(0.75 * fm)); Ieft = abs(fftshift(fft2(Ie))); Ir=reconstruction(Ie,1/(0.75 * fm),512); colormap('gray'); figure(); subplot(1,4,1); imagesc(I); subplot(1,4,2); imagesc(Ie); subplot(1,...
% Example script to compare several algorihms for low-rank matrix % completion on a random problem instance. For this instance, it calculates % reconstructions of the algorithms, and their respective relative Frobenius % errors. Their error decays are eventually visualized and plotted, both % with respect to the iterat...
% Plot FRF for all tests in Exp 3 where m was varied while k and c were % constant. function rect_q9() %% PRIOR KNOWNS: xunits = "mm"; % Masses of Blocks [kg]: mb1 = 490.5e-3; mb2 = 485.5e-3; mb3 = 240.5e-3; mb6 = 490.5e-3; Mc = mean([0.768, 0.672, 0.553]); % Mean of Cart Masses De...
function [ v ] = to_vec( M ) %TO_VEC Implements the vec operator [n, m] = size(M); v = reshape(M, n*m, 1); end
function bol = startsWith(str,pattern) % % Copyright 2016 Yulin Wu, Institute of Physics, Chinese Academy of Sciences % mail4ywu@gmail.com/mail4ywu@icloud.com bol = false; lp = numel(pattern); if lp == 0 || (length(str) >= lp && all(str(1:lp) == pattern)) bol = true; end end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Description: To mark the detected eye movements upon the EOG and differentiated EOG. %-------------------------------------------------------------------------------------------------------------------------------- % Used in: analyzetrain.m %----------...
% Copyright 2014 - by Magnus Ekeberg (magnus.ekeberg@gmail.com) % All rights reserved % % Permission is granted for anyone to copy, use, or modify this % software for any uncommercial purposes, provided this copyright % notice is retained, and note is made of any changes that have % been made. This software is distribu...
function [PeAct,PeSize,DBW,DT,CC]=FindPlFieldsData(FiringRate,Thh,flag) %Thh=0.66; G = fspecial('gaussian',[4 4],1.5); DT = imfilter(FiringRate,G,'same'); %DT=wiener2(FiringRate,[3 3]); %DT=RM(:,:,48); dd=size(DT); de=dd(1)/2; % flag=0; %% Set to 1 IF THE ENVIRONMENT IS A TORUS if(flag==1) DExt=DT; DExt=cat(2,...
clc clear close all for iteration = 1:30 run( 'main.m' ) end
function v=yellow(u)% one ppixel with three rgb values if(u(1)>=130 & u(1)<=255)%R %190 v(1)=255; else v(1)=u(1); end if(u(2)>=100 & u(2)<=255)%G %160 v(2)=255; else v(2)=u(2); end if(u(3)>=20 & u(3)<=130)%B %80 v(3)=0; else v(3...
load('data\\SEDs\\Scherg N1\\Time') load('data\\SEDs\\Scherg N1\\CondDeviant') indList = 3:10;% Visual isolation of the first peak. Time = Time (indList); Time = Time - Time(1); Time = Time./Time(end); record = record(indList); M = min(record); record = record/M; figure; plot(Time,record,'-','color','k','LineWidth...
%ControlCentor % Example 1: XVector = [0 0 0 0 1 1 0 1 1 1]; YVector = [0 0 0 0 0 0 1 1 1 1]; % Input : the data of two variables X,Y as XVector and YVector % Output: "Sig" returns 1 if X and Y significantly associate otherwise 0 % "PValue" returns the computed p-value % "ContigenMatrix" returns the m*...
clear; clc; format long; options = odeset('AbsTol',1e-13,'RelTol',1e-13); f = @(t,y) [-sin(y(1))*(1+y(2)),y(1)+y(2)]'; y1 = linspace(-15,15,30); y2 = linspace(-15,15,30); [x,y]=meshgrid(y1,y2); size(x) size(y) u = zeros(size(x)); v = zeros(size(x)); % we can use a single loop over each element to compute the deri...
function confusion = gaussOverlap( w1, w2 ) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % gaussian_overlap - estimate cluster overlap from a 2-mean Gaussian mixture model % % Usage: % C = gaussian_overlap( waveforms1, waveforms2 ) % % Description: % Estimates the overlap between 2 sp...
function [ x, y ] = implicitCurve2( F, dFx, dFy, x0, y0, curvelen, stepWidthMin, stepWidthMax, startDir ) %implicitCurve Generiert eine Menge von Wertepaaren mit F(xi,yi)==0 und %xi=x0+stepWidth*i mit i aus 0 bis steps % % F Funktion mit 2 veraenderlichen, dF/dy ~=0 in allen relevanten Bereichen % dFx und dFy sind...
function loadgpx(fileName,varargin) %LOADGPX Loads route points from a GPS interchange file % ROUTE = LOADGPX(FILENAME) Loads route point information from a .GPX % GPS interchange file. This utility is not a general-purpose % implementation of GPX reading and is intended mostly for reading the % files output by ...
clear close all % load the data file data = xls2struct('RMI Microgrid Load Data.xlsx', 'Sheet1'); % Save the output as... outFilename = 'Analyzed Data.xlsx'; peakStart = 16; % 24hr, when does peak time start? peakEnd = 21; % 24hr, when does peak time end? timestep = 5; % Minutes (data resolution) timestep = 60...
function dTau_toe_pushoff_dfy = dTau_toe_pushoff_dfy(in1,in2,Fx,Fy,H,k,cmax,dmax,sampT) %DTAU_TOE_PUSHOFF_DFY % DTAU_TOE_PUSHOFF_DFY = DTAU_TOE_PUSHOFF_DFY(IN1,IN2,FX,FY,H,K,CMAX,DMAX,SAMPT) % This function was generated by the Symbolic Math Toolbox version 8.5. % 04-Dec-2020 16:46:11 q_t1 = in1(:,1); q_t2 =...
% Assignment 2; Problem 3 % Solving an non-convergent infinite series % i.e. S(n) = 1/2 + 2/3 + 3/4 + .... + n/(n+1); %% Setting up the problem % n = 100; % n = 250; % n = 500; n = 1000; %% Performing computation for i = 1:n s = i/(i+1); sAll(i) = s; end
function plotBezier(Bezier,clr) if (nargin == 1) clr = 'b'; end nSamples = 50; t = [0:(nSamples-1)]'/(nSamples-1); controlPoints = Bezier.controlPoints; weights = Bezier.weights; nControlPoints = size(controlPoints,1); n = nControlPoints-1; B = zeros(nSamples,1); xBez = zeros(nSamples,1); yBez = zeros(nSamples,1);...
clc;clear all;close all;restoredefaultpath; addpath(genpath('.')); %% Set the input arguments bse_exe = '/home/ajoshi/BrainSuite19b/bin/bse'; dir={'215_F1979J44','238_F1980J4S','233_F1989J4P','231_M1979J41_2','231_M1979J41_1','221_F1973J56','219_M1984K53'}; premri={'F1979J44_preMRI','F1980J4S_preMRI','F1989J4P_preMRI'...
function [X, y, y_stim, trial, classes, classes_stim] = unpackData(data) %unpackData: Takes in data from paper and unpacks it % % Parameters: % data - struct data from loaded participant file % % Output: % X - EEG data % y - label for whether a letter is being shown (0 = not, 1 = shown but % non-target, 2 = s...
function [ FFstruct ] = init_global_sim(final_time, tstep, firefly_nr, cycle_period, coupling) %%--CONFIGURABLE PARAMETERS-- FFstruct.tstep = tstep; FFstruct.coupling = coupling; FFstruct.final_time = final_time; FFstruct.firefly_nr = firefly_nr; %Number of fireflies FFstruct.firefly_cycle_period = cycle_period; %tim...
clear all;clc; %%this is a simulation of the famous Monty Hall game %%which justifies the "switch door" strategy from the %%player's side %First we need to enter the number of games to be %played number_of_games = input('Enter the number of games to be played: '); strategy = input('Will you switch after Monty opens a ...
function [position,isterminal,direction] = EquilibriumEventFcn(t,x,DE_params_equil,Init,t_scale) % See https://www.mathworks.com/help/matlab/math/ode-event-location.html % for more details. %%%%%%%%%%%%%%%%%%%% % % Name: EquilibriumEventFcn.m % Code authors: Michelle Przedborski, Moriah Pellowe % Last updated: M...
%%sigmoidNorm.m - Sigmoid Normalization %%This function takes a set of stimuli, and evenly distributes them around %%the cicular complex domain using a sigmoid function. Works very well for %%input that follows a normal distribution function [normStimVec, vecMap] = sigmoidNorm(stimulus) %Get the size of the stimul...
load("vowels.mat") [amp,w] = positiveSpectrum(vowel_u) plot(w,mag2db(amp)) title("Espectro positivo de la vocal 'U'") xlabel("Frecuencia rad/muestra"); ylabel("Magnitud dB")
clc clear run_seconds = 2; dx = 1/200; dt = 0.0005; history_interval = 0.2; output_path = 'pictures\'; x_min = -1; x_max = 1; x_res = dx; x = x_min:x_res:x_max; u = ones(size(x)); f = zeros(size(x)); % Square wave f = ones(size(x)); f(x>-0.4&x<0.4) = 2; % Sine wave % f = sin(...
function mimage = createMask(image ,median,stafflocs, pks) %UNTITLED Summary of this function goes here % Detailed explanation goes here %Constants k = 1; %Reshape and gett stafflines from the image %image = rgb2gray(image); [rows, cols] = size(image); %Vi hade tagit bort den men tänker att vi behöver den %[pks, st...
function LDOS = kspec(atoms, points, V, delta, dispersion) % LDOS = kspec(atoms, points, V, delta, dispersion) % Calculates the conductance spectrum % atoms = locations of scattering atoms % points = locations to take spectra at % V = vector of voltages to evaulate LDOS over % delta: scattering phase shift (default i...
Q=B; W=A; z1=Q(1,:)==1; %& sig(1:end-1)>10 & sig(1:end-1)<20; b1=Q(:,z1); z0=Q(1,:)==0; %& sig(1:end-1)>10 & sig(1:end-1)<20; b0=Q(:,z0); tmp=[]; CON=[]; thr=0:0.01:1; res=[]; for th=1:numel(thr) c=(b1(7,:)>=thr(th)); d=(b1(8,:)<thr(th)); e=[c d]; res(th)=(sum(e==0)*(-2) + sum(e==1)*1)/numel(e); ...
function [white, black, grey] = DefineColors white = [255 255 255]; black = [0 0 0]; grey = white/2; end
clc close all clear all GOCE = 1; GPS = 2; MOLNIYA = 3; GEO = 4; MICHIBIKI = 5; deg2rad = @(x) (x/180)*pi; rad2deg = @(x) (x*180)/pi; GM = 398.6005*(10^12); orbit(GOCE).a = 6629E3; orbit(GOCE).e = 0.004; orbit(GOCE).i = deg2rad (96.6); orbit(GOCE).bo = deg2rad (257.7); orbit(GOCE).so = deg2rad (144.2); orbit(GOCE).T...
function d = createTemplateDbase(this, lsReservedName) % createTemplateDbase Create empty template database based for Quantity object. % % Backend IRIS function. % No help provided. % -IRIS Macroeconomic Modeling Toolbox. % -Copyright (c) 2007-2017 IRIS Solutions Team. %----------------------------------------------...
% comb_cprob_ind : Combination of two independent conditional PDF % % Call : % pAgBC=comb_cprob_ind(pA,pAgB,pAgC) % % pA : Prob(A) % pAgB : Prob(A|B) % pAgC : Prob(A|C) % pAgBC : Prob(A|B,C) % % TMH/2005 % function pAgBC=comb_cprob_ind(pA,pAgB,pAgC) pAgBC = pAgB.*pAgC./pA;
function pricing_tf_design_2() clear all; rehash sigma = 0.3; r = 0.05; T = 30; S0 = 1; %% 生成二叉树根 pricer = BinomialPricer; % pricer.set_params_from_optPricer(oi); %% 手动设置参数 pricer.T_ = T; pricer.S_ = S0; pricer.u_ = exp(sigma * sqrt(1/365)); pricer.d_ = exp(-sigma * sqrt(1/365)); pricer.r_ = r; %% 挂载...
function [ctrl, traj] = ctrl_NMPC(quad) import casadi.* opti = casadi.Opti(); % Optimization problem N = 20; % MPC horizon [SET THIS VARIABLE] % −−−− decision variables −−−−−−−−− X = opti.variable(12,N+1); % state trajectory variables U = opti.variable(4, N); % control trajectory (throttle, brake) X0 = opti.parameter(...
comp_color = containers.Map(); comp_color('annotation') = [213, 255, 246]/255; comp_color('text') = [236, 236, 236]/255; comp_color('figure') = [255, 213, 213]/255; comp_color('inset') = [255, 230, 213]/255; comp_color('legend') = [229, 213, 225]/255; comp_color('colorbar') = [213, 246, 255]/255; comp_color...
%% Used for adding new data function [DataMatrix,DataSignal] = AddData(DataMatrix,DataSignal,Resolution,... Classes,Amount_per_class,Signals,tD,t0,tc,tp,run_time) %% Formatting Pixels = Resolution(1)*Resolution(2); %Set each variable to an index to add to the 6D matrix res_dim= find([36,100,256]==Pixels); %make n...
function [X,params] = reduction_pca( X, opts ) p = opts.p; M = zeros(1,size(X,2)); S = ones(1,size(X,2)); if( strcmp(opts.zero_mean,'true') ) M = mean(X,1); X = X - (ones(size(X))*diag(M)); end if( strcmp(opts.unit_variance,'true') ) ...
function [rmn,rpq] =corelation (I,CiI) ff = 10000; for i=1:ff x=randi([1 (size(I,1)-1)]); y=randi([1 (size(I,2)-1)]); m(i)=I(x,y); n(i)=I(x+1,y); p(i)=CiI(x,y); q(i)=CiI(x+1,y); end rmn=[];rpq=[]; m=double(m);n=double(n);p=double(p);q=double(q); Em=mean(m);En=mean(n);Ep=mean(p);Eq=mean(q); Dm=s...
function [yout] = Tx_Rect_QAM(QAM,RiseTime,SampleRate,BaudRate,w) %TX_RECT_QAM Transmitter of QAM rectangular pulses % YOUT = TX_RECT_QAM(QAM,RISETIME,SAMPLERATE,BAUDRATE,W) does upsampling and pulse shaping for % the input signal QAM whose parameters are RISETIME, SAMPLERATE, BAUDRATE. W is the frequency % axis ...
function f = L1(beta) %This function computes the (-) maximum log likelihood global n nb nb1d nb1s lambda se pn wght load 'Data/jecnew'; %% Update lambda and wght series if n==1; load 'Data/wght0.csv'; %The 1st iteration weights come from a Probit estimation in Stata (see probit.do) wght=wght0; pn=wght; ...
%% compansator* syms s s = tf('s'); Vosc = 1.8; L = 10e-6; C = 100e-6; Vin = 3; F0 = 7500; Vref = 1.2; Cf3 = 2.2e-9; Fp2 = 42525; Fz1 = 425; Fp3 = 250e3; Rf3 = 1 / ( 2* pi * Cf3 * Fp2); Fz2 = 850; Rf1 = 1 / ( 2*pi*Cf3*Fz2) - Rf3; Rc1 = 2*pi*F0*L*C*Vosc/Vin/Cf3; Cc1 = 1 / (2*pi*Rc1*Fz1); Cc2 = 1 / ( 2*pi*Rc1*Fp3); B ...
function [z,D] = Highboostfilters(f,cut_off,boost) [M,N] = size(f); F = fft2(f); u = 0:M-1; v = 0:N-1; index_x = find(u > M/2); u(index_x) = u(index_x)-M; index_y = find(v > N/2); v(index_y) = v(index_y)-N; [V,U]=meshgrid(v,u); %Computing distance from point (u,v) to center of frequency rectangle D=sqrt(U.^2+V.^2); H...
function [ jointAngles ] = poseController(poseDesired, config, poseNow) % Snake Monster Walking % BioRobotics Lab % Author: Simon Kalouche % % Pose Estimation and Control % INPUT: poseDesired: [(pitch) rotation about x-axis, (roll) rotation % about y-axis,(yaw) roation about z-axis] % ...
%#codegen function mc_gadget_rgb(r,g,b) coder.ceval('RGB',r,g,b); end
%% Author : Deepak Karuppia 10/15/01 %% Generate 3D calibration pattern: %% Pw holds 32 points on two surfaces (Xw = 1 and Yw = 1) of a cube %%Values are measured in meters. %% There are 4x4 uniformly distributed points on each surface. cnt = 1; %% plane : Xw = 1 for i=0.2:0.2:0.8, for j=0.2:0.2:0.8...
function [] = CrankNicolsoncircle() L = 260; tsteps = 2000*pi; % number of time steps epsilon =0.01; time_step=0.001; % number of sampling points N = 120; % sample rate dl = L / N; % highest frequency detectable kmax= 1 / ( 2 * dl ); % array of x values xl = linspace( -L/2, L/2, N ); % array of k values kl = linspac...
function [x,y] = de_casteljau(n, x_p, y_p, u) %DE_CASTELJAU: esegue l'algoritmo di DE_CASTELJAU. %Input: %-n: numero di punti di controllo %-x_p: vettore dei punti, componente x %-y_p: vettore dei punti, componente y %Output: %-x: componente x del punto della curva restituito dall'algoritmo %-y: componente y d...
%load Cactus_cfp8_3d_transB_5lev; %load ParkScene_cfp8_3d_transB_5lev; %load Kimono_cfp8_3d_transB_5lev; %load CrowdRun_cfp8_3d_transB_5lev; %load BQTerrace_cfp8_3d_transB_5lev; %load OldTownCross_cfp8_3d_transB_5lev; Ldc=coef(:,:,2); L5=coef(:,:,5); L4=coef(:,:,9:10); L3=coef(:,:,17:20); L2c=coef(:,:,33:40); L2b...
function hidden_states = multinomial_exp_sample(X, C2D, N_H2D) % TEST 1 % C2D = [2 2] ; % N_H2D = [4 4] ; % X = 1/4*ones(3, 16) ; % TEST 2 % C2D = [2 2] ; % N_H2D = [4 4] ; % X = 1/1000*ones(3, 16) ; % TEST 3 % C2D = [2 2] ; % N_H2D = [4 4] ; % X = 1/1000*ones(3, 16) ; % X(1,:) = 1/4*ones(1, 16) ; ...
%[hPlot]=activityMultiTracePhysicalSpacePlot(h,Channels,Waveform,En,varargin) % Function purpose : Plots the raw voltage data on the real space of the electrode % % Function recives : Channels - the channels vector % Waveform [NChannels,Trials,Time] - the raw voltage s...
% Script that creates artificial data and then runs all the steps of the % code on the artificial data % Initialize all the features to generate artificial data room = [5 4 20]; absorp = [0]'; Fs = 22050; mic = zeros(20,3); src = zeros(20,3); rir = zeros(20,15000); positions = zeros(20,3); c = 343; for i = 1:20 p...