text
stringlengths
8
6.12M
function [ optimal_numClust, optimal_temporalFactor ] = ... optimal_numClust_temporalFactor( trial_idx, temporalFactor_range, numClust_range ) optimal_temporalFactor = temporalFactor_range(mod((trial_idx-1), length(temporalFactor_range)) + 1); optimal_numClust = numClust_range(ceil(trial_idx / length(temporalFacto...
function binaryFn = binary_function(attackAlgo, originalImage, watermarkedImage, detectFunction) wImg = imread(watermarkedImage); function [res, out, attackedImage] = try_attack(factor, varargin) attackedImage = uint8(attackAlgo(wImg, factor)); [res, out] = detectFunction(originalImage, watermar...
function [t,w] = GLinterval32(a,b,NPanels,pedges) % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % [t,w] = GLinterval(a,b,NPanels) % Returns nodes and weights for composite 32 point Gauss-Legendre quadrature % using NPanels panels over (a,b) % % [t,w] = GLinterval(a,b,NPanels,pedges...
function [AccountVal, PayoutVal, FeeVal] = calcValuePayoutAndFees_VEC( ... Holdings_0, assetPrice, annualWithdrawalRate, annualFee) % CALCVALUEPAYOUTANDFEES_VEC estimates the account value, the payout % amounts, and the fees collected for a Monte Carlo simulation of the GMWB. % % It makes some changes to the o...
clc, clear all, close all %% ANALYZE MEASURED DATA % Load data load Dam_properties.mat % Get mean values spec_mean = mean(spec')'; % Mean ZF-dam/mch-dam frac methylated mch_dam = mean(act')'; % Mean mch-dam frac methylated ZF_dam = mch_dam.*spec_mean; % Mean ZF-dam frac methylated %% FUNCTIONS TO...
function A = sym_polymat(x,n) A = []; for i = n:-1:1 if i > 0 A(:,end+1) = abs(x).^i .* sign(x); else A(:,end+1) = 1; end end
% Tim Truster % 10/08/2014 % 2D CZ element, elastic stiffness only %% Task Switch - Perform various element functions switch isw %% case 1 % Setup up elemental degrees of freedom (OPTIONAL) % Purpose: Rearrange order of dofs on element and/or flag certain % dofs to be presecribed away % Cal...
function W_out = eval_w_many_points(K,wc,wp) % W_out = eval_w_many_points(K,wc,wp) % % Evaluate a polynomial w(k), expressed as a coefficient matrix (wc) and a % powers matrix (wp), at the points K (2-by-N). This is the same as the % function eval_w, but can handle a 2-by-N input. However, calling this % function on a ...
clear params folders = dir("../data/Section1_SeveralCaptures"); base_save_folder = "../results/sec1/"; mkdir(base_save_folder); folders = folders(3:end); global params params.b = 0.001; for folder = folders(1)' save_folder = strcat(base_save_folder,folder.name); mkdir(save_folder); disp(fullfile(folder.fol...
function matData = load_mat(myFolder) if ~isdir(myFolder) errorMessage = sprintf('Error: The following folder does not exist:\n%s', myFolder); uiwait(warndlg(errorMessage)); return; end filePattern = fullfile(myFolder, '*.mat'); matFiles = dir(filePattern); for k = 1:length(matFiles) baseFileName =...
function [gSC, deltaSC, dev, glob] = gradDesc(SC, FC, mode, k1, lambda,extra) %% define some masks h1 = logical(diag(ones(length(SC)/2,1),+length(SC)/2)); % get masks for LH2RH and h2 = logical(diag(ones(length(SC)/2,1),-length(SC)/2)); % RH2LH homotopic connections h = h1 + h...
d = 25; rg = range(d, 'roadster.mat', 'speed_elsa.mat', 10000, 100); disp(['Battery charge expected being enough for driving ', num2str(rg), 'km.']); % Battery charge expected being enough for driving 49.6698 km. rg = range(d, 'roadster.mat', 'speed_anna.mat', 2000, 100); disp(['Battery charge expected being enough for...
function caffe_set_blobs_data(net, blobs, blob_names) % % This file is part of the code that implements the following ICCV2015 accepted paper: % title: "Object detection via a multi-region & semantic segmentation-aware CNN model" % authors: Spyros Gidaris, Nikos Komodakis % institution: Universite Paris Est, Ecole des...
clear all; close all; clc; dbg = true; fnm_alpha = pathos('_bkp/renkli_marker_alpha.csv'); if ~exist(fnm_alpha), error(sprintf('19bal/heg/.../05-vid-renkli-marker/_bkp/%s yi buraya kopyala\nVEYA bunu dene: https://github.com/downloads/19bal/heg/renkli_marker_alpha.csv', fnm_alpha)); end disp('anlik....
function [h,L,M,ground] = add_shadow(T,L,varargin) % ADD_SHADOW Add a shadow for plotted mesh (t) according to light (l) % % h = add_shadow() % Apply to all % h = add_shadow(T,L) % h = add_shadow(T,L,'ParameterName',ParameterValue,...) % h = add_shadow([],[],'ParameterName',ParameterValue,...) % apply to...
function [ dataArray ] = ifftc( dataArray ) %IFFTC inverse FFT for centered data % % Syntax % % A = IFFTS( F ) % % Returns IFFT of array F after applying the correct ifftshifts % dataArray = fftshift( ifftn( ( dataArray ) ) ) ; end
classdef (Hidden, Sealed) CoarseSetAffinityRecompute < amg.coarse.CoarseSet %COARSESET A coarse aggregate set of a fine-level graph. % This class is the main data structure used during aggregation % stages. % % @DEPRECATED % See also: AGGREGATORHCR. %=========================== ...
function eigenvalue_poincare() fix=open('fixedpointforfivelink/Switching_Control/fixed_point_F=0.mat'); % ival=fix.fpStates ival=fix.x' x_fix = ival(1:10); clear theta_minus theta_plus betta event XX M_bez global theta_minus theta_plus betta event M_bez [betta,theta_minus,theta_plus]=fcn_alpha_red(ival) %event=...
clear all close all clc b=1.595; a=1.430; uc=20; cr=96000; cf=80000; i=4132; m=2325; A=[(-cf-cr)/(uc*m) (b*cr-a*cf)/(uc*m)-uc 0 0;(b*cr-a*cf)/(uc*i) (b*b*cr-a*a*cf)/(uc*i) 0 0;0 1 0 0;1 0 uc 0]; B=[cf/m;a*cf/i;0;0]; C=[1 0 uc 0]; D=0; ss(A,B,C,D); impulse(ss(A,B,C,D));
%% SCRIPT THAT SOLVES A SLIDING HORIZON QU WITH LPM %% USING A TREE REDUCTION ALGORITHM %% initialization clear all; clc; %basic parameters WorkingDirectory = fileparts(mfilename('fullpath')); cd(WorkingDirectory); noSet = []; priceFreq = 'month'; data_file = 'model_data.dat'; model_file = 'max_qu_lpm.mod'; ru...
% function wedges = getWedges(radialMask, radialIm, param, varargin) %Reading in the variables if nargin ==3 L = bwlabel(radialMask); props = regionprops(L); center = props.Centroid; numWedges = 12; end if nargin==4 center = varargin{1}; numWedges = 12; %Default to 12 wedges end if nargin==5 ...
% Fleckmentation: hierarchical segmentation using 2-means clustering. % From 'Fleckmentation: Rapid Segmentation using Repeated 2-Means' % https://digital-library.theiet.org/content/journals/10.1049/iet-ipr.2018.6060 % DOI: 10.1049/iet-ipr.2018.6060 % https://www.researchgate.net/publication/334393498_Fleckmentati...
%{ Copyright (c) 2014. Raghvendra V. Cowlagi, Ph.D., Assistant Professor, Aerospace Engineering Program, Department of Mechanical Engineering, Worcester Polytechnic Institute. Higgins Laboratories, 247, 100 Institute Road, Worcester, MA 01609. Phone: +1-508-831-6405 Email: rvcowlagi@wpi.edu Website: http://www.wpi.ed...
function p = precision(predicted, gt) %AUTHOR: Son La %STUDENT NUMBER: y107227 % This function computes the precision of a classifier % INPUT % predicted: Nx1 binary array of predicted labels % gt: Nx1 binary array of gt % OUTPUT % p: precision value TP = sum(predicted & gt); % Predicted = 1 & GT = 1 FP = s...
%% Program to Evaluate Fitness of a Sensor Combination clear; clc; close all; env = environment_generate('mini_0705.mat'); datax = env.datax; % Discrete data points (x) datay = env.datay; % Discrete data points (y) dataz = env.dataz; ...
function [x, y, z] = draw_plane(point, normal, color, points) bounding_box = compute_data_bounding_box(points); d = -point' * normal; num = 60; [~, k] = max(abs(normal)); if k == 1 ym = linspace(bounding_box.min_y, bounding_box.max_y, num); zm = linspace(bounding_box.min_z, bounding_box.max_z, num); ...
function h= testmotion h = []; h.plotData = @plotData; h.setRotation = @setRotation; h.setStepSize = @setStepSize; h.onerot = @onerot; h.ccrot = @ccrot; h.cwrot = @cwrot; h.readcell = @readcell; % --- rotationdirection = 1; %1 for clockwise %-1 for counter clockwise %-- stepsize = 1; % in degrees hMoto...
% Copyright (C) 2013 Quan Wang <wangq10@rpi.edu>, % Signal Analysis and Machine Perception Laboratory, % Department of Electrical, Computer, and Systems Engineering, % Rensselaer Polytechnic Institute, Troy, NY 12180, USA % % You are free to use this software for academic purposes if you cite our paper: % Qu...
function output = comparaisonReport(input) if nargin == 0 disp('Choose a segmentation result file (mat)') [fileName,pathName,~] = uigetfile('*.mat'); input = fullfile(pathName, fileName); end if exist(input, 'dir') disp('Input is a folder') processDir(input); output = []; elseif exist(input, '...
function varargout = mapn(array, start, varargin) % [OUTPUT] = MAPN(ARRAY, START, FUNC, OPTIONS) % This is MAP(ARRAY, FUNC', OPTIONS) where FUNC' takes the ordinal % position of the array element we are mapping across instead of the % actual value. Positions start counting at start. % [funclist, vara...
clear all close all clc %% Parametry symulacji Fs = 10000; T = 10; t = 0:1/Fs:T; N = length(t); M1 = [1 10.1]; M2 = [1 20000]; M3 = [1 900]; C1 = 10; C2 = 1; C3 = 10; K1 = 200000; K2 = 4000000; K3 = 600000; sim('model_3dof') figure subplot(3,1,1) plot(tout,masa1) title('Masa pierwsza') xla...
function p = get_particula() p.velocidad = []; p.pos = []; p.mejorParticula_individual = []; p.dimension = 0; p.w = 0; #DEFAULT p.c1 = 0; #DEFAULT p.c2 = 0; #DEFAULT endfunction
clc clear load('space.mat'); N=2150; Nplanets=length(m); dt=100000; G=6.67e-11; for ts=1:N for i=1:Nplanets F=[0,0,0]; for j=1:Nplanets if i~=j %define relative position of the planet r=[x(j,ts)-x(i,ts);y(j,ts)-y(i,ts);z(j,ts)-z(i,ts)]; ...
function [ idimsigsummary] = idimsig( idimstats ) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here [m,n] = size(idimstats.ballcount); idim = idimstats(1).idim; count = idimstats(1).ballcount; scale = idimstats(1).firstscaleindex; sig = zeros(m,1); M = zeros(m,3); M(:,2) = idim; for i = ...
function [p, theta] = calcola_punti_traiettoria(xd, yd, phi) % [p, theta] = calcola_punti_traiettoria(xd, yd, phi) % FUNZIONE UTILIZZATA PER IL MAIN PER OTTIMIZZARE I LINK % restituisce le coordinate (posizione e orientamento) dei punti A, B e % i punti a massima e minima distanza dall'origine dista...
function [] = plot_combination_relus( C, W1, W2, B, nb_points ) % plots sum c_i | w1x + w2y + b |_+ on a sufrace/mesh grid x = linspace(-1,1,nb_points); y = linspace(-1,1,nb_points); [X,Y] = meshgrid(x,y); n = length(W1); Z = zeros([nb_points,nb_points]); for i = 1:n %w1 = W1(:,:,i); %w2 = W2(:,:,i); %b = B...
function status = XuReconWithAngularInfo (s_jsonc) %status = XuReconWithAngularInfo (s_jsonc) %the sinogram file is with the dimensions status=0; recon_para = XuReadJsonc(s_jsonc); raw_data_folder=recon_para.RawDataFolder; raw_to_sgm_sub=recon_para.RawToSgmFileReplace; D=dir([raw_data_folder,'\*.IMA']); for idx=1:len...
% 2017 Fall Numerical Optimization Homework #7 % 2017. 11. 20 % 20161216 HAN SANGJUN clc; clear; close all; max_iter = 5000; % when reach to end of loop, evoke error epsilon = 1; % for terminating condition %% Model 1 - ax + by + cz + d jacobian_mat = zeros(0, 4); % load given data path = ['C:\U...
function px_hm_exc(fdp,para) %========================================================================== % FORMAT px_hm_exc(fdp,para) % Usage: % This function is to check the excluded subjects on different levels % of criteria. % Input: % fdp.rp - full path of the rp*.txt files, a m-by-n cell with ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Created: 04-Apr-2014 16:53:06 % Computer: GLNX86 % Matlab: 7.9 % Author: NK %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % prepare ssh data % reads user input from input_vars.m and map_vars.m function S00b_prep_data %% set up [DD]=set_up; %% spmd main(DD); %% save inf...
%% Clean close all clear all %% Hemodynamic impulse response Fs = 10; dur = 20; % sec xh = 0:(1/Fs):dur; % sec a = 4.30; % peak time 4.5 s after stim, shape b = 0.75; % scale delta = 2; % 2s delay beta = 0.5; sigma = 1; H = beta*gampdf(xh-delta,a,b); %% Convolution with sti...
clc clear all % To find partial derivatives in two variables % f(x) = sin(x1)+exp(-x2) a = [0.5; 1]; h = [1e-6; 1e-6]; trueVal = [cos(a(1))*exp(-a(2)), -sin(a(1))*exp(-a(2))]; %% Partial derivative w.r.t first variable x = a; x(1) = a(1)+h(1); f1 = sin(x(1))*exp(-x(2)); x(1)= a(1)-h(1); f2 = sin(x(1))*exp(-x(2)); ...
%% % fname = 'highpower_steplaser_fsw_vna_20181220T121725'; % fname = 'highpower_steplaser_fsw_vna_4.50_20181223T125045'; fname = './steplaser_highpower/atten_2.50dB_20181223T173134'; % fname = './steplaser_highpower/atten_3.00dB_20181223T191121'; % fname = './steplaser_highpower/atten_3.50dB_20181223T205116'; ...
disp("punto 1") warning('off', 'all'); clc #La funcion nos permite verificar si los inputs del archivo p(x) estan bien function y = verification_p(array) sum = 0; for i = array sum = sum + i; end if sum == 1 y = true; return endif y = false; endfunction function y = verification_shapes(PX, PYX )...
function [a ,G, e] = recLS(a0,P0,u,z) N=900; % kezdeti értékek beállítása a=a0; P=P0; % rekurzív LS becsl? egyenletei for i=1:N G=P*u(i,:)'/(1+u(i,:)*P*u(i,:)'); e=z(i)-u(i,:)*a; a=a+G*e; P=(eye(25)-G*u(i,:))*P; end end
function [s, t_sym_s] = mk_sin(F_Hz, win, chan, Fsr_Hz, duration_s) if (nargin < 5) duration_s = 1; end if (nargin < 4) Fsr_Hz = 48000; end Tsr_s = 1 / Fsr_Hz; if (nargin < 3) chan = 2; end if (nargin < 1) F_Hz = Fsr_Hz / 8 end if (nargin < ...
%归一化的操作,如果F中的点的值大于256,则将它设置为255 %F:源数据 %frame:目的数据 %originFrame:若flag为1且originFrame中对应点值为零,则frame中对应位置的值为0 function [frame] = Normalize(F, originFrame, flag, max) frame = zeros(1, max); %% 这段也没有用啊…… low = 255000000; high = -25000000; for y = 0: max-1 for x = 1: max if low > F(x+y*max) low = F...
function varargout = argparse(varargin) % VL_ARGPARSE Parse option arguments % CONF = VL_ARGPARSE(CONF, ARGS) updates the structure CONF based on % the specified parameter-value pairs ARGS={PAR1, VAL1, ... PARN, % VALN}. The function produces an error if an unknown parameter name % is passed in. % % [CONF, A...
function plot_tfcondition_tstat_bar(tfc) % % % % % % % % tstat_avg = {'tstat_animal_avg_1hz','tstat_animal_avg_2hz','tstat_animal_avg_4hz',}; tstat_ste = {'tstat_animal_ste_1hz','tstat_animal_ste_2hz','tstat_animal_ste_4hz',}; plot_titles1 = {'One Hz Animal','Two Hz Animal','Four Hz Animal'}; tstat_animal_avgs = {'...
function rmse = RMSE(yMeasured, yPredicted) n=size(yMeasured) n=n(2); rmse=0; for i=1:n rmse=rmse+(yMeasured(i)-yPredicted(i))*(yMeasured(i)-yPredicted(i)); end rmse=sqrt(rmse); end
function [residual, g1, g2, g3] = sigma_mf_static(y, x, params) % % Status : Computes static model for Dynare % % Inputs : % y [M_.endo_nbr by 1] double vector of endogenous variables in declaration order % x [M_.exo_nbr by 1] double vector of exogenous variables in declaration order % par...
data=[12 -5 13 -3 -8 3 7 -4 7 -4 -4 -1 -5 2 13 -5 -6 5 -5 -8 -6 -7 2 9 -5 -4 -5 8 4 -1 12 1 7 11 11 -1 9 0 -5 14 -3 -8 -3 12 -1 -1 13 7 -6 -7 12 12 -8 10 6 14 -7 6 10 12 8 14 7 8 -1 10 9 13 3 13 -7 12 7 13 -5 -7 -2 9 10 -6 7 7 14 10 9 -6 11 -3 12 -6 8 12 9 10 11 11 1 1 -6 -4; 3 13 6 1 9 16 15 1 17 13 -1 -3 9 17 12 5 3...
myimg=imread('your 3D image needed to be labeling .png .jpg etc.'); myimg=imresize(myimg,[375,1242]);%accorind to the resolution of the camera fig = figure(1); set(fig,'position',[200,100,0.8*size(myimg,2),0.8*size(myimg,1)]); h(1).axes = axes('position',[0,0,1,1]); %h(2).axes = axes('position',[0,0,1,0.5]); imshow(myi...
function [nodes,tets,faces] = tetgen(V, F, quality, switches) % TETGEN Interface to the tetgen library. % % [nodes,tets,faces] = tetgen(V, F, quality, switches) % V: 3xN set of vertices % F: KxM set of faces, where K is the number of vertices per face % (optional, defaults to computing convex hull) % qua...
% clear all; close all; %faults=1:20 showfig=1; nori=21; for faulti=14 for timen=20%[20,16,13,10,8,6,4,3,2,1] for tagn=5%50:-5:5 % load(['D:\ZhangProject\mat\matf',num2str(faulti),'\teline',num2str(timen),'-',num2str(tagn),'-',num2str(faulti),'.mat']); [ traindata,trainlabel,testdata...
global base base = [pwd '/']; addpath(genpath([base 'BasicModels'])); addpath(genpath([base 'lightspeed'])); load('parseddata'); X = data(:, 3:4); output = gibbsPhonemes(X);
function value = basemax(x,varargin) % % zeromax(x,B=2) % % Implements the function basemax(x(1),B) + basemax(x(2),B) + ... % where basemax returns the number of digits base B of x equal to B-1. % % See also: onemax, zeromax %************************************************************ %* ...
function r = lt(p,q) % MEAS/LT Implement p < q for meas. % find the difference between the two diff = meas(); diff = p - q; % see if p < q at the 1-sigma level if (diff.value < diff.error) r = 1; else r = 0; end
function Data = VocExtractor(varargin) % COLLECT PROPERTIES AND PERFORM INITIAL ANALYSIS OF VOCALIZATIONS P = parsePairs(varargin); checkField(P,'Data') checkField(P,'Range'); checkField(P,'SR',250000) checkField(P,'Channels',[1,2]); checkField(P,'HighPass',50000); checkField(P,'LowPass',90000); checkField(P,'FIG',1...
%% clear all; clc; close all; global num_modes; ng = 4; %number of goals. is a fixed parameter nd = 3; %dimensionality of the problem. num_modes = 2; sig_t = 0.1; %std deviation for the entropy measurement. % xg_t = [randsample(-4:4, ng);rand(1,ng)*4 - 2; randsample(1:4, ng)] + rand(nd,1) - rand(nd,1); %random goal po...
%% INPUT FILE for FES software mesh_input = 'square04x04'; reference_geometry = 'quad'; % (2d) quad (3d) cube , circular, complex element_type = 'QUAD4'; physics = 'thermo_elastic'; n_dim = 2; node_p_el = 4; int_rule = '2x2'; disp = 0.01; Tinc = 1; dt = 0...
X = [ 3 -3.8 -1.8 -1.1 -3.2 -4.8; ... 2.4 0.2 0.4 -0.9 -2.5 4.2]; T = [0 1 1 1 1 0]; % hardlim Ступенчатая функция с жесткими ограничениями % learnp Абсолютная функция настройки net = perceptron('hardlim', 'learnp'); display(net); net = configure(net, X, T); W = rand(1,3) * 10 - 5 net.IW{1,1} = W(1:2); net.b{1} ...
% auto scan, Wentao Jiang, 180721 %% parameters and initialize stage % comment on stages: % x: move chip up/down, positive dx <-> up <-> right arrow on % keyboard for python GUI % y: move chip towards/away from fiber, positive <-> closer <-> up % arrow on keyboard % z: move fiber...
function LUT = galvoLoadLUT() LUT = dlmread('C:\Program Files\National Instruments\LabVIEW 2016\vi.lib\RAS\voltsLUT.dat'); end
% Tanvir Ferdousi % Kansas State University % Last Modified: Sep 2018 % Copyright (c) 2019, Tanvir Ferdousi. All rights reserved. % Redistribution and use in source and binary forms, with or without % modification, are permitted % Creates a GEMF compatible data structure using host model parameters function Para=Para...
clear clc N_number=300; bf = (53.19-3.9)/2; bs=bf/cos(0.5542); dx = bs/(N_number-1); x = 0 : dx : bs; load('N.mat') %choice of 3 l=0; c=3.85839; N=bendMoment(1)/(c*1); k=0; ratio=0.55; n=35; b_box=1; D=1; b=c/(n+1); c_box=3.85839; F=0.7; E=7.6*10^(10); while l < bs k=k+1; t=((N/(3.62*E))*(b^2))^(1/3); s...
A = tBenchMarkTemperatureController.tModel.aafA; B = tBenchMarkTemperatureController.tModel.aafB; C = tBenchMarkTemperatureController.tModel.aafC; E = tBenchMarkTemperatureController.tModel.aafE; for iTimeStep = 1 : tBenchMarkTemperatureController.iPredictionHorizon % tBenchMarkTemperatureController.tSimulation.aafS...
%% Empirical Bayes Missouri Cancer Example % Johnson and Albert p67, p24 %#testPMTK %% Setup Data data.y = [0 0 2 0 1 1 0 2 1 3 0 1 1 1 54 0 0 1 3 0]; data.n = [1083 855 3461 657 1208 1025 527 1668 583 582 917 857 ... 680 917 53637 874 395 581 588 383]; X = [data.y(:) data.n(:)-data.y(:)]; % EB matrix of...
%Arjovsky-94881-Tarela-18/6/2014 clear(); %Espesor: 25,4 milimetros. global rExt = 122.23750; global rInt = 96.83750; %padron: 94881. global TExt = 81.0; global TInt = 948.0/6.0; %Euler. f(y,t) es un function handler, h es el paso. t es un vector con la grilla de la variable independiente. function y = Euler (f, h...
function inputs = func_inputs_gen(n,seed_gen,base,nx,ny) rng(seed_gen); base_empty=isempty(base); if base_empty %initial loop % one filled inputs_1=zeros(nx*ny,nx,ny); for j=1:nx*ny inputs_1(j,j)=1; end % now we have nx*ny+1 samples % more filled n_more=n-nx*ny-1; if ...
% I thank % http://blogs.mathworks.com/steve/2013/06/25/homomorphic-filtering-part-1/ % for this code. :D % read the image I = imread('page.png'); figure, imshow(I); % the image might be a color image, so we convert it to greyscale %I = rgb2gray(I); % convert the image to floating-point type from uint8(which is defa...
function [T,Y] = makeIdealPuls( fs,timeLast,varargin ) % midVal = 0.5; pp = 1; isShowFig = true; isXcorr = true; savePath = ''; while length(varargin)>=2 prop =varargin{1}; val=varargin{2}; varargin=varargin(3:end); switch lower(prop) case 'isshowfi...
function [T,I,Y]=perfusionResponseP2X4StackDeMix5(y0,ton,toff,Ttot) ode=modelODEP2X4StackDeMix5(ton,toff); [T,Y]=ode15s(ode,[0 Ttot],y0,odeset('NonNegative',1:33)); I=getTotalCurrentP2X4StackDeMix5(Y); end
function [P, minP, maxP, Ppol] = cellWindow2(type, r, rCenter) %CELLWINDOW Computes coordinate offsets of a cell window of some type and %radius if ~strncmp(type,'polar',5) r = ceil(r); uniqueR = unique(r,'rows','stable'); Pdata = cell(size(uniqueR,1),1); sizes = ones(size(uniqueR,1),3); map =...
%Dönem Sonu Projesi 5 clear all; pkg load image; A1 = imread ('C:\Users\HP\Desktop\GoruntuIsleme\yesiltop5.jpg'); figure 1,imshow(A1); title('İlk Hali'); A2 = rgb2hsv(A1); sat=size(A2)(1); sut=size(A2)(2); A=uint8(255*A2(:,:,1)); esik=66; A3=0; for i=1:sat for j=1:sut if A(i,j)>esik A3(i,j)=1; else A3...
function [softmax_h, h2sInfo] = attnLayerForward(h_t, params, model, trainData, tgtPos) %%% % % Attentional Layer: from lstm hidden state to softmax hidden state. % % Thang Luong @ 2015, <lmthang@stanford.edu> % %%% h2sInfo = []; curMask = trainData.curMask; if params.attnGlobal % global srcHidVecs = trainDat...
clc clear params.pix_shift_x = 2; params.pix_shift_y = 1; params.thresh_bin = 4; params.gauss_sigm = 3; data_file = 'datasets/data_30Aug_2'; % img_base = imread('datasets/data_14Sep_2/us_image051.jpg'); figure('Name','base image | segmentation') imageList = dir(strcat(data_file,'/*.jpg')); for i=1: size(imageList...
function [bestIdl,bestModel] = runVbFret(data) %, vb_opts_in, PriorPar_in) % runVbFret Idealize traces using the vbFRET program. % % [IDL,MODEL] = runVbFret(DATA) run's Bronson et al's vbFRET program to % find optimal models and state assignment traces for each input FRET trace. % DATA may be a matrix, TracesF...
function randomGBSAA = RandomGBSAA(noOfUAV,a,b) %a=0.000000; %b= 0.160999; % RANGE OF THE TIME INTERVAL randomArrival = (b-a).*rand(noOfUAV,1) + a; %x = sort((b-a)*rand(n,1)+a,'ascend' or 'descend'); %randomArrival for n = 1: length(randomArrival) firstpacketarrival = randomArrival(n); for k = 1 : length(rand...
function res = bcsme(ya,yb) res =[ya(1)-1; ya(2)-1; ya(3)-1; ya(4)+10; yb(5)-yb(3);];
% From slides: % The command to load an image is imread % To show an image, use the command imshow clear all; clc; I = imread('greens.jpg'); imshow(I); % Check I in the Workspace: disp(size(I)); % 300 500 3 - NB Matlab uses height x width disp(class(I)); % uint8 - 8 bit precision integers % red channel imshow(I(:...
function [ P ] = outer( f, X, Y ) %OUTER Summary of this function goes here % Detailed explanation goes here P = zeros(length(X), length(Y)); for i = 1:length(X) for j = 1:length(Y) P(i, j) = f(X(i, :), Y(j, :)); end end end
function sig_build() % ---------------------------------------------------------- % Create Simulink Signal Builder Block from Excel data file. % % Each xls sheet is used to create a signal builder group % Time vector must be in the first column. % Each sheet must contain the same signal type (name & number) % ...
function x_dot = Dynamics(~, x, u, model) Vc = x(2); Tc = x(3); Ts = x(4); R1 = getParamESC('RParam',Tc,model); % RC circuit resistance tau = getParamESC('RCParam',Tc,model); % RC time constant C1 = tau/R1; % RC circuit capacitance Q = getParamESC('QParam',Tc,model); % Battery capacit...
J = 0.1; b = 1; K = 100; H1 = tf(K); H2 = tf([10],[0.5 1]); H3 = tf([1],[J,b]) H = feedback(H1*H2*H3, 1); zpk(H) step(H) pzmap(H); [wn, zeta] = damp(H) sigma = wn(1)*zeta(1) wd = wn(1)*sqrt(1 - zeta(1)^2)
%Create random trace to initialise AI learning close all clear all endTime=16 timeStep=0.01 Period=0.8; Ampmax=0.01; delay=3; Time=(0.0:timeStep:endTime)'; pkg load signal %Wavegroup Amp=[0.007 0.007 0.007]; Period=[0.7 1.15 1.3]; %phase=Period/(0.25*pi)-2*pi./Period*8 phase=Period/(0.25*pi) Elevation=zeros(length(Time...
% Robin Touche 900610-3270 robint@student.chalmers.se % Takes a value and returns the next iterator value function newValue = NewtonRaphsonStep(oldValue, fPrime, fSecond) newValue = oldValue - (Polynomial(oldValue, fPrime) / Polynomial(oldValue, fSecond));
%%This script initializes the geometries for the permanent magnet %%configuration, superconductor configuration, and the electromagnet %%configuration. In the bigger picture, this will feed the physical %%parameters needed to simulate dynamics and generate commanded torques. %% OS geometry %%calculate permanent magne...
function [predictProbLearning,predictProbTest,predictClassTest,depTestSVM]= ... runSVM(depLearning,explLearning,explTest,depLearningQual,depTest) %% Training SVM %SVM predictions lead to NaN if a value of a categorical predictor of the test explicative variables is not in the values %of th...
function train_CharCnn(varargin) % EXERCISE4 Part 4 of the VGG CNN practical setup ; % ------------------------------------------------------------------------- % Part 4.1: prepare the data % ------------------------------------------------------------------------- % Load character dataset imdb = load('d...
% trim Remove points from data cloud % % This method removes points from a data cloud. Simple calls: % object=trim(object); % remove points where any variable is infinite or NaN. Cloud points may % also be removed by passing a logical array; true values indicate points % to be removed . % object=trim(object,dro...
function [accuracy, cm] = get_frame_by_frame_accuracy(labels, detections, give_factor) [labels_smooth,detections_smooth] = deal(zeros(1,numel(labels))); [bl,bd,el,ed] = frames_to_sequences(labels, detections, give_factor); for i = 1:numel(bl) labels_smooth(bl(i):el(i)) = 1; end for i = 1:numel(bd) de...
function H = hess_beale(x) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here x1 = x(1); x2 = x(2); h11 = 2*(x2^6) + 2*(x2^4) - 4*(x2^3) - 2*(x2^2) - 4*x2 + 6; h22 = 30*(x1^2)*(x2^4) + 12*(x1^2)*(x2^2) - 12*(x1^2)*(x2) - 2*(x1^2) + 31.5*x1*x2 + 9*x1; h12 = 12*x1*(x2^5) + 8*x1*(x2^3) - 12*...
%this plot function plot Time Domain Maps tau vs t for T_increment of %T_vector and phase-cycling step pcstep function plotfunction_Time_Domain_maps(TimeDomainData,tau_vector,T_vector,t_vector,pcstep,T_increment,operation,... Contour,... Time_data_contour,... tau_vector_contour,... T_vec...
function [t w]=calc_sRK4(y0,h) % % This code implements the classical four stage fourth order % Runge Kutta method to solve an ODE system. % m=2; nstep=40/h; % w=zeros(nstep+1,m); t=zeros(nstep+1,1); t(1)=0; w(1,1:m)=y0; % p=4; d=[0, 1/2, 1/2, 1 ]; c=[0, 0, 0, 0 ; 1/2, 0, 0, 0 ; 0, 1/2, 0, 0 ...
function [cto_mech_voigt,cto_ther_voigt,sigma_voigt,sigma] = mat_thermo_elast_neoh(sys_vars,F,J,T_new,debug,file01) n_dim = sys_vars.n_dim; kappa = sys_vars.mat_para.kappa; G = sys_vars.mat_para.G; T0 = sys_vars.mat_para.T0; alpha = sys_vars.mat_para.alpha; %% Geometric calculations C = F'*F; [N,lambda_sq] = ...
function ex=alignEvents(ex,varargin) %function ex=alignEvents(ex,alignCode,alignLock,alignOffset,startCode,startLock,startOffset,stopCode,stopLock,stopOffset) %function ex=alignEvents(ex,alignCode,alignLock,startCode,startLock,stopCode,stopLock) %function ex=alignEvents(ex,alignCode,startCode,stopCode) %function ex=ali...
function varargout = robot(varargin) % ROBOT MATLAB code for robot.fig % ROBOT, by itself, creates a new ROBOT or raises the existing % singleton*. % % H = ROBOT returns the handle to a new ROBOT or the handle to % the existing singleton*. % % ROBOT('CALLBACK',hObject,eventData,handles,...) cal...
function FIR_multiplot (output_dir,dataFiles, dataExt, legendTexts, titleText, saveName) % FIR_multiplot (output_dir,dataFiles, dataExt, legendTexts, titleText, saveName) % % plots multiple FIR responses on the same graph. The plots are saved as % pdf files. Gets data values from either .fig files or .csv files. % % ...
function[obj,flag] = setupSerial(comPort) % It accept as the entry value, the index of the serial port % Arduino is connected to, and as output values it returns the serial % element obj and a flag value used to check if when the script is compiled % the serial element exists yet. flag = 1; % Initialize Serial object ...