text
stringlengths
8
6.12M
function [lambda_vec, error_train, error_val] = ... validationCurve(X, y, Xval, yval) % Selected values of lambda (you should not change this) lambda_vec = [0 0.001 0.003 0.01 0.03 0.1 0.3 1 3 10]'; % You need to return these variables correctly. error_train = zeros(length(lambda_vec), 1); error_val = zeros(lengt...
function [X] = myNormalization(label) sz=size(label); N = prod(sz(3:end)); X = zeros(sz); if max(label(:))>1 for i = 1:N Xtemp = label(:,:,i); maxX = max(Xtemp(:)); minX = min(Xtemp(:)); X(:,:,i) = (Xtemp-minX)/(maxX-minX); end else X = label; end end
function colorMapImshow(I,map,range,border,cbLabel) % COLORMAPIMSHOW Show image with colormap and colorbar allowing white areas (border) if nargin < 3 || isempty(range) range = [min(I(:)) max(I(:))]; end if nargin < 4 border = false(size(I,1),size(I,2)); end indices = max(ceil((I - range(1)) / (range(2) - range...
function res = f_style(n) % - utility program for selecting line styles % % USAGE res = f_style(n) % % n = interger value selecting % res = symbol specifying linespec for plots % % SEE ALSO: f_rgb, f_symb % -----Author:----- % by David L. Jones, Nov-2010 % % This file is part of the FATHOM Toolbox for Matlab and % i...
% AnalysisScript.m % in command window or DefineVars.m must define: % obspath - string pointing to observational data % AppEff - variable for apperture efficiency of telescope (between 0 and 1) % Source - variable for source size in arcmin, 0 if unknown % Beam - variable for beam size in arcmin % threshold - variable f...
function [bandWeighted, centralityWeights] = centralityWeighting1D(delayAxis_us, band, CF, weightingFunc, normalization, varargin) % centralityWeighting - Perform centrality weighting on a 1D array (i.e. specific frequency band). % % [BANDWEIGHTED, CENTRALITYWEIGHTS] = centralityWeighting1D(DELAYAXIS_US, CF, BAND, WEIG...
clear all clc %% outline % use rand6000, 5group 2000, +1000err fix ite 8000 to pre %% load % load trained ANN net data. %%%%%%%%%%%%%%%%%% tr_rat=1; tr_rat_str=mat2str(100*tr_rat); nnt_epochs_en= 8000; n_add_group=5; % ANN data path_ann_train='../res_data/en/en_atom_dis_errfix01/'; na_ann_train='Mat_atom_dis_errf...
clear all; clc; addpath('Utils') % Number of robots num = 5; % Dimension of area to cover dim = 100; % Radius of the robots R = 30 + rand(num,1)*10; % UnCertainty of the sensors on the robot unCertainity = rand(num,1); % Number of executions of the algorith iterations = 1000; % Algorithm to lloydsAlgorithm(R,num, di...
%Brian Polagye %September 18, 2014 %Description: add ADV data to gantry structure %Gantry 0,0,0 for inboard profiler corresponds to 1D downstream from %turbine rotation axis in x, centered on axis of rotation in y, and %retracted such that the ADV transducer is 'vectrino_midplane' distance %above the turbine ...
function [ a ] = findNearest( list, desiredNumber ) %UNTITLED Summary of this function goes here % Detailed explanation goes here NearestNum = ''; IniGap = 100; i = 0; for n = 1:length(list) gap = abs(list(n)-(desiredNumber)); if(gap < IniGap) IniGap = gap; ...
function [rgbColor,Name]=colorSelection(number) %-------------------------------------------------------------------------- % % colorSelection.m: % This function is a sub-function of lscriptFretTracesStat.mlx. % % Description: % The function is used to assign a color from a palette of 12 colors to a % graphics o...
% Procedure to get nodal stresses using Extrapolation method function [sigma] = Extrapolation(stressGP) %-------------------------------------------------------------------------- % Purpose : Extrapolating stress at Gaussian points to get nodal stress % values % % Synopsis : sigma = extrapolation(stre...
function L = BetaToL(beta) nStates = round((-1+sqrt(1+8*length(beta)))/2); L = tril(ones(nStates,nStates)); ixSet = find(L); for i = 1:length(ixSet), L(ixSet(i)) = beta(i); end
function [ fit_type,eq ] = gaussN( n , bg) %GAUSSN Creates fittype of n(>1) gaussians with one optional offset % Default is to include offset assert(n==round(n),'n must be an integer.') assert(isnumeric(n)&&n>0,'n must be greater than 0.') % bg specifies including background offset if nargin < 2 bg = true; end ...
function [dX,dY] = landmark_pointer(landmarks,landmark) [m,~] = size(landmarks); dX = 0; dY = 0; for i = 1:m if (landmarks(i,1) == landmark(1) && landmarks(i,2) == landmark(2)) dX = landmarks(i,3); dY = landmarks(i,4); break; end end end
function SBJ06c_CPA_prototype_ERP_plot_GRP_topo_cond(SBJ_id,conditions,proc_id,cpa_id,an_id,plt_id,save_fig,varargin) %% Plot ERP topography per condition for single window across group % INPUTS: % conditions [str] - group of condition labels to segregate trials %% Set up paths if exist('/home/knight/','dir');root_d...
%/** % Скрипт отрисовки графики для межсистемных помех %*/ clear close all clc path_to_ro = [pwd '/ro']; path_to_results_back = [pwd '/results/back_intersystem_L1']; path_to_results = [pwd '/results/intersystem_L1']; path_to_pics = [pwd '/k_intersys/L1/BackGPS']; load([path_to_results_back '/BackInterSysJam_BoCsin_...
% This is a simple Interior Point Method to solve Convex QP for MPC % Based on the Algorithm offered by the NTU Paper Embedded MPC and AUT's % m-function "quad_wright". % A simple version of priduip.(With centering path, without Pre.- Cor.) % Yi Ding 2014.7.12 % 这里后缀full的意思是在求解线性方程组时,这里没有进行压缩,而是直接求解了一个大的方程组 function [...
function fig = plot_UCB1bound(fig, T, t, cum_r, N, R, selected_arm) colors = ['m' 'g' 'b' 'k']; hat_R = cum_r ./ N; B = sqrt(2 * log(t) ./ N); U = min(1, hat_R + B); n_arms = length(cum_r); if t < 10 || mod(t, T / 20) == 0 clf; hold on; for ii = 1:n_arms errorbar(ii, hat_R(ii), U(ii) - hat_R(ii), ...
% Snake Test clear; clc; for i = 1:25 fprintf('Processing image %d...\n', i); clearvars -EXCEPT i; I = imread(['XRAY/', num2str(1000+i), '.png']); m = zeros(size(I,1),size(I,2)); m(500:1200, 400:700) = 1; ascale = 4; %figure; %subplot(1,2,1); imshow(I); title('Input Image'); ...
function u = LaplacePDE(g, L, n) % Solves Laplace's equation in 2D subject to a boundary condition u(x,L)=g(x). k=1:192; y=linspace(0,pi,n); Y=sinh(k(:)*y); r=csch(pi*k); c=sineSeries(g, L, 1024); u=dst(diag(c(k).*r)*Y, n); imagesc([0,L], [0,L], u'); set(gca, 'YDir', 'normal'); colormap(jet(256)); colorbar(); end
function [pred] = SLP(W,y,l_ind,stepSize,T) % Description % % SLP takes, % W - affinity matrix, labels should be at the left-top corner, % - should be in sparse form % y - label vector % l_ind - labeled indexes % stepSize - coefficient: step size % T - coef...
% CR001.m % Modelling a simple voltage divider circuit % Ian Cooper % School of Physics, University of Sydney % email: ian.cooper@sydney.edu.au % https://d-arora.github.io/Doing-Physics-With-Matlab/ % 171220 clear all close all clc % INPUTS =============================================================== emf =...
function [A, name] = fdm_2d_matrix(n0,fx_str,fy_str,g_str) % % Generates the stiffness matrix A for the finite difference % discretization (equidistant grid) of the PDE % % laplace(u) - fx du/dx - fy du/dy - g u = r.h.s. on Omega % % u = 0 ...
function gradients(img, figNum, m1, m2, gradName) %UNTITLED Summary of this function goes here % Detailed explanation goes here imgConv = uint8(conv2(img, m1, 'same')); imgConvScale = imgConv + 128; imgConvAbs = abs(imgConv); figure(figNum); subplot(2,2,1); imshow(img); title('Obraz originalny'); subplot(2,2,2); i...
clearvars -except YEAR %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% merge IAGOS-ST daily files into annual files, to reduce overhead in data loading % %Corwin Wright, c.wright@bath.ac.uk %2020/05/20 %%%%%%%%%%%...
function line_detected_img = lineFinder(orig_img, hough_img, hough_threshold) [theta_max, rho_max] = size(hough_img); [ht, wid] = size(orig_img); max_rho = sqrt(ht^2 + wid^2); fh = figure; imshow(orig_img); hold on; for theta = 1 : theta_max for rho = 1 : rho_max if houg...
%% Question 3c t = linspace(-1,1,1000); x = t; y = t; z = (-cos((t.^3)+1)+sqrt((cos((t.^3)+1)).^2+4*(t.^2+1).*(2-2*t.^2)))./(2*(t.^2+1)); plot3(x,y,z,'-r','LineWidth',4) % Add labels title('3D Plot of Z'); xlabel('X'); ylabel('Y'); zlabel('Z');
%% Program to check consistency of MRCPs by computing cross-correlation % Date modified: 2-17-2015 %clear; paper_font_size = 10; % Subject Details Subject_name = 'BNBO'; subj_n = 4; % change1 Sess_num = '2'; Block_num = 160; all_Cond_num = [1 3]; % 1 - Active; 2 - Passive; 3 - Triggered; 4 - Observation % change2 clo...
%% Initial Configurations % clear all;clc; %% Source parameters fsw = 40e3; ffund = 50; frms = 50; ModulationIndex1 = 0.9; Vmodule = 270; % Yes ESL and ESR ESLA = 19e-9; ESLB = 19e-9; ESLC = 19e-9; ESRA = 21.1e-3; ESRB = 21.1e-3; ESRC = 21.1e-3; % PWM Module1Phase = 0; %in degree % gate driver Ls = 0.9e-9; Ld = 0...
%Looking at the average firing rate for a given window in each of 4 %current/previous reward conditions MaltValue=0.75; load ('RAWTH.mat'); RAW=RAWTH; %run linear model and stats? 1 is yes, 0 is no runanalysis=1; %get parameters trialsback=10; %how many trials back to look Baseline=[-11 -1]; %For normalizing activi...
function coef_output=XuPolyFit(vec_input,vec_target,order) %coef=XuPolyFit(vec_input,vec_target,order) %this polyfit force the zero order coeff to be zero if size(vec_input,1)<size(vec_input,2) vec_input=vec_input'; end if size(vec_target,1)<size(vec_target,2) vec_target=vec_target'; end matrix_input=zeros(l...
%Inicializar o Bloom FIlter com dimensão n function [arr] = init(n) arr = zeros(1, n, 'uint8'); end
function params = bbpspline( x, order, num_seg, p_ord, lambda ) %BBPSPLINES P-spline interpolation of points in x % % Function interpolates points given in x using P-splines. % % params = bbpspline( x, order, num_seg, p_ord, lambda ) % % Input: % x .. points to interpolate. Each column represents a point....
function ground_truth = load_groundtruth(base_path, video) %see if there's a suffix, specifying one of multiple targets, for %example the dot and number in 'Jogging.1' or 'Jogging.2'. if numel(video) >= 2 && video(end-1) == '.' && ~isnan(str2double(video(end))), suffix = video(end-1:end); %remember the suffix ...
close all clear setPlot %% IEC Site definition Vref = 60; % Reference wind speed zref = 87.6; % Hub height above ground Uref = 12; % Wind speed at zref Iuref = 0.15; % Turbulence intensity zmin = 5; % Minimum height for wind shear. From 0 to zmin, U is constant and equal to U...
for jj =1:3 clear params_for_wrapper T = 77; [~ , B ,~ ]= inv_cm_unit_sys(T); %needed to convert parameters in %their equation into parameters for the HEOM E_a = 12328; E_b = 12472; J = 70.7; H_site = [E_a,J;J,E_b]; [M_prj,E_ex]= eig(H_site); E_ex = diag(E_ex); delta_Ex = E_ex(2)-E_ex(1); %delta_Ex = d...
clear all; close all; clc; x = linspace(0,5); t = linspace(0,5); sol = pdepe(0,@pdefun,@icfun,@bcfun,x,t); u = sol(:,:,1); surf(x,t,u); xlabel('Distance'); ylabel('Time'); zlabel('Wave');
% shows two images one on the top of another % with corresponding SIFT points % 'optionalTreashold' is the treshold for SIFT % 'optionalMaxMarkSize' is the max size for displaying marks function show2ImagesWithSiftMatches(im1, im2, optionalThreshold, optionalMaxMarkSize) minMarkSize = 20; % optional if na...
function visualizeFitsForDeconvolution(inputConeCombinationIndex, thePSFsupportDegs, thePSF, ... conePosDegs, retinalConeImage, visualConeImage, ... retinalConeActivations, visualConeActivations, ... hiResPSFsupportDegs, hiResRetinalConeActivationMap, hiResVisualConeActiv...
%define output file filename='/home/ubuntu/IceOceanVolume/ISOMIP_PLUS/Ocean3/MakeOSF/Ocean3_COM_ROMSUTAS_FISOC_OSF.nc' %load data x=ncread(filename,'x'); y=ncread(filename,'y'); z=ncread(filename,'z'); [X,Y,Z]=ndgrid(x,y,z); time=ncread(filename,'time'); meanMeltRate=ncread(filename,'meanMeltRate'); totalMeltFlux=ncrea...
function edges = crackPattern(box, points, alpha, varargin) %CRACKPATTERN Create a (bounded) crack pattern tessellation. % % E = crackPattern(BOX, POINTS, ALPHA) % create a crack propagation pattern wit following parameters : % - pattern is bounded by area BOX given by [xmin xmax ymin ymax]. % - each crack orig...
function Size = getLargestClusterSize(A_g, n) numNodes = size(A_g,1); numNeighbors = zeros(n,1); for i = 1:numNodes neighbor_list = 1:n; neighbor_list(i) = []; for l = 1:n mat = A_g^l; rm = []; for j = 1:length(neighbor_list); if ( mat(i,neighbor_list(j)) ~= 0 ) ...
function visibility = GetVisibility(cityLocation) numberOfCities = size(cityLocation, 1); visibility = zeros(numberOfCities); for i = 1:numberOfCities-1 iCityCoordinates = cityLocation(i,:); for j = i+1:numberOfCities jCityCoordinates = cityLocation(j,:); ...
function accuracy = madAccuracy(predicted, real,tolerance) %accuracy = 1-median(abs(predicted-real)); accuracy = mean(abs(predicted-real)<=tolerance); end
function [lindt,pm]=atx(ring,varargin) %ATX computes and displays global information % %LINDATA=ATX(RING,DPP) % %RING: AT structure %DPP: relative energy deviation (default: 0) % %LINDATA is a MATLAB structure array with fields % % From atlinopt: % % ElemIndex - ordinal position in the RING % SPos - ...
close all I = imread('tumorContour.jpg'); rI = imresize( I, 2); %[XB, YB] = find( I > 250 ); rI = imcomplement(rI); imshow(rI) %errn =size(XB, 1); [X,Y] = ginput; hold on imshow(rI) plot(X,Y,'r*') n = size(X,1); if ( X(1) < X(2) ) % forward if 1 backward if 2 q = 1; ...
function p = depth2pressure(d,latitude) % % p = depth2pressure(d,latitude) % d is depth in m % latitude in degrees % p is the pressure in Pa % % Based on the Leroy and Parthiot (1998) formula. % See: % http://resource.npl.co.uk/acoustics/techguides/soundseawater/content. % html#UNESCO ...
function [ status ] = SND_recAndPlayElaboration(fs, playDev, recDev, varargin ) %UNTITLED Summary of this function goes here % Detailed explanation goes here %If log on windows set with varargin log log=false; status='success'; stop = false; %Some default params for fft nAverage=1; %number of average nLenWin=409...
% 20161003359 อ๕ตยบใ Gogoing % Assignment 1 % 1 A tif_path = './data/tif_pictures/images/'; other_file_path = './data/other_files/'; % Read the pictures and write to JPEG, PNG, BMP livingroom_tif = imread(strcat(tif_path, 'livingroom.tif')); imwrite(livingroom_tif, strcat(other_file_path, 'livingroom.jpeg'), 'jpeg'); i...
function [fGF,phi] = getGFOuter(formula, args, k) global x u Z zLoop ZLoop bigM epsilon; if length(args)>1 disp('GF takes a single argument') return end % number of agents N = length(x); % number of states I = size(x{1},1); % time horizon h = size(x{1},2)-1; z = []; fGF = []; formulaAnd = strcat('And(', .....
function [path] = dijkstra( grid,start,stop ) %UNTITLED4 Summary of this function goes here % Detailed explanation goes here dist=eye(25); parent=eye(25); sptSet=eye(25); for i=1:1:25 dist(i)=1000; sptSet(i)=0; parent(i)=start; end dist(start)=0; for count=1:1:25 if count==0 u=st...
%/** % Скрипт формирования усеченного множества сигналов %*/ clear close all clc path_to_results_RA = [pwd '/results/radioastronomy']; load([path_to_results_RA '/Radioastronomy_BoCsin.mat'], 'Radioastronomy_BoCsin'); load([path_to_results_RA '/Radioastronomy_BoCcos.mat'], 'Radioastronomy_BoCcos'); load([path_to_resu...
classdef Anomer <handle %Anomer class representing the orientation of anomeric hydroxyl group % % Anomer properties: % symbol - anomer symbol % carbonPos - the position for anomeric carbon % % Anomer methods: % Anomer - create an ANOMER object % getSymbol - retrieve the "symbol" property % ge...
%% BenMAP Form Deaths = (Mortality{3,1}.*(One'*(1-(1./(exp(0.005826891.*PM_25')))))').*Pop_over_30; Mort = sum(sum(Deaths.*WTP_Mort)); %% BenMAP Form Infant = (Mortality{3,1}.*(One'*(1-(1./(exp(0.*PM_25')))))').*Pop_Infant; Mort_Infant = sum(sum(Infant.*WTP_Mort)); All_Mort{1,1} = (Mort+Mort_Infant); ...
clear all; %用于清除命令窗口中的变量 %绘制三维图形 [X,Y]=meshgrid(-8:0.1:8); Z=sinc(X); mesh(X,Y,Z); %效果如图1-3所示 set(gcf,'color','w'); %设置图形窗口背景为白色 [X,Y]=meshgrid(-10:0.3:10); R=sqrt(X.^2+Y.^2)+eps; Z=sin(R)./R; mesh(X,Y,Z); surf(X,Y,Z,'FaceColor','interp','EdgeColor','none','FaceLighting','phong'); ...
function[] = drqw_figures_orr_scale_1e4_kappa_1500() % %scale: 1e0, cpu-small? kappa=1.5e5 % new_time_seq_OGD = [21 42 63 85 107 130]; % new_loss_seq_OGD = [ 8514 18256 26690 36539 44629 53216]; % % new_time_seq_OMGD = [21 43 65 88 110 133]; % new_loss_seq_OMGD = [785 1556 2323 3093 3811 4582]; % % new_time_seq_MOGD1...
% t1 = input('Enter yaw '); t2 = input('Enter pitch '); t3 = input('Enter roll '); yaw = [1,0,0;0,cos(t1),-sin(t1);0,sin(t1),cos(t1)]; pitch = [cos(t2),0,sin(t2);0,1,0;-sin(t2),0,cos(t2)]; roll= [cos(t3),-sin(t3),0;sin(t3),cos(t3),0;0,0,1]; I = [1,0,0;0,1,0;0,0,1]; A = pitch*roll*yaw*I Pf = [2;6;1]; Pm = A^-1*Pf; di...
function [nmodes, kr, v1, v2] = NumOfModes(w, kr, v1, v2, cpmax) cp = w ./ real(kr); nmodes = length( find( cp <= cpmax ) ); if(nmodes == 0) error('Incorrect maximum phase speed input!'); end kr = kr( 1 : nmodes); v1 = v1(:, 1 : nmodes); v2 = v2(:, 1 : nmodes); end
function [DD]=get_input sprintf(['\n getting user input...']); %% DD=evalUserInput; %% DD.time=catstruct(DD.time, timestuff(DD.time)); %% sprintf(['\n setting internal parameters...']); [DD.pattern, DD.FieldKeys]=DDpatternsAndKeys; %% sprintf(['\n scanning data...']); DD.path...
function f=commandsForTable(frt,Rtmax) ld2date='1stFeb'; %64 sector, one projection: X=frt;%,frt1p1(:,2:end),frt1p25(:,2:end),frt1p4(:,2:end)]; X(:,67)=sum(X(:,2:64),2)+X(:,67); X(:,2:64)=[]; X(:,1)=discretize(X(:,1),62:7:X(end,1)+7); X(isnan(X(:,1)),:)=[]; Y=[accumarray(X(:,1),X(:,2)),accumarray(X(:,1),X...
% Clear the workspace and the screen close all; clear all; sca % Here we call some default settings for setting up Psychtoolbox PsychDefaultSetup(2); % Get the screen numbers. This gives us a number for each of the screens % attached to our computer. screens = Screen('Screens'); % To draw we select the maximum of th...
% % % c = cfilter(x,P0,P1) is the bandpass filter extracting from the % series x the component with periodicity [P0,P1] and stores the result % in the column vector y. x must be a column vector, while P0 and % P1 must be real (scalar) numbers such that P0<P1. If n is the number % of entries in x, then y has n-1 ...
for i = 1 : length(JT) n = sum(JT(i,1:range(2)) > 0); N = N + n; JT(i,m) = sum(A(JT(i,1:n),3)); M = M + JT(i,m); JT(i,m+1) = floor(2 * JT(i,m)*((1/n)*(1-k3)+k3))/2; end
% addpath(genpath('.\')) Lua_String = 'ar1.StartFrame()'; ErrStatus = RtttNetClientAPI.RtttNetClient.SendCommand(Lua_String);
clc % ############################# % Answer to 1(A) % ############################# % 5 values with in 2 and 3 are 2.2, 2.4, 2.6, 2.8 and 3. x = 2.2 : 0.2 : 3; printf("Value of x:\n"); disp(x); % Adding 1 to the second element of x. Means, adding to index 2. x(2) = x(2) + 1; printf("Value of x after subtraction:\n...
% Exercise 3 % Emil Airta %% Init n = 2^6; deltax = 1/n; xvec = deltax*(0:(n-1)); a = .025; v = round((a*n)-1); vvec = linspace(-a+deltax,a-deltax, v*2 + 1); p = (PSF(vvec,a)); convA = convmtx(p, n); convA = convA(:, (v+1):(end-v))*deltax; m = convA*targetf(xvec)'; sigma = .01; noise = sigma*randn(size...
%% Process loaded RT-PCR-MX-P3005 data %averagedData is averaged RT-PCR data (averaged measurement, well+filter) %backgroundWells is array of background wells (relative numbering 1,2,3...) %backgroundNumber is number of background wells %averageBackground is array of background data of each filter %averagedDataBack is ...
function joePerkellisGod(dentist,researcher)
function [poses, radii] = adjust_poses_scales(poses, blocks, verbose) %% Compute scales % num_finger_segments = 15; % if verbose, figure; hold on; end % for p = 1:length(poses) % poses{p}.edges_length = zeros(num_finger_segments, 1); % for i = 1:num_finger_segments % poses{p}.edges_length(i) = norm(po...
clc Xr=housepricesdatatrainingdata1(:,4:21); K=[2,3,4,5,6,8,10]; JBr=zeros(1,7); for i=1:7 JBr(i)= ClusteringReduced( K(i),Xr); end figure(2) plot(K,JBr);
function [x,timestamp] = segmentation(x,timestamp) %THE INPUT TO THIS FUNCTION MATRIX X SHOULD BE IN FOLLOWING FORMAT %TRIPID/TIMESLOT/LATITUDE/LONGITUDE latitude=x(:,3); longitude=x(:,4); r=((latitude>37.73& latitude<37.8) & (longitude>-122.45 & longitude <-122.4)); r_1=find(~r); tripid=x(:,1); ids=zeros(lengt...
function [L, gradh2o, gradh1h2, gradih1] = nnCostFunctionSig(X, y, thetaih1, thetah1h2, thetah2o, lambda) ntrain = length(y) nhidden2 = length(thetah2o(:, 1)) - 1 nhidden1 = length(thetah1h2(:, 1)) - 1 anon1 = sigmoid(X * thetaih1) a1 = [ones(ntrain, 1) anon1] % hidden layers values with ...
classdef ProbDist % This class represents an abstract proability distribution, e.g. a pdf or pmf. % All PMTK probability distributions inherit directly or indirectly from ProbDist. %% Main methods methods %{ function nll = negloglik(obj,X) % The negative log...
beta = 1/6; gamma = 1/2; dt = 0.1; [t1,d1,v1,a1] = newmark(beta,gamma,dt); dt = 0.05; [t2,d2,v2,a2] = newmark(beta,gamma,dt); dt = 0.01; [t3,d3,v3,a3] = newmark(beta,gamma,dt); % ----- plotting ----- % figure(1); line([0 2],[0 0],'color','black'); grid on; hold on; Plot_d1 = scatter(t1,d1,'b'); Plot_d2 = scatter(...
function [v2, f2, bE] = clipMeshByPlane(v, f, plane, varargin) %CLIPMESHBYPLANE Clip a mesh by a plane. % % [V2, F2] = cutMeshByPlane(V, F, PLANE) % Clip a mesh defined by the vertices V and faces F by a PLANE and return % the part of the mesh (V2, F2) above the plane. % % [V2, F2, ENEW] = cutMeshByPlane(V, F, ...
clear all; close all; clc; % Animations of the billiard trajectory % Our Difference Equation for Square Billiards: % x(n+1) = f(x(n)). f is too complex to write here. Refer to written notes. N = 100; % number of iterations/maps (bounces) %% Period 4 orbit with lines and dots. Trivial angle of pi/4 and p...
% Load NXT SCARA Parameters param_plant % Plant Parameters param_controller % Controller Parameters param_sim % Simulation and Virtual Reality Parameters % Reference Parameters (Circle) cp_ptp = cal_cp_ptp('Circle', ts1, l1, l2); param_ref
function [outputM] = mirror(inputM) [yDim, xDim] = size(inputM); outputM(yDim, xDim) = 0; temp(yDim,1) = 0; y = xDim; if (mod(xDim,2)) % odd case for i=1:1:(y/2-.5) temp = inputM(:,xDim); outputM(:,xDim) = inputM(:,i); outputM(:,i...
% written by ChengEn Lu % This function gets sequence from the start point to the edpoint in a % staight line function [lineseq] = getLineSeq(startpoint, endpoint) startpt = round(startpoint); endpt = round(endpoint); subdst = endpt - startpt; [maxval, idx] = max(abs(subdst)); if(maxval == 0) ...
% Setup_Demo is used to set the task, the visual input and the plotting % of the simulation. Only this file has to changed when running a % simulation with FEF_DEMO. % % created: Jakob Heinzle 04/07 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % select the task you want to run and define the...
function [behavioral_data, all_data_fields] = dsp__get_behavioral_data( db, SESSIONS ) assert( isa(db, 'DictatorSignalsDB'), ['Expected input to be a DictatorSignalsDB' ... , ' object; was a ''%s'''], class(db) ); DATA_FIELDS.meta = { 'session', 'actor', 'recipient', 'drug' }; DATA_FIELDS.gaze = { 'x', 'y', 't' }; ...
% Script to find valve actuator parameters that match frequency response % using the direct method (time domain). % Copyright 2010 MathWorks, Inc. % This script file is designed to find three parameters of the % valve actuator: Gain, Time Constant, and Saturation, by directly % measuring its frequency response to sin...
function lpall = readAllOmpExp(lpall) % OMPT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%55 %%%% 2010 % 20x20 lpall(end+1).dirPath='g:\Data\2010\October 2010\October 25 OMP Bulb'; lpall(end).fileIndx=5; lpall(end).cluster=1; lpall(end).mouseType = 'OMP'; lpall(end).anest = 'ketamine'; l...
function layout_obj = two_heights_6_turb() %two_heights_6_turb Summary of this class goes here % Detailed explanation goes here NREL5MWTurbType = nrel5mw; NREL5MWPole2 = nrel5mw; NREL5MWPole2.hubHeight = 100; locIf = {[300, 100.0]; [300, 300.0]; [300, 500.0]; [1000, 100.0]; ...
function newResources = updateTargetResources(orgTargetResource, coalitionPerformances, visits) visits = visits+1; coalitionResources = repmat([3 0 0],length(coalitionPerformances),1); newResources = orgTargetResource(1); while visits >= 1 newResources = newResources - sum(coalitionPerformances.*coalitionRes...
clc syms s t x(t)=exp(-t)*heaviside(t); h(t)=exp(-2*t)*heaviside(t); x(s)=laplace(x(t)) h(s)=laplace(h(t)) y(s)=x(s)*h(s) y(t)=ilaplace(y(s))
function param = parametros(data) % Set the Real mechanism parameters param = struct(); %% Simulation parameters param.end_time = data.duracion; % final time param.dt = data.At; % time step param.tol = 1e-9; % Initial position tolerance param.tol_dyn = 1e-9;% dynamic tolerance param.iter_max = 100; % Maximum it...
I=imread('F:/2019/CITRA/6_textures.bmp'); canny =edge(I,'canny'); sobel =edge(I,'sobel'); robert =edge(I,'roberts'); prewit =edge(I,'prewitt'); subplot (2,5,1) imshow(canny); title ('gambar 1') subplot (2,5,2) imshow (canny); title ('gambar 2') subplot (2,5,3) imshow (canny); title ('gambar 3') subplot (2,5,4) imshow (...
function plot_4(t,x,y,omega,X,Y,H,title_filter) %plot 1 subplot(3,2,1); plot(t,x,'b'); title('Seņal Pulso Rectangular x(t)'); axis([-3 3 -0.2 1.4]); xlabel('t'); ylabel("x(t)"); %plot 2 subplot(3,2,2); stem(omega,fftshift(X),"r"); axis([-50 50 -200 200]); title('Transformada de Fourier X(\omeg...
% 4. Error Probability for QPSK Modulation in AWGN Channel % Author: Seyed Mohammad Mehdi Hosseini (Smmehdihosseini@gmail.com) %Part 1 l_a=400000; M=4; a=randi([0,3],1,l_a); SNR=-40:12 ; len_SNR=length(SNR); txSig=pskmod(a,M,pi/4); p_err_vec=zeros(1,len_SNR); for k=1:len_SNR rxSig=awgn(txSig...
function dir=MNewton(Q,L,Y) % max 1/2*trace(Y'*Q*Y)+trace(Y'*L) % s.t. Y'*Y=I % One Riemannian Newton's direction for the subproblem at the point Y. % Q symmetry % The code for the Algorithm 2 in the article % We use Y to denote to the \gamma in the article [p,d]=size(Y); Yc=orthcompII(Y); W1=Y'*Q*Y; W2=Y'*Q*Yc; W4...
tmax=time_stamp close all % PARTS_EFF=find((mean(power_exchange_evol(:,:),1)>=1.2e8).*(alphas_Ekin'<=2.8e6)); PARTS_EFF=find(((mean(power_exchange_evol(1:tmax,:),1))>=1.2e6)); figure(2) subplot(2,1,1) grid on hold on plot(pphi_output(:,PARTS_EFF),'b') plot((mHe/eV)*(R0+Xpos_part_output(:,PARTS_EFF)).*vphi_output(:,...
function [g] = get_gradient_from_normal_vector(nv, rad) sz = size(nv); nv = extend_img(nv, rad); sz2 = size(nv); gx = zeros(sz2(1 : 2)); gy = zeros(sz2(1 : 2)); % set parameters sigma = 0.7; weight_vector = fspecial('gaussian', [2 * rad + 1, 1], sigma); for r = rad + 1 : rad + sz(1) for c = rad + 1 : rad + sz(2) ...
%»ìãç·¨¶þ´Î±æÊ¶ clc; clear all; close all; load wtankjy; TA=clock; [lp,m]=size(Y); if lp<m lp=m; end Kmax=18; Kmin=10; Tmax=370; Tmin=220; step=100; QB=10e40; u(1:lp)=u2-u1; Khi=[]; Thi=[]; temp1=rand(); temp2=rand(); for i=1:step for n=1:1 temp1=4.0*temp1*(1-temp1); ...
%% Load data datapath0 = '/snel/share/share/data/NW_Emory_Data_Sharing/Jango/Jango_WF_Isobox_2016/xds/Jango_20160626_001.mat'; datapathk = '/snel/share/share/data/NW_Emory_Data_Sharing/Jango/Jango_WF_Isobox_2016/xds/Jango_20160627_001.mat'; day0_data = load(datapath0); dayk_data = load(datapathk); day0_spikes = {da...
function filter_exp = design_filter_3(model) % Design a Gaussian filter for smoothing between forward and backward % advection % %% Get parameters sigma_filter=model.advection.sigma_filter; %% Grid x= model.grid.x; x = x -mean(x); y= model.grid.y; y = y - mean(y); [x,y]=ndgrid(x,y); %% Filter filter_exp = exp( - 1/(...
clear all pa_datadir JR-RG-2012-02-22 load JR-RG-2012-02-22-0001 SupSac = pa_supersac(Sac,Stim,2,1); K=SupSac(:,23)<11 & SupSac(:,24)<11; H10=find(K); A=numel(H10)/400 % K=SupSac(:,23)>10 & SupSac(:,23)<31 | SupSac(:,24)>10 & SupSac(:,24)<31; H30=find(K); B=numel(H30)/400 ...
%% DIGITAL IMAGE PROCESSING - Aristotle University of Thessaloniki % Assignment 2 - Summer Semester 2020/2021 % Kavelidis Frantzis Dimitrios - AEM 9351 - kavelids@ece.auth.gr - ECE AUTH % Description: % The topics of this assignment are: % 1. Representation of Images as graphs % 2. Image segmentation using Spec...
% BOOT.M % Lutz Kilian % University of Michigan % April 1997 function [CI]=boot(A,U,y,V) global p h nrep=2000; % for 90% interval p=4; h=40; [t,q]=size(y); y=y'; Y=y(:,p:t); for i=1:p-1 Y=[Y; y(:,p-i:t-i)]; end; Ur=zeros(q*p,t-p); Yr=zeros(q*p,t-p+1); IRFrmat=zeros(nrep,q^2*(...