text
stringlengths
8
6.12M
function q=Isotherm(y, P, T, isotherm_parameters) %hypotheticalisotherm- Calculate the molar loadings of a two component mixture % Calculate the total loading of a two component mixture loading. It is % assumed that the isotherm is able to be represented by a dual site % langmuir competitive isotherm with tem...
function isValidMat = validateLidarMatFile(absPathToLidarFile, simConfigs) %VALIDATELIDARMATFILE Validate whether the input dir is pointing a valid %result .mat file for the LiDAR file. If not, replace it with the correct %one. % % Inputs: % - absPathToLidarFile % The absolute full path to the .mat file to valida...
%% conv2_mult function y = conv2_mult(a, B, convopt) y = []; for i=1:size(B,3) y(:,:,i) = conv2(a, B(:,:,i), convopt); end return end
% SLAM_2D_NONLINEAR % 16-833 Spring 2020 - *Stub* Provided % A 2D SLAM algorithm % % Arguments: % none % % Returns: % none % function slam_2D_nonlinear() %% Load data close all; clc; addpath('../util'); load('../../data/2D_nonlinear.mat'); %% Extract useful info n_poses = size(gt_traj, 1); n_landmarks = size...
function x = conjgrad(A,b,x) % conjgrad - solves the system of linear equations Ax = b via conjugate gradient (code example from http://en.wikipedia.org/wiki/Conjugate_gradient_method) % % Syntax: % x = conjgrad(A,b,x) % % Inputs: % A - [matrix] % b - [array] % x - [array] initial solution; can be a vector of...
classdef CondModel < ParamModel methods(Abstract = true) inferOutput; end end
function [ spif triggerif d ] = util_load_mcds( opmode, varargin ) %UTIL_LOAD_MCDS Read MCD files. % This is a shortcut for % util_load_spike_trigger_mcdstream_from_multiple_files % and util_load_spike_trigger_mcdstream % Please refer to the original function. % % Input: % opmode: 'one' / 'm...
function isborder = determine_border_vertices_vol_tet(nv, elems, sibhfs, isborder, quadratic, varargin) % DETERMINE_BORDER_VERTICES_VOL Determine border vertices of a volume mesh. % % ISBORDER = DETERMINE_BORDER_VERTICES_VOL(NV,ELEMS) % ISBORDER = DETERMINE_BORDER_VERTICES_VOL(NV,ELEMS,SIBHFS) % ISBORDER = DETERMINE_BO...
function [x_filtered] = Filter(x,verbose) %FILTER Summary of this function goes here % Detailed explanation goes here % Eye tracker has a sample rate of 120Hz, but the analog output is 1000Hz. analog_freq = 1000; %hz eye_tracker_freq = 120; %hz freq_diff = analog_freq / eye_tracker_freq; % to smo...
% sub = rossubscriber('/stable_scan'); % scan_message = receive(sub); % r = scan_message.Ranges(1:end-1); % theta = [0:359]; %Initialize theta and ROS stuff sub_bump = rossubscriber('/bump'); sub = rossubscriber('/stable_scan'); pub = rospublisher('/raw_vel'); msg = rosmessage(pub); w = 0.2; d = 0.2413; vR = -w*(d/2)...
% Calculate a translation parameter and a rotation parameter between the reference % frame and the current frame function [locallattice_A0,locallattice_B0,A0_coor,B0_coor,rotationdegree,... translationinpixels,elapsedtime]... =featurebasedtracking(referenceframe,currentframe) %% Inputs and output...
function n_ms = cruces_zero(x,fs) n = 0; for i = 1:length(x)-1 if x(i+1)*x(i) < 0 n = n+1; end end ms = 1000*length(x)/fs; n_ms = n/ms; end
function [err] = m3f_tif_exper(experName, dataName, splitNums, initMode, ... seed, numFacs, KU, KM, numTopicFacs) %M3F_TIF_EXPER Run m3f_tif Gibbs sampling experiments. % % Usage: % [err] = m3f_tif_exper(experName, dataName, splitNums, initMode, seed, % seed, numFac...
function sim_start % % simulation example for use of cloud dispersion model % % Arthur Richards, Nov 2014 % %% Simulation state % time and time step t = 0; dt = 1.0; % The minimum distance at which a pair of UAVs may be without crashing into % each other uavCrashRadius = 15.0; % The minimum distance apart at which a...
%%%%% x(k+1) = A x(k) + B u(k) %%%%% y(k) = C x(k) + D u(k) Note: Assumes D=0 %%%%% %%%%% Illustrates open-loop prediction %%%% yfut = P*x + H*ufut + L*offset %%%% [offset = y(process) - y(model)] %% Fahrzeugparameter f¨¹r MPC Controller Design % Physical parameters g = 9.81; Pi = 3.1416; % E-Moto...
%% Stelling 12 % % De functie aanroep 'zeros(3)' genereert een matrix % met 3x3 elementen. % Antwoord = 1;
%% Main clear all; clc; close all % Global varialbes global env global log % Create rocket class DTF = rocket(init_rocket());% creates class with the initial values %% motor_init( DTF ); %loads rocket motor %% % Initilize Environmental variables % optional argument: Elevation(m) Temperature(C)and Pressure(Pa) env = env...
function out = sbxReadTiff(dir_path) %SBXREADTIFF Reads a directory of tiffs, specified by dir_path, in order, % and makes them available for use in other sbx functions if exist(dir_path) ~= 7, out = []; return; end if dir_path(end) ~= '\', dir_path = [dir_path '\']; end % Get a list of tiff files in th...
% rotate image clockwised around center point (1,1), with a radius degrees % input1---source image: I % input2---rotation degrees: radius (ex: pi/3) % output---rotated image: I_rot function I_rot = rotation(I, radius); % RGB channel R(:,:) = I(:,:,1); G(:,:) = I(:,:,2); B(:,:) = I(:,:,3); % get height, ...
clc; clear all; close all; data = csvread("..\..\Data\PETR4.SA.csv", 2, 1); adj = data(:,5); figure plot(adj) grid on mean(adj) var(adj) std(adj) figure autocorr(diff(adj))
% function Kernel % - inputs : tau, and trainingSet x % - Output : K the kernel matrix with : for all i, j in [1, length(x)], Kij = exp(-0.5*tau*|xi-xj|^2) function [ K ] = Kernel( x, tau ) d=sum(x.*x,2); % the diagonal of x*x' A = 0.5*d*ones(1,length(d)) + 0.5*ones(length(d),1)*d'-x*x'; K = exp(-tau*A); end
clear model; names = {'x', 'y', 'z'}; model.varnames = names; model.Q = sparse([1 0.5 0; 0.5 1 0.5; 0 0.5 1]); model.A = sparse([1 2 3; 1 1 0]); model.obj = [2 0 0]; model.rhs = [4 1]; model.sense = '>'; %gurobi_write(model, 'qp.lp'); results = gurobi(model); results.x
function [ dist ] = distance( V_2d_c1_noi, V_2d_c2_noi, F_noi ) %UNTITLED Summary of this function goes here % Detailed explanation goes here % Camera 2 dist_2 = []; for i = 1:size(V_2d_c1_noi,2) lm_2 = F_noi * [V_2d_c1_noi(:,i);1]; x = V_2d_c1_noi(1,i); y = V_2d_c1_noi(2,i); dist_2(i) = abs(x*lm_2(1...
%% -- ZEROTREE WAVELET VIDEO CODER -- %% % This is an algorithm that recreates the zerotree wavelet coding for video. % Based on the work of the following paper: % - Stephen A. Martucci, Member, IEEE, Iraj Sodagar, Member, IEEE, Tihao Chiang, Member, IEEE " A Zerotree Wavelet Video Coder" %% -- CLEARING MATLAB -- %...
function [ media ] = filtering( x) %media mobile: funzione che calcola la media su una finestra di valori pari %a passo, media con shift pari a passo filtCutOff = 1; sample=30; [b, a] = butter(3, (2*filtCutOff)/sample, 'low'); media = filtfilt(b, a, x); end
function TransformedD = importDigital(p) path=strcat(p,'DEV\MATLAB\ETL\DATA\Digital'); GoogleMktRef=readtable(strcat(p,'DATA\ReadIn\GoogleMktRef.csv')); MSNMktRef=readtable(strcat(p,'DATA\ReadIn\MSNMktRef.csv')); %% LOAD & CONCAT DATA for file=dir(path)' if ~file.isdir load(strcat(path,'\',file...
function [ dataT, dataN ] = AddNoChecksGroup( dataT, dataN, strQuest, nGroup ) %UNTITLED4 Summary of this function goes here % Detailed explanation goes here nRows = size( dataT, 1 ); nCols = size( dataN, 2 ); qNo = zeros(1, nCols) - 1; qCount = 1; c = 1; while c < nCols strQ = dataT{1,c}; hasLParen = find...
%% 4D matrix research close all; clear all; clc; %% Load Data % load synthetic data tensor load('SynthGoUp.mat'); % get 5 different sources (go up 1 meter every time) source1=zeros(1000,10,3); source2=zeros(1000,10,3); source3=zeros(1000,10,3); source4=zeros(1000,10,3); source5=zeros(1000,10,3); source1(:,...
function [] = plot_coord_sys(frame, vLen) % Function to plot a coordinate system using a frame % % Parameter 1: frame of a pose % Parameter 2: length of the coordinate system vectors % % No return values % % get size of frame [rows cols] = size(frame); % number of rows and...
function [ index_ineq, num_max, flag_ineq_region ] = define_inequation_node_less_old(nodes, index_node, set_ineq, branch_index, controls) %UNTITLED5 Summary of this function goes here % Detailed explanation goes here %Find inequation that define the regions but were not used set_new_index_ineq = []; ...
function [K,F] = enForceBCs(bNodes,bValues,K,F) BC = K(:,bNodes)*bValues; %u(0)K(:,1)+u(1)K(:,end) % Modify F F = F - BC; % Update Nodes in F F(bNodes) = bValues; % zero out corresponding columns and rows K(bNodes,:) = 0; K(:,bNodes) = 0; % change Nodes in K K(bNodes(1...
function yenddiff = yenddiff_vs_yinit(y_init) % Matlab Function to calculate the difference between the y value % at boudary and required value % y_init: Initial y value (RHS boundary value % yenddiff: The difference between the y value at boudary % and required value % Store the ODEs as functions ODE = @(x,y) -x*y-y...
function [Rt, Rmp, Rp, D] = DecompAffine(A) %{ computes the decomposition of the blockmatrix A of an affine 3x3-transform H_a where H_a = [ A t 0' 1] We can use that A is decomposable using the SVD: A = UDV' = UV'VDV' = (UV')(VDV') = (Rt)*(Rmp*D*Rp) where U and V are orthogonal matrices & D is a d...
% texture of the spin-vortex core % % b'' + b'/r = sin2b (1/r^2-1/xi^2) % % function polar_spinv() find_figure('polar_spinv'); clf; hold on; x=0:0.05:8; b=text1(x); plot(x,b, 'b.-'); plot(x, -pi/2*(1-exp(-x.^2/6)), 'r-'); plot([0 x(end)], -pi/2*[1 1], 'k-'); end % find texture with -pi/2 BC % x = 0....
clear; % Input image house = godthem256; % 1 for the simple differences operator % 2 for the central differences operator % 3 for the Roberts cross edge operator % 4 for the Sobel operator gradmagnhouse_1 = sqrt(Lv(house, 1)); gradmagnhouse_2 = sqrt(Lv(house, 2)); gradmagnhouse_3 = sqrt(Lv(house, 3)); gradmagnhouse_4...
classdef TestcomputeSphericalJointConstraints < matlab.unittest.TestCase % TestcomputeSphericalJointConstraints performs unit testing for computeSphericalJointConstraints properties end methods (Test) function testComputationIdentity(testCase) % testComputationIdentity tests...
function image = createImageFromRtDose(rtdose) %CREATEIMAGEFROMRTDOSE creates an Image object using the binary data of the RtDose file % % image = createImageFromRtDose(rtdose) % % See also: RTDOSE, DETERMINEDOSEVECTORS, IMAGE if ~isequal(rtdose.imageOrientationPatient,... [1;0;0;0;1;0]); warnin...
close all; clear; clc; neweva = [1, 1.0657, 1.0997, 1.0856; 2, 2.0863, 2.2242, 2.1596; 3, 3.0986, 3.3934, 3.2405; 4, 4.1020, 4.5027, 4.3442] fig = figure('Position',[0 250 800 350]); h = bar(neweva(:,1)',neweva(:,2:4)); set(h(1),'FaceColor','red'); set(h(2),'FaceColor','black'); set(h...
%Simulated Annealing example function xyz() ObjectiveFunction = @simple_objective; X0 = [0.5 0.5]; % Starting point lb = [-64 -64]; ub = [64 64]; [x,fval,exitFlag,output] = simulannealbnd(ObjectiveFunction,X0,lb,ub) end function y = simple_objective(x) y = (4 - 2.1*x(1)^2 + x(1)^4/3)...
clc; clear; load('linear.mat'); K=10; %% Sample Generate N=1000; iter = 400; s1_mu = [0,0]; s1_cov = eye(2); a_real = [0.35,0.65]; thr = [0,cumsum(a_real)]; u = rand(N,1); label = zeros(N,1); X = zeros(N,2); indice1 = find(thr(1)<=u & u<thr(2)); sample_num_1 = length(indice1); fprintf('sample 1 number: %d \n', samp...
function result=GetAmplitude(Txant,Rxant,Subc,RawCSI) %从csi_entry中获取csi(rawcsi即已经过read_bfee(bytes)读取后的结果,具体可以参考入侵检测代码中的相关部分) %csi_entry= csi_trace{i+startPkt}; csi = get_scaled_csi(RawCSI); result=db(abs(squeeze(csi(Txant,Rxant,Subc)))); end
function p = delayModel(p,stims,weights_before) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Matlab code for making a Self Organising Feature Map grid (SOFM) % % Rosie Cowell (Dec 2011) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Represent the...
function [an, xmu, xsigma ] = nanzscore(X) if any(isnan(X(:))) xmu = nanmean(X); xsigma = nanstd(X); x = (X - repmat(xmu, length(X), 1))./repmat(xsigma, length(X), 1); an = x; else [x, xmu, xsigma] = zscore(X); end end
%First I ran 'VideoToFrame.m' to convert video into frames (all folders) %Then I ran 'BorderOnImg' to put boxes on original locations of drones (all folders) %'MainCode.m' is ran in 30 given folders with YOLOv3 outputs. M = readmatrix('DataFolder'); % Information from YOLOv3 (see 'DataMatrixSF.m') MN = 1; % if ...
tspan = [0, 213]; n = 42600; m1 = 1; m2 = 1; m3 = 1; sol0 = [0.97000436, -0.24308753, -0.97000436, 0.24308753, 0, 0,... 0.466203685, 0.43236573, 0.466203685, 0.43236573, -0.93240737, -0.86473146]; [t,sol] = euler3(@(t,y) threemass(t, y, m1, m2, m3), tspan, sol0, n); hold on figure(1) plot(sol(:,1),sol(:,2), ...
%% Init PAR function - for initializing the parameters of GEA/BAT/PSO algorithm % Standard procedure for initializing, applicable for all three algorithms % - GEA, BAT, PSO function [Sol, Fitness, fobj, lb,ub] = initpar(pars,options); n = options.n; d = pars.nvar; func = pars.fgname; [lb,ub,fobj,func_min] ...
%MATLAB CODE ASSIGNMENT 2 ENPM662 %ANSWER 2 clc clear all %writing the code for A matrices %%declaring the variables and symbols for the matrix multiplication syms d1 d2 d3 l1 l2 l3 theta1 = -90; theta2 = -90; theta3 = 90; a1=0; a2=0; a3=0; alpha1=-90; alpha2=-90; alpha3=0; %%The general form of ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Copyright (C) 2016 Armin Alaghi and N. Eamon Gaffney %% %% This program is free software; you can resdistribute and/or modify it under %% the terms of the MIT license, a copy of which should have been included with %% this program at ht...
%***************************************************************** % Description: phase de-noising based on thresholds for spatial source phase % Usage: % pS = phase_denoising(cS) % Input: % cS: the corrected spatial map estimate with dimension 1 x V % Output: % pS: the corrected and denoised spatial...
%lyy33 clear all Q=load ('lye_1_25.TXT'); d=size(Q) t=Q(:,2); y=Q(:,1); y1=Q(:,3); y2=Q(:,5); u=0.25; % y=y(1:10:d); t=t(1:10:d); figure(1) plot(t,y); grid on pause y=y/400; y11=y(3:173); p1=y11'; T=y(4:174); T=T'; load step1; u=u(1:171); p2=u'; P=[p1;p2]; k1=1:171; S1=7; P=[p1;p2]; net=newff(minmax(P),[S1 1],{'...
function [net] = trainingNetwork(T,net,threshold,maxIteration) %% Code = 1, training is successful otherwise its not successful. trainingSize = 7; % 70% percent of data will used to train the method.yy trainingData = T(1:round(0.9*end)); % use 90% for training data testData = T(round(0.9*end):end); % 10% for testing co...
function ConvertMSUAlarm3(fileName) fid = fopen(fileName); dat = fscanf(fid, '%f %f %f %f', [4 inf]); fclose('all'); fid = fopen([fileName(1:end-3) 'alm'], 'w'); for i=1:size(dat,2) fprintf(fid,'%d,%f,%f,%f\n', i, dat(4,i), dat(3,i), dat(2,i)); end fclose(fid);
function x_bin = toBin(x, l, u, N) % toBin - Uses binaryDiscritization() % This function works with vector inputs for x, l, u % returns a char array length(x) by log2(N) % x - value to be discritized % l - lower bound % u - upper bound % N - number of discretization ranges for i = 1:length(x) x_bin(i,:) = binary...
function [R_ans, t_ans] = correct_changed_cams(changed_views , changed_cams, R_ans, t_ans) if (changed_views == 1) T = diag([-1 -1 1]); for i = 1:size(t_ans, 2) Ri = eye(3); if (length(size(R_ans)) > 2) Ri = R_ans(:, :, i); else Ri ...
function [output] = special_smooth_2d(input, win, bins1, bins2, nGrid) output = zeros(size(input)); nGrid1 = nGrid(1); nGrid2 = nGrid(2); x1 = (-nGrid1:nGrid1)/nGrid1; x2 = (-nGrid2:nGrid2)/nGrid2; Smoother1 = exp(-x1.^2/win(1)^2/2); Smoother2 = exp(-x2.^2/win(2)^2/2); Smoother1 = Smoother1./sum(Smoother1); Smoothe...
clc close all ponto = 0; hue = plot(50,50,'rx','LineWidth',2); axis([0 127 0 255]); hold on for i = 1:255 plot(i,ponto,'rx','LineWidth',2) ponto = ponto +1; pause(.001); end
function [ ] = make_ace_gas_vmrs_with_pratmo( tanstruct_o3_in, tanstruct_T_in, save_appendix, gasnames_in ) %A function to calculate the the VMRs of trace species at multiple local %solar times (LSTs) throughout the days of ACE measurements, at the %measurement locations. The values can be used to create ratios that ca...
% rectangle('Position',[6 16-8 5 2], 'FaceColor',[0.8 0.8 0.8]) % hold on % rectangle('Position',[11 16-8 5 2], 'FaceColor',[0 0 0]) % % axis([0 16 0 16]); %[sortedX,sortingIndices] = sort(classifer_weights,'descend'); clear all; % load('classifier_weights_10.mat'); % [sortedX,sorti...
classdef XmlProcessReader %XMLPROCESSREADER Summary of this class goes here % Detailed explanation goes here properties(Constant,Access=private) logger = ether.log4m.Logger.getLogger('ether.process.XmlProcessReader'); end methods function process = read(this, filepath) import ether.process.*; this.l...
function plotAnkle(pathJ,ankleThreshold,dt) [pathH,~] = size(pathJ); t = dt*(1:pathH); subplot(1,3,1); plot(t,pathJ(:,5),'b') xlabel('Time [s]'); ylabel('\phi [rad]'); subplot(1,3,2); hold on plot(t(1:end-1),diff(pathJ(:,5)),'g*'); plot(t,ankleThreshold*ones(...
% the LCMV filter in a two source scenario % reference: Multichannel Eigenspace Beamforming in a Reverberant Noisy % Environment With Multiple Interfering Speech Signals, 2009 % % Ziteng Wang @ 201812 % % Note: by setting g=[1; 0], LCMV attenuates the second source to some % extent. % When using MVDR, the interferece...
function [ m , v ] = build_bound_matrix( c , i , j ) [row col] = size(c) ; m = zeros(3) ; v = false(3) ; for ni = 1:3 c_i = i-2+ni ; for nj = 1:3 c_j = j-2+nj ; if c_i >= 1 & c_i <= row & c_j >= 1 & c_j <= col m(ni,nj) = c( c_i , c_j ) ; v(ni,nj) = true ; ...
function [x0,x] = cvx_markowitz(mu0,mu,V,sigma,xx0,xx,trans_cost); n = length(mu); U = chol(V); cvx_begin quiet variables x0 x(n) y(n) total_trans_cost maximize(mu' * x) subject to norm(U * x) <= sigma; ...
function Prediction_Sig = Regression_Prediction_Sig(Real_Prediction_Path, Rand_Prediction_Path_Cell) load(Real_Prediction_Path); RandomQuantity = length(Rand_Prediction_Path_Cell); for i = 1:RandomQuantity i tmp = load(Rand_Prediction_Path_Cell{i}); Rand_Corr(i) = tmp.Prediction.Corr; Rand_MAE(i) = t...
function drawBoundingBox(xBnd,yBnd,zBnd,lineWidth,color) % drawBoundingBox(xBnd,yBnd,zBnd,lineWidth,color) % % This function draws the wireframe box that as described by the limits in % xBnd, yBnd, and zBnd % hold on; % Draw the bottom: plot3(... [xBnd(1), xBnd(1), xBnd(2), xBnd(2), xBnd(1)],... [yBnd(1), yBn...
%% Dimensionamento %{ f0 = 40e3; w0 = 2*pi*f0; L = 2e-3; Rs1 = 250; Rs2 = 500; fn = 10e3/f0 : 0.01 : 90e3/f0; function y = Q0 (Rs, w0, L) y = w0 * L / Rs; end function y = In (fn, Rs, w0, L) y = 1./sqrt(1 + Q0(Rs, w0, L)^2 * (fn - 1./fn).^2); end figure; plot(fn, In(fn, Rs1, w0, L)); title('Rs = 250 \Omega', 'in...
function [XResult,YResult]=PSO_Stand(SwarmSize,ParticleSize,ParticleScope,IsStep,IsDraw,LoopCount,IsPlot) %输入参数:SwarmSize:种群大小的个数 %输入参数:ParticleSize:一个粒子的维数 %输入参数:ParticleScope:一个粒子在运算中各维的范围; %         ParticleScope格式: %           3维粒子的ParticleScope格式: %                          [x1Min,x1Max %                   ...
function dataset = dir_to_dataset(directory) files = dir(sprintf('%s/*.png',directory)); n_files = length(files); dataset(n_files) = struct('img', NaN*ones(480,640,3), 'thm', NaN*ones(8), 'lbl',[]); for n = 1:n_files dataset(n).img = imread(sprintf('%s/%s',directory,files(n).name)); thm_name = sp...
function [imhs, fig_h] = show_abundances(A2, m, n, title, plot_row, plot_col, options) if nargin < 2 if ndims(A2) ~= 3 return; end end if nargin < 4 title = 'Abundances'; end if ndims(A2) == 3 [m,n,M] = size(A2); A2 = reshape(A2, [m*n,M]); end endmember_num = size(A2,2); if nargin < 5 || ...
function q6(imagename) a=[10,70,150,-10,-70,-150] f= imread(imagename); subplot(length(a) + 1,1,1), imshow(f); for k =1 : length(a) sum = f+a(k); sum(sum>255)=255; subplot(length(a) + 1,1,k+1), imshow(sum); end
% Mahshid % Machine Learning Project 1 % Main Function %% clc clear all close all format long %% Choose the type of effect/data to be studied and startup parameters run_task=1; while run_task==1 choice_data=menu('Please choose what you want to study','Facial Expressions Effect','Pose Effect','Illumin...
clc; clear; %close all; snrRange = -10:2:80; ber_OFDM = []; ber_UFMC = []; freqO = 0.8; for i = snrRange ber_OFDM(end+1) = berOFDM(i,freqO); ber_UFMC(end+1) = berUFMC(i,freqO); end figure('name',num2str(freqO)); semilogy(snrRange,ber_OFDM,'ro--'); hold on; semilogy(snrRange, ber_UFMC,'bx--'); title('Compari...
nRepeats = size(pkStim,3); b1_end = floor(nRepeats/2); nPartitions = 1e3; spkThresh = 1; stimCells = find(stimMag>spkThresh); respCells = find([roi.group]==1 | [roi.group]==9); distThresh = 20; trueCons = nan(nPartitions,length(respCells)); shufCons = nan(nPartitions,length(respCells)); for nPartition = 1:nPartitions ...
waveFile='\dataSet\dean\201005-mirRecording\Record_Wave/陳亮宇_1/中華民國國歌_不詳_0_s.wav'; [y, fs, nbits]=wavread(waveFile); frameSize=512; overlap=0; frameMat=buffer2(y, frameSize, overlap); frame=frameMat(:,54); [magSpec, phaseSpec, freq, ps]=fftOneSide(frame, fs); n=length(ps); order=10; ave=polyval(polyfit((1:n)', ps, order...
function [] = project4(xi) %PROJECT4 Compute the estimate of input xi with varying degrees of % accuracy using both natural and clamped cubic splines, as well % as an calculating the hermite polynomial and an estimate at % x=2.8. % % calling sequences: % project4(xi); % % ...
function pixellist = globalToLocalPixelList(pixellist, offset, ... globalVolSize, localVolSize) [r, c, z] = ind2sub(globalVolSize, pixellist); c = c - offset(1); % xOffset r = r - offset(2); % yOffset z = z - offset(3) + 1; % zOffset %truncate synapses outside downloaded data indC = find(c == globalVolSize(2));...
% Starter code prepared by James Hays %This function will predict the category for every test image by finding %the training image with most similar features. Instead of 1 nearest %neighbor, you can vote based on k nearest neighbors which will increase %performance (although you need to pick a reasonable value fo...
function [ acc ] = ComputeAccuracy( X, Ys, convnet ) % Compute the accuracy numOfSamples = size(X, 2); [P, ~, ~] = EvaluateClassifier( X, Ys, convnet ); % Find the maximum value and the position [~, max_pos] = max(P); numOfCorrect = 0; for i = 1:numOfSamples if Ys(max_pos(i), i) == 1 numOfCor...
function t = H(mesh,points,q,xi,eta,Q) N = max(size(points)); d = min(size(points)); if(d==2) M = sqrt(max(size(mesh))); f = zeros(M,M); for i = 1:N for ii = 1:M for iii = 1:M %for j = -Q/2:Q/2 f(ii,iii) = f(ii,iii) + q(i)*((-2*xi^2)/(pi*...
%prep zscored traces for i=1:length(dend) dend(i).ztrace=zscore(dend(i).normtrace); dend(i).ztrace_st=dend(i).ztrace(:); end filename='p25_mag2_gen_gen_trace'; save(filename,'dend'); %% %%raw traces for all cells f=figure (1); f.Position=[1,1,1000,1000]; axis = (1:180); n= 8;%number of rows m= 7;%number of ...
clear;clc;figure%close all tic recdate='Sep_10_13'; cellnum='B'; trial=1; module='v_clamp_resistance'; % load([module '_' recdate '_' cellnum]) starting_v=-0.07; % Voltages are in volts first_prestep_v=-0.09; last_prestep_v=-0.07; increments=5; step_v=-0.06; resistance_v=-0.065; starting_t=2; % Times are in seconds p...
function [params, bins_res, cloud_res] = paralelel_reconstruction(model_cloud, params, params_baund, n_iter, n_neighb, settings) settings.n_neighb = n_neighb; results = zeros(n_iter,5); if strcmp(settings.model, 'CV2DoF') results = zeros(n_iter,3); end; parfor i = 1 : n...
% Parameters for MRAC clear clc %% Plant A = [-3.1074 0.9744;0.4501 -4.1003]; B1 = [663.1022;1331.7824]; B2 = [-42.7000;116.5044]; %Bm3 = [-14.2485;-26.8107]; B = [B1,B2]; d = [0.21;0.44]; %% Desired Trejactory Am = [-3.3808 1.2954;0.4444 -3.0501]; Bm1 = [667.8408;1333.9594]; Bm2 = [-39.2134;117.2730]; %Bm3 = [-14.24...
function val_ = ddOUn_val(fits, data, param) % function vals_ = ddOUn_val(fits, data) % % Compute the DV given A and lambda (the drift rate and the leak term) % based on an Ornstein-Uhlenback model. The DV is given by % % mu = A*COH./LAMBDA.*(exp(LAMBDA*T-TAU)-1), % % , where TAU is the neural delay. % % % INPUTS...
function [channels, phase_avg, ampl_avg, I, Q, sync] = decodeAvg(filename, singleChannel) if nargin < 2 singleChannel = 1; end if singleChannel: [I, Q, sync] = decodeSingleChannel(filename); channels = []; % eventually want to parse the config file to grab this Fs = 2.4e6; else [I, Q, sync] = decodeData(filenam...
classdef NeuronReader < handle % A NeuronReader can be used to read neuron files that were generated % with the NeuronMonitor utility in CARLsim. The user can then directly % act on the returned neuron data. % % To conveniently plot group activity, please refer to NeuronMonitor. % % Example ...
function outflag=inastring(loc,tempstr) apost=0; for k=1:loc if strcmp(tempstr(k),''''), apost=apost+1; end if ((strcmp(tempstr(k),' '))&(mod(apost,2)==1)), tempstr(k)=','; end end outflag=mod(apost,2);
function data_save(h,x,t,timeTaken,xN,xL,tL,H1,H2,m2,m3,s1,s2,Q) filename = data_filename(xN, xL, t, H1, H2, m2, m3, s1, s2, Q); save(filename, "x", "t", "h", "timeTaken", "xN", "xL", "tL", ... "H1", "H2", "m2", "m3", "s1", "s2", "Q"); end
close all clear all gamma = 4; A_c = 100; % just picked a random number C = 1; % dont know this shit yet M = 1:1:10; A_cm = (A_c .* M.^-(2/gamma)); A_cmtot = A_cm .* M; figure() plot(M,A_cm); grid on; title('A_{cm} [m^2] for a given number of antennas, \gamma=4'); xlabel('M'); ylabel('Area [m^2]'); figure() plot(M,...
function [sst,xlons,ylats] = read_goes(fn,varargin) % % FILENAME: read_goes.m % % USAGE: To run this program, use the following command: % % [sst,xlons,ylats] = read_goes(FILENAME) % or [sst,xlons,ylats] = read_goes(FILENAME,CLOUD CONTAMINATION PERCENTAGE)') % % DESCRIPTION: This file contains one (1) Matlab progr...
function[o]=ObjectiveFunction(x) %o = sum(x.^2);% OSphere Testfunction x = x-[-10,-10]; o = sum ( abs(x) ) + prod( abs(x) ); o = o + 100; %o = sum(x)./(1+sum(x.^2)); end
%% model parameters Vst= 0.15; %maximum stomatal conductance cm/s Vcut=0; %cuticular deposition velocity cm/s Rm = 0.1; %mesophyllic resistance s/cm options = [3:3]; %model will run through as many laps as number of factors. Here is where you can ``set the code to loop through different vaiables. ...
%MÉTODO DE RUNGE-KUTTA-FEHLBERG % - Introduzca la ecuación diferencial : 'Dy=y-(x^2)+1' % - Introduzca la condición y(a)=b : 'y(0)=0.5' % - Introduzca la función de trabajo : y-(x^2)+1 % - Introduzca la condición inicial : 0.5 % - Introduzca el valor de a : 0 % - In...
function [index_vals,vector_vals,final_node] = kd_closestpointgood(tree,point,node_number) % pramod vemulapalli 02/08/2010 % isnpired by work done by Andrea Tagliasacchi, simon fraiser university %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % INPUTS % tree --- the cell array ...
function ota_sumup(do_plot) if nargin == 0 do_plot = 0; end cd raw f = fopen('../workspace/input_diff.sp'); if f == -1 fprintf('## Invalid file workspace/input_diff.sp ##'); input_diff_read = NaN; else line = fgetl(f); if ischar(line) s = regexp(line, '=', 'split'); input_diff_rea...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Main file to test normalization of probabilistic %inference in a lower dimensional space represented %by a series of Gaussians. %An even distribution of Gaussians over -1,1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Constants num_basis = 20; %Number of basis functi...
function haskinsnirs(ParticipantID,PolhemusStatus,time) %polhemusstatus - set this as 1 if you want to process polhemus, set as 0 %if you already have a polhemus saved %time is 1 or 2 or 3 depending on visit %ParticipantID should be noted in single quotes. eg. '401001' if time~=1 if exist('/data3/') pathname = strcat...
clear all; close all; clc; addpath('../tree_matlab/'); addpath('../export_fig/'); load global_params_incr.mat; N_T = 3; room_size = [6;8]; %Breadth x Length L = room_size(2); B = room_size(1); AP_loc = [L/2; B/2]; client_loc(1) = B*rand client_loc(2) = L*rand b_R = 2*pi*(20/360); Nang = 100; RX_training_cw = NaN(N...
clear all; close all; clc; addpath('../lib'); addpath('../functions'); r = Rosenbrock(); disp(r.arity()); r.contour([-1,3],[-1,2],@(z) log(1+z), 100 ); axis equal ; search_method = GoldenSearch(); %search_method = LinesearchArmijo(); gradient_method = MinimizationGradientMethod(search_method,1e-6,10000,true); ...
% This code constructs a signed distance function from % the interface defined by {phi0 = 0}. % % http://www.math.lsa.umich.edu/~psmereka/LEVELSET/levelsetcodes.html % Retrieved May 2016 % Modified, May 2016, Kevin Chow % % Grid parameters N=100; h=2/(N-1); x=-1:h:1; y=x; [X,Y]=meshgrid(x); dt=0.20*h; %tf=0.10; nt...