text stringlengths 8 6.12M |
|---|
function bpm_setattn(Prefix, RFAttn)
if nargin < 1 || isempty(Prefix)
Prefix = getfamilydata('BPM','BaseName');
end
if nargin < 2 || isempty(RFAttn)
% Just a start
if getdcct < 40
RFAttn = 0; % Multibunch
% RFAttn = 12; % 2-bunch
elseif getdcct < 60
RFAttn = 4;
elseif get... |
function [y,x] = bspline_basis(j,n,t,x)
% B-spline basis function value B(j,n) at x.
%
% Input arguments:
% j:
% interval index, 0 =< j < numel(t)-n
% n:
% B-spline order (2 for linear, 3 for quadratic, etc.)
% t:
% knot vector
% x (optional):
% value where the basis function is to be evaluated
%
% Output a... |
function [ numSwitch ] = averageNetwork_numSwitch( ...
subject_id, diffusion_rate, parameter, clusterMethod, temporalFactor )
% compute number of switches at first scan training for a given subject of
% particular type of training module (1 - EXT, 2 - MOD, 3 - MIN), use
% diffusion distances by averaging all brain ... |
function re_ftimg = featureExtraction(img)
[row_img column_img byte_img] = size(img);
global g_template;
convimg = imfilter(img,g_template);
global g_siltpRate g_siltpRange;
grayimg = grayImage(convimg);
% rgbimg = rgbVector_2(convimg);
rgbimg = rgbNormal(convimg);
siltpimg = R_siltpCodingC(grayimg... |
function plot_nodes_in_cortex_new_223 (V,col)
hold on
% % PLOT CORTEX
cortex.path='MNI152_T1_2mm_brain_mask.nii';
cortex.pial=mapPial(cortex.path);
cortex.color=[0.9 0.9 0.9];
cortex.transparency=0.3; % To view only opaque cortex =1;
cortex.val=0.2;
redux=1;
sregion=smooth3(cortex.pial);
psregion=patch(isosurface(sre... |
function [devRegion,varRegion]=getRegionDevVarInner(nodeIDoutRectCoarse,regionID,yt,VarYt,iMnp)
%
% Gets deviations and variance corresponding to the key oints in the region being measured
% from the deviation information of the keypoints for whole part
% remaps yt to global and then picks key points corresponding to a... |
clc
% in= Sinal;
in=Sinal;
% out=lopass_butterworth(T_o,0.2,10,2);
out=T_o;
% out=t_o;
% fator de decimação a ser usado
fd=1;
% período de amostragem em segundos
Ts=fd*1;
% referir os dados ao ponto de operação em que foi feito o teste
[a b]=size(in);
[c d]=size(out);
u=in(1:fd:a);
y=out(1:fd:... |
clear variables
N=0;
d=1;
grid = Grid(1, 100);
x0 = ones(N+2,d);
x0(N+2, 1) = 0;
for i=2:d
x0(N+2,i) = 0;
end
A = [0 0 0; 0.5 0 0; -1 2 0];
b = [1.0/6.0 2.0/3.0 1.0/6.0];
s = 3;
rk = RungeKutta(grid, A, b, s, x0, N, d);
solu0 = zeros(N+2, d, grid.n, rk.s);
% solu = zeros(N+2, d, grid.n, rk.s);
% for... |
function u1=parabolic(u0,tlist,b,p,e,t,c,a,f,d,rtol,atol)
%PARABOLIC Solve parabolic PDE problem.
%
% U1 = PARABOLIC(U0,TLIST,B,P,E,T,C,A,F,D) produces the
% solution to the FEM formulation of the scalar PDE problem
% d*du/dt-div(c*grad(u))+a*u = f, on a mesh described by P, E,
% and T, with bou... |
% SOS in Morse on Arduino buzzer (version 1) % Assumption alert! we assume that you’re already connected to the
% board in MATLAB and that
% the connection object is called “a”.
% ---------- 's' ------------
clear all; close all
a=arduino('COM8','uno')
% 'long'
writePWMDutyCycle(a,'D5',0.33); pause(0.4); writeDigitalP... |
function [eigvector] = FNPAQR(data, class,options)
% Fuzzy Neighbourhood Preserving Analysis with QR-Decomposition
%
% [eigvector] = OFNDA(data, class, options);
%
% inputs
% ======
% data: feature matrix (nSmp x nFea)
% nSmp: no. of smaples.
% ... |
% obsolete not used function
function fiducial(ax)
hold(ax,'on')
mz = [1290 1080]/2;
gz = [1270 1920]/2;
azshift = 19.7;
ppd = 69/2;
plot(ax,mz(1),mz(2),'ro','MarkerFaceColor','r');
plot(ax,gz(1),gz(2),'go','MarkerFaceColor','g');
% plo... |
function [] = fmriGP_showkernel(ytr, hypers_learned, gp_input, gpmodel, varargin)
pnames = {'lims','orientation','labels'};
dflts = {[],0,{'Run','Time','Z','Y','X'};};
[lims, orientation,labels] = internal.stats.parseArgs(pnames, dflts, varargin{:});
lblsz = length(labels);
% ylabels = {'Run','Time','Z','Y'... |
% Example 4.9
% from Parameter Estimation and Inverse Problems, 3nd edition, 2018
% by R. Aster, B. Borchers, C. Thurber
% This script generates the G matrix, mtrue, dtrue, and noisy d
% then solves the inverse problem in various ways
% make sure we have a clean environment
clear
rand('state',0);
randn('state',0);
... |
function [scales,f,scale2Freq,scaleTickFun]=genWaveletScales(typeWavelet,freq,varargin)
% ** function scales=genWaveletScales(typeWavelet,freq,varargin)
% generates wavelet scales given a range of frequencies of interest, the
% type of wavelet and the frequency overlap (see below). Scales are
% determined according to ... |
function x=lab5b(s,fs)
a=1;N=4;
fc=[50 150 250 350 450 570 700 840 1000 1170 1370 1600 1850 2150 2500 2900 3400];
t=1:160;
t1=160-t;
t=t/fs;
t1=t1/fs;
pt=[];
gt=[];
ERB=24.7+0.108*fc;
b=2*pi*ERB*1.019*(-1);
h=[];
for i =1:17
pti= a.*t.^(N-1).*exp(b(i).*t).*cos(2.*pi.*fc(i).*t);
gti= a.*t1.^(N-1).*exp(b(i).*t1).... |
function idx = findclosestcentroids(X, centroids)
K = size(centroids, 1);
idx = zeros(size(X,1), 1); % returns index of closest centroid
for i=1:size(X,1)
temp = X(i,:);
[~,idx(i,1)] = min(sum(((bsxfun(@minus,temp,centroids)).^2),2));
end
|
function eps=evaluate_a1_coef_nu_axis(a1_coef,a2_coef,dPsih,Psih,psi_region1,sign_ksi0,area_region3,x_nu_cont13,r_nu_cont13,x_nu_cont13_initial,r_nu_cont13_initial,omega_cont13,pos_psi_rx,rx,scale_r,scale_omega,NR,Nomega,alpha,nu_values,psi3_nu,Psih_limit13)
pos_psi_rx_round=ceil(pos_psi_rx);
% Deriving the expressio... |
clear; close all; clc
%% Bob's str
BOB.SNR_dB=-6.5;
BOB.transfer_poly=[0.445516026180429,0.633021994668546,0.633086585454355];
%% Eve's str
EVE.SNR_dB=-6;
EVE.transfer_poly=[0.792,0.610];
%%
BOB.Es_N0_dB=BOB.SNR_dB-10*log10(2);
BOB.N0=10^(-BOB.Es_N0_dB/10);
BOB.transfer_poly=BOB.transfer_poly/sqrt(... |
m1 = [0.15 0.2 0.08 0.1]';
C1 = [ 0.20 0.05 -0.010 0.0
0.05 0.30 0.015 0.0
-0.01 0.015 0.100 0.0
0.00 0.000 0.000 0.0];
m2 = [0.15 0.2 0.08]';
C2 = [ 0.20 0.050 -0.01
0.05 0.300 0.015
-0.01 0.015 0.10];
[V1, M1, PWts1] = NaiveMV(m1, C1, 25);
[V2, M2, PWts2] = NaiveMV(m2, C2... |
function output = f()
syms x
x = -pi:0.1:pi
y = 3*x + sin(x)
plot(x,y,'r');
output = diff(y) |
% Description: this script finds the smallest apple in the given
% picture.('apple.jpg')
% Author: zlchen
% Date: 3/8/2019
% Email: zlchen@tongji.edu.cn
clc;clear;
src = imread('apple.jpg'); % load image
subplot(231);
imshow(src);
title('source image');
src_gra... |
function C = semi(X,Y,sigma,alpha)
N = size(X, 1);
% Step 1: Affinity matrix
M = zeros(N, N); % norm matrix
for i = 1:N % compute the pairwise norm
for j = (i+1):N
M(i, j) = norm(X(i, :) - X(j, :));
M(j, i) = M(i, j);
end
end
% Use a Gaussian to form an affinity matrix
K = exp(-... |
function GU_ExM_Janelia_calcPunctaDensityVol_neurolucida(vol1, vol2)
GU_ExM_calcPunctaDensityVol(vol1, vol2,...
'FindLocalMaxima', false, 'MinThreshold', [1450,2200],'Verbose', true,'OTSUGaussKernel', 0.5,...
'MinVoxelVolume', [246, 1008],'ExpansionFactor', 3.62); % sigma 3.9 |
% %% AMC026, one freq
% probe=new_analysis_code(false,false,'probe',false,false);
% probe_lang_resp=new_analysis_code(false,false,'probe',true,false);
% % probe_correct=new_analysis_code(false,false,'probe',false,true);
% % probe_correct_lang_resp=new_analysis_code(false,false,'probe',true,true);
%
% % %% Pretrial, AM... |
classdef PCA < Domain.Domain
%% Domain.PCA provides component variables from base variables
properties (Constant)
VARPREFIX = 'comp';
end
properties
% pca inputs
base_variables
weight_variable % an optional variable that is used as weight
weights % the evaluated weight va... |
%This function calculates the flux in the y direction.
%It returns the Inviscid Flux and the Viscous Flux
function [Ginv,Gv]=yflux(w,Constant,Viscous,Periodic,Enforce_Boundaries)
%w=[rho, rho*u,rho*v,rho*E];
%G=[rho*v,rho*u*v,rho*v^2+p,v*(rho*E+p)];
if(strcmp('yes',Enforce_Boundaries))
[w,p,T]=Set_Boundaries(w,Consta... |
% Specify input membership functions
udark = @(z) 1 - sigmamf(z, 0.35, 0.5);
ugray = @(z) triangmf(z, 0.35, 0.5, 0.65);
ubright = @(z) sigmamf(z, 0.5, 0.65);
% Plot the input membership functions.
fplot(udark, [0,1],20);
hold on
fplot(ugray, [0 1], 20);
fplot(ubright, [0 1], 20);
% Specify the output membership fu... |
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU Affero General Public License as
% published by the Free Software Foundation, either version 3 of the
% License, or any later version.
%
% This program is distributed in the hope that it will be usefu... |
function [R, ss, mS] = maskRegSplitInit(wsReg)
% Split mask to disjoint regions of the 1st frame.
%
% Input
% L - label matrix, h x w (uint16)
% mL - #label
% wsReg - region
%
% Output
% R - region matrix, h x w (uint16)
% ss - new label of each region, 1 x mR
% mS - #labe... |
% RDS to text decoder
index=1
text1 = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
text2 = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
AF = [];
N = 0;
PIN = [0 0 0];
MJD = 0;
Y = 0;
M = 0;
Day = 0;
Hour = 0;
Minutes = 0;
LocalTimeOffset = 0;
PI = 0;
PTY = 0;
che... |
function y = fun1(x);
y = 1/x;
endfunction
|
function [NX, NY, NZ] = d2n_kdtree(dm)
% input is dm in mm
%---------convert depth map to meters
dm = dm./1000; % convert depth map to meters.
[yres,xres] = size(dm);
%---------mask off zero entries
dm(dm==0) = NaN;
Mask = ~isnan(dm);
%---------get real world coordinates.
[X,Y,Z] = get_real_world_ac... |
% Brief : the main script of project 2
% Place : project 2
% Detail : First use the function getDataset() to get the Bezier curve's
% points dataset, then use myBezierDraw() to draw the Bezier
% curve based on the xylist.mat with the dataset or modify the
% pdf's stream with t... |
function trial_data = shuffle_td_labels(trial_data,shuffle_conds)
% function to shuffle labels of trial_data
% Inputs:
% trial_data - trial data struct
% shuffle_conds - cell array of condition labels to shuffle (e.g. shuffle_conds={'learning_block'} will shuffle learning block labels)
% shuffle conditions if ... |
function imagBW = kapur(imag)
% Kapur方法计算二值化阈值
% 通过定义前景类别和背景类别的熵,求使熵最大对应的灰度。这是一种全局阈值的二值化方法。
% 输入:
% imag: 灰度图像(256级)
% 输出:
% imagBW: 二值化图像
% 参考文献:
% 陈爱军,李金宗. 卫星遥感图像中类圆形油库的自动识别方法. 光电工程. 2006, 33(9):96-100
% J.N. Kapur, P.K. Sahoo, A.K.C. Wong. A New Method for Gray-Level
% Picture Thresholding Using the Entropy ... |
function [ validVOGTest, resultVOG, maxdevVOG, VOG, VOGband ] = VOGtest(fidLog, CT, posCSV, LoggedData)
%initialize return parameters
validVOGTest = 0;
resultVOG = 0;
maxdevVOG = 0;
VOG = 0;
VOGband = 0;
try
%get info
[numRows, ~] = size(LoggedData);
VOG = LoggedData(:,posCSV.VoG);
maxdevVOG = ... |
clc
clear variables
close all
%EX1
A=imread('LetterA.jpg');
figure;
imshow(A);
title('Original Image');
%?? WHERE SHOULD WE USE THIS CODE?
F=255*im2double(A);
%Input size
M = size(F,1)
outsize=M;
%Filter Size
n=[3,5,9,15,35];
for m=n
%padded F
P=(m-1)/2;
D= zeros(P,M);
F1=[D;F... |
function [ P,FZ,IA ] = getRunInfoMetric( run )
%for given test run returns pressure, FZs and IAs
P=[];
FZ=[];
IA=[];
% get field names ( of form "r_XXkPA_Xdeg_XXX(X)N" )
strings = fieldnames(run);
for i = 1:length(strings) % for each entry
str = strings{i,1};
if strcmp(str,'testid') || strcmp(str,'tireid') |... |
function varargout = DynaPort_32ft_v1_1(varargin)
% DYNAPORT_32FT_V1_1 MATLAB code for DynaPort_32ft_v1_1.fig
% DYNAPORT_32FT_V1_1, by itself, creates a new DYNAPORT_32FT_V1_1 or raises the existing
% singleton*.
%
% H = DYNAPORT_32FT_V1_1 returns the handle to a new DYNAPORT_32FT_V1_1 or the handle to
%... |
function A = affinity(X1, X2, Y1, Y2, opts)
% compute binary affinity matrix
%
if opts.unsupervised || isempty(Y1) || isempty(Y2)
assert(~isempty(X1));
assert(~isempty(X2));
A = pdist2(X1, X2, 'Euclidean') <= opts.thr_dist;
elseif size(Y1, 2) == 1
assert(size(Y2, 2) == 1);
A = bsxfun(@eq, Y1, Y2');... |
img = imread('rgb.png');
r = im2bw(img(:,:,1));
b = im2bw(img(:,:,3));
g = im2bw(img(:,:,2));
img2 = cat(3,r,g,b);
hsi = rgb2hsi(img2);
imshow(hsi(:,:,1))
imshow(hsi(:,:,2))
imshow(hsi(:,:,3))
imshow(hsi) |
clc
clear all
m = 16;
x = randi([0 1],1,10) %random array%
y = qammod(x,m) %modulation%
plot(y)
hold on
plot(x,'red') |
function [ FootEventStruct, FootEventCell ] = GetFootEvents( vicon,S, Modify )
%Pulls foot events from Vicon.
%Gather data from Vicon
[ LFSframes, LFSoffsets] = vicon.GetEvents( S, 'Left', 'Foot Strike' );
[ LFOframes, LFOoffsets] = vicon.GetEvents( S, 'Left', 'Foot Off' );
[ RFSframes, RFSoffsets] = vicon.GetEv... |
function [data,dwt] = simphotons( dataSize, sampling, model, varargin )
% SIMPHOTONS Simulate fluorophore photophysics
%
% DATA = SIMPHOTONS(SIZE, SAMPLING, MODEL) simulates a photon emission
% photophysical process using the Gillespie algorithm.
%
% SIZE is the number of traces and frames to simulate, respec... |
clc
clear all
close all
video = VideoReader('video1.avi');
nFrames = video.NumberOfFrames;
vidHeight = video.Height;
vidWidth = video.Width;
prevFrame = zeros(241, 321);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for k=1:nFrames
% framedata=read(video,k);
currFrame = read(video,k);
%
currFrame=rgb2gray(... |
% purpose: to generate .vtu file for paraview
% Hirshikesh, Indian Institute of Technology Madras,
%===================================================
clear all
close all
clc
FID = fopen('test.vtu', 'w+');
% import data
% node, element, scalardata, vectordata
filename = 'holecrack_405.mat';
lldata=load(filename);
... |
t = 0:1/2000:2-1/2000;
x = 1+chirp(t-2,4,1/2,6,'quadratic',100,'convex').*exp(-4*(t-1).^2);
%- Calcul the mean of the signal
xMean = mean(x);
%- Compute the hilbert transform of the signal minus the mean
env = abs(hilbert(x-xMean));
%- Add the mean to the envelope
yUp = env+xMean;
yLow = xMean-env;
%- Median of ... |
function [x, y] = latlon2carthesian(lat1_dms, lon1_dms, lat2_dms, lon2_dms)
% Computes carthesian coordinates between two GPS points.
% This method is only valable for small distances
if size(lat1_dms,2) > 1
% Convert dms to degrees
lat1_d = lat1_dms(1) + lat1_dms(2)/60 + lat1_dms(3)/3600;
lon1_d = lon1_d... |
clc;
clear all;
close all;
%% Initialization
dt = 0.1; %timestep
Tf = 10;
T = 0:dt:Tf;
%% Motion: STATIONARY
% %Errors
% omega_std = 0.1 * pi / 180;
% R = diag([0.05,0.05,omega_std]).^2; %System noise (squared) %OG
% Q = diag([0.00335, 0.00437, ]); %Measurement noise (squared) %OG
%
% % EKF Initializat... |
clc;
clear;
load('AdjustedPreparedCRNH02032016GANewton8W2.mat', 'data')
sampleSizes = data.sampleSizes;
allpoints = data.allpoints;
distanceMatrix=computedistances(allpoints, true, 2);
if isOneInfinite(distanceMatrix)
return
end
minBaryCenterPoints= computebarycenterdistributions(sampleSizes, allpoints, distanceMat... |
%% plotVout
function plotVout(Rm, Ro, C, V1, V2)
ns = 1e-9;
t = 0:ns:ns*10^4;
timeLabel = t/ns;
a = (Ro+Rm)/(C*Ro*Rm);
Vout = (V2*Ro)/(Ro+Rm) + ((V1-V2)*Ro)/(Ro+Rm)*exp(-a.*t);
figure;
plot(t,Vout);
axisHandle = gca;
set(axisHandle,'xTickLabel', timeLabel);
xlabel('Time (ns)')
endfunction
|
function [coo, con, bounds, sep, dpnts] = get_lshape_from_square(a, b, m, coo1, con1)
n = (m+1)^2;
coo2 = zeros(size(coo1)); con2 = zeros(size(con1)); nodes2 = zeros(1,n);
coo3 = zeros(size(coo1)); con3 = zeros(size(con1)); nodes3 = zeros(1,n);
west = 1:(m+1):(n-m);
nodes2(west) = west+m; % west2 same as east1... |
function [d,di] = seedoflife(f, fr, opt)
%--------------------------------------------------------------------------
%
% Copyright (c) 2013 Jeffrey Byrne
%
%--------------------------------------------------------------------------
%% Inputs
if ~exist('opt','var')
opt = nsd.opts().sol;
end
%% Descriptor Pooling
n... |
clear;
%profile on;
%% init globals
%global functions
global A
A = eval(['@(w)','[0 -w(3) w(2) ; w(3) 0 -w(1) ; -w(2) w(1) 0]']);
%create GUI
global ge ger;
[ge ger] = createGUI();
%calculate globals:
global r g st;
st = 1;
r = str2double(get(ge.radius,'string'));
g = [0 0 1]'* -9.80665;
%% init... |
function w = Metropolis_Weight(NodeNum,Neighbors)
% update node i
w = zeros(NodeNum,NodeNum);
for i=1:NodeNum
degree = length(Neighbors{i});
for j=1:length(Neighbors{i})
nei = Neighbors{i}(j);
degree2 = length(Neighbors{nei});
... |
function numgrad = computeNumericalGradient(J, theta)
% numgrad = computeNumericalGradient(J, theta)
% theta: a vector of parameters
% J: a function that outputs a real-number. Calling y = J(theta) will return the
% function value at theta.
% Initialize numgrad with zeros
numgrad = zeros(size(theta));
epsilon = 1e... |
xx = input('input first valname = ');
hh = input('input second valname = ');
eval(['load ' xx '.mat;']);
eval(['load ' hh '.mat;']);
%load A.mat;
%load G.mat;
eval(['AK=whos(' '''-file''' ',' '''' xx '.mat' '''' ')']);
eval(['GG=whos(' '''-file''' ',' '''' hh '.mat' '''' ')']);
A11=AK.name;
A22=GG.name;... |
function [] = mesh2povray2(Mesh, meshFName, func, colors)
Mesh.vertexNors = vertex_normal(Mesh);
%
func = (func-min(func))/(max(func)-min(func));
IDX = floor(func*0.999*64) + 1;
%
numV = size(Mesh.vertexPoss, 2);
numF = size(Mesh.faceVIds, 2);
f_id = fopen(meshFName, 'w');
fprintf(f_id, 'mesh2 {\n');
fprintf(f_id, ' v... |
function scatterCluster(V,IDX,K) %%scatter the points in class K
txtidx = textInTopic(K,10000,IDX); %%find all the documents in K
scatter3(V(txtidx,2),V(txtidx,3),V(txtidx,4));
hold on
end |
function error_list = stagewise_evaluate_list_prediction( test_data, S)
%EVALUATE_PREDICTION Summary of this function goes here
% Detailed explanation goes here
% S: N x B
error_list = [];
for i = 1:length(test_data)
error_list = [error_list; (test_data(i).costs(S(i,:))' - min(test_data(i).costs))];
end
end
|
function [training, validation]=split_dataset(dataset, ratio)
[n,m]=size(dataset);
training=dataset(randsample(length(dataset),n*ratio),:);
validation=setdiff(dataset, training, 'rows','stable'); |
function [codedData] = kodujPB( data )
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
% kodowanie/kontrola bledow za pomoca bitu parzystosci
[m,n] = size(data);
codedData = zeros(m, n+1);
for i = 1:m
codedData(i,1:n) = data(i,1:n);
codedData(i,n+1) = mod(sum(data(i... |
function [image_patches, labels] = coord_to_patches(images,imagecentres_cells,imagecentres_negative, radius)
image_patches = [];
labels = [];
for image = 1:length(images)
% image
patches = [];
% size(imagecentres_cells{image});
% size(imagecentres_negative{image});
imagecentres_cells_bot... |
function [AF] = RMSSD(RR_data,t)
N = length(RR_data);
avrg_value = mean(RR_data);
help = zeros(1,N-1);
for i = 1:(N-1)
help(i) = (RR_data(i+1)-RR_data(i))^2;
end
suma_help = sum(help);
rmssd = sqrt(1/(N-1)*suma_help);
nrmssd = rmssd/avrg_value;
if nrmssd >= t %0.1 % https://link.springer.com/artic... |
setMTEXpref('generatingHelpMode',true); % Avoid some artefact (fix issue #5)
%%
mtexdata small
ebsd = ebsd('indexed');
grains = calcGrains(ebsd);
G=gmshGeo(grains);
%% Plot the whole geometry
% The whole geometry can be plotted with the usual plot command:
plot(G)
%%
% The orientation used for plotting is i... |
function [A] = GenerateTransformationMatrices(theta, DH_params)
a_dh = DH_params(1);
d_dh = DH_params(3);
arpha_dh = DH_params(2);
theta_dh = DH_params(4);
carpha = cos(arpha_dh);
sarpha = sin(arpha_dh);
ctheta = cos(theta_dh + theta);
stheta = sin(theta_dh + theta);
A = ... |
%% Coherence check %%
clear all
close all
x=[0:0.2:5000];
y=sin(x);
figure; plot(x,y);
noise=randn(1,length(x));
y1=y+noise;
noise=randn(1,length(x));
y2=y+noise;
figure;
subplot(2,1,1);
plot(x,y1)
subplot(2,1,2);
plot(x,y2)
%%
fs=250;
[cxy,f]=mscohere(y1,y2,fs,fs/2,[1:100],fs);
figure;
plot(f,cxy,'b'); hold o... |
function uprime = FHN(epsilon, beta, u)
% function uprime = FHN(epsilon, beta, u)
%
% INPUT
% beta scalar, fixed parameter
% epsilon scalar
% u Fourier_2D
%
% OR
% INPUT
% xi Xi_vector or small_Xi_vector
%
% OUTPUT
% uprime Fourier_2D
gamma = 0.5;
if nargin == 1
if ~i... |
close all
clear all
clc
% Two training input paterns:
P=[ -1 -1 -1 1 -1 1 1 -1 1; -1 1 -1 -1 -1 -1 -1 1 -1]';
% Training outputs:
T=[0.1 0.1 0.1 ;0.9 0.9 0.9]';
% teach 1-layer network
[w1, b1,te ,tr]=...
trainbp(randn(3,9),randn(3,1),'logsig',...
P,T,[1 100 0.001, 1]);
disp('test network')
disp('Network output=>... |
classdef AppInputs
properties (Access = public)
exp_at_hr,
exp_at_lr,
exp_at_hr,
exp_at_lr,
rec_at_hr,
rec_at_lr,
exp_staff_hr,
exp_staff_lr,
rec_staff_hr,
rec_staff_lr,
exp_students_hr,
exp_students_lr,
rec_students_hr,
rec_stude... |
function [points] = predictAuthorship(w,gam,test,features)
%predictAuthorship Summary of this function goes here
% Detailed explanation goes here
points = [];
[numPapers,n] = size(test);
for i=1:numPapers
x = test(i,features)';
margin = (w'*x - gam);
if (margin > 0) % madison paper
points = vertcat(points,... |
function [ feature ] = lab_histogram( im )
%LAB_HISTOGRAM Summary of this function goes here
% Detailed explanation goes here
nBins = 15;
% im = im2double(im);
% im = rgb2lab(im);
L = im(:,:,1);
a = im(:,:,2);
b = im(:,:,3);
min_elm = min(min(L));
max_elm = max(max(L));
diff =... |
global sbconfig;
% User dependent settings
sbconfig.scanbox_com = 'COM22'; % scanbox communication port
sbconfig.laser_com = 'COM1'; % laser serial communication
sbconfig.laser_type = 'CHAMELEON'; % laser type (CHAMELEON or '' if controlling with manufacturer's GUI)
sbconfig.tri_knob = ... |
classdef CNNfc < handle
% Convolutional Neural Network
% Construction: input layer -> conv layer -> ReLU -> pooling layer
% Note: Grayscale image, without full connect layer
% 我只是个没有感情的滤波器
properties(SetAccess=private)
% conv
filterSize = 2; % size of filter
numFilter = 1; % number of f... |
A = importdata('rcv1_A.mat'); b = importdata('rcv1_b.mat');
%M= importdata('Fused_leu.mat');
n= size(A,2);
cvx_begin
variable x(n)
minimize( 0.01*norm(x,1) )
subject to
A*x== b
cvx_end
|
% Define body frame
qlw = 1.5; len = 1;
fig = figure(); ax = gca;
xb = quiver3(0,0,0,len,0,0,'r-','LineWidth',qlw); hold on;
yb = quiver3(0,0,0,0,len,0,'g-','LineWidth',qlw);
zb = quiver3(0,0,0,0,0,len,'b-','LineWidth',qlw);
xlim([-10 10]); ylim([-10 10]); zlim([-5 15]);
% xlim([-5 22]); ylim([-5 5]); zlim([0 8]... |
% Lab3 AA - 81013 - 81398
% Shift: Tuesday
clear
load digits
N_tests = 1;
epochs = zeros(N_tests, 1);
for i=1:N_tests
net = patternnet([15]);
net.performFcn='mse';
net.layers{1}.transferFcn='tansig';
net.layers{2}.transferFcn='tansig';
net.divideFcn='divideind';
net.divideParam.... |
close all
plot(wykresy.time, wykresy.signals.values(:,1),'r', 'LineWidth', 2)
hold on
plot(wykresy.time, wykresy.signals.values(:,2),'b')
legend('Wartość zadana','Poziom cieczy')
title('Zamknięty układ regulacji')
xlabel('Czas [s]')
ylabel('Poziom cieczy [cm]')
figure()
plot(sterowanie.time, sterowanie.signals.values(... |
function [AUMestimate,AC] = weightestimate_decVar(AC)
% Write this weight estimation function to estimate the all up mass (TOGW)
% based on all physical parameters of the aircraft, including propulsion
% AND WEIGHTS. The key field to return is the new AUMestimate. However, if
% you want, add fields in the AC struct... |
function Mstep(self, Z, U)
% Perform the M-step given latent variables Z,U.
% Mstep(self, Z, U)
%
% Required arguments:
% Z [N x K] expected value of Z, i.e. the posterior cluster likelihoods
% U [N x K] expected value of U, the t-distribution scaling variable
%
% This method updates the fitted model ... |
%计算10名学生6门课程的总分、排名,平均分(后续可自主添加)
f_name='name';name={'张三','李四','王二','小明','李红','小红','张强','辉宏','小二','张飞'};
f_number='Student_number';number={'20210001','20210002','20210003','20210004','20210005', ...
'20210006','20210007','20210008','20210009','20210010'};
f1='Chinese';value1={73,85,94,64,75,85,89,90,80,95};
f2=... |
function example()
% Example of event segmentation and finding corresponding events
% Parameters for creating small simulated datasets
V = 10;
K = 10;
T = 500;
T2 = 300;
% Generate the first dataset
rng(1);
eventMeans = randn(V,K);
eventLabels = generate_event_labels(T, K, 0.1);
simulData = generate_data... |
%This script creates edge images for detecting a colour cross marker
%Threshholds for the colour boundaries
%general threshold
threshold = 200;
%green threshold
gthreshold = 155;
%red threshold
rthreshold = 190;
%blue threshold
bthreshold = 170;
rgbthreshold = 170;
gbrthreshold = 190;
bgrthreshold... |
%%% This program compares each of the probabilistic models for events to all images in a time series and returns the max cross-correlation scores for each comparison.
clearvars *
%%% STAGE 1 - PROCESS TIME-LAPSE IMAGES
% the directory with the time series of interest is identified
timelapsefile = fopen('/Users/eisenl... |
function [sb1] = myCMA2(N, L, EqD, x1, R2, mu)
% input : N - num of sample
% L - length of filter
% EqD - equalization delay
% x1 - rx signal
% mu - step size
% R2 - constant modulus
% output: c - weights of the adaptive filter
% X - training matrix
% e - error for fee... |
function [res] =isT1exist(matrix,n)
%check if T1 exists in Graph G
flag=0;
for i=1:n
for j=1:n
if matrix(i,j)==1
flag=1;
break;
end
end
if flag==0
res=0;
return
end
flag=0;
end
res=1;
return |
m=100
c=10
k=1000
v0=1
x0=10
alpha=.1
|
function RT=RT(temp_recommend)
load('recommend.mat');
total=0;
tp_recommend=temp_recommend;
recommend_list=zeros(1,20);
count=1;
for i=1:20
% disp(['第' num2str(i) '個點']);
maxlink=sum(link(i,:));
for j=1:20
if(link(i,j)==1)
total=total+... |
function pts = intPtsCircleCircle(r1,r2,c1,c2)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
d = c1-c2;
if d == 0
pts = [NaN NaN; NaN NaN];
end
end
|
function jdDpxGratingExp
E=dpxCoreExperiment;
E.paradigm='jdDpxGratingExp';
E.window.distMm=290;
% 2014-4-24: Measured luminance BENQ screen Two-Photon room
% Brightness 0; contrast 50; black eq 15; color temp [R G B] correction = [0
% 100 100] blur reduction OFF; dynamic contrast 0 Resolution 1... |
%convertTiffToPng: Convert every tiff in image in every subfolder to png
%
% USAGE: [] = convertTiffToPng(dir)
%
% INPUT: dir: directory to search through and find all TIFF image in all
%subdirectories.
%
% NOTE: original tiff image will be deleted when this script is run!
%
% AUTHOR: Matthew Jemielita, 8/22/2... |
clear paramsAll;
clear params;
params.Gridjob.runLocal = false;
params.Gridjob.requiremf = 2000;
params.Gridjob.jobname = 'img50PhaseManySamplesFDR0p05maxdx32SmallDt';
params.PhaseSimulation.inActFolder = '../../../../20130726_Paper/Autoencoder/layer1ActNotRectified';
params.PhaseSimulation.inActFilenames = 'act.*.mat... |
function r = LineIntegralDiagonalVPS(vps,n,lambda)
% function r = LineIntegralDiagonalVPS(vps,n,lambda)
%-------------------------------------------------------------------------------
% Author:
% Chang, Ho-Ping (also written as Ho-Ping Chang or Peace Chang)
% National Synchrotron Radiation Research Center
% 101 Hsi... |
function [fWallHeatTransferCoefficient,fWallOutdoorActiveHeatCapacity,fWallIndoorActiveHeatCapacity] = UCtestML3(iLayersNumber,astrMaterials,afMaterialsThickness )
% UCtestML2 calculates wall resistance and active heat capacity for a given
% wall with number of layers "iLayersNumber", materials layout defined in "ast... |
%RAMPGENTABLELOAD - Load a ramp table to a mini-IOC
% rampgentableload(Waveform, IOCName, Channel, Comment, egul, eguf)
%
% Compile: Unix
% >> mex rampgentableload.c
%
% Windows aren't working (compile on a machine with visual C & changed errno to h_errno!)
% >> mex -DWINDOWS rampgentabl... |
function int = Simpson13(f, nSubInt, a, b)
n = nSubInt * 2;
h = (b-a)/n;
x = a:h:b;
fx = f(x);
int = fx(1)+fx(n+1);
int = int+4*sum(fx(2:2:(n)))+2*sum(fx(3:2:(n-1)));
int = int * (b-a)/(3*n);
end |
%Lab3 EE341
%Group members: Graham Arnold, Ting-Yu(Jacky) Wang
%Group member contribution: Each group member contributed equally to this
%script, the script was written collaboratively with both members working
%on the same task.
%% Part 1
load microsoftstock.txt;
a = 1;
b(1:30) = 1/30;
% 30 days moving average
h =... |
path = 'E:\1611_foot_data\1_mobile\m001_mobile\result_01\mask\';
for idx = 1:50:1700
filename = [num2str(idx-1, '%08d') '.jpg'];
img=imread([path filename]);
rows = size(img, 1);
cols = size(img, 2);
for i = 1:4
for j = 1:cols
img(i, j, :) = [0,0,0];
img(rows-i+1, j, :) = [0,0,0];
end
for ... |
function grad = gradient_smooth( xi, A, b )
%GRADIENT_SMOOTH Summary of this function goes here
% Detailed explanation goes here
grad = size(xi,1)*(A*xi+b);
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.