text
stringlengths
8
6.12M
% clear;clc; %load align wave param.hop = 1; param.sr = fs; [feat,t] = yin_best(result,param); %get freq_tbl f0 = feat.f0; best = feat.best ; pwr = feat.pwr; best_idx = find(best == 0); idx_exclude = 1:length(f0); idx_exclude(ismember(idx_exclude,best_idx))=[]; f0(idx_exclude) = nan; f0(find(f0>500)) = nan; f0_syn ...
% Network of Izhikevich Neurons learns the first bar of Ode to Joy % song note data is located in the file ode2joy.mat. clear all clc T = 1000000; %Network parameters and total simulation time dt = 0.04; %Time step nt = round(T/dt); %number of time steps N = 5000; %number of neurons %% Izhikevich ...
function list=variable_selection(compname,return_list) %function variable_selection % This function is for use with the input figure. It determines the list of components currently % active for variable editing purposes. It also determines what list of variables is available for each % currently active component. It...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % CandLES_CommSim - GUI for showing Communications Results % Author: Michael Rahaim % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Suppress unnecessary warnings %#ok<*INUSL> %#ok<*INUSD> %#ok<*DEFNU> function...
% Change the following lines to math your own repositories addpath('/PATH/TO/SPM') % ADD the path to your SPM repository basedir = '/path/to/your/repository/' % Change this line with the pat to the downloaded github repository %%% SETTINGS %%%% subjdir = fullfile(basedir, 'Sub_359'); jobdir = fullfile(basedir, 'JOB...
close all X = [0 0]; h =plot(X(1),X(2), 'o') maxAx =5; axis([-maxAx maxAx -maxAx maxAx]) hold on title('n = 0') pause() %Four step directions Step = [-1 0;1 0;0 1;0 -1]; for n =1:2000 delete(h) direction = randi(4); %random direction uniform integer in [1,4] dX = Step(direction,:); plot([X(1) X(...
function [Width, Height] = getLipSize(img1) [Width, Height, Dim] = size(img1); end
function barerrors(errors,data) % barerrors usage: % % barerrors(errors,data) % % Plots a bar chart (as if bar(data) was called), but with error-bars % given by ERRORS. Designed for use with barcharts.m % % Created by MT Cherukara, 8 November 2017 % % CHANGELOG: % make sure the input data is legit assert(size(da...
function class = classify_gaussian(model, xtest) length = size(xtest, 1); features = size(xtest, 2); class = zeros(length, 1); for i=1:length p1 = model.prior(1); for j=1:features mu = model.likelihood(1).feature{j}(1); sigmasquare = model.likelihood(1).feature{j}(2); c = -log((2*pi*sigm...
function fig = AutoCorrFig(t,trange,units) % AutoCorrFig: interactively view the autocorrelation for a spike train % AutoCorrFig(t,tmax,units), where % t is the vector of spike times % tmax is the largest time separation to consider % units is a string giving the name of the units in which time is measured % ...
N=256; sig = zeros(1,N); fs = 4000; for i=1:N if i/N*fs < fs/16 sig(i) = 1; end end sig(N/2+1:N) = wrev(sig(1:N/2)); figure; plot(linspace(0,1,256),sig) title('Ideal filter'); hk = ifftshift(ifft(sig)); for i=1:N if hk(i) == max(hk); maxelem = i; end end maxelem; 129...
% This is the driver layer of the TRM model but for sWBGT. Similar to the TRM model for Ts, it includes 3 main components: % 1, the TRM attribution itself (see Rigden and Li, 2017, Liao et al. 2018, Li et al. 2019, Wang et al. 2019), % 2, the optimization of m described in Liao et al. (2018 JGR-biogeosciences), % 3,...
%% BSD License %Copyright (c) 2010, The MathWorks, Inc. %All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, are permitted provided that the following conditions are %met: % * Redistributions of source code must retain the above copyright % notice, this...
function [y] = logiunpack(cv) y=zeros(length(cv)); for j=1:length(cv) for i=1:length(cv{j}) y(j,cv{j}(i))=1; end end y=logical(y); end
%Lotanna Ezenwa, Problem Set 6, #2 %PS6_1.m %% Due Wednesday, May 4, 2016 clear me = LotaEzenwa(); code = me.id; PS_6_2
% data: x, y LeastOscN = 15; [A,B,C,D,freq,td,ci] = toolbox.data_tool.fitting.sinDecayFit_auto(x,y); h = figure('Position',[0,0,1000,500],'Color',[1,1,1]); plot(x,y,'bo','MarkerSize',10,'MarkerEdgeColor','b','MarkerFaceColor','b'); hold on; if ischar(A) disp(...
% Aaron Ma % 20091536 % March 14th, 2017 % EESM5700 HW 1 - Problem 3.1 % ------------------------------------------------------------------------- % Clear workspace before starting script clc; clear; close all; % ------------------------------------------------------------------------- % Read the target image I = im...
% Simulatore non lineare % close all % clc % Vettore tempo e algoritmo di risoluzione equazioni differenziali tspan = 0:1e-2:5; [tnl,y] = ode45(@(t,y)pendulumOdefun(t,y,K),tspan,[0;0;theta0;0]); % Estrai risultati e confronta con il caso linearizzato xnl = y(:,1); vnl = y(:,2); thetanl = y(:,3); wnl = y(:...
%deconstructs filename and then reconstructs a rank n approximation for it function reconstruct(filename,n) %Read in the given image A = double(imread(filename)); %Since this is a black and white image, the other layers are unimportant B = A(:,:,1); %Performs singular value deconstruction [U,S,V] = svd(B); %Stores ...
allsubs = 1%[1:5 7:15 17:44 46 47 50 51 53:57]; backofhead = [1 14:22 25:38 41:50 54:57]; %New channels of interest: back of head midofhead = [2:13 23:24 39 40 51:53 58:66]; %Middle of head frontofhead = 67:96; %Front of head thesections = ['B' 'M' 'F']; cleaneventall = cell(180, 1); counter = 0; for s = allsubs ...
figure; t = 0:0.002:2; szum = randn(size(t)); subplot(2,2,1); y1 = sin(3*t); plot(t,y1); grid on; axis([0,2,(-2),2]); xlabel('t'); ylabel('y'); title('y = sin(3t)'); subplot(2,2,3); y2 = 0.3 * sin(10*t); plot(t,y2); grid on; axis([0,2,(-2),2]); xlabel('t'); ylabel('y'); title('y = 0.3sin(10t)'); subplot(2,2,2); plot...
function rec_para = Rec_fitting(X,Y,para0,plotflag,imgL,imgW,L0coe) %The Rec_fitting() function computes the five paremeters of Xc,Yx,L,W,alpha %of a fitted rectangle from the position information of a set of points in %the edge of the rectangle. % input: % X,Y: The position of points in the edge of the recta...
function [ bs, Sflag ] = dbBar(Code, start_date, end_date, slice_seconds, slice_start) % 每次只能取一种合约 % Code 为证券代码,股票的如 '600000.SH', 股指的如 'IF1312'(连续合约 'IF0Y00', 'IF0Y01', 'IF0Y02', % 'IF0Y03', 主力合约 'IFHot') % start_date为起始时间 % end_date为终止时间 % slice_seconds 表示切片长度,可以是数组如[60,90,120] % slice_start 表示开始时间,默认是0, 否则要与slice_sec...
% CSE 848: Evolutionary Computation Semester Project % Authors: Farhan Hormasji and Bonnie Reiff %% plotParetoEvolution_exponentialSamplingScale: TODO % Input: inputDir, the name of the folder of results to use (one folder % level about unified_nsga3) % indicatorName, the name of the indicator to be ...
function [T1,T2, expl1, expl2] = extractFilterPC( CouplingFilter, Lc ) %% warning off; clear x LL = Lc./1e4; ind = find(LL>0.3); ct = 0; for i = 1:length(ind) ct=ct+1; x(ct,:,:) = cell2mat( CouplingFilter{ind(i)} )'; end; x = permute( x, [2,1,3] ); % numMD x numPFC x time for i = 1:si...
% MP2: Doppler Sensing for Velocity Calculation of Hand Motion % % read input text and access points data % fileID = fopen('input2.txt','r'); formatSpec = '%f'; Input = fscanf(fileID,formatSpec); %Input about relevant info read fclose(fileID); % parse the data from input file % client_location_x = Input(1); client_l...
function g = sigmoid(z) %SIGMOID Compute sigmoid functoon % J = 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 [] = showFit(timeAvgData,florisObj,florisObjOpt) if nargin < 2 plotFloris = false; else plotFloris = true; end if nargin < 3 plotFlorisOpt = false; else plotFlorisOpt = true; end %% Plotting time-averaged flow slices for i = 1:length(timeAvgData) if max(abs(diff(timeAvgData(i).cellCente...
function thresh_histo(file,outdir,T) % % FILE: .nii or .mgz MRI volume fullpath % OUTDIR: dir to place binary files % T: threshold value % if outdir(end) ~= '/' outdir = [outdir '/']; end fprintf('Loading histology volume...\n'); vol = MRIread(file); volume = vol.vol; [rows cols N] = size(volume); fprintf('C...
function [y]=choose_real(x) n=length(x); i=1; while ((isreal(x(i))==0 || x(i)<=0) && i<n) i=i+1; end; y=x(i);
clear, clc; % k1 = 149.6576; % k2 = 72.8484; % k3 = 35.4401; % % k1 = 156.0963; % k2 = 19.9845; % k3 = 80.6076; % % k1 = 55.9318; % k2 = 111.3363; % k3 = 101.9553; k1 = 120.1527; k2 = 103.8403; k3 = 106.6672; zf=2.8; a1=0.2467; b1=-2.6681; c1=zf; a2=-1.9508; b2=1.9228; c2=zf; a3=2.9096; b3=2.1517; c3=zf; x1=74;...
function plotDCsimulation( fracInBounds, flexValues, storageAtSameBusFrac, optimalStorageFrac, optimalLoc) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here x = [0,(max(flexValues(:)))]; if optimalLoc hold on plot(flexValues(:),fracInBounds(:), '-ok', 'LineWidth', 4); plot(x...
% run Quant_SF % run Optim_SF % run Optim_SF2 % run GA_SF load Quant_SF load Optim_SF load OPtim_SF2 %% Figure Fsz = 18; Fsz_label = 14; Msz = 9; Msz_diff = 2.5; Ngen = 1e4; % # of generations of GA Niter = length( Nsol ); % # of iterations of the proposed method eval( ['load GA_SF_gen' num2str(Ngen)] ) figure; semi...
% READ % This is an edited version of load_noiseless_images to be compatible with % ImgTestGui and related code. % load_noiseless_images % This script loads the jth image of ith stack and it is such a common block % in all programs that I am saving this as a script, % I have removed this from the moviemaker scr...
function data = batchDetectParticles(fileNames,fcn) %batchProcessFiles Process image files. % SEQUENCE = batchProcessFiles(FILENAMES,FCN) loops over all the files % listed in FILENAMES, calls the function FCN on each of them, and combines % the results in SEQUENCE. FCN is a function handle for a function with % ...
%%% Laboratoire 4 MTH1210 Philippe Lacasse-Labelle, Antoine Busque clc; close all; %% Question 1 % Donnees t0 = 0; y0 = 1000; h = 1; nbpas = 30; % a) et b) à la main, voir rapport % c) % Donnees m = 100000; k = 2.0e-6; t = 0:1:30; solAnalytique = 1./((1./1000 - 1./m).*exp(-k.*m.*t) + 1./m); % Trouvee a la main [t,y...
send = mididevice('to Max 1'); receive = mididevice('from Max 1'); msg = midimsg('ProgramChange',1,2); receivedMessages = midireceive(receive) midisend(send,msg) %% wait until entering something while 1 receivedMessages = midireceive(receive); if isempty(receivedMessages) == 1 continue ...
function result= check_grid(matrix,i ,j ,num) %input: the unsolved sudoku puzzel, namely 'matrix'; position index i,j; and %possible values %output: whether the possible values can be filled in the current cell or %not %This function returns a result (true or false) to determine whether a %blank cell can be fille...
%----------------------------------------------------------------- % % M-file: radiator.m counter-current heat exchanger % % Kristina Haraldsson, NREL %----------------------------------------------------------------- function f=radiator(u,Tamb,Trad,U,Tcool,kw,dpipe,Lpipe,etablow,Tcell,g,drad,Lrad,Nrad) m_W=u(1); ...
% script dispersion_curves % This script, like the script dispersion_plots, generates a 2_D set of % non-dimensional frequency and wavespeed values at which the plate wave % dispersion relations for symmetrical or anti-symmetrical plate waves are % evaluated. The dispersion curves are then plotted with the MATLAB ...
% Test FETI-DP %clc; clear all; close all; idx = importdata('Blocks.txt'); Nblocks = length(idx)-1; % B = B(:,1); A = mmread('A.mm'); B = mmread('B.mm'); P = mmread('P.mm'); % figure; spy(A) % figure; spy(P) % e = eigs(A\(A+P),50,'lm'); % figure; plot(e) A = (triu(A,0) + tril(A.',-1)); % X = A\B; % fp...
function [ l ] = dispOpt( obj ) %DISPOPT 输出显示期权的相关信息 % 程刚,20151120 l = ''; if obj.CP == 1, cp = 'call'; elseif obj.CP==2, cp='put'; else cp='na'; end l = sprintf('%s, %s(K=%0.2f, T=%0.4fyr), %d ',obj.secCode, cp, obj.K, obj.T,obj.quoteTime); l = sprintf('%s\n px qt vol',l); l = sprintf('%s\nlast: %7.4...
%wcon_questions %{ 1) metadata.who - arrayed set of JSON strings (is a string allowable?) %}
%Save policies into file function z_savePolicies(Q,m,filepath) fileID = fopen(filepath(:),'a'); %if first map print legend before if(m==1) fprintf(fileID,'legend: \n'); fprintf(fileID,'#: action is indifferent (Q values equal for all state, action pairs) \n'); fprintf(fileID,'?: 2 a...
function ElectrodeGrid = CreateGeometry3DElectrode(Channel, ChanLoc, varargin) %% Optional params % nVert -number of vertices for each electrode, default: 32 % ctColor - sphere color. default: [.9,.9,0]; % YELLOW % elecAlpha - alectrode alpha. default: 1 % sizeScale - size scale ...
function err=poisson_fft3z_test disp('poisson_fft3z_test') fprintf('against poisson_fft2: ') n=[10,15]; h=rand(1,2); F=rand(n); u2=poisson_fft2(F,h,-1); u3=poisson_fft3z(F,h); fprintf('err=%s\n',norm(u3-u2,inf)); n=[500,500,24]; fprintf('3D Poisson equation size %d %d %d: ',n) % params h=rand(1,3); u=rand(n); d=rand(1,...
theta=pi/2; k_0=[3/5;0;4/5]; R0B=eye(3)+sin(theta)*matcross(k_0)+(1-cos(theta))*(matcross(k_0))^2; p_0=[1;-1;1]; p_B=R0B'*p_0 R0C=eye(3)+sin(pi/4)*matcross(k_0)+(1-cos(pi/4))*(matcross(k_0))^2 p_C=R0C*p_0
function F=f_assembly_fortran(A,X,u0, lambda, params) % call fortran version F= f_assembly(A,X,u0); if params.test_fortran disp('testing if sparse assembly of F same result in fortran') exe = './fortran/f_assembly_test.exe'; if exist(exe,'file') %Writing all arrays to text files for use by fortra...
clear; clc; CF_data_process; load('Dis_CF.mat'); load('final_table.mat'); final_table = final_table/sum(sum(sum(final_table))); test_num = 100000; range_label = 0:5:115; range_rate_label = -10:1:8; v_label = 20:1:40; dis_R = 5; dis_RR = 1; dis_V = 1; possi = 0; possi_list = []; NDD_scenario_set = zeros(test_num,303); ...
classdef particle < handle % A particle for particle swarm optimization. % https://en.wikipedia.org/wiki/Particle_swarm_optimization properties c % = input constants % c.f = function handle for function to minimize % c.lb = lower bound for search space % c.ub...
% path = 'C:\Challenge\motorcycle'; path = 'D:\test\playground'; GT = readpfm(['D:\test\playground\disp0.pfm']);%Modify D = disparity_map(path); % GT = uint8(GT); % [I,ndisp_calib] = input_data(path);%Read im0.png and im1.png from the specified path and read the given ndisp from calib.txt % ndisp = 20; % [Dis...
clear; tic; d = 50; % In km lambda_l = 10; % Density of point process along the axes that gnnerates lines lambda_c = 0.5; % Density of points points/km (1 per km) num_iterations = 100000; min_pathdist(num_iterations) = 0; numhl = poissrnd(lambda_l*(2*d),1,num_iterations); % Number of horizontal line...
function [ Ego_cent ] = ego_cent( matrix,n ) %UNTITLED Summary of this function goes here % Detailed explanation goes here for i = 1:n V =find(matrix(i,:) ==1); S = [i V]; Adj_temp = subgraph(matrix,S); Cent = brandesBetwCentr(Adj_temp); Ego_cent(i) = Cent(1); end end
function pass = uq_SVC_selftest(level) uqlab('-nosplash'); if nargin < 1 level = 'normal'; % TBD: Time that the tests will take end pass = 0; %% Test Names are defined here TestNames = {'uq_SVC_test_LossTypes', ... 'uq_SVC_test_ExpDesigns', ... 'uq_SVC_test_OptimAlgorithms', ... ...
function [A, B] = covScale(cov, hyp, x, z) % meanScale - compose a mean function as a scaled version of another one. % % k(x^p,x^q) = sf^2 * k_0(x^p,x^q) % % The hyperparameter is: % % hyp = [ log(sf) ] % % This function doesn't actually compute very much on its own, it merely does % some bookkeeping, and calls other...
% Copyright is with the following author(s): % % (c) 2012 Juraj Oravec, Slovak University of Technology in Bratislava, % juraj.oravec@stuba.sk % (c) 2012 Monika Bakosova, Slovak University of Technology in Bratislava, % monika.bakosova@stuba.sk % ------------------------------------------------------------------------...
clear all clc load s load v_ref load v_ref_ori load v_lim load gradient gravity = 9.81; mass = 286000; max_trac = 310000; max_accel = max_trac/mass; max_speed = 22.2; max_brake = 260000; max_decel = -(max_brake/mass); Davis = [0.005 0.23 2965]; if you want to test the system using step input, unco...
function ReRank() global POP_STRUC TEMP_STRUC = POP_STRUC; N = length(POP_STRUC.POPULATION); N_atom = zeros(N,1); for i = 1:N N_atom(i) = sum(POP_STRUC.POPULATION(i).numIons); end [nothing, ranking] = sort(N_atom, 'descend'); for i = 1:N POP_STRUC.POPULATION(i) = TEMP_STRUC.POPULATION(ranking(i)); end
classdef ModuleDE < AlgorithmModule %ModuleDE DE module implementation % Implementation of the module for the Differential Evolution % algorithm properties prefix = 'DE'; name = 'Differential Evolution'; end properties (Access = private) lblDiffFactor; ...
function proportion_replay_modulated_all(label,savelab,igroup,savefolder) cd('F:\XY_matdata\AllDays') d2 = dir('*.mat'); %% SMI = []; PARM = []; dday = []; for id = 1:size(d2,1) thisdir = d2(id).name; load(thisdir,[label '_Cand_sig_modu_include'],[label '_pSSDarm'],'other_cells_touse') ...
function [I] = evaluate_vcoeff(isize, tpar, ivl) % render a trajectory into an image % % [I, T] = evaluate_vcoeff(isize, tpar, ivl) % % isize ... output image size; [height, width] % tpar ... trajectory parameters x(t) = a + b*t + c*t^2; format: [a,b,c] % could be a cell array of parameters -> then generates mult...
function [cann] = Compute_WoW(obj,mu_ann,pann,ann) %Compute_WoW Summary of this function goes here % Detailed explanation goes here if exist('dWodW.mexa64','file') cann = WoW(mu_ann,pann,ann,obj.c_i_vert,obj.c_n_vert,obj.c_sorted_tri,obj.c_n_sorted_tri,obj.c_i_tri,obj.c_tri,obj.c_n_tri,obj.c_n_vert); ...
image=imread('dilbert1.jpg'); image=im2double(image); %ginput% obtain corrdinates to extract templates % compute an averaged template template=(image(141:158,35:52)+image(161:178,380:397)+image(177:194,668:685))/3; % flip the template template=fliplr(template); colormap gray imagesc(template)% display t...
clear,clc, close all %% add necessary folders to the path addpath(genpath(fullfile(cd ,'..\..'))) %% RgjVals = [1e-3, 1e-2, 1e-1]; %Gohm gap junctional resistance ratio = 10; %Gkir/Gbg probeCell = 20; %index of the cell for Vm reading for i = 1:numel(RgjVals) Rgj = RgjVals(i); CapillarySegmen...
function [FiltLoc, newsignal]=ContinFilter(signal, tol) % v.2.0 by Yang Xi % 本函数将signal中有效信号连续数目小于tol的1直接过滤成0,并返回改变值的位置 % signal 是由 1 和 0 组成的数字串, 1 为有效,0 为无效 % tol 表示有效信号所要求的最短长度 % FiltLoc 表示被过滤值的位置 % newsignal 过滤之后得到的新信号 i =1; ntotal = length(signal); newsignal = signal; while i <= ntotal if newsignal(i) == 1, ...
function [struc] = generateProblemSpecs(struc) % Material Properties E = 8; nu = 0.3; stiffness_bound = 1e-6; % struc.B = E / (3*(1 - (2*nu))); % bulk modulus struc.G = E / (2*(1+nu)); % shear modulus struc.G = struc.G*ones(struc.nVertGrid,1); struc.B = struc.B*ones(struc.nVertGrid,1); struc.Bmin = stiffness...
function yv=effect_vibrato(x) % Vibrato global fs; frecmod=10; ancho=0.0008; ya_alt=0; Delay=ancho; % delay de la entrada en un segundo DELAY=round(Delay*fs); % delay basico en un numero de muestras ANCHO=round(ancho*fs); % ancho de modulacion en un numero de muestras FRECMOD=frecmod/fs; % Frecuencia de mod...
HexaneHeptaneOctaneNonaneDecane; C = [2;3;4]; cPr = cPr(:,C); cG = cG(:,C,C); cH = cH(:,C); ch = ch(:,C); alpha = alpha(C); %alpha =[2.535211267605634 1.478873239436620 1]; %paper -> okay %alpha = [2.708399906766324 1.362735689073346 0.730566195842380]; %fit curves -> very good %alpha = [2.708399906766324 1.362735...
xw = zeros(1,Nlump*Nstep+1); zw = zeros(1,Nlump*Nstep+1); xl = zeros(1,2); zl = zeros(1,2); vtTE = zeros(1,2); vnTE = zeros(1,2); vtw = zeros(Nlump*Nstep,2); vnw = zeros(Nlump*Nstep,2); vtlw = zeros(1,2); vnlw = zeros(1,2); sigma = zeros(Npanels,1); mu = zeros(Npanels,3); muTE = zeros(1,2); muW = zeros(1,Nlump*Nstep)...
A=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; 0.87 0.49 0.36 0.83 0.87 0.49 0.36 0.83 0.87 0.49 0.36 0.83 0.87 0.49 0.36 0.83 0.87 0.49 0.36 0.83 ]; ww = root(0.1,16); %以时间为准则层生成的IOWA权重 [tri,result1]=IOWAaggregation(A(:,1:16),ww);%result1为IOWA聚合结果 [result2,vga] = testVGA( A(2,:) ); %result2为vpa聚合结果 a=0....
%% %% Written by Sheel Nidhan % This code is used to calculate the TKE of the field that is obtained from actual data clear; clc; %% Reading the datafiles of u_x velocity field var = 'wp'; loc = '50'; nstart = 1892600; nend = 1892600; stride = 100; dir = '/home/sheel/Work2/projects_data/spod_re5e4/frinf/data_file...
function I = monte_carlo(a,b,n,fun) %This function works for monte carlo simulation t = rand(1,n); x = a + (b-a)*t; s = sum(fun(x)); I = s*(b-a)/n; end
function [c,ceq,gradc,gradceq]=initPos_nonlcon(x,p) ceq1 = hipPos_x(x.')-p.hipLen/2; ceq2 = hipPos_y(x.')-p.startH; ceq3 = toePos_x(x.')-p.toeLen/2; % ceq4 = heelPos_y(x.')+p.model.h_heel; ceq5 = toePos_y(x.')+p.model.h_heel; gradceq1 = dHipPos_x(x.'); gradceq2 = dHipPos_y(x.'); gradceq3 = dHeelPos_x(x.'); % gradceq4...
function S1 = fluidstressnearboundary1(V, boundx0,boundy0,boundu0,boundv0, opt) % function S1 = fluidstressnearboundary1(V, boundx0,boundy0,boundu0,boundv0, opt) % Given the boundary boundx0,boundy0,boundu0,boundv0, and the adaptive grid % data in V (representing a single time point), estimate the jump in fluid % stres...
function[data] =dataCollectionGrowth_Final(filename) %Copyright (c) 2021, Daniela A. Garcia-Soriano %All rights reserved. %The function will collect into a single .mat file all the outputs from any %ID function. Pay attention to the columns names since the only one that %has that order so far is IDcfu_datapixelFinal_t...
%把cell中的只有一个cell的元素提出.比如a=cell(1,2),a{1,1}=b,b是cell,但是1*1的cell那么a{1,1}=b{1,1} function c=extract_cell(mtr,col) mtr=mtr(:,col); [m n]=size(mtr); for i=1:m for j=1:n if iscell(mtr{i,j}) && size(mtr{i,j},1)==1 && size(mtr{i,j},2)==1 mtr{i,j}=mtr{i,j}{1,1}; end ...
function [h,R1_] = SolveModel(b0,a0,r0,mu0,sigma0) % Rutina para correr el programa completo de búsqueda de empleo, basado en Mauricio Tejada en Python. %CDF pd = makedist('lognormal','mu',mu0,'sigma',sigma0); %Iteraciones R0_=1; diff=10; tol=0.00001; step=0.5; fun = @(x) 1-cdf(pd,x); while diff>tol; R1_ = b...
function [descriptor] = pb_descriptor_Datum() %pb_descriptor_Datum Returns the descriptor for message Datum. % function [descriptor] = pb_descriptor_Datum() % % See also pb_read_Datum descriptor = struct( ... 'name', 'Datum', ... 'full_name', 'Datum', ... 'filename', 'datum.proto', ... 'contain...
clear clc num=500; node_num=1685; L(1:node_num,1)=0; for t=1:1:500 name=num2str(t, '%d'); txt_name=['D:\SIMULIA\Temp\3D\3D_L\SquarePlateWithHole3D_LTHERM1_LOAD',name,'.mtx']; f=fopen(txt_name); ALL=textscan(f,'%s','Delimiter',{','},'HeaderLines',2); all=ALL{1}; len=length(ALL{1,1})/3; for ...
%% YPOLOGISTIKH NOHMOSUNH 2021 PTUXIAKH EXETASTIKH %% NIKOLAOS ISTATIADIS AEM:9175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EPANALHPTIKH DIADIKASIA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EKPAIDEUSHS TOU MODELOU function [ALL_METRICS] = simpleModel_trn_eval_pred(numberMembershipFunctio...
function [x_plus,A,B] = expl_euler_numerical_ind(t0,x,u,A,B,h,Tfin) [x_plus, timegrid] = expl_euler_variable(t0,x,u,h,Tfin); epsilon = 1e-8; nx = length(x); nu = length(u); A = zeros(nx); B = zeros(nx, nu); E = eye(nx); Eu = eye(nu); for i=1:nx x_ = x + epsilon*E(:,i); ...
% part = 'rot'; part = 'transl'; errs_pc5p = eval(sprintf('%s_errs_pc5p', part)); errs_pc3prast0 = eval(sprintf('%s_errs_pc3prast0', part)); % errs_pc5p = transl_errs_pc5p; % errs_pc3prast0 = transl_errs_pc3prast0; fig = figure; set(fig, 'position', [100,100,200,200]); h = {}; for level = 1:numel(nstd_ray) ref...
function data = shuffle_columns(data) [nr nc] = size(data); for i=1:nc data(:,i) = data(randperm(nr),i); end
function BandPassFilter_demo %带通滤波器测试程序 fs=2000; t=(1:fs)/fs; ff1=100; ff2=400; ff3=700; x=sin(2*pi*ff1*t)+sin(2*pi*ff2*t)+sin(2*pi*ff3*t); figure; subplot(211);plot(t,x); subplot(212);hua_fft(x,fs,1); title('Original spectrum'); xlabel('f'); ylabel('amp'); % y=filter(bz1,az1,x); y=BandPassFilter(x,300,500,200,600,0.1,...
% Static force analysis of 2D Mitchel Truss 4 (Fig 4.6 of Skelton & de Oliviera 2009) % By Shuhang Zhang, UC San Diego student 2019. clear; clf;clc; figure(1); % Free [Q=Q_(dim x q)] and fixed [P=P_(dim x p)] node locations Fai = pi/8; Beta = pi/6; r=10*logspace(1,(sin(Beta)/sin(Beta+Fai))^5,5); Q(:,1)=r(1)*[1; 0]; Q(...
clear; clc; CF_data_process; load('Q_table_little.mat'); global Q_table_little; for i = 1:size(Q_table_little,1) Q_table_little(i,:) = Q_table_little(i,:)/sum(Q_table_little(i,:)); end load('Dis_CF.mat'); load('final_table.mat'); final_table = final_table/sum(sum(sum(final_table))); test_num = 100000; global range...
function [e] = test4(cleanup, level) %TEST4 Open all samples % Thomas Ruark, 10/30/2007 % Copyright 2007 Adobe Systems, Inc. psSamplesStr = psjavascriptu('localize("$$$/LocalizedFilenames.xml/SourceDirectoryName/id/Extras/[LOCALE]/[LOCALE]_Samples/value=Samples");'); pspath = psjavascriptu('app.path'); pspath = ...
% runme for the colorful stimulus % 192 TRs %% params = retCreateDefaultGUIParams; params.fixation = 'dot with grid'; params.tr = 1; params.skipSyncTests = 0; params.calibration = 'CBI_Propixx'; params.prescanDuration = 0; params.experiment ...
function ShowHouseQR(A) % function ShowHouseQR(A) % Illustrates Householder QR factorization. % matrix. A call of the form ShowHouseQR() uses a random 6x4 example. if nargin==0 A = randn(6,4); end [m,n] = size(A); clc fprintf('Householder QR\n\n') disp('A = ') fprintfM('%7.3f',A) [Q_fact,R] = HouseQR(...
function net = SaFIN_FRIE_train(data_point, net, input, output, IND,OUTD, no_InTerms, InTerms, no_OutTerms, OutTerms,Rules, Rules_Weight,Eta,forget, Forgetfactor,Lamda, tau, Rate, Omega, Gamma) thre_lam = tau*Lamda; %%%%%%%%%%%%%%%%%%%%%%%%%%%% RULE GENERATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
function [x_sim,z_sim] = im2sim_space(x_im,z_im,sys,USInfo) x_im = x_im - USInfo.radius*cos(pi-USInfo.t0); % center [th_im,r_im] = cart2pol(x_im,z_im); % to polar th_sim = th_im; r_sim = r_im + sys.dist_to_probe*1000; [x_sim,z_sim] = pol2cart(th_sim,r_sim); % leave x centered
function jp_equalizerms(inputDir,outputDir,verbose) %JP_EQUALIZERMS Equalize RMSs for a directory containing sound files. % % JP_EQUALIZERMS(INPUTDIR,OUTPUTDIR) takes all of the sound files in the % input directory, gets the mean RMS, and then saves copies in the output % directory that have been adjusted to the ...
clc clear all diary off cont=0; while cont==0 l=input(' enter temporal length L= '); n=input(' enter spectral length N = '); w=input(' enter hamming weight W = '); jbound=jb(n*l,w); temp=sprintf('\n \n \n \n no of codes approx. by jhonsons bound is %d',jbound); disp(temp) cont=input('pres...
% Using get_cov_matrices to save the covariance matrices windowSize=15; %ex t_interval timeStep=5; doNormalize=true; doDetrend=true; options=struct; options.save_to_disk=false; options.folder = 'test'; covStack = getCovMatrices(windowSize, timeStep, doNormalize, doDetrend,options); save('cov_stack_15Day_normalized_de...
%% init clear all; close all; clc globals(); featureDL_folder = '../feature-deeplearning'; [annotations_train, annotations_val, annotations_test] = loadAnnotations(); load(fullfile(devkit_folder, 'classes.mat')); % load classes %% Load Data Xtrain = []; Xval = []; Xtest = []; ytrain = []; yval = []; % load train fpr...
load 'LabeledLineSignaturesTestSet.mat'; load 'LabeledLineSignaturesTrainSet.mat'; load 'BlobSignaturesTestSet.mat'; load 'BlobSignaturesTrainSet.mat'; % Set size probability matrix szX = size(PatStringsTestSet, 2); szY = size(PatStringsTrainSet, 2); confusion = zeros(szX, szY); % Concatenate pattern string of blob a...
alpha=1e-3; lambda=0; rounds=1000; epsilon=1e-6; X=load('Breast_Cancer_Wisconsin_(Diagnostic)_Data_Set_UCI.txt'); Y=X(:,end); X=[ones(size(X,1),1),X(:,1:end-1)]; N=size(X,1); Xtest=X(round(N*0.7)+1:N,:); Ytest=Y(round(N*0.7)+1:N,:); Xtrain=X(1:round(N*0.7),:); Ytrain=Y(1:round(N*0.7),:); w=logi(Xtrain...
%% Opdracht_1 % Maak de volgende 3 variabelen aan: % data1 met de getallen 1 tot en met 10. % data2 met de getallen 11 tot en met 20. % data3 met de getallen 21 tot en met 30. % Maak een variabele genaamd data. % Sla data1 tot en met data3 op als kolomvectoren in de variabele data. % Schrijf deze variabele data weg als...
function new_AA = GenAMatrix(N0_range,c1,c2,c3,Lp,Ls,Ld,K,k,m) %load BGPricker.txt; %wavelet= BGPricker; load ricker.txt; wavelet= ricker; Wmatrix = convmtx(wavelet,length(Lp)-1);W = Wmatrix(1:length(Lp)-1,:);clear Wmatrix new_c1 = (1/2)*c1+(1/2)*k*c2+m*c3; new_c2 = (1/2)*c2; D = zeros(length(Lp)-1,length(Lp)); fo...
function amap = cplx_angio(root, threshold); % function amap = cplx_angio(root, threshold); [mdata h] = read_img(root); pdata = read_img(['p_' root]); Npix = size(mdata,2); amap = zeros(Npix,1); for pix=1:Npix rhos = corrcoef( mdata(:,pix) , pdata(:,pix) ); amap(pix) = rhos(2,1); end if isfield(h,'pixdim') h = ...