text
stringlengths
8
6.12M
clc; clear; %Problem 1(i) n = input('Input Dimention \n'); wH = zeros(n); wL = wH; for i=1:n for j=1:n if i==ceil(n/2) wH(i,j) = 1; end end end for i=1:n for j=1:n if(i==j) wL(i,j)=1; end end end wV = rot90(wH); wR = rot90(wL); img =...
% calibrateGamma Calibrate Debye objects's gamma function % % This method calibrates the Debye object's gamma parameters % % >> object = evaluate(object,rhoData,gammaData); % % where rhoData, gammaData is the data set to fit to. % Bounds on the parameters can be specified with arrays of p_lower and % p_upper as % ...
function w2s2 = disp_GH_all_Ei1400(fix_mag_ff) Emax = 400; dE = 5; Dqh = [0.85,1.15]; Dqk = [0.85,1.15]; pr = projection([1,0,0],[0,1,0]); dat = fullfile(pwd,'sqw','data','Fe_ei1371_base.sqw'); s_1 = symop([1,0,0], [0,0,1], [1,0,0]); s_2 = symop([1,0,0], 90, [1,0,0]); s_3 = symop([1,0,0], -90, [1,0,0]); w2ss = cut_s...
%{ EC503 - Learning from Data March 2018 Word Embeddings De-biasing Function for soft bias method Worked on by: Frank Tranghese Requires CVX to be installed %} function [Wt] = softDebias(W,g,N) % *** INPUTS *** % W - entire word embedding set N x D % g - gender direction...
function [ACD_N_1_0,ACD_N_2_1,ACD_N_3_2,ACD_N_4_3,ACD_N_5_4,ACD_N_6_5,ACD_N_7_6]=ACD_N(n_e,T_e); global n_e_data_ACD_N; global T_e_data_ACD_N; global Table_ACD_N_1_0; global Table_ACD_N_2_1; global Table_ACD_N_3_2; global Table_ACD_N_4_3; global Table_ACD_N_5_4; global Table_ACD_N_6_5; global Table_ACD_N_7_6...
% Parameter Estimation and Inverse Problems, 3rd edition, 2018 % by R. Aster, B. Borchers, C. Thurber % % L = get_l_rough(n,deg) % % returns a 1D differentiating matrix operating on a series with n points. % % INPUT % n - the number of model points % deg - the order of the derivative to approximate % % OUTPUT % ...
function [corr_mat,srcind,trgind,srcecc,trgecc] = make_model_corr(src_area,trg_area,areas_srctemplate,ecc_srctemplate,pol_srctemplate) % Creates a cross-correlation matrix for retinotopic models % % Usage: % [corr_mat,srcind,trgind,srcecc,trgecc] = make_model_corr(src_area,trg_area,areas_srctemplate,ecc_srctemplat...
function F = EvaluationMetrics F.Brightness = @Brightness; F.Sharpness = @Sharpness; F.Blur = @Blur; F.Focus = @Focus; F.CompressVideo = @CompressVideo; F.MDE = @MDE; F.MUSE = @MUSE; F.JerkinessMatlab = @JerkinessMatlab; F.DivisiveNormalization = @DivisiveNormalization; ...
function [ pupil,mask,tip,tilt] = pupilOPL(rays,rmttp) %pupilOPL pupilOPL(rays) returns cumulative optical path difference % rmttp is whether to remove the Tip/Tilt/Piston (defaults to false) % pupil = full(sparse(rays.map(:,1),rays.map(:,2),rays.opl(:))); % mask = full(sparse(rays.map(:,1),rays.map(:,2),true)); ...
clear all close all clc num = 99; %% kx = 3; ky = 3; x = linspace(0,pi/2,num); y = x; [xx yy] = meshgrid(x,y); f = sin(kx * xx) .* sin(ky * yy) integral2 = simpson2d(f,x(1),x(end),y(1),y(end)) f1 = sin(kx * x); integral1 = simpson1d(f1,x(1),x(end)) %% clear all close all clc num = 9; xMin = 0; xMax = 2; yMin ...
function filteredFile = filteringData(filepath, filename, PathToSaveFile) close all; filepath filename PathToSaveFile Accelerometerjalllal = importfilecsvtomatrix(filepath); subplot(511); plot(Accelerometerjalllal); subplot(512); [B,A] = butter(2,0.05); plot(filter(B,A,Accelerometerjalllal(:,1:3))); hold on;...
function smoothed_data=smooth_ROI(ROI_path,n,varargin) % smoothed_data=smooth_ROI(ROI_path,n_smooth,varargin) % % takes a ROI structure input and returns a smoothed and checked version % of the ROI on the full cortical surface (for visualization purposes) % varargin may include ROI indices to visualize R=load(ROI_path...
clear all ; close all ; responders = {'alexandra3','fabio','gab','gabriella','genevieve','gina','jeremie','julie','katrine','marie','maxime','mingham','po','russell','suhan2','tegan2'} ; stims = {'S 11','S 12','S 13','S 14','S 15','S 16'} ; % get the top components (hand picked) for r=16%:length(responders) cd...
function Z = projectData(X, U, K) %PROJECTDATA Computes the reduced data representation when projecting only %on to the top k eigenvectors % Z = zeros(size(X, 1), K); U_reduce = U(:,1:K); Z = X*U_reduce; % ============================================================= end
function J = imPad( I, pad, type ) % Pad an image along its four boundaries. % % Similar to Matlab's padarray, with the following differences: % (1) limited to padding along height and width % (2) input format allows for separate padding along each dimension % (3) padding values may be negative, in which case perfor...
% % Cette fonction renvoie TRUE => la méthode explicite est stable pour % les parametres a,b,D,h,k % Une valeur de retour FALSE ne signifie pas que la methode explicite % sera instable. % function [ is_stable ] = is_stable_expl( a,b,D,h,k ) lambda_a = a*k/h; lambda_b = b*k; lambda_d = D*k/h^2; if...
%% Control Systems Engineering % Mass-Spring Damper System %% Initial Conditions m_1 = 1; % units in Kg m_2 = 1; % units in Kg k_1 = 1; % units in N/m changes for other conditions (1,1,0) k_2 = 1; % units in N/m changes for other conditions (1,1,0) c_1 = 1; % units in Kg/s changes for other c...
function varargout = doc_linsol(varargin) %DOC_LINSOL Get the documentation string for a plugin. % % char = DOC_LINSOL(char name) % % % % [varargout{1:nargout}] = casadiMEX(840, varargin{:}); end
function [niter, xvalue, X] = RegulaFalsi(xl, xu, f, tor) niter = 0; xvalue = 0; f = matlabFunction(f); X = [xl]; xvalue = (xu*f(xl)-xl*f(xu))/(f(xl)-f(xu)); judge = abs(xvalue-xl); while(judge>tor) niter = niter+1; xl = xvalue; xvalue = (xu*f(xl)-xl*f(xu))/(f(...
function docNode=add_contact_pair_FEB(docNode,FEB_struct,disp_opt) % function docNode=add_contact_pair_FEB(docNode,FEB_struct,disp_opt) % ------------------------------------------------------------------------ % This function adds FEBio contact definitions the input docNode defining % an XML file suitable for ge...
% function total=analyzeWaterDistribution(minSize, maxSize) % function to load and analyze water distribution in aggregate and by % region. Makes plots. Also creates shapefile %% non-function params clear minSize=0; maxSize=1e12; % 1km2 %% params saveFigs=0; saveShp=0; atUCLA=0; %% directories if ~i...
System_parameters; MSE = gsubtract(out.output_BB,out.output_NN); max_MSE = max(abs(MSE)) plot(MSE)
%ax^2 + bx + c = 0 function [root1,root2,root3,root4] = solve(a,b,c) h = 1; if(or(abs(a)>10.^150,or(abs(b)>10.^150,abs(c)>10.^150))) h = 10.^150; end root1 = ((-1).*b + h.*sqrt((b./h).^2 - 4.*(a./h).*(c./h)))./(2.*a); root2 = ((-1).*b - h.*sqrt((b./h).^2 - 4.*(a./h).*(c./h)))./(2.*a); root...
% for i=1:100 fprintf('n=%g\n',i) tango_command_inout('ANS/SY/CENTRAL','FireSoftEvent'); pause(1) end %
df_min = [ -4, -4, -2.0, -1.0, 0, 1.0, 2.0, 4, 4]; U_min = [-20, -6, -1.5, -1.0, 0, -1.0, -1.5, -6, -20]; df_max = [-10, -5, -5.0, -1.0, 0, 1.0, 5.0, 5, 10]; U_max = [-20, -6, 1.5, 1.5, 0, 1.5, 1.5, -6, -20]; df = [ -10, -8, -6, -4, -2, 0, 2, 4, 8, 10]; U = [58.7, 68.3, 7...
function h = heaviside(t) % function h = heaviside(t) % % Returns 0 if t<0 and 1 if t>=0 % % B. Parent 2013-11-28 h = 0.5 * (1 + sign(t)); indices = find( abs(t)<eps ); h(indices) = ones(size(indices));
function A=homography2intrinsic(Hbig) % The intrinsic matrix A is calculated from n homographies. % Hbig is a 3x3xn matrix of homographies. This file is used by % calib_zhang_simple, and is based on Zhang's calibration % technique (see calib_zhang_simple.m) % % Assumes the homogeneous coordinate is at the end (i...
%% Scratch script to generate total coverage plots %% Written by Hugh Roarty on March 26, 2010 % Modified on March 7, 2017 to plot files that are already concatenated tic close all; clear all; % addpath /home/codaradm/HFR_Progs-2_1_3beta/matlab/general % addpath /home/codaradm/operational_scripts/totals % add_subdire...
function bvp_obj = setup_problem_car(bvp_obj,modelParameters, disc, N) %INITIALIZE_OPT_CAR Summary of this function goes here % Detailed explanation goes here if(strcmp(bvp_obj.type, 'heading') || strcmp(bvp_obj.type, 'parallel') ) [opti_fwd, X_fwd, U_fwd, T_fwd, modelParams_fwd, initStateParams_fwd, finalStatePa...
function [segmentation, centers] = kmeans_custom(Im_vec, K, L, seed) % Prepping the cluster centers and setting a threshold centers = zeros(K, 3); threshold = 2; % Fetching centers from image idx = randperm(size(Im_vec, 1), K); for i = 1 : K centers(i, :) = Im_vec(idx(i), :); end % Computing the distance from pi...
close all clc clear; %% % 读取图像 [filename, pathname] = uigetfile('*.jpg', '读取图片文件'); %选择图片文件 pathfile=fullfile(pathname, filename); %获得图片路径 rgb=imread(pathfile); rgb=imresize(rgb,[720,960]); [m,n,z]=size(rgb); % 灰度转换 if(z>2) bw=rgb2gray(rgb); end %% % 提取感兴趣区域 xx = Circle_Region_seg( bw ); % [c,r]=...
function[E]=kp_6bands_Luttinger_Kohn_f(k_list, Dso, g1, g2, g3) % Calvin Yi-Ping Chao and Shun Lien Chuang % PHYSICAL REVIEW B VOLUME 46, NUMBER 7, (1992) % "Spin-orbit-coupling effects on the valence-band structure of strained semiconductor quantum wells" % Warren James Elder % PhD thesis: "Semi-empirical mod...
function r_beeswarm(X,G) if nargin<2 X=[randn(100,1); 0.2+randn(100,1)]; G=[ones(100,1); 2*ones(100,1)]; end c=G(randperm(length(G))); %% saveR('Data.R','X','G','c') system([getRscript, ' ', mfilename('fullpath'), '.r']); imshow('output.tif')
function cur_hfil=gchfil %GCHFIL Get current hdf5-file % % cur_hfil=gchfil; % % % Example % hfile=gchfil; % % See also gcdp, gcv hfig=gcf; cmsplot_prop=get(hfig,'userdata'); cur_hfil=cmsplot_prop.filename;
function [ ] = drawPts( img, pts ) hold off imagesc(img); colormap gray hold on plot(pts(:,1), pts(:,2), 'yo','LineWidth',1) axis equal end
function [networkActivity, nn] = run_network(adjMat, neuronLabels, isDep, isDiv, taus, kernType, stimulus, iActivityInj, DepletionRate, TauReplenishment) % RUN_NETWORK creates a network and runs it for a single trial condition % Input parameters - % adjMat: Adjacency matrix of connection strengths. Fir...
function [] = export_EEG_events(EEG) % save triggers/event info EEG.EVENTLIST = []; EEG = pop_creabasiceventlist(EEG,'AlphanumericCleaning','on','BoundaryNumeric',{-99},'BoundaryString',{'boundary'}); el = EEG.EVENTLIST.eventinfo; elT = struct2table(el); elT = elT(:,{'item','code','spoint'}); C = cell(size(elT,1),1);...
function [idx] = Todos_intentos(direcciones) direcciones = direcciones'; idx.der = []; idx.arriba_der = []; idx.arriba = []; idx.arriba_izq = []; idx.izq = []; idx.abajo_izq = []; idx.abajo = []; idx.abajo_der = []; for k = 1:size(direcciones) if (direcciones(k) == 0) idx.der(size(...
function [ah,cobh] = showmatabw(varargin) % Hilfsroutine zum Visualisieren von Arrays in einer Figure. % % Aufruf: showmata(a,b,c,...) % % Die Matrizen werden als Images in einer Figure % dargestellt, wobei die Farbcodierung zur Verbesserung der % Vergleichbarkeit in allen Achsen identisch ist. % % Falls nan (Not a N...
% Initial Values finalIndex = 100; deltaT = 0.1; Q = eye(3); F = eye(3); R = eye(2); x = cell(finalIndex,1); x{1} = [1.4 0 pi/8]'; % Calculate A and B matrices A = cell(finalIndex,1); B = A; xRef = zeros(finalIndex,3); uRef = zeros(finalIndex,2); %% Determine reference path syms t y x_func = cos(t); y_func = sin(t); ...
%%Code For One Dimention Heat Diffusion Explicit method clc clear all N=input('Enter Numbber of Grids = '); dt=0.1; L=10/1000; dx=L/(N-1); alpha=0.25/(2000*1300); kapa=(alpha*dt)/(dx*dx); step=1; x=1:1:N; %boumdry Conditions for i=1:N Tp(i)=30; % Row matrix For Previous Time Step end Tp(1)=250; Tp(N...
function [f, Jc, Jr] = jacobian_realsense(centers, radii, blocks, model_points, model_indices, block_indices, data_points, settings, fitting_type) D = settings.D; num_points = length(model_points); if strcmp(fitting_type, 'point_to_plane') f = zeros(num_points, 1); Jc = zeros(num_points, length(centers) * D)...
%Demo triangle_th.m performing gray image thresholding using the Triangle Method. %The demo reads a RGB image of vegetation against soil background. %This image is converted to a gray level image %% Read image RGB image and convert to gray level %Reads RGB Ib=imread('coins.png'); %% [lehisto x]=imhist(Ib); ...
function varargout = Time_Domain_Calculations(varargin) % TIME_DOMAIN_CALCULATIONS MATLAB code for Time_Domain_Calculations.fig % TIME_DOMAIN_CALCULATIONS, by itself, creates a new TIME_DOMAIN_CALCULATIONS or raises the existing % singleton*. % % H = TIME_DOMAIN_CALCULATIONS returns the handle to a new T...
classdef NeuroEvolutionUP properties saveFile = []; visualize = []; environment = []; environmentProperties = []; agent0 = []; agent0Properties = []; agent1 = []; agent1Properties = []; agent2 = []; agent2Properties = []; end properties(Depende...
close all clear all cd('/Users/marcw/DATA/subject0'); d = dir('*.mat'); n = numel(d) M = struct([]); for ii = 1:n fname = d(ii).name load(fname) M = [M Q]; end whos lat = [M.latency]*1000; V = [M.velocity]; D = [M.density]; uV = unique(V); nV = numel(uV); uD = unique(D); nD = numel(uD...
function outseis(outfilename,tr); % % function writing an su file; % function was more or less copied from the outseis.c function % of SOFI2D (see http://www.gpi.kit.edu/SOFI2D.php for source code of SOFI2D) % % Input: % outfilename : name of the su file % tr : struct containing the ...
function [J, grad] = costFunctionReg(theta, X, y, lambda) %COSTFUNCTIONREG Compute cost and gradient for logistic regression with regularization % J = COSTFUNCTIONREG(theta, X, y, lambda) computes the cost of using % theta as the parameter for regularized logistic regression and the % gradient of the cost w.r.t. ...
function varargout = pole_zero_filter_design(varargin) % POLE_ZERO_FILTER_DESIGN MATLAB code for pole_zero_filter_design.fig % POLE_ZERO_FILTER_DESIGN, by itself, creates a new POLE_ZERO_FILTER_DESIGN or raises the existing % singleton*. % % H = POLE_ZERO_FILTER_DESIGN returns the handle to a new POLE_ZE...
function [x] = RMSD(input,output) [r,c]=size(input); N=r*c; x=sum((double(input)-double(output)).^2,'all'); x=sqrt(x/N); return end
%% ESO Design with PX4 Controller with X based rotary wing UAV % Design of controllers is based on using Anton Erasmus Thesis and notation addpath(genpath('simulation_setup')); clear model_parameters; clear setup_simulation; %% Constants setup_simulation; % model_parameters; s = tf('s'); %% Angular Rate Plant Dynamic...
function Exp=HKLExpansion(conMat,Tensors,uvw,Temps,xscreen,yscreen,lsfits,inUVW3) %CTERun License %Copyright (c) 2012, The Kriven Research Group. All rights reserved. %Redistribution and use in source and binary forms, with or without %modification, are permitted provided that the following conditions are met: %1....
function [H, L] = storeR( F, levelF, o, H, L) %------------------------------------------------------------------------------ % % This function stores a two-dimensional gridfunction F into H for % future extraction. Properties and location are stored in the book- % keeping matrix L. % This function is a two-dimensiona...
function [xout,yout]=boxcar(x,y,n) %BOXCAR Reduce the number of points in an X,Y data pair by averaging. % [XB,YB]=BOXCAR(X,Y,N) will return XB,YB containing a factor of N fewer % points than [X,Y]. x=x(:); y=y(:); sz=length(y); yout=zeros(size(y(1:n:(sz-n+1)))); xout=yout; for cnt=1:n, yout=yout+y(cnt:n:(sz+cnt...
% book : Signals and Systems Laboratory with MATLAB % authors : Alex Palamides & Anastasia Veloni % % % Problem 2- Frequency Response Graph % % % % 8w^2+2jw+9 % H(jw)=--------------- % 6(jw)^...
function [ i, j ] = XYtoIJ(x, y, Xmax, Ymax, R, C) % compute pixel map coordinates from World cartesian coordinates % Detailed explanation goes here % -------->x % | % | % | %y v % i=1 is bottom row (y=Ymax) % j=1 is left column (x=0) i = round(((y)./Ymax).*(R-1))+1; j = round((x./Xmax).*(C-1))+1; end
function [NV,NI] = uniformly_sample(V,un,varargin) % UNIFORMLY_SAMPLE Uniformly sample an input curve % % NV = uniformly_sample(V,un,'ParameterName',ParameterValue, ...) % % Inputs: % V #V by dim list of ordered input points on an open curve % un # of samples {100} % Optional: % 'Loop' follo...
% after we hit space, we draw the black chess function draw_black_chess() global fig ax has_previous prev_cross black_pos black turn game_mode; delete(prev_cross); plot(ax, black_pos(1), black_pos(2), 'ko', 'MarkerFaceColor','k', 'MarkerEdgeColor','k', 'MarkerSize',13); has_previous = false; % ...
% problem 7 code n = 100; % Creating A A = zeros(n); for i = 1:n for j = 1:n A(i,j) = i * n - (n - j); end end b = (1:n)'; % We want the first (n-rank(A)) = 2 components to be zero % thus we want to find the values of the last 2 columns B = A(:, n-1:n); x0 = pinv(B)*b; % last 2 values o...
%function x=medellhgr(disfil) function x=medellhgr(disfil) [dist,mminj,konrod,bb,hy,mz,ks,buntyp,bunref,distlist,staton,masfil,rubrik,detpos,fu]=readdist(disfil); block=masfil(5:6); batchfil=['/p4/cm/' block '/div/bunhist/batch-data.txt']; [eladd,garburn,antal,levyear,enr,buntot,weight,eta,typ,stav]=readbatch(batchfil)...
close all; clear; clc; load indeks dataset = hdf5read('food_c101_n1000_r384x384x3.h5', '/images'); dataset = permute(dataset,[4 3 2 1]); im = zeros(384,384,3); for idx=1:size(indeks_pengamatan,2) for chn=1:3 im(:,:,chn) = dataset(indeks_pengamatan(idx),:,:,chn); end im = imrotate(uint8(im), 45, 'bi...
function h = f_plotBarsV(x,grp,rel,labels,err,width) % - vertical bar graphs % % USAGE: h = f_plotBarsV(x,grp,rel,labels,err,width); % % x = abundance data (columnwise) % grp = col vector of integers specifying group membership % rel = use relative abundance instead of group mean (default = 0) % labels =...
nmax = 100:100:100000; t=0; a = 0; b=0; c=0; for i=0:length(nmax) tic; a = b+c; t = t + toc; end t = t/length(nmax)
function [rho_ge_ft,diag_test]=rho_ge_f_HEOM2(N,om_1_rng,sup_op_ge,HL,tol) % Simplified version, works in exciton basis and assumes no explicit % vibrations are included % om_scale = typical frequency of exciton transfer % L_eg is -1i[H,rho_{eg}], plus extra acting on one specific tier of the % density mat...
function [tempTrafficBuffer] = changeTrafficBuffer (primaryPathTable, trafficBuffer) PR = length(primaryPathTable); TB = length(trafficBuffer); tempTrafficBuffer = zeros(1,2); for i = 1: PR tempTrafficBuffer(i,1) = primaryPathTable(i); tempTrafficBuffer(i,2) = 0; end ...
function Circle() %Introduction to the function disp('The General Equation of the Circle is in the form:') disp(' ') disp("Ax^2 + Ay^2 + Bx + Cy + G") disp(' ') disp('Simplified:') disp("x^2 + y^2 + Dx + Ey + F") disp(' ') disp("Where:") disp("D = B/A") disp("E = C/A") disp("F = G/A") disp(' ') disp("This...
function [stats,printouts] = accuracyStats(gt,prediction,varargin) % Provides the most common statistical means for the accuracy assessment % of multivariate classification tasks. Measures are stored in the MATLAB % struct 'stats' and include (name: description): % % - cfmat: Confusion matrix (absolute numbers) %...
function [freq, peak, dsp] = get_all_tones( signal, fs, thr, win ) % %function freq = get_all_tones( signal, fs [,thr, win ] ) % % Retourne toutes les frequences detectees dans le signal %sous la forme d'un vecteur ligne 'freq'. La methode utilisee %est une convolution entre la DSP de 'signal', puis une %dete...
%% Returnerar dT för varm och kall ström för %% %% Motström %% För simulering ensam %% T(1) är kallvatten ut %% T(2n) är varmvatten ut %% T(n) är kallvatten in %% T(n+1) är varmvatten in %% %% 1 2 .. n %% <-------- kv in %% --------> %%n+1 .. 2*n %In kommer 1:n-1, n+1:2n, dvs 2n-2 st function d...
function [cfg] = config_lasso(nchains,jobname,mu,b) %CONFIG configure five node model and parallel tempering options % % [cfg] = config() % % Initialize default configuration options cfg = init_config_defaults(); %% Parameter definitions (see BNGL model for parameter descriptions) [REQUIRED] % Available prior distri...
function ClusterFunc_00_ShowInfo(self) S = {self.name, ... sprintf('@%s', class(self)), ... sprintf('%d spikes', self.nSpikes()), '', ... }; for iL = 1:self.nLimits S = cat(2, S, ... sprintf('Limited on < %s X %s >', self.featuresX{iL}.name, self.featuresY{iL}.name)); end msgbox(S, self.name); ...
function [ source_out ] = construct_source( prim_cc,dadx_cc ) %Function "construct_source" % Adapted for MATLAB from Joe Derlaga's "residual.f90", 071113. % Constructs the Q1D area source term for the x-momentum equation. global param source = prim_cc(:,3) .* dadx_cc(:); % Do not return values over ghos...
function [] = motion_trajectory( vo , ao, ho, n) addpath('functions'); % -------------------------- Parametros Iniciais -------------------------- g = -9.809; % [m/s^2] Aceleração da gravidade so = 0; syms t; % Componentes da velocida vox = vo*cos(ao*pi/180); voy = vo*sin(...
#include "com_codename1_ui_animations_Timeline.h" const struct clazz *base_interfaces_for_com_codename1_ui_animations_Timeline[] = {&class__com_codename1_ui_animations_Animation, &class__com_codename1_ui_Painter}; struct clazz class__com_codename1_ui_animations_Timeline = { DEBUG_GC_INIT &class__java_lang_Class, 9999...
clc clear close all L1 = .4; L2 = L1*sind(60); l1 = .2; l2 = .2; h = .4268; f = .05; actuator_length = 0.25; P = actuator_length*2; % Desired motion m = 10000; tf = 10; t = linspace(0,tf,m); theta = 20*sin(115/15*t)*pi/180; phi = 15*sin(10*t)*pi/180; z = .1*sin(.5*t); H = h+z; vars = table(L1,L2,l1,l2,theta,phi...
function [predictProbLearning,predictProbTest,predictClassTest,N_Leaf,Nb_arbre,depthM]= ... runRandomForest(depLearning,explLearning,explTest,depLearningQual) %% fix random number generator for reproducibility rng(200000); s=rng; rng(s); %% find the optimal number of trees Prior_Prob=[1-...
function [B] = rotacionZ(A, theta) rotZ = [cos(theta) -sin(theta) 0 0;... sin(theta) cos(theta) 0 0;... 0 0 1 0;... 0 0 0 1]; B = A*rotZ; end
close all; name = {'2 lux'; '43 lux'; '90 lux'; '243 lux'}; rgb = [0.24, 0.13, 0.03, 0.02; 0.03, 0.01, 0.0, 0.0]'; x = 1:4; b = bar(x, rgb, 1); b(1).FaceColor = 'red'; b(2).FaceColor = 'blue'; set(gca, 'xticklabel', name); legend('RGB','RGBD'); xlabel('Lighting', 'FontSize', 13); ylabel('Error Percentage', 'Fon...
function z= bayes_classifier(m, S, P, X) [l,c] = size(m); % dimnesionality [l, N] = size(X); % number of data vectors for i=1:N for j=1:c t(j) = P(j) * comp_gauss_dens_val(m(:,j), S(:,:,j), X(:,i)); end [num, z(i)] = max(t); end end
% Script to run a STABILITY_FIR pipeline analysis on the twins database. % % Copyright (c) Pierre Bellec, % Research Centre of the Montreal Geriatric Institute % & Department of Computer Science and Operations Research % University of Montreal, Québec, Canada, 2010-2012 % Maintainer : pierre.bellec@criugm.qc.ca ...
function L = computeCost(y, tX, beta) % Compute the MSE N = length(y); %compute number of data points e = y - tX*beta; %compute the error of the model L = e'*e/(2*N); %compute MSE cost functions end
% % Classe CTpchnl % % Classe de gestion des échelles de temps % % Permet d'afficher les datas en fonction du temps ou on % décide de la référence temporelle (premier échantillon: % zéro ou autre...) % classdef CTpchnl < handle properties Dato ={}; end properties (SetAccess = protected) ...
function plot_gnss_file(file_path) % Plot first 0.1s data in specific file. n = 4e5; %0.1s fileID = fopen(file_path, 'r'); data = fread(fileID, [2,n], 'int16'); %two row vector figure plot((1:n)/4e6, data(1,:)) hold on plot((1:n)/4e6, data(2,:)) fclose(fileID); end
% KU Leuven - Technology Campus Gent, % Gebroeders De Smetstraat 1, % B-9000 Gent, Belgium % % File: Si_MOSFET_CSD17551Q3A_power_calculation % Created: 2020-04-16 % Author: Jonas De Schoenmacker % Version: 1.0 % % Description: Vermogenverlies in MOSFETs CSD17551Q3A, masterproef: % snelladen...
function [ data ] = read_cell( file, dim ) %READ_CELL Summary of this function goes here % Detailed explanation goes here data = cell(dim,1,0); fin = fopen('hmm_o.txt'); count = 0; while ~feof(fin) line = fgetl(fin); a = sscanf(line,'[ %f %f %f]; '); l = size(a,1)/3; count = count + 1; for i=1:l ...
function [result,z,x,pi] = fullrsm(m,n,c,A,b) % Solves a linear program using Gauss-Jordon updates % Assumes standard computational form % Performs a Phase I procedure starting from an artificial basis % Author: Alex Kennedy | aken327 | 460783474 % Input: % m,n = number of constraints and variables % c =...
function [pth_script_parfor,pth_script_dummy] = create_bash_scripts(dir_scripts_l,dir_scripts_h,jnam_h,jnam_dummy,fun,dir_logs_h,matlab_h,pwd_h,t) % Create bash scripts that are called using qsub to run on holly. % % Mikael Brudfors % 2017-11-04 %=========================================================================...
% non-linear constraint functions % May 1, 2013 function [c, ceq] = nonlconst3(a) % Nonlinear inequality constraints, c(a)<=0 %c = []; %c = [-a(1)^2-a(5)^2+a(2)^2+a(6)^2; % a(2)^2-(sqrt(a(1)^2+a(5)^2)+sqrt(a(1)^2+a(5)^2-a(2)^2-a(6)^2))^2*sin(2*thetaN)^2]; % c = [ -a(1)^2-a(5)^2+a(2)^2+a(6)^2; % a(2)^2-(sqr...
function [ X, y ] = GenerateTrainData( criterion, numSets, numObj, numFeat, ... par, alg) % Function generates data set and target vector to learn the classification % algorithm to forecast the best FSM using the corresponding data set % % Input: % criterion - string - name of ...
%% set hyperparams fs = 44100; blockSize = 1024; hopSize = 512; %% sin wav test f1 = 441; f2 = 882; t1 = (0: 1/fs : 1); t2 = (0: 1/fs : 1); % generate sin wav sin_t1 = sin(2*pi*f1*t1); sin_t2 = sin(2*pi*f2*t2); sin_t = [sin_t1,sin_t2(2:end)]'; % calculate f0 by finding max bin in spectrum [f0_max, ts] = myPitchTrackMax...
function f = es8(x) %Trying es8 function for k=1:60 x=sqrt(x); end for k=1:60 x=x*x; end f=x; end
for a=1:1000 for b=a:1000 c=1000-b-a; if c==sqrt(b^2+a^2); disp(a), disp(b), disp(c) end end end
clear all; clc; N=100; %M=17; fileID=fopen('Mini_150.csv','w'); A=zeros(100,2); B=zeros(100,2); T=csvread('Dataset2.csv'); %fprintf(fileID,"For N = %d\n\n\n",N); %fprintf(fileID,"M count cv\n"); for M = 1:100 min=10; max=20; for i=1:M for j=1:N % P(i,j)=i+j; ...
ifile = '../../tensors/3d_3_8.tns'; tns = sptLoadSparseTensor(1, ifile); ts = tic; for niter = 1:5 Z = sptSparseTensorAdd(tns, tns); sptFreeSparseTensor(Z); end time = toc(ts); fprintf('seq add time: %f sec\n', time/5); sptFreeSparseTensor(tns);
classdef TimeArray < irf.Time %TimeArray Class representing a time array % Many time points % ---------------------------------------------------------------------------- % "THE BEER-WARE LICENSE" (Revision 42): % <yuri@irfu.se> wrote this file. As long as you retain this notice you % can do whatever you want...
function result = _b (node, elem, ne) result(1,1) = node(elem(ne,2),2) - node(elem(ne,3),2); result(2,1) = node(elem(ne,3),2) - node(elem(ne,1),2); result(3,1) = node(elem(ne,1),2) - node(elem(ne,2),2); endfunction
clear A = [ -2.0 0.5 1.20 ; 0.0 -1.0 0.10 ; -0.2 0.1 -1.00 ]; B = [ 1 0 ; ... 0 1 ; ... 0 0 ]; C = [1 0 1]'; T = 2; Nt = 100; tspan = linspace(0,T,Nt); x0 = [0 0 1]'; [ut_opt,xt_opt,xt_free] = SolveOCP(A,B,C,tspan,x0); %% figure(1) subplot(3,1,1) plot(ut_opt') title('ut opt') subp...
function imd = CS4640_im_dist(im1,im2) % CS4640_im_dist - pixel-wise vector distance between images % On input: % im1 (M1xN1xP1 array): image 1 % im2 (M2xN2xP2 array): image 2 % On output: % imd (M1xN1 array): distace image % Call: % imd = CS4640_im_dist(im1,im2); % Author: % Kyle Heaton % UU % Spri...
function [A, msg] = rs232(varargin) % [A, MSG] = RS232 % % Constructor of class rs232 % % Dick Heeren % 2013 Marc van Wanrooij switch nargin case 0 A.baudrate = 115200; A.timeout = 1000; % 1 sec A.connected = true; A = class(A, 'rs232'); [~, msg] = serialport(0,[A.baudrate,A.timeout]);...
%直接序列扩频部分 function output_dsss = dsss(input_signal,seq_m) i_s_len = length(input_signal); input_signal = repmat(input_signal,1,8); input_signal = reshape(input_signal,i_s_len,8); input_signal = input_signal'; input_signal = reshape(input_signal,1,i_s_len*8); input_signal = 2*input_signal - 1; output_dsss = ...