text
stringlengths
8
6.12M
function W = generate_weights(N, mu_x, mu_y, offset) slope = 0.1720; % slope of rf size - eccentricity relationship intercept = -0.25; % intercept of rf size - eccentricity relationship theta = 1; % smallest allowed rf size conversion_factor = 1 / 1.7...
clc close all clear all IP_Image = imread('D:\STUDY\DIP\img_lib\elaine.512.tiff'); subplot(1,2,1); imshow(IP_Image); title('Orignal Image'); % Histogram of Image (Part 1) subplot(1,2,2); imhist(IP_Image); title('Histogram of orignal image'); % Local Histogram Equalization (Part 2) Lcl_Eq_2 = adapth...
function text = AlazarErrorToText(retCode) text = calllib('ATSApi', 'AlazarErrorToText', retCode);
% AMIGO_plot_pareto_front: plots pareto front in multiobjective opt % %****************************************************************************** % AMIGO2: dynamic modeling, optimization and control of biological systems % % Code development: Eva Balsa-Canto % % Address...
function [x,n,E]=Xsolver(x,y,S,M,T,TFov,A,B,kGrid,rkGrid,nX,toler,lambda) %XSOLVER Reconstructs an image using CG SENSE with multishot alignment % X=XSOLVER(X,Y,S,{M},{T},{A},{KGRID},{RKGRID},{NX},{TOLER},{LAMBDA}) % computes the best X for a given T % * X is the image to be reconstructed % * Y is the measu...
%% Intro %{ Intro %{ Matthew Luu 8/28/2020 %} Description of Code: Assignment #1 %{ Takes Linear Spectrum of different functions for assignment 1 %} Color Codes %{ 'red' 'r' [1 0 0] 'green' 'g' [0 1 0] 'blue' 'b' [0 0 1] 'cyan' 'c' [0 1 1] 'magenta' 'm' [1 0 1] 'yellow' 'y' [1 1 0] 'black' 'k' [...
%% Satellite probagation TLE2RV clc %close all clear all %close all format long g global AuxParam eopdata PC Cnm Snm const swdata %% Load initial data SAT_Const load DE430Coeff.mat load Epoch.mat load State.mat load Kep.mat load BStar.mat PC = DE430Coeff; Y0 = Y(1,:)'; %% Load File % read Earth gravity field coe...
clear all clc target_image=(imread('img.jpg')); random_image1=(imread('1.jpg')); random_image2=(imread('2.jpg')); random_image3=(imread('3.jpg')); random_image4=(imread('4.jpg')); random_image5=(imread('5.jpg')); random_image6=(imread('6.jpg')); imageArray={random_image1,random_image2,random_image3,random_image...
function [ dataset ] = dm_preprocess( prdatafiles, labels, width, height, interp, eqpercent, hg_csize, chainc_rsize, hl, calcfeat23, unskew ) %Preprocess the given set of images global preWidth; global preHeight; global resized; samples = max(size(prdatafiles)); say('Equalizing'); ...
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR % Autores: Gonzalo Pajares y Jesús Manuel de la Cruz % Copyright RA-MA, 2007 % Ejercicio 7.7: Extracción de bordes, regiones y puntos de interés % Operador Laplaciana %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 7.7.7 Bordes: opera...
function stack = conditionStack(stack) % bandpass filter stack for computing cross-correlation % low-pass filter k = hamming(5); k = k/sum(k); stack = imfilter(imfilter(stack,k,'symmetric'),k','symmetric'); % unsharp masking sigma = 41; % somewhat arbitrary k = gausswin(sigma); k = k/sum(k); stack = stack - imfilter...
disp('Open sim12ex8.mdl in SIMULINK WINDOW and click on simulation')
classdef Integers properties (Constant) zero = 0; one = 1; end methods (Static) function r = add(obj,a,b) r = a+b; end function r = minus(obj,a,b) r = a-b; end function r = prod(obj,a,b) r = a*b; ...
function [fig ] = plot_basic_temp(T, unit, dtind , tl, vis) %% [fig ] = plot_basic_temp(T, [unit], [dt] , [tl], [vis]) % % Basic plotting routine for temp.mat data % % INPUT % T : temp.amt structure % unit : string containing unit % dt : step width for time array...
function routineDataPlot_GroupHDS_SVM(R) close all [bigStore,subjects,typeLabels,featBank] = loadABCGeneric(R,{'bigStore','subjects','typeLabels','featBank'}); typeLabels = {'ISI','PreMove','PostMove','Imagery'}; %% Now do the plotting cmap = linspecer(5); R.data.feat_xscale{1} = R.frqz; % Select by SNR DC = table2arr...
function img = BrukerRecon(bruker) % Original file by Evan Calbrese, 6/8/11 % rmd - added multi-echo read, 6/8/11 % rmd - adapted for newest data, 8/3/12 if isempty(bruker) display('select directory containing fid file to recon') bruker=readBrukerDirectory(); end display('select directory to save output NIfTI t...
% Compute the sum of weights of points, i.e. Sigma(s')/max(Sigma(s')), % % Input: W: the adjacency matrix of NCUT; % numOfNeighbours: the number of neighbourhood % Output: M: the array of normalized neighbour sum % % 2007/12/18 % zhongcaiming function M = sumOfNeighbors(W, numOfN...
function [C, S, C_df] = processEftyOuts(C, S, C_df, Nnan_nanBeg_nanEnd, normalizeSpikes) % cleans C and S, ie removes the iti nans. % removes the last row of C_df (background comp). % if normalizeSpikes is 1, normalizes S of each comp to its max. % P and A are optional, if provided plots of tau, neuron_sn and max(A...
clc;clear all; x=[10,41,79,139,202,298]; y=[3.1,11.8,21.1,29.8,37.4,42.5]; x=x';y=y'; Z=zeros(length(x),2);D=zeros(length(x),1); v=[1;0.004] yfit=Z; k=3;errt=1; err=zeros(k,1);eps=0;count=0;countmax=10; while errt>eps && count<countmax count=count+1 for i=1:length(x) yfit(i)=v(1)*(1-exp(-1*v...
clear clc close all a=0.75 n=-2:0.2:3; y=exp(a*n) figure(5) stem(n,y,'color',[200 40 10]/255,'Linewidth',2) axis([-2 3 -4 10]) xlabel('n') ylabel('f[n]')
function make_hoverjump(thisdir,label) load(thisdir,[label '_replay_seqmax'],[label '_replay_seqreplayindex'],[label '_replay_seqtimes']) eval(['seq = ' label '_replay_seqmax;']) eval(['seqtimes = ' label '_replay_seqtimes;']) eval(['seqindex = ' label '_replay_seqreplayindex;']) clear([label '_replay_s...
format bank mcolor = {'g', 'r', 'b', 'y', 'm', 'w', 'k'}; load('av_pcl.mat'); clf fg_clouds = {}; bg_planes = zeros(16,4); for f = 1 : 16 f R = pcl_cell{f}; R(:,:,4:6) = R(:,:,4:6) * 1000; [L,W,~] = size(R); R = reshape(R, L*W, 6); depth_cloud = R; % remove 0 row depth_cloud = depth...
%% is_in: function description function [inside] = is_in(tetra, point) n = size(tetra, 1); D0 = [tetra ones(n, 1)]; D1 = D0; D1(1,:)=[point 1]; D2 = D0; D2(2,:)=[point 1]; D3 = D0; D3(3,:)=[point 1]; v = sum([det(D0) det(D1) det(D2) det(D3)] >= 0); if(v==n || v==0 ) inside = true; else ...
%% Clear all clc; clear all; %% Initialize values % Onewheel M = 750*10^(-3); %[kg] L = 72*10^(-3); %[m] Iyy_g = 2049081*10^(-9); %[kg*m^2] Ixx_g = 810407*10^(-9); %[kg*m^2] m_w = 54*10^(-3); %[kg] R_w = 0.04; %[m] I_w = (1/2)*m_w*(0.02^2+0.04^2); %[kg*m^2] % Motor R = 38; %[Ohm] K_phi = 0.158; %[Nm/A] K_t = 0.158;...
function [ S ] = initialize( N,n_0,index ) % Initialize fuild field for different TESTs % N: grid number % n_0: index of discontinuity surface % index: TEST index % S: [rho u p] switch index case 1 S_l=[1,0.75,1]; S_r=[0.125,0,0.1]; case 2 S_l=[1,-2,0.4]; S_r=[1,2,0.4]; ...
function dHip_x_vel = dHip_x_vel(in1) %DHIP_X_VEL % DHIP_X_VEL = DHIP_X_VEL(IN1) % This function was generated by the Symbolic Math Toolbox version 8.4. % 16-Jun-2020 20:49:44 q1 = in1(:,1); q2 = in1(:,2); qd1 = in1(:,7); qd2 = in1(:,8); t2 = q1+q2; t3 = cos(t2); t4 = sin(t2); t5 = t4.*4.38012e-1; t7 = qd2.*...
I = imread('lena.jpg'); I = rgb2gray(I); x1 = input("Enter the x coordinate of desired left top coordinate rate\n"); y1 = input("Enter the y coordinate of desired left top coordinate rate\n"); x2 = input("Enter the x coordinate of desired right bottom coordinate rate\n"); y2 = input("Enter the y coordinate of desired r...
clc; clear variables; n=imread('sqr_17.jpg'); [row,col,channel]=size(n); I=double(n); I_16{16}=zeros(64,64,3); dim(1:12)=1; dim(13:16)=[64 64 64 64]; % Initializing variables % eigval=zeros(64,64,3); eigvec=zeros(64,64,3); A{16}=zeros(64,64,3); A_new=zeros(row,col,channel); eigval_u=zeros(64,64,3); eigv...
% This function is used to calculate (d cos(beta))/(d r). function f = dcosbetadr(R,r,theta) f1 = 2*r.*((r.^2+R.^2).^2-4*R.^2.*r.^2.*sin(theta).^2).^(-0.5); f2 = 2*(r.^2-R.^2).*(r.*(r.^2+R.^2)-2*r.*R.^2.*sin(theta).^2).*((r.^2+R.^2).^2-4*R.^2.*r.^2.*sin(theta).^2).^(-1.5); f = f2-f1; end
%Project takes as an input an excel file with 10950 rows and 4 columns(One %for each timescale. %It stores a data in a 3 Dimensional Matrix dayWiseAnswer. %In matlab, a 3D matrix is stored as (row,col,page) %There are total 7 pages in o/p matrix, one for each day. %On each page, there are 4 columns ( One for each scale...
% Call Syntax: varphi = sift(g, SiftStopThresh, alpha, maxSifts) % % Description: This function perfoms sifting to remove a single IMF % % Input Arguments: % Name: r % Type: vector (real) % Description: original signal to extract one IMF % % Name: StopThresh % Type: scalar (positive) % Description: Sifting...
function investigateNLTransBehaviour(R) subjects= ls([R.path.localDatPath '\Generic']); subjects = cellstr(subjects); subjects = subjects(5:end); fsamp = 1000; SL = 0; for sub = 1:size(subjects,1) subCodeList = []; file1 = [R.path.localDatPath '\Generic\' subjects{sub} '\' subjects{sub} '_TransWindow_FT_Data.ma...
% Lithophane-generator % utils/estimate_face_count_flat.m % % © Jacob Peroutek, 2020 % All rights reserved. % Estimates the number of faces for a given image size function face_count = estimate_face_count_flat(img_size) perimeter = sum(2 * (img_size - 1)); area = (img_size(1) - 1) * (img_size(2) - 1); fac...
%ball drop h0 = input("height of ball at drop: "); h1 = input("height of ball after first bounce: "); syms t t2 timeFalling = solve(.5 * 9.81 * t.^2 == h0, t); v1 = 9.81 * timeFalling; timeRising = solve(.5 * 9.81 * t2.^2 == h1, t2); v2 = timeRising * 9.81; res = v2/v1; sprintf("coefficient of restitution is %.4f "...
function []=InformationAndDiagEntropy() % Get ready random matrices size and number of random matrices Mat_sizes = [4 8 16 32 100 150]; repeats = 1000; % Then load Solveig's data Data_dir = '/Users/elie/Dropbox/Solveig/Neuro/J. Neuroscience/selectivity'; load(fullfile(Data_dir, 'entropy_Bird_Dist_matrices_1322units.m...
import = 0; if import t1 = [53413,53525,53632,53684,53724,53764,53804,53844,53884,53925]; t2 = [53519,53626,53678,53718,53758,53798,53838,53878,53917,54010]; tb1 = t1(1); tb2 = t2(1); record = grab_3mdata_chunks('110821',t1,t2,tb1,tb2); clearvars t1 t2 tb1 tb2 import end L = size(record,1)...
clf;clear all;close all; signal = [1 zeros(1,127)]; % Causal System channel_gain_fast = 0.3 ; channel_gain_med = 1 ; channel_gain_slow = 0.3; ISI_signal = real(ISI_system(signal, channel_gain_fast, channel_gain_med, channel_gain_slow)); L = length(ISI_signal); h = 8*(-1/3)*((-1/3).^[0:L-1]); equalized_signal = conv(...
function display_latitudinal_dependence(values_input_average, lat_input, x_limit) figure; set(gcf, 'Position', [100, 100, 200, 310]) % [Left Bottom Width Hight] %% upper figure values_latitudinal_mean = nanmean(values_input_average,1)'; values_latitudinal_std = nanstd(values_input_average,1)'; subplot('Position', [...
%*********************************** % Get the surface area of an openning %*********************************** function [Ao] = getA_opening(surface_id,opening_id) global Infor_surface height=Infor_surface{5, surface_id}(opening_id,1).RectangularGeometry.Height*0.3048; width=Infor_surface...
function [map]=align_surf_to_fsa4(a,hem) if(hem=='L') fsa4L=gifti('/scr/namibia1/Projects/Personality/HCP_Data/fsa4L.gii'); Dist = pdist2(a.vertices,fsa4L.vertices); for i=1:32492 mind=min(Dist(i,:)); map(1,i)=find(Dist(i,:)==mind); % Dist(map(i),:)=100000000; end;...
% plots the lowest energy levels and the % average charge of a Cooper Pair Box (CPB), both single junction % CPB and split CPB. % A function call plots two figures, one is the energy levels and % and the other is the average charge. The calculated data is % saved to the current directory thus a later function call wi...
n=10000; for i=1:n fprintf('%d/%d\n', i, n); frame=randn(320, 1); zcr1=zcRate(frame); zcr2=zcRateMex(frame); if (zcr1~=zcr2) break; end end
function varargout = Detect_Lightning_Main_Dev(varargin) % DETECT_LIGHTNING_MAIN_DEV MATLAB code for Detect_Lightning_Main_Dev.fig % DETECT_LIGHTNING_MAIN_DEV, by itself, creates a new DETECT_LIGHTNING_MAIN_DEV or raises the existing % singleton*. % % H = DETECT_LIGHTNING_MAIN_DEV returns the handle to a...
d1=0; a3=155; a4=153; d5=33; dE=65; x4=185; z4=133+(d5+dE)-d1; %needs to be fixed when zd is determined C=180-acos((x4^2+z4^2+a3^2-a4^2)/(2*a3*sqrt(x4^2+z4^2+a3)))-acos((a4^2+a3^2-x4^2-z4^2)/(2*a4*a3)); theta2=acos((x4^2+z4^2+a3^2-a4^2)/(2*a3*sqrt(x4^2+z4^2+a3)))+atan(z4/x4); theta3=acos((a4^2+a3^2-x4^2-z4^2)/(2*a...
function v = gen_vec(comp, N) v = complex(zeros(N,1), 0); j = 1; for i = 1:N:length(comp) v(:,j) = comp(i:i+N-1,1); j = j+1; end end
% delayBuffer.m % Dan Hirlinger % 2/10/21 % Input x = [1; zeros(9,1)]; h = zeros(3,1); N = length(x); h = zeros(4,1); g = 0.5; for n = 1:N % % Series delay % y(n,1) = h(end,1); % % h = [x(n,1) ; h(1:end-1,1)]; % % % Feed-forward delay % y(n,1) = x(n,1) + (g * h(end,1)); % % h = [x...
% This function is an implementation of the euler method to find numerical % solutions to differential equations. This is the function used to find % approximations for problems 2.2.3 and 3.1.7 in Project 1 for APPM 2360 % Fall 2018 function y = ode_euler(yprime, ts, y_0) y = zeros(size(ts)); y(1) = y_0; ...
%----------------------------------------------------------------------- % Job configuration created by cfg_util (rev $Rev: 4252 $) %----------------------------------------------------------------------- matlabbatch{1}.cfg_basicio.cfg_mkdir.parent = {'/Volumes/crunch/freshTPS/random/B/'}; matlabbatch{1}.cfg_basicio.cf...
function fig = find_figure(figname,createnew) % find figure with given name or create new % script from /rota/programs/matlab if nargin < 2, createnew = 1; end fig = findobj(0,'-depth',1,'Name',figname); if ~isempty(fig) set(0,'CurrentFigure',fig(1)); elseif createnew fig=figure; set(fig,'Name',figname); else f...
filefolder = 'C:\Users\praveen\Desktop\imgp\4\Input Images\'; imagefiles = dir(fullfile(filefolder,'*.*')); nfiles = length(imagefiles); for i=[4] filename = imagefiles(i).name; fullfilename = fullfile(filefolder,filename); lbp = imread(fullfilename); [row column depth] = si...
% combine the results of bootstrap for NMG clear load('boot_NMG1.mat') rec_beta_hat_all = rec_beta_hat; load('boot_NMG2.mat') rec_beta_hat_all = rec_beta_hat_all+rec_beta_hat; load('boot_NMG3.mat') rec_beta_hat_all = rec_beta_hat_all+rec_beta_hat; load('boot_NMG11.mat') rec_beta_hat_all = rec_beta_hat_all+rec_beta_hat...
clear all clc % for the time t = -5:0.001:5; % First function's part i1 = (t>=0)*1.0; % Seconf function's part i2 = (t>=0.001)*1.0; % The final function it = i1 - i2; plot(t,it,'b','linewidth',2) title('\delta (t)') grid on pause
function [A, b, f] = SecondFIRProblem(wp, ws, wc, L, N, N1, DeltaP, DeltaS, DeltaT) M = (N-1)/2; %% Frequency w = (0:L)*pi/L; %weighting matrix S = diag(1/DeltaP*(w<=wp) + 1/DeltaS*(w>=ws)); d = (w<=wc)';%desired LPF frequency responce %% Get time constraints T1 = fliplr(tril(ones(N))); T2 = aToh(N); T = T1(1:N1+1,...
function [dpn] = mtspMatch(dpn,mts) %mtspMatch - match the two parts from the same file. This may involve %rotation, etc to make them match % Need to reshape the mts.sp structure, by matching againt the size of the % dpn.d1.sp matrix. szd = size(dpn.d1.sp); % Because the metaspace image is rotated, we need to switch ...
% Captures frames with your images and an overlay of the tracking marker % written by Chris function [validx,validy]=Markerplotting(validx,validy); if exist('validx')==0 [validx,Pathvalidx] = uigetfile('*.mat','Open validx.mat'); cd(Pathvalidx); validx=importdata(validx,'\t'); end if exist('validy')==0 ...
function [x,y,I2,ix,iy] = digitizeGraph(I) if (nargin == 0), [fn,pn] = uigetfile({'*.jpg;*.tif;*.png;*.bmp','Image files'}, ... 'Graph image file'); fname = fullfile(pn,fn); I = imread(fname); end; imshow6(I,'n'); box = msgbox('Click origin','Digitize graph','help','non-modal'); [ox,oy] = gi...
% Have user browse for a file, from a specified "starting folder." % For convenience in browsing, set a starting folder from which to browse. clc clear startingFolder = 'C:\Users\Barfi\Dropbox\Clifford_Lab_MATLAB\Shafaat_try_GUI\Data'; if ~exist(startingFolder, 'dir') % If that folder doesn't exist, just start...
function [ tinew,lambda,J,dJ,m] = UnPasGradient( param, tiold,px,py,lambda ) % methode du gradient avec pas adaptatif p = [px py]'; % sous forme polynominale: [J,dJ,m]= calculerJ(param,tiold,p); % update theta: tinew = tiold - lambda*dJ; % choix de lambda: [Jnew,~,m]= calculerJ(param,tinew,p); if Jnew <= J lambd...
function plot_3d(time, freq, amp, scale, fig_title) % plot_3d(time, freq, amp, scale, title) % % plot 3d-like picture of a signal % scale can be 'auto' or real number % % slazav, feb 2012 %% plot 3d-like frequency picture [p_f, p_a] = rel2f.find_peaks(freq,amp(:,1)); [p2f, p2a] = rel2f.select_2peaks(p_f,...
%% Phase Correlation demo % Demonstrates estimating translational shift between two successive frames % using Phase Correlation. % % <https://github.com/opencv/opencv/blob/3.1.0/samples/cpp/phase_corr.cpp> % %% Prepare video source vid = cv.VideoCapture(); pause(1); assert(vid.isOpened(), 'Could not initialize capturi...
function [state] = initialize() state.attitudeVector=[0.0 0.0 0.0]; state.attitudeQuaternion=rpy2quaternion(state.attitudeVector); state.attitudeMatrix=makerotation(state.attitudeVector); state.velocityVector=[300.0 0.0 0.0]; state.positionVector=[0.0 0.0 0.0]; state.bodyrateVector=[0.0 0.0 0.0]; state.alp=0.0; state.b...
% rings data sum for loose criteria %idces from hebb_pattern_showcase.m if ~exist('rings','var') load rings.mat load 114_sorted_file_path.mat %freg=load('sel_conn_chain_duo_6s_1_2.mat','pair_reg','pair_chain'); %load reg_keep.mat cd('/home/xd/pkg') addpath(fullfile('npy-matlab-master','n...
classdef SiAMODeL %UNTITLED8 Summary of this class goes here % Detailed explanation goes here properties (Access = public) DataTypes; MAINSTRUCTURE; end methods function SiAMODeL = SiAMODeL(DATA) %UNTITLED8 Construct an instance of this class ...
function PlotStim(record,trange,hs) % PlotStim(record,trange,hs) % record: the cell-array with the stimulus info & neural responses, % arranged in records % trange: the range of the time axis (will be calculated if omitted) % hs: axis handle for the stimulus plot (will create a new plot window if omitted) if (nargin...
cyc_description='development test cycle'; cyc_version=2003; % version of ADVISOR for which the file was generated cyc_proprietary=0; % 0=> non-proprietary, 1=> proprietary, do not distribute cyc_validation=0; % 0=> no validation, 1=> data agrees with source data, % 2=> data matches source data and data collection meth...
function[code]=loadcdmadata(name) load(name); group_no_to_select=1; if exist('group')==1 if numel(group)~=0 select=group(group_no_to_select,:); end end if exist('groups')==1 select=groups(group_no_to_select,:); end codelength=n; [aa,users_max]=size(select); %% generate code % codelength=length(dop2...
function imgnm = gen_nm(num, key) % key == 0, input image name % key == 1, output interpolation image name % key == 2, .flo file name % key == 3, _ker.png if key == 0 s = num2str(num); len = length(s); for i = 1:4-len s = ['0', s]; end imgnm = ['fr...
# clear;
function [aM_out] = matrixTriangle_set(aM_in, af_val, varargin) % % NAME % function [aM_out] = matrixTriangle_set(aM_in, af_val, <astr_triangle>) % % % ARGUMENTS % % INPUT % aM_in matrix square matrix % af_val float value to assign to upper or lower % ...
function [morphed_im] = morph(im1, im2, im1_pts, im2_pts, warp_frac, dissolve_frac) % Triangulation used to morph a source image into a target image % Author: Brian Wright % % im1: H1 x W1 x 3 representing first image % im2: H2 x W2 x 3 representing second image % im1_pts: N x 2 matrix with first image correspondences ...
% using a class with static methods here % since MATLAB doesn't have true globals classdef g methods(Static) function r = DROW; r = 1; end % row dimension function r = DCOL; r = 2; end % column dimension function r = DPAG; r = 2; end % page dimension end end
function [ res ] = my_gcd( a, b ) %GCD function used to compute GCD A=a; B=b; while B>0 R=mod(A,B); A=B; B=R; end res=A; end
function [head]=getHeader_smr(fID) try frewind(fID); catch warning(['getheader_smr:\t' ferror(fID) 'Invalid file handle?' ]); head=[]; return; end; head.FileIdentifier=fopen(fID); head.systemID=fread(fID,1,'int16'); head.copyright=fscanf(fID,'%c',10); head.Creator=fscanf(fID,'%c',8); head.usPerTime=fr...
function [child1, child2] = crossover(parent1, parent2) %UNTITLED4 Summary of this function goes here % Detailed explanation goes here lengthP1 = length(parent1); crossoverpoint = randi(lengthP1); child1=[]; child2=[]; for i=1:crossoverpoint child1(i)= parent1(i); child2...
% Function checks whehter eye is on specified target % % input x1 measured x pos % input y1 measured y pos % input x1_target vector with x coordinates of potential targets % input y1_target vector with y coordinates of potential targets % input error1 max distance from the target allowed % % outpu1 target number where ...
function normaltime=converttomilitary(normaltime) if strcmp(normaltime{3},'am') && normaltime{1}==12 normaltime{1}=0; end if strcmp(normaltime{3},'pm') && normaltime{1}~=12 normaltime{1}=normaltime{1}+12; end normaltime(3)=[]; end
%read the svm model weights and bias %then output them as fixed point data clear; clc; setup_libsvm_env('kona'); out_name ='/home/maolin/Projects/isp_on_roach/hw_eval/hw/rom.v'; %read data from files fprintf('reading data...\n'); load svm_model.mat; weight=(model.sv_coef)'*model.SVs; bias = -model.rho; save('svm_wb.ma...
subplot(3,1,1) n = -20:1:20; u1 = (n>=0); u2 = (n>=10); a = 0.8; fxn = (a.^n).*(u1 - u2); stem(n, fxn) title('(a^n)*(u[n] - u[n-10]), a = 0.8') xlabel('n') ylabel('fxn') subplot(3,1,2) n = -20:1:20; u1 = (n>=0); u2 = (n>=10); a = 1.0; fxn = (a.^n).*(u1 - u2); stem(n, fxn) title('(a^n)*(u[n] - u[n-10]), a = 1.0') xlabe...
function [rv,vv] = oe2rv_Elosegui_Marcus(oe,mu) %-%----------------------------------------------------------------------%- %-%-------------------- Code Template for Computing ---------------------%- %-%--------- Cartesian Planet-Centered Inertial (PCI) Position ----------%- %-%------- and Cartesian Planet-Centered I...
function pac_within_elec(subj,block,coupling) %coupling: 1 for theta-HG coupling if coupling == 1 phase_freq = [4 7]; power_freq = [70 150]; phase_lab = 'theta'; power_lab = 'gamma'; end get_subj_globals(subj,block) load([dtdir subj '_' block '_CAR.mat']) ecogCAR = notf(ecogCAR); ecogPAC = rmfie...
%%%% Derive Equations of Motion % % "See-Saw" Disk problem % % This system consists of two components: % % 1) The see-saw, which is modeled as a slendar rod that rotates about its % center of mass. % % 2) A uniform disk, which rolls without slip along the see-saw % % m = mass of disk % R = radius of the disk % % I1 = ...
%usa algoritmo de entrenamiento tg_sig function [a3,P,Q,T,epocas,e,fe,W1,b1,W2,b2]=gdescendente(P,T,W1,b1,W2,b2) Q = size(P, 1); %numero de muestras(100, 50 ceros y 50 unos) % Valores iniciales alfa = 0.001; epocas=0; fe=inf; [ a3,g_W2,g_W1,g_b2,g_b1 ] = feedfordward( P,W1,W2,b1,b2,T ); while fe>10^-4 epocas=epoc...
function commit(commitMessage) % TODO error checking [a, b] = system('git add -u'); % add everything [a, b] = system(sprintf('git commit -m "%s"', commitMessage)); end
function [ output_args ] = ik( input_args ) %IK Summary of this function goes here % Detailed explanation goes here end
% Condense the data for combinations of age groups combs = table2array(data_wide(:, {'casese', 'casesf', 'casesg', 'casesh', 'casesi'})); combsoffset = table2array(data_wide(:, {'offsete', 'offsetf', 'offsetg', 'offseth', 'offseti'})); [a, b] = find(~isnan(combs)); for j=1:2 for i=1:length(a) prelambdacombs{j}(i, :)...
% Alan's Guitar Tuner Code % Dec 18, 2020 clc;clear; bigloop = 1; while bigloop == 1 littleloop = 1; note_Freqs = [82.5, 110, 146.8, 196, 246.9, 329.6]; % E, A, D, G, B, e. Open string freqs for A440 tuning % prompts user to input which string is being tuned prompt= '\nPress the number correspond...
function out=dualsrckf(dynfun,obsfun,data,time,x0,R,V,P0x,P0q,Re,Rr,q0,param) % %DualSRUKF: Dual Estimation Square Root Cubature Kalman Filter % DUALSRCKF(dynfun,obsfun,data,time,x0,R,V,P0x,P0q,Re,Rr,q0) % This implements a continuous-discrete square root cubature kalman bucy filter to % simultaneously estimate...
function h = ut_draw_camera(K,pixsize,R,T,col,camlabel,axlength) % h = ut_draw_camera(K,pixsize,R,T,col,camlabel,axlength) % draws a camera in the current axis with the following properties: % K: camera calibration matrix % pixsize: size of a pixel (square pixels are assumed) % R: wRc: orientation ...
%% part a.) [x,y] = meshgrid(-2:.2:2, -2:.2:2); z=(x.^3)+(y.^3)-(2.*x.^2)+(3.*y.^2)-8 surf(x,y,z); %roots for df/dx=0 a = solve('3*x^2-4*x=0','x'); %roots for df/dy=0 b = solve('3*y^2+6*y=0','y'); hold on plot3(a(1),b(1),-7,'ro') plot3(a(1),b(2),-7,'ro') plot3(a(2),b(1),-7,'ro') plot3(a(2),b(2),-7,'ro') syms x y ...
function X = uq_exponential_invcdf( F, lambda ) % UQ_EXPONENTIAL_INVCDF(F, parameters) calculates the inverse Cumulative Density Function % values of CDF values F of samples X that follow an exponential distribution with % some value of the distribution's lambda parameter % % NOTE: % Please keep in mind the differen...
function F = uq_gamma_pdf( X, parameters ) % UQ_GAMMA_PDF(X, parameters) calculates the Probability Density Function % values of samples X that follow a Gamma distribution with parameters % specified in the vector 'parameters' % % Input parameters: % % 'X' The samples % % 'parameters' contains ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %plot data components of conceptual diagram %to be stitched together in PPT % % %Corwin Wright, c.wright@bath.ac.uk, 2021/02/01 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
function [A, B] = deinterleave(I) if ndims(I)<3 A = I; B = []; else A = I(:,:,1:2:end); B = I(:,:,2:2:end); end end
[Vx,Vy] = lucas_kanade('sphere1.ppm', 'sphere2.ppm');
function [weightEachClass, indMutInfEachClass, weights, indMutInf, indxImpf, indxImptf] = mutualInfo(data, label, topN, topM, topO) odata = data; data = spones(data); indMutInf = []; indMutInfEachClass = []; numdocs = size(data, 1); numfeatures = size(data, 2); ulabels = unique(label); numl...
%This function check if the property calculation succeeds or not % Success: 1; No: 0; % Dong Dong % function [target] = checkProperty() function [target] = Read_BoltzTraP(flag, ID) % detemine the current folder name currentdir = pwd; [upperpath,directory] = fileparts(currentdir); % Added by Fei Q...
function error_rate = error_rate_nb(data) base = 0; rate = 0.1; for i=1:size(data,1), if data(i,32) == 1, base = i; break; end; end; traningX=data(floor(rate*base):base-1,1:30); traningX=[traningX;data(base+floor(rate*(size(data,1)-base)):size(data,1),1:30)]; traningY=data(floor(rate*base):base-1,32); traningY...
function [prb w] = updateWeights(prb,wt); % w = updateWeights(prb,w) % return a least squares update for the weights- uses cg and % pipelined operators. wp = prb.wp; N = prb.nh; K = prb.K; wd = prb.wd + (prb.wp-wt); nw = prb.nw; zp = prb.z((N*K)+(1:N)); zm = reshape(prb.z(1:(N*K)),N,K); fac = sqrt(N/nw/2); mdfy = p...
clc;clear; %LOADING THE DATA %load GoodMeasurement_14_bus.mat; %load GoodMeasurement_1354_bus.mat; load Measurement.mat %HERE COME USER-DEFINED PARAMETERS OF GN algorithm eps_tol=10^-6; %stopping criterion for max(abs(delta_x)) Max_iter=100; %maximum number of GN iterations H_decoupled=0; %if 0, full H and '...
function result=gaussian(x,c,sigma) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % result=gaussian(x,c,sigma) % returns the value of a gaussian % with standard deviation sigma, % centered at c, evaulated at x %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% result=zeros(size(x)); result=1/(sigma*sqrt(2*pi)).*exp(-(x-c).^2/2/sig...