text
stringlengths
8
6.12M
function Lxx = vscopf_h(x, lambda, om, mpopt) % clear; % load('hdata.mat'); % [lambda,mpopt] = deal(Lambda,optns.mpopt); %OPF_HESSFCN Evaluates Hessian of Lagrangian for AC OPF. % LXX = OPF_HESSFCN(X, LAMBDA, COST_MULT, OM, YBUS, YF, YT, MPOPT, IL) % % Hessian evaluation function for AC optimal power flow, suita...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Facial Expression LSH-PCA-LDA % Version : 2.0 % Date : 01.2.2017 % Author : Mehdi Ghayoumi %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function SN=renoise1(mm) stat=0; len=0; start=0;...
function netplot(px,py,n) for i = 1:n plot(px(i,:),py(i,:),'k','Linewidth',2); hold on; end end
function [ b2deg,b1deg,bhalf ] = resmplbasin( id, Zbn ) %UNTITLED2 Summary of this function goes here % This function creates mask of 1 and 2 degree grid resolution from 0.5 degree grid % resolution mask file Zbn. It samples down the catchment mask to the resolution required % %-----------------------------------------...
%> @brief Return a set of indices for monotonically increasing data set X %> given slice points xi %> @expect That X and xi are both sorted %> @note Will be empty at the beginning function [C, xs] = split_data(X, xi) assert(issorted(X)); assert(issorted(xi)); len = length(X); count = length(xi); indices = nan(count, 1...
function b_corr = phaseDetrend(b,Ncenter,doSHOWPIX,fh) %PHASEDETREND: function for correcting phase by evaluating drift at % center of kspace %| %| Accepts "b-matrix" (raw data reshaped into {# data pts per echo} x %| {# of shots} x {# of slices}) and returns version of b corrected %| for phase drift %| %|...
% ------------------------------------------------------------------- % Generated by MATLAB on 28-Jul-2021 18:28:29 % MATLAB version: 9.8.0.1396136 (R2020a) Update 3 % ------------------------------------------------------------------- saveVarsMat = load('PyFracSim2_Time21600.mat'); widths = saveVarsMat.widths; % <1...
function test_lu % Test code for the quaternion lu function. % Copyright © 2011 Stephen J. Sangwine and Nicolas Le Bihan. % See the file : Copyright.m for further details. disp('Testing LU decomposition ...') T = 1e-12; A = randq(10); [L, U, P] = lu(A); compare(L * U, P * A, T, 'quaternion/lu failed test 1') A ...
%% test ReScale % this script compares the performance of original clustering algorithms % with the performance of their ReScale versions. Parameters for each % algorithm are tuned to the best. The results are the same as Table 6 of % the original paper. clear clc load('S1'); % load a dataset %% Original version %%%...
function [xC,yC,r2]=find_circuminfo_of_memorized_tria (T); % % [xC,yC,r2] = find_circuminfo_of_memorized_tria (T) % % This function considers the circumcircle of the given triangle (passed as % reference). Used relations are: % % A=[x1,y1,1 % x2,y2,1 % x3,y3,1] % v=[-x1^2-y1^2,-x2^2-y2^2,-x3^2-y3^2]' %...
function M = fitSegment(varargin) % FITSEGMENT fits an n-dimensional parametric equation for a segment % between two points. % M = FITSEGMENT(p1,p2) fits a segment between p1 and p2 such that: % p(s) = M*[s; 1] where s \in [0,1] % p(0) = M*[0; 1] = p1; % p(1) = M*[1; 1] = p2; % % M = FITSEGMENT(p)...
%Este programa calcula la raíz de la ecuación que nos da el valor crítico %del número de Mach para un coeficiente de presión mínima dado clear clc fun=@(M)(((1-M^2)^(1/2)+M^2*(-0.383)/(2*(1+(1-M^2)^(1/2))))*1/ (0.7*M^2)*(((2+0.4*M^2)/2.4)^(7/2)-1)-(-0.383)); %En nuestro caso, Cpi=-0.383 x0=1; toler=10^-7; itermax...
figHandles = findobj('Type','figure'); for i=1:length(figHandles); <<<<<<< HEAD set(figHandles(i),'units','normalized','outerposition',[0 0 1 1]) % print2eps(['eps',num2str(i),'.eps'], figHandles(i)); % fixlines(['eps',num2str(i),'.eps']); % saveas(figHandles(i),['eps',num2str(i),'.eps'], 'epsc'); ...
function [p,d,step]=rwrH(subPPI,subMim,B1,B2,gamma,lamda,eta,d0,p0) Nd = size(subMim,1); Ng = size(subPPI,1); nW = [(1-lamda)*subPPI',lamda*B1'; lamda*B2',(1-lamda)*subMim']'; display(size(nW,1)); for i = 1 : size(nW,1) if sum(nW(:,i)) == 0 nW(:,i) = sparse(zeros(size(nW(:,i)))); else nW(:,i) =...
function x = mdwtrec(dec,varargin) %MDWTREC Multisignal 1-D wavelet reconstruction. % X = MDWTREC(DEC) returns the original matrix of signals, % starting from the wavelet decomposition structure DEC % (see MDWTDEC). % % X = MDWTREC(DEC,IDXSIG) reconstructs the signals which % indices are given by the vect...
function cart_dataRecovery_test() addpath('..'); %% Pseudo-experiment: % Setup Dummy System: m1 = 0; % Known mass added to cart in experiment1 m2 = 20; % Known mass added to cart in experiment2 sysp = struct(); % System parameters sysp.M = 80; % Unknown cart mass sysp.k = 0.134...
clc;clear all;close all; tic; figure set(gcf,'Renderer','OpenGL'); x=[-5:0.1:5]; y=x; [xnew, ynew] = meshgrid(x,y);%生成网络采样点 for k1 = 1: size(xnew, 1) for k2 = 1 : size(xnew , 2) X = [ xnew(k1,k2) , ynew(k1, k2) ]; z(k1,k2) = Ackley( X );%代入Ackley函数 end end h = contour(xnew, ynew, z , 20);%绘制等高线...
%%%%%%%%%%%%%partitioning data into training set and test set; % seed = 20150835; % rng(seed); num_person=632; num_train=num_person/2; num_test =num_person/2; num_trn1=158; num_trn2=158; idxtemp=randperm(num_person); idx_test=idxtemp(1:num_test); idx_train=idxtemp(num_test+1:end); %mpair_ID_train=[unique(idx_train),un...
function varargout = DI3D(varargin) % DI3D MATLAB code for DI3D.fig % DI3D, by itself, creates a new DI3D or raises the existing % singleton*. % % H = DI3D returns the handle to a new DI3D or the handle to % the existing singleton*. % % DI3D('CALLBACK',hObject,eventData,handles,...) calls the l...
% Zeitableitung der rotatorischen Teilmatrix der analytischen Jacobi-Matrix für beliebiges Segment von % %RN% % Use Code from Maple symbolic Code Generation % % analytische Jacobi-Matrix: Differentieller Zusammenhang zwischen % Endeffektorposition und verallgemeinerten Koordinaten. % Zeitableitung der Winkeldarstellun...
function svm_plot = plot_svm_drug_effect_histos( epoch_struct ) epoch_struct_fields = fieldnames(epoch_struct); svm_plot = figure(); svm_plot_pos = get(svm_plot, 'Position'); %// gives x left, y bottom, width, height svm_plot_width = svm_plot_pos(3) * length(epoch_struct_fields); svm_plot_height = sv...
function [qq] = plotenergy_force(loopsol,Z0, R0,l,q,pos,C0) k0=320; mesh =0:0.001:1; t = mesh; tt=t; Sol=loopsol; a0=0.3; c0=R0*C0; g=20; c = -0.5*c0*(1 - tanh(g*(t - a0))); fontsize = 14; fontsize2 = 6; lineWidth = 4; lineWidthf = 3;%lineWidth = 12; axesWidth = 2; xLabelOn = 1; yLabelOn = 1; xTickLabelOn = []; yT...
function x = separate(uq, r_range, phi_range) r_len = length(r_range); phi_len = length(phi_range); separated = zeros(r_len*phi_len, 3); for r_i = 1:length(r_range) for phi_i = 1:length(phi_range) idx = (r_i-1)*phi_len + phi_i; separated(idx, :) = [r_range(r_i),...
function [ rotError, origin_rotError ] = Fn_CalculateError( GT_R, R ) origin_GT_R = GT_R'; tGT_R = GT_R'; [U, ~, V] = svd(tGT_R); tGT_R = U*V'; tGT_R = det(tGT_R).*tGT_R; rotError = (acosd(max(abs(tGT_R'*R),[],2))); origin_rotError = (acosd(max(abs(origin_GT_R'*R),[],2))); end
%% EPG demo / tutorial % Gehua Tong, Nov 14 2018 % Run each section separately! %% How to use EPG_custom.m % Construct seq (a struct, not related to pulseq at the moment) seq.rf = [0 0 0 0 0 0 90 180 180 180 180 180]; seq.grad = [1,1,1,1,1,1,1,1,1]; s...
function [outputMatrixTime,outputMatrix,outputMatrixSpont, p, cellIDs, outputTimes] = getStimSpiketimes(animal, iseries, iexp, igroup, iaddinfo) if nargin<4 igroup = 8; end if nargout>3 getTimes = true; else getTimes = false; end if nargin<5 iaddinfo = '1'; end if numel(iaddinfo) == 1 && numel(igroup) >...
function av = averagePeriod( time, data, varargin ) %% Extract year, month day and hour components of the datenum vector dateVector = datevec(time); %% Insert week number between month and day weekVector = weeknum(time)'; dateVector = [dateVector(:,1:2) weekVector dateVector(:,3:6)]; % By default the length...
function v=bint2(a,x,y) % v=interp_b2d(a,x,y) % bilinear interpolation from a to position x,y % Jan Mandel, February 2006 [m,n]=size(a); if(x<1 | x>m | y<1 | y > n), error('arg out of range') end % map to lower left corner i=min(floor(x),m-1); j=min(floor(y),n-1); t=x-i; u=y-j; v=a(i,j)*(1-t)*(1-u)+a...
% first multi channel and then single channel % fpr tpr by thresholding, spatial info etc % % subj={'C_C' 'A_S' 'B_G' 'E_N' 'C_R' 'D_L'}; R=[];fSS=[];tfSS=[];fSSauc=[]; % Itest=[1:numel(subj)]; for ci=Itest % ci eval(['sEEG=' subj{ci} '_sEEG;']); eval(['rsEEG=' subj{ci} '_rsEEG;']); eval(['fsEEG=...
% this version is intended to simulate conditions at 7T % % Batch file for pseudoCASL simulations. COntains a bunch of cases % execute a chunk of code at a time doBatch=1; sigs=[]; phis = []; close all; % array_Gz_ss = linspace(0.1,2.5,15); array_Gz_ave = linspace(0,0.15, 15); sigs1 = zeros(length(array_Gz_ave), le...
function [dpHip, dp1, dp2] = getJointVel(z,dz,p) % [dpHip, dp1, dp2] = getJointVel(z,dz,p) % % This function computes the velocity of the hip and ankle joints. % % INPUTS: % z = [4 x n] angle matrix % dz = [4 x n] angle rate matrix % p = parameter struct: % .g = acceleration due to gravity % .l = leg length...
clear; n = 1; switch n case 1 load('../results/lightbulb_problem_opt.mat') load('../results/lightbulb_fit.mat') c = 1;% 11; PRs_opt = squeeze(lightbulb_mdp(c).optimal_PR(:,1,:)); PRs_aprx = [lightbulb_problem(c).approximate_PRs;[0,0]]; pi_star = lightbulb_mdp(c).pi_...
% % Function: ret = ViewMatrixAfterReordering (A, A_ord, nz, pct, bw, bw_ord, algorithm, output_filename, do_not_show, do_not_print) % % This function views two matrices side by side. It also shows the fill % in percentage, number of non-zeros, and bandwidth of each matrix. % % Required arguments: % % A - fi...
% Proses Seleksi function Index = selection(Fitness) SumFitnessValue = sum(Fitness); CumFitnessValue = 0; RandomValue = rand(); NumberFitness = max(size(Fitness)); I = 2; while( I <= NumberFitness ) CumFitnessValue = CumFitnessValue + Fitness(I); Fraction = CumFitnessValue / SumF...
function similarity=fidelity(rd,pd) %FIDELITY Calculate the average fidelity between the predicted label % distribution and the real label distribution. % % Description % SIMILARITY = FIDELITY(rd, pd) Calculate the average fidelity between % the predicted label distribution and the real label distri...
function ph_plot(file_format,filetype,filename,first_channel,second_channel,... first_phase,second_phase,direction_matrix,n_directions,... n_channels,n_lines,xaxis) % function ph_plot(file_format,filetype,filename,first_channel,second_channel,... % first_pha...
clear; clc; close all; tic x = [1 7; 6 3; 7 8; 8 9; 4 5; 7 5; 3 1; 4 3; 2 4; 7 1; 1 3; 4 2]; y(:, 2 : 3) = x; y(:, 1) = 1; % Normalization of vector spaces y(7 : 12, :) = -y(7 : 12, :); %Weight vector initialization r1 = -100000; r2 = 100000; a = (r2 - r1) .* rand(1, 3) + r1; %Margin b = 10; % Perceptron function...
%% Stelling 13 % % De code 'zeros(3,6)' genereert een matrix die uit 3 rijen % bestaat, gevuld met nullen. % Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
function [ fD ] = fDrag_eci( R, V, B ) % [ fD ] = fDrag_eci( R, V, B ) % Determine the accleration due to drag using an exponential atmospheric % density function. % INPUTS % R - [3x1] ECI Position Vector (km) % V - [3x1] ECI Velocity Vector (km/s) % B - Ballistic Coefficient of Satellite % OU...
%% Recollecting data from BrainBonus2 (FCz) load results_BrainBonus2.mat recollect_data %% Calculate Theta phases t_min = 0; t_max = 600; subj_ind = 12; result = results{subj_ind}; trials = result.trials; trials = bsxfun(@minus, trials, mean(trials,1)); original_erp = mean(trials,3); mask = times > t_min & times < t...
function [learnedModel] = learnOriHist_minVar(allfiltered,nF,h,backgroundIm,ax,ay) % nF: maximum number of features to select get_natural_statististics(ax); load storedHI % CONSTANTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% gain_thres = 0.01; nimage = size(allfiltered,1); norient = size(allfilte...
close all clear all % close all %% Medium % Volume size xSize=200; %in px ySize=200; %in px zSize=500; %in px voxelSize=0.1; %in mm/px % Coordinates space % [M,N]=size(uin); %get input field array size % dx=L/M; %sample interval % k=2*pi/lambda; %wavenumber L=xSize; M=ySize; dx=voxelSize; dy=dx; % x=-L/2:dx:L/2-dx; %...
function Fin = sigNevHol(in,Mn,Sn,Bn) Fin = Mn./(1+(exp((-Sn.*in)./Mn)*(Mn-Bn))./Bn);
% TRAINLSVM Train linear support vector machine classifier. % MODEL = TRAINLSVM(X,Y) trains a linear support vector machine (SVM)from % data in X (N samples-by-D features) and the targets in Y (N samples-by-1), % where Yi=1 is a health sample and Yi=2 is an unhealth sample (i=1,...,N). % MODEL a structure wit...
function gui_project_DR(vec,DataRate,TX) % GUI_PROJECT_DR Interface graphique pour l'affichage des débits reçus. % GUI_PROJECT_DR(VEC,DATARATE,TX) affiche l'environnement VEC, l'émetteur TX % et l'ensemble des débits reçus DATARATE sur toutes les zones de % l'environnement. % % VEC = matrice [m x 4] repr...
%% JPA bringup data=data_taking.public.jpa.s21_BiasPwrpPwrs_networkAnalyzer('jpaName','impa1',... 'startFreq',4e9,'stopFreq',8e9,... 'numFreqPts',401,'avgcounts',10,... 'NAPower',0,'bandwidth',3e3,... 'pumpFreq',[],'pumpPower',[],... 'bias',[-0.75e-3:0.1e-4:0.35e-3],... 'notes','Check JPA aliveŁ...
function setArea(w, a) % SETAREA - % wallmethods(5, wall_hndl(w), a);
disp('Choose option 1. daily 2. monthly 3. yearly'); h=input(''); if(h==1) a=xlsread('nsedaily.xlsx'); a(isnan(a))=0; t=logreturn_daily(a); end if(h==2) a=xlsread('nsedata.xls'); a(isnan(a))=0; t=logreturn_monthly(a); end if(h==3) a=xlsread('nseyearly.xlsx'); a(isnan(a)...
function [DbarMod, DbarExp, Amod] = ArcieroModelHR_eval(x, Control, Anemia, Dob, layer) %%%%%%%%%%%%%% Preparation CPP = [40, 60, 80, 100, 120]; Control = ATPconcentration(Control, x(11)); Anemia = ATPconcentration(Anemia, x(11)); Dob = ATPconcentration(Dob, x(11)); eval(['ATP_Control = Control.Tv_',layer,';']); e...
function commander(filename) fin = fopen(filename, 'r'); % Open the file with the provided filename % Clear the workspace evalin('base', 'clear'); % Create a cellular object to store the code line by line evalin('base', 'CODEBASE = {};'); % Set the current line number to 1 lineNo = 1; % Set a place to keep track of ...
x=load('data1.mat') y=load('data2.mat') z=load('data3.mat') x=x.data; y=y.data; z=z.data; data=[x ; y ; z] save('data.mat', 'data'); A=zeros(length(data), 6); A(:,1)=1; A(:,2)=data(:,1); A(:,3)=data(:,2) A(:,4)=abs(data(:,1)).*data(:,2); A(:,5)=abs(data(:,2)).*data(:,2); A(:,6)=(data(:,1)).^3; b=data(:,4)- data(:,3); ...
function [change] = glrt_1d(J, Jprime, x, Y, Ghat, ... nbhdSize) % do GLRT based on hypothesis testing, assume Gaussian likelihoods % Y is individually-reconstructed data (both ref and changed) % Ghat is reconstruction of data using VBJS (best estimate of scene) % get zero mean for GLRT assumption Gnorm = Y - Ghat...
function [y,t] = MyFFTConv(x,h,fs,pad) % [y,t] = MyFFTConv(x,h,fs) % Inputs: % x = signal 1 time array % h = signal 2 time array % fs = sampling rate % pad = 'y' - keep zero pad part, 'n' - get rid of zero pad part % Outputs: % y = convolved time array signal % t = time array for convolution % Info: % By: Matthew Luu %...
function [xsol, optimalobjective, basisfinal] = simplextwodlevens1(A, b, c) % Solves an LP using the Simplex Method starting from a Two Phase % initialization. % utility methods num_of_rows = @(matrix) size(matrix, 1); num_of_cols = @(matrix) size(matrix, 2); num_rows_of_A = num_of_rows(A); ...
function [lis, best_s, best_e] = LongestIncreasingSubsequence(meanPosition) % Find the longest subsequence of an array whose values are increasing. % [lis, best_s, best_e] = LongestIncreasingSubsequence(meanPosition) l = length(meanPosition); i = 1; max = 1; s = 1; e = 1; best_s = 1; ...
function obj=stat_smooth(obj,varargin) % stat_smooth Display a smoothed estimate of the data with % optional 95% bootstrapped confidence interval % % Arguments given as 'name,value pairs: % - 'method': Which method to use for the smoothing. Available methods are: % - 'eilers' (method from Eilers 2003, defau...
function PresentBlockEnd(pc) global const scr stimulus stiPar expPar timing %% mytext = ['Block finished. Accuracy: ' num2str(pc) '%']; Screen(scr.windowPtr,'DrawText',mytext, 0.3 * scr.xres, 0.35 * scr.yres, [0 0 0]); drawFixation(scr); WaitSecs(.5); KbWait(-3); drawFixation(scr); WaitSecs(.5);
function matrix = ArrayListofArrayList2Matrix(al_of_al) nrow = al_of_al.size; matrix = cell(nrow,1); for i = 1:nrow al = al_of_al.get(i-1); ncol = al.size; vector = zeros(1,ncol); for j = 1:ncol el = al.get(j-1); vector(j) = el; end ...
function plot_sigstar(ax,data,pairs,varargin) % Plots significance stars for distributions in data % % data - Nx1 cell array of distributions % pairs - Mx2 comparison indices % set defaults test = 'ranksum'; bars = 'on'; % parse inputs for i=1:numel(varargin) arg = varargin{i}; if ischar(arg) switch ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright (C) 2013 by Jerome Maye % % jerome.maye@gmail.com % % ...
%% Prepare workspace close all; clear; clc; % Run two models to compare IRFs dynare RBC nowarn load('RBC_results.mat', 'oo_'); irf0 = oo_.irfs; save irf_0.mat irf0; dynare ind_lab nowarn load('ind_lab_results.mat', 'oo_'); irf1 = oo_.irfs; save irf_1.mat irf1; %% Plot IRF comparison close all; clear; clc; load irf_...
%RRAND samples from the correlation coefficient distribution % % Syntax (hidden method) % ---------------------- % x = sim.rrand( sim, rho, N, n, dr,r ) % % Details % ------- % The user cannot access this function directly. % Will store computed distributions for later use if sim.use_cdf is true. % % ...
function CC=VectorizedCOP(Lblocks,calc) % L = [LA, 0; LB, LC]. LA is square diagonal block corresponding to % the OPs. LC is square diagonal block corresponding to the non-OPs. % LB is rectangular subdiagonal block. LA is sparse block-diagonal % with lower triangular 3-by-3 blocks. LB is dense. LC is dense lower % tri...
function c=diff1r(ic, k, dt, dx, time, circ); %solves 1D diffusion eqn., Ct=k*Cxx with periodic boundary conditions using %Euler method. %size of initial condition at c(1,1) is ic %k is diffusion coeff. %time & space steps are dt & dx, resp. %NB: k,dt,dx must be chosen such that 1-2*(dt*k/(dx^2))>0 %time is ...
function [ err ] = errors( A,r ) %ERRORS Summary of this function goes here % Detailed explanation goes here n = size(A,2); err = zeros(n,1); for j = 1:n err(j) = norm(A(:,j)'*r/(norm(A(:,j),2)^2)*A(:,j) - r,2)^2; end end
function psych_draw_fixation(w,rect,size,width,time,pos,color) if isempty(pos) [x_cent, y_cent] = RectCenter(rect); else x_cent = pos(1); y_cent = pos(2); end x_coords = [-size size 0 0]; y_coords = [0 0 -size size]; all_coords = [x_coords; y_coords]; Screen('DrawLines',w,all_coords,width,co...
% Generates a periodic triangulation for the unit square with a circular % hole. This function uses the distmesh package: http://persson.berkeley.edu/distmesh/ % Input: % * r = radius of the hole % * h = mesh size % Output: % * [c4n, n4e] = coordinate arrays of nodes and connectivity information, % * s = FEM stiffn...
for j = 1:10 for i = 1:10 fprintf('*'); end fprintf('\n'); end
th = (0:5:360)*pi/180; r = 0:.05:1; [TH,R] = meshgrid(th,r); %[X,Y] = pol2cart(TH,R); Lr=length(r); Lth=length(th); % x=0:h:1; y=0:h:1; % L=length(x); c=1; tau=0.01; h=0.0001; a=max(r); kappa = c*tau/h; nsteps=ceil((1+h)/(c*tau)); temp = zeros(Lr,Lth); temp(1,:)=1/h; temp(2,:)=(kappa^2)*(1+h/a)*(temp(1,:)-temp(...
%% INITIAL SETUP CODE % Clear the workspace and screen sca; close all; clearvars; % Setup PTB with some default values PsychDefaultSetup(2); %Setting screen number: secondary monitor if it exists screenNumber = max(Screen('Screens')); % Define black, white and grey white = WhiteIndex(screenNumber); black = BlackIndex(s...
%test for vertical_sweeps format compact % test for vertical_sweeps nel=[5,4,3] %nel=[1 1 1] n=nel+1 h = [1,1,1] expand=1.3 A = diag([1 1 1]) lambda=[] params=[] u0=[]; X = regular_mesh(nel,h,expand); % X = add_terrain_to_mesh(X, 'hill', 'shift', 0.1) X = add_terrain_to_mesh(X, 'hill', 'squash', 0.1) % more thoroug...
function draw_force(steps, force,lcmgl) for j = 1:4 lcmgl.glPushMatrix(); lcmgl.glTranslated(steps(j).pos(1),... steps(j).pos(2),... steps(j).pos(3)); axis = [force(1:3,j)',4]; axis = axis([4,1:3]); % LCMGL wants [angle; axis], not [axis; angle] axis(...
function Y = subsref(G, index) % % Define field name indexing for kronMatrix object. % % Y = subsref(A, index) % % This is called whenever a subscripted reference to the % kronMatrix object is made. Options are: % G.a % G.b % G.a{k} % ...
function centers = center(edges) centers = (edges(1:end-1)+edges(2:end))/2;
% Run script for solving Darcy's system (fine scale) with mixed % finite element method (RT0 + P0) % clear all; %% Set up the parameter nx = 30; ny = nx; hx = 1/(nx-1); hy = 1/(ny-1); % load coef.mat p = @(x)cos(pi*x(:,1)).*cos(pi*x(:,2)); v1 = @(x)-pi.*sin(pi*x(:,1)).*cos(pi*x(:,2)); v2 = @(x)-pi.*cos(pi*x(:,1)...
function [i,x_out,f_out,ea_out] = nonlin_fixed_point(func,func_updated,x_guess,es,imax) syms x y if nargin<4||isempty(es) es=0.1; end if nargin<5||isempty(imax) imax=50; end i = 0; x0=x_guess; ea = 100; f(x,y) = func; f_updated(x,y) = func_updated; while((ea > es) && (i < imax)) x_old = x0; ...
function [ min1, indic_min ] = calcul_min( array ) %UNTITLED4 Summary of this function goes here % Detailed explanation goes here for i = 1 : length(array) if (array(i) ~= 0) min1 = array(i); indic_min = i; break; end end for i = 1 : length(array) if (arr...
function rgb = complex2rgb(data2d, complexmode, clim) % Author: Vladimir Golkov if nargin<2 complexmode = 1; end % rgb = zeros([size(data2d), 3]); phase01 = (angle(data2d)/pi+1)/2; % phase scaled to [0 1] phasemod = linsc(phase01,[0 1],[.15 .85]); absd = abs(data2d); if exist('clim','var') magnitude0...
function winning_full = visual_comb_win_simp(fig,SwPt,M_X,Cont_list,Bnd,Dist) figure(fig); bnd_X = M_X.bnd(1,:); len_X = bnd_X(2)-bnd_X(1); winning_full = []; for i = 1:length(SwPt) origin = len_X/2*0; W = Cont_list{SwPt{i}}; coord_W = M_X.get_coord(W)...
% % Automated Road Network Extraction from High Spatial Resolution Multi-Spectral Imagery (Thesis) % URL:http://www.geomatics.ucalgary.ca/research/publications/GradTheses.html % function [mean comp ecc var] = ats_descriptors_mod(I, w, step) % get image size [imH imW] = size(I); % Initialize vari...
function phalcd(varargin); % phalcd( [...] ); % Counts D h = timeplot({'DetD'}, ... 'Counts D', ... 'D', ... {'DetD'}, ... varargin{:} );
function dist= findFirstEqual( ts1, ts2, itimes ) %FINDFIRSTEQUAL 查找第一个大于等于的数,距离现在的行程 % inputs: % ts1: 当前序列 % ts2: 待比较序列 % itime: 时间序列 % version 10, luhuaibao, 2014.5.29 n1 = length(ts1); n2 = length(ts2); if n1~=n2 error('两序列长度不同'); end ; if ~exist('...
function mutatedChromosome = Mutate(chromosome,mutationProbability,numberOfOperators,numberOfRegistor,numberOfOperands) nGenes = size(chromosome,2); mutatedChromosome = chromosome; for j = 1:nGenes r = rand; index =mod(j,4); if (r < mutationProbability) if index == 1 mutatedChr...
function [xdot] = coax_eom(t,state,control,param) % States x = state(1); % x position y = state(2); % y position z = state(3); % z position u = state(4); % u velocity v = state(5); % v velocity w = state(6); % w velocity roll = state(...
function basisobj = create_constant_basis(rangeval) % CREATE_CONSTANT_BASIS Creates a constant basis % Argument: % RANGEVAL ... an array of length 2 containing the lower and upper % boundaries for the rangeval of argument values. If a % single value is input, it must be positive and th...
function [ bus, branch ] = BTdata_for_inj_env( bus, branch ) %returns data required for running BT based on convex envelopes of bus %current injections %unpack data [N, L_uniq, uniq]=deal(bus.nbus, branch.uniq.L_uniq, branch.uniq); %compute number of adjacent buses for each bus Adj=sparse(uniq.ind_F, uniq...
% TODO % Tree implementation from: % http://www.mathworks.com/matlabcentral/fileexchange/35623-tree-data-structure-as-a-matlab-class function r = rf() addpath('.') raw_data = csvread('wf.csv'); X = raw_data(:,1:(end-1)); % the samples Y = raw_data(:,end); % the labels % Split data. Always u...
clear; clc; stdy = 3.33; stdp = 3.33; yaw1 = 0; lim = 3; %stds stepsize = 500; yaw2 = linspace(yaw1-lim*stdy,yaw1+lim*stdy,stepsize); pitch1 = 0; pitch2 = linspace(pitch1-lim*stdp,pitch1+lim*stdp,stepsize); pitch2 = pitch2'; ux = 5*cosd(pitch2)*cosd(yaw2); uy = 5*cosd(pitch2)*sind(yaw2); uz = 5*sind(pitch2)*ones(s...
%part a %Define variables for angular frequency and fundamental period w = 3*10^8*pi; T = (2*pi)/w; %create vector t that goes from 0 to 5T at an evenly distrubuted number of %n times. For us n was set to 100 t = linspace(0,5*T,100); %answer s = cos(w*t); %part b %when x is equal to 0m t1 = sqrt(100)/(3*po...
function [ LfLfh0 LgLfh0 ] = get_LfLfh0_LgLfh0( q,dq,alpha,theta_begin,theta_end,robot ) dh0dq=get_dh0dq(q,dq,alpha,theta_begin,theta_end); d_dh0dq=get_d_dh0dq(q,dq,alpha,theta_begin,theta_end); [D,C,G,B,damping]= robot.Dynamic_model(q,dq); [ER,dER]=robot.get_ER([q;dq]); M=[D -ER'; ER zeros(2,2)]; H=[C*dq+G+damping;dE...
theta=meshgrid(eps:pi/180:pi); phi=meshgrid(eps:2*pi/180:2*pi)'; %元因子: f = abs(2*cos(pi*cos(theta))+eps); f = abs(sin(pi*sin(theta)/2)./sin(theta)).*f; fmax=max(max(f)); [x,y,z]=sph2cart(phi,pi/2-theta,f/fmax); %之前第二个变量直接写的是theta,对照说明以后已改正 mesh(x,z,y); axis([-1 1 0 1 -1 1]);
function rhs = phi2(y,eig) %UNTITLED7 Summary of this function goes here % Detailed explanation goes here rhs = [y(2); (x.^2-eig).*y(1)]; end
%% initialize environment close all; clearvars clc %% changing default fontsize fontsize = 20; set(0,'DefaultAxesFontName','Times New Roman'); set(0,'DefaultAxesFontSize',fontsize-2); set(0,'DefaultTextFontname','Times New Roman'); set(0,'DefaultTextFontSize',fontsize); %% configs configs.numRegions = 360; %Number ...
clear; close all; clc; LR_folder = './LR'; % LR preout_folder = './results'; % pre output save_folder = './results_20bp'; filepaths = dir(fullfile(preout_folder, '*.png')); max_iter = 20; if ~ exist(save_folder, 'dir') mkdir(save_folder); end for idx_im = 1:length(filepaths) fprintf([num2str(idx_im) '\n'])...
% [channelsToRemove,channelEventFraction]=removeInactiveChannels(t,ic,res,minimalEventFraction,varargin); % Function purpose : Finds inactive neurons in a recording % % Recives :t [ms] - firing timings % ic - index chanel % res [ms] - resolution of finding bursts (100); % ...
% generate path path(path,genpath(pwd)) % compile mex files if necessary Amexfile = ['partXY.mex' lower(computer)]; if ~exist(Amexfile,'file') cd Utilities; %mex -O fastWHtrans.cpp %mex -O -largeArrayDims updateSval.c -lmwblas -output updateSval mex -O -largeArrayDims updateSval.c -lmwblas %mex -O...
function rescale(filename) set(gcf, 'PaperSize', [6.25 7.5]); set(gcf, 'PaperPositionMode', 'manual'); set(gcf, 'PaperPosition', [0 0 6.25 7.5]); set(gcf, 'PaperUnits', 'inches'); set(gcf, 'PaperSize', [6.25 7.5]); set(gcf, 'PaperPositionMode', 'manual'); set(gcf, 'PaperPosition', [0 0 6.25 7.5]); set(gcf, 'renderer...
fsize = 18; loglog(Er3k2Unperturbed(2,:),Er3k2Unperturbed(1,:),'-ok',Er3k2Cperturbed(2,:),Er3k2Cperturbed(1,:),'-sk',Er3k2Operturbed(2,:),Er3k2Operturbed(1,:),'-+k',Er3k2Unperturbed(2,:),Er3k2Unperturbed(2,:).^3,'-.k',Er3k2Unperturbed(2,:),Er3k2Unperturbed(2,:).^4,'--k') axis([.2*10^(-1) 1 10^(-8) 1]) set(g...
%% Stelling 3 % % Met de help functie kan je alleen zien wat de input variabelen % zijn van een standaard Matlab functie en niet de % output variabelen. % Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
function[out]=spreader(code,x)%spreader y=x'*code; out=reshape(y,1,numel(y));