text
stringlengths
8
6.12M
% Mat l ab Program <Exl 0_l . m> % Thi s Matlab exerc i s e <Exl 0_l . m> performs s imulation of % binary baseband polar transmi s s i on in AWGN channe l . % The program generates polar baseband signa l s us ing 3 di f ferent % pul s e shapes ( root - raised cos ine ( r= 0 . 5 ) , rectangular , hal f - s ine ) % and ...
function finalTS = makeTrialStructure % this array describes the structure/proportion of basic and reverse across the stages % of the experiment. By using 8 to 2 ratio, we control where the reversal % trials pop up. They occur 8 times in every 40. stg2 = repmat([8 2],2,1); % rather than type 8 2 lots of times! B...
%% Impact is an impedance matching GUI % % The GUI is generated primarily with the MUI package. There are three % menus: Add Curve, Analysis, and Plot. % % In addition to the AV_Iterationmenu bar, two toolbars are available. % The one next to the help toolbar is 'Selected Signals' and is a shortcut % to the '...
function [ ] = ex33( ) imc = imread('loro.png'); img = rgb2gray(imc); [n m] = size(img); X = ones(n*m, 3); for i=1:n X((i-1)*m+1:m*i,1) = i; X((i-1)*m+1:m*i,2) = 1:m; end for i=1:n*m a = X(i,:); X(a(2),a(1)) = a(3); end %e = reshape(img, n*m, 1); %X(:,3) = e; %k = 18 %[idx,c]= kmeans(X,k); %idx = resh...
k = 20; increment = 1 / (k + 1); best_regularizer; best_avg = Inf; reg_pts = zeros(1, k); loglike_pts = zeros(1, k); trainerr_pts = zeros(1, k); testerr_pts = zeros(1, k); i = 1; for regularizer=increment:increment:1-increment reg_pts(i) = regularizer; cur_best_avg = Inf; cur_best_ll = 0; cur_best_trainerr = ...
%Scratchpad close all clear all clc % TSM = 0.1; % ak = rand(10,1); % a = 1/TSM; % % old_points = (1:length(ak))-1; %-1 to 0 index % new_points = round(a*old_points)+1; %+1 to 1 index % % ak_hat = zeros(1,ceil(length(ak)*a)); % ak_hat(new_points) = ak(old_points+1); % % count = 0; % for n = 1:length(ak_hat) % i...
clear,load W x1_R = {'TETCB';'TETXB'};x1_R = replace(x1_R); %x1:终端消费/总消费(能源利用率) x2_R = {'REPRB';'NGMPB'};x2_R = replace(x2_R); %x2:清洁能源和可再生能源的生产量 x4_R = {'LGTCB';'RETCB';'NGTCB';'NUETB'};x4_R = replace(x4_R); %x4:清洁能源和可再生能源的消耗量 x6_R = {'TEPRB'};x6_R = replace(x6_R); %x6:总能源的生产量 x7_R = {'TPOPP'};x7...
% % function: data association between local map and global map % % input: globalmap, local map % % output: match_matrix % % last modified: 24/09/2009, Shoudong function DoGlobalDataAssociation global Params; global Match; global Est; % disp(' *** entering DoGlobalDataAssociation'); % to record the...
% % created January 21, 2016 by Patrick Knapp (Sandia National Laboratories) % function varargout=report(object,varargin) Narg=numel(varargin) + 1; assert(Narg>1,'Error: report takes at least 2 NTOF objects as input') %% create figure with three subplots figure('Units','Inches','Position',[4,6,14,6],'Color','w',... ...
function nnDistance = nnDistDistributionSelectFrame(ptloc1, ptloc2, frames, pixelsize) % Number of organelle types to be analyzed: 1 % Input: % (1) ptloc1 and ptloc2: two 1 x n structure with a field xy containing point positions and n = % frame numbers % (2) frames: frame indices % (3) pixelsize: unit: micrometer %...
function Sim20 %% Reset close all clear %% Load data load('GroupsWOAisles.mat'); %% Set names simName = '20 Groups without aisles, 10 min delay'; folderName = 'Sim20'; %% Set conditions [Sim.Luminaires.View] = deal('narrow'); [Sim.Zones.DimAfter] = deal(duration(0,10,0)); [Sim.Zones.OffAfter] = deal(duration(0,10,0...
% Simulates t time steps and returns a length(i0)-by-t+1 state matrix where % column i is the state at time t = i. % G :: graph object % i0 :: initial state vector % f_i :: function :: n -> i, where n is a vector indicating the infectious % degree (number of infectious nodes connected to each node, and ...
%%Generates track curve and estimates normal force experienced along track. %%Constants g = 9.81; %gravitational constant, m/s^2 m_cart = 100; %cart + rider mass, kg h_start = 6.7056; %Ramp starting height, m l_end = 32; %Track length %Track Geometry Constants b = .055; %1/dampi...
%a = dec2bin('divyansh') %r = reshape(a,1,56) %transpose(r) clc; i =imread('abc.jpg'); im = rgb2gray(i); row=size(im,1); col=size(im,2); s=zeros(row,col,8); for k=1:8 for i=1:row for j=1:col s(i,j,k) = bitget(im(i,j),k); end end end a = dec2bin('divyansh') r = reshape(a,1,56) s1 ...
classdef Test_ReportingDirector < matlab.unittest.TestCase %% TEST_REPORTINGDIRECTOR % Usage: >> results = run(mlarbelaez_unittest.Test_ReportingDirector) % >> result = run(mlarbelaez_unittest.Test_ReportingDirector, 'test_dt') % See also: file:///Applications/Developer/MATLAB_R2014b.app/help/matl...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %this script is for analyze the feature %and visualization %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% id = input('Please input the subject id you want to analyze:'); % id = str2int(id); s1016 = ['num_fea = length(f.f',num2str(id),'(:,1));']; eval(s1016); % num_fea = length(f.f.f...
data=load('E:\IIT KGP\ML Project\datasets\CIFAR10_matlab\data_batch_1'); x=data.data; labels=data.labels; n=size(x,1); for j=1:n l=labels(j) y=x(j,:); r=y(:,[1:1024]); g=y(:,[1025:2048]); b=y(:,[2049:3072]); finalr=[]; finalg=[]; finalb=[]; c=1; for i=1:32 ...
function portList=scanForGPS() % SCANFORGPS Scans communication ports for GPS receiver. It further % checks what is sent through serial port in order to determine if they % are correct NMEA sentences. % % Examples: % 1) portList=scanForGPS() % % Serial Port Object : Serial-/dev/ttyUSB0 % % Communica...
clear all clc; path1 = 'F:\Study\UnderGrad\Graduation Design\Data\heiti201709baitian\2017\09\0907\dn\'; path2 = '20170907-113555F_1000_674_0.tiff'; filepath = fullfile(path1,path2); % filepath='F:\Study\UnderGrad\Graduation Design\Data\heiti201709baitian\2017\09\0902\dn\20170902-143155F_2000_675_0.tiff'; ...
%goes through all fixed points in zs and picks out only the ev that %are b/w 1 and -1 : max|eig(A+W.*D)| < 1 -----> these are the stable fixed points! %then plots all eigen values for the identified fixed points function ev_plot() clear all; close all; clc path = '/zifnas/polina.litvak/output/09/triton_...
clear close all clc % before loading data, need to make sure it looks okay in the Matlab text % editor. Unicode (UTF-8), Unix LF, and get rid of funck characters at the % beginning of the file data = load('~/Dropbox/Data/DSC/PlayDSC.dat'); time_min = data(:,1); temp_C = data(:,2); heatFlow_mW = data(:,3); %%%%%%%%%...
function gradient_machine_textfile(GR,varargin) %% Experimental gradient waveform machine template % Input is 2D matrix with size [time-points 3]. % 3 represents the X/Y/Z gradients. % dt = 1 us and values should be in T/m (SI-units) % % Function will create the output textfile of name/location=varargin. % T.Bruijnen @...
function P = guipoints % Input 2D points from user interactively. % Copyright 2010 Levente Hunyadi fig = figure; ax = axes( ... 'Parent', fig, ... 'XLimMode', 'manual', ... 'YLimMode', 'manual'); x = []; y = []; ctrl = line(-1, -1, ... 'Parent', ax, ... 'LineStyle', 'none', ... 'Marker', 'x');...
function [u] = fftBC(v, a, b) N=length(v); n=(0:N-1)'; phi=atan2(a,b*n); v1=bsxfun(@times, exp( 1i*phi)/2, v); v2=bsxfun(@times, exp(-1i*phi)/2, v); u=fft([v(1,:); v1(2:end,:); zeros(1,size(v,2)); v2(end:-1:2,:)]); u=u(1:N,:); end
clear; x_lat=0:5e-3:pi/2; x_lon=0:5e-3:pi; grad_sym=1; lon_deg = [ 22 37 23; 22 30 47; 22 44 00]; lat_deg = [ 52 45 54; 52 40 27; 52 43 37]; dist = [4; 13.4; 4.1]; point_num=3; lon_rad = zeros(point_num,1); lat_rad = zeros(point_num,1); f...
%--plot Freq % clear % clc % data_path='/Users/hcq/workspace/MCS/data/'; % data_name = 'size_global_exp3.txt'; % data_name0 = 'size_sea_exp3.txt'; % data_name1 = 'size_land_exp3.txt'; % tmp =load (fullfile(data_path, data_name)); % tmp0 =load (fullfile(data_path, data_name0)); % tmp1 =load (fullfile(data_path, data_na...
%week4 %calculate MSE between 2 matrices %X=[1 1 2 2; 1 1 2 2; 2 2 3 4; 2 2 5 6] %Y = [2 2 1 1; 2 2 2 2; 2 2 6 4; 2 2 5 3] %distxy=abs(X-Y).^2 %msexy=sum(distxy(:)/numel(X)) %msexy = % % ALWAYS CLEAR WORKSPACE BEFORE RUNNING ELSE GET INCORRCT RESULTS WO ERROR % MSG or get ERROR MSG which is not debuggable. % % 1...
function [ mask ] = getMask( ann, imgSize ) w = imgSize(1); h = imgSize(2); R = MaskApi.frPoly(ann.segmentation,w,h); mask = MaskApi.decode(R); % Conform to matconvnet expectations mask = single(mask); mask(mask == 0) = -1; end
function X = pa_fart_levelramp(X, N) % PA_FART_LEVELRAMP(X) % % Adds 20 ms of zeros to start and end of a sound signal. This is required % because of a peculiarity of the hoop/sound localization setup: the sound % level is controlled by the second DA output of the RP2.1, and to prevent % a strong onset pulse of the spe...
clear; load AR_part.mat; load ratel.mat; % for k=1:15 for t=0:6 X_trn1=cell(100,1); X_tst1=cell(600,1); X_trn2=cell(100,1); X_tst2=cell(600,1); Y_trn1=zeros(100,1); Y_tst1=zeros(600,1); Y_trn2=zeros(100,1); Y_tst2=zeros(600,1); count1=1; count2=1; for i=1:700 if(rem(i,7)==t) X_trn1{count1}=imresize(X1{i},[1...
clear all; num=input('请输入数值:') if num>=0 disp('显示所输入的数值:') num end
function [ Xtrain, Xtest, dtrain, dtest ] = leaveoneout( X,d,f,subject ) nImages = length(d); trainIndexes = zeros(nImages,1); testIndexes = zeros(nImages,1); j = 0; for i=1:nImages if f(i) == subject j = j + 1; testIndexes(j) = i; else trainIndexes(i-j) = i; end end trainIndexes = ...
function res = outliers(d) % One of attempts to remove outliers. But frankly, I don't like this code z = 3; meanM = mean(d); sigmaM = std(d); meanMat = repmat(meanM,size(d,1),1); sigmaMat = repmat(sigmaM,size(d,1),1); Ceil = meanMat + z * sigmaMat; Floor = meanMat - z * sigmaMat; d((d - meanMat...
% script for plotting results %% 1 - 28 boxplot of median ranging over all parameters. % boxes are learning permutations with diffusion, red is no diffusion % without permutation, blue is diffused without permutation % First, boxplot for permutations with diffusion % diff_rate = 10; permuteSeed_3day = [1 2 3 4 5 6 1...
function ak=FK_ak(a,b,k) h=pi/1000; x=0:h:2*pi; % y selbst einfuegen (zweiter teil nach ak) % ./ und .* beachten (da zwei Matrizen) y=(1/pi)*(a+b*x)./(1+x).*cos(k*x); ak=h*((y(1)+y(end))/2+sum(y)-y(1)-y(end)); if k==0 ak=ak/2; end
clear; clc; close all; alpha = 1; % diffusion coefficient ( mass / thermal diffusivity ) epsilon = 0; % convection coefficient fw = 0; % 1 for fw diff (explicit) || 0 for bw diff (implicit) n = 9; % number of unknowns on x x0 = 0; x1 = 1; h = (x1-x0)/(n+1); % mesh size x = x0+(0:n+1)'*h; % domain in...
% slower than one_per_n02 function out = one_per_n(x) c = 1; n = 1; out = []; for ii = 2:1e5 if c > 1e4 out = -1; elseif n >= x out = c; break; end n = n + 1/ii; c = 1 + c; end end
clear, close all %% Task 8 - MapReduce %Reads in data ds=tabularTextDatastore('nuclear_plants_big_dataset.csv', 'TreatAsMissing','NA','MissingValue',0); ds.SelectedVariableNames='Power_range_sensor_1'; %Functions calls fun1a=@mapsum_mean; fun1b=@redsum_mean; %Get sum and mean values outds1=mapreduce(ds, ...
function []=show_everything(sp,mirrorCenterR,mirrorCenterL,img,fc) figure; [x,y,z]=sphere(30); r_m=5; r_eyeball=7.8; %camera pupil X=x*2*r_m; Y=y*2*r_m; Z=z*2*r_m; mesh(X,Y,Z); text(0,0,0, ' Camera Pupil') %eyeball L X=x*r_eyeball+mirrorCenterL(1); Y=y*r_eyeball+mirrorCenterL(2); Z=z*r_eyeball+mirrorCenterL(3); hold ...
function [theta, mu, sigma] = train(data) end_data = length(data(1,:)); X = data(:, 1:end_data-1); y = data(:, end_data); m = length(y); % Normalizing data... X_norm = X; mu = zeros(1, size(X, 2)); sigma = zeros(1, size(X, 2)); mu = mean(X); sigma = std(X); X_norm = (X-mu)./sigma; X = X_norm; ...
%Bsed on the exponential decay, remove the background by randomly select %detected photon with specific dtime. %% fn={'2d3d','3d1d'}; rn={'2d3d10','3d1d13'}; for fi = 1:length(fn) clearvars -except fn rn fi filefolder=['E:\F8Se2 July\08172020\apd rBG\',fn{1,fi}]; cd(filefolder) names=struct2cell(dir([fn{1,fi},'*.mat'])...
clear all ;close all ; subs = {'alex','charest','esteban','fabio','gab','gabriella','genevieve','gina','guillaume','jeremie','julie','katrine','lisa','marc',... 'marie','mathieu','maxime','mingham','patricia','po','russell','sunachakan','tah','vincent'} ; amps = zeros(24,6,3,64,50,130); stds = zeros(24,6,3,6...
function [MAP] = calcMAP(neighbourH, neighbourTest) [num_data, num_dim] = size(neighbourTest); cntOnes = ones(1, num_dim); cntOnes = cumsum(cntOnes); MAP = 0; succNum = 0; for i = 1:num_data neighbour_id = neighbourH(i, :); isNeighbour = neighbourTest(i, neighbour_id); cntNeighbour = cumsum(isNeighbour); ...
function Ei400_uvw111_at200TPmod2Peaks(varargin) root = fileparts(pwd); data_source= fullfile(root ,'sqw','Data','Fe_ei401.sqw'); bragg = [2,0,0]; dE = 10; dK = 0.1; pefP1= [-0.43,-0.125,0,0.125,0.48; 205,30,0,20,245]; pefP2 = [-0.38,-0.125,0,0.125,0.52; 200,30,0,25,240]; pefP3 = [-0.38,-0.14,0,0.18,0.48; ...
function [output, stpEvt] = is_stop_event(key_pressed,key_desired) %key_pressed should be a valid keycode (see the BbCheck function) %key_desired should be a string in MacStim format %output a a boolean variable that indicates whether a stop event has %occurred, while stpEvt holds the key that caused the event. %k\ ma...
clear all, close all, clc addpath('build_mats') %--get data matrix X and subtract mean load('datamat.mat') X = Xbg; parms.Kb = 0.35; parms.M_rho = 0.5; parms.Ke = 1000; %Subtract mean: Xtil = X; mean_X = mean( X, 2 ); for j = 1 : length(parms.tvect) Xtil(:,j) = X...
% pulrecsig.m: create pulse shaped received signal clear; N=10000; M=19; Ts=.000101; % # symbols, oversampling factor time=Ts*N*M; t=Ts:Ts:time; % sampling interval & time vector m=pam(N,4,5); % 4-level signal of length N mup=zeros(1,N*M); mup(1:M:N*M)=m; % oversample by integer length ...
function T = tempprefix(D); % TEMPPREFIX returns a unique name prefix, starting with the given directory % suitable for use as a prefix for temporary files. % % T = tempprefix(D) % T = tempprefix() same as above but uses builtin tempdir as D % % Inputs: % D name of directory to find prefix % Out...
function y = de2bimod(x,n) xtemp = x; dv = [128 64 32 16 8 4 2 1]; out = zeros(1,n); for i = 1:n if xtemp>=dv(i) out((n+1)-i) = 1; xtemp = xtemp - dv(i); end end y = out; end
% This code implements the model in equation (7) % and analyzes the total variation (tv) and average ratings (avg). % Finally plots the average of tv and avg over monte carlo realizations. clear; clc; close all N_N = 100; % number of experiments m = 70; % Number of prompts tv = zeros(N_N,m); % collects total variations...
function [ labels ] = classify_svm( svm_model, data, varargin ) %CLASSIFY_SVM Classifies a given data set using a trained MATLAB SVM %implementation. % Receives the trained MATLAB SVM model in the first parameter, % "svm_model". % The training data is stored in the variable "data.X", a m-by-n matrix % where n i...
%Numerical differentiation %Jared Rivera %804603106 clear all; close all; clc; %set x-domain x=linspace(-5,5,100); domainlength=length(x); %set h-domain harray=logspace(-15,-1,50); harraylength=length(harray); exactd=dfx_exact(x); %Set up error arrays errorforward=zeros(1, harraylength); errorbackward=zeros(1, harr...
function measinit(sysflag,X0) global Ts Tnext t t0 global Xs timer=[0 0 0 3600 60 1]'; if sysflag==0, das_wri1(2,49); das_wri1(11,0); t=clock*timer; t0=t; Tnext=t; disp('Measurement system started') else Xs=X0; t=0; t0=t; Tnext=t; end
function h = plot_gp_CV_rois_helper_boxcharts(fs, test_type, statistic, regressor_names, roi_names, null_value, cmap, significant_scale, regressors_to_compare, font_scale, outliers) sem = @(x) std(x) / sqrt(length(x)); nROIs = size(fs, 1); nregressors = size(fs, 2); nsubjects = size(fs, 3); if ~ex...
function gb = gabor_kernel(dimensions, lambda, theta, psi, sigma, gamma) sigma = lambda/pi*sqrt(log(2)/2)*(2^sigma+1)/(2^sigma-1); sigma_x = sigma; sigma_y = sigma / gamma; [x, y] = meshgrid(-fix(dimensions / 2) : fix(dimensions / 2), fix(-dimensions / 2) : 1 : fix(dimensions / 2)); x_theta = x * cos(theta*p...
function g = sigmoid(z) %SIGMOID Compute sigmoid function % g = SIGMOID(z) computes the sigmoid of z. % You need to return the following variables correctly g = zeros(size(z)); % ====================== YOUR CODE HERE ====================== % Instructions: Compute the sigmoid of each value of z (z can be a matrix, ...
function [ Ptool_F, af67_F, S6_F ] = Forward_puma( S6, Ptool_6, phi1, th2, th3, th4, th5, th6 ) %This function calculate the forward puma problem a=[0 17 0.8 0 0]; %define a12-a56? a(1) represent a12 af=[0.5*pi 0 1.5*pi 0.5*pi 0.5*pi]; %define af12-af56, af(1) represent af12 S=[0 5.9 0 17 0 S6]; %define S...
function [m_CO2, y_CO2] = DuanSun(T, p, m_salt) % This function solves the Duan-Sun model to calculate the solubility of % CO2 in water and in the brine and the mole fraction of CO2 in the gas phase % T is the temperature in [K] % p is the pressure in [Pa] % m is the salt molality in [mol/kg] % Copyright (c) 2012-2016 ...
function [hi] = hamperl(dfft,wind) h = zeros(size(dfft)); halfsies = ceil(length(dfft)/2); std_mult = 1; %figure; hold on %loglog(abs(dfft),'k') for i = 1:halfsies h(i) = dfft(i); if i > floor(wind/2) if i > (halfsies-floor(wind/2)) rr = dfft(halfsies...
classdef QuadraticLayer < nnet.layer.Layer % QUADRATIC % y = [x^2 x*u u^2]' % Copyright 2018 The MathWorks, Inc. % Revised: 10-30-2018 % Copyright 2018 The MathWorks, Inc. % check with: % quad = rl.layer.QuadraticLayer('Name','quad') % checkLayer(quad,[15 1],'ObservationDimension',4) % checkLayer(quad,[1 1 15]...
function [time3D, cPkt3D] = p2( B, M, P, needPrint ) % p2, simulate packet arrivals, and display the procedure if needed. % % B, M, P should be 1*n vectors; B -> bandwidths(Mbps), M -> message % sizes(MB), P -> packet sizes(MB), needPrint -> 1 for displaying procedure; % % if the size of last packet in a message is les...
function [num_dis] = dis_his(data,num) %UNTITLED6 此处显示有关此函数的摘要 % 此处显示详细说明 x = [data.dis,double(data.height)]; num_dis = zeros(length(data.dis),1); for i = 1:length(data.dis) if (i-num*100/2)<=0 boud = 1:num*100; elseif i+num*100/2>=length(data.dis) boud = (length(data.dis)-num*100):length(data...
function [fr, failitems] = readh5file(fnm, items) % @author M.Moriche % @date Created 06-06-13 by M.Moriche % @date Modified 07-06-13 by M.Moriche % @date 07-06-13 by M.Moriche % added extra arguments in H5D.read % @date 22-07-13 by M.Moriche % added error handling and failitems as output % @date 13-12-13 b...
function l while gcf > 1 delete(gcf) end delete(1)
%% Data analysis for [20180114, 141953] (97b551b) Params1 = linspace(0, 200, 41) * 1e-6; Params2 = linspace(4, 160, 40) * 1e-6; Params3 = linspace(6, 240, 40) * 1e-6; clear o; o(1).Params = Params1; o(1).ParamName = 'TNaRaman1 '; o(1).ParamUnits = 'us'; o(1).PlotScale = 1e-6; o(2).Params = Params2; o(3).Params = Pa...
close all; clear all;clearvars; close all; clc; folder = 'J:\WeiLabHD\recordings\NewRig\20190305'; moviefiles = dir([folder '\*.zip']); cell_area = 0; pixel_xcorr = input('Pixel Cross-Correlation Analysis (For XCorr Bkg must be substracted)?\n'); smoothing = input('Smoothing?\n'); unmixing = input('Unmi...
function [full_code_img,dict_codes]=encodingth(image,quality) grayimage=image(9:288,9:288); fun=@(block_struct) dct2(block_struct.data); I2=blockproc(grayimage,[8,8], fun) %figure; imshow(I2,[]); title('DCT Image') % To get the DCT image uncomment this % Standard Quantization Matrix q_mtx = ...
function [model, Fold] = TrainSparseMGP2(y, x, options) addpath(genpath('../toolbox'),'../globalkern','../utils','../ftcmgp'); options.gamma = exp(-2); options.kern.isVarS = options.isVarS; options.kern.isArd = false; options.nout = size(y,1); ndim = size(x{1},2); if ndim>1, options.initialInducingPositionMethod...
% Function to define FEM type lists using FEM object metadata % Anthony Ricciardi % function obj = typeLists(obj) %% extract object metadata mObj = metaclass(obj); %% loop through properties for i = 1:size(mObj.PropertyList,1) % isa entry eval(['bool=isa(obj.',mObj.PropertyList(i).Name,',''entry...
load('data_v1-90degree_phase_pos_seq.mat') id1=Module1{1}.Values.Data(:); id2=Module2{1}.Values.Data; tout=Module2{1}.Values.time; %% Fs=1/(tout(2)-tout(1)); L=length(tout); y1_raw=fft(id1); y2_raw=fft(id2); %% y1 = abs(y1_raw/L); y1 = y1(1:L/2+1); y1(2:end-1) = 2*y1(2:end-1); y1_ang = angle(y1_raw/L); ...
function tr = setup1(net) % Copyright 2010 The MathWorks, Inc. tr.trainFcn = net.trainFcn; tr.trainParam = net.trainParam; tr.performFcn = net.performFcn; tr.performParam = net.performParam; tr.derivFcn = net.derivFcn; tr.divideFcn = net.divideFcn; tr.divideMode = net.divideMode; tr.divideParam = net....
% MA 3457 / CS 4033 (B-Term 2018) % Student: Vandana Anand % Problem 2A format long %% Part AA disp("Part AA") %set up the matrix with the 6 equations and 6 unknown variables %Note: %x1, x2, x3 are c1, c2, c3 %x3, x4, x5 are x1, x2, x3 F=@(x) [x(1)+x(2)+x(3)-2; ... x(1)*x(4)+x(2)*x(5)+x(3)*x(6); ... x(1)*pow...
function [] = mypoint(p, color) if (length(p) == 3) scatter3(p(1), p(2), p(3), 8, color, 'o', 'filled'); end if (length(p) == 2) scatter(p(1), p(2), 15, color, 'o', 'filled'); end
function A = assemble_matrix_volume_in_2D(matrix_size, coef, mesh, FE, der_trial_x,der_trial_y,der_test_x,der_test_y, time) %矩阵组装器,需要输入系数函数,矩阵大小,P,T,Tb矩阵,试探函数的基函数类型及对x,y的导数阶,测试函数的基函数类型及导数阶 A = zeros(matrix_size(1),matrix_size(2)); P = mesh.P; T = mesh.T; Tb = FE.Tb; number_of_elements=size(T,2);%得到单...
function [ binDataMat ] = binDataUnequalBy( dataMat, binNumber, binDim, fun ) % This function bins a matrix along the dim dimension in nBin % Warning: this could lead to bins of different size, arbitrary splitted sizeMat=size(dataMat); if nargin < 4 fun = @mean; end if nargin < 3 binDim = find (sizeMat > 1, ...
function Sol = iMATAO(model,Zopt,rxn_exp,coreset,eps,samplesize,FVArange,deltamax) %*********************iMAT Alternative Optima Sampling********************* %************************************************************************** %This function implements the iMAT alternative optima sampling method. The %o...
%% Set paths to other GEMINI repos cwd = fileparts(mfilename('fullpath')); gemini_root = [cwd, filesep, '../../../GEMINI']; addpath([gemini_root, filesep, 'script_utils']) addpath([gemini_root, filesep, 'setup/gridgen']) addpath([gemini_root, filesep, '../GEMINI-scripts/setup/gridgen']) addpath([gemini_root, filesep, '...
% Lab 4 - AA - Naive Bayes Classifiers % 81013 - 81398 % Tuesday, Group 2 % % 2. A simple example - Naive Bayes Classifier % Bayes classifier works by selecting the class i % that has maximum probability P(Ci|x), given a observation x % % By Bayes Law: P(Ci|x) = (P(x|Ci)*P(Ci))/P(x) % P(x|Ci) = distribution o...
clc; close all; clear all; delta = 0.9; ti = 60; kp = 1/delta; ki = 0;%1/(delta*ti); K = 2; T = 40; dt = 1; st = 1200; lp = fix(st/dt); a=exp(-dt/T); b = 1-a; r=1; x(1:3)=0; ui = 0; y = [0]; t = [0]; for i=1:lp e = r-x(3); up = kp*e; ui = ui + ki*e*dt; u = up+ui; ux = u + r/K...
function amp = four(img) % four % % Fourier transform analysis of skin pictures % img pixmap containing the image to analyse global goose frame = goose.current.iFrame; L = goose.set.visual.imgLen; Lm = goose.current.imgLenMax; %Marker (green channel) sel = img(1:50,(end-50):end, 2); %right-upper window, g...
function imageOut = setImageLevels(imageIn) fig = figure('Visible','off','Position',[400,200,800,600]); imgBox1 = axes('Parent',fig,'Position',[.15 .15 .7 .7]); end
%% this function is to get the best performance tran Prob sequence % input: Metrics, rowname_ind, tranProb_value % output: the value, and the tran Prob sequence which has the value function [best_mat] = findbest(Metrics, rowname_ind, tranProb_value) % preallocate best_mat = cell(length(rowname_ind),3); Met...
function y=fun(c,x) %funcion definida por la que se va a justar global grafica y=c(1)*x+c(2)*exp(-c(3)*x); set (grafica,'ydata',y);%para ir ajustando la grafica respecto de la aproximacion pause(.05) end
function [g bv lv]=Gap(v) % GAP computes the gap function from game v. % % Usage: [g bv lv]=Gap(v) % Define variables: % output: % g -- The gap function of game v. A vector of length 2^n-1. % bv -- The upper vector/payoff of game v. % lv -- The lower/concession vector of game v. % % input: % v ...
function plot_nodes(nodefile, facefile) % Figure hf = figure(1); set(hf, 'Position', [100 100 600 600]); % Plot nodes nodes = load(nodefile); %plot3(nodes(:,1), nodes(:,2), nodes(:,3), 'k.'); hold on; %nn = size(nodes,1); %plot3(nodes(83:nn,1), nodes(83:nn,2), nodes(83:nn,3), 'r.'); gix=[]+1; for i=1:length(gix) ...
% ---------------------------------------------------- % SLAB 2017 REU % Written by: Hridu Jain % Date: August 24, 2017 % ---------------------------------------------------- clc clear all % close all X = load('constants.mat'); jd_start = datenum(2017, 08, 01, 00, 00, 00) + 1721058.5; %jd_end = datenum(2017, 08, ...
clear all; clc; close all; %addpath('../data'); %addpath('methods/'); addpath 'C:\Users\willf\Pictures\blinks\72cm.seated.light.move' video = VideoReader('1280x720.mp4'); method = exmethods.CountPixelsMethod(); FRAMES_PER_SECOND = 25; bd = BlinkDetector(FRAMES_PER_SECOND); bd.setExtractorMethod(method...
function [ DBN ] = init_DBN( config ) nb_couches=length(config)-1; for k=1:nb_couches DBN{k}=init_RBM(config(k),config(k+1)); end end
function kickstart(folder, pull) if nargin <2, pull = true; end if pull ft.update(folder) end addpath(folder) ft_defaults;
%generate distribution figures for Appendix B % from Parameter Estimation and Inverse Problems, 3rd edition, 2018 % by R. Aster, B. Borchers, C. Thurber clear figure(1) clf bookfonts x=-0.5:0.01:1.5; f_U=zeros(length(x)); ind=find(x>=0 & x <=1); f_U(ind)=1; plot(x,f_U,'k') xlabel('x') ylabel('f_U (x)') ylim([0 1.2]) pr...
clear;clc;close all; n=0:200; M=100; % Size of window w1 = 0.05*pi; w2 = 0.20*pi; w3 = 0.35*pi; wa = 0.15*pi; wb = 0.25*pi; s = sin(w2*n); %signal v1 = sin(w1*n); %Noise part 1 v2 = sin(w3*n); %Noise part 2 v = v1+v2; % Total Noise x = s+v; % Polluted signal x(n) w = 0.54 - 0.46.*cos((2*pi).*n/M); % Window Function ...
function R = romberg(f, a, b, n) %Romberg's Method R = zeros(n); h = b-a; R(1,1) = [feval(f, a)+feval(f,b)] * h / 2; for i =1:n-1 R(i+1, 1) = R(i,1)/2; h = h/2; k = [1:2^(i-1)]; R(i+1, 1) = R(i+1, 1) + h*sum(feval(f, a+(2.*k-1).*h)); end for j = 2:n ...
%Using SimpleFixedPoint Locate the root of a equation %Md. Khirul Alam %25/5/2016 syms x; f=(-6*x^3+5*x^2+2)/7;%Equation 6x^2-5x^2-7x-2=0 xnew=1; for k=1:10 xold=xnew; xnew=subs(f,xold); error=abs(xnew-xold)/xnew*100; disp([k xnew error]) end
% function [S_bar] = predict(S,u,R) % This function should perform the prediction step of MCL % Inputs: % S(t-1) 3XM % R 2x2 % % Outputs: % S_bar(t) 4XM function [S_bar] = Predict_rand(S,R,x,y,particle_size) %Number of particles N = siz...
function info = info_type_inpaint(type,N,k,eps_rel_k,time) % % Type-like definitions for TVinpaint to be used with mxTV software % info_type = struct('STATUS',{'EPSILON-OPTIMAL-SOLUTION',... 'NOT-EPSILON-OPTIMAL-SOLUTION',... 'MAXIMUM-NUMBER-OF-ITERATIONS-EXCEEDED'},... 'NINPAINT',{N},'...
%load('C:\Analysis\Data\Results_0'); %Obj = Real_Payoffs; Obj = Sim_Payoffs; Size = size(Obj); I = Size(4); Eff_Sample_Size = zeros(Size(1),Size(2),Size(3)); for k1 = 1:Size(1) for k2 = 1:Size(2) for k3 = 1:Size(3) Eff_Sample_Size(k1,...
function [ dlogf dlogn dlogv alpha interpMeans] = calculateRates(data, data2, N, data1ssc) %UNTITLED Summary of this function goes here % Detailed explanation goes here data = reshapeTimeCourse(data); data2 = reshapeTimeCourse(data2); eventRate = reshapeTimeCourse(N); data1ssc = reshapeTimeCourse(data1ssc); means =...
function r = shuffle(n, seed) % https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle lcg = LCG(seed); m = 1:n; for i=n:-1:2 j = floor(lcg.rand()*i)+1; t = m(i); m(i) = m(j); m(j) = t; end r = m; end
clear; clc; % initialize 1D array to store sinuisoid window of 4096 discrete points. x = zeros(1, 4096); %y(m) = b0 + b1*x(m-1) + b2*x(m-2) + b3*x(m-3) + b4*x(m-4) %% finding b value b0 = mod(1,2) + 1; %2 b1 = mod(2,3) + 1; %3 b2 = mod(3,4) + 1; %4 b3 = mod(5,5) + 1; %1 b4 = mod(0,6) + 1; %1 %% Transfer fu...
function res = ddif_fun(f, x) % 求函数数值二阶导 e = 0.0001; left = diff([f(x-e), f(x)])/e; right = diff([f(x), f(x+e)])/e; res = diff([left, right])/e; end