text stringlengths 8 6.12M |
|---|
function [PPs, labels, error_table] = get_projections(lowpatches, highpatches, dict_size, em_inum)
%% Basic setting
patch_num = size(lowpatches, 2);
kcenters = randi(dict_size, [patch_num, 1]);
lambda = 0.1;
%% Initial
% PPs
for i = 1:dict_size
idx = find(kcenters == i);
Lo = lowpatches(:,... |
function [ range_each ] = my_data_range_group( datain, n_group )
% calculate data range each group
% n_group must be fit to MxN dimension matrix of datain
% datain = raw data tanpa ada grouping
% n_group = group amount
% range_each = single array of group range
data_group = my_grouping(datain,n_group);
range_each = ... |
function SatDensity= MBWREOS_SatDensityL(T)
%Calculates the saturated density of liquid- consistent with MBWR equation of state
%USE:
%SatDensity= MBWREOS_SatDensityL(T)
%WHERE:
% T = temperature (K)
% SatDensity = density of saturated liquid (kg/m^3)
Tc = 101.08+273.15 ; % Critical temperature
Tr = T/Tc;
A = 5.28... |
function obj = analyzeDirEntry( obj )
%ANALYZEDIRENTRY Check the directoryEntry and set all its properties
for m = 1:obj.dimensionCount
dimEntry = obj.dimensionEntries(m);
switch dimEntry.dimension
case 'X' % Pixel index / offset in the X direction. Used for tiled images
obj.XPos = dimEntry.startCoordina... |
%% functionname: function description
function [labels, numFeature] = text2label(labelText)
m = size(labelText, 1);
labels = zeros(m, 1, 'uint8');
numFeature = 0;
lastText = '';
label = -1;
for i = 1:m
temp = strsplit(labelText{i}, '_');
thisText = temp{1};
if strcmp(lastText, thisText) == 0
label = l... |
function [result, arr] = final_v_seam_rem(img)
array = {};
array{end+1} = img;
energy = dual_gradient(img);
seamArray = find_V_seam(energy);
show = show_seam(img, seamArray);
array{end+1} = show;
result = remove_seam(img,seamArray);
array{end+1} = result;
arr = array;
end
|
f = fopen('iq-fm-96M-240k.dat', 'r', 'ieee-le');
c = fread(f, [2,inf], '*float32');
fclose(f);
z = c(1,:) + j*c(2,:);
s = diff(unwrap(angle(z)))/(2*pi);
myFilter = butter(6, 16000/(240000/2));
x = filter(myFilter(1), myFilter(2), s);
y = x(5:5:end);
length(y)
normalised = y/max(y);
audiowrite('outputRadio.wav', nor... |
%Assigment by Aldo Villarreal on January 6th
%More gray level image processing
%Import image to workspace
rice=imread("rice-shaded.tif");
figure(1)
imshow(rice)
%Create filter to mask uneven ilumination
h_filter=fspecial('average',163);
%Apply filter on the original image using replicate to create the mask
rice_avera... |
n = 200;
x = linspace(-10,10,n);
for k =1:n
y(k) = (2 * sin(x(k))) + (3 * sin(2 * x(k))) + (7 * sin(3 * x(k)));
end
plot(x,y);
|
classdef NetworkManager < handle
properties
convToPoolBlockSets
globalPoolLayers
fcLayer
kernels
learnRate
end
methods
function obj = NetworkManager()
%obj.LMST = inLMST;
%obj.simplexList = inSimplexList;
%obj.nodeX = i... |
function read_molecules()
global ORG_STRUC
uff = struct('molecule',{}, 'ZMATRIX', {}, 'name',{}, 'format',{},'radi',{},'types',{}, 'charge', {},...
'optFlags',{},'index',{}, 'symbol', {}, 'molcenter', {}, 'length', {}, 'CN', {}, ...
'num_optFlags', {}, 'flex_dihedral', {}, 'bound', {}); ... |
edifunction [data header] = importRlsTxt(filename)
%List of fields to read.
fieldList = {'Sr','Si','N1r', 'N1i', 'N2r','N2i',...
'Signal','Phase','Noise','StdErr','PVal'}
%iSess iCond iTrial iCh iFr AF xF1 xF2 Harm FK_Cond iBin
%SweepVal Sr Si N1r N1i N2r N2i Signal Phase Noise StdErr PVal
hdrFields = {... |
% Eclipses
alfa = asin(rE/rO)
angulo_eclipse = 2*alfa
porcentaje = 2*pi/angulo_eclipse
tiempo = porcentaje*T = porcentaje*2*pi*sqrt( r^3/mu )
% Eclipses: cono
r_cono = 138900;
alfa = asin(rT/sqrt( r_cono^2 + rT^2 ))
beta = deg2rad(90) - alfa
c^2 = a^2 + b^2 - 2*a*b*cos(phi)
a/sin(alfa) = b/sin(beta) |
% Kmean clustering with k=2
image=Kmeans('Bird.jpg',2);
figure;
imshow(image),title('K=2');
% Kmean clustering with k=5
image=Kmeans('Bird.jpg',5);
figure;
imshow(image),title('K=5');
% Kmean clustering with k=10
image=Kmeans('Bird.jpg',10);
figure;
imshow(image),title('K=10');
%
% Kmean ... |
function W=Adjacency_(edges,weights,N)
%Function W=adjacency(edges,weights,N) computes the weighted
% adjacency matrix of a point and edge set. For an unweighted
% matrix, set weights equal to ones(1,M) where M is the number
% of edges in the graph.
%
%Inputs: edges - A Mx2 list of M edges indexing into ... |
M = dlmread('anglesOut.txt4');
sp = M(:,1);
sr = M(:,2);
ep = M(:,3);
ey = M(:,4);
s = size(sp);
M_est = dlmread('test0.txt');
sp_est = zeros(size(sp));%M_est(:,1);
sr_est = zeros(size(sr));%M_est(:,2);
ep_est = zeros(size(ep));%M_est(:,3);
ey_est =zeros(size(ey));%&M_est(:,4);
time = zeros(s);
for i=1:s
time(i) =i;... |
function a=divergence(ux,uy)
[m,n]=size(ux);
%u(i+1)
c1=circshift(ux,[0,-1]);c1(:,n)=c1(:,n-1);
c2=circshift(ux,[0,1]);c2(:,1)=c2(:,2);
c3=circshift(uy,[1,0]);c3(1,:)=c3(2,:);
c4=circshift(uy,[-1,0]);c4(m,:)=c4(m-1,:);
a=(c1-c2)./2+(c3-c4)./2;
end |
%% DOCUMENTATION
% OBJECTIVES
% PoT Representation
% PoT
% Input : video.avi
% Output : POT vector representation (using sum, max, and average
% pooling)
%%
clc
clear
close all
vector_sequence = [];
data_pot_sum = [];
data_pot_average = [];
data_pot_max = [];
interval = 3;
% Input
s... |
function img = iReflex(exImg,sizeImg)
%% iReflex
% exImg: Imagen extendida (entrada)
% sizeImg: Tamaño de la imagen de salida
% img: Imagen resultado
[nRows nCols ~] = size(exImg);
rows = sizeImg(2); cols = sizeImg(1);
dRows = (nRows-rows)/2;
dCols = (nCols-cols)/2;
img(:,:,:) = exImg(dRows+1:dRows+rows, ... |
% This is an ISET simulation script that generates a number of natural
% scenes and simulates acquisition with cameras with different levels of
% read noise.
%
% Copyright, Henryk Blasinski, 2015
close all;
clear variables;
clc;
s_initISET;
%%
nChannels = 7;
nBasis = 6;
wave = 400:5:700;
nWaves = length(wave);
del... |
clearvars
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% make plots for 2020/08/21 meetings base don program outputs
% Corwin Wright, c.wright@bath.ac.uk
% 2020/08/21
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function TOTALprojection = forwardProjectGPU( H, realspace )
global zeroImageEx;
global exsize;
Nnum = size(H,3);
zerospace = gpuArray.zeros( size(realspace,1), size(realspace,2), 'single');
TOTALprojection = zerospace;
for aa=1:Nnum,
for bb=1:Nnum,
for cc=1:size(realspace,3),
... |
function u = udpReceiveOpen(port2receive, handles)
global handles
global udpReceive
global errCount
global initaialFrameCount
global dataSum
global x
global y
global z
global t
global tt
t=0;
tt=0;
global meshFlag
global algoFlag
global initialFlag
global laySitRecord
global onOffRecord
global onOffArray
global move... |
%3.tocka
%koeficienti polinoma dveh spremenljivk
B = [2 5 -1 0;
1 3 -4 nan;
0 0 nan nan ;
1 nan nan nan];
%trikotnik T
T = [0 0; 5 1; 3 3];
%tocke za izvrednotenje
T1 = [0 0];
T2 = [1 1];
T3 = [4 2];
%baricentricne koordinate tock
bar1 = pointbary(T1,T); %(1.000000, 0.000000, 0.000000)
ba... |
% ======================================================================
% Simple FVision FModel (SFF) TotalCorrelationEstimate Version 2.0
% Copyright(c) 2020 Qiang Li & Jesus ;-)
% All Rights Reserved.
% qiang.li@uv.es
% ----------------------------------------------------------------------
% Permission to use, ... |
load('resultsforchorusn1to68.mat')
for i=2:length(predscore)
meanscore(i-1)=mean(predscore{i}(1,:));
equalmean(i-1)=mean(predscore{i}(2,:));
end
figure
plot(2:length(predscore),meanscore,'b.')
xlabel('Max Length of Pattern Used', 'fontsize', 14)
ylabel('Score', 'fontsize', 14)
|
%index 30: fits are not too different, only one wayward optimization,
%median fine
format shortg;
close all
T = readtable('../Residual_Algorithm/PatientInfo07212021.csv','Headerlines',2);
figureson = 1;
%for i = 1:4, 6:12;
%load(strcat('../../Control/Control_Optimized/control',num2str(i),'_optimized.mat'));
for ... |
function LL = get_location_load(DATA)
day_indices = get_day_indices(DATA);
total_days = length(day_indices);
total_locations = length(unique(DATA(:,3)));
LL = zeros(total_days,total_locations);
for t=1:total_days
DATA_DAY = DATA(day_indices{t}(1):day_indices{t}(2),:);
for loc=1:total_locations
LL(t,l... |
%============================ blobFilter ============================
%
% Returns the handle to an image processor that applies an oriented
% blob filter. An oriented filter is essentially a filter bank of
% blob filters that are rotated at different angles. The orientation
% of a pixel is determined by the ... |
function [angs, points] = mixed_angles(obj1, obj2, m,n, labs,leg,misssubs)
% Computes the angle difference between dominant eigenvectors of two
% leadinfo objects. Use this with respect to two objects that differ in
% some way, for example control and Tinnitus groups or session 1 vs session
% 2. angles.m also generat... |
function varargout = vis_gui(varargin)
% VIS_GUI M-file for vis_gui.fig
% VIS_GUI, by itself, creates a new VIS_GUI or raises the existing
% singleton*.
%
% H = VIS_GUI returns the handle to a new VIS_GUI or the handle to
% the existing singleton*.
%
% VIS_GUI('CALLBACK',hObject,eventData,handl... |
%LRsounds: the GUI for playing sounds to left adn right ear. Nothing fancy.
%*******************************************************************************
% The Graphical User Interface
% this version allows differing filenames for each ear
%**********************************************************************... |
maskParams.padSize= 2; % 2x padding
maskParams.loLimAngst= 80;
maskParams.hiLimAngst= 3;
maskParams.smoothPix= 5;
maskParams.sigma= 1.42;
maskParams.resolutionAngst= [17.00 10.00 8.00 5.00];
maskParams.threshold= [6.20 5.50 4.70 3.80];
classesMrcsPath= '/mnt/d/csparc/P1/J44/cryosparc_P1_J44_... |
function [sync_packet] = make_packet(pos_vec,vel_vec)
%THIS FUNCTION GENERATES OF THE SYNCWRITE PACKET
%([pos_vec] position vector of the motors)
%([vel_vec] velocity vector of the motors)
%([following is the sync write packet structure])
%([255 255 254 L(length) sync_instruction(131) starting_reg(30) N(number of ... |
% Test for varying CI bounds
N=20;
n=30;
n_f=4;
samples = 60;
deltaNorm_R = zeros(samples*10,1);
MSE_R = zeros(samples*10,1);
totalError_R = zeros(samples*10,1);
MSE = zeros(samples*10,1);
deltaNorm = zeros(samples*10,1);
totalError = zeros(samples*10,1);
i=0;
epsilon = normrnd(0, 1 ,[n,N]);
Sig = 1;
... |
function [ processedRespVec ] = processResponses( symmetryFunc, respVec, vecMap )
respVecSize = size(respVec);
processedRespVec = zeros(1, respVecSize(2));
%%Preallocate the vector
if strcmp('sigmoid', symmetryFunc)
processedRespVec = ( cos(vecMap(respVec)) + 1i * sin(vecMap(respVec)) );
e... |
function graph_r(I, a, b, from, to)
hold off;
x = from : to;
for i = x
actual(i - 4) = abs(I - rectangles(a, b, i));
theoretical(i - 4) = abs((b - a) * power((b - a) / (i - 1), 2) * (-1 / power(1 + a, 2)) / 24);
runge(i - 4) = abs(rectangles(a, b, i) - rectangles(a, b, round(i /... |
function y=zointerp(x,displ,len)
% zointerp.m
%
% Input: x: downsampled predictions
% displ: window displacement during feature extraction
% len: intended length of data (147500 in the case of
% leaderboard predictions)
%%
y=zeros(len,size(x,2));
I=eye(l... |
function [ ] = draw_template( actions,lengths,mean_subsignals,actions_warped,temp_mean )
marker='o';
marker_size=3;
wave_color1=[208,32,144];
wave_color2=[255,148,25];
wave_color3=[107,142,35];
action=1;
% Original samples
% h=figure;
% hold on;
% sample=1;
% t=1:leng... |
function [dirratio]=directionalratio(headpath,tuningfilename,version)
close all; %make sure nothing else is open when you start
cd('tuning2');
load(tuningfilename);
tuningname=strsplit(tuningfilename,'.');
cd(headpath);
fn=fieldnames(chosenfluor);
if version==1
window=[15 25];
elseif version==2
window=[20... |
function [X_op,X_L_op, rms_error_list, P_states, P_landmarks] = constrained_SLAM( X_0,P_0,X_L_0, Q, R, Y_v,Y_w, Y_r,Y_b,Y_const, t, d, constr_L, x_true, y_true, th_true, l_true)
%GN_ESTIMATOR Summary of this function goes here
%% Some matrix dimensions
M = 17*2; %No of landmarks times dimension of landmark position... |
function [L, L_I]=max_eig(D,c)
if ~exist('c','var'), c = 0; end
[M,N] = size(D);
if isa(D,'gpuArray')
L = zeros(size(D),'single','gpuArray');
else
L = zeros(size(D));
end
m = min(M,N);
h1=diag(D);
% Ir1 = h1 < c;
% %reLU
% r1 = h1;
% r1(Ir1) = 0;
L_I = h1 < c;
%r... |
function [cost, grad] = softmaxCost(theta, numClasses, inputSize, lambda, data, labels)
% numClasses - the number of classes
% inputSize - the size N of the input vector
% lambda - weight decay parameter
% data - the N x M input matrix, where each column data(:, i) corresponds to
% a single test set
% labels -... |
function PathBasedDisimilarity = PathbasedDist(W,x);
Pairs = minimumSpanningTree(W); %%%% MST
% Pairs0 = [];
% Pairs = FastMST0801_M(x, Pairs0); % FastMST
% compute path based distance and geodesic distance
PathBasedDisimilarity = pathGeodesic(Pairs, W);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
% System_Wizyjny_Online_V4 - Zaimplementowany filtr Kalmana i optymalizacja
% okna pomiarowego
clc
clear all
close all
%% specyfikacja testu
MaxTime = 20 ; %maksymalny czas pobierania danych
display_figure = 'ON'; % jeśli 'ON' to wyświetlany jest pogląd aktualnej pozycji
odleglosc_wierzcholkow=20; % odleglosc w cm międ... |
function [] = write_data(connection, data)
if(length(data) <= 61)
report(1)=9;
report(2)=length(data);
report(3)=0;
report = [report data];
reportPointer = libpointer('uint8Ptr', report);
res = calllib('iowkit', 'IowKitWrite', connection, 1, reportPointer, 64);
else
... |
%% DOUBLE CHECK: tiger should have been initialized (and solvers set) at the end of model_curation_careyBMCG. if not:
% start_tiger # default is cplex solver
% set_solver('gurobi');
% set_solver_option('MaxTime',60*60); % max time a TIGER simulation is allowed to run
% set_solver_option('IntFeasTol',1e-8); % cutoff... |
function this = plot(this, name)
comp = this.ref.(name);
plot(this.time, comp.val, 'r');
if ~isempty(comp.data)
data.time = comp.data.src.time;
data.val = comp.data.src.val;
data.std = comp.data.src.std;
hold on
if any(data.std)
errorbar(data.time, data.val, data.std, 'kx', 'LineWidth', ... |
function img = renderSingleGenom(fixedLayer, layers, genom, segments, genomIdx, adder)
% RENDERSINGLEGENOM
% Renders one single entry of a genom and returns only the region in the
% image where the related segment is visible
%
% Part of a *FAILED* approch to segmentation optimization by genetic
% optimization.
%
% Wr... |
%%%Channel%%%
%Add a dead-time tau_n
for i=1:N
tau_n=Tb*rand(1)/1000;
delayed (:,i) = delayseq(channel_input(:,i),tau_n);
end
%Add a weakening constant alpha_n
signal = delayed * alpha_n;
%Add AWGN noise
channel_output = awgn(signal,SNR);
|
%% Inputfile for a 7 bus system
% All Data is in p.u. 'j' refers to imaginary operator. '_' refers to
% subsciprt. '^' refers to superscript.
%% BUS_SPEC consists of 14(Hex - E) columns. The column wise description is
% as follows:
% 1 -- Bus Numer.
% 2 -- Type of Bus, 0 == slack, 1 == PV, 2 == PQ
% 3 -- Initial... |
%----------------------------------------------------------------------------
% openncfile_cosp.m
%
% this script opens a netcdf file and stores variables in a structure 'v'
%
% concerning modis
% there are several questions to be resolved with modis
%
% 1. what are reff_modis and reff_modis2? they are old and may not... |
function [MFt, MFf] = matchedFilter(signal_f, Hf, fs)
% function [MFt, MFf] = matchedFilter(signal_f, Hf, fs)
% calculates the (complex) matched filter output in time and frequency for
% an input signal in the frequency domain, when matched with a system
% function H.
% INPUTS :-signal_f, input signal in freque... |
function gen_toc()
%GEN_TOC Build the HTML files used by the Matlab help browser
[here,~, ~]=fileparts(mfilename('fullpath'));
docdir = fullfile(atroot,'..','docs','matlab');
tocfile = fullfile(docdir,'helptoc.xml');
[fid,fmess,fmid] = copyfile(fullfile(here,'helptoc.xml'),tocfile);
if fid <= 0
error(fmid,'%s: %s'... |
function [ Z ] = Feval(f,x0)
%----------------------------------------------------------------------------------------------
% Author: Hemanth Manjunatha
% Date: Oct-13-2015
%
% Function : powell.
%
% Purpose : Gives partial derivative of a function at a funciton at x.
%
% Parameters : f-> given function,... |
function cr = processData(r,s,Tstart,Tmax)
fs = 96000;
c = 343;
M = length(s);
N = length(r);
nstart = fix(Tstart*fs);
nmax = fix(Tmax*fs);
if (length(r) < length(s))
r = [r zeros(1,length(s)-length(r))];
end
cr = real(ifft(fft(r,N+M-1).*fft(fliplr(s),N+M-1)));
cr = cr(M:length(cr));
cr = cr((nstart+1):length... |
function result =rfunccode(alpha,A,Farray)
Ax=A(1);
Ay=A(2);
Az=A(3);
R0001=R000x(1,alpha,A,Farray);
R0002=R000x(2,alpha,A,Farray);
result =(R0001)+Ax*(Ax*(R0002)); |
function plotSeparation(b, model, varargin)
% Plot cluster separation by projecting on LDA axes
% plotSeparation(b, model) visualizes the cluster separation by
% projecting the data on the LDA axis for each pair of clusters. Each
% column is normalized such that the left cluster has zero mean and unit
% varianc... |
function [rotmat] = get_rotmat(obj)
% Returns the rotation matrix A from class cFrame.
% Return rotation matrix
rotmat = obj.rotmat;
end % get_rotmat()
|
%% evaluation of the 6dof forward kinematics problem solution
% forward kinematics for original configuration
ROBOT = 'GP50';
robot=robotproperty(ROBOT);
%% robot set up parameters
% real theta
theta_ini = [-0.0452 -1.5247 0.2224 -0.0072 0.1575 -1.9004]';
% anchor poitn
anchor_point = [1.6343;0.0060;1.1... |
function peglistener( addr, msg2 )
msg = msg2.clone;
text = [];
text.msg = msg;
text.TIME = now;
%try; text = AMDispatch( text ); catch; end;
text = AMDispatch( text );
pegclient( text );
function text = IdentBody( text )
text.BODY = 'Ident';
text.unix_time = text.msg.pop_uint32;
text.unix_time_string = datestr( unix... |
function p=setClockRate(varargin)
%p=setClockRate(tickRate)
%
%This function will create a packet to
%go into SLEEP_MODE
%if your mote is running the COMMAND component
%Adjust the relevant global parameters listed below before calling this function.
%
%possible values of tickRate are 1, 2, 4, 8, 16, 32, 63, ....4096, 1... |
clearvars
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%new 2D+1 ST version, based on meeting of 07/08/2020
%Corwin Wright, c.wright@bath.ac.uk, 1... |
function y = svm_rbf_regressor(svs,sv_coefs,b,gamma,x)
Ksv = length(sv_coefs);%number of support vectors coefficients
[N,NFr] = size(x);
temp = zeros(N,1);
y = zeros(N,1);
for k=1:N
for i=1:Ksv
temp(k) = temp(k) + sv_coefs(i)*rbfk(svs(i,:),x(k,:),gamma);
end
y(k) = temp(k,:) + b;%out... |
function dCovMatdt=covariance_matrix_ode_v1(CovMat,detsolstruct,t,param,dimension)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% ... |
% 畫ADCP的每日資料(u,v,u+v)
%80公尺以上的流速容易擾動
%通常只畫80公尺深以下的資料
current_folder = pwd
cd(current_folder)
clear;clc
load D1S1L000_2
%%
u = SerEmmpersec*0.001; %(m/s)
v = SerNmmpersec*0.001; %(m/s)
Error_V = SerErmmpersec*0.001; %(m/s) A Series of Error velocities
Mag_V = SerMagmmpersec*0.001;% A Series of Magnitudes (m/sec)
% BTd... |
function pktboundscollapsed = CollapsePacketBoundaries2(pktbounds,minseparation,series,backgroundthresh)
pktboundscollapsed = pktbounds(1);
for i = 2:length(pktbounds)
% current pkt-bound sufficient distance from last pkt-bound
if pktbounds(i) - pktboundscollapsed(end) >= minseparation
% ... |
function V0 = nuft_forw_gridding(Y, px, py, E2x, E2y, E3x , E3y)
% Forward fast Gaussian gridding.
% Consider using the MEX version which is much faster.
%
% Copyright, Matthieu Guerquin-Kern, 2012
Nb = numel(E2x);
Mr = size(Y);
Msp = numel(E3x)-1;
V0 = zeros(Nb,1);
px = double(px);
py = double(py);
%% First dum... |
function out = GetForces2(P,u)
t=u(1);
state=u(2:13);
ctrl=u(14:P.SurfCnt+14);
pn = state(1);
pe = state(2);
pd = state(3);
u = state(4);
v = state(5);
w = state(6);
phi = state(7);
theta = state(8);
psi = state(9);
p = state(10);
q ... |
%Test to główny plik programu!
clear; clc; %czyscimy przestrzen pracy i okno komend
wejscia=input('Podaj liczbe wejsc (jednoczesnie l. argumentow): '); % podawanie kolejnych wymaganych do dzialania sieci danych
warstwa1=input('Podaj ilosc neuronow warstwy ukrytej: ');
warstwa2=input('Podaj ilosc neuronow warstwy d... |
% ENSC180-Assignment3
% Student Name 1: Nicole
% Student 1 #: 123456781
% Student 1 userid (email): stu1 (stu1@sfu.ca)
% Student Name 2: Tobi Shires Nakamura
% Student 2 #: 123456782
% Student 2 userid (email): tshiresn (tshiresn@sfu.ca)
% Below, edit to list any people who helped you with the assignment,
% ... |
function Z1 = kalign(Z0, vp0, vp1,rmax)
% creates the tform matrix that aligns Z1(ref) and Z2 (object).
% To obtain aligned version of Z2 use comand:
% Z2t = imtransform(Z2, tform, 'XData', [1 n],'YData', [1 n]);
n=length(Z0);
N0 = length(vp0);
N1 = length(vp1);
% discard points that are further than rmax
if nargin... |
function EventFcnMultiCaller(obj, event, oldFun, newFun)
% Author: Vladimir Golkov
if isa(oldFun,'function_handle')
oldFun(obj, event);
end
if iscell(oldFun)
% recursively call all added functions
EventFcnMultiCaller(obj, event, oldFun{2:end})
end
newFun(obj, event);
|
function deploy_each_dagnet(epoch, datapath)
for i = 1:epoch
fileName = strcat('net-epoch-',num2str(i),'.mat');
fileName = fullfile(datapath,fileName);
[net, info] = loadState_deploy(fileName);
net = net_deploy(net,1) ;
deployname = strcat('net-deployed-',num2str(i),'.mat');
save(fullfile(datap... |
clear;
% load our data set
load('iddata-11.mat');
uid = id.U; % real input
yid = id.Y; % real output
Nid = length(uid); % length of the input vector
% IDENTIFICATION
figure;
plot(uid,yid);
title('DATA identification');
xlabel('input identification');
ylabel('output identification');
m = 1; %degree
na =... |
function [samples, outputPath] = plexon2bin(rawDatapath, saveBinPath, channelTpye, opts)
% only pl2 files are supported, continous data must be recorded
% channelTpye: 'SPKC' or 'WB'
%% data file names:
rawFileName = {};
for i = dir(rawDatapath)'
if numel(i.name)<3 || ~strcmp(i.name(end-2:end), 'pl2')
... |
function Imaget=mycolor3(Imaget)
Image=im2double(Imaget);
I=rgb2hsv(Image);
[y,x,z]=size(I);
Blue_y = zeros(y, 1);
white_y = zeros(y, 1);
p=[0.56 0.68 0.4 1 0.3 1 3]; %蓝色,考虑到阴影的影响,放宽了亮度的下限
wp=[0 0 0 0.1 0.9 1]; %白色的hsv参数
figure;
for i = 1 : y
for j = 1 : x
hij = I(i, j, 1);
si... |
% Make a DBN for the exocytosis model with the following variables
%
% Time-dependent variables
%
% Coupling variables
% Gex.C, Gcell.C, Scell.C
%
% Observed variables
% The node 'GLP1.obs' corresponds to the 'GLP1.GL' in the GL data model
%
% Time-invariant variables
%
% Parameters
%
% To generate a conditional gaussi... |
function EigPlotBcN(bcVec,NVec,bcE,maxRealEigVal,maxImagEigVal,...
ParamStr1,ParamStr2,SaveMe,xMode,yMode,AnisoDiff,PerturbGen,NVaryStr,MaxEig)
figure
subplot(2,1,1)
plot(bcVec,maxRealEigVal)
Ax = gca;
Ax.YLim = [0 MaxEig];
legendCell = cellstr(num2str(NVec', 'N=%-d'));
legend(legendCell)
xlabel('bc');ylabel('Max ... |
classdef Road
properties (SetAccess = protected)
start % (x,y) vector for the start
finish % (x,y) vector end
length % length of road
velocity % (x,y) vector for max velocity
end
methods
function obj = Road(start, finish, velocity)
if nargin > 0
obj.s... |
%EEG1 = pop_loadset('/labs/burwellstudy/projects/testing-eeg-toolbox/output_data/201810291300_sub000502_ses01_run03_cnt_epoch_emg.set');
%EEG2 = pop_loadset('/labs/burwellstudy/projects/testing-eeg-toolbox/output_data/201810291300_sub000502_ses01_run04_cnt_epoch_emg.set'); EEG = pop_mergeset(EEG1,EEG2,1);
%EEG = pop_l... |
clear;
clc;
g = 9.81; %przyciaganie ziemskie
fprintf('punkt a) - rzut poziomy)\n');
fprintf('-----------\n');
vo = input ("ustaw predkosc poczatkowa w m/s: ");
ho = input ("ustaw wysokosc poczatkowa: ");
vox = vo; ... |
function [ctchannels,idxc] = Crosstalk(g,ch1,tmax,h)
% CrossCorrAll: Compute spike time cross correlations for all pairs
% [cpdf,pair] = CrossCorrAll(tall,tmax):
% Input:
% alltimes: alltimes{i,j} is a vector of spike times. alltimes(i,:) should be a
% cell array of related spike times, i.e. same channel or same cel... |
function idx = findClosestCentroids(X, centroids)
%FINDCLOSESTCENTROIDS computes the centroid memberships for every example
% idx = FINDCLOSESTCENTROIDS (X, centroids) returns the closest centroids
% in idx for a dataset X where each row is a single example. idx = m x 1
% vector of centroid assignments (i.e. eac... |
function [ thrIm2 ] = thresholding( thrIm, punctamindiameter, punctamaxdiameter, varargin )
global demo
% Length units are entered in pixels
ws = cell2mat(varargin(find(strcmp([varargin],'ws'))));
demo = cell2mat(varargin(find(strcmp([varargin],'demo')))); % Run program in demo mode
% Demo mode command %
if isempty(... |
function [ kokLapaisy ] = particleLossesSampling( U, Uo , dp,d, inletinAsento, kuvat)
%Funktio laskee näytteenoton tehokkuuden annetuilla parametreillä. TÄllä
%hetkellä on vain mahdollista laskea häviöt isoaksiaalisessa tapauksessa
%(putken virtaus ja ilmavirtaus ovat saman suuntaisia, eikä niiden välissä
%ole kulmaa)
... |
function [information] = cross_validation(x, y, fold_num, similarity_func)
total_classes = 6;
information = struct('predictions',[], 'conf_matrix',[], 'error_rate',[], 'precision_rates', [], 'recall_rates',[], 'falpha_measures',[], 'classifying_errors', []);
information.precision_rates = zeros(1,total_classes);
inform... |
function c = corrT(x,y)
nx = numel(x);
mx = sum(x)/nx;
my = sum(y)/nx;
sx = sqrt(varT(x));
sy = sqrt(varT(y));
c = sum((x-mx).*(y-my)) / ((nx-1)*sx*sy);
if isinf(c), c = 0; end;
if isnan(c), c = 0; end;
c = min([c,1]);
c = max([c,-1]); |
clc
clear
format long g
global const
SAT_Const
ge = 398600.8; % Earth gravitational constant
TWOPI = 2*pi;
MINUTES_PER_DAY = 1440;
MINUTES_PER_DAY_SQUARED = (MINUTES_PER_DAY * MINUTES_PER_DAY);
MINUTES_PER_DAY_CUBED = (MINUTES_PER_DAY * MINUTES_PER_DAY_SQUARED);
% TLE file name
fname = 'tle.txt';
% Open the TLE file an... |
function choosemasterfield(HSPReduction)
%CHOOSEMASTERFIELD Summary of this function goes here
% Detailed explanation goes here
% Extract some information.
MasterFieldArray = HSPReduction.MasterFieldArray;
FieldSolutions = HSPReduction.FieldSolutions;
solutionIndex = mode([FieldSolutions.FieldIndex]);
Master... |
function [t] = accel_time(a,v1,v2,vec,vmax)
%ACCEL_TIME Calculates time for an accelerating obeject give points of
%travel, acceleration, initial and final velocity.
d = norm(vec);
d_accel = abs(((vmax^2)-(v1^2))/(2*a));
d_decel = abs(((v2^2)-(vmax^2))/(2*a));
if (d_accel+d_decel) <= d
t1 = abs((vmax-v1)/a); %acc... |
clear all, close all, clc
%(------------------------------------------ PARAMETERS ------------------------------------------)
%%
hazardTotal = 5; % Total number of obstacles
hazardSizes = [0.05,0.15];
hazardWindow = [-1,1;-1.8,1.8];
flagSize = 0.25;
redFlagpos = [2,1.1];
blueFlagpos = [-2,-... |
function [Di,Ne,Nodelist] = evaluate_boundary_conditions (Domain,BC);
%
% [Di Ne Nodelist] = evaluate_boundary_conditions (Domain,BC)
%
% This function find the correct boundary conditions to assign to a domain.
%
% Input & Output of this function are:
%
% Domain:
% Domain.Boundary.Values: references to boun... |
function res = commutatorSE3N(u,v)
N = length(u)/6; %number of connected pendulums
res = zeros(length(u),1);
for i = 1:N
res(6*i-5:6*i) = commutatorSE3(u(6*i-5:6*i),v(6*i-5:6*i)); %exploit the
%direct product structure of the Lie group SE(3)^N
end
end |
clc;clear all;close all;
load('264_optdigits.mat');
features = data;
labels = labeledData(:,1);
[N D] = size(data);
% Determine the train and test index
trainIndex = zeros(N,1);trainIndex(1:1000) = 1;
testIndex = zeros(N,1);testIndex(1001:N) = 1;
trainData = features(trainIndex==1,:);
trainLabel = labels(trainIndex==1,... |
function v = q2rv(q)
n2 = acos(q(1));
if n2>1e-20
k = 2*n2/sin(n2);
else
k = 2;
end
v = k*q(2:4); |
function [Test_D_P,Train_D_P] = LDA(Train_Data,Test_Data,N_C)
%
% This function implement the Linear Discriminant Analysis.
%
% [Test_D_P,Train_D_P] = LDA(Train_Data,Test_Data,N_C)
%
% Train_Data - The training data (Must be reshaped to a vector)
% Test_Data - The testing data (Must be reshaped to a vector)
% N... |
fm3 = (1/9) * ones(3,3);
fm5 = (1/25) * ones(5,5);
fm7 = (1/49) * ones(7,7);
foTr3 = mask_Fourier_transform(fm3);
foTr5 = mask_Fourier_transform(fm5);
foTr7 = mask_Fourier_transform(fm7);
figure();
subplot(1,3,1);
imagesc(foTr3);
colormap(gray);
subplot(1,3,2);
imagesc(foTr5);
colormap(gray);
subplot(1,3,3);
imagesc... |
function [ outputImage ] = myAHE( inputImage, N )
% The function is used to perform Adaptive Histogram equalization on an image passed as inputImage
% using a window size of N (default assumed to be an odd number). The method uses two custom
% defined functions myHE (which is our implementation of histogram equali... |
function fitness = CacuFit(path,a,b,h)
%%该闲数用于计笕路径适应度值
% path input 路径
% fitness input 路径适应度值
[n,m] = size(path);
% 对于每一只蚂蚁
for i = 1:n
fitness(i) = 0;
for j = 2: m/2
%适应度值为长度加高度,j*2-1为 y,j*2为 h
fitness(i) = fitness(i) + sqrt((1*b)^2+((path(i,j*2-1)-path(i,(j-1)*2-1))*a)^2+((path(i,j*2)-path(i,(j-1)*2))*h)^2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.