text
stringlengths
8
6.12M
matrix=zeros(63,7); a=0.7; count=0; for x=1:63 matrix(x,1:6)=binary(x,6); end for x=1:63 res=sum(matrix(x,1:6)); modul=mod(res,2); matrix(x,7)=modul; end w_z=-0.5 + 0.5 .*rand(6,6); w_z_z=-0.5 + 0.5 .*rand(6,6); w_y=-0.5+ 0.5 .*rand(1,6); input=zeros(1,6); hide_la=zeros(1,6); dz=zeros(1,6); dzz=zeros(...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Finding Nested Logit FOC Jacobian %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % The calculations of the FOC Jacobian is done on the last period of the % Painkillers dataset. % Put shareHessian in Nes...
function [X] = my_dct2(x) % Computes the 2-dimensional discrete cosine transform (DCT-II) of matrix x X = my_dct(my_dct(x).').'; end
function scores = AttractioNet_objectness_scoring(model, image, bboxes, skip_image_conv_layers) % AttractioNet_objectness_scoring: % It implements the objectness scoring module of AttractioNet. The % objectness scoring module assign confidence score to each input box that % represents how likely it is each box to tight...
function xT = findTraj(r, n, m, dim, tDes, posDes) H_joint = []; for i=1 : m % find cost matrix for each segment H = findCostMatrix(n, r); % multiply by time factor to nondimensionalize H = 1 ./ ((tDes(i+1, 1) - tDes(i, 1))^(2*r-1)) .* H; % put in block diagonal ma...
% 0NE GENE AUTOREGULATION % desired behavior only with a hill function with steepness > 2 so that % once the autoregulation kicks in the activity level converges clear all; % constants TIME_STEP = 0.01; tmax = 5; timeArray = 0:TIME_STEP:tmax; n = length(timeArray); % network positive = true; productionRate_x = 25; d...
function [A0 A O] = genHMMparam(A0_hsmm, A_hsmm, O_hsmm) A0 = A0_hsmm; A = A_hsmm; O = O_hsmm; %data for running murphyk HMM code save('murphykHMMinit', 'A0', 'A', 'O');
function []=saveanimate(filename,pout,vout,uout) global u_0 h_0 pmin=min(min(pout)); pmax=max(max(pout)); umin=min(min(uout)); umax=max(max(uout)); x=[pmin-10:0.01:pmax+10]; [e,~]=size(pout); figure; for i=1:e p=pout(i,:); v=vout(i,:); u=uout(i,:); %t=tout(i); [h,~]=Gauss(x,pout(i,:),vout(i...
% PURPOSE: Generates dummy observations for a Minnesota Prior % ----------------------------------------------------- % USAGE: vm_dummy % ----------------------------------------------------- % NOTE: requires to run vm_spec.m % ----------------------------------------------------- % tau : Overall tightness % d ...
%%%%% Test network's performance on the test patterns %%%%% %sumSqrTestError = 0; %crossEntError = 0; %sumOfError = 0; all_outAct = zeros(size(outAct, 1), size(inputs_test, 2)); inputs_test = test_images; prediction = zeros(1, 1253); for pat = 1:size(inputs_test, 2); %%%%% forward pass %%%%% ...
function d=getDilatedanmarP2X4sense(y) d=y(:,7)+y(:,8); end
function varargout=roo2brightness(varargin) %ROO2BRIGHTNESS Convert spectrum to ISO Brightness. % BRIGHTNESS=ROO2BRIGHTNESS(ROO,WL) with size(ROO)=[M N ... P W] returns % matrix BRIGHTNESS with size [M N ... P]. % % ROO holds M*N*...*P spectral readings with W spectral bands and WL, % size [1 W], holds th...
function [ t , x ] = sinusoidal_generator( A, f0, fase, FS, Tx ) % Criar o vetor de pontos - grelha de tempo. t = 0 : 1/FS : Tx; x = A * cos(2 * pi * f0 * t + fase); sound(x); %uncomment in 4c and 4d %figure; %plot( t, x); end
% clear variables % % % Create Vd and nd for use with karma_sim_jacobian_compare_1cell % filename = 'data_1cell_b800_18000_Vpert_0p03125' % eval(['load ' filename '/configinfo']) % load corresponding data % % x=floor(perttime/writeint)%9 % Indicate the interval before the one where the perturbation was applied...
% Program 8.6 Finite element solver for 2D PDE % with Dirichlet boundary conditions on a rectangle % Input: rectangle domain [xl,xr]x[yb,yt] with MxN space steps % Output: matrix w holding solution values % Example usage: w=poissonfem(0,1,1,2,4,4) function w=poissonfem(xl,xr,yb,yt,M,N) f=@(x,y) 0; % define input ...
%%%%%%%%%%%% CREATE FUNCTION %%%%%%%%%%%%%%%%%%%%%%%%%%%% % I will be verry quick on this one because it could be usefull not only % if you alreday manage matlab well % % Creating can seems not really usefull at the begging but in fact it same a lot of time % because you will create the function once and use i...
close all clc N = 5; robot = Robot(); map = [0,0;60,0;60,45;45,45;45,59;106,59;106,105;0,105]; %% Calibrate %robot.calibrateTurn(-2*pi, 1) %% Time rotating scanner % time = zeros(1,N); % for i = 1:N % deg = 360.0 - (360.0 / robot.scan_num); % % prep motor % if robot.scan_clockwise % pow...
%Computes the equally weighted portfolio analyses results for the Alpha %analysis and the Recession analysis. Alleff = load('all_efficient.mat'); eff_inter = mean((Alleff.Alleff_ar1)'); eff_prior = mean((Alleff.Alleff_ar12)'); eff_cross = mean((Alleff.Alleff_cross)'); original = mean((Alleff.excInd)'); PCA = l...
clear all, clc; v = rand(7,1); w = rand(7,1); z = 0; for i = 1:7 z = z + v(i) * w(i); end z z1 = sum (v .* w) z2 = w' * v % z3 = v * w' % z4 = w * v'
function [points,quads,curv] = coregrid(r1) R_right=[r1/4; r1/2; r1]; theta = 2*pi/4*(0.5:1:3.5)'; % Right shells shell_right=exp(1i*theta)*R_right'; points=shell_right(:); % Right and Left shells q0=[5,1,8,4; 6,2,5,1; 7,3,6,2; 8,4,7,3]; quad_inner=[q0+0;q0+4]; % Core quad_core=[1,2,4,3]; % Gather all quads quads=[qu...
function [ N ] = NURBS_2D(xi_1, xi_2, i_1, i_2, p_1, p_2, n_1, n_2, Xi_1, Xi_2, w) %compute 2d nurbs basis function NumKnots_1 = length(Xi_1); NumKnots_2 = length(Xi_2); if(NumKnots_1 ~= n_1+p_1+1) error('n+p+1 is not equal to the number of knots, for dimension 1'); end if(NumKnots_2 ~= n_2+p_2+1) ...
clear; pro_mem_eff; N=50; con_e_max=0.2366; option=gaoptimset('TimeLimit',3600*5,'Display','iter','TolFun',1e-10,'PopulationSize',30,'Generation',100); lb=[0 0 0]; ub=[100 100 100]; [x fval]=ga(@delta_pid_mppt,3,[],[],[],[],lb,ub,[],option); dJ=delta_pid_mppt(x); %save('fuzzy_ga_opt.mat','x') %}
function [predicted_classes,predicted_scores] = predict_Hellinger_forest(model,features) %Function: predict_Hellinger_forest %Form: predicted_classes = predict_Hellinger_forest(model,features) %Description: Predict labels using trained Hellinger Distance Decision % Forest %Parameters: % model: a trained Helling...
% setup basic environment for supercell % input: sc_m, sc_n % expect sc_m >=2 sc_n>=1 lattice_a=1.42*sqrt(3); layer_d=[0,0,3.35]; % lattice_a* a1=[sqrt(3)/2,-1/2]'; a2=[sqrt(3)/2,+1/2]'; sc_int_bottom_a1=[sc_n,sc_m]; sc_int_bottom_a2=[-sc_m,sc_n+sc_m]; sc_int_top_a1=[sc_m,sc_n]; sc_int_top_a2=[-sc_n,sc_n+sc...
function Ahat= DICASimp(y) % dimension d, num trails d=size(y,1); phi = randn(d,1); G1_phi = G1(phi,y); G2_phi = G2(phi,y); G3_phi = G3(phi,y); M = G1_phi-G2_phi-2*G3_phi; [U,D,~] = svd(M); X = U*D.^(1/2); psi1 = randn(d,1); G1_psi1 = G1(X'\psi1,y); G2_psi1 = G2(X'\psi1,y); G3_psi1 = G3(X'\psi1,y); M1 = G1_psi1-G2_p...
clc clear %% Elements n = 4; % number of elements in sde m = 2; % number of other throwoff elements l = 0; % number of other other elements nfft = 4096*2; T = 0.5e-6*nfft; deltaT = T/nfft; t = [0:nfft-1]/nfft; time = t*T; %% Input forcing function (run 'Phsforce.m') disp('Loading Forcing function...') Load = load('f120...
function [ patches ] = getPatches( img, pSize, overflow ) %GETPATCHES Return a matrix where each column is a patche of img % img is the image to be cut in patches % pSize is the size of patches (they are squares) % overflowSize is the number of pixels of 'overflow' % % Each patches is stored in one column the s...
function out = distfcm(center, data) out = zeros(size(center, 1), size(data, 1)); % fill the output matrix if size(center, 2) > 1, for k = 1:size(center, 1), out(k, :) = sqrt( sum( ( ( data-ones(size(data, 1), 1)*center(k, :)).^2)' ) ); end else % 1-D data for k = 1:size(center, 1), out(k, :) =...
function vacc_core_init_xblock(varargin) defaults = { ... 'veclen', 32, ... 'n_inputs', 1, ... 'arith_type', 0, ... 'bit_width_out', 32, ... 'bin_pt_out', 17, ... 'add_latency', 2, ... 'bram_latency', 2, ... 'mux_latency', 0, ... 'bin_pt_in', 0, ... 'use_dsp48', 1, ... }; n_inp...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function samples = sampleFromHisto(histo, N) % Samples from a non-parametric distribution modeled by a 3-D histogram % % Input parameters: % - histo: input histogram to sample from. Can be of any arbitrary % dimension % - N: number of ...
function z=int(z,N,h,x) % Calcuiate the integral sum=0; for l=1:N+1 sum=sum+h*feval(@p,x(l))*z(l); end z=sum; end
function [L_class,aggClassEst] = ADABOOST_te(adaboost_model,te_func_handle,test_set,true_labels) % global L; % ADABOOST TESTING % % [L,hits] = ADABOOST_te(adaboost_model,te_func_handle,train_set, % true_labels) % % 'te_func_handle' is a handle to the testing function of a % ...
function f_plot_export(hfig,SaveName) FontSize = 10; FontName = 'Arial'; % % FontName = 'MyriadPro-Regular'; % % % figure dimensions in cm % figure_width = 14; % figure_height = 10; % set(hfig, 'units', 'centimeters', 'pos', [5 5 figure_width figure_height]) % % % setup axis plot properties % % shading interp; % ...
function [phi,zeta,eta] = TDD(Az,fs,fn,fnMin,fnMax,varargin) % [phi,zeta,nu] = TDD(Az,fs,fn,fnMin,fnMax,varargin) estimates the mode % shapes phi, modal displacements nu and modal damping ratios zeta of a % structures using the time Domain Decomposition (TDD) mthod [1] % %% Inputs % * Az: acceleration data. Mat...
function call_price=american_call_futures_currcy_bin(S, K, r, r_f, sigma, time, no_steps) %-------------------------------------------------------------------------- % % DESCRIPTION: % % Pricing a futures currency option using a binomial approximation % % % Reference: % % John Hull, "Options, Futures ...
%Ridge regression object classdef reg_ridge < handle properties beta end methods %Carries out ridge regression and returns decision rule (beta) %%%%%%%Arguments%%%%% %obj=object %resp_vec=response vector %cov_matrix=covariate matrix %alph...
% System A_true=[1 0.5 0.3]; B_true=[1 0.5]; % Data x = randn(100,1); Pn = 0.01; y = filter(B_true,[1 A_true],x)+sqrt(Pn)*randn(size(x)); % gamma-SVM parameters epsilon = 0; gamma = 1e-1; C = 10; p = 5; mu = (.1:.1:1.9); % Try different mu values for i = 1:length(mu) disp([num2str(i) ' de ' num2str(leng...
u=0; a = 4; t = 10; y = secondlaw4c(u,a,t);
clear paramsAll; clear params; params.Gridjob.runLocal = false; params.Gridjob.requiremf = 3000; params.Gridjob.wc_host = ''; params.Gridjob.jobname = 'JR_NoDriver'; params.Gridjob.continue = false; params.Gridjob.initRandStreamWithJobid = true; params.Gridjob.combParallel = false; params.Gridjob.walltime = '00:59:00...
% 3.5最后一问 function a=dtfs(x,n_init); a=[]; w=2*pi/length(x); %fundamental frequency for k=n_init:n_init+length(x)-1 %period from 0+n0 to N-1+n0 a_k=0; for n=1:length(x) a_k=a_k+x(n)*exp(-j*k*w*(n+n_init-1)); end a=[a a_k/length(x)]; end if n_init<...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function animate3DFigure(figHangle, increment, doSave, file) % Visualize a 3-D figure by rotating along vertical axis % % Input parameters: % - figHandle: handle to the 3-D plot to rotate % - increment: Variation in angle from one frame ...
function [structure] = AnalyseSwitchingIE(log, sdp) % % clear all; close all % sdp = 3; % fileID = fopen('LSw_IE6.txt'); % log = textscan(fileID,'%s %f %d %s'); % fclose(fileID); % this function summaryses responses to the language switching task. % It takes a single log, previously edited with coding for in...
%% Create the random spectral points for the common channels %% Set up the folders uuidFolder = 'D:\Papers\Current\LARGIIDataCatalogInfo\uuidMaps'; saveFolder = 'D:\Papers\Current\LARGIIDataCatalogInfo\spectralRelationships'; baseFolders = {'O:\LARGDataCorrected', 'H:\LARGDataMaraCorrected', ... 'H:\LARGDataAsr_10...
%% Features O_dyn = 8*n; %# random gaussian directions for dynamics O_w = 6*n; %# random gaussian directions for W D_dyn = 2*O_dyn*n; D_w = 2*O_w; %exclude these components of x in f(x) n_dyn = 1:2; %exclude these components of x in B(x) n_dyn_B = 1:6; %B should be constant for PVTOL %exclude these components of x...
function [receptor,Bou] = getGij_lay_psv_dwn(pota,receptor,Bou,... Mpsv,M_sh,m,f,ops,mtrcs) % obtner las tensores de Green entre segmentos: % Bou.pt{i}.gG .gT % y entre segmentos y receptores % Bou.pt{i}.xG .xT % en la frecuencia % Allocate GreenFun variables % now the ...
%Computer Integrated Surgery, EN.600.445 %Alperen Degirmenci, Saumya Gurbani %Copyright 2010 Johns Hopkins University. function [a b samples] = readSampleReadings(filename, numA, numB) %Reads the SampleReadings.txt and returns the corresponding G point3D structs %and the number of frames fid = fopen(filen...
clear; format long; eff_pv=.15; load('PV-RO-ERD data (365days) calculated in 07-Aug-2014.mat'); q_f0=q_f_max_ntr_erd; q_p0=q_p_max_ntr_erd; load('P_out fron PV.mat'); num_PV=20; w_sun=num_PV*P_max*eff_pv*1e-3;%month 12 eff_erd=.98; eff_hp=.9; eff_ht=.9; fos=73.45/100;%bar*kg/g c_f0_ro=35; c_b=0.1; fai=0.5; pi_f0...
function albainit % Initialize parameters for ALBA control in MATLAB % %========================== % Accelerator Family Fields %========================== % FamilyName BPMx, HCM, etc % CommonNames Shortcut name for each element % DeviceList [Sector, Number] % ElementList number...
function [trunc_w,trunc_vec] = userdata_truncFFT(w,fft_w,center,half_width,skip) % half_width = 4*half_width; trunc_vec = fft_w(w < (center+half_width) & w > (center-half_width),:); trunc_w = w(w < (center+half_width) & w > (center-half_width)); len = length(trunc_w); trunc_vec = trunc_vec(1:...
function plotActTermsOnMorphs2(cell_id,cell_layer,... nrn_model_ver,nrn_pop_name,model_prefix,model_prefix2,varargin) mat_dir = addPaths; in.morph_alpha = 0.5; in.morph_color = 'k'; in.term_act_col = 'r'; in.term_act_col2 = 'b'; in.term_lw = 1.5; %in.term_lw = 7; in.cell_inds_file = 'gen_figures/cellplot_inds_ls...
% ------------------------------------------------------------------------------------------------------------------------- function net = add_adjust_layer(net, name, input, output, params, gain, bias, lr_gain, lr_bias) % --------------------------------------------------------------------------------------------------...
%1 im1 = imread("autumn.tif"); im2 = imread("football.jpg"); imshowpair(im1,im2,"montage"); %2 h = fspecial("gaussian",[5,5]); %3 ycbcr = rgb2ycbcr(im1); Y = ycbcr(:,:,1); %4 ycbcr_copy = ycbcr; Y_conv = imfilter(Y,h,"replicate"); ycbcr_copy(:,:,1) = Y_conv; subplot(121); imshow(ycbcr2rgb(ycbcr)); title("original...
function out = My_Imresize_BL(Input_Image, Resizing_Factor) [rows, collumns, ~] = size(Input_Image); out = zeros(rows*Resizing_Factor, collumns*Resizing_Factor); for i = 1: size(out, 1) for j = 1: size(out, 2) x = i/Resizing_Factor - floor(i/Resizing_Factor); y = j/Resizing_Facto...
% Encode Data %data(i)=1--> level chane %data(i)=0--> no level change function y=enc_data(x) clf; clear; bits=8; threshold=0.5; data=rand(1,bits); for i=1:length(data) if data(i)>threshold data2(i)=1; else data2(i)=0; end end data data2 figure(1) subplot(3,1,1); stairs(data2); title('Original D...
% generate_varian_stucture_20180208 % create by MP on 2/8/2018 % % puts together the information from the data_list file to create the % carbon and proton filepath names as well as the structure to save the % data % % update(1) by MP on 2/19/2018 % improves list management % load default values if isempty(c13_seq_name...
function logger = emptyLogger() logger = struct('parameter',{},'iteration',{},'values',{},'PRAUC',{},'stdPRAUC',{},'dims',{}); end
clear all close all load('D:\abanobi\Documents\STAGE ISTERRE\gueguen\Archive\ERGATZ\CS2\060304_1326.002.mat') vector = Z(:,2); dt = 0.005; sampling_period = dt; sampling_freq = 1/sampling_period; xt = 0:sampling_freq/(length(vector)):sampling_freq-sampling_freq/(length(vector)); Z_fen = zeros(12000,29); Z_...
% Uses PCA to get the best possible basis functions for the bi-exp filter function [B_PCA] = PCA_basis(Sim_Struct, time_vec) display('-I- Creating PCA basis matrix...'); %% Get relevant parameters from simulation struct % Time parameters % sec_inter = Sim_Struct.sec_interval(1); % total_sim_time = ...
% This MATLAB program checks the feasibility of LMIs from Theorems 1 and 2 of the paper % A. Selivanov and E. Fridman, "Predictor-based networked control in the presence of uncertain time-varying delays," in 55th IEEE Conference on Decision and Control, 2016, pp. 501–506. %% LMIs of Theorem 1 % System parameters ...
%x = quadprog(H,f,A,b,Aeq,beq,lb,ub) n=10; e=ones(n,1); mu=randn(n,1); S=randn(n); S=S*S'; r0=1; [w,minvar]=quadprog(S,zeros(n,1),-mu',-r0,e',1,zeros(n,1),e);
% Finite Difference Model of Geotherm + Surface Temperature Warming % Jan 25 2016 clear all figure(1) clf %% BOREHOLE DATA load cape_thompson.dat; data_depth=cape_thompson(:,1); data_T=cape_thompson(:,2); %% INITIALIZE %Constants k = 2.5; %W/mK rho = 2000; %kg/m3 Cp = 2000; % J/kg K kappa = k/(rho*Cp); %Space Arr...
function [glmModel] = designMatrixBlocks(selectedArray,glmnetOpt,glmModel) basisFunction = normalize_var(normpdf(-1*glmnetOpt.bf.bfwidth:glmnetOpt.bf.bfwidth,0,glmnetOpt.bf.bfstd),0,1); for i = 1:length(selectedArray) currentCell = selectedArray{i}; %Defining features touchDurMat = zeros(currentCell....
clc;clear;close all a=0:0.01:90; b = 2*(1-a/90)-tan((90-a)/2/180*pi); plot(a,b,'LineWidth',1.8) xlabel('\theta_s') ylabel('\lambda_s') set(gca,'fontsize',16); grid on axis([0 90 0 1]) set(gca,'xtick',0:10:90)
n = 1/2; while(n >= 1/512) fp = (-3*e.^(0) + 4*e.^(0+n) - e.^(0+2*n))/(2*n); display(fp); n = n/4; end
function [net,X,Xi,Ai,T,EW,Q,TS,err] = config(net,X,Xi,Ai,T,EW,configNetEnable) % NNTRAINING.CONFIG % Copyright 2010-2015 The MathWorks, Inc. % Define default return values in case error is returned. if nargin < 7, configNetEnable = true; end Q = []; TS = []; % Input % Missing inputs filled in with 0 column values i...
function q = DiscriminationTask(varargin) % PSychophysics expeirment for UFlicker. The oberserver is presented with a % fixation point. Then the background moves and at some variable time % defined by objDelays the two patches appear on either side of the % fixation point. THe task is to identify the highest contrast ...
clear; clc; %% Preset Users = 200; PacketLength = 1; %% ALOHA simulation Cursor = 1; %data cursor for arrays for p = 0:0.0001:1 %arrival rate (per unit time) G(Cursor) = Users * p; %average arrival rate (per unit time) % Pure ALOHA TimeSlot = 0.01; PacketDuration = PacketLength / TimeS...
function goodBoxesNonDups = detect_object( image_path, offset, slice,fidelity,car_model) %UNTITLED Summary of this function goes here % Detailed explanation goes here addpath(genpath(('/home/ivashish/voc-dpm-master'))); im = imread(image_path); %load('VOC2007/car_final.mat'); tt = tic; goodBoxesNonDups = process(i...
load data new_cv = [2, 2; 3, 2]; D = [1, 2; 2, 1; 3, 1; 5, 5; 5, 6; 6, 5; 6, 6]; % C = [0.4, 0.7; 0.6, 0.3]; figure scatter(D(1:end, 1), D(1:end, 2)); hold on scatter(C(1:end, 1), C(1:end, 2)); axis([0 8 0 8]) grid on n = 0; while n < 10 new_cv = competitive_learning(D, new_cv, 0.4); figur...
function A=FUNfivePointLaplacian(n) % This function constructs a five-point Laplacian matrix for an n x n % mesh, with periodic boundary conditions A=zeros(n^2,n^2); for i=1:n^2 if(i>(n-1)*n), NORTH=i-(n-1)*n; else, NORTH=i+n; end if(i<n+1), SOUTH=(n-1)*n+i; else, SOUTH=i-...
function [score] = KL(map1,map2) % map1: Saliency map % map2: Fixation map %make sure map1 and map2 sum to 1 if any(map1(:)) map1 = map1/sum(map1(:)); end if any(map2(:)) map2 = map2/sum(map2(:)); end % compute KL-divergence score = sum(sum(map2 .* log(eps + map2./(map1+eps)))); end
function rv = bandstop(F, band) %BANDSTOP: Remove frequencies in band from spectrum % rv = BANDSTOP(F, band) % - F : Fourier spectrum (one or more channels) % - band: threshold frequencies (vector [low high]) [A, B] = size(band); if(A~=1 && B~=2 && isinteger(band(1))~=1 && isinteger(band(2))~=1...
%% stadio 2 function [Cin, W23, W24, W25] = stadio22(tau22) % constants Cox = CoxCapacity(); % channel lenght L = 0.12*10^-6; % load capacity for this stage Cl22 = 100 * 10^-15; % delay for this stage % ratios ratio23 = ratioMos('P', Cl22, tau22); ratio22eq1 = ratioMos('N', Cl22, tau22); ratio24 = ratio22eq1 *...
function [naivetime,blockedtime,opt_blockedtime] = test(n,b) A = randn(n); B = randn(n); tic, C = naive(A,B); naivetime = toc; tic, D = blocked(A,B,b); blockedtime = toc; tic, E = optimal_blocked(A,B,b); opt_blockedtime = toc; assert(norm(C-D)/norm(C) < 1e-14); assert(norm(C-E)/no...
clc; clear; close all data_dir = './'; fig_dir = './figs/'; fn_test = 't10k-images-idx3-ubyte'; fn_test_label = 't10k-labels-idx1-ubyte'; fn_train = 'train-images-idx3-ubyte'; fn_train_label = 'train-labels-idx1-ubyte'; %% read training images + labels fid_train = fopen([data_dir, fn_train]); % images [magic_train, ...
function [orbs,orbitin] = findorbit(ring,varargin) %FINDORBIT find the closed orbit % %Depending on the lattice, FINDORBIT will: % - use findorbit6 if radiation is ON, % - use findsyncorbit if radiation is OFF and ct is specified, % - use findorbit4 otherwise % %[ORBIT,FIXEDPOINT]=FINDORBIT(RING,REFPTS) % % ORBIT: ...
% Umbenennen eines Roboters in den Ergebnissen der Maßsynthese % Wird benutzt, wenn in der Roboter-Datenbank ein Roboter umbenannt wird % und die Ergebnisse mit der aktuellen Programmversion reproduziert werden % % Eingabe: % OptName % Name der Optimierung (z.B. 'ARK_3T2R_20220114_plfmorph') % RobNameOld % Vorheri...
function medusaMuxInit(nodeid, muxaddr) % function medusaMuxInit(nodeid, muxaddr) % % This is part of the Medusa software suite. % Pascal Stang, Copyright 2006-2012, All rights reserved. % % $LICENSE$ global MEDUSA global sock % setup I/O port directions data = [ hex2dec('40')+muxaddr 2 hex2dec('0006') ];...
function [edv]=multinomial(Xtr, xltr, Xdv, xldv, epsilons) edv = []; wc=[]; wc0=[]; pred=[]; classes=unique(xltr); N=rows(Xtr); pri=[]; post=[]; for e=1:columns(epsilons) for c=1:rows(classes) i=find(xltr==classes(c)); NC=rows(i); pri=[pri;NC/N]; xn=sum(Xtr(i,:)); xnd=sum(sum(Xtr(i,:))); auxpost=xn/xnd;...
% step piezo voltage and scan VNA; % WTJ, 20180914 % WTJ, 20180922 % WTJ, 20190923 % For each detuning, take EOM dark, EOM, wide on-chip, narrow on-chip. side = 'R'; V_bg = 2.7; piezo_smoothset(V_bg); pause(0.5) Ps = getPs(instrs); hsattenSet_fast; %% % Reset the VNA and scan. % initZNB_wide_100Hz; % zn...
function argStruct = generateContinuousStochasticPolicyFcn(argStruct,numericSpec) % GENERATECONTINUOUSSTOCHASTICPOLICYFCN generates continuous stochastic % policy (use for PG, AC, etc. agents) % Copyright 2019 The MathWorks, Inc. % REVISIT: should this method live in sampling strategy? outputstr = argStruct.Outp...
function [ varargout ] = DrawBox( xlim,ylim,zlim, varargin ) %DRAWBOX Draws wire box specified by xlim, ylim, zlim % xlim, ylim and zlim are a 2x1 array % varargin goes directly to the plot3 function. Specify parent if % necessary! Handy fact - if a 4th element for color is specified, it is % the transparency o...
% This is a class to wrap up a generic ChomboOutput class with specific MushyLayer % functionality classdef MushyLayerOutputOld < handle properties chomboOutput mlComps end methods function obj = MushyLayerOutputOld(dim, frame, output_dir, plot_prefix) obj.mlComps =...
clear all close all warning off addpath('./functions'); addpath('./AgrawalICCV05MatlabCode'); EnvMap = 5; %%%Demo PARAMETER: Environment Value %%CHOOSE DIFFERNECE VALUES GHERE FOR DIFFERENT IMAGES FROM THE "../images" folder interactive = 0; %DEMO PARAMETER Interactive Normals. Set this to "1" NormalsUnif =...
%% figure,co=get(gca,'ColorOrder'); set(gcf,'DefaultAxesColorOrder',co([1 2 3 5 7 6 4],:)); plot(ldr_flat_slant_range.time,ldr_flat_slant_range.signals.values,... ldr_ellipsoid_slant_range.time,ldr_ellipsoid_slant_range.signals.values),grid cf=gcf;figs=cf.Number; xlabel('Time, sec'),ylabel('meters') fig_text='Sla...
function p = hex_to_int16(h) %HEX_TO_INT16 Convert hexadecimal string to int16 number. % % HEX_TO_INT16(H) converts the hexadecimal string H and returns the % corresponding int16 numbers. Each row in H, representing one output value, % must only contain characters in the set '0123456789abcdefABCDEF'. % % For e...
% julia fractal close all; figure; load('0.julia.mat'); %mattread('0.julia.matt'); imshow(I); F = getframe(gcf); [I, map] = rgb2ind(F.cdata, 256); imwrite(I, map, 'julia.gif', 'gif', 'Loopcount', inf, 'DelayTime', 1); for ii = 1:149 load([num2str(ii) '.julia.mat']); %mattread([num2str(ii) '.julia.matt'])...
clear; clc; addpath Model Utilities %% data set setting dataset.name = 'GT_32x32'; dataset.tr_num = 8; dataset.random = 0; dataset.normalization = '255'; [train, test] = loadDataset(dataset); %% Learning Dictionary from class-specific training data params.num_Vi = 8; params.num_G = 40; params.maxIter = 20; params....
function pa_genexp_avam_snd % PA_GENEXP_SPATIALPRIOR % % This will generate an EXP-file of a spatial prior learning % experiment. EXP-files are used for the psychophysical experiments at the % Biophysics Department of the Donders Institute for Brain, Cognition and % Behavior of the Radboud University Nijmegen, th...
function fitpar_selected = select_fitpar(fitpar,keep_only) % Build a structure, containing selected fitpar parameters % fitpar_selected=struct(); fitpar_selected.p = fitpar.p(keep_only); fitpar_selected.sig =fitpar.sig(keep_only); fitpar_selected.bp = fitpar.bp(keep_only); fitpar_selected.bsig =fitpar.bsig(keep_only)...
function run_svm_t(setting) setpaths data = load_data(setting); result_dir = sprintf('result_%s', setting); if ~exist(result_dir, 'dir') mkdir(setting); end C = 1; func = 'main_svm_t'; kernel_types = {'linear', 'poly'}; kernel_params = {0, 1.1:0.1:1.5}; N_set = [2 4 6 10 15 20]; for i = 1 : length(N_set) N...
%%read image i = imread('~/Desktop/4.png'); j=rgb2gray(i); %figure out the pad value to pad to white if isinteger(j) pad = intmax(class(j)); else pad = 1; %white for floating point is 1.0 end [r, c, ~] = size(j) if r > c newImage = imresize(j, 512 / r); newImage(:, end+1 : 512, :) = pad; elseif c > r ...
function [pcaA V] = fastpca( A, k ) % 快速PCA % % 输入:A --- 样本矩阵,每行为一个样本 % k --- 降维至 k 维 % % 输出:pcaA --- 降维后的 k 维样本特征向量组成的矩阵,每行一个样本,列数 k 为降维后的样本特征维数 % V --- 主成分向量 [r c] = size(A); % 样本均值 meanVec = mean(A); % 计算协方差矩阵的转置 covMatT Z = (A-repmat(meanVec, r, 1)); covMatT = Z * Z'; % 计算 covMatT 的前 k 个本征值和本征向量 [V D]...
function [ boolVec ] = detectAlternans( ACI,threshold ) %UNTITLED Summary of this function goes here % Detailed explanation goes here counter=0; % threshold=0.2; boolVec=zeros(length(ACI),1); detect=7; for i=3:length(ACI) if(ACI(i-1)-ACI(i-2)>threshold && ACI(i)-ACI(i-1)< -threshold) || (ACI(i-1)-ACI(i-2)<-thres...
function C = correlation_fun(corr,mesh1,mesh2,spthresh,matvec,x) % CORRELATION_FUN returns the correlation matrix (or times a vector). % % C = correlation_fun(name,c0,c1,sigma,mesh1,mesh2,spthresh); % C = correlation_fun(name,c0,c1,sigma,mesh1,mesh2,spthresh,matvec,x); % % Outputs: % C: Either a sparse correlati...
function varargout = set_reference_stateD(varargin) [varargout{1:nargout}] = CoolPropMATLAB_wrap(328,varargin{:}); end
function y = sigmoid(x,t,a) narginchk(1,3) if nargin<3 a = 1; else assert(isscalar(a)==1,'a must be a scalar.') end if nargin<2 t = 1; else assert(isscalar(t)==1,'c must be a scalar.') end %% Perform mathematics: y = 1./(1 + exp(-a.*(x*t))); end
function plot_3DPose(points, nKeyPoints, edges, LiWi, colors ) scatter3(points(:,1), points(:,3),points(:,2), 400, 'k.', 'LineWidth',1) hold on % for pointid = 1:nKeyPoints % if any(pointid == [5,6,7,13,14,15,16]) % label_ = [num2str(pointid),'L']; % elseif any(pointid == [9,10,...
function rb = FK_exp_7dof %% manipulator twists W1 = [0 0 1]'; W2 = [0 -1 0]; w1 = W1; q1 = [0;0;0.2025]; w2 = W2; q2 = [0;0;0.2025]; w3 = W1; q3 = [0;0;0.2025]; w4 = -W2; q4 = [0;0;0.2025+0.42]; w5 = W1; q5 = [0;0;0.2025+0.42]; w6 = W2; q6 = [0;0;0.2025+0.42+0.4]; w7 ...
%% harmonyA.m % % genrate a 440Hz tone Fs = 8000; % sampling rate sep = power(2, 1/12); A = 440; %tone A frequency Cs= A*power(sep, 4); % tone C# E = Cs*power(sep, 3); % tone E t = (0:1/Fs:2); % from 0 to 2 second % we reduce the amplitude by 0.2 to avoid distotion. % add the three tones y = 0.2*(sin(2*pi*(A...