text stringlengths 8 6.12M |
|---|
function mildSlope()
profile on;
[vertices, triangles, depth, openBoundary, closedBoundary] = readMesh("lyttelton.mesh");
k0 = 1 / (3 * 256 / (2 * pi * 6378137 * 0.00955042966330666));
wavedirection = [1 -1];
waveheight = 2;
R = 0.9;
% Assemble *local* stiffness matrix and load vector
[A, b] = assemble(vert... |
function [picks,rejects] = translatePeaks( picks, fieldSize, tform )
% translatePeaks apply transformations to peak locations
%
% PEAKS = translatePeaks(PEAKS, SZ, TFORM) applies the transformation TFORM
% (from maketform) to the matrix PEAKS (x coordinates in first column, y in
% second), centered around an ... |
function clusterAssignments = clusterAnalysis(setR)
% DESCRIPTION: compute a clutering algorithm (k-means)
% INPUT: Reflectance measurements (vector of decimal numbers)
% OUTPUT: clusterAssignments Final cluster assignments (vector of numbers, 1 or 2)
% INIT vector of cluster assignments
clusterAssignments = zeros(1,l... |
function [s1,a]=tone_vocoder(s,fs,N,cutf)
D_200=1/0.06*log10(200/165.4+1);
D_7000=1/0.06*log10(7000/165.4+1);
size=linspace(D_200,D_7000,N+1);
fbands=165.4*(10.^(0.06*size)-1);
s1=zeros(1,length(s));
for i=1:N
f1=fbands(i);
f2=fbands(i+1);
%产生带通滤波器
[b,a]=butter(4,[f1 f2]/(fs/2));
y=filter(b,a,s);
... |
function [J, grad] = logistic_cost_function( theta, X, y )
m = length(y);
grad = zeros(size(theta));
H = X * theta;
a = -y .* log(sigmoid(H));
b = (1 - y) .* log(1 - sigmoid(H));
J = 1/m * sum(abs(a - b));
for i = 1:size(theta)
grad(i) = 1/m * (sum((sigmoid(H) - y) .* X(:,i)));
... |
function out = calc_X(k1, k2, h1, h2, delta_x1, delta_x2, delta_y1, delta_y2)
beta_c = 1.127e-3;
%geometric factor
Ax1 = delta_y1*h1;
Ax2 = delta_y2*h2;
out = 2*beta_c/(delta_x1/(Ax1*k1) + delta_x2/(Ax2*k2));
end |
% average Ein = 0.0394
% average Eout = 0.0485
Ein = 0; % percent of g(x) ~= f(x)
Eout = 0;
numruns = 1000; % number of runs
N = 100; % number of points in the training set
T = 1000; % number of points in the test set
% creating the initial weight vector
w = zeros(1, 3);
for s = 1:numruns
trainpts = ones(N,1);... |
function c = bs_pde_ko_call(model, option, M, N)
% BS_PDE_KO_CALL prices a knock-out call option using finite differences on
% the Black-Scholes PDE.
%
% Required are:
% model : struct with fields
% sigma : Volatility
% r : Risk-free interest
% S0 : Initial value
% op... |
function bw = bw_nrd (x)
h = (quantile(x,0.75) - quantile(x,0.25))/1.34;
bw = 1.06 * min([sqrt(var(x)), h]) * size(x,2)^(-1/5);
end |
clear all
close all
SIZE = [1024,1024]; % Defining the size of the images
N_images = 5; % The number of images created for each movie
if exist('out', 'dir')
rmdir out s % Remove all previous files if there are some
end
% N_particles = [32, 128, 256, 512]; % The number of particles in the
% videos
% max_speed = ... |
function [A, B, X0, U0, range] = linAB_TS_X(data, n, rng)
range = rng * data.h20;
for i = 1 : n
h20(i) = range * (i - 1 - (n - 1) / 2) / (n - 1) + data.h20;
[A(:,:,i), B(:,:,i), X0(:,i), U0(:,i)] = linAB(h20(i), data);
end
end |
clear
global A B fai2
fai2 = 2.25*(90/342)^0.88;
E=2.25*(90)^0.88; %重伤群众上限
E1 = -90^0.88; %轻伤群众下限
E2 = 2.25*342^0.88; %轻伤群众上限
load A
load B
LA = length(A); %获取重伤群众人数
LB = length(B); %获取轻伤群众人数
L=LA+LB; %%获取总... |
function [mean , c] = mean_cov(S)
lenth = size(S,1);
mean_x = sum(S(:,1))/lenth;
mean_y = sum(S(:,2))/lenth;
mean = [mean_x mean_y];
c = cov(S);
end
|
function [Y1 Y3] = shiftmul(data1,data2)
coder.extrinsic('decimalToBinaryVector','binaryVectorToDecimal');
bin=decimalToBinaryVector(data1,16);
b1=bin([6+1:end 1:6]);
b2=bin([4+1:end 1:4]);
b3=bin([1+1:end 1:1]);
Bn1=data1+binaryVectorToDecimal(b1)+binaryVectorToDecimal(b2)+binaryVectorToDecim... |
%% Starting point, clear everything in matlab
tic;
clear all;
close all;
clc;
%% Problem Formulation
FitnessFunction=@(C,g,x,c) TDi_PSO(C,g,x,c); % FitnessFunction
nLights=4; % Number of Traffic Lights
nIntersections=1; % Number of Intersections (stati... |
function Q2 = LatexQ(d, j, pattern)
% Q2 = LatexQ(d, j, pattern) prints out Q for degree d, level j, showing
% normalization factor first if possible. Returns the actual matrix
% printed. If pattern is present, LatexPattern is used to show the general
% pattern.
% Find the Q matrix.
Q = FindQ(d, j, 'min');
% Find ... |
function [ bins vfCDF ] = myCDF(vfData, fMIN, fMAX, strcolor)
Vlen = size(vfData,2); CDFlen=400; vfPDF = zeros(1,CDFlen+1);
fmin = min(vfData);
fmax = max(vfData);
fStep = CDFlen/(fMAX-fMIN); bins = fMIN : (fMAX-fMIN)/CDFlen : fMAX;
for jjj = 1 : Vlen,
inow = floor((vfData(jjj) - fMIN)*... |
%Implements an example MAP decoder, soft-input soft-output. Uses a
%brute-force algorithm, which is useful for demonstration/learning
%purposes.
%
% Copyright Colin O'Flynn, 2011. All rights reserved.
% http://www.newae.com
%
% Redistribution and use in source and binary forms, with or without modification, are... |
function varargout = curvature(DEM,varargin)
% 8-connected neighborhood curvature of a digital elevation model
%
% Syntax
%
% profc = curvature(DEM)
% [profc,planc] = curvature(DEM)
% ... = curvature(DEM,d)
% curv = curvature(DEM,d,'type')
% [profc,planc] = curvature(DEM,d,'both')
%
... |
function Mnorm = pixelNormalizationVar(M,type,sigma)
%PIXELNORMALIZATION Compute pixel-wise normalization
%
% Inputs:
% M Magnitude/weight {i}[:,:]
% type Filter type
% sigma Filter std.dev. [i,2]
Mnorm = cell(size(M));
for i = 1:numel(M)
[f,r] = ndFilter(type,double(sigma(i,:)));
rMin = floor... |
% This scripts computes histograms of finger's positions inside the
% triangular arena from the subjects/ideal observer conditioned on the
% finger's positions from the ideal observer/subjects. It allows to see if
% there is a correlation between subjects and the ideal observer. Or, in
% other terms, is there agreement... |
function ofdmSeq = old_ofdm_mod(qamSeq, frameSize, cpr)
% P = amount of frequency bins.
P = length(qamSeq)/frameSize;
% Explain the necessity of the `mirror operation' in each frame from a signal processing point of view.
% We willen enkel positieve frequenties
packet = reshape(qamSeq, frameSize, P);
packet = [zeros... |
%% visualize activations of a convolutional neural network
%% load pretrained network and data
net = alexnet;
im = imread(fullfile(matlabroot, 'examples', 'nnet', 'face.jpg'));
imshow(im);
imgSize = size(im);
imgSize = imgSize(1:2);
%% view network architecture
net.Layers;
%% show activations of first convolutiona... |
% *****************************************************************************************
% File Name : ylabelLatex.m
% Author : Dingjiang Zhou
% Boston University, Boston, 02215
% Email : zdj@bu.edu zhoudingjiang@gmail.com
% Create Time : Sat, Sep. 05th, 2015. 10:10:56 PM
% Last ... |
function [vr] = commonTerminationVIRMEN(vr)
%commonTerminationVIRMEN This function contains the common termination
%information for every virmen maze
fclose(vr.fid);
if vr.numTrials ~= 0
[dataCell] = catCells(vr.pathTempMatCell,'data'); %#ok<NASGU>
save(vr.pathMatCell,'dataCell');
delete... |
function [ X ] = jacob1( q, qDot )
%JACOB1 calculates the vector of task space velocities using Jacobian and
%joint velocities (Qdot)
J = jacob0([q(1) q(2) q(3)]);
T = [qDot(1); qDot(2); qDot(3)];
X = J*T;
end
|
%MB_ParameterEstimation load .mat file with edge features and estimate paramters w of EdgePot
% enkel edgepot aangezien nodepot door NN wordt berekend
clear;close;
addpath(genpath('D:\Google Drive\Research\2017-05 point cloud segmentation\Matlab\Mijn code'));
addpath(genpath('D:\Google Drive\Research\2017-05 point clou... |
pos_fin = [1000 19000 40000 40000 40000 40000] - 100;
profile clear
profile on
close_motion_prop([0,0,0,0,0,0],s)
pause(5);
pos_mes = read_all_positions( s, 1 );
speed_mes = read_all_speeds( s, 1 );
data_pos = pos_mes;
data_speed = speed_mes;
close_motion_prop(pos_fin,s);
t = 0; t_ma... |
function [params, error] = lms_estimator(data, order, lr)
%LMS_ESTIMATOR Computes the lms estimate using gradient descent
% params - dynamics of the weights learnt from the data
% error - dynamics of the prediction error
% data - input containing samples of the process for estimation
% order - order parameter t... |
% NearSpeakerTable -- MUX to Speaker assignment tables for the human lab with
% the chair at the center of the room. Should calibrate with the
% mic pointed directly at 0,0 (Cn.DirectIncidence= 1). Note that azimuth
% is limited to +/-40.
Cn.DAC1SpkrTable= [ % this must match the current patch panel conn... |
function y = f9(x)
t1 = length(x);
t3 = 1;
for i = 1:t1
t2 = cos(x(i)/sqrt(i));
t3 = t3*t2;
end
y = sum(x.*x)/4000-t3+1; |
clear;
clc;
tic
%% HDR IMAGING - INITIALS
resize_ratio = 1/60;
% load .TIFF images
img = imresize(imread('./exposure_stack/exposure1.jpg'), resize_ratio);
[height, width, ch] = size(img);
k = 16;
Zmin = 0;
Zmax = 255;
n = Zmax - Zmin + 1;
img_list = zeros(height, width, ch, k);
for i = 1: k
img_name = join(['... |
function [x, force, u, cnew, cost] = ADMM_CEN(obj,DYNCST,DYNCST2,x0,xc0,u0,u0_cen,COMTask,SwingFootTask,spmode,xf,Op)
%ADMM for three blocks (centroidal_model + whole_body + projection operator)
%the constraints are
% c = CoM(q)
% [m*dc;L] = Ag(q)*dq
% force = g_f(q,dq,u)
% u ... |
function varargout = newton_GUI(varargin)
% NEWTON_GUI MATLAB code for newton_GUI.fig
% NEWTON_GUI, by itself, creates a new NEWTON_GUI or raises the existing
% singleton*.
%
% H = NEWTON_GUI returns the handle to a new NEWTON_GUI or the handle to
% the existing singleton*.
%
% NEWTON_GUI('CALL... |
clear all
% The parameters of the paper
D = 1;
H = 0.3;
r = 0.4;
k = 2.0;
A = 0.02;
S = 100;
x0 = 1500;
m = r * k;
deltaU = 0.0001;
timeStep = 0.01;
simulationTime = 500;
if(mod(simulationTime,timeStep)~= 0)
return
else
%Equilibrium values
uEq = (r * H)/(1 - r);
vEq = (1 - uEq)*(H + uEq);
% ... |
% Figure 7.43 Feedback Control of Dynamic Systems, 5e
% Franklin, Powell, Emami
%
% script for fig. 7.43
clf;
f=[-10 1 0;-16 0 1;0 0 0];
g=[0 0 10]';
h=[1 0 0];
j=0;
[np,dp]=ss2tf(f,g,h,0);
np=[0 0 0 10];
nc=conv([-1 0.718],[1 1.87]);
r=[-0.95+6.17*i -0.95-6.17*i];
dc=poly(r);
... |
clc;close all;clear;
warning off all;
load WeatherForecasting.mat % fea group-
class = zeros(3,numel(group)); % create 3x69 matrix
for i =1:numel(unique(group))
class(i,:) = group == i; % create a logical matrix corresponding to each group
end
[a, b]= uigetfile('*.*');
filename = [b,a];
im=imread(fil... |
u_inf=[23.1615 16.6564];
%i=contador de collocation points
%j=contador de vortex points
n=(numel(coord_vor))/2;
A=ones(n);
B=zeros(n);%era para pruebas
RHS=zeros(n,1);
C=zeros(n,1);%era para pruebas
for i=1:n
normal=normales(i,:);
for j=1:n
% if j>i
... |
function [MatrixOfDistances,PotentialUnknowns,ConnectivityMatrix,ListOfEquations,DemodulationInformation] = ReadNodeCoord
%ReadNodeCoord reads the log file and creates matrices containing the
%information about nodes
%
% NO INPUTS
%
% OUTPUTS:
% MatrixOfDistances = the distance between any two nodes; the results are s... |
% train network
% Input:
% trainX -- trainsetX
% trainY -- trainsetY
% topo -- topology [input_layer_size, ... , output_layer_size]
% max_epoch -- maximum epoch to train
% l_rate -- learning rate
% lambda -- regulation term
% f... |
function [CostIoU,CostDist] = TrackletsMergeCostM_V1(Low_tracks_in,ThreSeg)
%UNTITLED8 此处显示有关此函数的摘要
% 此处显示详细说明 PolyBbox
CostIoU=inf(length(Low_tracks_in));
CostDist=inf(length(Low_tracks_in));
DeltaMag=[]; % average delta
for ci=1:length(Low_tracks_in)
TR1=cell(1,2);
TR1{1,1}=Low_tracks_in(ci).pol... |
fid=fopen('soln.dat','r'); % open data file
fseek(fid,0,'eof'); % go to end of file
position = ftell(fid); % determine size of file
frewind(fid); % go back to the beginning
n = sqrt(position/8); % assume file contains 2x2 matrix
f=fread(fid,[n,n],'double'); % of 8-byte doubles
fcl... |
NumPoints = 30;
N = [0:NumPoints-1];
X = [ones(1, 10) zeros(1, NumPoints-10)];
H = 2.^(-N);
Conv = conv(X, H);
figure(1); clf; hold on;
plot(N, Conv(1:NumPoints));
stem(N, Conv(1:NumPoints));
|
%StatMdPlot.m
% confidence interval 95%
% ci = nlparci(gaubt,r,'covar',cov);
% % check for r2
% sst = sum(abs(yFit-mean(y)).^2);
% sse = sum(abs(yFit-y).^2);
% RMSE = sqrt(sse/dn);
% rsq = 1-(sse/sst);
%
% fprintf('sse %0.3f; sst % 0.3f; rsq %0.3f \n', sse, sst, rsq);
%
% % C = corrcoef(y, yFit);
% % rsq1 = C(1,2... |
function analyze_ERP_features(CFG, ERP_features, ERP_combined)
% channels and datasets to analyze
ch_ids = CFG.ch_idx;
exp_IDs = CFG.exp_IDs; num_exps = numel(exp_IDs);
% bins
bins = CFG.bins;
% one of the ERPs
%ERP_exmp = ERP_combined(end);
% get channel labels
%lbls = {ERP_exmp.chanlocs.labels};
max_coef = 0;
for... |
function fname = ldf(path,suffix)
%
% fname = ldf(path,suffix)
%
if nargin == 0 || isempty(path),
path = '/tag/temp/' ;
end
[fname pname] = uigetfile([path '*.dtg'],'Pick a file') ;
if fname == 0,
fname = [] ;
commandwindow
return
end
fname = [pname fname(1:find(fname=='.')-1)] ;
% unpack file if n... |
%% small program to simulate projections of a rotated and sheared image.
close all
theta = -45; %rotation and shearing angle
Im=double(imread('cameraman.tif'));
%rotate the image
Im2=imrotate(Im,theta);
[x,y]=size(Im2);
figure; imshow(Im2,[])
%project the rotated image
line=sum(Im2,1);
%compute matrix for af... |
function [count] = areaOfImage(image)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
a = image;
[p,q,r] = size(a);
if r==3
A = rgb2gray(a);
else
A = a;
end
A = uint8(A);
b = imbinarize(A,graythresh(A));
count = 0;
for i=1:p
for j=1:q
if b(i,j) ... |
function bcw_norm = normalizedata(bcw)
[r c] = size(bcw);
bcw_norm = [];
norm_col = [];
for i = 1:(c-1)
norm_col = normalizecolumn(bcw(1:r,i));
bcw_norm = [bcw_norm , norm_col];
end
bcw_norm = [bcw_norm , bcw(1:r,c)];
|
function [Value,M] = hsscanf(String,Format,N)
% hSSCANF : Do SSCANF for a cell array of strings.
ONCE = 0;
CELLOUT = 0;
if nargin < 3, N = Inf; end;
if isa(String,'char'), String= cellstr(String); end;
NoStr = length(String(:));
%Value = cell(size(String));
Value = {};
M = [];
for StrNo = 1:NoStr,
... |
clear all;
%二维输入向量 ,以及其相应所属的类别 ,
P=[-3 -2 -2 0 0 0 0 +2 +2 +3;0 +1 -1 +2 +1 -1 -2 +1 -1 0];
C=[1 1 1 2 2 2 2 1 1 1];
T=ind2vec(C); %将C转换成向量形式T
%绘制出输入数据点
i=1;
cla
for i=1:10
if C(i)==1
plot(P(1,i),P(2,i),'+') %效果如图5-41所示
hold on
else
plot(P(1,i),P(2,i),'o')
hold ... |
%--time series of MCS number
%--three parts:fig1--global&global_anom+runm;
%--fig2--anom+runm,land,sea,NH,SH;fig3--anom+runm,seven regions
clear
clc
data_path='/Users/hcq/workspace/MCS/data/';
% data_path='/home/hxm_stu/WORK1/hcq/MCS/data/';
%data_name3= 'record_num_exp3.txt';
data_name= 'record_num_init_exp3_region.t... |
function [ conSeq ] = findContinueSeq( seq, minCon )
if ~exist('minCon','var'), minCon = 1; end
if isempty(seq), return; end
conSeq = [1; seq(1)];
for i = 2 : length(seq)
if seq(i) ~= conSeq(2,end)
conSeq = [conSeq [1;seq(i)]];
else
conSeq(1,end) = conSeq(1,end)+1;
end
end
while 1
[mi... |
z= audiorecorder ;
disp('start speaking')
recordblocking ( z , 10 );
disp('end of speaking')
%start speaking
%end speaking
play(z) ;
myrecording = getaudiodata (z) ;
plot(myrecording) ;
|
load coinfNR
thetaHR1 = thetaHR500;
load coinfNRC thetaHR500
thetaHR2 = thetaHR500;
load coinfNRD thetaHR500
thetaHR3 = thetaHR500;
load coinfNRM100 thetaHR500
thetaHR4 = thetaHR500;
parametrit = {'\gamma','log(\tau^2)','\beta_{1}','\beta_{2}','\beta_{3}',...
'\alpha_{M,1}','\alpha_{M,2}','\alpha_{M,3}','\alph... |
function a = CheckerMatrix(n)
% Taking a number n produce a square
% checkerboard matrix that has dim nxn.
x=[];
y=[];
for i=1:n
if mod(i,2)==0
for j=1:n
if mod(j,2)==0
x = [x 1];
else
x = [x 0];
end
end
else
for j=1:n
if mod(j,2)==0
x = [x 0];
else
x = [... |
% Lab 02 - Gloria Dal Santo 14/10/20
close all; clear variables; clc
addpath ./data
addpath ./functions
% read and show
im_name01 = 'lena-y.png'; % intensity
im_name02 = 'wool.png'; % intensity
im01 = imread(im_name01);
im02 = imread(im_name02);
figure('name','original');
subplot(1,2,1); ims... |
function [bi exp] = reversePascal(poly)
exp = (length(poly) -1);
if length(poly) == 2
bi = [poly(1) poly(end)];
else
for x = 2:length(poly)
poly(x) = poly(x) - poly(x-1);
end
if poly(end) == 0
poly(end) = [];
end
bi = reverse... |
%% Assignment 3 - Drinks and Heat Transfer Analysis
% Roy E. Crippen IV
% ENG 101
% Due 9/5/2019
%
% The goal of this code is to compute the time required to cool a beverage
% with user-input-values for initial temperature, desired temperature, and
% fridge temperature using Newton's Law of Cooling.
%
%
%% Useful Formu... |
% delete all variables
clear;
% close existing figure windows
close ALL;
% load array from file into matlab
% note that columns can be separated by space / tab or commas in matlab
temp = importdata('output.txt', ',', 1);
A = temp.data;
%delete temp;
%A = load('output.txt');
% file format (note y1, y2, y3 refer t... |
clc, clear all
dtu = load('results/optimize/DTUparamsTestFinalOpponent.mat');
sift = load('results/optimize/dogsift_opponent_test.mat');
pathTypes = 1:6;
[imNumKey,liNumKey,imNum,liNum,pathNames,pathX,pathXlabel] = dtuPaths('test');
setNum = 1:60;
% Number of images in each set
imgNum = sum(cellfun(@numel,imNum(path... |
function [output] = ErrorDiffusionDithering(input)
% input : gray img, type = double
% output : gray img, type = double
[M,N] = size(input);
output = zeros(M,N,'double');
for i = 1 : M
for j = 1 : N
if input(i,j) < 0.5
err = input(i,j);
else
err = input(i,j) - 1;
end
... |
%
%
% A Script shoing how to simply write a matrix out to an ffA format file.
%
%
%
%% load some recognisable data
load clown;
%% create an volume with variation in z
sz = [ size(X) 10 ];
data = zeros(sz);
for n = 1:sz(3)
data(:,:,n) = X + n*10;
end
%% Build the ffa header struct
header = f... |
function [d] = graphPLE(a,b,c,fontsize2)
%graphs ple data
surf(a,b,c');
xlabel('Emission','FontSize',fontsize2);
ylabel('Excitation','FontSize',fontsize2);
zlabel('Intensity');
shading interp;
view(0,90);
axis image;
% saveas(A,'testfile.jpg');
%[gradplex gradpley]=gradient(levelpledata);
|
function average_flow = computeFlow(img1, img2, win_radius, template_radius, grid_MN, mask, mask_idx)
mask = flip(flip(mask), 2);
[ht, wid, ~] = size(img1);
opticalFlow = zeros(grid_MN(1), grid_MN(2), 2);
average_flow = zeros(2, 1);
num_flow = 0;
c = 1;
for x = round(wid / (grid_MN(2) +... |
datafolder = 'G:\My Drive\Ole Miss\NCCHE\DeepWaves\TN' ;
loggerfolders = {'wlog1','wlog2'} ;
n = numel(loggerfolders) ;
for k = 1:n
selectionfolder = [datafolder,filesep,loggerfolders{k},filesep,'Selections'] ;
savefolder = [selectionfolder,'_cleaned'] ;
mkdir(savefolder) ;
% List files in directory
... |
%{
This takes the raw data .mat files and segments out the bones.
It makes a max of everything with > 200 HU
It then takes the largest connected component of pixels
and that is considered the bone
%}
GENERATED_DATA_PATH='D:\DATA\SPINE_LESIONS_GENERATED_DATA_SET\';
patientFolders = dir(GENERATED_DATA_PATH);
for fo... |
%% This Matlab file simulates the second-order low-pass filter that is used
% to filter motor pulses to provide a clean tachometer signal. This filter
% is implemented with analog components and is therefore continuous. The
% Matlab continuous control systems tools are used for the simulation.
% ------\/\/\/---|---\/... |
%%%% Solve H2 with Loop instead %%%%
close all
%%%% set up parameters
alpha = 0.35;
beta = 0.99;
delta = 0.025;
sigma = 2;
A_h = 1.1; A_l = 0.678;
pi_hh = 0.977; pi_hl = 1-pi_hh;
pi_ll = 0.926; pi_lh = 1-pi_ll;
v_guess_h = 0;
v_guess_l = 0;
%%%% Set up discretized state space
k_min = 0;
k_max = 45;
num_k = 1000; % num... |
function filtered = gaussian(data, window, srate)
%window is number of points on each side of current point that you want to
%consider
window = window*2;
b = gausswin(window);
[H, W] = freqz(b, 1, 10000);
index = find(abs(H)<(0.70710678118654752440084436210485*H(1)),1,'first'); %find index of first value that is les... |
[q4,t] = YToolkits.timeseries2vector(Data.q_thigh_knee_L);
[q5,t] = YToolkits.timeseries2vector(Data.q_knee_shin_L);
[q6,t] = YToolkits.timeseries2vector(Data.q_shin_tarsus_L);
[qHeel,t2] = YToolkits.timeseries2vector(Left_heel_spring_p);
q4 = q4';q5 = q5';q6 = q6';qHeel = qHeel';
% time_period = 2:0.0005:3;
% q4_choi... |
function BoxTrackSeqTimeIntervalCompare_EvtPeakAngle
% Part of BoxTrackSeqTimeIntervalCompare. This function compute cells' peak firing angle in each
% turn events, time interval between neighbouring peak angles in each turn event.
%
% Created on 8/25/2016, XM.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function vf = read_vector_field(filename)
%format:
%24 3
%0.999987 0.00013041 -0.00361332 0.00013041 0.998699 0.036044 -0.00361332 0.036044 0.00131395
%0.781284 -0.0618677 0.40872 -0.0618677 0.9825 0.115613 0.40872 0.115613 0.236217
%...
%
% Copyright (c) 2008 JJCAO
%% open file
fid = fopen(filename,'r');
... |
function [q] = imex2(q, A, H, N, Nt, Nx, ht, hx, epsilon)
p = q(1:N+1,:,:);
w = q(N+2:end,:,:);
alpha = A(N+2,1);
a = 2*epsilon/(2*epsilon + ht);
b = ht/(2*epsilon + ht);
for n = 1:Nt
Hpn = cell2mat(arrayfun(@(i) H(p(:,i,n)), 1:Nx, 'UniformOutput', false));
% first stage
... |
%% Computer Exercise 3
load compEx3data
load compEx1data
%%
% Normalize image points with K^-1
x1n = K\x{1};
x2n = K\x{2};
%% Eight point algorithm
[dim, rows] = size(x1n);
M=[];
for row=1:rows
xx = x2n(:, row)*x1n(:, row)';
M(row,:) = xx(:)';
end
% SVD
[U,S,V] = svd(M);
v = V(:,end);
eigenvalues = diag(S.'... |
function [vad4,vad14,ampl] = stat1VAD_f_27_04_15(audifile,addnoice,sw,s,a)
%sw=1-> 'dd(a)' is, sw=2-> s- number of frames for avarige for apostML,s>=1.
%recomendate a = 0.97.
[ampl,frc] = audioread(audifile);
noicelySigal = ampl+addnoice*randn(size(ampl));
ampl = noicelySigal;
lengthFrame=round(frc/100);
numb... |
function y_hat = lrPredict(X,weights)
[~,n] = size(X);
ynew = weights(1);
for j=1:n-1
ynew = ynew + (weights(1+j)*X(j));
end
y_hat = 1 / (1 + exp(-ynew));
end |
%% analyse CAMELS and UKBN catchments
clc
% close all
% clear all
data = load('catchment_attributes_updated_UKBN.mat'); %catchment_attributes_updated
attribute_table_UKBN = data.attribute_table_updated;
data2 = load('catchment_attributes_updated_CAMELS.mat');
attribute_table_CAMELS = data2.attribute_table_up... |
%% Yunhao Bai for MIBIsubgroup, 20200420
%compensation the boundary leakover with CODEX-like logic
%(cell B channel X counts) = (cell B channel X counts)
%- (cell A channel X counts) * BoundaryAB/perimeterA - cell C/D
%+ (cell B channel X counts)
%assumption and approximation:
%2. at corner of 3/4 different c... |
% convergence stats
plot_convergence_PT_RJMCMC('Test_SynthData/Test_synthData')
subplot(421); ylim([0, 3])
load('Test_SynthData/Test_SynthData_PT_RJMCMC_4.mat')
% posterior ensemble
nBurnin = 50000; nThin = 1;
[H,V,intfcCount,meanH,meanV,medianH,medianV,kOut] = ...
plot_RJMCMC(1,s_ll,k_ll ,nBurnin,nThin,1,100,'iso... |
%混沌法整定PID参数
clc;
clear all;
close all;
k=2;
T=10;
n=2;
kp=0.833;
ki=0.0833;
pmax=kp*5;
pmin=kp/5;
imax=ki*5;
imin=ki/5;
step=100;
r=1;
QB=10e40;
d1=rand();
d2=rand();
for i=1:step
for j=1:step
d1=d1*4*(1-d1);
d2=d2*4*(1-d2);
kpr=(pmax-pmin)*d1+pmin;
kir... |
function [tq,q,tu,u,t,p,Q,code]=hydrograph(uhname,rdname,method,...
K,D,R,Iar,A,CN,Tc,units)
% SCS Unit Hydrograph Convolution (R11)
%
% [tq,q,tu,u,t,p,Q,code]=hydrograph(uhname,rdname,method,...
% K,D,R,Iar,A,CN,Tc,units)
%
% Input
% ... |
function [Xkaiser, Xhaar]=imdenoise(filename, sigma)
% Attemps to denoise an image via Kaiser window and Haar wavelet transform.
% Examples:
% [Xkaiser, Xhaar]=imdenoise('Lenna.png', 0.08);
% [Xkaiser, Xhaar]=imdenoise('airplane.png', 0.1);
% The best Kaiser window is found with previous knowledge of the original... |
function [C,Ceq]=compute_nonlcon(initial_alpha_red,Fext,tF,d)
clear theta_minus theta_plus betta XX event output_error
M_bez=6;
angle = 0;
XX=initial_alpha_red(1:10)'; % for full 26 parameters optimization
[betta,theta_minus,theta_plus]=fcn_alpha_red(initial_alpha_red');
count1=0; count2=0;
for i = 1:1:length(d)... |
function [M,N] = PFC1(y,x)
[n,p] = size(x);
xo=x-ones(n,1)*mean(x);
N=1/n*(xo'*xo);
yy=[y,y.^2];
yf=yy-ones(n,1)*mean(yy);
Pf = yf*inv(yf'*yf)*yf';
Xf = Pf*xo;
Sigmaf = 1/n*Xf'*Xf;
M =Sigmaf ; |
function [ results_filename, model_filename ] =...
generate_fnames_for_experiment(cfg_params, hyper_params, ofold, ifold)
% hyp_params is used for generating snapshot filenames (will make a filename
% out of this struct).
hyp_params.method = cfg_params.method_params_str; % Add method name to it.
hyp_params.datase... |
clc, clear all, format long
folder = 'C:\Users\amaur\OneDrive\Área de Trabalho\Eletrônica\TCC1';
F = dlmread(fullfile(folder, 'FFT.txt'));
figure
colormap(gray(1024))
imagesc(abs(fftshift(F)))
axis image
D = abs(ifft2(F));
figure
colormap(gray(1024))
i... |
%% Mainscript Project: Observer Design
clc; clear; close all;
global Ap Bp Cp_OF A_comp B1_comp B2_comp C_comp D1_comp D2_comp HE_rad Np nT
V0 = 2813.32; %(Trimmed Airspeed in ft/s)(= 2.5 Mach)
%%FROM LQR DESIGN:
load LQRdesign
Q_LQR = [qq_LQR, 0, 0; 0, 0, 0; 0, 0, 0]; %LQR Q Penalty Matrix
R_LQR = 1; %LQR R P... |
function [fNeg,phi] = getNeg(formula,args,k)
global W Wtotal Z zLoop ZLoop bigM epsilon;
if length(args)>1
disp('Negation takes a single argument');
assert(length(args)==1);
end
% number of agents
N = length(W);
% number of states
I = size(W{1},1);
% time horizon
h = size(W{1},2)-1;
% Get its constraints
[f... |
function [pValueList] = hotspotPvalueDist(hotspotmapList, pTH, shuffelingFalg, plotFlag)
% claculate the inhibition, excitation rates in ll out hotspot maps
% you need to run first:
% readHotspotList or load 'data\Analysis\hotspotmapList'
if ~exist('plotFlag', 'var')
plotFlag = 1;
end
if ~exist('pTH', 'var... |
clear all;
clc;
load('Data_zheng.mat')
X=data;
% X=Normalize_TPM(X);%%%TPM normalization scRNA-seq count data X
lambda=0.1;
[A] = SR(X, lambda);
for i=1:size(A,2)
r=zeros(1,size(A,2));
ai=A(:,i);
[s,t]=find(abs(ai)==max(abs(ai)));
S(i)=s;
if s>=i
r(s+1)=1;
else
r(s)=1;
... |
clear;
load data1.txt
figure;
x = data1(1:20,2);
z = plot(x,data1(1:20,5),"rx-",x,data1(1:20,6),"g*-",x,data1(1:20,7),"bo-",x,data1(1:20,8),"md-",x,data1(1:20,9),"cp-");
set(gca,'fontsize',24);
title("Variation of entropy of binding with registers");
xlabel("Cores");
ylabel("Entropy");
set(gca,'fontsize',18);
legend("I... |
%% Computer Exercise 1
load('compEx1.mat')
twoD = pflat(x2D);
figure(1)
subplot(1,2,1)
plot(twoD(1,:), twoD(2,:),'.');
title('2D plot of points in x2D');
threeD = pflat(x3D);
%figure(2)
subplot(1,2,2)
plot3(threeD(1,:), threeD(2,:), threeD(3,:), '.')
title('3D plot of points in x3D');
%% Computer Exercise 2
figure(1... |
function [varargout] = eql_ex0_mlp_vel
%% *SET-UP SOIL GEOLOGY*
Vs0_layers = 100; % layers shear wave velocities [m/s]
H_layers = 1000;
f_max = 2000; % maximum frequency to propagate
n = 10;
dH_max = 10;%Vs0_layers./n./f_max;
N_layers = floor(H_layers./dH_max); ... |
%输入信号即冲激信号δ(n)
deltan=impseq(1,1,4000);
%设置差分方程的各个系数
%响应前的系数
b697=[1,-1.7077,1];
b770=[1,-1.6453,1];
b852=[1,-1.5687,1];
b941=[1,-1.4782,1];
b1209=[1,-1.1641,1];
b1336=[1,-0.9964,1];
b1477=[1,-0.7986,1];
b1633=[1,-0.5685,1];
%输入前的系数
a697=[0,0.5204];
a770=[0,0.5686];
a852=[0,0.6203];
a941=[0,0.6736];
... |
function [T, Y]=FO3CNN(parameters, orders, TSim, Y0)
%
% Numerical Solution of the Fractional-Order 3-Cells CNN
%
% D^q1 x1(t) = -x1(t) + p1 f(x1(t)) - s f(x2(t)) - s f(x3(t))
% D^q2 x2(t) = -x2(t) - s f(x1(t)) + p2 f(x2(t)) - r f(x3(t))
% D^q3 x3(t) = -x3(t) - s f(x1(t)) + r f(x2(t)) + p3 f(x3(t))
%
% f... |
function gainswitch330
%根据沈老师的实验参数进行模拟
sigmaas=0.56e-25;
sigmaes=5.96e-25;%受激发射截面
sigmaap=1.52e-25;%受激吸收截面
sigmaep=0.11e-25;
gamal=1+sigmaas/sigmaes;%gamal=1+fll/ful
gamap=1+sigmaep/sigmaap;%gamap=1+fup/flp
c0=3e8;
nindex=1.46;%纤芯折射率
c=c0/nindex;
lanbdap=1.565e-6;%泵浦波长
lanbdas=1.86e-6;%激光波长
h=6.626068... |
function [r, irc]=bbbestpos(rob, pos, prev_pos)
%BBBESTPOS Finds position with closest configuration to current position.
%
% [r, irc]=bbbestpos(robot, pos, prev_pos)
%
% Finds position with closest configuration to current position based
% on distance in joint space.
%
% Input:
% robot .. robot c... |
function [Lambda1_t,Nu1_t,Lambda2_t,Nu2_t]=ppmfEstep(R,mask,mu1,Sigma1,mu2,Sigma2,tau,Lambda1,Nu1,Lambda2,Nu2)
%
% Author: Hanhuai Shan. 04/2012.
%
% E-step of ppmf
%
% k: the rank after decomposition
% M: #movies
% N: #users
%
% Input:
% --data--
% R: N*M, rating matrix... |
% read current from alim
% D1=current1(:,1);
% D2=current1(:,2);
% QF=current1(:,3);
% QD=current1(:,4);
% time=0:0.000016666:0.333316;
% plot(time,current1(:,1))
% save 'current' time D1 D2 QF QD;
load 'current' time D1 D2 QF QD;
n0=1000; % pour filtrage
n1=int16(0.0005/0.0000166666);
nl=12*4;
n2=length(time)/2-nl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.