text
stringlengths
8
6.12M
% Figure: clustered heatmap (clustermap) % 03.05.2020 JR % Generates a hierarchically-clustered heatmap from a numeric array. % % %%%%% Usage %%%%% % CLUSTERMAP(data, row_label, col_label, cmap) performs % hierarchical clustering via LINKAGE and DENDROGRAM and visualizes data % via HEATMAP. Rows/columns are la...
%% Changes the endian of an array function out = swapendian( msg ) s = fliplr(msg); % Flip array i = 1; while i < length(s) %Through array s([i i+1]) = s([i+1 i]); % Flip bits i = i + 2; end out = s;
function[M,trasy]=local(seq1,seq2,kara,nagroda,przerwa,poczatek,koniec) if (length(seq1)>length(seq2)) A=seq2; B=seq1; else A=seq1; B=seq2; end iloscW=length(B)+1; iloscK=length(A)+1; M=zeros(iloscW,iloscK); back = zeros(iloscW,iloscK); back(1,2:iloscK)=70; back(2:iloscW,1)=7; for i=2:iloscW f...
function [c] = config_getdefault() c = segmentation_configuration(); c.memory_efficient = 0; % 1== github, 2==denis, 3==lindmik c.dataset = 1; % Feature Extraction Parameters c.sampleRate = 4000; c.secondsPerTile = 5; c.minTrackLength = 134; c.maxExpectedTrackWidth = 641; % (magicisland=380*2 others 350*2) c.band...
function [X_poly] = generate_poly_features(X,k) X_poly = []; for j = 1 : k % for each value j from 1 to k, calculate power of the matrix times j. trainRow = power(X,j); % on each iteration size of each matrix increases. Thus to append the new % matrix generated, make a grid of size equal to the co...
function nii2analyze(casFilesNii) % EXAMPLE % casFilesNii = {'./arun_01.nii;./rtmp_variance.nii;./run_01.nii}; % nii2analyze(casFilesNii); % $Id: nii2analyze.m 1279 2014-03-24 20:06:25Z klitinas $ % $HeadURL: svn+ssh://klitinas@anger.engin.umich.edu/svn/matlab/img/trunk/nii2analyze.m $ % Loop through and convert each...
% Example 1.1 R=10 i=[0:2:10] v=R*i P=V*i T=[i;V;P]
function [Solution2,Solution] = Generate_Segments(row,column) %% n2=(column*row-1)/8; n3=(column*row-1)/4; Solution=cell((n2+n3),1); Solution2=cell((n3*3/2),1); position2=zeros(2,2);position3a=zeros(3,2); position3b=zeros(3,2);position2a=zeros(2,2); position3a(1,1)=0; position3a(1,2)=(row-1)/2; position3a(2,1)=(row-1...
% This file is a demo of UMUTracker Project.The UMUTracker is currently under active development. % Related information can be found in the paper : % % Hanqing Zhang, Tim Stangner, Krister Wiklund, Alvaro Rodriguez, Magnus Andersson % UmUTracker: A versatile MATLAB program for automated particle tracking of 2D light ...
function void = assignmentOneSub(dataMatrix) % first assignment of Offline-2 (auxiliary part) % main operations are accomplished here % % Input: % dataMatrix = matrix containing given sets of data % Output: % this function returns nothing % task-1 (NOTICE: graph plotting) figure; % NOTICE sc...
function error=LR_SteepestDescent( Xtrain, Ytrain, Xtest, Ytest ) %Batch %Construct nonlinear basis function intercept=ones(size(Xtrain(:,1))); x_quad=Xtrain.^2; x_3=Xtrain.^3; Xtrain_new=cat(2,intercept,Xtrain,x_quad,x_3); %Initiate weights weights=ones(size(Xtrain_new(1,:)')); %initiate alpha alpha=1e-5; for n=1:100 ...
function [ Q, R ] = ModGSQR( A ) %ModGSQR zmodyfikowany algorytm rozkładu QR Grama-Shmidta % A - macierz wejściowa % Q - macierz wyjściowa ortogonalna % R - macierz wyjściowa górna trójkątna [m,n]=size(A);%macierz A może nie być kwadratowa Q=zeros(m,n); R=zeros(n,n); d=zeros(1,n); for i=1:n %rozkład QR Q(:,i)...
function next_gen_infomation_sturct = ... Explore_next_gen(current_gen_info) %This function is at the cuurent genration level - we want to find the %paths that coreesponding current bi points, the end points of the paths %and set up the next gen structure % I - % current_gen_info = struct; % current_gen_info...
%% Remap to Depth % Calls linearEOS.m and Resplotter.m (which calls RSF.m) function [Psimap]=Remap(start,t,option) %% This functions remaps Streamfunctions in (y,t) or (y,rho) into (y,Rho(z)) %Inputs: %Fname = String of years e.g.225-230 %Option: 1= Temp layers 2=Density layers %Calls RSF2 RSF3, linearEOSDens close al...
function C = vec2col(v,w,step, dim, ctr) % function C = vec2col(v,w,step, dim, ctr) % Splits a vector (or the columns of a matrix) into windows with length w, % stepping with length step. % % Mercurial revision hash: $Revision$ $Date$ % Copyright (c) 2010, Eric Tytell <tytell at jhu dot edu> if (nargin < 5) ctr = ...
function [J, Grad ] = nnCost( x,y,theta ) % Summary of this function goes here % This is a costfunction with backward propagation % The neural netwrok contains two hidden layers with 3 % neurons in each layer. % Detailed explanation goes here % Coded by Hemanth Manjunatha on Mar 28, 2016 % Initilaize the Variables [a...
clear clc format compact close all warning('off', 'optim:quadprog:HessianNotSym') %% Robot Model [PARAMS, PARENTi, KINE, INER, CNCTPTS] = PendModel(); [RobotLinks, RobotParam] = PendRobot(PARAMS, PARENTi, KINE, INER, CNCTPTS); n = RobotParam.n; m = RobotParam.m; %% Wrong RobotModel - What Controller Thinks [PARAMS2,...
function [this, tt, ts] = trend(this, varargin) % trend Estimate time trend in time series data. % % Syntax % ======= % % Input arguments marked with a `~` sign may be omitted. % % x = trend(x, ~range, ...) % % % Input arguments % ================ % % * `x` [ tseries ] - Input time series. % % * `~range` [ numeric...
function [ data ] = getP2C( data, wb ) %getP2C Calculates a frame's proximity to its cluster centroid % Preallocate nGroups = numel(data.clusters); nrf = numel(data.frames); d2c = zeros(nrf,1); % Calculate distance between frame and cluster centroid waitbar(0,wb,'Calculating distance to cluster ce...
%{ Newton Raphson system equations Input : % matEq Matrix with the n equations % vVal Vector with the initial value of the variables % it Number of iterations output : % vRoots % vEa % message %} function [varargout] = NRS(matEq, vVal, it) n = size(matEq,1); v = [vVal]; vEa = []; syms(sym('x',...
function Ndumpgptstart(fid,ax,ay,x1,y1,x2,y2) fprintf(fid,"reset\n"); fprintf(fid,"unset border\n"); fprintf(fid,"unset key\n"); fprintf(fid,'set size ratio %f\n',ay/ax); fprintf(fid,"unset tics\n"); fprintf(fid,"set size ratio %f\n",(y2-y1)/(x2-x1)); fprintf(fid,"set xrange [%f:%f]\n",x1,x2); fprintf(fid,"set ...
clc,clear all,close all; image = imread('pout.tif'); image_new = imadjust(image, stretchlim(image), [0.0, 1.0]); subplot(221); imshow(image); title('Original image'); subplot(222); imhist(image); title('Histogram of original image'); subplot(223); imshow(image_new); title('Stretched image'); subplot(224); imhist...
function [Q2,QT,priceR,priceT,prI,prP,W] = m1_expost_outcomes(t,Qm,a,b,c1,c2,x,k,n_i,th1,th2) Q_max = exp(a-b*(c1+t)); % Entire energy market at dirty energy prices if c2-th1+Qm >= c1+t; % Impossible to exceed mandate % Q2 = Qm; priceR = c2-th2+Qm; prI = (th1-th2)*Qm; else; % Possible for winner to ...
I=zeros(400,400); I(100:300,100:300)=1; % imshow(I); I=imread('giraffe.jpg'); I=im2double(rgb2gray(I)); hx= [ -1 0 1; -1 0 1; -1 0 1 ]; hy=hx' Ix=abs(conv2(I,hx,'same')); Iy=abs(conv2(I,hy,'same')); imshow([Ix Iy Ix+Iy (Ix+Iy)/2])
function outArray = sample_Interpolation_Cimini_ER_Bin(sr,sc,z,theta,Nsample) prodMat = (sc*sr').^theta; if length(z(:))==1 %if the z input is a number then treat it as a number tmp = z*prodMat; elseif prod(size(z)==size(prodMat)) % check wether the dimension of z is compatible...
function result = phi(currPointB, neighborA, neighborC) AB = currPointB - neighborA; BC = neighborC - currPointB; result = acos(dot(AB, BC)/(norm(AB, 2)*norm(BC, 2))); end
%% Choose only images from dataset 3 imNumsToUse = [70:173, 175:225]; % skip the category with only 7 frames %% Load gabor images (huge time-saver!) inputfile = 'data/preprocessing/2014-12-04/gaborBands.mat'; load(fullfile(rootpath, inputfile), 'gaborBands'); %% Continue with contrast images outputdir = fullfile(root...
function [bands] = bci_freq2band(fp,f,df,fs) %fp = Nx1 (number of frequency points) %df = step per band %f = center frequencies [Nf] = length(fp); NBand = length(f); bands = zeros(1,NBand); dn2 = ceil(Nf*df/(2*fs));%number of point for half df fcn = floor(Nf*f/fs);%number of points per center frequencies fcnl = fcn-dn2...
%Code was copied and edited from MATHWORKS examples %http://www.mathworks.com/help/images/examples/color-based-segmentation-using-k-means-clustering.html?prodcode=IP&language=en %Edited by: Andrea Hidalgo %July 10th, 2014 figure(1) RGBsample = imread('RGBsample.jpg'); imshow(RGBsample),title('Messier-83'); te...
% Copyright (c) 2012 Romain Hennequin (http://www.romain-hennequin.fr/). % script to synthesize audio data from a MIDI file. clear all % directory of MIDI files inputDirectory = 'sounds\separation\score informed\Midi'; directory = dir(inputDirectory); for p = 3:length(directory) % name of the MIDI file M...
close all; x = csvread('data.csv'); x = [ x zeros(1,200)-1]; n = numel(x); M_max = max(x); M_min = min(x); R = max(x) - min(x); MX = 1 / n * sum(x); DX = 1 /(n - 1) * sum((x - MX).^2); Sigma = sqrt(DX); fprintf('\nM_min = %.2f\nM_max = %.2f\nR = %.2f\n', M_min, M_max, R) fprintf('\nMX = %.2f\nDX = %.2f\n', MX, DX); ...
c = [1; 0; 1]; A = [1, 2, 0; 1, 0, 2]; b = [5; 6]; lb = []; ub = []; ctype = "US"; vartype = "CCC"; sense = 1; [xmax, fmax, status, extra] = glpk(c, A, b, lb, ub, ctype, vartype, sense)
function filteredDetectedEvents = chainQ_new_V2(timeSeries, seedPositions, windowSize, duplicationThreshold, maxChainLen) tic DEBUG = 0; maxOverlapRestricted = round((7 / 8) * windowSize); maxOverlapRelaxed = round((1 / 2) * windowSize); chainsFromED = []; chainsFromDTW = []; for i...
function [zeroFormGN] = globalNumbering_0_form(obj, p) % globalNumbering_0_form computes the local to global numbering of 0-forms % of polynomial degree p on the SurfaceOfSphere mesh. % % The numbering is done along eta first and then xi. According to the % schematics below: % % G % ...
function [ posa,nega ] = list2() %UNTITLED Summary of this function goes here % Detailed explanation goes here [File_Name Path_Name]=uigetfile({'*.xlsx'},'Select Review Data'); some=strcat(Path_Name,File_Name); data=xlsread(some); intensity=data(:,1); pitch=data(:,2); %imshow(intensity); a=max(intensity); b=min(int...
%--------------------------------------------------------------------- %--------------------------------------------------------------------- % % Startup script for plot settings in MATLAB % %--------------------------------------------------------------------- % % Dependencies; none. % % Ryans ROMS Matlab and netcdf...
function F= myfun_Xaxis_RFdirection_2order(c,x) % the function of pseudo potential around the position % x(j,1)==X, % F= c1 x^2+c2*x+c3 n=size(x,2); for j=1:n F(j)= c(1)*x(j)*x(j)+c(2)*x(j)+c(3); end end
%script to test interp3 of the UWBRAD data clear all D=load('dat/TbUWBRAD.mat'); x=20; rhoi=rand.*range(D.rho)+min(D.rho); dTi=rand.*range(D.dT)+min(D.dT); Bi=rand.*range(D.B)+min(D.B); Tbi=ObsModel(D,rhoi,dTi,Bi,x); for i=1:length(D.rho), for j=1:length(D.dT), for k=1:length(D.B), plot(D....
N = 24; [D, x] = fourierDiff(N); % smooth function in [0, 2*pi] f = exp(sin(x)); fprime = cos(x).*f; % plot(x, D*f' - fprime', '-m', 'Marker', 'o'); % smooth function in [0, T] T = 3; t = 3*x/(2*pi); f = exp(sin(t*2*pi/3)); fprime = (2*pi/3)*cos(t*2*pi/3).*f; plot(t, (2*pi*D*f')/3 - fprime', '-m', 'Marker', 'o');
%题目 协变量 x -1 -1 0 0 0 0 1 1 1 % y 2 3 6 7 8 9 10 12 15 %求泊松分布 %答案 lamda = y = exp(ax+b) a=1.8893 b=0.6698 clc; clear; X=[-1;-1;0;0;0;0;1;1;1]; Y=[2;3;6;7;8;9;10;12;15]; X=[X,ones(size(X,1),1)]; W=rand(2,1)-0.5; a=0.00001; epsilon=0.0000000001; for i=1:100000 deltaW=a*X'*(Y-exp(X*W)); %更新过程 ...
% Entry function for the preprocessing. Takes a given image and % preprocesses it in order to facilitate the following component % retrieving step. function [im_mute, im_binarized, im_thin, ocrResult] = preprocess(im_original, answer) %% preprocessing parameters bin_threshold = 150/255; %% image region choosing % if ...
% Berechnung des 25%-Quartilkoeffizienten der Schiefe q = quantile(Klebermenge,[0.25 0.5 0.75]); g25 = ((q(3)-q(2))-(q(2)-q(1)))/(q(3)-q(1)) % Berechnung des Momentenkoeffizienten der Schiefe gm = skewness(Klebermenge)
function fp_plot( op, fname, figure_number) % Run this after fp_ini.m and one of fp_*.slx % to obtain plots, or simply the signals % March2017, J. Gaspar % June2017 "MODIFIED" by João Ribafeita % more operations asked via arg 'op' switch op case 'load' fp_plot_data_load(fname) %loads fi...
close all clear all clc Fs = 1000; time = 0:1/Fs:4; t_stim = 0:1/Fs:2; SR = 0.1:0.1:1.5; N_MU = 120; %number of motor unit i_MU = 1:N_MU; %motor unit identification index RP_MU = 100; %range of twich force across motor untis in unit of fold b_MU = log(RP_MU)/N_MU; %coefficient to establish a range of twich force value...
close all; clear all; clc; ap.ThisFile = fileparts(mfilename('fullpath')); cd(ap.ThisFile); nm.ThisFile = mfilename; load('matlab.mat') %% Do some testing try [grade, grade_theses, grade_prog] = calculateGrade(con, strPoints, numTheses); catch err error([mfilename ': ' err.Message]); %% Clean up c...
function [ array_out ] = apply_filter_mad3(array_in) %A function to apply the a filtering whereby only data that lies within 3 %median absolute deviations of the median is kept. Each row of the data is %filtered seperately. % *INPUT* % array_in: ARRAY - array of data. % This structure can be create...
%QT_DIRCOS2QUAT_E Convert direction cosine matrix to quaternion % % Syntax: % q = qt_dircos2quat(C) % % In: % C - Direction cosine matrix % % Out: % q - Unit quaternion % % Description: % Convert direction cosine matrix C to quaternion q. % This code is compatible with Eigen package. % Copyright (C) 2014 Sim...
n = 100; X = rand(n, 2); y = [ones(n/2, 1); -ones(n/2, 1)]; splitGain = MSESplitGain('constant'); splitGain = splitGain.reset(X, y); n = 1000000; y = rand(n, 1); yPred = rand(n, 1); for i = 1:1000 end tic for i = 1:1000 sd2 = mean((y-yPred).^2); end toc tic for i = 1:1000 r = y-yPred; sd2 = r' * r / num...
function gray = image_threshold ( gray, a ) %*****************************************************************************80 % %% IMAGE_THRESHOLD resets gray pixels to black or white based on a threshold. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 27 F...
function submitWeb(partId) if ~exist('partId', 'var') || isempty(partId) partId = []; end submit(partId, 1); end
function [rho,Delta_t]=Godunov(geometry,rho_0,... Demand_upstream,Supply_downstream,... Delta_x,T) number_section = length(geometry); V_max = 0; X = []; L_section = NaN(1,number_section); L_partial = 0; % %--------------------- Optional --------------------- % figure; hold on for i = 1:number_section V_...
% ADVISOR data file: PTC_CONVAT.m % % Data source: % % Data confirmation: % % Notes: % Defines all powertrain control parameters, including gearbox, clutch, % and engine controls, for an advanced conventional vehicle using a 4-spd % gearbox. % % Created on: 7-Oct-1998 % By: MRC, NREL, matthew_cuddy@nrel.gov % % Rev...
x = [normrnd(2, 2.7, 100, 1); normrnd(20, 2.7, 100, 1); normrnd(2, 2.7, 100, 1); normrnd(10, 5.7, 100, 1)]; y = [normrnd(2, 2.7, 100, 1); normrnd(20, 2.7, 100, 1); normrnd(20, 2.7, 100, 1); normrnd(10, 5.7, 100, 1)]; dots = cat(2, x, y); init_means = [5 5; 15 15; 5 15; 20 10]; dist = @(x1, y1, x2, y2) sqrt((x1 - x2).^2...
function out = GetCenterPos(newTime, p1, p2, p3, stdEdge, angle) % Get the Center Position with given p1,p2,p3, and return [time x y z]. [row col] = size(p1); edges = [GetDistance(p1, p2) GetDistance(p1, p3) GetDistance(p2, p3)]; edges = sortrows(edges')'; stdLen = stdEdge(4); centerPos = zeros(row, 4); num = 0; for...
% Activity: MATLAB 2 Bonus, Task 1 % File: ML2_ACT_Task1_katherto.m % Date: 22 November 2015 % By: Kathryn Atherton % katherto % Ryan Hellyer % rhellyer % Natalie Zimmermann % zimmermn % % Section: 04 % Team: 59 % % ELECTRONIC SIGNATURE % Kathryn Atherton % Ryan Hellyer % Natalie Zimmermann % % The electronic signatur...
function [h,v] = satellite(T,unit) % SATELLITE calculates altitude and velocity of a satellite with period T % Constants G = 6.67*10^(-11); M = 5.98*10^(24); R = 6.371*10^(6); grain = 100; switch unit case "day" || "dy" || "d" T/(24*3600) case case case ...
function [A2 B2 E] = gradDes(A, B, Iv, In) global H_SOBEL H_SOBEL = fspecial('sobel'); global H_LAPLACIAN H_LAPLACIAN = fspecial('laplacian', 0); global GRAD_IN GRAD_IN = gradient(In); global GRAD_IV GRAD_IV = gradient(Iv); THRESHOLD_E = 1e-1; THRESHOLD_L =1e-7; for i = 1:100...
clear all; close all; h = fspecial('gaussian',3,1.4); %generate the gaussian filter with 1.4 sigma rank = rank(h); sum_en = sum(sum(h)); %note the rank of h and sum of all entires will be 1 [U,S,V] = svd(h); %apply svd() function to devive for verticle and horizontle direction h1 = U*sqrt(S); h2 = sqrt(S)*V'; %use U...
function [p] = Shape2P(obj,shape) %Shape2P Summary of this function goes here % Detailed explanation goes here q = obj.Shape2Q(shape); b = obj.Shape2B(obj.RemoveQ(q,shape)); p = [q;b]; end
function [cM] = ... stats_metaFold(varargin) % % NAME % % function [cM] = stats_metaFold() % % ARGUMENTS % INPUT % % OPTIONAL % % OUTPUTS % cM cell cell array of stats data, organized % per curvature type % % DESCRIPTION % % 'stats_metaFold' draws plots of the GWI and WMF indices for a set of % subjects % % ...
function [y]=sigmoid (x) for i=1:length(x) y(i)=1/(1+exp(-x(i))); %figure(1) %hold on %plot(x(i),y(i)); % if y(i)>0.5 % y(i)=1; % else y(i)=0; % end end end
function varargout = GUIFeedback(varargin) %GUIFEEDBACK MATLAB code file for GUIFeedback.fig % GUIFEEDBACK, by itself, creates a new GUIFEEDBACK or raises the existing % singleton*. % % H = GUIFEEDBACK returns the handle to a new GUIFEEDBACK or the handle to % the existing si...
clc; close all; clear all; % Read Colour Image and convert it to a grey level Image % Display the original Image mycolourimage = imread('lena.jpg'); myimage = rgb2gray(mycolourimage); subplot(1,2,1); imshow(myimage); title('Original Image'); % Apply LOG edge detection % The sigma used is 3 f=fspecial('lo...
clc clear interval = 3; x = 7; name = 'data'; iter = interval*10/interval; temp_sum = zeros(x,iter); temp_average = []; pot_sum = []; pot_average = []; pot_max = []; data = []; data2 = []; A = [1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10; 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1...
function [dbname,list_ICD9,interval_boundary,interval_label,table_prc]=ListDiseaseCode( ix ) %UNTITLED6 Summary of this function goes here % Detailed explanation goes here table_prc=0; switch ix case 1 dbname='aplastic_anemia'; list_ICD9=' code LIKE ''284.01'''% OR code LIKE ''284.8%'' OR code L...
function [C_multi_trs, f_multi_trs, P, S_multi_trs] = deconv_multitrs(cs_frtrs, Nnan, YrA, C, f, P, options) %% Ntrs = length(cs_frtrs)-1; method = options.deconv_method; %% Set YrACL ie C2 + YrA % C or C2 YrAC = YrA + C; % add C2 to residual. C2 corresponds to running demo_script with P=0 so no time constants are...
% 05-2012 % Victor Barres % USC Brain Project % Script to create a slab from atlas function data_atlasSlab(varargin) if isempty(varargin) simName = getSimName(); slabName = inputSlabName(); atlasName = getAtlasName(); ansArea = getAreaName(atlasName); areaName = ansArea.areaName; areaIndex = a...
function [Y_extend] = InterpLancoz(Y, N) a = 3; % [-a, a] 지점 관여 x = zeros(2*a,3); % 함수 값을 for문으로 입력하기 위한 배열 설정 len = length(Y); % 정의역 index 최대 값 Y_extend = zeros(1,len*N); % 확장된 Y함...
function adjustment = ros_adjust(forecast, analysis, time, fuel_map, p, w) % adjustment = ros_adjust(forecast, analysis, time) % function returns a rate of spread adjustment factor % inputs: % forecast - tign for forecast % analysis - tign for analysis % time - time step for which comparison between f...
function [X,B]=get_iwcoff(W,B) Sinit = squeeze(W(1,1,:)); X2 = waverec(Sinit,B,'db4'); X = zeros([size(W,1) size(W,2) length(X2)]); for k=1:size(W,1) for h=1:size(W,2) [A]= waverec(squeeze(real(W(k,h,:))),B,'db4'); [C]= waverec(squeeze(imag(W(k,h,:))),B,'db4'); X(k,h,:) =A + 1i...
function [ Lewis_HNO3_exGas ] = Lewis_HNO3( t ) % Computes the Lewis number for nitric acid in exhaust gas Lewis_HNO3_exGas = ... thermalDiffusivity_air(t) / massDiffusivity_HNO3_air(t); end
%% lecture 11 %Goal: Obtain standard error of parameter estimates %Calculation of standard error with secondary parameters. %Linear models are those that have parameters are involved in linear %fashion ... as long as the terms in the model are linear kind of %parameters %Non-linear regression for estimating...
function setRules = getRules(rule, inputSize, outputSize, boolean) if boolean setRules = zeros( size(rule,2), inputSize + outputSize); for i=1: size(rule,2) for j=1:size(rule(i).antecedent, 2) setRules(i, j) = rule(i).antecedent(j); end for j=1:size(rule(i).consequent, 2) ...
clear all; close all; x = -2*pi:0.1:2*pi; y = sin(x); figure(1); plot(x,y); figure(121); plot(y,x);
clc;clear all;close all % Random generator. Hapus bila tidak memiliki preferensi % load('PSO-1.mat') % rng(S) % S=rng; % Generate new random seed. Gunakan ini bila tidak memiliki PSO-1.mat % Parameter model sintetik a=20; xobs=[5:5:45]'; % reciever linear % xobs=[25]; A=1:50; % Parameter pendekatan line...
function u = function3(amp,freq,t) u = amp*sin(freq*2*pi*t); end
function [measure] = con_MSMDA(data,rdm,target,ratio) % MSMDA % normalize target data [Xl,Yl,Xu,Yu] = normN2_target(target,rdm,ratio); Xl = Xl*diag(1./sqrt(sum(Xl.^2))); Xu = Xu*diag(1./sqrt(sum(Xu.^2))); % split training target data Xl into training data Xltr and validation data Xlva nl = length(Yl); nlt =...
% paramsForShowTrajAnalysis2.m % Parameters for function ShowTrajAnalysis2.m: %% PARAMETERS % PARAMETER r: % Number of frames to average over when calculating a frame average in % order to get a Signal Mask to distinguish cell region from background % region. Note it has to be at most equal to the total no. of frame...
function varargout = GUI(varargin) % GUI MATLAB code for GUI.fig % GUI, by itself, creates a new GUI or raises the existing % singleton*. % % H = GUI returns the handle to a new GUI or the handle to % the existing singleton*. % % GUI('CALLBACK',hObject,eventData,handles,...) calls the local % ...
wscalogram("image",tmp2,"xdata",ts); title("Continuous Transform, absolute coefficients"); set(gca,"YDir","reverse") ax = gca; ax.YLim = [60 140]; colormap jet;
function R = getRSE2(g) % returns rotation matrix R = g.R; end
function [sssSSTO] = ssto(High,Low,Close,k,d) % Function to calculate the fast Stochastic [sSTO]= indicators([High,Low,Close],'ssto',k,d); TT=length(High); S=zeros(TT,1); for i=1:TT; if (sSTO(i,1)>80) S(i)=-1; elseif(sSTO(i,1)<20) S(i)=1; else S(i)=0; end sssSSTO=S; end end
function res = CkDot(v) %CKDOT Summary of this function goes here % Detailed explanation goes here if size(v,1)==3 && size(v,2)==3 elseif size(v,1)==3 && size(v,2)==1 else end end
zadnjih6StevkVpisne = [1 5 1 1 3 6]; m = zadnjih6StevkVpisne(1:3); m = 15 + 5 * sin(m); k = zeros(1, 5); for i=1:5 k(i) = max(1, zadnjih6StevkVpisne(i) + zadnjih6StevkVpisne(i+1))/(i+2); end M = diag(m); K = [-k(1)-k(2), k(2), 0; k(2), -k(2)-k(3)-k(4), k(3); 0, k(3), -k(3)-k(5)]; K = -K; % re?ujemo Kx = ...
%% plot gps data in game track % minimize point outside track by offsetting track boundaries clearvars -except offset load('tracks\DTM_ZANDVOORT.mat') load('Z:\JJ_Documents\MATLAB\Laptime simulation\session_zandvoort_laps36-52_20130627_0931_v1.mat', ... 'Xpositionm', 'Ypositionm', 'Lap') ind = zeros(s...
function p = Naivebayes( data, lambda) p = zeros(4,70001); len = length(data); data = data(randperm(end)); count_y = 0; for i = 1:len x = data(i).line; x_len = length(x); x_new = zeros(70000,1); y = x(1); if y ==1 count_y = count_y+1; end if x_len >1 for j = 2...
function uSol = oneStep(uSol, Nc, Nv, A, B, U, V, E, nVars) %ONESTEP Compute solution at t_{n+1} from solution at previous time-steps. % USOL = ONESTEP(USOL, NC, NV, A, B, U, V, E, NVARS) updates the solution USOL % using the coefficients A, B, U, V, and E, and the nonlinear part of the % operator in coeffici...
function [percentage] = evaluate(path_to_testset, w, histogram, count_bins) path_to_testset_cats = strcat(path_to_testset, 'cats/'); x_cats = getImgNames(path_to_testset_cats); [n_cats m_cats] = size(x_cats); path_to_testset_not_cats = strcat(path_to_testset, 'not_cats/'); x_not_cats = getImgNames(path_to_tes...
function init(){ #nested for for(int n = 0; n?<10; n++){ for(int i = 0; i ?< 3; i++){ n++ } } } function render(){ Line l2 = (({0,0} + {0,5})*n) draw(l2); }
function dbBrowser(hdaRootDirectory) % Browse database annotations and detection results. % % Complementary to vbbPlayer. Cannot display video efficiently (use % vbbPlayer for this), but can display detection/evaluation results. Set % internal parameters appropriately (such as results to display, etc.) % % Uses two fun...
function quantization(filename, numLevels) % QUANTIZATION quantizes the file's values to a set number of levels using % uniform quantization % filename : file to be quantized % numLevels : number of levels % ============ NUMBER 1 ============ % Read the speech file, and play at the normal frequency [audioinput, Fs, B...
function ShowBandChol(A,p) % function ShowBandChol(A,p) % Illustrates band cholesky of a positive definite A with bandwidth p. % A call of the form ShowBandChol() will generate a random 6x6 example % with bandwidth 2. if nargin==0 p = 2; G = triu(tril(randn(6,6)),-p); A = G*G'; end G = BandChol(...
function [z] = eradode(a,b,ze,d,Ti,dt,s1,z1,r1) % This function will take as inputs, the initial value of the 3 classes. % It will then apply Eulers method to the problem and churn out a vector of % solutions over a predetermined period of time (the other input). % Function Inputs: s1, z1, r1 - initial value of eac...
%NO TAN BUENO: ES SOLO UN EJP(EL DE TOMASI) %CODIGO DE HAMMING % Codigo Caracter: 100101111001 %Andres Felipe Rendon Rios cod.06991095 %Javier Mesa Durango cod.06991062 clear %bit1=[0 0 0 0 1]; bit2=[0 0 0 1 0]; %bit3=[0 0 0 1 1]; %bit4=[0 0 1 0 0]; %bit5=[0 0 1 0 1]; bit6=[0 0 1 1 0];...
X = randn(1,1000); Yi = filt(X); Y = filt(X(1:41)); Yi1 = zeros; Yi2 = zeros; Yi3 = zeros; Yi4 = zeros; subplot(2,2,1) for i = 1:900 Yi1(i) = Yi(i + 1); end plot(Yi(1:900), Yi1,'.') title('Y(i + 1) vs. Y(i)') xlabel('Y(i)') ylabel('Y(i + 1)') subplot(2,2,2) for i = 1:900 Yi2(i) = Yi(i + 2); end plot(Yi(1:900...
function LL = logLikelihoodDBV(DBV) % Calculate the log likelihood that a looked-up set of data has a value of % deoxygenated blood volume DBV. For use within the FMINBND (or similar) script % only. Will have to have a lot of hard-coded stuff that it looks up. Requires % qASE_model.m % % MT Cherukara % 2018-10-02 % de...
clearvars -except ti %% Initialize variables. filename = '..\lists\ratings.list'; startRow = 282; endRow = 664918; %% New | Distribution | Votes | Rating | Title formatSpec = '%6s%10s%10s%6s%s%[^\n\r]'; disp('Opening file'); %% Open the text file. fileID = fopen(filename,'r'); textscan(fileID, '%[^\n\r]', startRow-1...
% This script will write the program input and output to a text file called % 'report_projectName.txt' % -- INPUT fname = strcat('report_',name,'.txt'); fid = fopen(fname,'w'); %create new file to write data to. product = ver('matlab'); fprintf(fid,'Project Title: %s\n',name); t = isunix; if t == 1 fprintf(fid,'U...
addpath data_gen addpath submission-stubs data_stdize %A = [1, 2, 3, 4; 4, 5, 5, 4; 8, 8.2, -2, 3] tic stdize(X); toc
function rate = getFIRA_binRate(trials, spikei, rate_begin, rate_end, rate_wrt, bins) % Compute spike rate for each trial TRIALS for each bin in BINS. % function rate = getFIRA_rateBined(trials, spikei, rate_begin, rate_end, rate_wrt, bins)% % % INPUTS: % trials : selection array for trials % spikei : s...