text
stringlengths
8
6.12M
function [ObjPosition, ObjSpeed] = ObjMotion2(t_k, WS, NumElem, flag) ObjPosition = zeros(3,NumElem); ObjSpeed = zeros(1,NumElem); if strcmpi(flag, 'standing_wind_random') k = 5; lambda = 15; l = 1; % ObjSpeed = ones(1,NumElem).*RandWindSpeed(k, lambda); % ObjSpeed = ones(1,NumElem).*HarmWindS...
function [medie,patrat,produs] = Exercitiu3_Razvan_Craciunescu [z] medie=mean(real(z)); patrat=z.^2; produs=z*z';
function AdjustDTWAFigsInGroup_Plos1_CompBio_July2021(figGroup, offsetTop, bottomPictureXstart, displayLength, figureName) originalSignalFig = 3; alignedSignalFig = 2; % Which child in Fig consensusLine = 1; goldStandardLine = 2; numDBADTWAFigGroup = size(figGroup, 2); for countFigs = 1 : numDBADTWAF...
tic; ni = 1000; noi=100; n=d; ions=zeros(ni,n+3); ions=initial(ions,range); ions=benefit(ions,objective_function); hamION=[]; [anions,cations]=anion_cation(ions); anions_memory=anions; cations_memory=cations; for g=1:noi [anions,cations]=update_ions(anions,cations,range); anions=benefit(anions,objec...
function [spectralSamples, freqs] = getRandomSpectralSamples(EEG, startingFracs, ... sampleLength, channels, numFreqs, freqRange) %% Compute specified random spectral samples % % Parameters: % EEG EEG set structure % startingFracs numChans x numSam...
function [Count] = Dict_Rec(params,data,ch) %% Function to implement Sparse KSVD % Used in Denoising & Dictionary Recovery % A is the sparse representation of the base dictionary D = B*A % D_ = Dummy Dictionary % D = Original Dictionary ; Ground Truth %% Parameter Extraction Tdict = params.Tdict; D_base = params.D_bas...
clear all;clc; time = 20; N = 2000; Pp = 0.05; Pn = 0.05; P_circle = 0.25; %人群分片 count_p = floor(N*Pp); count_p_in = floor(count_p*P_circle); count_p_out = count_p-count_p_in; count_n = floor(N*Pn); count_n_in = floor(count_n*P_circle); count_n_out = count_n-count_n_in; count_f = N-count_p-count_n...
%% FPTC Synchronizer % Author: Hongli Shi u5738846 % Date: 10 May, 2017 % Description: The function is to synchronize the timing and frequency % offset. The input is the received TD OFDM sequence y. There are two % outputs. One is the estimated timing n_est (the end point of CP), % and the other is the estimated frequ...
% % Created by Tiago Carvalho Mendes % October, 2019 - University of Aveiro % clear; close all; clc; Ta = 0.01; t = [0:Ta:5-Ta]'; x = 2*sin(4*pi*t); figure(21); plot(t,x); grid on; title('Signal x(t)'); legend('x(t)'); xlabel('Time (s)'); ylabel('Amplitude'); y = cos(10*pi*t); figure(22); plot(t,y); grid on; title...
function bb=adabooster(proto, boost_steps, param1, param2) % bob=booster_base(proto, boost_steps, param1, param2) % % Constructor for aqabooster class % % BASECLASS(ES) : booster_base % G. Raetsch 10.12.99 % Copyright (c) 1998,1999 GMD Berlin - All rights reserved % THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE o...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % CSC C11 - Assignment 2 - Document Clustering. % % This script is used to perform clustering on a dataset that % contains word-frequency vectors for a couple thousand articles % from the BBC: % % http://mlg.ucd.ie/datasets/bbc.html % % You *do not ne...
classdef EucImageDistance % % Compate between input image and reference image. % % @author: Jeffrey Chan, 2014 % properties m_mRefImage; m_mRefPos; end methods function [obj] = EucImageDistance(mRefImage, mRefPos) obj.m_mRefImage = mRefI...
% Functions x[n] and h[n] x = [0,0,1,3,4,0,0]; % x[n] h = [0,0,6,5,4,3,2,1,0,0]; % h[n] % End Functions x_find = find(x); % Find indexes of all nonzeros in x x_start = x_find(1); % index of first nonzeros in x x_end = x_find(end); % index of last nonzero number in x h_find = find(h); % All indexes of non-zeroes in...
%Recall that the physical level is z+2 %Value of r2 determines which leaf we start on, smaller r2 -> closer to %boundary %Difference between r2 and r3 determines position on leaf. Large difference %close to bottom, small difference close to top maxZ = 5; r1 = 1; r2 = 1; r3 = 1; DepthTable = zeros(ma...
clear all; close all; load('/Users/maximilianbrill/Desktop/Brill&Wolf/MATLAB/results/com_tax_mf_delta.mat'); load('/Users/maximilianbrill/Desktop/Brill&Wolf/MATLAB/results/com_igp_mf_delta.mat'); load('/Users/maximilianbrill/Desktop/Brill&Wolf/MATLAB/results/com_tax_df_delta.mat'); load('/Users/maximilianbrill/Desktop...
% prefix = prefix before the number % use sprintf('05d%','number') to match the '00015' thing % N_file = number of files in that directory function result = n2ndist(prefix, atom1, atom2, N_file) namestring = [prefix '%05d.pdb']; result(N_file,2) = 0; h = waitbar(0,'Calculating n2n dist...'); for i=1:N_file ...
function LFP_DATA=stan_ephys_getdata_lfp_stats() % % stability analysis--baseline data % first take all of the data from control [options,dirs]=stan_preflight; nboots=1e3; tmp=dir(fullfile(dirs.agg_dir,dirs.lfp_dir,'*.mat')); lfp_files={tmp(:).name}; LFP_DATA.dates=[]; LFP_DATA.days_since=[]; LFP_DATA.ang_diff=[]; L...
%Toggleable options (4, 1, 2 is the most complete sequence) part1 = 4; %1, 2, 3, or 4 part2 = 1; %1 or 2 part4 = 2; %1 or 2 %Part 1: Create Transition Matrix (normalization will be done all at the %same time) numberOfSpaces = 40; B = zeros(numberOfSpaces, numberOfSpaces); doubleDiceRollDistribution = [0 1/36 2/...
% imbibition capillary pressure curve % Written by Ali A. Eftekhari function res=dpc_imb(sw, pce, swc, sor, teta, labda, b) dpc1=dpc_drain(sw, pce, swc, labda); dpc2=dpc_drain(1-sw, pce, sor, labda); res=(0.5*(1+cos(teta))).^b.*dpc1+(0.5*(1-cos(teta))).^b.*dpc2; end
clear close all clc %% T1T2 % Load data cd('/Users/jaredking/Documents/Classes/Chemistry/Research/Summer2016/TradSSET2_M212Samples_23_28June2016/TradSSET2_M212_Fresh_Overnight_24June2016/2/ILTs/'); % cd into desired directory datafile = 'TradSSET2_M212_Fresh_Overnight_24June2016'; % Datafile invDat = load(strcat(data...
head = ones(450,501); for i = 1:450 for j = 1:501 if i/3. + abs(j-250) > 250; head(i,j) = -1; end end end tail = imrotate(head,180); figure();imagesc(head);colormap gray;axis image;title('Head up'); figure();imagesc(tail);colormap gray;axis image;title('Tail up');
% LogEn function A2=LogEnFun(Image) A=rgb2gray(Image);%½«Í¼ÏñתΪ»Ò¶Èͼ imshow(A); A2=log(1+double(A)); % axes(handles.axes2); % imshow(A2,[]);
function ci = repli2ci(bstat,stat,alpha) %ci = repli2ci(bstat,stat,alpha) % CI = BOOTCI(NBOOT,BOOTFUN,...) computes the 95 percent BCa bootstrap % confidence interval of the statistic defined by the function BOOTFUN. % NBOOT is a positive integer indicating the number of bootstrap data % samples used in the c...
%% Model only l = 0.34; lr = 0.17; tv = 1.4; gv = 1; td = 0.1; gd = 1; beta = @(x)atan((lr/l)*tan(x(5))); inputs = ret{1}.inputTrajectory; Ts = t(2)-t(1); % Steering model filter Fs1 = tf(gd,[td 1]); Fz1 = c2d(Fs1,Ts); inputsF(2,:) = filter(Fz1.num{1}, Fz1.den{1},inputs(2,:)); % Velocity model filter Fs2 =...
function tsa = mytsd(t, qData,tUnits,Header) switch nargin case 0 tsa.t = []; tsa.data = []; tsa.header = []; tsa.units= []; case 1 if isa(t, 'mytsd') tsa = t; return; elseif isa(t, 'ctsd') tsa.t...
num=load('1D_Rie_Test_10.dat') plot(num(:,1),num(:,2),'b.') hold on exact=load('exact0.dat') plot(num(:,1),exact,'b') num=load('1D_Rie_Test_11.dat') plot(num(:,1),num(:,2),'g.') exact=load('exact1.dat') plot(num(:,1),exact,'g') num=load('1D_Rie_Test_12.dat') plot(num(:,1),num(:,2),'r.') exact=load('exact2.dat') plot(nu...
function arg = rw_loadcurve(mode, obj, fileid, name, loadcurve, sigma, varargin) %RW_LOADCURVE ermöglicht Zugriff auf Parameter der Klasse "Lastgang" % Diese Funktion gehört der RW_-Funktionenreihe an, die eine automatische % Abarbeitung aller im Simulationsprogamm vorkommendnen Parameter erlaubt. % Dazu we...
clear all; close all; I1 = imreadbw('img1.png'); I2 = imreadbw('img2.png'); [M,N] = size(I1); [vx,vy] = getFlow(I1, I2, 2); figure, % subplot(3,1,1) % imagesc(vx); % subplot(3,1,2) % imagesc(vy); % subplot(3,1,3) hold off imagesc(I2); colormap gray hold on quiver(vx,vy,0);
function tSignal = GetMaximalRadiationSignal( tConverter, afJulianDates ) % % construct the roof tRoof = PhysicalModels.HorizontalRoof( ... tConverter.fLatitudeInDegrees, ... tConverter.fLongitudeInDegrees, ... tConverter.fTimeZoneInHours, ... false ); % % g...
function throw(tag,message1,varargin) %NNERR Throws nnet error in calling function, with update message. % % NNERR(TAG,MESSAGE) throws the error ('nnet:FILENAME:TYPE',message) % in the calling function, where FILENAME is the name of the calling % function. % % NNERR(TYPE,MESSAGE,NAME) updates message by replacing a...
function surfaces = findCenters(surfaces,source) options.aperture=false; options.segments=false; options.negative=true; [~,~,~,elev,trace] = raytrace(columnSource(source,0),surfaces,options); % trace the chief ray only N = numel(trace); for i=2:N if ~isfield(surfaces{i-1},'lo...
function drawback_info = PCBDetect(source,template,visible,issave,log_folder_name,output_folder_name) % comapre source image to the template iamge in order to detect the % darwbacks in source image. the locations and classes of darwbacks would % be recorded in the log file stored under the folder specificated be ...
%% Initialise helix % Generates the coordinates for a helix function [r,init_type] = initialize_helix(filament_param,driving) %% Global dels n amp k dels = filament_param.dels; n = filament_param.n; radius = driving.rad; h = driving.h_step; % Preallocate r = zeros(3*n,1); r_rad = ...
% File: PB_38.m for Problem B-38 clear; clf A = 8; M = 8; % defining step size delta = 2*A/M; k = 1:1:M; y = zeros(length(k),1); P = zeros(length(k),1); for (i = 1:1:length(k)) y(i) = (2*k(i)-M-1) * 0.5 * delta; P(i) = 1/pi*(asin((2*k(i)-M)/M) - asin((2*k(i)-M-2)/M)); end; plot(y,P,'o'); axis([y(1) y(length(k...
clear; clc; syms M J T R Th Ph Td Rd Thd Phd x = [T R Th Ph]; xd = [Td Rd Thd Phd]; v = [T R Th Ph Td Rd Thd Phd]; dt = .01; O = 2; EV = J; EO = 0; AZ = 2 * pi * O; g = sym(zeros(4)); g(1, 1) = - (1 - 2 * M / R); g(2, 2) = 1 / (1 - 2 * M / R); g(3, 3) = R ^ 2; g(4, 4) = R ^ 2 * sin(Th) ^ 2; g(1, 4) = - 4 * J * sin(...
function diseaseNet import brml.* D=20;S=40; dv=1:D; sv=D+1:D+S; load diseaseNet pot=str2cell(setpotclass(pot,'array')); drawNet(dag(pot),variable); tstart=tic; [jtpot jtsep infostruct]=jtree(pot); % setup the Junction Tree jtpot=absorption(jtpot,jtsep,infostruct); % do full round of absorption t=toc(tstart); disp(['J...
function ptCloudScene = process_scene_2(pico_FileName, time, sensor_pos,sensor_att,~,start_here,end_here,use_rotations,use_translations,refresh_data) tic % Lets stitch baby, this first block gathers and syncs data sensor_att = movmean(sensor_att, 41,1); % Grab necessary data from pico flexx if refresh_...
function matlabbatch = bspm_coregister(reference, source, other, costfun) % BSPM_COREGISTER % % USAGE: bspm_coregister(reference, source, other) % % ARGUMENTS % reference = image that stays put % source = image that is moved to match the reference % other = images to move with the source % costfun = 1 (defau...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Description: plot mean error rates (figure 2 in the manuscript) %% Author: Xuelian Zang %% Contact: zangxuelian@gmail.com or lianlian81821@126.com %% Date: 15/10/2013 %% updatedate : 28/03/2020 %% modified by Fiona %%%%%%%%%%%%%%%%%%...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Function: incorporate contact constraint to stiffness matrix based on % penaly method % %Input: ncp_1=number of control point in patch 1 % ncp_2=number of control point in patch 2 % Problem=Problem set % Penal...
%% x = imread('Barbara.jpg'); if(length(size(x))==3) x=im2double(rgb2gray(x)); else x=im2double(x); end sigma=5e-3; miu=4e-4; [m, n] = size(x); %% %%get the oberverd image load kernels.mat H=k{7}; H_FFT=psf2otf(H,[m,n]); HC_FFT = conj(H_FFT); y=imfilter(x,H,'circular','conv')...
function state = gtrack_unitUpdate(uid,var,num) global trackerProcObj; global points; GTRACK_SPREAD_ALPHA = 0.01; GTRACK_MIN_POINTS_TO_UPDATE_DISPERSION = 3; FLT_MAX = 3.402823466e+38; MSIZE = 4; myPointNum = 0; myUniquePointNum = 0; centroidSnr = 0; J = zeros(4,9); D = zeros(4,4); u_sum.array = zeros(1,4);...
function [r2,rmse] = rsquare(y,f) % Compute coefficient of determination of data fit model and RMSE % % [r2 rmse] = rsquare(y,f) % % RSQUARE computes the coefficient of determination (R-square) value from % actual data Y and model data F. The code uses a general version of % R-square, based on comparing the variabilit...
function Vars = getQdecVars(Qdec) % Vars = getQdecVars(Qdec) % % Returns a one dimensional cell string array with the name of the variables % in Qdec. % % Input % Qdec: Two dimensional cell string array of Qdec data. % % Output % Vars: One dimensional cell string array. % % $Revision: 1.1.1.1 $ $Date: 2012/02/02 11:25...
function [redraw, rekey, undoable] = DeleteCluster(iClust) % f = CopyCluster(iClust, varargin) % % INPUTS % iClust - index into MClust_Clusters % REQUIRES % figHandle from parent % % OUTPUTS % MCC - The updated cluster % % % ncst 26 Nov 02 % ADR 2008 % global MClust_Clusters global MClust_Hide global MClust...
function f = objective( x ) %OBJECTIVE Summary of this function goes here % Detailed explanation goes here f = (x-3)^2 end
function [ry,rye,t,vary]=acfar(a,v,m); %Usage: [ry,rye,t]=acfar(a,v,m) % m: max number of lags % a: denuminator polynomium % % ry: covariance function % rye: cross covariance function % t: time index % Programmed 1994 by Niels K. Poulsen % Department of Mathematical Modelling, % Technical University of Denmark ...
%Part 2 a) % Training data from 1a) data2 = zeros(200, 256); data2(1:100, :) = data(sampleSet3, :); data2(101:200, :) = data(sampleSet8, :); % Testing data from 1b) x2 = zeros(200,256); x2(1:100, :) = data(testingSet3, :); x2(101:200, :) = data(testingSet8, :); target(1:100,1) = -1; target(101:200,1) = 1; Y = RegLS(0...
% ANALYZE Step wedge analysis % % This method determine the transfer table of film exposure to linearized % intensity level. % >> object=analyze(object); % The optical densities used in the analysis are controlled by the object % properties StepLevels, StepOffsets, and CalibrationRange. % % To only view the analyzed ...
function mph = kmph2mph(kmph) %KMPH2MPH Convert speed from kilometers per hour to miles per hour % % mph = KMPH2MPH(kmph) converts speeds from kilometers per hour to miles % per hour. % % See also KMPH2KTS, KMPH2FTPS, KMPH2MPS, MPH2KMPH. % Jonathan Sullivan % Original: May 2011 % jonathan.sullivan@ll.mi...
function MultiViewer(varargin) % Data Viewer for Multimodal Data Collected with Controller % Note: At this point MultiViewer only works with consecutive trials! % % Usage: % MultiViever('Argument',Value,...); % Data : MultiModel data in Controller format (obtained from C_loadRecording) % Transpose [...
function [Lout,yt] = get_graph_states_idx(G, ys, Id) for t = 1:length(G) L = (G{t}.laplacian); Lout{t} = L(Id,Id); end yt = ys(Id,:,:);
%matriz de flexibilidad para pasar esfuerzos a deformaciones %caso esfuerzo plano ozz=oxz=oyz=0 %young en MPa, deformacion axial en epsilon (epsilon = gama / 2) function f = flexibilidad_esfplano(young, poisson) f_general = flexibilidad(young, poisson); f = f_general; %eliminar filas 3, 4 y 5 f(5,:) = [...
function [h,v,incl] = m2h(M,A,fs,fc) % [h,v,incl] = m2h(M,A) % M and A are sensor structures or matrices % or % [h,v,incl] = m2h(M,A,fc) % M and A are sensor structures % or % [h,v,incl] = m2h(M,A,fs,fc) % M and A are matrices % Compute heading, field intensity and inclination angle by gimball...
function y = blk_reactor_BaCl2_NH3_cylindrical_no_walls_fun1(x) %% % Salt molar mass: pair = get_material_properties(x.pairName); binder = get_material_properties(x.binderName); gas = get_material_properties(x.gasName); % Composite volume (m3): y.Vcomposite_m3 = x.Lr * (pi/4*(x.D^2-x.Ddiff^2)); % Composite ...
function [obj] = PointContact(obj, rbm, frame) arguments obj (1,1) Contact rbm (1,1) DynamicalSystem frame (:,1) casadi.SX end switch rbm.Model.dimensions case 'planar' if size(frame,1) ~= 2 error('Contact frame must be 2x1 for 2D point contacts') end case 'spatial' ...
load('/home/mahdyar/Documents/MATLAB/gan_anomaly/code/variables/ped2.mat') original_frm_dir='/home/mahdyar/Documents/MATLAB/gan_anomaly/data/UCSD/ped2/frm/test/'; generated_frm_dir='/home/mahdyar/Documents/MATLAB/gan_anomaly/data/UCSD/ped2/of2app/of2app_output/'; original_of_dir='/home/mahdyar/Documents/MATLAB/gan_...
% 适用于罗德FSW43频谱仪的一些控制命令 % obj = C_RS_FSW43('102.10.1.1'); 根据IP地址连接设备 % obj.saveASCII('C:\1.csv'); 将频谱数据以ASCII格式保存到仪器中 % [fre, power] = obj.getMaxPeak(); 获取频谱最高峰的幅度和频率 % [X, Y] = getMarkerN(obj, iMarker); % 获取Marker i对应的频率和幅度 classdef C_RS_FSW43 properties interface = 0; end methods function...
function [ pts ] = rotatePoints(pts, c, ang) ca = cos(ang); sa = sin(ang); R = [ca sa 0; -sa ca 0; 0 0 1]; pts = pts - c; pts = [pts; ones(1, size(pts,2))]; pts = R*pts; pts = pts + [c;0]; end
clear; N = 100; disturbance_factor = 100; errs = zeros(1, N); out_file = 'gyro_measurement_test.txt'; % The following data should be written: % - quaternion estimate (4) % - body frame angular rate estimate (3) % - quaternion disturbance, vector (3) % - body frame angular rate disturbance (3) %...
function [volume] = sphere_vol(radius) %SPHERE_VOL calculates the volume of a sphere % This function accepts either a scalar radius or an array of radii % and returns a scalar or array of volumes respectively % Inputs: % radii: a scalar radius or array of radii % Outputs: % volume: a scalar volume or arr...
function ProblemNo5() n = (-1:200); X = input('Enter an equation for x(n): '); for a= 1:200 if a==1 y(a)=-1.5*X(a+1)+2*X(a+2)-0.5*X(a+3); x(a)=X(a+1); elseif (a>1)&&(a<=199) y(a)=0.5*X(a+2)-0.5*X(a); x(a)=X(a+1); elseif a==200 y(a)=1.5*X(a+1)-2*X(a)+0.5*X(a-1); x(...
function [ samples ] = gaussRandom( mu, sigma, numSamples ) %GAUSSRANDOM Sample a normal distribution with parameters mu and sigma % Generate random points using a gaussian distribution if size(sigma,1)==1, sigma=eye(length(mu))*sigma; end samples = mvnrnd(mu,sigma,numSamples); end function [r,T]...
% [lx,ly]=size(mountain); % x=0:28.34:28.34*(ly-1); % y=0:28.34:28.34*(lx-1); % mesh(x,y,mountain); % %% % [lx,ly]=size(flat(30:40,30:40)); % x=0:30:30*(ly-1); % y=0:30:30*(lx-1); % mesh(x,y,flat(30:40,30:40)); % axis([0 300 0 300 -1000 1000]); % %% % [lx,ly]=size(flat); % x=0:30:30*(ly-1); % y=0:30:30*(lx-1); % mesh(x...
function [ Ecg, RLocation, RQuality, NewEnd, Time, AllFile ] = ReadEcg( FileName, ... RQualityFile, EcgStart, EcgEnd, fs, AllFile) % This function waits for data to be saved then reads it % Inputs: % FileName : The name of the file containing ECG % RFile : The name of the file containing RR interval % RQ...
% clear all clc A_start = 0.05; A_end = 1.5; A_step = 0.05; A_count = (A_end - A_start) / A_step + 2; A_array = zeros(1, int64(A_count)-1); T_of_A = zeros(1, int64(A_count)-1); for i=1:A_count, A_array(i) = 0.05 + (i-1)*0.05; % %Declarations x0= [A_array(i),0]; % y(0), y'(0) y0= [-1.5,3....
function marginal_plot(x, t, v, r1, cx) % MARGINAL_PLOT % % [] = marginal_plot(x, t, v, r, cx) % % Inputs : % x : array of size M_by_N % t,v : arrays of size M_by_I and I_by_N % r : Relative size of the main panel 0<r<1 % cx : color axis % % Outputs : % : % % Usage Example : [] = marginal_...
function varargout = centriodTest(varargin) % CENTRIODTEST MATLAB code for centriodTest.fig % CENTRIODTEST, by itself, creates a new CENTRIODTEST or raises the existing % singleton*. % % H = CENTRIODTEST returns the handle to a new CENTRIODTEST or the handle to % the existing singleton*. % % CE...
function [Q,R] = my_gsmith(A) Q = []; M = [1, 1/2, 1/3, 1/4; 1/2, 1/3, 1/4, 1/5; 1/3, 1/4, 1/5, 1/6; 1/4, 1/5, 1/6, 1/7]; for i=1:size(A,2) q = A(:,i); for k=1:size(Q,2) R(k,i) = q'*M*Q(:,k); q = q - R(k,i)*Q(:,k); end R(i,i) = sqrt(q'*M*q); Q(:,i) = q/R(i,i); end
function result = interpl(x, table, x1) % interpl.m does a linear interpolation at x1 in a table of values along x, % x is a row vector size n, table a matrix nXl and x1 a column vector size l % the result is a column vector of size l % take attention : vector x must match the rows in table, otherwise we assu...
clear;clc; fprintf("HI\n");
function [rho, E, Ftu, Fty, Fbear, Fshear, v] = materials(material) % 'Al7075' 'Al6061', 'AlBeMet', 'Steel', 'Ti6Al4V' % rho [kg/m3] : density % E [Pa] : Young modulus % Ftu [Pa] : Ultimate stress % Fty [Pa] : Yield stress % v [-] : Poisson ratio switch material case 'A286' Fty = 1400e6; ...
function [date_time, fake_gyro, fake_accel, real_gyro, real_accel, angles] = ... convert(fake_fname, real_fname, angle_fname) % Turns simulated test data into matrices. % Test data can be found in the model/tests directory, and follows the % format of: % y-m-d h:m:s:[microseconds] [gyroscope data] [accelerometer da...
% Gather all parameters of the semiconductors %% General q =1.6021766208e-19;% [C] absolute value of the chanrge electrons epsilon_0 = 8.85418782e-12*1e-6; % [cm-3 kg-1 s4 A2] vacuum permitivity T = 500; %[K] k_b = 1.3806e-23; h = 6.62607004e-34;% [m2 kg / s] Planck m0 = 9.109e-31 ;% [kg] mass electron V_t = k_b*T/q...
function encode_cf(img_dir, codebook_path, para) database = retr_database_dir(img_dir, '*_feat.mat'); load(codebook_path); dict = dict; parfor n = 1:length(database.path) fprintf('Encoding: %d of %d\n', n, length(database.path)); func_encode_cf(database.path{n}, dict, para ); ...
function [ cFkArea ] = makeFkCalculation(targetFk,rPoint,cPoint,wr,wc) cFkArea = zeros(wr*wc, 5); for r=1:wr for c=1:wc rp = r+rPoint; cp = c+cPoint; if r == 1 cFkArea(c, :) = targetFk(rp,cp,:); else cFkArea((r-1)*wc+c, :) ...
A_1a = [3 -1 1;3 6 2;3 3 7] b_1a = [1 0 4] [raizesA_1a difA_1a] = MetodoDeJacobi(3, A_1a, b_1a, zeros(3), 0.0000000001, 100) [raizesB_1a difB_1a] = MetodoDeGaussSeideiB(3, A_1a, b_1a, zeros(3), 0.0000000001, 100) tamA_1a = 1:size(difA_1a,2) tamB_1a = 1:size(difB_1a,2) plot( tamA_1a, difA_1a ) plot( tamB_1a, difB_1a ) ...
function setdt (delt) % this function allows for the specification of the delta-t value % (delta-t = tt - ut1) to be used in the calculation of sidereal % time and the terrestrial-to-celestial transformation. it allows % these calculations to be performed, correctly, using ut1 as the % time argument for the ear...
function [points, edgeInds, linePositions] = intersectLinePolygon(line, poly, varargin) %INTERSECTLINEPOLYGON Intersection points between a line and a polygon. % % P = intersectLinePolygon(LINE, POLY) % Returns the intersection points of the lines LINE with polygon POLY. % LINE is a 1-by-4 row vector contai...
function [w] = grdescent(func, w0, stepsize, maxiter, tolerance) % function [w]=grdescent(func,w0,stepsize,maxiter,tolerance) % % INPUT: % func function to minimize % w0 = initial weight vector % stepsize = initial gradient descent stepsize % tolerance = if norm(gradient)<tolerance, it quits % % OUTPUTS: % % w = fin...
function d = distancePQ(xP,yP,zP,xQ,yQ,zQ) % Function to calculate the distance between two points P and Q d = sqrt((xP-xQ).^2 + (yP-yQ).^2 + (zP-zQ)^2); end % function d = distance(xP,yP,zP,xQ,yQ,zQ) % % % d = sqrt((xP-xQ)^2 + (yP-yQ)^2 + (zP-zQ)^2);
% Rafael Villamor Lora % February 15, 2022 % SIMULATE LINEAR FLOW FROM APERTURE MAPS % % This script shows, step-by-step, how to simulate 2D steady laminar flow % of a Newtonian fluid with constant density using the Local Cubic Law % (LCL) approximation. clear all, close all, clc % LOAD DATA: APERTURE FIEL...
function sem = stderror(x,dim) sem= std(x,[],dim) / sqrt(size(x,dim)); end
function [rois, xyzrcoClusterPeaks] = ... registerRois(subject, theDate, location, varargin) p = inputParser ; addParameter(p,'whichClusters',[]); addParameter(p,'whichBlocks',[]); addParameter(p,'xMargin',15); addParameter(p,'yMargin',15); addParameter(p,'zFitStyle','poly11'); addParameter(p,'rFitStyle','poly1...
function [Data,para] = get_Data_SMS(Data,para) Data.kSpace = fftshift2(Data.kSpace); Data.mask = logical(abs(Data.kSpace(:,:,:,1,:,:,:))); Data.kSpace = ifft2(Data.kSpace); Data.kSpace = fftshift2(Data.kSpace); Data.kSpace = fft2(Data.kSpace); Data.kSpace = Data.kSpace.*Data.mask; nSMS = para.Recon.nSMS; Data.SMS = ex...
% % Script para demostrar la convergencia de la regla trapezoidal para funciones % no-periodicas y periodicas % close all; clear all; % % Funcion de prueba % f_fun = @(x) exp(1/sqrt(2) * sin(x)); int_exact_pi4 = 1.033247157375863; int_exact_2pi = 7.09347072432924; % % Convergencia para intervalo no-periodico % a = ...
function [A_t,sig_A,D_t,s,p,R,d1] = calcMertonModel(E_t,sig_E,K,t,T,r) % Calculates the Value of Firm Assets, Volatility of Firm Assets, % Debt-Value, Credit-Spread, Default Probability and Recovery Rate as per % Merton's Structural Credit Model. The value and volatility of firm assets % are found by Bivariate Ne...
tfinal=0.01; t=0:0.00001:tfinal; xanalog=cos(2*pi*400*t)+cos(2*pi*700*t); %critical sampling fs=2fm(fm=700) fs=1400; %Note that samples will repeat after 13/fs,hence its %sufficient if we consider first 14 samples(0 to 13) of analog %signal (observe the figures given previously) tsamp=0:1/fs:13/fs; xsampled=c...
filename=input('filename?: ','s'); data=load(filename); color=menu('please choose a color','red','blue','green') type=menu('please choose a type','star','square') switch color case 1 switch type case 1 plot(data,'r*') otherwise plot(data,'rs') ...
function [ Values, Classes, Likelihood, PriorProbability ] = NBTrain(AttributeSet, LabelSet) %Comments are stepped through as if we were using our %specific example of spambase.data PriorProbability = []; %The number of features %2 because its an mxn matrix so the index of n is 2 %Note:Matlab is...
function out = f_struct2flat(d,fname) % - turn a structure into a flat table & optionally export % % USAGE out = f_struct2flat(struct,'fname') % % struct = input structure % fname = optional filename for export % out = cell array of flattened structure % % SEE ALSO: f_extractFields % STRUCT2FLAT turns a structure ...
function datefinal=DMSPmanagedate(CURRENTDATE,SECONDS,SATNUMBER) %% DMSPmanagedate.m Transforms the time from seconds to actual date %-------------------------------------------------------------------------- % Input %------ % % CURRENTDATE - Number directloy taken from text file of UTD DMSp % rep...
function [Result, alpha, b, E] = examineExample(i2, xt, yt, alpha, C, tol, b, E) y2 = yt(i2); a2 = alpha(i2); E(i2) = fx(xt(i2, :), xt, yt, alpha, b) - y2; r2 = E(i2) * y2; if((r2 < -tol && a2 < C) || (r2 > tol && a2 > 0)) if(~isempty(find(((alpha ~= C) & (alpha ~= 0)), 1))) i1 = FindMaxStepi1(i2, C, alp...
function [G_J, c_J] = Jacobi_factorization(A, b) n = size(A); D =zeros(n,n); for i = 1:n D(i, i) = A(i, i); endfor L=tril(A,-1); U=triu(A,1); Di = inv(D); S=L+U; G_J = zeros(n,n); G_J = Di*S; for i = 1 : n G_J(i,i) = 0; endfor G_J = -G_J; c_J = zeros(n,...
function ImpointCurvePlot(n,sP,p,U,plotVector,Points) C = zeros( sP , 2 ); for l = 1:sP % work around, make sure other points are not needed C(l,:) = CurvePoint(n,p,U,Points,plotVector(l)); end plt_curve = plot(C(:,1),C(:,2),'r.'); hold on; Impoints = {...
function [trueAcc, permAccs, winTime] = runCompClass_PermTest(sub, ... winToUse, preproc, numPerm, numFolds, doZ, dataRoot, ... resultRoot, randSeedFile) % runCompClass_PermTest: a function for performing the high/low competition % classification task for each time window, and the accompanying % permutation tes...
%%%% MATLAB script to process FMRI data from visual experiments % gets the stimulus times from log files, extracts stimulus type and time % at which it occured, and saves an ideal convolved with an HRF to the % subject specific directory clear all ; close all stimnames{1} = 'unperturbed' ; stimnames{2} = 'cont...
function U0 = SparseIdentification(u_target,TOL,dt,n,N,M,A,V,epsilon,tau) % This function computes the adjoint algorithm for sparse source % identification (algorithm 4 in the paper) u0=zeros(2*N*N+N,1); [u0,error] = GradientDescent(u0,u_target,TOL,dt,n,M,A,V,epsilon,tau); % Call to gradient descent algorithm (...
function angles2d %ANGLES2D Description of functions for manipulating angles. % % Angles are normalized in an interval of width 2*PI. Most geom2d % functions return results in the [0 2*pi] interval, but it can be % convenient to consider the [-pi pi] interval as well. See the % normalizeAngle function to ...
function [output1] = R_LeftAbductionJoint(var1) if coder.target('MATLAB') [output1] = R_LeftAbductionJoint_mex(var1); else coder.cinclude('R_LeftAbductionJoint_src.h'); output1 = zeros(3, 3); coder.ceval('R_LeftAbductionJoint_src' ... ,coder.wref(ou...