text stringlengths 8 6.12M |
|---|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Gibbs Sampling for Gaussian Mixture Model
% Jie Yang 2015
%
% Note: All parameters named by My_** are
% parameters to be iterated/optimized
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function GMM_MCMC()
load('data.mat')
n_obs=size(X,2);
n_dim=... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Functia calculeaza valoarea numarul %
% polinoamelor formate de matricea %
% tridiagonala. %
% %
% %
% GE... |
%% Generate NIFTI
clear;
% load the coordinates
data = load_nii('ribbon01_funcRes+orig.nii.gz');
% load IJK
load('/Users/lcnl/Documents/MATLAB/JLP/data/jlp01.mat', 'IJK');
%% write to nifti file
writeNIFTI('testing.nii',[64,64,30],IJK, 1, data.hdr, 'fix'); |
% 7/30/13
% findContConstraints.m
% interate again through the desired position matrix
% construct constraints to ensure continuous connections between trajectories
% where positions or dervatives aren't fixed
% these constraints are of the form x_j^(i)-x_j+1^(i) = 0, where i is any
% derivative and j is any piece ... |
function ROIName=GetROIName(structAxialROI)
ROIName=[];
for i=1:length(structAxialROI)
ROIName=[ROIName; {structAxialROI(i).name}];
end
|
function q6(seq)
seq = num2str(seq);
seq = seq-'0'
[~,n] = size(seq);
for i=(2:n-1) %changing the length of the sequences
buffer = zeros(n-i+1,i);
for j=(1:n-i+1) %Number of sequences with length i possible
buffer(j,:) = seq(j:j+i-1);
end
[unique_rows,~,ind] = unique(buffer,'... |
function unew = smoothStep(u, f, h)
% u and unew are stored in a nh by nh matrix
dim = size(u);
nh = dim(1);
unew = u;
for i = 1:nh;
for j = 1:nh;
if( i > 1 );
a = unew(i-1, j);
else
a = 0;
end;
if( i < nh );
b = unew(i+... |
function proll = nmat2proll(nmat, dt)
% function proll = nmat2proll(nmat, dt)
%
% NMAT2PROLL converts note matrix 'nmat' (MIDI matrix) to binary piano-roll
% matrix 'proll' given time resolution 'dt'.
%
% Inputs
% nmat note matrix
% dt length of time frame in seconds
%
% Outputs
% proll binary piano-ro... |
function str = design(str)
% This function allows an interactive design of AWG layout.
% SF, January 31, 2006
str = update(str); %fixed parameter update
str = loop(str); %tweaking three main variables
awgsave(str); % save AWG design in an associated .mat file
|
clc;clear;close all;
InputImage=imread('graylizard_downsample.bmp');
figure(1)
imshow(InputImage);
title('Input Image');
t = cputime;
%InputImage=rgb2gray(InputImage); %not necessary for tif
row=size(InputImage,1);
col=size(InputImage,2);
channel=size(InputImage,3);
% OutputImage_2=uint8(zeros(row/2,col/2,channel)... |
clc
clear
close all
%%%%%%%声明几个全局变量方便使用
cdfFile = '19980204_224024_ANTSTEP.CDF';
Range = 17;
cdfFile_t = cdfFile;
if length(cdfFile_t)>17
cdfFile_t(17:27)=[];
else
cdfFile_t(4:7)=[];
end
matFile = [cdfFile_t,'IPIX.mat']; |
classdef CHP83732A < instrument.CGPIB
%CHP83732A 此处显示有关此类的摘要
% 此处显示详细说明
properties
end
methods
function obj = CHP83732A(address,varargin)%第二个参数是初始化模式
obj = obj@instrument.CGPIB(address);
if(nargin==1)
obj.rst();
... |
function quality=check_head(M, rect, frame_num)
%quality=check_head(M, rect, frame_num)
% Check the ratio of depth around the head box and inside
% Isabelle Guyon -- isabelle@clopinet.com -- February 2012
IM=M(frame_num).cdata;
IM(IM==0)=255;
x=round(rect(1));
y=round(rect(2));
w=round(rect(3)/2);
h=round(rect(4)/... |
function obs = dynamic_obs(dyn_obs,t)
[~,id] = min(abs(t-dyn_obs(:,1)));
obs = dyn_obs(id,2:end);
end
|
% VX_stretch_real_pv.m
% ========== This program performs time stretching
%=========== using the FFT-IFFT approach, for real ratios
clear;clf;
%------ user data ----------
n1 = 200; %analysis step
n2 = 512; %analysis step
s_win = 2048;
[DAFX_in,FS] = audioread('la.wav');
%-------- initialize windows, arrays, etc ---... |
function evaluer( funksjon, a, b, n )
h = (b-a) / n;
for x = a:h:b
funksjon(x);
end
end
|
% 可视化聚类
type centerHSV.txt
type ColorHSV.txt
fileID = fopen('centerHSV.txt','r');
fileID2 = fopen('ColorHSV.txt','r');
formatSpec = '%f,%f,%f';
formatSpec2 = '%f %f %f';
size_imgArray = [3 Inf];
imgArray = fscanf(fileID,formatSpec,size_imgArray);
imgArray2 = fscanf(fileID2,formatSpec2,size_imgArray);
fclose(fileID); ... |
%---------------------------------------------------------------------
% pcontaindemo1
%
% Demonstration of PCONTAIN function for proving set containments
% using SOS optimizations. The example uses PCONTAIN to maximize
% the size of a circle inside the contour of a 6th degree polynomial.
% See PCONTAIN help for more ... |
% c8truck_ac.m
%
% Class 8 Truck Air Condition
%
% the mechanical power required by the air condition in W given
% engine mechanical shaft speed in rad/s and air compressor load fraction (0.0 [no load] --> 1.0 [full load]
%
% DESCRIPTION:
% This file defines the accessory loading of componentry on a heavy class 8 truc... |
%% movie generation for EA2019-Oct
% by Hideki Kawahaaraa
% 29/Oct./2019
clear variables
close all
fs = 44100;
fftl = 32768 * 64;
rng(13214)
pdiv = 2;
fdiv_av = 3;%13;
baseIdx = 1:fftl;
centerIdx = fftl / 2 + (-4:4);
fringeIdx = baseIdx((baseIdx < fftl / 2 - 4 & baseIdx > fftl / 2 - 10) ...
| (baseIdx > fftl / 2... |
function fig = plotMeanSlowWaves(snips,varargin)
%% PLOTMEANSLOWWAVES Plot average of slow oscillations (<= 5 Hz)
%
% fig = PLOTMEANSLOWWAVES(snips);
% fig = PLOTMEANSLOWWAVES(snips,'NAME',value,...);
%
% --------
% INPUTS
% --------
% snips : Table from GETTRIALWAVEFORMS.
%
% varargin : (Op... |
function image = customReaderImage2(location)
% keep location info
image = struct('image', imread(location), 'location', location);
end |
function FigtoImg(directory,type)
%This function turns every .fig file in directory into an image
%file with extension type using export_fig
tmp = dir(directory);
for f=3:length(tmp)
fname = [directory tmp(f).name];
if (strcmp(fname((end-3):end),'.fig'))
outname = [fname(1:(end-3)) type];
if (e... |
function gij = mth_oblsph_mt_cov(a, b, eta, lambda)
% MTH_OBLSPH_MT_COV computes the covariant matric tensor g_i_j of the
% oblate spheroidal coordinate system.
%
%-----------------------------------------------------------------------
% Copyright 2017 Kurt Motekew
%
% This Source Code Form is subject to the terms of t... |
function [KM] = KernelMatrix(TrainMatrix,Sigma)
[Rows,Columns] = size(TrainMatrix);
KM = zeros(Rows,Rows);
for i=1:Rows
for j=1:Rows
s = TrainMatrix(i,:) - TrainMatrix(j,:);
t = norm(s);
KM(i,j) = exp(-(t^2)/(Sigma^2));
end
end
|
%{
_______________________________________________________
#####################################################
SIMULACION PROYECTO DE GRADO CASOS COVID-19
EMPLEANDO METODO DMD
_____________________________________________________
##############... |
cd('C:\Users\fabio\github\wearable-jacket\matlab\WISE_KNT')
ThMean_Cmap = colormap(gca);
save('ThMean_Cmap','ThMean_Cmap'); |
function out_pic = decrese_size(img,row,col)
% [row, col] = size (img);
fil = ones(3,3);
fil = fil/9;
b = imfilter(img,fil,'replicate');
out_pic(:,:) = b(1:2:row,1:2:col);
out_pic = floor(out_pic);
end |
% Convolves a spike train with a Gaussian of the given standard deviation.
function rslt = spike_density( spikes, StDevInMS )
if nargin < 2
StDevInMS = 100; %Default standard deviation = 100ms;
end
SamplesPerMS = 1;
NumberOfStDevs = 3;
WindowSize = StDevInMS * SamplesPerMS * NumberOfSt... |
format short
X = imread('img14sp.tif');
X = double(X);
Y = imread('img14g.tif');
Y = double(Y);
[sizeX sizeY] = size(X);
numR = floor((sizeY - 3*2)/20);
numC = floor((sizeX - 3*2)/20);
Z = zeros(numR*numC,49);
Y1 = zeros(numR*numC,1);
for i = 1:numC
for j = 1:numR
Z((i-1)*numR + j,:... |
function [ numAnno,group ] = mtspNumAnnoGet
%mtspNumAnnoGet - determine the number of annotations
% Where?
%locn = '/Volumes/JSM/DB/Metaspace/EngineDumpOLD/MTSP-Merge/Neg/Breast/';
locn = '/Volumes/JSM/DB/Metaspace/EngineDumpNEW/Merge/Breast/';
% Find all of the mat files in this place
allF = fileFinderAll(locn,'mat'... |
name=('test2');
I=imread([name,'.tif']);
figure,
subplot(2,2,1),imshow(I);title([name,'原图']);
[sx,sy]=size(I);
sigma=1.5;
for N=1:3; %大小是(2N+1)×(2N+1)
N_row = 2*N+1;
GausFilter = fspecial('gaussian',[N_row N_row],sigma);
I_AftGau=imfilter(I,GausFilter,'conv');
subplot(2,2,2),imshow(I_AftGau);title(... |
clear all
xl=[-0.04,-0.0001];
for ind=1:2
loops=1
D=0.7e-10;
theta=[0.1:0.1:2*pi]';
M=length(theta);
[k,T,eta,Dtg,petriR,polyR,PDt,PDr,bndclsn,pcolsn,rad,azi,eli,msd]=initialisevariables(M,loops);
[kpmpc,kpeo,theta_0,phi_0]=initialisevariables2;
mupeo=-5e-9;
mupmpc=0;
i=200;
timeiter=i;
t=0.005;
tau0=t.*loops;
x=xl(ind... |
%find Maximum Accuracy
%% distance
% accuracyNo.mat 65.0712 epoch 0.12 to 0.39
% accuracyNormal.mat/NormalD/NormalD1 67.6424 epoch 0.65 to 0.88
%% similarities
%
%
fasai = load('accuracyEuclidean/accuracy100Normalswap.mat');
kao=load('accuracyEuclidean/accuracy100Normal.mat');
fasai2=load('accuracyEuclidean/accurac... |
function setGraphicsDefaults
set(0,'DefaultAxesFontName','Arial', ...
'DefaultAxesFontSize', 12,...
'DefaultAxesFontSize', 12,...
'DefaultAxesPlotBoxAspectRatio',[1 1 1],...
'DefaultAxesPlotBoxAspectRatioMode','manual',...
'DefaultAxesXGrid','on',...
'DefaultAxesYGrid','on'...
)
|
function [S, e, t, x,U] = manopt_nearest_stable_real_generic(M, fun, maxiter, timemax, x0)
% Compute the nearest (real) Omega-stable matrix to a real matrix A (or at least a local minimum)
%
% [B, e, t, Q, U] = manopt_nearest_stable_real(A, fun, maxiter, timemax, x0)
%
% B = arg min_{X stable} ||X-A||_F
%
% B has quas... |
%% E3632A for Peak AMP
DCPowerSupplyObject_2 = visa('agilent','ASRL5::INSTR');
fopen(DCPowerSupplyObject_2);
fprintf(DCPowerSupplyObject_2,'SYSTem:LOCal');
pause(0.1);
fprintf(DCPowerSupplyObject_2,'*RCL 1');
pause(0.1);
fprintf(DCPowerSupplyObject_2,'SYSTem:REMote');
pause(0.1);
fprintf(DCPowerSupplyObject_2,'OUTP OFF... |
%% Load in MNIST data
[trainImage,trainNum] = readMNIST('train-images-idx3-ubyte','train-labels-idx1-ubyte',60000,0);
[testImage,testNum] = readMNIST('t10k-images-idx3-ubyte','t10k-labels-idx1-ubyte',10000,0);
trainImage = reshape(trainImage,[28,28,1,60000]);
testImage = reshape(testImage,[28,28,1,10000]);
trainNu... |
% GoovaertsChap5_kt : Goovaerts Example : Chapter 5 Kriging With A Trend
dwd=[mgstat_dir,filesep,'examples',filesep,'data',filesep,'jura',filesep];
[pdata,pheader]=read_eas([dwd,'prediction.dat']);
[data,header]=read_eas([dwd,'transect.dat']);
x=data(:,1);
Cd=data(:,4);
% find data
id=find(Cd~=-99);
x_obs=x(id);
Cd_o... |
% xDD_base [6x1]
% second time derivative of r_base and phi_base
|
% Runs experiment on convergence of swap chains with original and Rasch input
%
% Copyright (c) 2014 Aleksi Kallio
if ~exist('loadedDataVersion', 'var')
load('datasets.mat')
end
M=datas{1};
nOrig = 10;
nRasch = 10;
nSteps = 200;
nSwaps = 10;
cc = zeros(nOrig + nRasch, nSteps);
oc = count_correlations(M);
O... |
function demo_fast_sc(opt_choice)
% opt_choice = 1: use epslion-L1 penalty
% opt_choice = 2: use L1 penalty
if ~exist('opt_choice', 'var')
opt_choice = 1;
end
% natural image data
load ../image_set_descriptor.mat;
X = image_set_descriptor;
X = X(1:128,:);
% sparse coding parameters
num_bases = 128;
beta = 0.4;
b... |
function [y] = Graficauno(input1, input2)
load('Datos.mat');
America=0;
AsiaAustralia=0;
Europa=0;
Africa=0;
for c=1:1:5
America = America + VentasAnuales(c,6);
end
for c=6:1:12
AsiaAustralia = AsiaAustralia + VentasAnuales(c,6);
end
for c=13:1:19
Europa = Europa + VentasAnuales(c,6);
end
for c=20:1:20
Africa = Africa ... |
function imgOut = normImage(obj,imgIn)
MINMAX = obj.display.MINMAX;
brightset = obj.display.brightset;
imgIn(1,1) = MINMAX(1);
imgIn(1,2) = MINMAX(2);
imgIn(imgIn<MINMAX(1)) = MINMAX(1);
imgIn(imgIn>MINMAX(2)) = MINMAX(2);
% draw the new version
max_temp=max(max(imgIn));
imgOut=imgIn.*brightset;
imgOut(imgOut>max_tem... |
% [answer resptime] = compQ(mainwindow, fgcolor, bgcolor, question,showlegend)
%
% Asks a comprehension question on window MAINWINDOW with text color
% FGCOLOR on background color BGCOLOR, then asks comprehension question
% QUESTION afterwards.
%
% If SHOWLEGEND is TRUE, a legend indicating which key is YES and which i... |
function [x,k] = LeMa(StepBound, eta, xstart, StopError, method)
Delta = StepBound/2; x = xstart; E=Inf; k=0;
while E > StopError
k = k+1;
[f, g, B] = enso(x);
switch method
case 1
[Q, S, Q] = svd(B);
[lambda, pd] = EigenSolTR(Q, S, g, Delta, StopError);
E = norm(pd);
case 2
[lambda, pd] = ExactTR(B, g, De... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Build runtime input files needed to run a sub-region of llc_4320
% on facet 4 (fc=4). Run after running ExtractFields.m.
% {{{ Define desired region and initialize some variables
NX=4320;
prec='real*4';
region_name='Box56';
minlat=24;
maxlat... |
function [ levelMean, levelDensity, xBase ] = level_plot( data, names, logPlotting, nLevels, varSteps, cutoff )
%% LEVEL_PLOT plots the time series of data[:,1] vs data[:,2] split
% over the level variable data[:,3].
% nLevels are found, with the default of 4 levels
%
% Written by: Michael Hutchins
%% Data size
N ... |
function fp = sp_id_fingerprint_generate(secretKey, sp_id)
%{
get the fingerprint of service provider (sp_id)
secretKey: service provider's secret key
%}
rand_str = [ secretKey string(sp_id) ];
fp = hex2bin(DataHash(rand_str,'MD5'));
end |
%%answer for HW7
%problem 3
clear all;
close all;
%interval = 0.1
T = 10;
t = 0:0.1:T;
namta = 2 + sin(t) + sin(2.*t)./2;
%F(s)
f = inline('5/4 + 2*s - cos(s) - cos(2*s)/4');
df = inline('2 + sin(s) + sin(2*s)/2');
% sample {t1, t2, ... tn}
M = 30;
for i=1:M
% sample {t1, t2,... |
dx=0.001
nmax=2000
for i=-nmax:nmax
%Since MATLAB has only natural number indices, use j as index instead of i.
j=i+2001;
x(j)=dx*i;
y(j)=exp(x(j));
end
plot(x,y)
|
classdef LSMTimeStamps
%TIMESTAMPS Simple class representing the Timestamps part of LSM metadata
%
% AUTHOR: Stefano Masneri
% Date: 14.3.2017
properties
size = 0;
numberTimeStamps = 0;
timeStamps;
end
methods
function obj = LSMTimeStamps(lsmPtr, byteOrder)
%Read all ... |
function [filteredEEG] = twoFiltersOneCall(setFiles, setPath, lowPassEnd, highPassEnd, saveOrNotToSave)
% twoFiltersOneCall applies two filters separately in one call (but who you
% gonna call?).
% INPUT (* = required)
% setFiles: a cell containing .set files names. If not supplied it
% will looked for them... |
function [success] = createMatchObjBtwnTrialsMaps(inputImages,matchStruct,varargin)
% Creates obj maps that are color coded by the objects global ID across imaging sessions to check quality of cross-session alignment.
% Biafra Ahanonu
% started: 2020.04.08 [11:36:38]
% inputs
% inputImages - cell array of [x y nF... |
function [errore] = interpolazione(funzione,tipo,A,B,N_nodi)
if nargin < 2
errordlg('Errore inserimento input');
error('Errore inserimento input')
end
if nargin == 2
a = 0
b = a+10
n_nodi = 10
end
if nargin == 3
a = A
... |
%vis_clusters
l = length(clusters_data);
axis_config = [-3000 4000 0 7000];
%function vis_clusters(t, clusters, init, fin)
c_styles = {'.b', '.r', '.g', '.m', '.k', '.c','.b', '.r', '.g', '.m', '.k', '.c','.b', '.r', '.g'};
for i=1:l
t = clusters_data{i}.time;
if (i ~= l)
tn = clusters_data{i+1}.time;
delt... |
clc;
clear all;
close all;
warning off all;
tic;
%% Create sensor nodes, Set Parameters and Create Energy Model
%%%%%%%%%%%%%%%%%%%%%%%%% Initial Parameters %%%%%%%%%%%%%%%%%%%%%%%
n=100; %Number of Nodes in the field
[Area,Model]=setParameters(n); %Set Parameters Senso... |
% FuseLidarAltitudeFilter.m
% Adjusts the current fusion estimate by estimating the altitude from the
% lidar data directly under the UAV.
%
% This script assumes that a FuseXYZ filter has been executed on the data
% such as FuseRaw or FuseLinear
% Width of lidar data from the center of the scan to use for
% alt... |
function Violin_DCN(lsDCN, numPixel_Exp, lsOrganName)
figure();
nOrgan = length(lsOrganName);
cellViolin = cell(nOrgan,1);
nTem = 0;
for i=1:nOrgan
cellViolin{i} = lsDCN(nTem+1:nTem+numPixel_Exp(i));
nTem = nTem+numPixel_Exp(i);
end
violin(cellViolin');
set(gca,'xtick',(1:nOrgan),'xticklabel',ls... |
function results = t_sne_experiment(results_root_path, results_name, experiment, results_config_script)
check_output_dir(results_root_path);
%% Setup machine
setup_data = setup_machine();
%% Run configuration script
if nargin<4
default_t_sne_config_script;
else
run(results_con... |
function p=InPlane_DistributedLoad(x,type,alpha,b)
% x ---- location of nodes where the load applied;
% type ---- linear or nonlinear load distribution;
% alpha ---- for different linear variations;
% b ---- length of applied load side.
switch type
case 'linear'
p=1-alpha*x/b;
c... |
function I=compzoidal(Fun,a,b)
n=2; %초기값, 문제에서 처음 구간나눌땐 반으로 나눠랫음
h=(b-a)/n;%초기 h는 a b의 절반값일것이다.
x=a:h:b;
y=Fun(x);
s=0;
for i=1:n %a+nh=b
s=s+(y(i)+y(i+1))*h/2;
end
while 1 %무한루프
n=n*2;%쪼갠거 한번더 쪼갬
h=(b-a)/n;
x=a:h:b;
y=Fun(x);
... |
warning off all;
data = datcomimport('Phoenix56Seat.out');
alldata = data{1}; |
function P = cp_gram(X,R)
% Extended GRAM and direct trilinear decomposition to higher order CPD.
% This decomposition is often used to initialize CP algorithms.
%
% REF:
% [1] E. Sanchez and B.R. Kowalski, ?Tensorial resolution: a direct trilinear
% decomposition,? J. Chemometrics, vol. 4, pp. 29?45, 1990.
%
% [2]... |
function str = print_pvalue(pvalue,pvlimit,alpha,spacey)
if nargin <3
alpha = 0.05;
end
if nargin < 2
pvlimit = 0.001;
end
if nargin <4
spacey = true;
end
if pvlimit > alpha
error('lower bound pvalue can not be bigger than alpha');
end
a = num2str(pvlimit);
pvdigit = numel(regexprep(a,'\<0[.]',''))... |
%% initialize environment
close all;
clearvars
clc
%% configs
configs.numRegions = 360; %Number of brain regions
configs.mask_ut = triu(true(configs.numRegions,configs.numRegions),1); % upper triangular mask
configs.numDiffMetrics = 10; %
configs.numFCs = 420;
configs.numSubjects = configs.numFCs / configs.numDiffMet... |
function [M,Up,my,sing_values] = mvsa(Y,p,varargin)
%% [M,Up,my,sing_values] = mvsa(Y,p,varargin)
%
% Minimum Volume Simplex Analysis (MVSA)
%
%% --------------- Description ---------------------------------------------
%
% MVSA Estimates the vertices M={m_1,...m_p} of the (p-1)-dimensional
% simplex of minimum vo... |
function [ A ] = MPS_TransformToLeftGauge( A )
[N, ~] = size(A);
[~, d] = size(A{1});
for kk=1:N
if kk==1
A{kk} = Contract({A{kk}}, {[-2, -1]});
M = reshape(A{kk}, d, size(A{kk}, 2));
elseif kk == N
A{kk} = Contract({A{kk}}, {[-2, -1]});
M... |
function [x,y] = gamma1(s,region)
% gamma1 computes the parametric curve of the bottom part of the streak
% domain as defined in [1].
%
%
% USAGE
% -----
% [x, y] = gamma1(s,region)
%
% Computes the parameterization between the points s of the
% computational domain and the physical domain f... |
function b=block2treeC(a,tanTheta)
sz=size(a);
nbk=sz/8; %nbk the number of blocks,which is also the size of the 3rd level band
tbk=2*nbk; fbk=4*nbk; hbk=nbk/2; qbk=nbk/4; hq=nbk/8;
%first level:
b=zeros(sz);
b(1:4:fbk(1),:)=a(1:8:sz(1),:); b(2:4:fbk(1),:)=a(2:8:sz(1),:);
b(3:4:fbk(1),:)=a(3:8:sz(1),:); b(4:4:fb... |
function dim = mrir_DIM_SEG(varargin)
dim = 08;
return;
|
clear;
clc;
num=[10000];%分子
den=[1 5 100 0]; %分母
sys=tf(num,den);%开环传递函数
nyquist(sys);%绘制系统的奈奎斯特图
grid on;
|
% function AverageHistogram
% Loads histogram data, and analyses them
% MT Cherukara
% NOT actively used 2018-05-11
clear;
hdir = '/Users/mattcher/Documents/DPhil/Data/Fabber_Results/Histograms/Subject_01/';
% pre-allocate data arrays
hcent = zeros(2,30);
hdata = zeros(2,30);
% load data manually this time (we don... |
function [ indUpsideTwoCrows ] = isUpsideTwoCrows(~, bars)
%%
% 《日本蜡烛图技术》,1998年5月第一版,P101
indGap = bars.barCeil(1:end-2)<bars.barFloor(2:end-1);
indFirstCrow = bars.yinYang(2:end-1)==-1;
indSecondCrow = bars.yinYang(3:end)==-1;
indEngulf = (bars.barCeil(2:end-1)<bars.barCeil(3:end))&(bars.barFloor(2:end-1)>bars.barFloo... |
global stopR waitT clockmax
global g_tave g_tstd g_run
totalNumCarsWaiting = sum(stopR);
individualCarWaitTimeAverage = waitT./clockmax;
mean_individCarWait = mean(individualCarWaitTimeAverage);
std_individCarWait = std(individualCarWaitTimeAverage);
g_tave(g_run) = mean_individCarWait;
g_tstd(g_run) = std_individ... |
function [ output_vector ] = create_AU( input_vector )
output_vector = [];
for i = 1:length(input_vector)
if input_vector(i)
output_vector = [output_vector, i];
end
end
end
|
j=sqrt(-1) % Defining j
I=[30+j*40; 20+j*15] % Column of node current phasors
Y=[1.5-j*2 -.35+j*1.2; -.35+j*1.2 .9-j*1.6];
% Complex admittance matrix Y
disp('The solution is')
V=inv(Y)*I % node voltages (solving I=YV)
S=V.*conj(I) % complex power at nodes
|
function planet_astronomical_data = astronomical_data(planet_id)
% This fucntion extracts a planet's astronomical data.
%
% INPUT:
% planet_id = planet identifier - 1 to 9, from Mercury to Pluto
% OUTPUT:
% planet_astronomical_data
%
% VARIABLES DESCTRIPTION:
% astronomicalData - 9x7 ar... |
function output_matrix = inverse_kinematics( Vt )
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% initial_conditions değişkenleri
global n x y z a R
global Phi H Phit J l_s hh h_s
global h1 h2 h3 h4 h5 h6 h7
global l12 l23 l34 l45 l56 l67 l7t
global l_s_7t
global H1 H2 H3 H4 H5 H6 H7
glob... |
function [x] = rcrammer
syms x
%Función para solucionar un sistema de n-ecuaciones lineales
A=input('Digite la matriz A=');
B=input('Digite la matriz B=');
n = length(B);
for i = 1:n,
C = A;
C(:,i) = B;
x(i)=det(C)/det(A);
disp(x)
end
|
function pathEnd = findMazeExit(imgGreen)
% creates a 2x2 matrix - borders of the maze-exit
% [x y; x y] ==> top-left; right-bottom
%
% INPUT
% imgGreen ... G-channel of the image
%
% OUTPUT
% pathEnd ... left-top and right-bottom coordinates of the exit
center = centroid(imgGreen);
pathEnd = [center; center];
... |
classdef vertex < handle
properties(SetAccess = private)
xy% horizontal position
z=inf;% distance from associated edges (height of roof)
delta% uncertainty, due to numerical precision
LeftV=vertex.empty;% parent vertex (or neighboring base)
RightV=vertex.empty;% p... |
function [negLogLike,d_negLogLike] = MLL_newton(Q1_sqrt,Q2_sqrt,k,theta,sigma,mu,a,rho,L,Y)
%% Description;
% Input: parameters
% Output: negative max likelihood function:negLogLike & differentiate it by
% each parameter:d_negLogLike
%%
% syms sqrt_Q1 sqrt_Q2 k theta sigma mu a rho
for i = 1:L
V(i) = Y(... |
function [onflAuto additional] = segmentONFLVolume(volume, Params, onh, rpe, icl, ipl, infl, bv)
% SEGMENTONFLVOLUME Segments the ONFL from a Volume.
%
% For detailed comments refer to segmentONFLCirc(..).
%
% This is an experimental adaption of the circular scan algorithm to volume
% scans. Preliminar results were pub... |
function display_map_season(Values_input_annual_north, Values_input_annual_south, average_period_value, value_limit)
values_get = Values_input_annual_north;
values_get_size = size(values_get);
values = zeros (size(values_get)) + NaN;
values(1:values_get_size(1)/2,:) = values_get((values_get_size(1)/2+1):end,:); % fl... |
%
% DESC
%
% Plot the calling card rates for various Nobel cellular cards to South Africa
%
% HISTORY
% 04 September 2003
% o Initial design and coding
%
T=1:60*60;
plot( T/60, phoneRate(60*60, 4*60, .134/60), 'r', ...
T/60, phoneRate(60*60, 2*60, .144/60), 'g', ...
T/60, phoneRate(60*60, 1*60, .... |
function [Ni,We,exitflag,exitmsg] = planar_local_planner(Ne, Nr, Prob)
% Connect algorithm - finds time optimal path and consideres joint angle
% and torque limits
%t0 = Ne(1); x0_src = Ne(2:7); x0_sen = Ne(8:13);
%tf = Nr(1); xf_src = Nr(2:7); xf_sen = Nr(8:13);
t0 = Ne(1); x0 = Ne(2:end);
tf = Nr(1); xf = Nr(2:end);
... |
% ?Rahul Kala, IIIT Allahabad, Creative Commons Attribution-ShareAlike 4.0 International License.
% The use of this code, its parts and all the materials in the text; creation of derivatives and their publication; and sharing the code publically is permitted without permission.
% Please cite the work in all materials... |
function [ A] = communication_range(i,N,pose_x,pose_y,max_dist, A1)
% if i agent goes out of the j's communication range, then A(i,j)=A(j,i)=0
for m=1:N
distance = 0;
if m~=i && A1(i,m)==1
distance=sqrt((pose_x(i)-pose_x(m))^2+(pose_y(i)-pose_y(m))^2);
if distance>max_dist
A1(... |
classdef class_artery < handle
properties( Access = public )
n % [-] number of intersections
intersection % 1xn array of class_intersection
x % [ft] 1xn intersection positions
cycle % [sec] cycle time for coordination
vi ... |
clc; clear all; close all;
%% Annotation for Infant Data
InfantDataAnnotList = {'A06-09-28-2013','B06-10-30-2013','N09-12-04-2013'...
'GR09-07-12-2014','LW10-06-19-2014','AR16-07-14-2014','J20-08-19-2013','RB23-12-04-2014'};
%% Importation of Class Labeling Vector
cd('\\bmi-nas-01\Contreras-UH\Infantdata\I... |
% may be possible to get around 40 trials for run with the current timing
% of the screens in the task...
% first timing run 3/17/17: 332.3418sec = 5.53min; 326.4461sec= 5.44min;
% 342.3856sec = 5.70 min; 338.8972sec = 5.64min;
% should we also create an output for the delay time in 5th screen
function probz13_0_E... |
function plot_RNAPZ13( d, str, conc)
figure();
set_print_page(gcf,1);
image(d*20); colormap(1-gray);
make_lines; make_lines(0:5:20,'b');
title(['Titration: ', str], 'fontsize',20,'fontweight','bold');
hold on;
x = [0,0,21,21]; y = [1700,2000,2000,1700];
fill(x,y, 'w', 'edgecolor','none');
for i = 0:5:20;
plot([i+... |
%% AR(1)
g = 0.95;
s = [1,zeros(1,49)];
dt = 0.05;
c = filter(1,[1,-g],s);
tau = -dt/log(g);
sf = 10;
dt2 = dt/sf;
t = (0:49)*dt;
t2 = t(1):dt2:t(end);
h = exp(-t2/tau);
figure;plot(t,c,'o'); hold all; plot(t2,h,'.');
%% AR(2)
s = [0,1,zeros(1,48)];
gr = [0.6,0.95];
c2 = filter(1,poly(gr),s);
tau = -dt./log(gr);
h2 ... |
clear all
tracks=9;
N=127;
for(j=1:tracks)
[filez fold]=uigetfile('*.txt','simData','A:\SmarticleRun\SarahAmeobotData\127');
pathz=fullfile(fold,filez);
simD=importdata(pathz);
% remove first line
simD(1,:)=[];
dat=zeros(simD(end,1)-simD(1,1),3);
dat(1,1)=simD(1,1);
dat(2:end,1)=[2:(size(dat,1))]+dat(1,1)-1;
for(i=1:s... |
%% Processing EMG signals to remove noise and artifacts.
%
% Author: Anna Vettoruzzo
% September 2021
clc;
close all;
clear all;
%% Set paths
addpath D:\Tesi\Codice\fieldtrip-20210311
ft_defaults %sets the defaults and configures up the minimal required path settings.
datadirMEG = ['D:\Tesi\Data\'];
... |
%% Stelling 10
%
% Het is ongebruikelijk dat je als Matlab programmeur
% zelf functies schrijft.
%
Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
|
function Frec = pol2rec(Fpol)
Frec = Fpol(:,1).*(cos(Fpol(:,2)*pi/180)+j*sin(Fpol(:,2)*pi/180));
|
function gen = updateComponentSpec(gen,param,value)
% UB is the new upper limit
% LB is the new lower limit
% dX_dt is the new ramp rate (kW/hr)
% Output is optional and can include new efficiency curves
UB = gen.Size;
if strcmp(gen.Type,'CHP Generator') || strcmp(gen.Type,'Electric Generator') || strcmp(gen.Type,'Hydr... |
%--------------------------------------------------------------------------
%-----------------------SYNTHETIC DATA GENERATION--------------------------
%--------------------------------------------------------------------------
[~, ~, Te_fluct_xt]=generate_fluctuations(radial_kc,poloidal_nc,freq_c,time_parameter);
[ra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.