text
stringlengths
8
6.12M
function loc=LMSloc(X) %Syntax: loc=LMSloc(X) %_____________________ % % Calculates the Least Median of Squares (LMS) location parameter % of the columns of a matrix X. If X is a vector, it returns the LMS % location parameter of its components. If X is a scalar, it returns % X. % % loc is the LMS estimated v...
function h = hog_norm_hist(block, n, filter, dir_edges) x_grad = conv2(block, filter, 'same'); y_grad = conv2(block, filter', 'same'); angles = atan2(y_grad,x_grad); mags = sqrt(y_grad.^2+x_grad.^2); [N,B] = histc(reshape(angles,[n^2 1]), dir_edges); h = zeros(length(dir_edges)-1,1); mags = reshape(mag...
function plotCylinderTest %Plots the snake as a cylinder, no animation. %THIS WILL NOT WORK UNLESS YOU ADD "virtual_chassis" TO YOUR PATH close all plt = CylinderPlotter(); kin = HebiKinematics; kin.addBody('FieldableElbowJoint'); kin.addBody('FieldableElbowJoint'); kin.addBody('FieldableElbow...
function [segEncontrados,finales,vecs,centros,segids,resconexion,resol] = esquinasv(puntos,segmentos,conexion,radio,maxangdif) vecs = zeros(length(segmentos),2); centros = zeros(length(segmentos),2); finales = zeros(length(segmentos),2); resol = zeros(length(segmentos),2); segids = zeros(length(segm...
function cameras = random_cameras_on_sphere(n, radius, origin) cameras = zeros(3, 4, n); for t = 1:n cameras(:, :, t) = random_camera_on_sphere(radius, origin); end end
function [R1, R2] = get_relative_imrefs(info1, info2, reg_type) %% Get relative spatial references for the two images to be registered % Ambre's edits from the original script: % modified to allow for spatial references of 4D timeseries data to be extracted % reg_type to perform 2D to 2D reg on 3D data if slice ...
function d = getPushDisturbance(t,D) % d = getPushDisturbance(t,D) % % This function computes the horizontal and vertical push disturbance, % given the start time (D.t0) end time (D.t1) and magnitude (D.fx, D.fy) % of the push. All inputs are scalar. % if D.t0 < t && t < D.t1 d = [D.fx; D.fy]; else d = [0;0];...
function sFiles = compute_head_model(sFiles,meg,eeg); % function sFiles = compute_head_model(sFiles); % % meg = 1: none % meg = 3: overlapping spheres % meg = 4: OpenMEEG BEM % eeg = 1: none % eeg = 2: 3-shell sphere % eeg = 3: % OpenMEEG BEM % Process: Compute head model sFiles = bst_process(... 'CallProcess', '...
classdef SimulationReader < handle % SR = SimulationReader(simFile) creates a new instance of class % SimulationReader. % % SimulationReader can be used to read a simulation log file that is % created by default ("results/sim_[netName].dat") or by specifically % calling method CARLsim::saveSimul...
function varargout = MIB(Operation,Global,input) % <problem> <MOP in IntelligentBuildings> % IntelligentBuildings for Evolutionary Multi-Objective Optimization % operator --- EAreal switch Operation case 'init' Global.M = 3; Global.D = Global.M + 9; Global....
function util_plot_curve(x1,y1,x2,y2, lwidth,lcolor,lalpha, min_radian,modified_length, method) %UTIL_PLOT_CURVE Plot a curve from (x1,y1) to (x2,y2) % Input: % x1,x2,y1,y2: Position of (x1,y1), (x2,y2) % lwidth: Line width % lcolor: Line color, [r g b; r g b] -> [begi...
% computes the trajectory of the robot by chaining up % the incremental movements of the odometry vector % U: a Nx3 matrix, each row contains the odoemtry ux, uy utheta % T: a (N+1)x3 matrix, each row contains the robot position (starting from 0,0,0) function T = compute_trajectory(U) % initialize the trajectory matr...
function [ maxNo,maxYes ] = inferensi( tabFuzzyEmosi,tabFuzzyProvokasi ) %UNTITLED Summary of this function goes here % Detailed explanation goes here hasilInferensiNo = []; hasilInferensiYes =[]; maxYes = 0; maxNo = 0; if(tabFuzzyEmosi(1,1) == 1 && tabFuzzyProvokasi(1,1) == 1) % rendah and...
function [x_db, y_db, pupil_db] = Deblink(x,y,pupil,verbose) %DEBLINK Summary of this function goes here % Detailed explanation goes here % Blink duration is Rhesus Macaques is aproximately 200ms on average(Tada et al. % 2013 - PLoS ONE) % We find the peak of the differential of the X data. Whenever there is ...
function plot_predictions(x, Y, D, Ypred, Vpred, ind_kf_train, ind_kx_train) M = size(Y,2); if (D==1) figure; plot(x,Y); hold on; plot(x,Ypred, 'x', 'MarkerSize', 10); % for j = 1 : M idx = find(ind_kf_train == j); xx = x(ind_kx_train(idx)); yy = Y(ind_kx_train(idx),j); ...
function [q, ele]= pqPop(q) %³φΆΣ ele = q{1}; q(1) = []; end
%% % RBE3001 - Laboratory 1 % % Instructions % ------------ % Welcome again! This MATLAB script is your starting point for Lab % 1 of RBE3001. The sample code below demonstrates how to establish % communication between this script and the Nucleo firmware, send % setpoint commands and receive sensor data. % % IMPORTA...
% 这份代码是在SDPC源代码的基础上改进添加的 % % 运行Main.m脚本文件可以看到5种算法('BCS-SPL+SDPC','BCS-SPL+DPCM', 'BCS-SPL+SQ', 'BCS-SPL+SDPC_ch8','BCS-SPL+SDPC_ch16') % 的图像率失真图,后续继续要做的话可以拿到预测块的相关性信息,标志位的分布图。 % % 改进的核心代码为satisfy, satisfy16分别是找到当前块领域的8个块的index和16个块的index
function [f,g] = primalProblemUncMultiRegGeneral(w,X,XX,A,AA,p,b,ref,exv,alpha1,alpha2,ro,numSamples,sessionNum,numEigs) f = 0; g = []; for i = 1:sessionNum wi{i} = w(numEigs*(i-1)+1:numEigs*i,:); ui{i} = X{i}' * wi{i}; us_i{i}=ui{i}.^2; ex_i{i}=exp(-us_i{i}/2); gaussi{i} = ui{i}.*ex_i{i}; ...
%% Extract data as CSV % This script exrtacts the experimental results as well as the experimental % information (time, inputs) and generates a csv file. % --------> direct: Directory path where the images are saved (string) % --------> ident: identifier that will be added to the matlab structure % containing all the...
function slider_plot( directory ) % Get .xxx files in directory files = dir([directory '*.mcd']); % to actually get the filename use this: file_name = [directory files(1).name]; % random data data = [1 2 3 4 5 6 7 8; 8 7 6 5 4 3 2 1]; % figure spacing and sizing stuff ...
function [p th]=btt(nm,hm,am,a,b) % Bradley Taylor on home/away/neutral games % nm neutral matrix of games, hm home, am away % output vector of team strengths n=size(nm,1); MINDIFF=1e-6; p=ones(n-1,1); theta = 1; % parameter for home advantage, set to no effect to start diff=1e100; difft=1e100; totmat=nm+hm+am; Wh=am...
% This is main code for RC x = load('lienard_intermittency.dat'); data = x(:,2); inputData = (data(1:end-1)); targetData = (data(2:end)); washout = 0; trlen = 45000; tslen = 5000-1; trX{1} = inputData(1:trlen); tsX{1} = inputData(trlen+1:trlen+tslen); % Remove initial points from target! trY = targetData(1+washo...
function obj = setMass(obj, mass) % sets the link mass % % Parameters: % mass: the link mass @type double assert(isreal(mass) && mass >= 0,... 'The mass of the link must be a positive real scalar value.'); obj.Mass = mass; end
% single weighted: weighted least square and sparse coding framework function X = LSSC_DC(Y, par) % initialize D [U, ~, V] = svd(Y * Y', 'econ'); D = V * U'; f_curr = 0; % update W for weighted sparse coding Wsc = par.lambdasc / par.Wls^2; for i=1:par.WWIter f_prev = f_curr; % update C by soft thresholding ...
function [Mreordered,Mindices,cost] = reorder_matrix(M1,cost,flag) %REORDER_MATRIX matrix reordering for visualization % % [Mreordered,Mindices,cost] = reorder_matrix(M1,cost,flag) % % This function rearranges the nodes in matrix M1 such that the matrix % elements are squeezed along the main diagonal. Th...
%Full Body LG EKF and EUL EKF for the boxing CMU data %Load up the generated model clear vis; close all; % EKFCodePath = 'C:\Users\kgwester\Documents\ResearchWork\CloudSLAM\lg_persontracking\'; EKFCodePath = 'C:\Users\kgwester\Documents\ResearchWork\MatlabWrapper\'; addpath(genpath(pwd)); addpath(EKFCodePath); visua...
f = figure; set(f, 'position',[0 0 1106 420]) uicontrol('style','text','string','Open Requests','position',[15 400 1076 16],'fontunits','normalized','fontsize',.8,'HorizontalAlignment','Center'); cnames = {'Requestor','DOR','#Requested','#Filled','Age','Line1','Genotype1','Line2','Genotype2','Line3','Genotype3','Comm...
clear,clc input_path='../../input/'; %input parameters z_o=0.02; nsteps=30000; dt=0.05; Nx=96; Ny=48; Nz=30; hprocs=1; l_r=2; z_i=20; u_star=0.5; l_z=60; press_cor=3; f_p=0; press_step=5; u_avg=2; verticalBC=0; nu=0; theta_mean_wind=0; cs_count=2; nframe=0; c_flag=1; Cd=0.15; h_canopy=20; npart=0; scalarcount...
function angels=Numerische_kin(pos) %% Diese Programm berechnet die Winkel zu einer Position numerisch. Es stellt eine alternative zum algebraischen Ansatz dar. %%In dieser Iteration wird jedoch nicht auf kollisionen oder die %%Beschrängkungen denen die Winkel unterliegen geprüft!!. a=166; b=218; c=130; x=pos(2)...
function [in_bounds,v_13,v_17,v_19,v_23,v_24] =... nonviolationfraction47(pwr_case, pv_cap, irrad_time,pct_load, options) % Function takes case56customv2 and solar irradiance data as inputs. The % resistance at bus 45 is altered to account for the installed solar % capacity. It % then calculates the power flows in ...
% See demo_nmf.m for an example of how to use this function. % % Steps I took to compile MEX file on midway2: % % module load gcc/6.3.0 % module load matlab/2018b % mex nmfccd_helper.cpp % function [A, B, f] = nmfccd (X, A, B, tol, maxiter, verbose) % Handle optional arguments. if nargin < 4 tol = 1e-6...
function [w, b] = TrainSVM(Xtrain, ys, lambda, maxIterations) [d, n] = size(Xtrain); w = zeros(d, 1); b = 0; t = 1; for e=1:maxIterations inds = randperm(n); for i=inds eta_t = 1 / (lambda * t); w = w * (1 - eta_t * lambda); % common update step v = ys(i) * (w' * Xtrain(:, i) + b); ...
%========================================================================== % 1D Poisson_kp solver, @Polito S.Z 05/2014 %- coupled with 8-band kp, using full set of WFs to compute charge %- underrelaxation mixing used to achieve convergence %- Broyden's second algorithm %==========================================...
function out = KableLab_RISK_EU(choseRisky,CertainAmt,RiskyAmt,Risk,RT) % choseRisky = 1 if risky option is chosen, 0 if certain option is chosen. Others are no choices % Risk needs to be between 0 and 1. All inputs must be column vectors. 2016-Jun-07, Arthur out.percentCertain = (sum(choseRisky == 0) / length(chose...
function [ snpo1] = t2s_0415( tnpi1) %UNTITLED4 Summary of this function goes here % Detailed explanation goes here Tout = tnpi1; TUL = Tout(1:2,1:2); % upper left s-matrix TUR = Tout(1:2,3:4); % upper right s-matrix TLL = Tout(3:4,1:2); % lower left s-matrix TLR ...
function [template bx by] = learnColor(folder,sxBySy,ax,gain_thres) load config1 ay = ax; nF = 20; saturation = 0.001; % (bx, by) should be adaptive per category load storedColorHI storedHI % ================================================================= % Input training images % --------------------------------...
function SimScore = SequenceSimilarity(s1, s2) %% if s1 == s2 % SimScore = 1 [Score, Alignment] = nwalign(s1, s2); SimScore = Score; %
function [E,T,U] = autoGen_energy(q1,q2,dq1,dq2,m,I1,I2,R,g) %AUTOGEN_ENERGY % [E,T,U] = AUTOGEN_ENERGY(Q1,Q2,DQ1,DQ2,M,I1,I2,R,G) % This function was generated by the Symbolic Math Toolbox version 6.3. % 21-Apr-2016 17:26:09 t2 = dq2.^2; t3 = dq1.^2; t4 = sin(q1); t5 = I1.*t3.*(1.0./2.0); t6 = I2.*t2.*(1.0....
N = 101; t = 0:N-1; % %p_sys = [0.0; 0.8]; % %p_sys = [0.3; 0.5]; % %p_sys = [0.3; 0.9]; % p_sys = [0.6]; % %p_sys = [-0.5 + 0.5j, -0.5 - 0.5j, 0.7]; % % b = [1]; % %b = [length(p_sys) sum(p_sys)] % %b = [1 0.5]; % %b = [1 0]; % a = poly(p_sys); % Fs = 1; % sysd = tf(b, a, Fs); % h = impulse(sysd, N-1); %% pole grid ...
function [J,Z,X]=initialize() % This function is designed to independently assign motor positions and % filament positions (randomly) within the hexagon. % 01/26/14 % Callie J Miller % USES THE FOLLOWING FUNCTIONS: hexagon.m global M N L cote x0 y0 xhex yhex %Pre-Allocate J=zeros(2,M); Z=zeros(5,N); X=zeros(4,M); %set...
function [L_matrix,R_matrix,ILD_matrix,ABI_matrix,ITD_matrix,HRTFinfo] = get_HRTFinfo2(bird_number,... hrtf_file,... hrtf_file2,... get_HRTF,... get_ITDmatrix) %Directories & files data_directory = ['d:\mlspezio\physioldata\' num2str(bird_number) '\']; cache_directory = ['d:\mlspezio\matlab\script...
df=zeros(100); kk=1; for ii=0:0.05:4.95 df(kk)= (sin(ii+0.05)-sin(ii))/0.05; kk=kk+1; end plot(0:0.05:4.95,df); hold on rr=0:0.05:4.95; plot(rr,sin(rr)); plot(rr,cos(rr));
function [ WSN_PCAWavelet_Predict_Normalized_DataCell,WSN_PCAWavelet_TargetOriginal_DataCell ] = WSN_PCAWavelet_DataPreparation_Prediction( SensorDataMatrixLabelled_Cell, WindowSize, ContinuousWindow_YesNo, Wavelet_Level, Wavelet_Filter, FeatureEnergySignal_YesNo, Normalization_YesNo, Normalization_TrainPredict, Train...
%Training the data clc; clear; datapath = fullfile('/Users/juliemallinger 1/Desktop/newcovidimages_2/'); imds = imageDatastore(datapath, 'IncludeSubfolders', true, 'LabelSource', 'foldernames'); rng(0); imds.ReadFcn = @customReadDatastoreImage; imds = shuffle(imds); [imdsTrain, imdsVal, imdsTest] = splitEachLabe...
function A = meanProd(mean, hyp, x, i) % meanProd - compose a mean function as the product of other mean functions. % This function doesn't actually compute very much on its own, it merely does % some bookkeeping, and calls other mean functions to do the actual work. % % m(x) = \prod_i m_i(x) % % Copyright (c) by Carl...
function updateAnnotations(trialnums,dataindex) for i = 1:length(trialnums) testfolder = dataindex{find(cell2mat(dataindex(:,2)) == ... trialnums(i),1,'first'),1}; filename = ['../../../data/', testfolder, '/', ... num2str(trialnums(i)),'-annotations.csv']; disp(trialnums(i)) if(exist(...
function d=derivPoly(p) %disp('poly') %disp(p) d=[]; for i=[1:size(p,2)] dn=[]; for j=[2:size(p,1)] dn=[dn;p(j,i)*(j-1)]; end if(size(dn)==0) dn=0; end d=[d dn]; end %disp('deriv') %disp(d) end
% The first line of code (comments don't count) of any % function file *MUST* be of the form % % function output_names = function_name(variable_names) % function P_out = logistic_rhs(p, r, K) % The word "function" has to come first. % % We decided to call our output P_out. This name is usually % not particularly...
%% Script for GEMs & Git Workshop 2018-03-23 clear all; %% Reading the model modelYeast=readCbModel; % Choosing a reaction to delete printRxnFormula(modelYeast, 'rxnAbbrList', 'r_0005'); %% Deleting a reaction modelYeast = removeRxns(modelYeast, 'r_0005'); % Exporting the new version of the model for commiting to the...
function images = process_dcm_images_for_registration(d, post_crop_width, post_crop_height) directory = dir(d); w_before = 960; pre_crop_width = 600; pre_crop_height = 500; pre_crop_rect = [w_before/2-pre_crop_width/2 100 pre_crop_width-1 pre_crop_height-1]; l = 0; files = {}; ...
function def = readProblemDef(filename) fid = fopen(filename); def = []; while ( ~feof(fid) ) line = fgetl(fid); % Ignore empty lines if ( isempty(line) ) continue; end % Ignore comments if ( line(1) == '#' ) continue; end token = sscanf...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%% Differential Dynamic Programming %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%% Course: Robotics and Autonomy %%%%%%...
classdef MotionHistory < handle %MOTIONHISTORY Class containing the history of the arm's shape % This is a handle class, i.e. objects are always passed by reference % rather than value. As a result the values can be efficiently % updated on the go without copying the whole history. proper...
for i=1:10 clear; digitDatasetPath = fullfile('D:\bpe');%change as necessary numTrainFiles = 0.8;%change as necessary imds = imageDatastore(digitDatasetPath, ... 'IncludeSubfolders',true,'LabelSource','foldernames'); [imdsTrain,imdsValidation] = splitEachLabel(imds,numTrainFiles,'randomize'); imageSize = ...
function [ raiz ] = PuntoFijoSEL( u, v, x0, y0, error ) syms x; syms y; e = 100; fx = diff(u,x); fy = diff(u, y); gx = diff(v,x); gy = diff(v, y); while e > error if (abs(subs(subs(fx,x,x0),y,y0)) + abs(subs(subs(gx,x,x0),y,y0)))>= 1 || (abs(subs(subs(fy,x,x0),y,y0)) + abs(subs(subs(gy,x,x0),y,y0))) ...
function ProjData = EllipseProj(Phantom, structProj) N_Ellipse = size(Phantom,1); ProjData = zeros(structProj.nAngle,structProj.nChannel); fAngle = 2 * pi/structProj.nAngle; fDetWidth = 2 / structProj.nChannel; for ii = 1:N_Ellipse A = Phantom(ii,1); % Amplitude change for this ellipse as...
function [dist1_appr, dist2] = dist_appr(feat1, feat2,w) %% Initializing n1 = size(feat1,1); n2 = size(feat2,1); % dist1_appr = zeros(n1,n1); dist2 = zeros(n2,n2); %% Computing the approximated distances betwen selected feature points of img1 for i=1:n1 for j=i+1:n1 % if i ==j, continue; end; ...
clear clc tic %-------------------------------------------------------------------------- % initial values % Number of iterations and samples n = 20000; % L is length of Filter L = 16; % SNR_db : [5 10 15 25] SNR_dB = 5; % thereshold parameter (for high SNR we should set epsilon in range of (0:0.3)) % t...
function d = getDSE2(g) % returns the distance of the associted g d = g.d; end
function result= check_col(matrix,i ,j ,num) %input: the unsolved sudoku puzzel, namely 'matrix'; position index i,j; and %possible values %output: whether the possible values can be filled in the current cell or %not %This function returns a result (true or false) to determine whether a %blank cell can be filled...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% Specify project path %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear; close all root_path = utils.get_project_path(); export_path = fullfile(root_path,'export','opt'); if ~exist(export_path,'dir') mkdi...
clear; clc; % =================================3.2===================================== % -------w1------- -------w2------- -------w3------- % x1 x2 x3 x1 x2 x3 x1 x2 x3 SAMPLES = [-5.01 -8.12 -3.68 -0.91 -0.18 -0.05 5.35 2.26 8.13; -5.43 -3.48 -3.5...
function [ResultsAverageActivity, ResultsAverageActivityItemsCount, ResultsAverageActivityOnlyNum]=AverageActivity_cue_image_SelVoxProperGLM(ActiveVoxels,MMor5cond,med_more,engram) %we decided to report the reinstatement analysis based on selecting %2highThirds. These were selected from ProperGLM. To get activation to ...
function index=findmatches(source, target) % index=findmatches(source, target) % Find the index of a value in Target (if any) that matches a value in Source % for each value in Source % Linearize arrays source=source(:); target=target(:); % Allocate output varible index=NaN(size(source)); if isnumeric(source) && isn...
function hexagi_behaviour_transfer_movementVSstandstill(Subjects, ProcPath) % Get player locations and yaw only for movement timepoints, i.e. take out standing still % Only for the transfer phase % Includes times between the trials (it's the entire run) % Player transfer move includes backward movements if narg...
function Xx = accept_reject(func) test_x = linspace(0,1); A = max(func(test_x)); % sample random number according to well-chosen distribution X = rand(); % sample uniform random number U = rand(); % acceptance criterion if U <= func(X)/A % accept Xx = X; el...
function allFactors = BuildOCRNetwork (images, imageModel, pairwiseModel, tripletList) % This function constructs the Markov network for one word by putting % together the full list of different types of factors. % % Input: % images: A struct array of the images for each character in the word. % imageModel: The pro...
function [ b ] = is_transition_matrix ( P ) %Проверяет является ли матрица матрицей переодов ( сумма в строке равна 1) sum = 0; b = true; if ( size(P,1) ~= size(P,2) ) b = false ; display( ' Matrix is not matrix of Markov transition'); end for i = 1 : size(P,1) ...
% This version is for a KMR style 1-D taper where you compute the undulator % K step-by-step by specifying a constant resonant phase a priori total_simtime = 0; % Time dependent case if(param.itdp) for ij = 1:param.Nsnap-1 % takes Nsnap snapshots along length of undulator tstart = tic; firstslice=ij; ...
function plot_robot( robot,x ) [pT,pHip,p1R,p2R,p3R,p4R,p1L,p2L,p3L,p4L]=robot.get_joint_position(x); [p1Rm,p2Rm,p3Rm,p4Rm,p1Lm,p2Lm,p3Lm,p4Lm]=robot.get_motor_joint_position(x); lw=0.1 plot([pT(1),pHip(1)],[pT(2),pHip(2)],'k','LineWidth',lw); hold on plot([p3R(1),p1R(1),pHip(1),p2R(1),p4R(1)],[p3R(2),p1R(2),pHip(2)...
function clearActionFromPopup(source,~) h = guidata(source); if(~isempty(h.Action)) h.Action=[]; clearAction(h.guifig,[]); end
% calculate in-focus image for one coherent beam % the direction of the beam specified direction is % given by kx and ky both can assume values in [-.5 .. .5] % example: vars; memi(0,-.5,rr(s)<20,rr(s)<20) function u5 = memi(kx,ky,tm,tl) u0=exp(2*pi*1i.*(kx.*xx(tm)+ky.*yy(tm))); % illumination u2=ft(u0.*tm); % lco...
function [Total_DemandKWh,Total_NetKWh,Total_SolarKWh,Total_BatteryKWh,Demand_tRMDkW,Batt_tRMDkW,PV_tRMDkW, Net_tRMDkW, HMP, HMP_Batt, HMP_PV, tRMD, tHMP, checkRMD, checkHMP, dataOK] = peakCalcs(DATA,HourBegin,HourEnd,Daynum) %peakCalcs Calculates microgrid performance indicators for each day during %peak hours. % Ca...
function p=femwind_with_graphics_test disp('femwind_with_graphics_test') p=femwind_main p.graphics=2; p.st_contour=1 p.sc_all = 1; p.sc2_all = [1 2]; p=femwind_main(p); rate = [0.066948270621534 0.069839695192657]; if all(abs(p.rate - rate) < 1e-8) disp('convergence rate tests OK') else error(sprintf('somet...
% x_pred Dynamic variable x_pred_par = [1 0 0 0]'; % A Static variable A_par = [1 -0.8 -0.2 -0.01 0.05]'; % B Static variable B_par = [0.100 0.025 0.010 0.005]'; % MSE_pred Dynamic variable MSE_pred_par = 100; % C_w; Static variable C_w_par = 4; % C_u; Static variable C_u_par = 1;
%need an X and a w offset = 0; % This is the virtual gnd of the mirror. y_model = X*w' + b; % ground truth, actual matrix multiplication y_model = y_model'; %transpose y_true_false_model = y_model >= 0; %if >=0, set as 1. else set as 0. res_model = y_true_false_model == y_actual; %test. will compare accuracy_...
function [res psl the_min the_max] = isl(af) sidelobes = 0; mainlobe = 0; s = size(af); psl = 0; % loop across the Doppler axis for jj=1:s(1) % figure out the mainlobe boundary for this slice the_diff = diff(af(jj,:)); l = length(the_diff); [mainlobe_max, mid] = max(af(jj,:)); the_max...
function runintro() BrusselatorLOD2D_IFETDRDP(0.01,101,0.05,1,'intro1.eps',40) BrusselatorLOD2D_IFETDRDP(0.01,101,0.1, 2,'intro2.eps',40) BrusselatorLOD2D_IFETDRDP(0.01,101,0.5, 3,'intro3.eps',40) BrusselatorLOD2D_IFETDRDP(0.01,101, 2, 4,'intro4.eps',40) end
clear all %run the analysis of the GSMP challenge gsm_setGlobalVariables ak_step1a ak_step1b ak_step1c ak_step2a writeEPS('gsm_usrp_synchronism'); %,'font12Only'); ak_step2b
%clc; %clear; Load_DATCOM_data76; %%% CL elevator %%% csvArrayData = table2array(csvData); Y_cl = zeros(1); for i = 1:length(data.delta) finder = find(csvArrayData == data.delta(i)); Y_cl(i) = csvArrayData(finder(1), 2); end X = data.delta; X = X'; Cl_elevator = fit(X,Y_cl','poly1'); Cl_delta_elevator = Cl_elev...
clear all; clc; %% online algorithm global A B Q R K ; A = [0 0 1 0; 0 0 0 1; -1.7117 0 -0.3249 0; 0 0 0 -1.004] ; B = [0 0; 0 0; 0.0503 0.0959; -0.1228 0.1] ; Q = diag([200 75 0 0]) ; R = 0.005*eye(2,2) ; %to find the optimal feedback control law k. %K = zeros(2, 4) ; K = ...
clear;clc;close all; % Created Sep 16 by HG addpath('../SRC'); load AllResults.mat load DoBResults.mat load HDResults.mat %% Reading data / modeling / analysis based on Pzf data from John Tune: SpecimenPairs = [2,2; 3,1; 4,3; 5,4]; % First column Control, Second column Anemia and Anemia+Dobutamine case n...
function [mbest, mu, sigma] = exhaustiveSearch(models, scoreFn, varargin) % Exhaustively search for best model: mbest = arg max_i scoreFn(models{i}) % If useStdErrorRule=1, we pick the simplest which is within % 1 std error of the best N = length(models); mu = zeros(1,N); sigma = zeros(1,N); [maximize, useStdEr...
function [H,phi] = fftdb(x,Nfft) %============= This function discards values in FFT bins for which %magnitude > a threshold if nargin < 2 Nfft = length(x); end F = fft(x,Nfft); F = F(1:Nfft/2+1); % f = 0,...,Fs/2; phi = angle(F); % phase in [-pi,pi] F = abs(F)/Nfft*2; % normalize to FFT length %------------ r...
function x = gensig(params,t) % GENSIG Generate signals for signal manipulator % % This generates periodic time signals from parameters. % The following signals are supported: % - cosine wave [1 T0 A t0] % - rectangular pulse train [2 T0 A t0 tau] % - triangular pulse train [3 ...
function [fnorm,Deriv] = getgradients(X, N, myFx) for i=1:N xx = X(i); h = 0.01 * (1 + abs(xx)); X(i) = xx + h; Fp = feval(myFx, X); X(i) = xx - h; Fm = feval(myFx, X); X(i) = xx; Deriv(i) = (Fp - Fm) / 2 / h; end fnorm = norm(Deriv); end
function [ a ] = angle( A, B, C ) % zwarac kąt o wierzchołku w punkcie B %wartość zwracana w stopniach BA = [A(1)-B(1), A(2)-B(2), A(3)-B(3)]; BC = [C(1)-B(1), C(2)-B(2), C(3)-B(3)]; ca = dot(BA, BC)/(norm(BA)*norm(BC)); a = radtodeg(acos(ca)); end
function [] = frame_demo_by_class(data) rng(15742); labels = unique(data(:, 2)); pnum = 3; figure; page = round(size(labels, 1) / 3); for i = 1 : size(labels, 1) indx = find(data(:, 2) == labels(i)); % for j = 1 : pnum disp(['a=' num2str(round(i / page + 1)) ',b=' num2str(mod(i, page) + 1)]); f...
function plot_output(all_candidates, ground_plane_regions, ground_plane_regions_adjusted, cameras, show_candidates, show_ground_truth, candidates_frame, draw_regions, tracklets, nohomocorrec_tracklets, gnd_detections,overlap_adjusted, num_frames,debug_gnd_truth_frames,start_frames) %openfig(floor_image); hold on; ...
close all; clc; load('data_5_1.mat'); %1.) Scatter Plot: figure; plot(LOS_train(1,:), LOS_train(2,:), 'r o'); hold on; plot(NLOS_train(1,:), NLOS_train(2,:), 'b o'); legend('LOS', 'NLOS'); title('Scatter Plot of training data'); xlabel('x1'); ylabel('x2'); %% % 2.) Max Likelyhood estimation x1NLOS = NLOS_train(...
% Call Syntax: [S,A,IF,IF_MA] = HSA(x, SiftStopThresh, EMDStopThresh, alpha, I, beta, L, MA_len, parFlag) % % Description: This function perfoms EMDand demodulation % % Input Arguments: % Name: x % Type: vector (real) % Description: original signal to decompose/demodulate % % Name: SiftStopThresh % Type: sc...
cwd = fileparts(mfilename('fullpath')); run(fullfile(cwd, '../setup.m')) %% basic mag = igrf.igrf(datetime(2010,7,2), 65, 85, 0); assert(abs(mag.north - 9295.415460) < mag.north*0.001, 'north error') assert(abs(mag.east - 2559.7889298) < mag.east*0.001, 'east error') assert(abs(mag.down - 59670.379598) < mag.down*0.0...
function A = Hub(n) A(:,:,1) = zeros(n,n); for i = 1:(n-1) A(1:i,:,i+1) = 1; A(:,1:i,i+1) = 1; A(:,:,i+1) = A(:,:,i+1).*~eye(n); end
% cs_sr06 - Rekonstrukcija signala kod sazetog ocitavanja. % % Poziva se: % [xr,Status] = cs_sr06(yk,B); % [xr,Status] = cs_sr06(yk,B,Ispis); % gdje je % yk - vektor dobiven sazetim ocitavanjem (M komponenata) % B - matrica koja povezuje sparse bazu i ocitani vektor (M x N) % Ispis - a...
clear all imgbk = imread('Pedestrian_dataBase/ped7c0000.tif'); thr = 40; minArea = 200; baseNum = 1350; seqLength = 100; % baseNum = 1374; % seqLength = 0; % %imshow(imgdif) se = strel('disk',3); figure; for i=0:seqLength imgfr = imread(sprintf('Pedestrian_dataBase/ped7c%.4d.tif',baseNum+i)); hold off ...
function [v] = elementsOf(s) v = s.elements;
%% Load Model qube2_rotpen_param; % Set open-loop state-space model of rotary single-inverted pendulum (SIP) QUBE2_ROTPEN_ABCD_eqns; % Display matrices A; B; Q = diag([5,1,1,1]); R = 1; K = lqr(A,B,Q,R)
function BTcall(reg,adata,fdata,tdata,object) %reg 1=channel 1, 2=channel 2, 3=channel 3, %0 for turning on/off each channel, 1 is on, 0 is off, adata=channel 1, %fdata=channel 2, tdata=channel 3 div = ','; val = strcat(num2str(reg),div,num2str(adata),div,num2str(fdata),div,num2str(tdata)); write(object,val,'s...
%product of matrix column. returns array function f = matrixColumnProduct(A) f = prod(A);