text
stringlengths
8
6.12M
function NmlNum = getNmlNum(handle1, handle2) Num = getNum(handle1, handle2); if strcmp(get(handle2, 'Userdata'), 'OK') if Num >= 0 && Num <= 1 NmlNum = Num; return; end mywarndlg('The value needs to be in the range of 0~1!'); twinkle(handle1); set(handle2, 'Userdata', 'WRONG'); end...
tic for i = 1:100 getAllValid(b,1); end toc %% n = 8; coord = [3 5] a = magic(n); a = reshape(1:64,[8 8])' % Emitting from the coord in question % 2 horz, 2 vert, 2\diag, 2/diag rays = cell(8,1); % Vertical rays{1} = flipud(a(1:coord(2)-1,coord(1))); rays{2} = a(coord(2)+1:end,coo...
function [objvalue, ptr, per] = calobjvalue(pop, piecetime,equsize) % 计算目标函数值 % pop input 种群 % piecetime input 工件加工时间 % equsize input 每个工序设备数量 % objvalue output 目标函数值(加工时间) % ptr output 工件加工时间记录,cell % per output 工件加工设备记录,cell [popsize, piecesize] = size(pop); prosize = size(eq...
classdef LinearDynamicalSystem < ProbDist % A discrete time, stochastic, (switching) linear dynamical system % (state space model), with Gaussian noise. properties % Let z(t) denote the hidden state at time t and y(t) the % observation at time t. If specifed, x(t) denotes an additional ...
%% ScreenBasedMonocularCalibration % % Provides methods and properties for managing monocular and bi-monocular calibrations for screen based eye trackers. % This type of calibration is not supported by all eye trackers. Check the DeviceCapabilities of the eye tracker first! % % calib = ScreenBasedMonocularCalibr...
%Name:Muhammad Zubair SC %Title: Automatic Sound Reconigtion System function m = mfcc_program_mean(audp, fs) N=length(audp); preEmph=2* [1 -1]; aud = filter(preEmph,1,audp); frameduration=0.025; framelen=round(frameduration*fs); overlap=round(0.01*fs); lasframe=floor(N/framelen); audf=zeros(framelen,lasframe); filter...
function oriChoiceWorldJF(t, events, p, vs, in, out, audio) %% oriChoiceWorld % Burgess 2AFC task with orientation discrimination % 2019-02-06 Modified for oriComp (originally advancedChoiceWorld.m) SF % 2019-02-11 Added stationary cue option (p.stationaryCues) SF % 2019-02-13 Added wait on early response opti...
function S = predict_list_cs_classification( test_data, weights_list, features_choice_struct ) % test_data is in common format % weights_list is length B cell array. beta_list{i} is [d,1] % % S is [N,B] B = length(weights_list); N = length(test_data); S = zeros(N,B); for k = 1:B features = conseqopt_features(test_da...
marsbar('on') i = 1 for x = -70:6:73 for y = -106:6:75 for z = -70:6:81 my_centers(i,1) = x; my_centers(i,2) = y; my_centers(i,3) = z; i = i + 1; end end end radius = 3; roi_dir = '/data/mridata/jdeng/sd_bvftd/nodes/all_nodes_2'; for pt_no = 1:...
classdef GridjobExample < Gridjob %GRIDJOBEXAMPLE Summary of this class goes here % Detailed explanation goes here properties end methods %% Subclass Constructor: initialize standard parameters: function this = GridjobExample(varargin) % Call superclass constructor: th...
%% This is the modelling of neuron (not the kinetic model) function model1(iter,k,range) %k should be less than 8 %% defining kinetic rates I = linspace(range(1),range(2),k); alpha_n = @(V) 0.01*(10 - V)/(exp((10-V)/10) - 1); alpha_m = @(V) 0.1*(25 - V)/(exp((25-V)/10) - 1); alpha_h = @(V) 0.07*exp(-V/20); bet...
function [ H,V,f, lucky ] = arnoldi_v2(A,Hk,Vk,fk,p) lucky = 0; [m,n] = size(A); k = length(Hk); V = zeros(n, k+p); V(:,1:k) = Vk; H = zeros(k+p, k+p); H(1:k,1:k) = Hk; f = fk; for j = 1:p beta = norm(f); if beta == 0 disp('LUCKY BREAKDOWN!!!') beta lucky = 1;...
function update_coin_counter(trial) global exp %% Add running coin count set_buffers_and_messages; earned_coins = nansum(exp.PROBSWITCHdata.reward); for buffer = 1:exp.numb_of_buffers loadpict('stimuli/coin_small.png', buffer, 300, 300); preparestring(num2str(earned_coins), buffer, 360, 300); en...
% 2 Create a Matlab function ofdm demod.m that simulates an OFDM-based receiver. In the % receiver, a serial-to-parallel conversion is performed, followed by an FFT operation, to % regenerate the transmitted OFDM frames and QAM symbols. %%%%% zie slide 29/40 function [demodulatedSequence, fresp_est] = ofdm_demod(of...
p_3_av = 0.3*p_3_h + 0.4*p_3_m + 0.3*p_3_t; eta_TS = ( cp*T_0_m*( (p_3_av/p_0_m)^((gamma-1)/gamma) - 1 ) - V_0_m^2/2 ) /l_Eu; disp('_________________________________________________________________________________') disp(' ') disp(' RESULTS') ...
function [Hx,Hy,Hx2,Hy2] = BuildData(X,Y,X2,Y2,D,p) Hx = buffer(X(D+2:end),p,p-1,'nodelay'); % input, train Hy = buffer(Y(1:end-1-D),p,p-1,'nodelay'); % output, train Hx2 = buffer(X2(D+2:end),p,p-1,'nodelay'); % input, test Hy2 = buffer(Y2(1:end-1-D),p,p-1,'nodelay'); % output, test
%Chris Santos %ECE 314 %9/16/15 %HW #2 scrsz = get(groot,'ScreenSize'); w = scrsz(3); h = scrsz(4); figure('Position',[(w/2)-((w/2)/2) (h/2)-((h/2)/2) w/2 h/2]); x1 = 0:1e-6:300e-6; x2 = Times(:,1); xmarker = 30e-6; y1 = sin(20000*pi*x1); y2 = C1V(:,1); ymarker = sin(20000*pi*xmarker); plot(x1,y1,'b', x2, y2, 'r', xm...
% OPTIMUM INCIDENCE AND DEVIATION (ALREADY COMPUTED) % DESIGN INCIDENCE i_des_statt = i_S_mt; i_des_statm = i_S_mm; i_des_stath = i_S_mh; % DESIGN DEVIATION ANGLE ddelta_di_t = ( 1+(sigma_S_t+0.25*sigma_S_t^4)*(abs(alpha_2_t)/53)^2.5 )/exp(3.1*sigma_S_t); ddelta_di_m = ( 1+(sigma_S_m+0.25*sigma_S_m^4)*(abs(alpha_2_m...
function [centroids] = clustering_pc(points, NC) [n m] = size(points); centroids = zeros(NC, m); x=0; j=0; for i = 1:n j=0; i; s = i + j*NC; x = x +1; while mod(i,NC) == 0 && s <= n && x <= NC centroids(x, :) = centroids(x, :) + points(s, :); j = j + 1; s = ...
function treeIdx = getTreeWithName( skel, name, mode ) %Get all nodes with a name from a tree. % INPUT name: string % String to look for in the tree names. % mode: (Optional) string % Specify search mode % 'exact': Exactly matches the name (Default) % 'partial': name is par...
% co mamy: %długości: clear clc data=load('patientsDATA.txt'); x=1+randi(240); P_amplitude_AVR=data(x,1); P_length_AVR=data(x,2); Q_amplitude_AVR =data(x,3); Q_length_AVR =data(x,4); R_amplitude_AVR =data(x,5); R_length_AVR =data(x,6); S_amplitude_AVR =data(x,7); S_length_AVR =data(x,8); T_amplitude_AVR =data(x,9); ...
% Tao Du % taodu@stanford.edu % May 29, 2014 % draw a cross at [px, py] function [ image ] = draw_cross( image, px, py ) [height, width, ~] = size(image); len = round(min(height, width) / 100); wid = round(len / 4); % if out of bound, do not draw it if (px - len) < 1 || (px + len) > width...
function Xcorr = fastXcorr(spike_matrix, maxLag, autocorr) %% by Mattia % inputs: % spike_matrix: units * time % maxLag: the maximum lag for which xcorr will be computed. in the same % units as the spike_matrix % autocorr: 1 if you also want to compute autocorrelations, 0 if you don't % output: % Xcorr: given a matr...
function [ output_args ] = checkValid( data ) %-------------------------------------------------------------------------- % % checkValid: % A function to return a warning if the input argument is empty % % Syntax: % [ output_args ] = checkValid( data ) % % Inputs: % data - a scalar, a vector, a matrix or a m...
%一般继电器特性 clc; clear all; close all; xian1=0.3; xian2=0.8; st=10; dt=0.01; lp=st/dt; t=dt:dt:st; w=3; u=sin(w*t); Y=[]; for i=1:lp-1 if u(i+1)>u(i) if u(i+1)>xian2 y=1; else if u(i+1)<-xian1 y=-1; else y=0; end...
function latestfile = getlatestfileall(directory) %This function returns the latest file from the directory passsed as input %argument %Get the directory contents dirc = dir(directory); % dirc.name %Filter out all the folders. % dirc = dirc(find(~cellfun(@isdir,{dirc(:).name}))); dirc=dirc(~ismember({dirc.name},{'.','...
function [newCompMesh, meshDisk] = adaptMesh( PosWQ, L, B, T ) %adaptMesh passt die Diskretisierung an --> um die Position der aktuellen %WQ feinere Schritte % PosWQ: <1x3> double [x, y, z] Position der WQ % Cxb: <1x1> double Größe der aktuellen WQ % L,B,T: <1xn> double aus componentMesh % Zur Verfügung stehende...
function [xdot, y] = bicycle_model_PID(t,x) % Note: this is a 2D vehicle model that has braking and lateral forces at % four wheels: fl, fr, rl, rr % It is assumed that both front tires have same Cf, same for rear % This is a simulation of fully-locked braking. global L B R_w L1 L2 h Jrl t_disturb drivetrain_damp ...
function savewaveform(fname,V,fs) % % savewaveform(fname,V,fs) % f = fopen(fname,'wt') ; if f<=0, fprintf('Error: unable to open file %s\n',fname) ; return end fprintf(f,'Start:,1,\n') ; fprintf(f,'Length:,%d,\n',length(V)) ; fprintf(f,'Sample Rate:,+%1.6E,\n',fs) ; fprintf(f,'%d,\n',round(32767*V)) ; fclo...
function A = AA_to_A(AA,time) A = zeros(size(AA,1),size(AA,2)/time,time); for i = 1:size(AA,2)/time for j = 1:time A(:,i,j) = AA(:,time*(i-1)+j); end end end
function snr_sd_v4_check_artifact(subj, study) % Runs a signal-to-noise ratio analysis on fMRI data. Check that the % pathing works for your specific study, and adjust it in the "paths" % section of the code. % CHANGELOG % Code runs to check SNR of 06Jul17 test with Lee. Works with 3D nii files -- Matt % 20 July 17 ...
function rtn = countOnes(row, s, e) rtn = 0; for i = s:e if (row(i) ~= 0) rtn = rtn + 1; end end
function legendShrinkLines(legH, pctShrink) %% function legendShrinkLines(legH, pctShrink) % must come after all calls to change lines in figure, else the new length % will be overwritten % - pctShrink == 100 means do not change % % histed 121008 %% test lH = findobj(legH, 'Type', 'line'); if isempty(lH), error('No l...
% Advection terms element matrix --- buoyancy % (\div u) c*v % A(2*nip,2*nip) in separate displacement ordering % np is the number of points per f.e. % k is the current integration point, to evaluate at function A = advect_c(FUN,FUNT,DER,Coord,np,vec_coeff,nju,wh) A =zeros(2*np,2*np); if nju==0.5, ...
% MCLLVPC.M % Lowered voltage option callback % Called by mclcm mcllvp = get(mcluilvp,'Value') ; if mcllvp == 1 ; set(mcluilvp,'Value',1,'BackGroundColor','white'); set(mcluiprp,'Value',0,'BackGroundColor',[.5,.5,.5]); mclprp = 0 ; else set(mcluilvp,'Value',1); mcllvp = 0 ; end ;
function h = CS4640_LoG(x,y,sigma2) % CS4640_LoG - Laplacian of Gaussian function % On input: % x (double): x value % y (double): y value % sigma2 (double): variance of Gaussian % On output: % h (double): LoG value % Call: % h = CS4640_LoG(3,2,2); % Author: % Kyle Heaton % UU % S...
function image = hybrid_image(im1, im2, cutoff_low, cutoff_high, hybrid_option) fil1 = fspecial('Gaussian', 4 * cutoff_low + 1, cutoff_low); fil2 = fspecial('Gaussian', 4 * cutoff_high + 1, cutoff_high); im1_fil = imfilter(im1, fil1); im2_fil = imfilter(im2, fil2); % To extract high frequency, subtract the original ...
%% postprocessing illustration clc clear all close all load('WPFE_data.mat'); TSwind.forecast =forecast; TSwind.production = measurement; TSwind.total_cap = total_cap; TSwind.delta_T = 0.25; TSwind.n_samples = length(forecast); day = 1; load(['day',num2str(day),'.mat']); scen_error = scen_error'; [samples_scenari...
function [T,WV] = LoadSEfromCSC(fn, R, U) % Loading enginer for MClust-4.0 % % sizeofdouble = 8; if nargin == 1 fp = fopen(fn); nS = fread(fp, 1, 'int'); nSamp = fread(fp, 1, 'int'); T = nan(nS, 1); WV = nan(nS, 1, nSamp); for iS = 1:nS T(iS) = fread(fp, 1, 'double'); ...
function texture = maskMatrix(matrix, radia, saccadeSize, mode, centerShape) % Given a matrix, generate a texture that has matrix everywhere except % in the mask (which depends on mode). The mask is the superposition of % 2 circles (or squares) and a rectangle. The rectangle is centered on the screen %...
% Matt Churgin and Chris Fang-Yen % Last edited 11/29/17 %% Load Data clear all close all [srcfilename pname]=uigetfile('*.mat','MultiSelect', 'on','Select the .mat files'); cd(pname); load(srcfilename); group1 = [1 2 3 4 9 10 11 12 17 18 19 20 25 26 27 28 33 34 35 36 41 42 43 44 ]; % TRAINING group2 = ...
% Analysis script for waveguide FEM resolution studies clear all factor = 0.1:0.02:1; reflection = zeros(1,length(factor)); reflection_theory = zeros(1,length(factor)); k_calculated = zeros(1,length(factor)); elements = zeros(1,length(factor)); percentage = 0; for analysis_index = 1:length(factor) clearvars -exc...
%标题和图例标注 %title('string') %图例:legend('string1','string2') %按照绘制的先后顺序进行对图例的标注 x=-pi:pi/20:pi y1=cos(x) y2=sin(x) plot(x,y1,'-ro',x,y2,'-.b')%线形/%颜色/%标注 title('curve') legend('y1','y2','location','southeast')
clear;clc; InputData = xlsread('output\And.csv'); [rows,cols] = size(InputData); %transposeInputData = InputData'; %newMat = []; %for i = 1:34:rows % newMat = [newMat;transposeInputData(:,i:i+33)]; %end %variance = var(newMat); %[VarianceValue, index] = maxk(variance,10); LowPassValues1 = []; Fs = 2000;...
%% AM_FST_snr_pilot % Script to run FST for AM Ported from my previous isss_multi script. % Cloned on 11/14/19 to pilot SNR in seniors. % Author - Matt Heard % MM/DD/YY -- CHANGELOG % 08/07/17 -- Started changelog. MH % 08/07/17 -- Found error in "prepare timing keys" that overwrote eventStartKey % and stimStartKe...
% MMLDSTC.M % Data storage callback mmldstv = get(mmluidst, 'Value') ; if mmldstv == 1 ; set(mmluidst,'BackGroundColor','yellow') ; set(mmluidsp,'Visible','on') ; else ; set(mmluidst,'BackGroundColor',[.5 .5 .5]) ; set(mmluidsp,'Visible','off') ; end ;
function [vector_new] = zeroNeg(vector) % Replaces all the negative values of a vector with zero replace=0; vector_new=vector; for i=1:1:(length(vector)) if vector_new(i)<0 vector_new(i)=replace; % when assigning to a new integer, old value goes on left % when assigning to a new variable, o...
function [Jfn, Cfn, kfn, dbn, Qn, accn,Vn, Dn] = NormalCutS(A,K,L,c,Partition) %normalized cut taking m = size(A,1); if ~exist('K','var') && ~exist('L','var')&& ~exist('c','var') K = min(100, ceil(m/10)); L = 2; c = 0; end; %d = sparse(diag(sum(abs(A))+1)); %normalized laplacian La=laplacian(A); %N = d^(-1...
function phase = phis(U0MeV,VrfMV) % phase = phis(U0MeV,VrfMV) % % this function returns the synchronous phase in radians % input: % U0MeV is energy loss per turn in MeV % VrfMV is the RF voltage in MV phase=pi - asin(U0MeV./VrfMV); end
clear; close all; clc %% % % Joćo Araśjo 2018/2019 % % Brute-force optimization Script for the Traveling Santa 2018 contest % % %% %% Load data and get initial cost Data = csvread('cities.csv',1); load('Path_opt') %Get primes in order for memberC usage load('Primes') costInit = 0; pathHist =...
function [metric, output_log] = train_oasis_c_pos_flip(images, labels, parms) % % % [oasis_agress, parms] = take_from_struct(parms, 'oasis_agress', 0.1); [oasis_num_of_steps,parms] = take_from_struct(parms, 'oasis_num_of_steps',1000000); [oasis_save_every,parms] = take_from_struct(parms, 'oasis_sav...
ld = load('J_vs_E.mat'); x2 = ld.fj200.x; f2 = ld.fj200.signal; f2_err = ld.fj200.error; x4 = ld.fj400.x; f4 = ld.fj400.signal; f4_err = ld.fj400.error; e_min_s = 45; e_max_s = 125; % first subrange: take from ei200 ir2_min = find(x2==e_min_s); ir2_max = find(x2==e_max_s); x_tot1 = x2(1:ir2_min); s_tot1 = f...
function bqt = qt_balance(S) %% enforce 2:1 ratio [M,N] = size(S); maxDim = full(max(max(S))); minDim = full(min(min(S(S>0)))); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%De%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Creating matrix J whose size = image size and used to indicate the % occupation of each types of squar...
clc clear all close all global tol tol = 1e-7; tmax= 500; dt= 1; t0 =0 ; time= t0:dt:tmax + dt; p0=-50; r0=0; pold=p0; rold=r0; diso=0.1; phi= zeros (size(time)); rec= zeros (size(time)); time_count =1; while (time(time_count)<tmax) time_count=time_count+1; pnew= pold; [fp,dp_fp, rnew] = m...
function [J_train,J_val,J_test,theta,y_model] = learnCurve_m5(data_t,data_val,data_test,alpha,iter,sizes,deg) % Create learning curves from the data % Uses: convertCategory, no normalization or polyFeatures, use % categorical & numerical data separately. n_num = 1; n_sizes = length(sizes); f = waitbar(0,'Runnin...
function [obtained_a, obtained_b, decided] = softmax(a,b); temperature = 0.3; std_dev = 1; exp_sum = (exp(a*temperature) + exp(b*temperature)); prob_a = exp(a*temperature)/exp_sum; prob_b = exp(b*temperature)/exp_sum; obtained_a = a; obtained_b = b; if prob_a > prob_b; obtain...
function [ output ] = get_energy_characteristic( ) %GET_ENERGY_CHARACTERISTIC Summary of this function goes here % Detailed explanation goes here global en_type c1 c2 d1 hessian = zeros(3, 3); if strcmp(en_type, 'arap') hessian(1, 1) = 2; hessian(2, 2) = 2; hessian(3, 3) = 2; output = ...
close all clear clc I_s=0.01e-12; I_b=0.1e-12; V_b=1.3; G_p=0.1; current= @(V) I_s.*(exp(1.2/0.025.*V)-1)+ G_p.*V-I_b.*(exp(-1.2/0.025.*(V+V_b)-1)); V=linspace(-1.95,0.7,200); I_1=current(V); I_N=I_1+I_1.*(0.4*rand(1,length(I_1))-0.2); figure(1) hold on plot(V,I_N) hold off figure(2) hold on semilogy(V,I_N) hol...
%%%%%%%%%%%%%%%SVM分类器训练 function [multiSVMstruct] =multiSVMtrain(traindata,nclass,gamma,c) %%%多类别SVM训练器 for i=1:(nclass-1) for j=(i+1):nclass X=[traindata((32*(i-1)+1):32*i,:);traindata((32*(j-1)+1):32*j,:)]; Y=[ones(32,1);zeros(32,1)]; multiSVMstruct{i}{j}=svmtrain(X,Y,'kernel_Function',@...
function [returnAnswers, humanResponses] = Pacman(numRepBlock, timing) more off; close all; %%%%%% Screen Init %%%%%%% PsychDefaultSetup(2); Screen('Preference','SkipSyncTests', 1); Screen('Preference','VisualDebugLevel', 0); screens = Screen('Screens'); endSc = max(screens); global white = 0; globa...
function psnr = imgPSNR(imgP, imgComp, n) [row col] = size(imgP); err = 0; for i = 1:row for j = 1:col err = err + (imgP(i,j) - imgComp(i,j))^2; end end mse = err / (row*col); psnr = 10*log10(n*n/mse);
function [x] = unicycleTest() % This function generates random linear speeds and angular velocities for 5 % randomly generated time intervals. The "unicycleModel" function is then % called to calculate the positions vs time. % Clean up close all clc x = [1;2;0]; % VERY initial conditions c = 1; % initiate counter a ...
function b = secant(f, a, b) % Solves f(x)=0 for x, requires two initial aproximations. yb=1; ya=f(a); while(abs(yb)>eps) yb=f(b); temp=b; b=b-yb*(b-a)./(yb-ya); a=temp; ya=yb; end end
%Section 1.4 %Problem 11 % Initialization f1 = @(x) x^3 - 5.06*x^2 - 10.392*x + 46.2; fp1 = @(x) 3*x^2 - 10.12*x - 10.392; f2 = @(x) x^3 - 1100*x^2 + 100220*x - 20000; fp2 = @(x) 3*x^2 -2200*x +100220; % a fprintf('a\n') [xbest,~,nitr,~] = NewtonAE(f1,fp1,2,1e-6,100,0); fprintf('Itr:%d, x:%f\n',nitr, xbest) [xbest,...
%{ Ex.2 Fie ecuatia x^3 - 7 * x ^2 + 14 * x - 6 a. Sa se construiasca in Matlab o procedura cu sintaxa [xaprox] = MetBisectie(f, a, b, ε). b. Intr-un fisier script sa se construiasca ın Matlab graficul functiei f(x) = x^3 - 7 * x ^2 + 14 * x - 6; pe intervalul [0, 4]. Sa se calculeze solutia aproximativa xaprox cu er...
%% Sampling theorem: % pick a sampling frequency Fs = 120; % pick times of sampling t=0:1/Fs:1; w=12; % pick a signal frequency y = sin(w*t*2*pi); figure; plot(t, y, 'LineWidth',2); hold on % downsample the signal to 60 Hz t_60Hz = t(1:2:end); y_60Hz = y(1:2:end); ...
%Sove e^(x+y) +x2 +0.5y2 +xy -y such that x+2y =3 %Eliminate equality constraints and reformulate as unconstrained %minimization clear f_y = @(y)(exp(3-y)+2.5*y^2 -10*y +9); df_y = @(y)(-exp(3-y)+5*y-10); x_k =1; y_k = 1; obj_k =[];t_k=[]; xks=[]; yks=[]; iterk=[]; for iter = 1:100 Dy = -df_y(y_k)...
function plot_path(map, path) % PLOT_PATH Visualize a path through an environment % PLOT_PATH(map, path) creates a figure showing a path through the % environment. path is an N-by-3 matrix where each row corresponds to the % (x, y, z) coordinates of one point along the path. tic clf line=size(map.block,1); for...
function [isc, p, stats, perf, rand_perf] = eeg_corrca( ALLEEG, stimulusIdc, flag_randclass) N = length(ALLEEG); T = min([ALLEEG.pnts]); D = ALLEEG(1).nbchan; conditionList = cellfun(@(x) strcmp(x(4), 's'), {ALLEEG.setname}); X = zeros(T,D,N); % number of stimulus conditions C = length(stimulusIdc); % add all eeg...
% % % % clear all; close all; clc; N = 500; % Size of the simulated network whose connectivity must be % synthetically generated... %-------------------------------------------------------------------------- % Test 1 - random connectivity p = 0.4; % Marginal probability of a synaptic co...
% % Generate histogram %hist_RG = [imhist(Blurred_img(:,:,:,1)) % imhist(Blurred_img(:,:,:,2))]; % % % Normalize avg_R = mean(Blurred_img(:,:,:,1),'all'); avg_G = % mean(Blurred_img(:,:,:,2),'all'); min_R = % min(Blurred_img(:,:,:,1),[],'all'); min_G = % min(Blurred_img(:,:,:,2),[],'all'); ...
function [k,X,Y,fxy,wch,wucha,P]=RK4 (funfcn,fun,x0,b,C,y0,h) x=x0; y=y0;p=128; n=fix((b-x0)/h); fxy=zeros(p,1); wucha=zeros(p,1); wch=zeros(p,1); X=zeros(p,1); Y=zeros(p,length(y)); k=1; X(k)=x; Y(k,:)=y'; % 绘图. clc,x,h,y %计算 %fxy=fxy(:); for k=2:n+1 x=x+h; a2=C(5);a3=C(6); a4=C(7); b21=C(8); b31=C(9); ...
%% Subplot of all flags from files subplotIterator = 1; for i = 1:2:500 subplot(16, 16, subplotIterator); fullPath = strcat(prefixPath, countryIds(:, i:i+1), postfixPath); img = imread(fullPath); % We standardize flags to 32x16 by filling out if necessary if size(img,3) ~= 3 % If MATLAB couldn...
function Ex1_TheSolarSystem clear all;clc;close all;delete('*.asv'); %% Units uses % *Units: Mass(kg), redios(AU : 1 AU = 1.5e-11 m), time(yr)* k=1e3;ks=.04; r_sun=k*(6.9551e8/1.5e11); %% Planets % % *1- Mercury (Me)* M_Me=2.4e23; rs_Me=0.38710; ec_Me=0.206; r_Me=k*((2439.7e3)/1.5e11);%AU*e3: radi...
% mod_wrksht = worksheet(:,(2:26)); % mod_wrksht(:,end+1:end+4) = worksheet(:,33:36); % mod_wrksht(:,end+1:end+11) = worksheet(:,37:47); % mod_wrksht(:,end+1:end+3) = worksheet(:,50:52); % mod_wrksht = mod_wrksht(1:length(current_sub),:); mod_wrksht = analysis_matrix; count = 0; for i = 1:size(analysis_matrix,1) ...
clc clear load('train.mat') load('test.mat') %preprocessing %find mean of each row mu = mean(train_data, 2); sd = std(train_data, 0, 2); %standardization method strd_train = (train_data-mu)./sd; strd_test = (test_data-mu)./sd; %checking for kernel suitability K = strd_train'*strd_train; isSuitable = svm_helper.check...
%Input: Matrix %Description: Calculates, for each row, the average of the entries in that %row. %Output: Vector (Column) function average=Average_R(x) format long average=x(:,1); for i=2:length(x(1,:)) average=average+x(:,i); end average=average/length(x(1,:)); end
%% Q1 %% clear clc %% Part 1 %% [samples, text, raw] = xlsread("./resources/California_birth_1.xlsx"); for i = 1:14 if (text(1, i) == "TGRAMS") break end end for j = 1:14 if (text(1, j) == "WEEKS") break end end mean_TGRAMS = mean(samples(:, i)); median_TGRAMS = median(samples(:, i));...
function handle = stackViewer(F, tag, minmax) %Focused.stackViewer is the focused wrapper for stackViewer % it creates the memory map and optionally loads the mask switch nargin case 1 tag = 'source'; end titleFig = F.name; % get title mask = []; % default mask switch tag ...
clc; clear all; %% data=load('train_super_annotations.mat'); train_path=data.train_path(1:500); train_gaze=data.train_gaze(1:500); train_bbox=data.train_bbox(1:500); train_meta=data.train_meta(1:500); train_eyes=data.train_eyes(1:500); %% %train_subset=[subset_path,subset_gaze, subset_bbox,subset_meta,subset_eyes] ...
T_F1 = 10; a = 0.05; %start with a number greater than T_F1 so that feed starts immediately k=0; buffer1 = 0; buffer2 = 0; timer1 = tic; timer2 = tic; disp([num2str(toc(timer1)),', ',num2str(toc(timer2))]) while (k<12) if toc(timer1) > T_F1*exp(-a*toc(timer2)) switch buffer1 case 0 k=...
%clear all clc %load_OrginalData_6by6 %------------------------------------------------------------------------- %Maximum_Num=2^36-1; %Test_X=zeros(1000,6,6); %Remain_Index=zeros(Maximum_Num-length(InputX),1); Create_X=zeros(length(InputX),6,6); count_index=1; count_test=1; count_train=1; %------------------...
% %%align two wet images one to each other. % %%The function tries different angles,rotate one of the two images,and for each angle calculate the % %%translation of this image repect the other one.The phase % %%correlation function returns the quality value q The angle corresponding to the % %%best q value is se...
% MATLAB R2015a function % S. M. Farzaneh, farzaneh@nyu.edu % Created: September 20, 2017 % Title: Compute relaxation time in bilayer graphene % and save it to data/relaxation/ % Note: this function uses parallel for loop (parfor) % Note: the input arguments must be scalar function [] = compute_relaxation_bilayer(s,...
function saveniidata(NII,FN) % function saveniidata(NII,FN) % if exist('save_untouch_nii','file') % save_untouch_nii(NII,FN); % else % save_nii(NII,FN); % end try save_nii(NII,FN); catch save_untouch_nii(NII,FN); end
%% Test 1: Simple Pendulum % % Reference % https://ocw.mit.edu/courses/mechanical-engineering/2-003j-dynamics-and-control-i-spring-2007/lecture-notes/lec16.pdf syms theta dtheta ddtheta syms m g l T = 1/2*m*l^2*dtheta^2; V = - m*g*l*cos(theta); xVec = theta; dxVec = dtheta; ddxVec = ddtheta; [Mmat,bvec] = Lagrange...
batiksongket = imread ('songket_palembang.jpg') %imshow(batiksongket); resize128 = imresize(batiksongket,[128,128]); %imshow(resize128); grayscale = rgb2gray(resize128); %imshow(grayscale); histeq = histeq(grayscale); canny = edge(histeq,'canny'); subplot(2,2,1); imshow(resize128); title('original'); subplot(2,2,2)...
function determine_KPPVcenters(name, n, m) img = imread(name); properties = get_numbers_properties(img); img = imbinarize(img); img = 1-img; s = size(properties); nb_columns = s(1)/10; dlmwrite('KPPVcenters.csv',[]); for i = 1:10 for j = 1:nb_columns ...
%% ======================================================================== % y0 function (example1) % written by Dongjin Lee (dongjin-lee@uiowa.edu) %% ======================================================================== function [output]=responY1(X,mu) global cntY1 cntY1 = cntY1 + 1; %multivariate Gauss...
function [ MaxEnvVec] = MaxEnv( samples, blockSize, hopSize ) %This functions calculate the peak Envelope in each block and returns a %vector containing all the peak envelopes for the audiofile. L = length(samples); n = 1; MaxEnvVec = []; index = []; for n=1:hopSize:L-blockSize currentBlock = abs(samp...
function [ y ] = rtab_1D_1out( xv, yv, x, mode) % RTAB Read Table % Read y(x) function from table by interpolation. xv and yv are data % arrays. x is the query point(s). y is the interpolated answer(s). % xv data points NEEDS TO BE ORDERED from small to big values. % If mode == 0, xv data points must be given in ...
%% Part1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% close all; clc; clear; %% Step1: Define intrinsic parameters au = 557.093; av=712.9824; % Pixel conversion parameters u0=326.3819; v0=298.6679; % Principal point in the image plane f=80; % focal length. Unit: mm Tx=100; Ty=0; Tz=1500 ...
function [V,pcaData]=fpca(traindata,k,mA) m=size(traindata,1); % mdata=mean(traindata,1); mdata_matrix=repmat(mA,m,1); z=traindata-mdata_matrix; %使得原始数据均值为0; A=z*z'; [U,D]=eigs(A,k); %计算A的前K个特征值对角阵D与特征向量U;其中U为z*z'的特征向量; D=inv(D); %求矩阵的逆; V=z'*U*D; %V为z'*z的特征向量;这一步是按照自己对SVD的理解写的,不一定正确,但对结果影响不大; % V...
function [ck kcvq]=k_convexQ(v) % K_CONVEXQ checks whether the game v is k-convex. % % % Usage: [ck kcvq]=k_convexQ(v) % Define variables: % output: % ck -- Returns 0 in case of a non k-convex game, otherwise % a vector/list of numbers indicating which kind of % k-convexity has been d...
function [ net ] = InitNet(net_param, data_set, test_set) net.net_param = net_param; batch_sz = net_param.train_param.batch_size; test_batch_sz = net_param.test_param.batch_size; layer_num = length(net_param.architecture)/2; layers = cell(layer_num, 1); % parameters of the layer layers_train = cell(layer_num, 1); % mem...
%% RLWM + PST - new version 2014 (Anne Collins)) %%%% Anne Collins %%%% Brown University %%%% November 2014 %%%% anne_collins@brown.edu %%%% RLWM task instructions function InstructionsLSSt_controller(w,rect,Actions,SMat) debug = 0; load debugstate % if debug % [w, rect] = Screen('OpenWindow', 0, 0,[],32,2);...
clear; T_emax=471; d=1; n_p=2701; igh=1; uamax=95; F=3.05; r_r=F*d/2/pi; m=8830; g=9.8; alpha=16.7/180*pi; psi_max=f*cos(alpha)+sin(alpha); eta_T=0.858; init_i0=r_r*n_p/uamax/igh; i0=0.377*init_i0; ig1=m*g*psi_max*r_r/T_emax/i0/eta_T;
function v_ = propagation_v_R(w, v, p, rotation_matrix) v_ = rotation_matrix * (v + cross(w, p)); end
function [f,lo,f_convorder,steer] = filters(n_tap) %-------------------------------------------------------------------------- % % See demo_sepspyr.m for usage examples and help % % Copyright (c) 2013 Jeffrey Byrne <jebyrne@cis.upenn.edu> % %-------------------------------------------------------------------------- ...
function [ bic ] = BIC(X, C, idx, k) M=size(C,2); R=length(X); uni=unique(idx); s=0; for i=1:k t=(idx==uni(i)); for j=1:length(X) if(t(j)==1) s=s+norm(X(j,:)-C(i,:))^2; end end end sigma=(1/(M*(length(X)-k)))*s; L=0; for i=1:k; R_n=sum(idx==uni(i)); L=L+(-0.5*R_n*log(2...