text stringlengths 8 6.12M |
|---|
clc; clear all; close all;
load('100m.mat');
N=8; M=8;
k=input('enter the total no.of samples');
% figure;
n=1:1:k;
x(n)=val(1,k);
x=x(n);
% figure 1;
plot(x(n));
y2=x(n);
y3=x(n+1);
y4=x(n+2); y5=x(n+3); y6=x(n+4);
y7=x(... |
function LH = mod23(startValues, choice, outcome)
alpha = startValues(1);
temp = startValues(2);
delta = startValues(3);
options=size(outcome,2);
trials = size(outcome,1);
Q=zeros(trials, options);
%initialize Qs for the first trial as 0
for o = 1:options
Q(1,o) = 0;
end
% Call learning learnin... |
function diff_equation
t = [0,0.02,0.04,0.06,0.08,0.1,0.12,0.14,0.16,0.18,0.19,0.195];
xk_2 = 1;
xk_1 = 1;
xk = 1;
for i =1:length(t)-1
[~,~,ncp] = fbncp(xk_2,xk_1,xk,t(i+1),t(i));
part_ncp = partial_ncp(xk_2,xk_1,xk,t(i+1),t(i));
x_k = - ncp / part_ncp;
lambda_k=Newton_line_search(x_k,xk_2,xk_1,xk,t(i... |
clc
clear
load('hedfhd_short.mat') %pre-loading data
load('hedfhdnames_short.mat')
XRET = hedfd_short(1:end,2:end-1);
figure, hold('on')
subplot(2,2,1)
autocorr(XRET(:,67))
name1 = hedfhdnames_short{67};
title(name1(13:end-17))
subplot(2,2,2)
autocorr(XRET(:,59))
name2 = hedfhdnames_short{59};
title(name2(13:e... |
%% ECE-552 Spice project / Phase I
% Author: Seyed Nematollah Ahmadyan
% Fall-2011
% this is a kernel script
tic
clear
disp(sprintf('ECE552-Spice Started'));
fileName = 'bjt.txt' ;
verbose=0;
symbolic=0;
format long ;
hspiceEnabled=0;
disp(sprintf('[info] parsing input netlist: %s', fileName));
if hspiceEnabl... |
function grad = compute_singval_grad(X, q, eps)
% COMPUTE_SINGVAL_GRAD Computes gradient of singular value rank
% approximation
% ns = COMPUTE_SINGVAL_GRAD(X, p, eps) to computer gradient with
% smoothing parameter eps and multiplier (1 + eps ^ q)
grad = 2 * eps * (1 + eps ^ q) * mpower(X * transpose(X) + ...
... |
function right_left_velocity = getVelocities( delta_phi )
% GETVELOCITIES Calculates the current velocities based on delta_phi
% obtained from the dynamical contributions.
%
% right_left_velocity = GETVELOCITIES(delta_phi)
% @PARAM
% delta_phi - angular displacement resulting from the dynamics.
% @RETURN
% right_left_... |
function [Y]=CameraSensitivity(rgbCMF)
% rgbCMF : database fo 28 cameras Reference: What is the Space of Spectral Sensitivity Functions for Digital Color Cameras?
Y = zeros(99,28);
redS =rgbCMF{1,1};
greenS= rgbCMF{1,2};
blueS =rgbCMF{1,3};
for i=1:28 %normalise
Y(1:33,i)=redS(:,i)./sum(redS(:,i));
Y(34:66,i)... |
%disp(’Click gauche pour insérer les points de contrôle et click droit pour le dernier et terminer.’);
touche = 1
figure
axis([0 10 0 10])
grid on
hold on
x = []
y = []
i = 0
while touche == 1
i +=1
[xi,yi,touche] = ginput(1);
plot(xi,yi,'r*');
x = [x xi];
y = [y yi];
end
n = length(x)
plot(x,y,'g')
%*... |
styleImage = im2double(imread('starrynight.JPG'));
contentImage = imread('lighthouse.JPG');
imshow(imtile({styleImage,contentImage},'BackgroundColor','w'));
net = vgg19;
lastFeatureLayerIdx = 38;
layers = net.Layers;
layers = layers(1:lastFeatureLayerIdx);
lgraph = layerGraph(layers);
for l = 1:lastFeatureLayer... |
%Section 1.4
%Problem 15
% Initialization
f = @(x) 5*x^7+2*x-1;
fp = @(x) 35*x^6+2;
fpp = @(x) 210*x^5;
g = @(x) 1/x^3-10;
gp = @(x) -3/x^4;
gpp = @(x) 12/x^5;
% Halley
[xbest,~,nitr,~] = Halley(f,fp,fpp,0.5,1e-6,100,0);
fprintf('Householders method for f:\n')
fprintf('Itr:%d, x:%f\n\n',nitr, xbest)
[xbest,~,nitr,~]... |
function [uRot,vRot] = f_vecRot(u,v,theta,ccw,geo)
% - rotate vectors (U,V) by angle THETA
%
% USAGE: [uRot,vRot] = f_vecRot(u,v,theta,ccw,geo);
%
% u,v = corresponding vector components
% theta = angle to vectors
% ccw = rotate vectors counter-clockwise (default = 1)
% geo = use geographical coordinate system ... |
function [circleAvailable, dummyVar] = myDetectCircle_OpenCL(edgedRegion)
%myDetectCircle_OpenCL Optimized circle detection methodology using OpenCL
%This function makes use of the MATLAB OpenCL toolbox designed by
%Radford Juang (https://uk.mathworks.com/matlabcentral/fileexchange/30109-opencl-toolbox-v0... |
disp('frame_rank = ');
disp(frame_rank);
reference_frame=min((frame_rank-1)*10+1,1001)
f=reference_frame;
% f0=f;
% rx_value=rx_evol_interp(f)
% ksi0_value=ksi0_evol_interp(f);
% xpos_sep=interp1(radial_r_value_flux,1:Nradial,rx_value);
%
% psi_limit13=max(interp... |
function [cps] = nominalpowerset(cps_in, cpsuse, t)
% ======================================================================
% Syntax: pn = nominalpowerset(cps, cpsuse, t)
% Description: Set planned power .p of cps structure to zero and if applicable set .p to nominal voltage according to cpsuse
%
% IN: cps:... |
%使用 Ctrl+C 结束,单击图像可查看对应t,y的值
t=0:0.1:100*pi;%t的取值范围
m=-1.5*cos(t)+1.8*t;%θ=∫wdt=-1.5cost+1.8t
plot(t,m);
x=-2*pi;
axis([x,x+4*pi,0,600]);
grid on %加上网格线
while 1
if x>max(t)
break;
end
x=x+0.5;%调节x轴移动速度
axis([x,x+4*pi,0,600]); %移动坐标系
pause(0.1);%程序暂停0.1s继续执行
end
|
function HDIlim = HDIofMCMC(sampleVec,credMass)
% Computes highest density interval from a sample of representative values,
% estimated as shortest credible interval.
% Arguments:
% sampleVec
% is a vector of representative values from a probability distribution.
% credMass
% is a scalar between 0 ... |
%% Naris Paper Sandbox
%% list of sessions to analyze
% Session_list = {'R054-2014-10-11', 'R054-2014-10-12', 'R054-2014-10-13', 'R054-2014-10-14'};
Session_list = {'R054-2014-10-13', 'R054-2014-10-14', 'R054-2014-10-15', ...
'R049-2014-02-07', 'R049-2014-02-08', 'R049-2014-02-10',... % 'R049-2014-02-09',...
... |
%
% Smooth point-set registration method using neighboring constraints
% -------------------------------------------------------------------
%
% Authors: Gerard Sanromà, René Alquézar and Francesc Serratosa
%
% Contact: gsanorma@gmail.com
% Date: 15/02/2012
%
% Nonrigid extension to non-rigidly register samples fro... |
function[sample] = sampleAncestral(p0,pT,n)
nNodes = size(pT,3)+1;
sample = rand(n,nNodes);
sample(:,1)=(sample(:,1)>p0(1))+1;
for t = 2: nNodes
sample(:,t)=(sample(:,t)> pT(sample(:,t-1),1,t-1))+1;
end
end
|
clear all
%% INITIALIZE TIME
to=0;
tf=120;
inc=121;
time = linspace(to,tf,inc);
%% HSF1 TITRATION RANGE
Hsf1_add = logspace(-4,3,50);
%% ODE KINETIC/TXN PARAMETERS
% Obtained from Parameter Screen
k1 = 166.8; % HSP-UP association
k2 = 2.783; % HSP-Hsf1 disassociation
k3 = k1; % HSP-Hsf1 association
k... |
function fb = filterbanks(min,max,amount,fftsize)
mmax = mel(max);
mmin = mel(min);
step = (mmax-mmin)/(amount+1);
for k=1:amount+2
num = (k-1)*step + mmin;
f(k) = num;
fm(k) = melinv(num);
fb(k) = floor((fftsize+1)*fm(k)/(max*2));
end
fbank = zeros(amount,fftsize/2+1);
for j=1:amount
for i=fb(j):fb(j... |
% Find shots within a given distance on a specific line
%
% NJA, 5/16/2016
clear
LINE = 'SGMNT15_MCS001'
LINEPATH = ['./segD_geom/',LINE,'_checkFFID'];
% LINE = './test_segD/SGMNT15_MCS001_checkFFID';
[linename,FLDR1,yyyy,mm,dd,hh,mmm,ss,utmx,utmy,FLDR2,yyyy2,doy,hh2,mm2,ss2] = textread(LINEPATH,'%s%d%d%d%d%d%d%d%f%f... |
function q_BI = euler2quaternion(yaw, pitch, roll)
%#codegen
% Axes: oX -- car heading, oY -- vertical axis. oZ = [oX, oY]
% Rotation sequence:
% 1. yaw, around Y axis
% 2. pitch, around Z axis
% 3. roll, around X axis
sang = sin([yaw, pitch, roll] / 2);
cang = cos([yaw, pitch, roll] / 2);
q_BI = [...
cang(1) *... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% In this file, we used gradient descent method to solve the kl
% optimization problem mentioned in the report
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% read and pre-process feature and label files
... |
% MJLPERC.M
% Expanded range for Bloch Equa
% Called by mjljm
% First check replot ****************************
if mjlreplv == 1 ; % Re-Plot turned on; turn off
set(mjluirepl,'Visible','off') ;
set(mjlreplb,'Visible','off') ;
mjlreplv = 0 ;
end ;
% Do calcs ***************************************
mjlperv = get(... |
% store orbite DOF
%clear
istart=10;
iend=200;
nbpmx=22;
% Orbite sans DOF à stoker
% [X0,Z0] = getboobpm(22,200,10);
% save('orbite_no_DOF', 'X0')
load('orbite_no_DOF', 'X0');
% Orbite avec DOF
[X1,Z1] = getboobpm(nbpmx,iend,istart);
save('orbite_avec_DOF', 'X1');
% difference
Xdiff= X1-X0;
plo... |
cd ./deepray-dgann
mypath
cd ..
CleanUp2D;
close all; clear all; clc;
%% SET PARAMETERS
% boundary conditions
BC_cond = {100001,'P'; 100002,'P'; 100003,'P'; 100004,'P'};
%solution to be considered
alph=73*pi/180;
InitialCond = @(x,y) 1*(y<tan(alph)*x)+3*(y>=tan(alph)*x);
%polynomial order
N = 3;
%ranges to visua... |
function [E, E1, E2, Et, Et1, Et2] = testClassSeperability(N,MEAN1,STD1,MEAN2,STD2, PLOT)
%
% This function generates two random Gaussian sequences and computes
% both the theoretical error and the histogram-based method, using
% respectively the functions computeHistError() and theoreticalError().
%
%
% ARGU... |
% PlotSphereIntensity(azimuth, elevation)
% PlotSphereIntensity(azimuth, elevation, intensity)
% h = PlotSphereIntensity(...)
%
% Plots the intensity (as color) of a number of points on a unit sphere.
% Input:
% azimuth (phi), in degrees
% elevation (theta), in degrees
% intensity (optional, if not provid... |
%--------------------------------------------------%
% %
% Programa para correr para detecção corte de cena %
% %
%--------------------------------------------------%
clear
close all
clc
disp('Selecione video mpeg or avi... |
function [fig_handles] = plot_ERP_image(CFG, EEG)
channel_idx = CFG.channel_idx_to_plot;
channel_lbl = EEG.chanlocs(channel_idx).labels;
exp_id = CFG.exp_id_cur;
event_types = CFG.exp_param(exp_id).event_type;
event_names = CFG.exp_param(exp_id).event_name;
amplitude_limit = CFG.amplitude_limit;
vertical_smoothing_par... |
function [ind_mat]=indicator(im, ind_bb, green_rgb, red_rgb)
ind_mat=zeros(1,1);
k=ind_bb(3);
x=ind_bb(1);
l=ind_bb(4);
y=ind_bb(2);
red_image = imagecrop(im, red_rgb);
green_image = imagecrop(im, green_rgb);
if(green_image(floor(x)+floor(k/2),floor(y)+floor(l/2)) == 1)
ind_mat(1,1)=1;
elseif(red_image(f... |
addpath RWTHMindstormsNXT;
%establish memory map to status.txt.
fstatus = memmapfile('status.txt', 'Writable', true, 'Format', 'int8');
fstatus.Data(10) = 49;
m2 = memmapfile('m2.txt', 'Writable', true);
m3 = memmapfile('m3.txt', 'Writable', true);
b3 = memmapfile('buffer3.txt', 'Writable', true, 'Format', ... |
function [ pos ] = ExtractShortcutVT(cfg_in)
% function ExtractShortcutVT(cfg_in)
%
% extract VT data from Emily's shortcut task raw data
%
% run from data folder; assumes VT1.nvt and *Events.Nev present
%
% cfg_def.nTargets = 2; % number of videotracker targets to extract; 2 is usually the red and green rat LEDs
% cfg... |
function []=plot_coor(fig_num,pos,coor)
% pos = 3 x segment
for k = 1 : size(coor,3)
figure(fig_num)
hold on
str = {'r','g','b'};
for c = 1 : 3
plot3([pos(1,k),squeeze(coor(1,c,k))],...
[pos(2,k),squeeze(coor(2,c,k))],...
[pos(3,k),squeeze(coor(3,c,k))],str{c},'l... |
function setStateButtons(handles)
on = handles.States(:,1);
mult = handles.States(:,2);
for i = 1:length(handles.sensorControls)
%Set the colors
handles = setControlColor( handles,i-1,on(i) );
%Set the Buttons
childTags = getChildTags( handles.sensorControls{i},...
{'SensorO... |
function vals = streamHead(s,n)
% STREAMHEAD Compute the first n elements of the stream
s1 = s;
vals = cell(1,n);
for i=1:n
vals{i} = streamCar(s1);
s1 = streamCdr(s1);
end
|
% John Chen <chenyi@hitsz.edu.cn>
% Shenzhen Graduate School, Harbin Institute of Technology
% Created: November 2013
% Modified: November 2013
function znew = sample_index(probs)
% function that samples
sumprobs = sum(probs);
probs = probs ./ sumprobs;
irand = rand;
cumprobs = cumsum(probs);
znew = 1+ sum(irand >... |
clear all; close all; clc;
n = 500000;
altitudes = zeros(n,1);
temperatures = zeros(n,1);
densities = zeros(n,1);
for i=1:length(altitudes)
altitudes(i) = (i-1)/1000; %alt in km
end
R_E = 6371;
for i=1:length(altitudes)
alt = altitudes(i);
zeta = (alt-120)*(6356.766+120)/(6356.766+alt);
if... |
function spline = ReturnSpline(XY)
X = XY(:,1);
Y = XY(:,2);
sz = size(X);
l = sz(1);
b = zeros(l, 1);
h = zeros(l, 1);
u = zeros(l, 1);
v = zeros(l, 1);
z = zeros(l, 1);
spline = zeros(l - 1, 4);
for i = 1 : (l - 1),
h(i) = X(i+1) - X(i);
b(i) = (Y(i+1) - Y(... |
close all
clc
%% Load Data
tic; fprintf('Importing Data \n');
if exist('ACWI','var') == 0
load('Data_0918.mat');
else
clearvars -except ACWI Index
end
toc
%% --------------------------------------------- Define Parameters ----------------------------------------------------------------
%% ... |
function [MK_ERP]=MKMS_ERP(ERP_Subj,Subj,k,G)
for g=1:G
for s=1:Subj % subjects
x=squeeze(ERP_Subj(:,:,s,g)); % samples x channels x subjects x groups
[A_opt,c_idx,Res] = modkmeans(x',k); % chan x samples
MK_ERP(:,s,g)=c_idx';
end
e... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
%
%
%
% Plotting in 3-D space
%curve
x=0:.1:100;
y=cos(x);
z=sin(x);
plot3(x,y,z)
xlabel('x')
ylabel('y=cos(x)')
zlabel('z = sin(x)')
%surface
x=1:5;
y=1:5;
[X,Y]=meshgrid(x,y)
Z=... |
function [x, fval] = ALM_solver_for_Maximizing_MPLIP(amp, phase, ...
relFreqConst,numSources,xcoords, ycoords, zcoords, sigma, ...
epsilon, alpha, beta, maxIter, lb, ub)
% Maximizing Monochromatic Polarized Light Interference Patterns Using
% Augmented Lagrangian Method.
%#codegen
%% Optimization prob... |
clear all
close all
clc
tic
I = imread('cameraman.jpg');
I = double(I);
f1 = gabor_filter(0.25,0.5,0,I);
f2 = gabor_filter(0.25,0.5,pi/4,I);
f3 = gabor_filter(0.25,0.5,3*pi/4,I);
f4 = gabor_filter(0.25,0.5,pi/2,I);
% f5 = gabor_filter(0.75,1.5,5*pi/4,I);
% f6 = gabor_filter(0.75,1.5,3*pi/2,I);
% f7 = gabor_filte... |
function A = graphrnd(n, m, diagpull)
% GRAPHRND Creates adjacency matrix of a random graph
%
% Other m-files required: none
% Subfunctions: none
% MAT-files required: none
%
% Author: Gabriel Moreira
% email: gmoreira (at) isr.tecnico.ulisboa.pt
% Website: https://www.github.com/gabmoreira/maks
% ... |
% Input matlab directory, layer set number, name of E_file, and cell_id,
% writes Er.txt to
function Er = writeEr(mat_dir,run_params_fold,cell_model,Efield)
% Open E-field data for cell
Edata_dir = fullfile(mat_dir,'output_data','nrn_efields',...
sprintf('layer_set_%g',Efield.layer_set_num),Efi... |
function pNash = find_nash(follows, langs, logt, constants, global_k, p0)
%% Find Nash (Takes a long time..)
% Somehow, starting from original proportions lead to numerical problems
% Better to start with SW opt or random.
[n,m] = size(follows);
if nargin >= 6
pNash = p0(1:n);
else
pNash = 0.5*ones(n,1);
end
... |
clear
clc
%data=load('patientsDATA.txt');
data=load('analiza.txt');
P_amplitude_AVR=data(:,1);
P_length_AVR=data(:,2);
Q_amplitude_AVR =data(:,3);
Q_length_AVR =data(:,4);
R_amplitude_AVR =data(:,5);
R_length_AVR =data(:,6);
S_amplitude_AVR =data(:,7);
S_length_AVR =data(:,8);
T_amplitude_AVR =data(:,9);
T_length_A... |
% McClelland and Rogers (2003)
% pcho4@jhu.edu
clear all;
clc;
% Load the data file.
load 'MR03_dataset'
whos
%% Training options
% training option
nepoch = 500; % Number of epochs
lrate = 0.1; % learning rate
wrange = 0.9; % range of initial weights and bias; will be [-.45, .45]
wdecay = 0; ... |
clear
clc
tTest = [-1/sqrt(2), -1/sqrt(2) 0; 1/sqrt(2), -1/sqrt(2), 0; 0, 0, 1];
rTest = [159.099; 384.099; 155];
[r,l] = scaraIK(rTest,tTest)
[rR,rT] = scaraFK(r)
[lR,lT] = scaraFK(l)
|
function Y = sample_random(domain, N, box)
% domain: function handle,
% input: points,
% output: positive number (in the domain)
% negative number (outside of the domain)
% N: number of points
% box: a bounding box domain (dim*2 matrix) that encloses the domain
dim = size... |
function w = ab2(f,t,alpha)
% f = f(t,y) is RHS function of ODE
% t is evenly-spaced vector of dependent variable grid points
% alpha is initial condition
h = t(2) - t(1); % calculate grid spacing
w = zeros(size(t)); % initialise results vector
w(1:2) = alpha; % initial condition
for i = 2:length(t)-1
w(i+1) = ... |
f=imread('cameraman.tif'); %input image
figure, imshow(f);
w=ones(3); %Mask or Kernal
%imfilter to find convolution and correlation of f and w
gconv=imfilter(f,w,'conv','replicate'); %convolution of f and w
figure, imshow(gconv);
gcorr=imfilter(f,w,'corr','replicate'); %correlation of f and w
figure, imshow(gcorr);
%%... |
function h = findplot(h,key,value)
hdls = findall(h,key,value);
if(length(hdls) < 1)
h = figure();
set(h,key,value);
return
end
if(length(hdls) > 1)
for i = 1:(length(hdls)-1)
delete(hdls(i));
end
end
h = hdls(1);
hold off
end |
function [T,I,Y]=perfusionResponseP2X4Inact1factor(y0,ton,toff,Ttot)
ode=modelODEP2X4Inact1factor(ton,toff);
[T,Y]=ode15s(ode,[0 Ttot],y0,odeset('NonNegative',1:22));
I=getTotalCurrentP2X4Inact1factor(Y);
end |
function [acc, loss, proba] = Softloss(y, w, x, lamb)
% proba, loss and gradient
% - x: n_samples, n_features
% - w: n_features, n_labels
% - y: n_samples, n_labels
n_samples = size(x, 1);
ExW = exp(x*w);
proba = bsxfun(@rdivide, ExW, sum(ExW, 2));
loss = -sum(sum(log(proba).*y))/n_samples + lamb/2 * sum(sum(w.^2));
... |
function I = decision_integral_eval(yL,yR,ylevel,v,v_y,pc,yvals,npoints,subv,dn_flag,dn)
if nargin < 9 || isempty(subv); subv = v; end
if nargin < 10 || isempty(dn_flag); dn_flag = 0; end
NumCnd = numel(v);
NumTrials = size(yL,1);
%npoints = 500;
yvals = reshape(yvals,[1,1,length(yvals)]);
subv = reshape(subv,[1,1,le... |
function [N6] = FcalcN6(mel_s)
%function [] = FcalcLoudnessPrctile(amp_m)
%
% Calcul L10, L20, L30, L50 et L90. Prctile de la loudness
% approximée par amplitude^.6
%
amp_m = mel_s.value';
loud_v = sum(amp_m.^.6, 2);
ener_v = sum(amp_m.^2, 2);
maxener = max(ener_v);
maxloud = max(loud_v);
%% max ener -20 dB (sone)
... |
function drawPulleys(Param)
%UNTITLED7 Summary of this function goes here
% Detailed explanation goes here
l=6;
for i=2
% for i=1:size(Param.Pulleys,2)
P1=[-l;Param.Pulleys(:,i)];
P2=[l;Param.Pulleys(:,i)];
[X1,Y1,Z1]=cylX(P1,P2,Param.PulleyR);
surf(X1,Z1,Y1,'FaceColor','none','EdgeColor',[0.9 0.9 0.9... |
data = dlmread('iris.dat'); % data file
v=[1:4];
c=5;
measure = 1; % Used similarity measure (see classifier.m)
p = [0.1:0.25:4]; % p parameter range
m = [0.25:0.25:3]; % m parameter range
pl=1; % Do we use plotting w.r.t. parameters p and m or not pl=0 no plotting pl=1 plotting.
N=10; %How many times data i... |
%script initialisation
clear;
clc;
close all;
syms n t;
%options :
%choice = 'time' will plot the time domain FS
%choice = 'freq' will plot the frequency spectrum
%choice = 'both' will plot both
choice = "time";
%Periodicity Properties
T = 2;
w0 = 2*pi/T;
%define x(t) over a period t -> [0,T]
% x = piecewise(t<-T/... |
% ========================================================
% Simple Gaussian Elimination Algorith with Row Swapping
% Returns list of solutions to system
% ========================================================
% INPUT:
% n: Number of unknowns
% A: Augmented Coefficient Matrix
% Example:
% n = 4;
% A = [
% ... |
%%%%%%%%%%%%%%%%%%%%% Hebbian learning rule %%%%%%%%%%%%%%%%%%%%%%%%%%
% Author: Danny Ly
% Program Description: This program was built to demonstrate the Hebbian
% Artificual Learning Rule, in this program we want to know given the
% Hebbian learning how many prototype images can the weight matrix really
% hold? and w... |
function [centroids] = clustering_pc(points, NC)
[N D] = size(points);
centroids = zeros(NC, D);
NC_list = zeros(NC, N);
#cate elemente are fiecare cluster
NC_col = zeros(1, NC);
#initializam lista cu punctele din fiecare cluster
for i = 1 : N
if mod(i, NC) == 0
NC_col(NC) = NC_col(NC) + 1;
... |
function varargout = licenseplate(varargin)
% LICENSEPLATE MATLAB code for licenseplate.fig
% LICENSEPLATE, by itself, creates a new LICENSEPLATE or raises the existing
% singleton*.
%
% H = LICENSEPLATE returns the handle to a new LICENSEPLATE or the handle to
% the existing singleton*.
%
% LI... |
function varargout = Sig_Project_Disc(varargin)
% SIG_PROJECT_DISC M-file for Sig_Project_Disc.fig
% SIG_PROJECT_DISC, by itself, creates a new SIG_PROJECT_DISC or raises the existing
% singleton*.
%
% H = SIG_PROJECT_DISC returns the handle to a new SIG_PROJECT_DISC or the handle to
% the existing ... |
close all
t = -3:.01:3;
p1 = tpdf(t,1);
p5 = tpdf(t,5);
p30 = tpdf(t,30);
plot(t,[p30; p5; p1],'linewidth',1);
hold on
h=area(t(1:200),p30(1:200));
h.FaceAlpha = 0.2;
text(-1.5,.05,'\alpha')
%text(-2,.02,'(Cumulative probability)')
xlabel('T Value')
ylabel('Probability density (p)')
txt = ' \leftarrow 1 degree of freed... |
function vimSimFigures3P
%common parameters
opts.duration = 60; tooltips.duration = '(s) recording duration';
opts.reqFrameRate = 1e3; tooltips.reqFrameRate = '(Hz) Minimum Frame rate';
opts.accessTime = 25e-6; tooltips.accessTime = '(s) time cost per neuron to image multiple neurons. Assumes no a... |
function [ rho,u,p,M ] = shock( x,shloc,pb,p01,f )
%Function "shock"
% Computes an exact solution at an x-location for a Q1D nozzle
% with an internal shock. The solution is decomposed into two
% isentropic solutions, on either side of the shock.
% -------
% Inputs: sub(x,shloc,pb,p01,f)
% x... |
A=300;a=10;l=1;omega=50;x0=0.3;
x=[0:0.01:l];
for i=1:5000
y=zeros(1,101);
for k=1:100
y=y+A*omega*sin(k*pi*x0/l)/(l*(omega^2-k^2*pi^2*a^2/l^2))...
*(sin(omega*i/500)/omega+l*sin(k*pi*a*i/(500*l))/(k*pi*a))...
/(k*pi*a/(omega*l)-omega*l/(k*pi*a))*sin(k*pi*x/l);
end
... |
function iv_out = iv(varargin)
% IV Interval datatype constructor
% Interval, or iv, data is one of the main datatypes. Each iv struct
% contains a set of intervals and accompanying information (in usr field).
% Many functions require or assume that the intervals are non-overlapping.
%
% function iv_out = IV([t... |
%{
# Thermal scenario set up function.
OUTPUT:
This function returns a structure with
* internal dissipation of each node
* solar irradiation on each node
* albedo irradiation on each node
* planetary IR irradiation on each node
All units are SI units.
This function can be used as a template when creating new sce... |
function [FeaturesVec] = featuresExtraction(OverlapLength,RawSamples,Fs )
FeaturesVec={};
for SampleInd=1:numel(RawSamples)
CurrRawData=RawSamples{SampleInd};
WindowLength_inSamples=(25e-3*Fs); %window length in samples;
%WindowLength_in_MS = WindowLength_inSamples/(10e-3*Fs); %window length in m... |
load medidas_transformador.mat
%
% a=0.10;
% b=0.15;
%
% k=((a-b)/(2*(a+b)))^2;
%
% perimetro_elipse=pi*((a+b)/4)*(3*(1+k)+1/(1-k))
plot(medidas_transformador(:,4));
grid on;
|
function keyList = benchKeyList()
% return a list of potentialy created KEYWORD by the bench.populateHeader
% This is usefull when copying a header from one to an other
% e.g. naomi.copyHeaderKeys(IFMData, ZtC, naomi.benchKeyList)
K = naomi.KEYS;
keyList = {K.XCENTER, K.YCENTER, K.XPSCALE,... % bench
... |
p_T3_av = sum(p_T3_ave.*dm)/m;
beta_TT = p_T3_av/p_T0;
T_T3_av = sum(T_T3_ave.*dm)/m;
deltaHis_TT = cp * T_T0 * (beta_TT ^ ((gamma - 1)/gamma)-1); % [J/kg]
eta_TT = deltaHis_TT / ( cp*(T_T3_av - T_T0) );
Yigv = (p_T0 - p_T1) ./ (p_T1 - p_1);
Yigv_av = sum(Yigv)/length(Yigv);
Yrot = (p_TR1 - p_... |
x=[0:.05:2*pi]
y=[0:.05:2*pi]
[xa,ya] = meshgrid(x,y)
cone1= 1.9106+(sin(-pi/2+xa)+sin(-pi/2+ya))*.6155
cone2= 1.9106+(sin(-pi/2+xa+.6666*pi)+sin(-pi/2+ya))*.6155
cone3= 1.9106+(sin(-pi/2+xa+1.3332*pi)+sin(-pi/2+ya))*.6155
cone4= 1.9106+(sin(-pi/2+xa)+sin(-pi/2+ya+.6666*pi))*.6155
cone5= 1.9106+(sin(-pi/2+xa+.6666*pi... |
%% Make sure you have added the path of ML_toolbox to your directory.
%
%addpath(genpath(./))
% You have to figure out the number of clusters present in the datasets by
% using different projection techniques
clear all; close all;
%% Generate Circle Data
num_samples = 1000;
dim_samples = 2;
num_classes = 2;
[X,labe... |
function [error_MSE, error_HAU] = symmetric_p2p(A,B)
% [error_MSE, error_HAU] = symmetric_p2p(A,B)
% compute the symmetric point-to-point metric using MSE and Hausdorff distance
% error_MSE : maximum error using Mean Squared Error
% error_HAU : maximum error using Hausdorff
% A,B : matrix to be compared where each row ... |
function dianyunalg()
global toprestore;
global toprenum;
global hObject1 handles1;
global runstat;
global showEnable;
global paravalue;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%算法参数配置%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
deltathrd = str2num(paravalue.alg.trianthreshold); % 三角形边长阈值,超过此阈值的三角形将被过滤掉
%%... |
MeanMagnetization = [];
Thermalcapacity = [];
spatialcorrelationlength=[];
temperature=[2:0.05:3];
% MonteCarlo loop
for T=2:0.05:3
[Ms, Es, CLs] = MonteCarloFunc(T);
% Record the results
MeanMagnetization = [MeanMagnetization mean(Ms)/(20^2)];
Thermalcapacity = [Thermalcapacity var(Es)/T^2];
spatialcorre... |
%%
% Data
X1 = 0:600; %showing off that it works even
X2 = 300:10:900; %if the lines are not all at the
X3 = 100:5:800; %same interval
Y1 = X1.^2./500000;
Y2 = .002.*X2;
Y3 = sind(X3);
%%
% Show off multiple sets of x-values
figure(1)
clf
%Create the plot and legend
hp = plot(X1,Y1, 'r--', X2, Y2,... |
D = 90.5*0.4814E-3;
S = 1.814;
q0 = 1.4155;
M = 0.9953;
v0 = 1.545 /48.888;
tspan = [0 100];
IC = [q0 v0];
opt = odeset('AbsTol',1E-4);
[t, Q] = ode45(@dqdtfn,tspan,IC,opt);
q = Q(:,1);
v = Q(:,2);
% Classically E would be (1/2)Mv^2 + U
% If that applies here, then:
E = 1/2*M*v.^2 + D*(1- exp(-S*(q-q0... |
SMBV = CSMBV;
Rec = CReceiver;
%соединение с SMBV
[Stat] = SMBV.SetConnection('192.168.1.22',5025);
if (Stat == 0)
error('Connection problem')
end
%сброс настроек SMBV в дефолтные, очистка лога ошибок
[Stat] = SMBV.Preset;
if (Stat == 0)
error('Error')
end
%запрос модели, серийного номера
[Stat, result] = SMBV... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ENGR 112 Sections 512 %
% Harland Ashby %
% Ahmad Al Kawam %
% 04/30/16 %
% Week 19 ... |
% function testCombination
%% Setup paths and load databases
addpath ../;
setPath;
basePath = '/nfs/hn01/jlalonde/results/colorStatistics/';
outputBasePath = '/nfs/hn01/jlalonde/status/colorStatistics/';
compiledResultsPath = fullfile(basePath, 'matchingEvaluation', 'compiledResults');
databasesPath = fullfile(basePa... |
clear
clc
close all
%%
filename = 'SSEDiff_3_29Aug2018';
filedir = 'C:\CommonData\TKM\Nafion117\';
fileloc = strcat(filedir,filename);
[ap,spec,spec2,spec3,spec4] = readTecmag4d(strcat(fileloc,'.tnt'));
spec3 = spec3(1:3,:,:);
tEcho = 200; %us
nEchoes = 512;
nPts = 16;
nPtsBlank = 0;
n2DExp = size(spec3,2); %CHECK F... |
load('CP_SynSim.mat')
nPairs = length(sub253_synPairs);
sub253 = figure;
for i=1:nPairs
subplot(nPairs,2,2*i-1)
bar(sub253_set1(:, sub253_synPairs(i, 1)));
subplot(nPairs, 2, 2*i)
bar(sub253_set2(:, sub253_synPairs(i, 2)));
end |
LEDSKY_RING=[0,2,5,9,14,20,27,35];
LEDSKY_SPOKE=[60 30 0 330 300 : -30 : 90];
FLAG_less = 0;
Range = [0 40];
Sel = LEDSKY_RING <= max(Range) & LEDSKY_RING >= min(Range);
SelLEDSKY_RING = LEDSKY_RING(Sel);
Rings = repmat(SelLEDSKY_RING,numel(LEDSKY_SPOKE),1);
Spokes = repmat(LEDSKY_SPOKE',1,numel(SelLEDSK... |
%Solve the f-subproblem and set g^k_f.
%% We define the procedure of solving the subproblem as a function:
function z_f = f_sub(A, b, sum_gh, xk, d,L,lamda,INV)
%% This is the main function to compute the f-subproblem. All the input arguments correspond to equation (28) in our written draft.
%method direct inve... |
% shows a polygon from the 'Points'
% 'optionalColor' is an integer in 1..64
function showPolygon(V, Points, optionalColor)
% optional
if nargin < 3 || isnan(optionalColor)
optionalColor = 55;
end
%\optional
checkSize('Points', Points, [2, NaN]);
checkSize('V', V, [1, 2]);
num =... |
figure;
screenDist = 36;
pixPerCm = 27.03;
eyePosPix = tools.deg2pix(XY_fixMid, screenDist, pixPerCm);
n = numel(imNames);
for ii = 1:100%n
if ii == 1 || ~strcmp(imNames{ii}, imNames{ii-1})
img = ica.loadImage(datadir, imNames{ii});
end
clf;
hold on;
colormap gray;
imagesc(img, 'X... |
curFolder = fileparts(mfilename('fullpath'));
%plotter = str2func('semilogx');
plotter = str2func('loglog');
%%%%%%%%%%%%%%%%%%%%%
%% 1. Rounding Time vs Dim
%subplot(1, 2, 1);
figure;
roundingTime(curFolder, plotter)
lgd = legend('BarrierRound', 'PolyRound', 'IsoRound', 'Location', 'northwest');
lgd.FontSize = 15;
... |
function T = parse_svg_transform( t_str )
pattern = '(scale|translate|rotate|skewX|skewY)\((-?(\d+\.\d*|\.\d+|\d+)(\s*[ ,]\s*)?){1,3}\)|(matrix)\((-?(\d+\.\d*|\.\d+|\d+)(\s*[ ,]\s*)?){6}\)';
[startIdx, endIdx, tokens] = regexp(t_str, pattern, 'start', 'end', 'tokens');
T = eye(3,3);
for ti = 1:numel(tokens)
... |
function run_btn_tuberculosis(object,event,h)
%RUN_BTN_TUBERCULOSIS Summary of this function goes here
% Detailed explanation goes here
listbox_layers = findobj_figure(h.figure,'Set Parameters','listbox');
layer = h.tuberculosis_layers(listbox_layers.Value);
h.tuberculosis_layers(listbox_layers.Value).result =... |
%% 2014.12.01 - 2017.01.31
clc; clear all;
month = [1,2,3,4,5,6,7,8,9,10,11,12];
year2015 = [1827, 1623, 2213, 1420, 1699, 1317, 1732, 2054, 2890, 892, 1624, 2112 ];
year2016 = [1517, 1131, 1483, 1398, 1305, 1345, 1698, 2231, 3494, 2073, 1962, 3294];
year2014_Dec = 1721; ... |
function [ index ] = loopThroughUntilIndexIsLLLessThenTolv2( tol, dataRange )
%have a data range with slope as second index
%loop though untill the slope is less then tolarance
[x,~]=size(dataRange(:,1));
index=round(x/2);
high=x;
low=1;
while(1)
index=ceil((high+low)/2);
if(index>=x)
inde... |
function roi_data = get_roi_data(experiment)
%==Get Df/f wrt ROIs=======================================================
% pass the experiment struct and hope the fields haven't been changed
n_rois = 1;
% Set the ROI and use it for the entire experiment
[r,c]=size(experiment(1).frames(1).image);
roi_frame_inds = 1:10... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.