text
stringlengths
8
6.12M
function AddImportFilterPath [MFilePath, MFileName]=fileparts(mfilename('fullpath')); TempIndex=strfind(MFilePath, '\'); ProgramPath=MFilePath(1:TempIndex(end)-1); DataDir=[ProgramPath, '\ImportExport\ImportModule']; ImportDir=GetImportModuleList(DataDir); if isempty(ImportDir) return; end for i=...
function [] = demo_FastEMD_compute(P,Q,D,extra_mass_penalty,flowType) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % EMD computation % This part is common to all demo_FastEMD scripts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Fastest version - Exploits the fact that the ground distance is % thr...
function [ ] = addToSelection( name ) % Robert Cooper 10-17-2014 % This script interacts with photoshop to add the input name to the % selection. script = [ 'var re = "' name '";'... ' var matches = collectNamesAM(re); '... ' for( var l = 0; l < matches.length; l++ ){ '... ' addToSelectionByIndex(...
function yhat = segment(im, mask, model, D, D2, params, params2, scaleparams) % Pre-process image up = [size(im, 1) size(im, 2)]; im = pyramid(im, params); if max(mask(:)) > 1; mask = mask ./ 255; end % Extract first module feature maps L = extract_features(im, D, params); % Pre-process f...
function [fNorm, tNorm, sNorm, Cost] = NormCalculation(fUpdate, Image, sWeight, tWeight) fNorm = sum(abs(fUpdate(:)).^2); if tWeight ~= 0 tNorm = abs(diff(Image,1,3)); tNorm = tWeight * sum(tNorm(:)); else tNorm = 0; end if sWeight ~= 0 sx_norm = abs(diff(Image,1,2)); sx_norm(end,:,:,:,:)=[]; ...
% prova aggiunta file c = 1;
function tEvent = getButtonSync(nFrames,frameRate,tEvent) %GETBUTTONSYNC Get frame number for button pushes in the OptiTrack rec % % button_frame = cpl.getButtonSync(nFrames,frameRate,tEvent) % % -------- % INPUTS % -------- % nFrames : Number of frames in this OptiTrack recording % ...
function Z = coeffFun2DBlocks6(xi, X, Y) % In % xi ... parameter size 6 % X, Y ... coordinates (with meshgrid) % Out % coeff ... coefficient Z = zeros(size(X)); Z(0 <= Y < 1/6) = xi(1); Z(1/6 <= Y < 2/6) = xi(2); Z(2/6 <= Y < 3/6) = xi(3); Z(3/6 <= Y < 4/6) = xi(4); Z(4/6 <= Y < 5/6) ...
% load the data dir = '2014-04-18-near-goalposts/mat/'; filename = 'pass1.mat'; dir_prefix = '/home/abarry/rlg/logs/'; dir = [ dir_prefix dir ]; loadDeltawing % get start and end times [throttle_start, throttle_end] = FindActiveTimes(u.logtime, u.throttle, 1150); % get altitude start and end times [alt_start, ...
% need to edit so that requirement is not trial.end == 48, since now % includes fix break trials so size of block is often > 48 function [TestBlocks]=DPF_ExoAttnParseFiles(Observer); eval(sprintf('Folder=dir(''data/%s'');',Observer)); if size(Folder,1) FileNum=length(Folder); %for all items for File=3:FileNum %exclud...
function [spikes,frame_vector,removed_spikes] = AdjustFramesVector(sp,stimInfo,frame_vector); %%% This function will take the original spiketrain and the original frames_vector %%% and adjust both to account for extra syncs and create a new %%% spiketrain and new frames_vector to be used for generating the raster plot....
function [InTick, OutTick] = MarijnInitInOutTick(inettyp, N, mu, th, sigx, sigy) sigscal = mean(mu) / 3; R = [cos(th) sin(th); -sin(th) cos(th)]; InDeg = 3 * (N + abs(diff(mu * N))); OutDeg = 0; if ismember(inettyp,1:3) while abs(sum(InDeg) - sum(OutDeg)) > abs(diff(mu * N)) x ...
% This is a basic predator-prey script that is intended to show % how to organize a test code. % The predator and prey strategies are very basic. function predator_prey close all Initial_fuel_r = 500000; % Max stored energy for predator Initial_fuel_y = 50000; % Max stored energy for prey ...
function gij = mth_os_mt_cont(e, a, eta) % MTH_OS_MT_CONT computes the contravariant matric tensor gij of the % oblate spheroidal coordinate system. % %----------------------------------------------------------------------- % Copyright 2020 Kurt Motekew % % This Source Code Form is subject to the terms of the Mozilla P...
function obj = tv_objective( x, b, mu, eps ) obj = mu*l1_eps(grad2d(x),eps) + 0.5*norm(x-b,'fro')^2; return function rval = l1_eps(x, eps) rval = sum(sqrt(x(:).^2+eps.^2)); return
function [J, grad] = lrCostFunction(theta, X, y, lambda) m = length(y); J = 0; grad = zeros(size(theta)); h = sigmoid(X * theta); non_reg_j = - (1 / m) * sum(y .* log(h) + (1 - y) .* log(1 - h), 1); reg = lambda / (2*m) * sum(theta(2:end, 1) .^ 2); J = non_reg_j + reg; % [ 1 3 4..] this should be a column vector no...
clear all; close all; clc; % Siulation Time simulation_time = 3; global C R applied_external_voltage maximum_charge; % Applied Voltage applied_external_voltage = 10; % Capacitance C = 1e-2; % Resistance R = 50; % Maximum Charge on capacitor maximum_charge = C / applied_external_voltage; initial_charge = 0; ...
function result=mainFunction(populationSize, numberOfMutations, numberOfSteps, data,dataLength) combinations=nchoosek(1:5,3); combinationsToClassification=CTC(combinations); score(1:10,1:3)=0; scoreSin(1:10,1:3)=0; % data = 256 x 15 x 3 for j=1:1:10 for i=1:3:9 dataIn14=[data(:,combinations(j,1),(i+2)/3), ...
function H=VisualizeBoundCircle(X,R,C) % Visualize a 3D point cloud and its bounding circle. % % - X : M-by-2 list of point co-ordinates % - R : radius of the circle. % - C : 1-by-3 vector specifying the centroid of the circle. % - H : 1-by-6 vector containing handles for the following objects:...
function [alice_key, bob_key] = QKD(n,eavesdropping) % |0> O = [1; 0]; % X gate X = [0 1; 1 0]; % Hadamard gate H = (1/sqrt(2))*[1 1; 1 -1]; %% Alice alice_bits = randi([0,1],1,n); alice_bases = randi([0,1],1,n); for i=1:n if alice_bits(i)==0 ...
%% Initialization % clear the work space and close all figures clear; close all;clc; % Add all the folders into Matlab path currentFolder = pwd; addpath(genpath(currentFolder)); % Change the plot model in case of drawing crash opengl('save', 'software'); % Finished fprintf('Initialized!\n')
%% simulate data N = 20; % number of subjects for n = 1:N P(n).lrate = betarnd(1,9); % learning rate sampled from a beta distribution with mean 0.1 (=1/(1+9)) P(n).invtemp = gamrnd(5,1); % inverse temperature sampled from a gamma distribution with mean 5 (=5*1) end T = 100; % number of trials R = [0.25 0.75]; %...
% "High precise and zero-cost solution for fully automatic industrial robot TCP calibration" function [T] = tcp_calib(data,n) %plane norm vector normal_vector = [n(1) n(2) -1]; %normalize plane norm vector nor = norm(normal_vector); normal_vector = [n(1)/nor n(2)/nor -1/nor]; ...
%The MIT License (MIT) % % Copyright (c) January, 2014 michael otte % % Permission is hereby granted, free of charge, to any person obtaining a copy % of this software and associated documentation files (the "Software"), to deal % in the Software without restriction, including without limitation the rights % to use, co...
function [freq,flux,yes] = one_radial_line(nphot , xk0 , alpha , beta , make_plot , save , all_radial , radial_release) % set random number generator rng(10); % s = rng; nchan = 100; xmax = 1.1; vmin = 0.01; deltax = 2*xmax/nchan; freq = zeros(1,nchan); flux = zeros(1,nchan); ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Code can be found at https://github.com/OakesLab/FFT_Alignment % This routine produces a vectorfield of alignment directions using small % subwindows in the real space image. Images should be grayscale images. % Angles determined are...
%{ This scripts outputs the positive and negative vector fields together with the parameters. The vector fields (over an annulus) correspond to the instaneous trajectory of the ground contact point of an oblique cone when its apex is fixed and the cone is allowed to roll on a flat ground over its base rim. %} %Set p...
% Name: Zheng Wen % USC ID: 7112807212 % USC Email: zwen1423@usc.edu % Submission Date 1/27/2020 function res_img = NLmeans(img, small_r, large_r, h, a) %h: standard division %a: gauss standard devision [m,n]=size(img); res_img=zeros(m,n); PaddedImg=reflectionPad(img,small_r); panel=zeros(2*small_r+1,2*sm...
function DispNumberedTrig(Trig,vertexIndeciesP,faceIndeciesP,varargin) figure if(length(varargin)>0) Colors=varargin{1}; if(length(varargin)>1) ClearP=varargin{2}; else ClearP=true; end else ClearP=true; Colors=['r','g','b','c','y']; end Ncolrs=length(Colors); if(ClearP) ...
function M = rob_anim(fig,t_list,x_list,u_list,bnd_B,rob,gnd,prespect,flag_CoM) % input: fig ---- figure handle % Yt_list -- output of simulation % Yx_list -- output of simulation % bnd_B ---- boundary of target set, has to be 2xm matrix % rob ---- SimHopRob structure % gnd ----...
function correlationMats = do_group_level_glm(correlationMats, Settings) %DO_GROUP_LEVEL_GLM run group comparison % % Copyright 2014 OHBA % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundati...
clear all close all %%% add fieldtrip path addpath /home/jaco/fieldtrip-read-only/preproc/ %%% create random data data = randn(32,500,100); % 32 channels, 500 samples, 100 trials data = cumsum(data,2); data(32,2:500,:) = data(1,1:499,:); cfg.chan_sel = 1:32; % compute for all pairs of channels cfg.data_sel = 1:500...
samplingRate=0.004; Fmax=0.5/samplingRate; nt=1000; t=(0:nt-1)*samplingRate; df=2*Fmax/nt; f=(0:nt/2)*df; F=10; s=0.7*cos(2*pi*F*t); S=fft(s); A=abs(S/nt); amp=A(1:nt/2+1); amp(2:end-1)=2*amp(2:end-1); phase=atan2(imag(S(1:nt/2+1)),real(S(1:nt/2+1)))*180/pi; figure subplot(2,1,1) plot(real(S)) subplot(2,1,2...
%[2014]-"Grey wolf optimizer" % (9/12/2020) function GWO = jGreyWolfOptimizer(feat,label,opts) % Parameters lb = 0; ub = 1; thres = 0.5; if isfield(opts,'N'), N = opts.N; end if isfield(opts,'T'), max_Iter = opts.T; end if isfield(opts,'thres'), thres = opts.thres; end % Objective function fu...
function [sssAlligator] = alligator(High,Low,period1,period2,period3) %http://www.forextraders.com/forex-indicators/alligator-indicator-explained.html %http://www.tradingsetupsreview.com/trading-alligator-by-bill-williams/ % Blue=13 days SSMA % Red= 8 days SSMA % Green = 8 days SSMA % period1> period2>period3 ...
function K = uq_SVR_eval_K( X1,X2,theta, KernelOptions) %UQ_SVR_EVAL_K returns the kernel matrix K given X and hyperparameters % Detailed explanation goes here % Kernel options K_family = KernelOptions.Family ; K_isIsotropic = KernelOptions.Isotropic ; % K = nan; % Consistency checks if K_isIsotropic && length(the...
function [grad] = loss_gradient(label, gram, w, lambda) grad = 2*lambda*w - (gram') *(label.*(1-sigmoid((gram*w).*label)))/size(label, 1); end function [sig] = sigmoid(input) sig = 1 ./ (1+exp(-input)); end
function Expre_regu = Get_regular_fitting_expre(Struct) Struct_out = Struct; % Substitute x split_expre = strsplit(Struct.Expre,Struct.x_name); Expre_regu = split_expre{1}; for i = 1:length(split_expre)-1 Expre_regu = [Expre_regu, 'x',split_expre{i+1}]; end % Substitute y split_expre = strsplit(...
function coords = getLinSpacedPointsOnSquareGrid(n, distance) if mod(sqrt(n),1) == 0 x = sqrt(n); y = x; else error([num2str(n),' elements not possible. Only perfect squares.']); end coords = NaN(2,n); counter = 1; for i = 0 : x-1 for j = 0 : y-1 coords(1, counter) = i; ...
function [x, y, z] = sHarmonic(l,m) %%[x y z] = orbitalSTLmaker(l,m) % l,m are quantum numbers % [x y z] returns the xyz coordinates used for triangulation of the faces %This program will generate a solid shell of a given orbital. % More accurately, it will create a shell of a given spherical harmonic. % p orb...
function [ints,errs,header,orig,injectionEB] = B1integrate(fsn1,fsndc,sens,errorsens,orifsn,mask,orig,transm) % [ints,errs,header,injectionEB] = B1integrate(fsn1,fsndc,sens,errorsens,orifsn,mask) % % % injectionEB is 'y' if injection was between sample measurement and % empty beam measurement, otherwise it ...
function[modeled_data_OUT] = master_domain(obs_data, obs_kinetics, domains_in) %% Need to switch this to take in data from obs_data and obs_kinetics % Takes in observed data and models the Fcum, lnD/a2, and delta according to the given domain % structure --> output variable described below % data_in = observed data ...
function [ mean_result ] = PCA_SVM_T1_new( task, Size_of_feat, KernelSVM, ... fast, knn,selected_channels, number_sub_channel, size_of_sub) %PCA_SVM_T1 analyse data %========================================== %Author: Uladzislau Barayeu %Github: @UladzislauBarayeu %Email: uladzislau.barayeu@ist.ac.at %=============...
function I_rec = Decompress(I_comp) % Your decompression code goes here! [height,width] = size(I_comp.X); I_rec = zeros(height,width,size(I_comp.U,1)); for r = 1:height for c = 1:width I_rec(r,c,:) = I_comp.U(:,I_comp.X(r,c)); end end %for i=1:size(I_comp.U,2) % i % I_rec(find(I_comp.X == i),...
% Written by Patrick Strassmann % Analysis for Fixed-ratio behavioral task slidingWindowSize = 19; sigma = slidingWindowSize alpha = slidingWindowSize/(2*sigma); IPIcriterion = 20 collectData = 1 amplitudeAnalysis = 1; burstCountsToAnalyze = 1:6; plotSpikesAndPETHsSeparately = 1; FR = 4; signalStruct = struct; varName...
function [out]=fog_rectification(input) %#codegen % Copyright 2017 The MathWorks, Inc. coder.gpu.kernelfun; % restoreOut is used to store the output of restoration restoreOut = zeros(size(input),'double'); % Changing the precision level of input image to double input = double(input)./255; %% Dark channel Estimat...
function sig = PreadSGN(fnm) fid = fopen(fnm, 'r'); sig = fread(fid, 'float32'); fclose(fid);
function pointC=calPosFromAngle(vectorAB,dist,angle,pointB) % C % > % / | % / | % ---->---> % A B D if angle == 0 direction =0; else direction = angle / abs(angle); end angle = abs(angle); cosAngle = cos(angle); sinAngle = sin(angle); vectorBD = dist * cosAngle / norm(vectorAB...
function y=zfunp16(x) % derivata prima funzione test zfunf16 in [-4,4] y=11.*x.^10+8.*x; end
% ISAPPROX - Estimates whether or not one array is approximately numerically equal to another. % % SYNTAX: % b = isapprox(x, y) % b = isapprox(x, y, format) % % OUTPUT: % b: BOOLEAN % A Boolean indicating whether or not the two inputs are approximately equal. % % INPUT...
function [scaledDwn, scaledUp] = checkRescale(H, dwn, up) %{ this function just counts how many times a resize was necessary in TformSRT. Definitely a way to do this in the other function without having to pretty much do everything twice but I'm not sure how to do so when the output is already an array and very imp...
function CarMovement global x y OrigLargeImage=imread('BirdsEye.jpg','jpg'); car=imread('Car.jpg','jpg'); car=imresize(car,.1); car_temp=imread('template_car.jpg'); car_temp=imresize(car_temp,.1); car_temp=imrotate(car_temp,100); car=imrotate(car,100); [m1,n1,k1]=size(car); rr=[1,2]; Lu=[]; %look up table for butterfl...
function [C] = cellzeros(C, matrixSize) % [C] = cellzeros(C, matrixSize) % % Assign matrices of zeros the size of 'matrixSize' into the cell array C. % C can also be a vector for the size of the cell array. % % Inputs: % C A cell array to be filled with zeros or a vector % specif...
function [] = pssetpixels(p, c, t, l, b, r) %PSSETPIXELS Set pixel data to the current layer in Photoshop. % PSSETPIXELS(P) P is a H-by-W-by-C pixel matrix containing all the active % channels (C), the height (H), and width (W) of the document. For an RGB % document this would be a H-by-W-by-3 matrix. % % PS...
function [normalLineX, normalLineY, tangentLineX, tangentLineY] = getCollideAxis(circle1, circle2, normalVector) %Partie pour l'axe normal aux cercles mNormalLine = normalVector(2,1) / normalVector(1,1); pNormalLine = circle1.finalY - mNormalLine*circle1.finalX; normalLineX = linspace(circle1.finalX, circle2.finalX); n...
clc close all clear all %% Bakalářská práce % Název: Segmentace ultrazvukových sekvencí % autor: Jana Schwarzerová, učo: 186686 % Verze Matlab R2015b %% Segmentace Narůstání oblastí % ****************************Načtení dat********************************** % ...
%% HW 4.2.6 %% Initial-boundary-value Problem % * $v_t = \nu (v_{xx} + v_{yy}) + F(x, y, t), (x, y) \in R, t > 0$ % * $v(x, y, t) = g(x, y, t), (x, y) \in \partial R, t > 0$ % * $v(x, y, 0) = f(x, y), (x, y) \in \bar{R}$ % where % * $R = (0, 1) \times (0, 1)$ % * $F(x, y) = 0, f = 0, \nu = 1$ % * $g(0, y, t) = \sin t \...
function [result,ptemp]=model_function2(t1,t2,t3,t4,v) %设定变量 l=4.355; tstp=0.5; xstp=tstp*v; hcrou1=1.15e-6;%固态升温 hcrou2=1.85e-6;%液态升温 hcrou3=4.851e-7;%降温 dp=0.15e-3;%零件厚度 %计算 maxSlope=0; climb=0; high=0; peak=0; atime=l/v; n=uint16((atime-rem(atime...
clc clear files = dir('*SEG_DOWN3X.AIM*'); dirName = 'DK0:[MICROCT.DATA.00004088.00029271]'; fid = fopen('rotateSegAim.csv','w'); [NUM,TXT,RAW]=xlsread('F:\tibial plateau scan information.xlsx','Condyle Rotation Adjustment','A2:H100'); fprintf(fid,'%s\n','$ipl'); for i = 1:length(files) fileName = files(i).nam...
function FlylabPlotAngleOverTime(dirspec, filespec) % FlylabPlotAngleOverTime(dirspec, leafspec) % Take a set of directories of .csv files (written by Flylab), % and plot the mean angle trajectory, and the individual angle trajectories. % This is used for viewing how the fly orientation changes over time. % % di...
classdef NdgQuadratureFreeNonhydrostaticSolver3d < handle %NDGQUADRATUREFREENONHYDROSTATICSOLVER3D 此处显示有关此类的摘要 % 此处显示详细说明 properties % Second order partial derivative about nonhydrostatic pressure in direction x, $\frac{\partial^2 p}{\partial x^2}$ SPNPX % Second order partial...
fileName = 'C:\Users\Loukianos\Downloads\ENZYMES\ENZYMES_g292.edges'; inputfile = fopen(fileName); W=[]; l=1; k=1; W=zeros(60); while l<200 % Get a line from the input file tline = fgetl(inputfile); % Quit if end of file if l>0 nums=strsplit(tline); if length(nums) W(...
N1=[4,4]; N2=[9,9]; sinif1=repmat(N1,500,1)+randn(500,2); sinif2=repmat(N2,500,1)+randn(500,2); etiket1=ones(500,1); etiket2=2*ones(500,1); tumSiniflar=[sinif1;sinif2]; tumEtiketler=[etiket1;etiket2]; gscatter(tumSiniflar(:,1),tumSiniflar(:,2),tumEtiketler,'rb','+*'); model=fitcnb(tumSiniflar,tumEtik...
function generalization_error = simple_validation(x,y,test_data_percent, train_function, predict_function, grade) %SIMPLE_VALIDATION Summary of this function goes here % Detailed explanation goes here trn_data_length = round((length(x) * test_data_percent)/100,0); data_indexes = randperm(length(x)); xtrn = x(data...
clc clear all fprintf('the Newton-Raphson method\n\n'); Xi = input('Initial point = ? '); tol_x = input('tolerance x = '); tol_y = input('tolearnce y = '); while(1) Xu = Xi - fun(Xi) / pfun(Xi); Yu = fun(Xu); if(abs(Xu-Xi) < tol_x || abs(Yu) < tol_y) root = Xu break; else ...
function [dimA, dimB] = contractinds(ia, ib) % contractinds - Find the contracted dimensions. % [dimA, dimB] = contractinds(ia, ib) % locates the repeated indices. ind = find(ia(:) == ib).' - 1; dimA = mod(ind, length(ia)) + 1; dimB = floor(ind / length(ia)) + 1; % slower than the automatic: % [dimA, dimB] = ...
classdef ConeOutline < handle % CONEOUTLINE % % 30Dec2017 % -- properties (SetAccess = private, GetAccess = public) closedCurve coneTrace end properties (Constant = true, Hidden = true) TAG_DEFAULT = 'cone'; end methods function obj = Co...
function [sum] = add_seconds(original_time, seconds_to_add) %% Update Seconds temp_sec = original_time(6) + seconds_to_add; if temp_sec >= 60 addMinute = floor(temp_sec / 60); temp_sec = mod(temp_sec, 60); else addMinute = 0; end %% Update Minutes temp_min = original_time(5); if addMinute ~= 0 temp_min...
%{ This is an implementation of the model described by Dupuy and Fivel Implementation for a Lomer Lock %} clc; clear; % Definition of important anonymous functions Energy = @(theta, b, nu) (b.^2) .* (1 - nu .* cos(theta).^2) ./ (1-nu); dEnergydTheta = @(theta, b, nu) (b.^2) .* (nu .* sin(2 .* theta)) ./ (1 - nu); ...
function [outputArg1] = componentNames() %COMPONENTNAMES Summary of this function goes here % Detailed explanation goes here outputArg1 = neqsim.util.database.NeqSimDataBase.getComponentNames; end
function fm2() % loading matched points: load left_image_points; load right_image_points; [a b]=size(left_image_points); % finding A matrix: for i=1:a x1=left_image_points(i,1); y1=left_image_points(i,2); x2=left_image_points(i,1); y2=left_image_points(i,2); %A(i,:)=[x1*x2 x...
clear all close all % For particle filter %%%%%%%%%%%%%% % sensor_update2.m % ResampleParticles2.m % motion_update.m % (sysresample.m) % InitAroundPose.m % IsInBounds.m % MCL_GetPoses.m % MCL_Update.m % Compute RMSE values RMSE_EKF = zeros(3,1); RMSE_UKF = zeros(3,1); RMSE_PF = zeros(3,1); RMSE_RBPF = zeros(3,1); M...
function ia_plot(level_difference,time_difference,direction_matrix,... frq_axis,single_plane) % function ia_plot(level_difference,time_difference,direction_matrix,... % frq_axis,single_plane) % % IA_PLOT plots for a horizontal plane the interaural time difference and the % ...
c = [2 1]; A = [-6 10; 7 2; 4 -3; -2 -4; -2 2; 2 -1]; b = [17 28 16 3 3 19]'; % x = [-1; -1]; BaseIniziale = [5 6]; format compact format rat % mode = 'frombase'; %'fromx' o 'frombase' maxiter = 4; disp("######################### INIZIO #########################"); n_vincoli = size(A,1); Base...
function output = pNN50_20s(Name) [rr,tm]=ann2rr(Name,'atr'); num = size(rr,1); time = zeros; j = 1; for i = 1:num if(rr(i)>1000) time(j) = (rr(i)/5000); j = j+ 1; end end period = time(1, 1:20); sum = 0; for q = 1:19 if((period(q+1)-period(q))>50) sum = sum + 1; end end ...
function [trial, data] = GaborTrial(display, stimParams, data) % trial = GaborTrial(display, stimParams) numStimColors = display.stimRgbRange(2)-display.stimRgbRange(1)+1; % We want to guarantee that the stimulus is modulated about the background midStimColor = display.backColorIndex; % display.gamma contains the gamm...
clc close all fig = figure(); hold on i = 1; track = loadTrack('testTrack.mat',100,true); car = TestCar([track.x(i);track.y(i);-30;1]); n = 3; N = 12; dt = .5; plot(track.x,track.y,'.r') plot(track.bx,track.by,'.-k') plot(track.yx,track.yy,'.-k') his = []; isLoopClosed = false; totalTime = 0; elapsedTime = 0; pa...
function [ image, descriptor, location] = ownSIFT( img, n ) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here % n: window size image = imread(img); I = single(image); [location, descriptor] = vl_sift(I, 'WindowSIze' , n); location = double(location'); descriptor = double(descriptor); de...
function flag = event_gradient_ss(t,y,yp,k2,thresh,component) %y = 1 when the L2 norm of the gradient field is below thresh(1) %y = 2 when the 2-norm of the time derivative yp is below thresh(2) %note that y is in Fourier space. %L2 norm of the gradient field is \int_{|| \nabla y(x) ||^2 dx} = \int_{|| k ||^2 |...
X1 = load('Handheld_Front_Vito_X.mat'); Y1 = load('Handheld_Front_Vito_Y.mat'); X2 = load('Handheld_Front_2D_X.mat'); Y2 = load('Handheld_Front_2D_Y.mat'); X3 = load('Handheld_Front_PreVGG_X.mat'); Y3 = load('Handheld_Front_PreVGG_Y.mat'); X4 = load('Handheld_Front_Orig_X.mat'); Y4 = load('Handheld_Front_Orig_Y.mat')...
%add two images - size should be the same img1 = imread('img1.png'); img2 = imread('img2.png'); %same size summed = img1 +img2; %imshow(summed); %lower the intensity in images average = img1 /2 + img2 /2; %imshow(average); average2 = (img1 + img2) /2; %imshow(average2); % writing a function % multiply by a scal...
close all clear all % working DNN clc % nh = [60,40,30,20]; %ims AND cwru % nh = [100,70,50,30]; %Air Compresser % new architecture wider nh = [60,50,40,20]; %ims AND cwru % nh = [100,80,60,30]; %Air Compresser epoch =1; % training epochs mini_bat...
function frequency_array_for_correlation = get_frequency_array_for_correlation(faxis, frequency_array) % Purpose %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Make frequency array for correspondence of group id to frequency % Just for experiment 3 (Sweep experiment) %%%%%%%%%%%%%%%%%%%%%%%...
clear all; [original_audio, Fs, nbits] = wavread('C:\Users\AASHISH\Desktop\sound_test5.wav'); %---------------------------------------------------------------------------- x = original_audio; h = fir1(5,2/32); y = filtfilt(h',1,x); wavplay(y,Fs);
clear tic d=load('data_error.txt'); data=d(:,2); N=length(data); x=min(data):0.01:max(data); L=length(x); T=100; for n=1:2 %baraye D1 va D2 Mn=zeros(L,T); delta=zeros(1,T); for t=1:T; %be ezaye tav haye mokhtalef D hara mohasebe mikonim for k=1:L j=0; for i=1:...
function [nDC, nDCH, nDCD, nHospital, inHospital, nICU, inICU, nDeaths, PD_Lockdown, INF, FinalState]=Simulate_One_Region(Region, TAU, ALPHA, INC_P, S_Scale, Factor, h_factor, i_factor, d_factor, h_stretch, i_stretch, Lag, ... Start_Date, WALES_FLAG, ComplianceT, ComplianceO, Run_stop, nV_Beta, nV_Speed, Import_Da...
function [cost,sched,risk,perf] = EO_fitness_fcn_multi(x) %% EO_fitness_fcn.m % This function takes as an input a vector [1 x N_INSTR] called x which % contains the assignment of instruments to satellites following the format % below: % x = [Sat_of_instr1 Sat_of_instr2 ... Sat_of_instrN_INSTR] % where Sat_of_instri are...
function result = calc_diffusion(sigma_vals,time_vals) % input: sigma_vals - sigma values, time_vals - according timestamps % output: result - diffusion coefficient for given values [~,m,~] = elr(sigma_vals(:).^2,time_vals()); result = m/2; end
function draw( obj, varargin ) if nargin == 1 fphys = obj.fphys; elseif nargin == 2 fphys = varargin{1}; end % check the figure is created and not removed. isFigureExit = ~isempty( obj.draw_handle ) ... && isvalid( obj.draw_handle{1} ) ; if isFigureExit for m = 1:obj.Nmesh mesh = obj.mesh...
function [ G ] = ppmwrite( input, outfilename, inbit ) %将一幅图像转换为单通道的PPM格式的图像 % input为输入的图像矩阵, outfilename为输出的图像, % inbit为输入的图像的位精度,目前只能是8位或者16位,否则结果不正确。 % G作为函数输出,只是为了方便和产生的outfile图像进行对比,检验结果是否正确。 fid = fopen(outfilename, 'w'); [h, w, d] = size(input); Imax=uint16(2^inbit); fprintf(fid, 'P6\n'); fprintf(fid, '%d ...
% 用矩阵方式实现求x=1-20000的函数sin(x/100pi)的值 function y = sinfun2(M) x = 0:M; y = sin(x ./ (100*pi)); end
function [tankShape,ThetaRiseMax,Ntupes,Stube] = DesignTankShape(x,y,z,maxAllowableTempRise,pi,hvsCurrent,Req) dt = 0.05; It = 0.075; TankDissipationArea = (2 .* x .* z)+(2 .* y .* z)+(x .* y ./ 2); Pcu = 3 .* power(hvsCurrent,2) .* Req; ThetaRiseMax = (pi + Pcu) / (12.5 .* TankDissipationArea); if ThetaRiseMax <= max...
function [NshapeS] = C3D8_El_Shape_Surf(NES,xi) NshapeS(1) = (1-xi)/2; NshapeS(2) = (1+xi)/2; %NshapeS = NshapeS';
function [ T ] = initiate(n,m,t0 ) T=zeros(m,n); for i=1:n for j=1:m T(i,j)=t0; end end end
function [x1, x2, y1, y2] = value_yue_jie(x1, x2, y1, y2, pic_xsize, pic_ysize) if x1 < 1 x1 = 1; end if x2 < 2 x2 = 2; end if y1 < 1 y1 = 1; end if y2 < 2 y2 = 2; end if x1 > pic_xsize x1 = pic_xsize - 1 ; end if x2 > pic_xsize x2 = pic_xsize; end if y1 > pic_ysize y1 = pic_ysize - 1; end i...
function [W,b] = updateW1(X,Y,eta,W,b,n,l) % initialize the gradient of the weighting matrices and biases nabla_W = cell([1,l-1]); nabla_b = cell([1,l-1]); for i = 1:l-1 nabla_W{i} = zeros(n(i+1),n(i)); nabla_b{i} = zeros(n(i+1),1); end % compute the gradient of the ...
function gui = applyToAllMice(gui,action,varargin) data = gui.allData; inds = gui.allPopulated; switch action case 'add' newStr = varargin{1}; case 'delete' killStr = varargin{1}; case 'merge' oldList = varargin{1}; newName = varargin{2}; toKill = varargin{3}...
% im_labtop=imread('labtop.JPG'); % load Camera_data; % % extract_grid(im_labtop(:,:,1),15,15,fc,cc,kc,dX,dY); % % % load Plane % TwoDpoint = [KK [0; 0; 0]]*[R_proj T_proj; 0 0 0 1]*[Tc_ext; 1]; % TwoDpointNorm=TwoDpoint/TwoDpoint(3) % TestImage=zeros(size(I)); % TestImage(:,ceil(TwoDpointNorm(1)))=255; % TestImage(c...
function weights=Mmakeweights(edges,img,theta) [m,n,k] = size(img); % Calculate average Lab value of each pixel Img(:,:,1)=img(:,:,1)'; Img(:,:,2)=img(:,:,2)'; Img(:,:,3)=img(:,:,3)'; input_pixels=reshape(Img, m*n, k); img_lab = colorspace('Lab<-', input_pixels); weights=exp(-(1)*sqrt(sum((img_lab(edges(:,1),:)-img_l...
t1 = posixtime(datetime('now')); a = 2; b = 3; c = a*b; for i=1:10 j = 4; end t2 = posixtime(datetime('now')); diff = t2-t1;