text stringlengths 8 6.12M |
|---|
%% Make stimExpt
acqObj = resFOV1;
expName = 'm22_170222';
stimBlocks = logical([0 1 1 1 0]);
linFOVum = [500, 500];
syncFiles = dir('*.abf');
for i=1:length(syncFiles)
syncFns{i} = fullfile(acqObj.defaultDir,syncFiles(i).name);
stimFns{i} = fullfile(acqObj.defaultDir,sprintf('%s_%d',expName,i));
resFns{i} ... |
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR
% Autores: Gonzalo Pajares y Jesús Manuel de la Cruz
% Copyright RA-MA, 2007
% Ejercicio 5.1: Suavizado y Realzado: filtro de la mediana
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 5.11.1 Suavizados: filtros de orden
%%%%%%%%%%%%%... |
%% Kalman Smoother
% This script will run the backward smoothing on the EKF estimates.
% It assumes that 'ekf_walk.m' or 'ekf_run.m' has been run.
%% Backward recursion
xSmooth = xEst;
PSmooth = Pcov;
for j = N-1:-1:1
% Calculate Smoothing Gain
A = Pcov(:,:,j)*bigPhi(:,:,j)'/(Ppred(:,:,j+1));
%... |
classdef SIG_NAME_DEF
properties (Constant)
HORIZONTAL_EYE = 'horiz_eye';
VERTICAL_EYE = 'vert_eye';
LOCAL_FIELD_POTENTIAL = 'LFP';
end
methods ( Access = private )
function obj = SIG_NAME_DEF()
end
end
end |
function Plot_IRF_Comparison_Shade(VAR, VAR2, VARbs, VARbs2, para)
nCol = round(sqrt(VAR.n));
nRow = ceil(sqrt(VAR.n));
fontsize = para.fontsize; % Fontsize in figures
set(gcf,'DefaultAxesFontSize',fontsize);
set(gcf,'DefaultTextFontSize',fontsize);
for nvar=1:VAR.n
subplot(nCol,n... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Symmetry Based Analysis of Facial Expressions Partially Occluded Due to Head Motions
% Version : 1.0
% Date : 01.2.2017
% Author : Mehdi Ghayoumi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
clc; clear all; close all;
A = [4 1 1 0; 1 4 0 1; 1 0 4 1; 0 1 1 4];
b = [1;2;0;1];
n = size(A,1);
xold = [0;0;0;0];
tol = 0.00001; % tol = 1e-4;
diff = 1;
iter = 0;
while diff>tol
for i=1:n
sum = 0;
for j = 1:n
if i~=j
sum = sum + A(i,j)*xold(j,1)
en... |
%%%%%%%%%%%%%%%%%%%%%%%%%%
%(c) Ghassan Hamarneh 1999
%%%%%%%%%%%%%%%%%%%%%%%%%%
function AngleNormal=GetNormalAngle(pt1,pt2,X)
%function AngleNormal=GetNormalAngle(pt1,pt2,X)
x1=X(pt1);
y1=X(pt1+size(X,1)/2);
x2=X(pt2);
y2=X(pt2+size(X,1)/2);
dx=x2-x1;dy=y2-y1;
angle=atan2(dy,dx);
AngleNormal=angle+pi/2; |
function x = mesh_x(d_s,d_layer,d_c,NumberMesh)
% Generates one-dimensional mesh along x-axis
% Variable description:
% Input
% d_layer - thicknesses of each layer
% NumberMesh - number of mesh points in each layer
% Output
% x - mesh point coordinates
%
d_total = [d_s,d_layer,d_c]; % thicknesses of all layers
NumberOf... |
function [] = plot_amp(str,simple,taper,svd,xax)
if ~isempty(simple), figure; plot(xax,simple); title(['SIMPLE ', str]); end;
if ~isempty(taper), figure; plot(xax,taper); title(['TAPER ', str]); end
if ~isempty(svd), figure; plot(xax,svd); title(['SVD ', str]); end |
%{
mc.Experiments (manual) # info about each microcolumn experiment
-> mice.Mice
---
exp_type="unknown" : enum('patching','two-photon','other','unknown')# type of experiment
doe=null : date # date of experiment
age=null : tinyint ... |
%% Qurstion6: Texture
% Dataset: DatasetA/B
disp('Intorduction of Computer Vision Coursework 2 - Q6: Texture');
%% (a)
im_car1 = imread('Dataset/DatasetA/car-1.jpg');
im_car1g = ICV_rgb2grey(im_car1);
size_im_car1 = size(im_car1g);
[car1_local_d , ~] = ICV_q6_local_des(im_car1g, 20);
figure; imshow(im_car1g);
for i=1:... |
function comparison = PACK_compare_archs(arch1,arch2)
%% PACK_compare_archs.m
%
% a1 = PACK_get_arch_from_results(results,3)
% Usage: PACK_compare_archs(a1,PACK_ref_arch)
% global params
fprintf('************************************************************\n');
fprintf('************************************************... |
function igrnd = logr2(t,p,ratefunc)
r = feval(ratefunc,t,p);
igrnd = r.*log(r).^2;
|
function [Left,Right]=CreateHalfMasks()
%Gives left and right masks with 8 orientations.
SUP=25; % Support of the largest filter (must be odd)
SCALE=[0.25 0.5 1]; % Sigma_{x} for the oriented filters
NORIENT=8; % Number of orientations
NF=NORIENT*length(SC... |
function addEventFcn(hFigs, PropertyName, newFun, areDuplicatesOK)
% Author: Vladimir Golkov
for hFig = hFigs(:)'
oldFun = get(hFig, PropertyName);
if isempty(oldFun)
set(hFig, PropertyName, newFun)
else
if ~containsEventFcn(hFig, PropertyName, newFun) || (exist('areDuplicatesOK','var') && areDuplicatesOK... |
load 'pMetrics.mat';
load 'uMetrics.mat';
%pMetrics and uMetrics are alphabetically ordered
%find names with both UPDRS and iPhone measurement
[comNames pInd uInd]=intersect(pMetrics(:,1),uMetrics(:,1));
%find Ximitidou in both cells
XindP=find(strcmp(pMetrics(:,1),'Ximitidou'));
XindU=find(strcmp(uMetrics(:,1),'Ximi... |
function plot_spectra
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% plot_spectra.m
%
% Plots the spectra to the main window
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global DATA HANDLES PARAMS
% get which figures plotted
savalue = get(HAND... |
function [x_givens, r_givens] = givensls(A,b)
[Q,R] = givensqr(A);
[m,n] = size(A);
y = Q'*b;
r_givens = norm(y(1:(m-n),:));
x_givens = linsolve(R(m-n+1:m,:),y(m-n+1:m,:));
end
|
function [laplac] = laplacian(trired,p,q,r)
% forms the laplacian for the tohoku fault geometry
% Note: this creates laplacian for just one strikeslip or thrust-slip
% [laplac] = laplacian(trired,p,q,r)
% written by Rishabh Dutta, 28Sep 2015
% no. of patches
npat = size(trired,1);
laplac = sparse(npat,npat);
for ... |
%% Display luminance variation
%
% Parameters are chosen to match those in the Westheimer case.
%
%%
disp('**** EI Display Luminance')
nTrials = 1000;
nBasis = 40;
% Integration time
% Captures eye movements up to 100HZ
% Adequate for absorptions (ms)
tStep = 10;
% Scene FOV. Larger than usual to show t... |
% Here we simulate X-ray tomographic measurement without avoiding inverse
% crime
clear all;
%% Define the measurement setup
% Choose the size of the unknown. The image has size MxM.
M = 40;
% Choose the angles
Nang = 65;
% Load precomputed results of the routine tomo01_RadonMatrix_comp.m
% with the particular val... |
%% Stelling 5
%
% Met behulp van de functie som() kunnen de waardes
% van een vector bij elkaar worden opgeteld.
%
Antwoord = 0;
|
function [ whinBoundaryLatLons, whinBoundaryXYs, whinBoundaryUtmZone ] ...
= loadWhinBoundary(utmZone)
%LOADWHINBOUNDARY A helper function to generate and load the WHIN boundary.
%
% Input:
% - utmZone
% Optional. Default to '16 T'. The UTM zone to use for converting GPS
% (lat, lon) to UTM (x, y).
%
% Ou... |
function [val,loc] = find_val_difference(fnc,val)
% [val,loc] = find_val_difference(fnc,val)
% Inputs:
% fnc = function data array to find value in
% val = The value desired
% Outputs:
% val = value of the found value
% loc = sample point of value location
% Last Edit: 4/6/2021
% By: Matthew Luu
for a =... |
function varargout = Plant_Component_Variables(varargin)
% PLANT_COMPONENT_VARIABLES MATLAB code for Plant_Component_Variables.fig
% PLANT_COMPONENT_VARIABLES, by itself, creates a new PLANT_COMPONENT_VARIABLES or raises the existing
% singleton*.
%
% H = PLANT_COMPONENT_VARIABLES returns the handle to a... |
function [dpdt] = paineenmuutos(N,dp,ddpdt,T)
% input
% N - hiukkasten lukumääräpitoisuus (#/m^3)
% dp - hiukkasen halkaisija (m)
% ddpdt - hiukkasen halkaisijan muutosnopeus (m/s)
% T - ympäristön lämpötila (K)
% output
% dpdt - höyrynpaineen muutosnopeus
M = 18.016e-3; % Veden moolimass... |
% инициализация потока чтения*****************************************
inputVideoName = 'D:\108ANV01\MAQ09013.mp4';
videoReader = VideoReader(inputVideoName);
keypoints_table = [];
descriptors_table = [];
active_table = [];
keypoints = [];
descriptors =[];
for i = 1 : 10%videoReader.NumberOfFrames
frame=rgb2gra... |
function [specStruct, variableFactors] = script4_testingSpec
% set up the pathing
fileStack(1).fullPathTrc = fullfile('saved', 'Subject01_SingleArm60Time_OnlyRightArm.trc');
fileStack(1).fullPathMat = fullfile('saved', 'Subject01_SingleArm60Time_OnlyRightArm_01_mocap_mocap_X00_floating_ekfId1_ekfIk.mat');
fileStack(1... |
clear
close all
clc
addpath('../../mod_demod');
%%%%%初始参数设置%%%% %%%%%
N_packet = 1e5;
N_bits = 1e2;
N_symbol_16qam = N_bits/4;
L=6;%%可分辨的多径条数
L_vector=0:L-1;
SNR = 0:5:40;
SNRR = 10.^(SNR./10);
SNR_len=length(SNR);
Data_bit = round(rand(N_bits,SNR_len));
BER_16qam_index = zeros(SNR_len,N_packet);
%%%%16QAM调制%%%... |
% Update the state given a certain move
function up_state = update_state(~, act_state, move)
switch move
case "F"
up_state = m_permut(36,38,14,12, act_state);
up_state = m_permut(24,37,26,13, up_state);
up_state = m_permut( 6,35,47,15, up_state);
up_state = m_... |
clear;
X = [ 0 0; 2 3; 1 4; 4 2; 3 0];
Cluster = [2 2 1 2 1];
Cluster = Cluster';
K =2;
c1 = mean([;X(3,:); X(5,:)]);
c2 = mean([X(1,:);X(2,:); X(4,:)]);
centroids = [c1;c2]
Je = Quntization(X,K,centroids,Cluster)
function Je = Quntization(X,K,centroids, Cluster)
[Ndata D] = size(X)
for Cetr=1:K
... |
clear all;
%Definitions of the parameters for the simulation
parameter;
%Calcul of the signals in the transmitter
transmitter;
%Passage through the channel
channel;
%Calcul of the operations did in the receiver
receiver;
%Show Results
results;
|
clear ; close all; clc
fprintf('Finding closest centroids.\n\n');
%range of random matrix
##A = 0
##B = 10
##X = A+(B-A)*rand(600,2);
X = load('dat.txt')
K = 5; % Number of centroids
icentroids = centroidinit(X,K,false);
max_iters = 10;
[centroids,idx] = runkmeans(X,icentroids,max_iters,true);
|
function [ wavesTrimmed, meanSurfaceWave ] = SurfaceWaveTrimmer(waves)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
times=[];
for i=1:length(waves)
wavesTrimmed(i).name = waves(i).name;
wavesTrimmed(i).time = waves(i).time(find(waves(i).time>20));
wavesTrimmed(i).surfaceW... |
function FS_plot_neuropil(BGD)
out.Bgnd = BGD.Bgnd;
out.Npil = BGD.Npil;
counter = 1;
for ii = find([BGD.index{:}] == 0)
MD{counter} = out.Bgnd{ii}(:,16:end)-out.Npil{ii}(:,16:end)-min(out.Bgnd{ii}(:,16:end)-out.Npil{ii}(:,16:end));
D1(counter) = mean(out.Bgnd{ii}(:,10:end)- min(out.Bgnd{ii}(:,10:end)) );
D2(count... |
% The struct 'param' is appended with a list of cell-specific parameters
param.I_1C = 60; % amps (1C-rate current corresponding to cell capacity)
%% Electrode Surface Area in the planar direction
param.A = 2.05268559698939; % m^2; overall active surface area
%% Solid particle radius [m]
param.R_n = 2e-6;
param.R_p... |
function [newim1, newim2, b, H1, H2, newe] = rectify_images(im1, im2, x1, x2, F12)
%RECTIFY_IMAGES rectifies two images to achieve correspondences of scanlines.
%
% [newim1, newim2] = rectify_images(im1, im2, x1, x2, F12)
% [newim1, newim2, b, H1, H2] = rectify_images(im1, im2, x1, x2, F12)
% [newim1, newi... |
function string_disp = brant_update_pre_disp
h_main = findobj(0, 'Name', 'brant_Preprocessing',...
'Tag', 'brant_preprocess_main');
h_disp = findobj(0, 'Name', 'brant_CheckBoard',...
'Tag', 'brant_preprocess_check');
h_para_dis... |
% Test Cases:
[result1] = birdNest(rooms1);
[result1_soln] = birdNest_soln(rooms1);
% result1 => After an epic chase spanning 2 rooms, the cats found the bird in IC 114!
%
[result2] = birdNest(rooms2);
[result2_soln] = birdNest_soln(rooms2);
% result2 => After an epic chase spanning 1 rooms, the cats found the bir... |
function [h_mes] = add_zeros_adv(hwz_mes, addition_zeros)
h_mes = zeros(size(hwz_mes, 1), size(hwz_mes, 2) + addition_zeros);
rim = ceil(log2(size(h_mes, 2) + 1));
h_mes(:, 1:rim) = hwz_mes(:, 1:rim);
h_mes(:, (rim + 4):size(h_mes, 2)) = hwz_mes(:, (rim + 1):size(hwz_mes, 2));
end |
%declaring relevant parameters
T = 2;
w = -5:0.1:5;
syms t;
a = -1;
b = 1;
%declaring the function
xt = 1-abs(t);
%running cont. FT
y = continuousFT(xt,t,a,b,w);
figure;
subplot(2,2,1);
plot(w,real(y)); grid on;
title('Real part of FT');
xlabel('w') ;
ylabel('Real part of FT');
subplot(2,2,2);
plot(w,imag(y)); gr... |
format long
function y = g(x)
y = 1/6 * x**3 + 1/3 *x**2 + 1/6
end
myFixpunktIter(@g, 0, 6)
|
function [ I ] = simpson( a,b,n )
%a é o limite superior
%b é o limite inferior
%n é o nº de subintervalos desejados
%averiguar se n é par
if(mod(n,2) ~= 0)
n=n+1;
end
h=(b-a)/n;
x=a:h:b;
fx=exp(sin(x));
I=0;
for i = 1 : 2 : (n-1)
I = I + fx(i) + 4*fx(i+1) + fx(i+2);
end
I=(h/3)... |
function KalmanXsim(sigmaVis,sigmaSpeed,speedprofile,dt,Ntrial,Fshownoise)
c{1} = 'c';c{2} = 'k';c{3} = 'm';
xmax = 100;
gain = [0.8 1 1.2];%[0.8 1 1.2];%
Tmax = 50;
Rdist_unwrap = zeros(Ntrial,Tmax,numel(gain));
x_unwrap = zeros(Ntrial,Tmax,numel(gain));
Runspeed = zeros(Ntrial,Tmax,numel(gain));
Visspeed = zeros(Nt... |
function kegg_pKa = getTrainingDatapKas(target_cids, target_inchies, use_cache)
if nargin < 3
use_cache = true;
end
CACHED_KEGG_PKA_MAT_FNAME = [getBasePath() 'cache/kegg_pkas.mat'];
% Load pKas from cache if required
if use_cache && exist(CACHED_KEGG_PKA_MAT_FNAME, 'file')
fprintf('Loading the pKa values fo... |
function noticeficationResult(checkBelongsTo)
if(checkBelongsTo==1)
fprintf('You Win!\n');
elseif(checkBelongsTo==-1)
fprintf('You Lose!\n');
else
fprintf('You draw!\n');
end
|
function [qSol,err,NewtonData] = NonLinearCG(F,q0)
% Conjugate Gradient algorithm:
% STEP 1: given x_1, d_1 = -grad(f(x_1)), k = 1
% STEP 2: compute alpha_k>0 (various methods, see Dai & Yuan (1999) equations 1.7 and 1.10)
% STEP 3: compute x_k+1 = x_k + alpha_k*d_k; if grad(f(x_k+1)) < tol, break
% STEP 4: compute bet... |
function TransmissionMMPlot(LambdaList,mmVecs)
mmNum = [ "00" "01" "02" "03" '10' '11' '12' '13' '20' '21' '22' '23' '30' '31' '32' '33'];
%M00 transmission
%% Average Transmission
fp = ['D:\Measurements\Dichroic_Analysis\MM_img\dichroic-45-small-ROI-' date];
mkdir(fp);
figure(1)
meanTransmission = mean(squeeze(mmVecs... |
#Calculating the ground state then save to R_gstate and use in DiagEvolOperator
#The Ak is calculated according to wigner mapping tensored with identities in Aknew
global sigma_x=[0 1; 1 0];
global sigma_z=[1 0;0 -1];
global sigma_y=[0 -i;i 0];
t_step=0.01;
J=1;
a=0; #start point
b=2; #end point
n=(abs(b-... |
%% Stelling 12
%
% De if-statement wordt uitgevoerd als de expressie tot
% een true wordt geevalueerd.
%
Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
|
function [ hr,this_hrpeak ] = estimate_next( peak,estm,hrpeak, accClass, idx,bound, frame)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
prev_hrpeak = hrpeak(idx-1);
prev_hr = estm(idx-1);
init_glb;
persistent count stillcount AccStimulus;
if isempty(count)
count = 1;
stillcount = 1;
AccStimulus = -10000;
... |
function plotdata=plotbetadispcurlyh(lindata,ring,dpp,varargin)
idx=cat(1,lindata.ElemIndex);
H=CurlyHlindata(lindata);
beta=cat(1,lindata.beta); % left axis
plotdata(1).values=beta;
plotdata(1).labels={'\beta_x','\beta_z'};
plotdata(1).axislabel='\beta [m]';
dispersion=cat(2,lindata.Dispersion)';... |
function [ mouse,trainingsettings,cell] = loadEphysMetadata(filename)
%loadEphysMetadata used to load general metadata for training group or groups of mice
% Data loaded includes mouse names, initial weights, number of training
% days, position of reward zone (front/back) and type of lever action (pull, push,
% p... |
function [OutputWeight] = elm_autoencoder(InputData, NumberofHiddenNeurons)
%ELM_AUTOENCODER Summary of this function goes here
% Detailed explanation goes here
InputData = InputData';
NumberofTrainingData = size(InputData, 2);
NumberofInputNeurons = size(InputData, 1);
InputWeight=rand(NumberofHiddenNeurons,Nu... |
close all
clc
clear all
addpath('../energy_model');
load('../energy_model/E_model_full.mat');
load('../energy_model/E_angle_speed.mat');
altitude = 10;
% calling the functions
[power_simulation, time_simulation, distance_array] = flight_simulation_analysis(E_model, E_angle_speed, E_rotate, e_total, altitu... |
dir='D:\CMTC\bothlead\Rp30\L500\';
datastore=[];
mulist=0.1:0.1:1;
for index=1:100
fn=strcat(dir,num2str(index));
for muindex=1:length(mulist)
muVar=mulist(muindex);
L=300;
fnL=sprintf("m1.0D0.2a5L%dmVar%.1fLL-2.048,0.3-",L,muVar);
fnR=sprintf("m1.0D0.2a5L%dmVar%.1fRR-2.048,0.3-"... |
function [p,f,N]=gappy_psd(x,nfft,fs,maxgap);
% function [p,f]=gappy_psd(x,nfft,fs,maxgap);
% Computes the psd for x, but is able to "handle" data gaps. Gaps
% smaller than maxgap (in # of samples) are interpolated over.
% Gaps larger than maxgap are made into separate time-series so
% that no fft is run over a g... |
%
% Function: [A, A_ord, nz, pct, bw, bw_ord, p] = ReorderMarketMatrix (i_mtx_filename, o_mtx_filename, algorithm, field, precision, get_stats)
%
% Reads a sparse matrix A from a Matrix Market (MM)-formatted file,
% applies either Reverse Cuthill-McKee or Nested Dissection reordoering
% to it and writes it t... |
% -------------------------------------------------------------------------
% Program Description
% -------------------------------------------------------------------------
%
% Purpose:
% - Main program for one country with fixed foreign demand
% - Saving Glut Project
%
% Auth... |
global aggregateVel clockmax
global g_vave g_vstd g_run nc g_nc;
averageVel = aggregateVel./clockmax;
meanSpeed = mean(averageVel);
stdSpeed = std(averageVel);
g_vave(g_run) = meanSpeed;
g_vstd(g_run) = stdSpeed;
g_nc(g_run) = nc;
% disp("nc: " + nc + " spd: " + meanSpeed);
% disp("Average speed of car per time s... |
function result = fft2dInner(signal, isInverseTransofrm)
cost = 0;
result = zeros(size(signal));
signalSize = size(signal);
%result = fft2(signal);
for i = 1 : signalSize(1)
result(i, :) = common.fftInner(signal(i, :), cost, isInverseTransofrm);
end
for i = 1 : signalSi... |
function [ArmExtensionMMs, isLengthValid,restingArmLengths, currentArmLengths, Rwp, biw, ai] = CalculateArmLength(X, Y, Z, phi, theta, psi, RefX, RefY, RefZ)
%CALCULATEARMLENGTH takes in desired height and degree rotations, converts
%them to displacement of motor arms.
% Since each of the six links of the Stewart ... |
%% BilateralFilter.m
%% BilateralFilter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% uhat = BilateralFilter(v,K,N)
% Apply a bilateral filter with window half-width w, distance standard
% deviation sd and similarity standard deviation ss to the image v
% Inputs:
% v : the input image
... |
clear
clc
%% Definition
LINE_WIDTH = 2;
MARKER_SIZE = 5;
END_PLACE = 50+1;
%%
A=xlsread('D:\Python\tensorflow\image caption coding\ResultProcess\Resnet_Sydney\Save_Excel.xlsx');
B=xlsread('D:\Python\tensorflow\image caption coding\ResultProcess\Resnet_UCM\Save_Excel.xlsx');
C=xlsread('D:\Python\tensorflow\image cap... |
function [ output ] = centerSignal( input )
%centerSignal Center the input vector around zero
% Simple shift of the values so that the range is centered on 0
cols = size(input,2);
maxi = max(input,[],2);
mini = min(input,[],2);
output = input - repmat(((maxi - mini) / 2) + mini,1, cols);
end
|
function [ tempX, tempY ] = slideSnail( board, x, y, turn, movement )
if turn == 22
myMark = 2;
else
myMark = 1;
end
tempX = x; tempY = y; isSlide = false;
%if need to slide down
if strcmp(movement, 'down') == 1
while board(tempX, tempY) == myMark
... |
while 1 % temporarily disabled for test APR 21
[ keyIsDown, timeSecs, keyCode ] = KbCheck;
if keyIsDown
[tmp tmp_key_code]=find(keyCode==1);
tmp_key_code
if ((tmp_key_code==53)) % trigger
% KbName(keyCode)
% if (KbName(keyCode) == 5)
break;
end
% If ... |
Neem aan dat het code commentaar in het onderstaande
voorbeeld correct is.
De code bevat een programmeerfout:
======= Code =======
% Optellen van een variabele
a = 2;
b = 2;
som = a + b;
======= Code ======= |
function [x,y] = getPatchRectInputs(x1, x2, y1, y2)
x = [x1,x2,x2,x1,x1];
y = [y1,y1,y2,y2,y1]; |
function ht = subtitle(kn, text)
%% 在一个figure中间显示内容
h1 = get(gcf,'children');
axis1 = get(h1(end),'Position');
axis2 = get(h1(end-kn+1),'Position');
axest = [axis1(1),axis1(2)+axis1(4),axis2(1)+axis1(3)-axis1(1),0.01];
ht = axes('Position',axest);
axis(ht,'off')
title(ht,text) |
function [binom]=binomial(n,k)
binom=(factorial(n))/(factorial(k)*factorial(n-k)); |
function phan = loadCTScanPhantom( fileName )
[phan.phantomMaterials, metaMaterials] = readMetaImage( [ fileName '.mhd']);
phan.size = metaMaterials.DimSize; % number of pixels in ground truth materials image
phan.spacing = metaMaterials.ElementSpacing; % input spacing (mm)
phan.offset = ze... |
%Bin file to binary signal
function [signal, errmsg] = file2signal(FILENAME)
% input:
% FILENAME - name of file to open
%
% output:
% errmsg - returns a system-dependent error message if fopen fails to open the file. Otherwise, errmsg is an empty string
% signal - binary signal [-1 1 -1 1]
signal = 0;
[fileID, errmsg]... |
% Large Car Air Conditioning Compressor Load
%
% DESCRIPTION:
% This file defines a small car air conditioner's compressor load.
%
% SOURCE: Delphi Corporation public web site
%
% FILE Author: Aaron Brooker, NREL, aaron_brooker@nrel.gov
%
% Date: 18 December 2002
%
%
pulley_ratio=1.3;
map_spd = ([0 1000 2000 3000 40... |
function [relativeInterfaceArea] = momentPerVolume(...
diskCenters, diskRadii, gridRF, moment)
%Computes the sum of moments of disk radii divided by cell area
% diskCenters: clear
% diskRadii: clear
% gridVectorX/Y: specification of macro-cell edge lengths
A0 = zeros(gridRF.nCells, 1... |
% 高斯白噪声对DSSS系统产生的影响
clear
fd = 10;
fc = 1000;
fs = 10000;
k = 1;
err = [];
for snr = 0:1:20
EB_N = 10^(snr/10);
data = bingen(5000);
C = mseq(9);
data1 = ds_mod(C,data);
[t,Y] = BPSKmod(data1,fd*length(C),fc,fs);
% [f,p] = T2F(Y,fs);
% plot(f,abs(p));
% Y1 = awgn(Y,EB... |
function [ Q1, Q2, Q3, V1, V2, V3, F1, F2 ] = abundances_region_c_CM( Dtag,p2tag )
% only the common type specialists exist
%-----------------------------------------------------------
syms F1 F2
global g
global g1
global g2
global Fmax
global Sp
%global c
global QTotal
global a1
global a2
global b... |
% Question 4
% Quang Anh Tran - 40075748
my_big_array = load('my_big_array.txt', '-ascii')
|
function [ cbr ] = clusterCBRinit( X, y )
%CBRINIT Initialize clustered CBR system.
% [ cbr ] = clusterCBRinit( X, y )
labels = unique(y);
cbr = cell(1,length(labels));
parfor i = 1:length(labels)
iLabel = labels(i);
iLabelIdxArray = y == iLabel;
iLabelExamples = X(iLab... |
function ValidMask = GetValidityMaskFromUserInput(RSim,Mask)
if isempty(Mask)
VersionStrings = RSim.ValidVersionStrings;
else
VersionStrings = RSim.ValidVersionStrings(Mask);
end
NotDone = true;
while NotDone
RSim.Print('Detected, installed versions:\n');
... |
%the function takes in two dataset and find NMF synergies of the two
%datasets with training criteria as :
%VAF > 90, DOF_VAF > 60, Delta_VAF < 5
%The function returns synergy vectors of the two datasets
%Written by Navid Lambert-Shirzad
%20170105
function [Synergies_Tr, Synergies_Val] = find_NMF_synergies(DOF, TrFul... |
function success = uq_PCE_calculate_coefficients_regression(current_model)
% SUCCESS = UQ_PCE_CALCULATE_COEFFICIENTS_REGRESSION(CURRENT_MODEL):
% Calculate the polynomial chaos coefficients of CURRENT_MODEL via
% least-square regression.
%
% See also: UQ_PCE_CALCULATE_COEFFICIENTS_PROJECTION
%% CONSISTENCY CHE... |
function Y = MVDR_RTF(ftbin, Gcor, Ncor, refMic)
[Nchan,Nbin,~] = size(ftbin);
u0 = zeros(Nchan,1);
u0(refMic) = 1;
ng = zeros(Nchan,Nchan,Nbin);
lambda = zeros(Nbin,1);
for flp = 1:Nbin
ng(:,:,flp) = Ncor(:,:,flp) \ Gcor(:,:,flp);
lambda(flp) = trace(ng(:,:,flp));
end
Y = bsxfun(@rdivide, squeeze(sum(bsx... |
%
%
%
%
function [En,TimeFrame]=ShortVar(x,Fs,FrameLength,FrameStep,win)
%filedir=['F:\文档\录音\']; % 设置路径
%filename='a.m4a'; % 设置文件名
%fle=[filedir filename]; % 构成完整的路径和文件名
%[x,Fs]=audioread(fle); % 读入数据文件
%x=x(:,1);
%Fs = Fs; %采样频率
%FrameLength=0.01; %帧长度,单位s;
%FrameStep=... |
%%%Initialize
clear
clc
close all
tic
%%%Globals
global BB m I invI lastMagUpdate nextMagUpdate lastSensorUpdate
global nextSensorUpdate BfieldMeasured pqrMeasured BfieldNav pqrNav
global BfieldNavPrev pqrNavPrev
BfieldNavPrev = [0;0;0];
pqrNavPrev = [0;0;0];
%%%%Simulation of a Low Earth Satellite
disp('Simulatio... |
[x y]=meshgrid(-2:0.5:2,-2:0.5:2);
z=x.^2+y.^2+x.*y;
mesh(x,y,z); % cizdiriyor
surf(x,y,z); % renklendiriyor |
warning off
mkdir('../pictures')
%% a quick peak of initial distribution of particles
input('press enter to plot dist.plt')
m = importdata('../orbit_results/dist.plt',' ',5);
dist = m.data;
init_particle_position(dist)
%% a quick peak of final distribution of particles
try
input('press enter to plot distf.plt')
... |
function [flag ,triangle] = Verification(record_E, record_M, record_enorm, record_ellipse)
% initialize return value
flag = false;
triangle = [0 0 0 0 0 0];
[e_n, ~] = size(record_E);
[m_n, ~] = size(record_M);
for eye1 = 1:e_n-1
for eye2 = eye1+1:e_n
% (r,c)
% left_eye & right_eye: record_e(eye1,... |
function [f, g] = stpOneNormFunc(x)
%% one norm function
global globalA globalB;
n = length(globalB);
z = globalA * x -globalB;
f = sum( abs(z) );
% calculate the gradient
for i = 1 : n
temp = z(i, 1);
if( temp >= 0)
temp = 1;
else
... |
function [p1,p2,delta] = quadratic_analysis(pBoth,pNone)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% This function calculates for each individual p1 and p2 (i.e. the amount %%%
%%% of attention at each of the two probe locations) based on pBoth %%%
%%% (probability to rep... |
%% evaluation of the 6dof forward kinematics problem solution
% forward kinematics for original configuration
% robot definition
ROBOT = 'GP50';
robot=robotproperty(ROBOT);
theta_ini = [pi/20 -pi/2 pi/20 pi/20 pi/20 pi/20]';
cpre = ForKine(theta_ini, robot.DH, robot.base, robot.cap);
%% sampling to veri... |
% saveDXF
%
% Save the lines, polylines, and curves in an DXF file.
%
% input: filename = location of file to save at
% data = struct containing lines
% plotfile = boolean whether or not to plot the result
%
% written by: Cynthia Sung
% uses: DXFLib_v0.9.1 from FileExchange
% last modified: 03/18/2015
%
... |
function [rate,SN,SSIM,delta]=find_coding_rate_sub(a,delta,rate0,f)
M=8; lev=3; [coef,fL]=LFP2(a,M); tanTheta=1/8; coef=block2bd(coef,M,lev,tanTheta); %<=====LFP
%coef=coef_reorder(coef);
%M=16; lev=2; [coef,fL]=LFP2(a,M); tanTheta=1/8; coef=block2bd(coef,M,lev,tanTheta); %<=====LFP
coef0=coef;
num=numel(a);
fsz0=r... |
function [PP_CFG, PP_DATA] = OT_postprocessing(PP_CFG, PP_DATA, CFG, DATA, test_idx)
PP_DATA.tests{test_idx}.test_name = DATA.tests{test_idx}.test_name;
if ~isfield(DATA.tests{test_idx}, 'num_trials')
PP_DATA.tests{test_idx}.key_factor_name = PP_CFG.tests{test_idx}.key_factor_name;
PP_DATA.tests{test_idx}.key... |
%% Iniciando o sistema
clc;clear all;close all;
municipios = [ 1 303.30 202.14;
2 518.50 595.97;
3 211.86 136.97;
4 283.22 372.51;
5 626.06 293.15;
6 799.88 85.79;
7 235.70 815.87;
8 948.74 39.79;
9 547.85 63.07;
10 115.41 157.17;
11 386.78 149.91;
12 117.19 110... |
%% [center,U,obj_fcn] = MDFCM(MD,cluster_n)
% 功能说明:对工艺路径特征——MD距离进行聚类,采用改进k均值聚类算法
% 输入参数:
% MD - MD距离矩阵
% c_n - 聚类中心数
% 输出参数:
% center - 聚类中心(矩阵)
% U - 划分矩阵
% obj_fcn - 目标函数(值)
%%
function [center,U,obj_fcn] = MDFCM(MD,c_n)
[p_n,~... |
function [y_deriv] = Take_Deriv(y,m)
syms t
y_deriv = diff(y,m) |
function [out1] = kolejne_potegi_f6(a,n)
tab = zeros(1,n); % tablica zer o wymiarze n
for i=1:n
tab(i)=a^i; %wypelnianie tablicy kolejnymi potegami a
end
out1 = tab;
end
|
function K = kernelBasis(X1, X2, kernel, kernelpar)
% K(i,j) = Kernel(X1(i,:), X2(j,:))
%
% K = calc_Kernel(X1, X2, kernel, kernelpar)
% kernel and kernelpar select the kernel function and its
% parameters. X1 and X2 contain one example per row. If X1 is of size
% [M, nin] and X2 is of size [N, nin], K will be... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.