text stringlengths 8 6.12M |
|---|
load('hall.mat')
tile_origin=hall_color(1:80,1:80,:);
tile_origin=int16(rgb2gray(tile_origin));%转换成灰度图像,并且转换成int支持正负数,16位防止溢出
tile_dct=dct2(tile_origin);%离散余弦变换
diff=zeros(80,80);
diff(1,1)=128*80;%变换域的亮度减小方法
tile_dct=tile_dct-diff;
tile_dct=idct2(tile_dct);
tile_directly = tile_origin-128;%直接原图像减小亮度
imshow(tile_direc... |
clc
clear all
close all hidden
cNum=40;%类的总数
%load yale_data %%5*5分块
load orl_data %%3*3
% load ar_light_data
%load ar_expre_data %ar人脸库共计50位男性,50为女性,每人26张,合计2600张
%load ar_zhedang_A_data
% load ar_zhedang_B_data
% load caslight1_data
% result1=zeros(13,13);
fperc=10;%每类的人脸数
% for a=1:5
n=3;
m=3;%分块... |
function [incidentDistance, reflectiveDistance, directAzimuth, incidentAzimuth, reflectiveAzimuth] = coordinate(directDistance, verticalDistance, horizontalDistance)
% Function:
% - obtain the AP-IRS (incident) and IRS-user (reflective) distance
%
% Input:
% - directDistance (d_D): AP-user dista... |
clear all
close all
clc
%syms x
x=0:10;
mu=trimf(x,[1,3,9]);
subplot(221)
plot(x,mu)
title ('triangular function')
if 0<mu<=0.5
mi=2*(mu.^2);
end
if 0.5<mu<=1
mi=1-(2*(1-mu).^2);
end
% if mu==0
% mi=0;
% end
subplot(222)
plot(x,mi)
title ('int triangular function')
if 0<mi<=0.5... |
1%MICROARRAY dataset
clear
close all
% load labels
load ref.txt
% load data
X = textread('nci.txt','','delimiter',' ');
X=X';
Labels=ref;
clear ref
% options
V_clases=[1 2 3 4 6 7 9 12]; % vector with selected classesVector de CLASES SELECCIONADAS
% that i... |
function rvpplot(rvp, p, clm)
% Standard deviation of Kalman vel&pos measurement noise plot.
%
% Prototype: rvpplot(rvp)
% Inputs: rvp - =[Zk(vel), Zk(pos), Var(vel], Var(pos), t]
% p - if rvp=[Zk(vel), Zk(pos), t], then p=[Var(vel], Var(pos), t]
%
% See also kfplot, inserrplot, kffile.
% Copyright(c) 2009-2... |
function [xs, xd] = subsample_lpf(x,Ts,Tss)
fs = 1/Ts;
fss = 1/Tss;
% Taking LPF over dft of signal
[~,X,~,~]=dft(x,fs);
X=lpf_freq(X,fss/2,fs);
[~,x]=idft(X,fs);
x=real(x);
% Ratio for sampling and subsampling
ratio = fs/fss;
% Subsampling
xs = downsample(x,ratio);
% Delta train representation
xd = upsample(xs,ra... |
function R = Iterative(nume, d, eps)
%citirea din fisier text, linie cu linie, dupa care construirea imediata
%a matricei de adiacenta A-fara duplicate.
f=fopen(nume,'rt');
N=fscanf(f,'%i',1);
A=zeros(N,N);
for i=1:N
c=fscanf(f,'%d',1);
k=fscanf(f,'%d',1);
s=fgets(f);
s=str2num(s);
fo... |
function varargout = A_TrousWT1(x,n)
% 1-D signals a trous wavelet transform
% @x: input sigals which can be a comlou vector or a matrix
% @n: scale
h = [1 4 6 4 1]/16;
y = x;
d = cell(n,1);
modeDWT = 'per';
for ii = 1:n
lf = length(h);
y = wextend('1D',modeDWT,y,lf/2);
t = conv2(y,h,'same');
if nargi... |
function [E,k,E_bar,k_bar,E_,k_] = NLD(pars)
%this models the coupled economic growth- environment quality dynamics Chen and Li 2011
% Based on difference equations 9 and 11.
% this is a John-Pecchenino model with habit formation of environmental
% quality and consumption tax
% intialize the parameters;
E0 = pars.E0;... |
function [Fs, z, dFsdUs, dFsdUds, dFsdkxynmukth] = ELDRYFRICT_WJ(us, z, uds, kxynmukth, N0)
%ELDRYFRICT_WJ returns the forces and jacobians of elastic dry
%friction for a whole joint formulation
%
% USAGE:
% ------
%
% INPUTS:
% -------
%
% OUTPUTS:
% --------
Np = size(us, 2);
Fs = zeros(6, Np);
dFsdUs = zeros(6... |
classdef tcpip_client < mtwisted.io.async.iobase
% a wrapper of matlab tcpip with async io
% Copyright 2016 Yulin Wu, University of Science and Technology of China
% mail4ywu@gmail.com/mail4ywu@icloud.com
properties (SetAccess = immutable)
ip
port
end
methods
function obj ... |
function s=grpsrdiffwavgraph(wavs,group,covariates,samprate,resamprate,alpha,outliers,patchlen,bw)
% graphs group1 vs group2
% and significance of difference for each 1 second interval
% usage: s=grpdiffwavgraph(wavs,group,samprate,resamprate,alpha,outliers,printts)
if nargin<4, samprate=62.5; end
if nargin<5, res... |
% File tema3_subpunctul_b.M
% Function: tema3_subpunctul_b
% Call: tema3_subpunctul_b(wb,ws,delta_b,delta_s)
% Pentru argumentele de intrare date in enuntul problemei, wb = banda
% de trecere, ws = banda de stopare, delta_b = toleranta maxima a
% abaterii in banda de trece... |
%% fni17, 8/26, 90:190
clearvars; home
mousename = 'FNI17'; fprintf(['\n====================',mousename,'====================\n'])
day = '150908';
filenumber = '001'; % corresponds to what mdf file?
imfilename = strcat(day, '_', filenumber);
% regFrameNums:
% if set to nonempty, noMotionTrs won't matter an... |
% this routine will load the previously saved .mat files, and compare the output of mixed MCMC and parallel tempering MCMC for the problem of 2D sinc likelihood
% Yiming Hu, Jan, 2013
%============================================================
load average.mat
%to read the variable times, as the total number of .mat ... |
% function description
% let the covariance of Sample be EYE
function new_samples = ICA_normalization(Sample)
% centering
mean_value = mean(Sample, 1);
% 1xn
Sample_centering = Sample - repmat(mean_value, size(Sample, 1), 1);
% whitening
cov_var_value = cov(Sample_centering);
% nxn
[V, D] = eig(cov_var_value);... |
function [remove_eul_P_B_ER, remove_eul_P_B_EL, remove_eul_P_I_ITip] = remove_exception_points(eul_P_B_ER, eul_P_B_EL, eul_P_I_ITip, rotm_T_ER_NTip,rotm_T_EL_PTip)
% Function: Remove the exceptional points from eul_P_B_ER, eul_P_B_EL, eul_P_I_ITip.
% Input: eul_P_B_ER, The position of the end flange of right hand in ba... |
%% Stelling 20
%
% Je kunt in Matlab vectoren van gelijke lengte niet met
% elkaar vermenigvuldigen.
%
Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
|
function [ A ] = pole_matrix_complex( p, N)
%Vandermonde matrix on the poles
%performs task of finding impulse responses components to horizon
%complex version, will have complex numbers
%p: set of poles in complex plane (must include conjugates)
%N: horizon, number of samples
%raise r to powers
% index_N = ones(1,N-... |
function loc = fun_loc(m,i,j)
%m是地图
%i,j是要判断点的坐标
if m(i+1,j)==5||m(i+1,j)==6
if m(i,j+1)==5||m(i,j+1)==6
loc=1;
else
loc=2;
end
else
if m(i,j+1)==5||m(i,j+1)==6
loc=3;
else
loc=4;
end
end
end
|
% a = 0.9;
% b = 0.9;
% c = 1/(a*b);
%fd=@(p) p(:,1).^2/a^2+p(:,2).^2/b^2+p(:,3).^2/c^2-1;
lambda = 0.8;
bfun = @(bvar) surface_A(bvar,lambda);
b = fzero(bfun,1);
a = lambda * b;
fd=@(p) (p(:,1).^2 + p(:,2).^2 + p(:,3).^2).^2 ...
- 2*a^2*(p(:,1).^2 - p(:,2).^2 - p(:,3).^2) ...
+ a^4 - b^4;... |
clear all
close all
clc
load mahal_distances
[~,~,auc_neighborhood] = find_roc_curve(mahaldist_neighborhood_TBI',...
mahaldist_neighborhood_NC');
[~,~,auc_diagonal] = find_roc_curve(mahaldist_diagonal_TBI',...
mahaldist_diagonal_NC');
mahals = [mahald... |
clear all
dd = '../dat/';
fd = '../fig/';
% synex
iptg = [0 750 1500 3000 30e3]; % nM
load([dd 'pixel_data.mat'])
for i = 1:4
xs{i} = double(synex.px{i})';
end
load([dd 'pixels_only_30um_2013_07_31.mat'])
xs{5} = double(synex.induced30um);
% native
iptg = [0 750 1500 3000 30e3 100e3]; % nM
load([dd 'pixel_data.mat... |
function run_all_so1(gNo)
% Run everything in sequence
%{
setNo is currently not used
Need to run:
gNo 9: baseline
gNo 6: wage earners
%}
% ------------------------------------
% setNo = 901;
% cS = const_so1(gNo, setNo);
% Make all directories for this set
if 0
output_so1.mkdir(gNo, setNo);
end
% Run Cps... |
load cactus_96frames
load result_cactus_d15
nel=1024*1024;
snr=zeros(1,32);
for ia=1:32
e=double(ar(:,:,ia+32)) -double(a(:,:,ia+32)); e=e.*e; e=sum(sum(e))/nel;
snr(ia)=20*log10(256/sqrt(e));
end
%=================================================================
%infile='cactus_intra26.yuv'; fid=fopen(infile);... |
function outputIm = TextureFlatten(destIm, imMask, threshold)
%TEXTUREFLATTEN Flattens image according to threshold using Poisson
%
% Parameters
% DESTIM: image to texture flatten
% THRESHOLD: threshold for edge detection
edgeImage = edge(rgb2gray(destIm),'canny',threshold);
[height, width, ~] = size(destIm)... |
function closeWindow(button,eventdata)
display Goodbye
close(h)
end
|
classdef test_MvnDist < UnitTest
% Test MvnDist
properties
rndData;
testModel;
end
methods
function obj = setup(obj)
obj.rndData = randn(100,10);
% Setup fixtures common to all test methods here.
% The target object is stored under obj.targetOb... |
%Problema 5 tema casa.
A = 1.5; % amplitudinea
T = 4;
F = 1 / T;
t = 0:0.002:12; % timpul de la 0 la 12 milisecunde cu rezolutie temporara de 2ms
%am ales ca t.ul sa mearga pana la 12 pentru a observa mai multe perioade
s = abs(A*sin(2*pi*F*t)); % folosim fucntia de modul pentru a transforma partea negativa a sin... |
% WP2DUTIL 2次元ウェーブレットパケットユーティリティ
% WP2DUTIL(OPTION,WIN_WPTOOL,IN3,IN4)
% Copyright 1995-2004 The MathWorks, Inc.
|
function varargout = AbelImg(imagein,center,varargin)
% This code takes an image, folds it to one quadrant, and calculates forward-Abel transform columnwise using the
% 1D algorithm 'Abel'. By default, it is assumed that the laser is
% polarized in 'x' direction (along a row vector)
% Input arguments:
% imagei... |
function [value] = rect(t)
%UNTITLED7 Summary of this function goes here
% Detailed explanation goes here
if abs(t)<=0.5
value=1;
else
value=0;
end
|
function plotShortestPaths(t, strainMatrix, nodeIDs)
%plotXY(xy, anchorNodes, truexy, bx, strainMatrix, kd, nodeIDs)
%
%this function will plot the points xy and the node ids if they are passed
if ~isfield(t, 'xyEstimate') t.xyEstimate = t.xy; end
if nargin<2 | isempty(strainMatrix) strainMatrix = zeros(size(t.xyEstim... |
classdef Quad_WalkingPlanParser
% parse the footstep_plan and walking plan, so that we can construct a
% ContactWrenchSetPlanner
properties(SetAccess = protected)
num_footsteps
footstep_contact_pos
support_times
footstep_support_interval % A 2 x num_footsteps matrix, the i'th footstep starts in su... |
function p = getAudapterParamSet()
p = struct;
paramNames = {'bShift', 'bTrack', 'bDetect', 'bWeight', 'bCepsLift', 'bRatioShift', ...
'bMelShift', 'bGainAdapt', 'bRMSClip', 'bBypassFmt', 'bPitchShift', ...
'bDownSampFilt', 'mute', 'sRate', 'frameLen', 'nDelay', 'nWin', ...
'nLPC', 'nFmts', 'nTracks', 'av... |
close all;
clear;
L=512;
n=0:(L-1);
Window=ones(1,L);
W1=pi*mod(10*max(8,5)/(11*(8+5)),1);
W2=mod(W1+pi/4,pi);
A1=1;
A2=0.75;
X=(A1*cos(W1*n)+A2*cos(W2*n)).*Window;
Xcorrelation = xcorr(X,'unbiased');
%1.1 corelation
figure1=figure('Name','Autosusxetish','NumberTitle','off');
plot((-100:99)*2*pi/200,fftshift(Xcorrelat... |
folder = '/tmp/abc/str/tt/';
k = 16;
Io = imread([folder 'out_' num2str(k) '.png']);
% Remove background
for i=1:size(Io,1)
for j=1:size(Io,2)
if ((Io(i,j,1)==241) & (Io(i,j,2)==255) & (Io(i,j,3)==255))
Io(i,j,1)=255; Io(i,j,2)=255; Io(i,j,3)=255;
end
if ((Io(i,j,1)==199) & (Io(i... |
classdef cameraSingleImage_template < handle
properties (Access = public)
referenceImage
fringeX
fringeY
wavenum
averaging = true
referenceType = 'staticReference'
end
properties (Access = private)
ySum = [];
wSum = [];
end
methods
function this = cameraSingleImage_template()
end
func... |
function c1 = c(t, d, m, mode)
if mode == 1
c1 = 2/(d^(3/2)*(t + 8)^(1/3));
elseif mode == 2
c1 = 2*sqrt(m)/(d^(3/2)*(t + 8)^(1/3));
elseif mode == 0
c1 = 2/(d^(1/2)*(t + 8)^(1/3));
end
end |
% Copyright (c) 2017, Amos Egel (KIT), Lorenzo Pattelli (LENS)
% Giacomo Mazzamuto (LENS)
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are met:
%
% * Redistributions of source ... |
function veinListProcess(veinList,xyList,imageout)
%veinList和xyList是有对应关系的
total=size(xyList,1);
%先通过距离找出main vein
xyList(:,5)=sqrt((xyList(:,1)-xyList(:,3)).^2+(xyList(:,2)-xyList(:,4)).^2);
[maxPosition,~]=find(xyList==max(xyList(:,5)));
[x,y]=find(veinList(:,:,maxPosition)==1);
main_vein_matrix=[x,y];
mainX=xyList(m... |
function Output = IDCT8x8(img)
O_1 = idct2(img(:,:,1));
O_2 = idct2(img(:,:,2));
O_3 = idct2(img(:,:,3));
Output = cat(3,O_1,O_2,O_3);
end
|
clc;clear;
load iv_static.mat;
load iv_switch.mat;
%% plotting static IV relationships
N=78;
figure(1); clf
subplot(2,1,1); hold on
plot(vs(7,:), is(7,:)*1000)
plot(vs(4,:), is(4,:)*1000)
plot(vs(8,:), is(8,:)*1000)
plot(vs(2,:), is(2,:)*1000)
plot(vs(6,:), is(6,:)*1000)
plot(vs(1,:), is(1,:)*1000)
hold off; grid ... |
% rand('seed', 1994);
% num_dots = 20;
num_dots = 10:5:200;
% num_dots = 200;
x_range = linspace(-1,1); % For y = x slope.
y_range = x_range; % For y = x slope.
%
% pos = [];
% neg = [];
%
% sz = 30;
% cp = 'red';
% cn = 'blue';
%
% for i=1:size(y,1)
% if y(i) == 1
% pos = [pos; x(i,1:2)]... |
clear all;
Img = imread('peppers.png');
Img1 = rgb2gray(Img);
f = mod(Img,128);
mask = Img>127;
for i = 1: 3
for j = 1: 3
if mask(i,j) == 1
f(i,j) = f(i,j) + 128;
end
end
end
subplot(1,3,1), imshow(Img);
subplot(1,3,2), imshow(Img1);
subplot(1,3,3), imhist(Img1);
|
%% addStat
% adds all pars and stats to allStat.mat for a specified entry
%%
function my_pet_st = addStat(my_pet, T, f)
% created 2023/01/27 by Bas Kooijman
%% Syntax
% my_pet_st = <addStat *addStat*> (my_pet, T, f)
%% Description
% gets model, MRE, SMSE, CLOMPLETE, author, date_subm, date_acc, all parameters and st... |
function MBONplotting(physdata,filtphysdata,savefigs)
samprate=10000;
fncontra=fieldnames(physdata.contra);
fnipsi=fieldnames(physdata.ipsi);
avgfilt={};
contrabases=[];
ipsibases=[];
contrass=[];
ipsiss=[];
contraoff=[];
ipsioff=[];
contrameans=[];
ipsimeans=[];
baselinevoltcontra=[];
pulserespcontra=[];
baselinevo... |
function mtlfade(infile,outfile)
% function mtlfade(infile,outfile)
if (nargin<2)
disp(['outfile not specified']);
return
end;
[comment1, filetype, info_blocks,...
n_channels, day_of_date, month_of_date, year_of_date,...
no_bl_per_chan, subject_no, ...
subject_first_name, subject_las... |
% Модуль Юнга Н/м2
E = 1000000;
% Площадь поперечного сечения стержня м2
A = 0.001;
% Погонная масса кг/м
mu = 10.0;
% Длина стержня м
L = 1.0;
% Масса стержня
M = L*mu;
% Количество материальных точек, на которые разбивается стержень
N = 30;
% Начальное расстояние между точками (l0)
p.L = L/N;
% Масса материаль... |
function [pno_repeat, Enunique, Enreps]= repeat_model(N0,q)
probi(1)=1;
for i = 2:N0
probi(i) = ((q-i+1)./q);
end
pno_repeat = prod(probi);
Enreps = N0*(1-((1-1/q).^(N0-1)));
Enunique = N0*((1-(1/q)).^(N0-1));
end |
%{
# subject.Death
-> subject.Subject
-----
death_date: date # death date
%}
classdef Death < dj.Manual
end |
i=0;
m=10;
if m>i
disp(i);
i=i+1;
else
enddiary off
|
%Sinir Agi olusturma ve egitilmesi
function[vcikti,vld_hedef] = siniragi2(n1,n2,loran, training_oran)
%input= sensor degerleri
%output=hastalik durumlari
%training_oran=Verilerin yuzde kacinin training icin kullanilacagini belirleme orani.
%Girdiyi ve ciktilarini training ve validation olarak ayir
%NN olusturup t... |
function [ match ] = location_match( lat, long, latTable, longTable )
%LOCATION_MATCH finds the indices in latTable/longTable that matches the
%given lat/long values.
% If a match cannot be found within the initial tolerance it is repeated
% with the tolerance doubling each time.
% If multiple matches are found the mo... |
function [imgout] = imbbox(im, bb, opt)
%--------------------------------------------------------------------------
%
% Copyright (c) 2011 Jeffrey Byrne
%
%--------------------------------------------------------------------------
%% Options
if ~exist('opt','var')
opt.linewidth = 2;
opt.linecolor = [0 1 0];
end... |
%% Control Panel
epsilon = 0;
Nt = 500;
dt = 0.01/5;
A = -1;
%% Other Setup
it_save = Nt/50;
Nsave = Nt/it_save+1;
%% Load signed distance function and mesh information
load('signed_dist_star.mat')
Phi_prev = Phi_0;
Phi = zeros(length(xm),length(ym),Nsave);
Phi(:,:,1) = Phi_0;
nsave = 2;
%% Iterate in time to calcula... |
function handle=imshu8(im)
im=double(im);
handle=figure,imshow(uint8(255*im/max(im(:)))),axis on |
function PROTEINS_STRUC = backbone(xyzfile, backbone_atoms)
% $Rev: 584 $
% $Author: maxim $
% $Date: 2014-08-30 10:27:47 +0400 (Sat, 30 Aug 2014) $
% Get x, y, z coordinates from input .xyz file:
backbone_crd = backbone_xyz(backbone_atoms, xyzfile);
numIons = size(backbone_crd,1);
min_value = min(backbone_c... |
function compare_results(indcs, opt)
params = opt.objective_data;
fs = fieldnames(indcs);
alin = @(x,y) strjust(sprintf(x, y), 'center');
fprintf(alin('%15s', 'Indices'));
fprintf('\n');
fmt = '| %5.3f %5.3f ';
for ii=1:length(fs)
fprintf(alin('%15s', fs{ii}));
... |
%Labels:
%B0 --> magnetic field
%Rpll ---> log to the base 10 of the z-axis rotational diffusion rate, 1/second
%ksym ---> sqrt(kA*kB) symmetrized exchange rate between conformations A and B0
%spec_mat ---> resulting Sc- spectrum in 2D complex format
%angle2 ---> jump angle: assuming that jump occurs from \gamma_d = 0... |
function statsExternalSelectFile(src,~,~,window)
% statsExternalSelectFile - launch dialog to select a file containing the
% external test set samples
% Define the default location
defP = '/Users/jmckenzi/Dropbox/Imperial/Projects/REIMS Laser/Test Set/';
if ~exist(defP,'dir')
defP = pwd;
end
% Ask user for file..... |
function voi = createEmptyImageFromContour(contour, pixelSpacingX, pixelSpacingY, pixelSpacingZ)
%CREATEEMPTYIMAGEFROMCONTOUR creates an VolumeOfInterest object using the data in Contour and
% prefered pixel spacing
%
% voi = createImageFromContour(contour, pixelSpacingX, pixelSpacingY, pixelSpacingZ)
% this is a h... |
function [x,S] = update_step(landmarkID,z,x,S,map, Q)
%@param:
% map : location of all landmarks
% z : known range and bearings
% x,S : the current estimate of the robot.
% Q : the covariance of the measurements
%@return... |
addpath('../');
%% parameters
M = 1.096;
m = 0.109;
b = 0.1;
l = 0.25;
% I = 0.0034;
I = 1/3*m*l^2;
g = 9.80;
%% use a
A2 = [0 1 0 0;
0 0 0 0
0 0 0 1
0 0 m*g*l/(I + m*l^2) 0];
B2 = [0
1
0
m*l/(I+m*l^2)];
C2 = [1 0 0 0
0 0 1 0];
D2 = [0
0];
[num, den] = ss2tf(A2,B2,C2,D2);
% printsys(num,... |
BCovert=csv2struct('RTData_48.csv');
BOvert=csv2struct('RTData_47.csv');
BBBOvert=csv2struct('RTData_57.csv');
angles=unique(BCovert.Angle)
for i = 1:length(angles)
ind=find(BCovert.Angle==angles(i));
meanRTCovert(i)=mean(BCovert.ReactionTime(ind));
end
plot(1000*meanRTCovert,angles,'-o')
x... |
% can I decode choice by the HP FR during certain parts of the theta cycle
% yes
% indinds = [0 .06];
% indinds2 = [-.07 -.01];
indinds = [-.06 0];
indinds2 = [-.12 -.06];
numshuff = 50;
tit = 'Mean.2_WithinCycle';
cd(dirs.homedir)
accd = []; A = []; AS = [];
d2 = dir('*.mat');
for id = 1:size(d2,1)
... |
function weird_num = weird_map(num)
LSB = sign(num);
bits = dec2bin( abs(num) );
SGN = bits(end);
bits = [bits(1:end-1), dec2bin((-LSB + 1)/2)];
weird_num = bin2dec(bits) * (-1)^(num2str(SGN));
end |
function y = swingUp(X)
x = X(1);
phi = X(3);
dphi = X(4);
eps = 1e-5;
m = 0.109;
l = 0.25;
I = 1/3*m*l^2;% 0.0034;
g = 9.80;
umax = 0.1 * g;
if(abs(cos(phi)) < eps || abs(dphi) < eps)
y = 0;
else
y = ( - sign((1/2*(I + m * l^2)*dphi^2+m*g*l*(cos(phi)-1))*dphi*cos(phi))) * umax;
if(sign(y * x) > 0)
... |
function [d, history] = Untitled(A, b, p,mu, rho0, alpha)
% solves the following problem via ADMM:%
% minimize E_D(d(k);f_f,f_m)+lamda*eta*||Z||_2,1
% s.t. D(k)=Z;
% where A is a feature matrix and b is a response vector. The scalar m is
% the number of examples in the matrix A.
% ==========================... |
load trainedModel;
% mealData1.csv/Nomeal1.csv/mealData1Test.csv
% filename = input('Enter CSV filename to test the model: ', 's');
testData = readmatrix("TestData.csv");
%Preprocessing the testData
testData_cleaned=testData(:,1:30);
testData_cleaned = fillmissing(testData_cleaned,'linear',1);
% Create Feature Matrix... |
function showImage(image)
figure;
imshow(image); |
function [ gd, t, t_index ] = gr_dev( tm )
% Returns the greatest deviation between actual and requested speeds and the elapsed time when this event occurred
% results figured as max(abs(actual_speed-requested_speed))
absDeviation = abs(tm.spd_act-tm.spd_req); % absolute deviation
[ gd, t_index ] = max( absDeviation ... |
function [ B ] = IDFTmatrix( N )
%UNTITLED9 Summary of this function goes here
% Detailed explanation goes here
j = sqrt(-1);
B = zeros(N,N);
for n = 1:N
for k = 1:N
B(n,k) = (1/N)*exp((j*2*pi*(k-1)*(n-1))/N);
end
end
end
|
function Grf_heel_c4 = Grf_heel_c4(in1,in2,Fx)
%GRF_HEEL_C4
% GRF_HEEL_C4 = GRF_HEEL_C4(IN1,IN2,FX)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 06-Jul-2020 22:18:29
q1 = in1(:,1);
q2 = in1(:,2);
q3 = in1(:,3);
q4 = in1(:,4);
q5 = in1(:,5);
q6 = in1(:,6);
qd1 = in2(:,1);
qd2 = in... |
% Sync audio and neural data. TTL pulses embedded in silent sound files
% (generated by my code, generate_silent_playback_files_with_TTL_pulses.m)
% were sent to both the Avisoft recorder and the Neurologger, and the
% common times of the pulses are used for syncing. 1/5/2017 Wujie Zhang
%%
session_folder='H:\Wuji... |
function [Hdr, Inst, Cfg, Sensor, Gps, Wt, Bt, Nmea, Gps2, Surface, AutoMode]=readpd0rrss(fullName,varargin)
% Read RDI PD0 File Format (WinRiver)
% The function reads the RDI PD0 format raw data as recorded by WinRiver.
% It accounts for the special locations used by WinRiver to store GPS data.
% It should read standa... |
function [ phi ] = LimiterMinmod( a,b )
% Minmod Limiter
N=length(a);
N1=length(b);
if N~=N1
error('Dimension Error!');
end
phi=zeros(1,N);
for i=1:N
flag=a(i)*b(i);
if flag<=0
phi(i)=0;
else
phi(i)=sign(a(i))*min(abs(a(i)),abs(b(i)));
end
end
end
|
function epoch_anova_summary_fig = epoch_anova_barchart( mfs, drug, current, paradigm )
if nargin < 1, load master_file_struct; mfs = master_file_struct; end
if strcmp( paradigm, 'Attention' )
epoch_list = {'attend_fixation_stats', 'attend_visual_stats', 'attend_attend_stats', ...
... |
nlist == [num]
nlist2 == [num]
pol1 = [1,2,3,4]|| 4x^3 + 3x^2 + 2x + 1
pol2 = [5,0,3]|| 3x²+5
||Function that evaluates a Polynomial, Horners Rule
polev :: (nlist, num) -> num
polev ([], num) = 0
polev ( front : rest, num ) = front + polev (rest, num)*num
||Evaluation of a derivate of a Polynomial
dpoli :: (nlist, n... |
function varargout = get(t,varargin)
%GET Get WDECTREE object field contents.
% [FieldValue1,FieldValue2, ...] = ...
% GET(T,'FieldName1','FieldName2', ...) returns
% the contents of the specified fields for the WDECTREE
% object T.
% For the fields, which are objects or structures, you
% may get subfie... |
<<<<<<< HEAD
%MATLAB_PRACTICE CHAPTER5_b
%% cell-1
A=cell(2,3);
A{1,3}=1:3;
A{2:2}='string';
%% cell-2
A=[1 2 3 4;5 6 7 8;9 10 11 12];
C={A sum(A) sum(sum(A))};
D(1,1)={A};
D(2,1)={sum(A)};
D(2,2)={sum(sum(A))};
%% cell-3
clear,clc
C(1)={[1 2 3]};
C(2)={[1 0 0]};
C(3)={[0 1 0]};
C(4)={[0 0 1]};
C(5)={[1 0 1]};
C(6)=... |
function [image_roidb, bbox_means, bbox_stds] = fast_rcnn_prepare_image_roidb(conf, imdbs, roidbs, bbox_means, bbox_stds)
% [image_roidb, bbox_means, bbox_stds] = fast_rcnn_prepare_image_roidb(conf, imdbs, roidbs, cache_img, bbox_means, bbox_stds)
% Gather useful information from imdb and roidb
% pre-calculate mean... |
% DISPLAY LAURMATオブジェクトに対する関数を表示
% M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 29-Mar-2001.
% Last Revision 12-Jun-2003.
% Copyright 1995-2004 The MathWorks, Inc.
|
function span = spans(knot, order, open)
span = find(knot(1:(end-1)) < knot(2:end));
span = span(span >= order & span <= length(knot) - order);
if ~open
span = [span length(knot) - order + 1];
end |
function vp = klattice(nx, ny, a, type)
% generates the position for the CO molecules to form a hexagonal or
% triangular lattice.
% input: nx,ny = number of retangular unit cells
% a = unit cell lattice constant
% type = 1 => honeycomb (CO in triangular lattice)
% type = 2 => triangular (... |
function [file] = CT_ExptList_v6()
%% File Description
% Generates a GUI for selecting worm tracks for anaylsis by Manual_WormTracks.m
%
% Import variables from the Index sheet
%
% Version 6.0
% Version Date: 12/2/19
%
%% Revision History
% ~2017 Generated by ASB
% 8-27-19 Cleaned up and updated ... |
function [ y ] = reaction( U , V , t )
%UNTITLED3 Summary of this function goes here
% This is the reaction term for U (Put in any function) time based
a = -2;
o = size(U);
I = zeros(o);
if ( t < 6 )
for i = 1 : 10
I(i) = 1;
end
end
% y = U.*(1-U).*(U-a) + U - 4*V + I;\
y... |
function mat = twoDct_quantize(x, Ks)
Q = [16 11 10 16 24 40 51 61; 12 12 14 19 26 58 60 55; 14 13 16 24 40 57 69 56; ...
14 17 22 29 51 87 80 62; 18 22 37 56 68 109 103 77; 24 36 55 64 81 104 113 92; ...
49 64 78 87 103 121 120 101; 72 92 95 98 112 100 103 99];
[N,~] = size(x);
mat = [];
for a ... |
%根据数据生成初始的hmm矩阵
%初始转移矩阵为呈指数梯度下降矩阵,初始状态全为1
%将样本截成长度相同的段构建状态的混合高斯模型
%其中,A为转移矩阵,B为观测到状态的概率分布,即高斯模型,pi为初始向量
function [hmm] = initHmm (data, S)
hmm.N = S;
%构建初始状态向量
hmm.pi = zeros (1, S);
hmm.pi(1) = 1;
%构建初始转移矩阵
for i = (1 : S)
hmm.A(i,i) = 1;
for j = (i + 1 : S)
hmm.A(i,j) = hmm.A(i,j - 1) * 0.5; %转移到下个... |
function [bestW, best_filters_g, best_filters_h, bestD, bestX, errors, time] = wdla(Y, n, m, k0, filters_g, filters_h)
%W-DLA - Wavelet-like Dictionary Learning -
% A proof of concept implementation of the W-DLA. This implementation is
% optimized for clarity, not performance. See the paper for the details.
%
% [W, fil... |
function map = mapToDictionary(I, dictionary)
% function map = mapToDictionary(I, dictionary)
%
% I is column stacked images, basically formatted to work with pdist2
% mapToDictionary maps INPUT image I to INPUT dictionary using the L2
% distance. pdist2 is part of the Piotr Dollar MATLAB toolbox.
%
% CREDITS
% Wri... |
function [return_carry,return_sum] = comp(x1,x2)
return_sum = xor(x1,x2);
return_carry = and(x1,x2);
end
|
function [shape] = B2Shape(obj,b)
%B2Shape Summary of this function goes here
% Detailed explanation goes here
l = b(1:obj.n_l);
f = b(obj.n_l+1:obj.n_l+obj.n_f);
r = b(obj.n_l+obj.n_f+1:end);
shape = obj.R2Shape(r);
shape = obj.ApplyF(f,shape);
shape = obj.ApplyL(l,shape);
end
|
clc;
clear all;
SourceFolder='C:\Users\Pouya\Documents\MATLAB\DECAF\Data\Stimuli\Videos-DEAP-all\';
%% Audio Signal & EEG signal
listing = dir(SourceFolder);
listing = {listing.name};
listing = listing(3:end);
for i=1:40
disp(i)
signal = audioread(char(strcat(SourceFolder,listing{i})));
... |
%% Predict Rihanon's data
num_channels= 15;
% y is the threshold map
y= Thresholds;
% bias mean is the bias map{0/1}
bias_mean= bias;
trials= 56;
for channels = 1:num_channels
for operation_inv= 1:size(top_position,2) %:size(test_data,2) %top
ch= channels-1;
for i= 1... |
m = randi([1 20]);
n = randi([1 20]);
if(m==n)
m=m+1;
end
A = rand(m,n);
C = A'*A;
B = A*A';
%Determinante
detC = det(C)
detB = det(B)
%Traza
traceC = trace(C)
traceB = trace(B)
[vectoresC,valoresC] = eig(C);
[vectoresB,valoresB] = eig(B);
%Vectores propios
vectoresC
vectoresB
%Valores propios
valsC = diag(va... |
function out=frr_far_err(inside_class,outside_class)
NGRA = length(inside_class);%类内测试
NIRA = length(outside_class);%类间测试
FRR = [];
FAR = [];
th = 0.6:0.01:1;
for i = 1:length(th)
frr = sum(inside_class>th(i))/NGRA;
FRR=[FRR frr];
far = sum(outside_class<th(i))/NIRA;
FAR = [... |
function D = extractModelFeatures(trial,t_range)
if nargin < 2
t_range = 1:length(trial.interp.t);
end
pos = extractTrialState(trial, 'X_i',t_range);
pos = pos(3,:);
vel_world = extractTrialState(trial, 'X_dot_i',t_range);
vel = zeros(size(vel_world));
acc = extractTrialState(trial, 'X_ddot_i',t_range);... |
%% Opdracht 4
% Maak een function genaamd opdracht_4.
% In deze opdracht maak je enkel gebruik van operatoren en een
% if-statement (geen else-statement).
%
% Geef deze functie de volgende inputs:
% Gastronemicus, RectusFemoris, Brachialis
%
% Als de Gastronemicus gelijk is aan 0 of 1 moet de output van de functie
% al... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.