text stringlengths 8 6.12M |
|---|
function a = simpleAbsorption (f_kHz, t)
%
% function a = simpleAbsorption (f_kHz, t)
%
% To get the absorption coefficient at a given frequency and temperature.
% Coefficient is given by:
% a = f^2 * 0.17 / (18 + t)
%
% Inputs:
% -f_kHz: frequency in kHz (could be a vector).
% -t: t... |
classdef PIDcontroller < handle
%PIDcontroller
%
properties
P;
I;
D;
lastAccess; % timestamp
end
properties (SetAccess = private)
dt;
sumError;
lastError;
feedback;
accumulatedFeedback;
end
properties (Access... |
function [soln] = pathFinder(QUAD)
% Minimum snap trajectory generation
soln = []; % generated trajectory;
%% ---------------------------
% EXTRACT PARAMETERS
% ----------------------------
pathx0 = QUAD.x0;
pathxf = QUAD.xf;
if size(pathx0) ~= size(pathxf)
error('Dimensions of x0 and xf do not match');
end
%... |
function handles = osc_dbupdate(osc_message,handles)
% OSC_DBUPDATE - Update current insturment knowledge object by
% adding new XML desciption files
% Check input arguments
if ~isempty(handles.session)
error('orchidee:osc:osc_dbupdate:ImpossibleOperation', ...
'Close current session before updating knowl... |
function[dx]=isham_treat(t,x)
%% isham ode model function for use in treated simulations
% import parameters
global phi alpha mu_M p r u1 tu
% interpolate for current control
u=interp1(tu,u1,t);
% calculate neg bin pgf plus derivatives
h1=h_neg_bin(1);
% mean and variance derivatives
dx=zeros(2,1);
dx(1)=phi ... |
function f_output = un_average_pooling(x)
size_xy=2*max(size(x));
f=zeros(size_xy, size_xy);
for i = 1:size_xy
for j = 1:size_xy
f(i,j) = 0.25*x(ceil(i/2),ceil(j/2));
end
end
f_output = f;
end |
function generate()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Gehler-Shi dataset.
%
dataset{1} = 'Canon1D';
dataset{2} = 'Canon5D';
for i = 1:length( dataset )
diary( [dataset{i} '.csv'] );
generateGS( dataset{i} );
diary off
end
end
... |
function Uninstall_MTEX2Gmsh
if ispref('MTEX2Gmsh')
rmpref('MTEX2Gmsh');
end
fp=fileparts(mfilename('fullpath')); % Path to the present file
rmpath(fp);
savepath; |
% Plot profiles
load pressure_displacement_profiles
fig1=figure;
%here, the groups of two are put as input for each of the y slots, while the x are the same
[hAx,hLine1,hLine2] = plotyy(initial.x,[-initial.cp -optimal.cp],initial.x,[initial.disp optimal.disp]);
set(hAx(1),'YLim',[-1.2 1]) %these 4 l... |
%输入格式举例:[watermarkimagergb,watermarkimage,waterCA,watermark]=dwtspread('girl.jpg','girlwsvd.png',52,'db6',2,0.1)
function [watermarkimagergb,watermarkimage,waterCA,watermark]=dwtspread(input,goal,seed,wavelet,level,alpha)
%读取原始图像
data=imread(input);
data=double(data)/255;
datared=data(:,:,1);%在R层加水印
%对原始图像的R层进行小波分解记录原始... |
% Sampling & reconstruction
clc;
clear; % clears all variables
close all % close all windows
% Creating "analog" signal
t=0:.1:20;
F1=.1;
F2=.2;
x=sin(2*pi*F1*t)+sin(2*pi*F2*t);
% Plotting
figure(1);
subplot(3,1,1);
plot(t,x,'k-');
title(['Original signal: B=',num2str(F2)])
xlabel('t');
ylabel('x(t)');
grid on
% % C... |
Arrena=imread('arrena2.jpg');
resizedArrena=imresize(Arrena,[480,480]); %resizing of arrena
resizedArrenaO=imresize(Arrena,[480,480]);
resizedArrena=resizedArrena(:,:,1)>200&resizedArrena(:,:,2)>200&resizedArrena(:,:,3)>200;
resizedArrena=bwlabel(resizedArrena);
... |
function plr = create_plr_from_outer_cell( antenna_coordinates, user_coordinates )
% Propagation loss ratio from the outer cell regions
if nargin < 2
error('Error: not enough inputs.');
end
num_user = numel(user_coordinates);
num_macro_cell = numel(antenna_coordinates(:, 1));
num_antenna = numel(antenna_coordinat... |
function SinogramC=XuPanelAlignmentWithoutSymmetry(Sinogram,viewNum,detectorPanelWidth,panelIdxBegin,panelIdxEnd,bad_width,interpIndex)
%SinogramC=XuPanelAlignmentWithoutSymmetry(Sinogram,viewNum,detectorPanelWidth,panelIdxBegin,panelIdxEnd,bad_width,interpIndex)
SinogramC=Sinogram;
for PanelIdx=[panelIdxBegin:panelIdx... |
% function mytest()
clc % 清屏
clear all; % 删除workplace变量
close all; % 关掉显示图形窗口
images=[ ];
M_train=3;%表示人脸
N_train=5;%表示方向
sample=[];
pixel_value=[];
sample_number=0;
for j=1:N_train
for i=1:M_train
%读取图像,连接字符串形成图像的文件名。
str=strcat('Images\',num2str(i),'_',num2str(j),'.bmp');
img= im... |
function [bb, Protocol]=init_learn(bb, dataset)
% [bb, Protocol]=init_learn(bb, dataset)
%
% performs some initializations before learning
% G. Raetsch 10.12.99
% Copyright (c) 1998,1999 GMD Berlin - All rights reserved
% THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE of GMD FIRST Berlin
% The copyright notice a... |
function [rgb_spectrogram] = convert_spectro(S, trepr, frepr)
im = imag(S); % input [0-1] image
h = imagesc(trepr*1e6,frepr/1e6,abs(S)); % imagesc handle
cm = colormap(h.Parent); % get axes colormap
n = size(cm,1); % number of colors in colormap
c = linspace(h.Parent.CLim(1),h.Parent.CLim(2),n); % intensity range
ind ... |
% Return RL circuit current
% Parameter :
% V : Voltage, constant for dt
% dt : Time between i_RL and i0
% L : Inductance value
% R : Resistance value
% i0 : Initial current value
function i_RL = RL_current(V,dt,L,R,i0)
% i(t) = i0*e^(-R*t/L) + V/R (1-e^(-R*t/L)
i_RL = i0*exp(-R*dt/L) + (V/R)*(... |
(* ::Package:: *)
(* ::Title:: *)
(*QMRITools JcouplingTools*)
(* ::Subtitle:: *)
(*Written by: Martijn Froeling, PhD*)
(*m.froeling@gmail.com*)
(* ::Section:: *)
(*start Package*)
BeginPackage["QMRITools`JcouplingTools`", Join[{"Developer`"}, Complement[QMRITools`$Contexts, {"QMRITools`JcouplingT... |
%% Reset MATLAB
close all
clear
clc
%%
addpath('excludes');
%% Initialize file paths
testDir = '97BC_2017_01_13_08_12_00_archive';
filePaths = struct( ...
'lightReading', [testDir,filesep,'lightReading.csv'], ...
'activityReading', [testDir,filesep,'activityReading.csv'], ...
'pacemaker', ... |
function [fh,ResAll] = vizDataFitAcrossModels(model,Y,U)
if ~iscell(model)
model={model};
end
if isa(model{1},'struct') %For back-compatibility
model=cellfun(@(x) linsys.struct2linsys(x),model,'UniformOutput',false);
end
fh=figure('Units','Normalized','OuterPosition',[0 0 1 1]);
Nm=length(mode... |
clear
%load('../data/ALLAML.mat');
load('../results/orldata.mat');
load('../results/orlclass.mat');
%load('../results/jaffedata-by_expression_patch_100_32.mat');
%load('../results/jaffeclass-by_expression_213.mat');
V = V'
Y = V1
%V = D'
%Y = classes01
classOrder = unique(Y);
result = []
for iter=1:1
kfold=... |
function [x_forntier1, y_forntier1,label] = neighbourlist_wshed_marker(image,i,j,height,width,label,gray_level,x_forntier1, y_forntier1)
if i==1 && j==1 % check 1st point
% a=image(i+1,j);
% b=image(i+1,j+1);
% c=image(i,j+1);
if image(i+1,j)<=gray_level && label(i+... |
function [R_new,p,B]=Validcorr(R_org,adj)
% ValidCorr is a function for adjusting the correlation matrix form.
% invalid to valid. There are 2 input: R_org is the original correlation
% matrix and adj is the adjustment factor, which need to be higher than
% or equal to zero.
% In this algorithm, the co... |
function P = pad(M, n)
sz = size(M);
P = [[M; [0:n-1, zeros(1, sz(2) - n)]], zeros(1 + sz(1), 1)];
end
% function P = pad(M, v)
% s = size(M);
% P = [[M; v * ones(1, s(2))], v * ones(1 + s(1), 1)];
% end |
function [ examples ] = generate_from_psi( psi, n_examples )
%GENERATE_FROM_PSI Summary of this function goes here
% Detailed explanation goes here
[M,N] = size(psi);
examples = zeros(M,n_examples);
for i = 1:n_examples
rand_col_ind = randi(N,5,1);
rand_weight = randn(5,1);
psi_rand_cols = psi(:,rand... |
clear all ; close all ;
subs = {'alex','dina','genevieve','jeremie','karl','russell','valerie','tegan'} ;
freqranges = {[48,60],[45,60],[60,80],[50,70],[50,70],[50,70],[56,70],[55,70]} ;
lowcomps_outside = {[25,6,48],[26,8,18],[15,16,5],[12,5],[9,7],[25,10,3],[13,7],[14,12,11]} ;
highcomps_outside = {[20,17,8],[... |
clear
clc
close all
addpath Functions
tic
%%
T=0.01 ;
Pu1 = blkdiag( 5,2,5,3) ;
runtime =5000;
effTimeArray = 1 : runtime ;
Xu1 =[0.5;2.1;99;-1.9];
ff = [ 1 T ; 0 1 ] ;
fy = blkdiag( ff , ff ) ;
Z = zeros(2,1);
%%
Xu2 =[45; pi-2 ; 5 ;1.5];
Pu2 = blkdiag( 5,2,5,3 ) ;
%%
sigma1 = 0.3;
sigma2 = 0.3;
Qxyz1 =... |
function [IqD,PAU]=IqD_basis_functions(sval,Au)
%
% Usage: IqD=gen_IqD(sval,Au)
% Decompose the gold autoscattering profile Au into a volume-weighted gold nanocrystal
% radius distribution and creates radius-weighted gold-gold basis functions in the
% distance increment between 1:200 Angstrom and the s-range given... |
%clear all
Vmin = -2.95;
Vmax = 3; %gate voltage
%parameters
global Voff l0 l1 ep D q mo h m Kb hbar d DeltaV T Reg1_2
T = 300; %temperature
% for T=100:20:500
f = figure()
Voff= -3;
d = 20e-9;
l0 = 2.12e-12;
l1 = 3.73e-12; %experimental parameters
ep = 9*8.85e-12; %permittivity of AlGaN
D = 1.001e18; ... |
% function [position2enforce,velocity2enforce] = PeriodicityConstraints(rbm, H, impulseContribution, x0, xEnd, xFlipped)
function [PosPeriodicity,VelPeriodicity] = PeriodicityConstraints(rbm, H, impulseContribution, x0, xEnd, xFlipped)
q0 = x0(1:12);
dq0 = x0(13:24);
qEnd = xEnd(1:12);
dqEnd = xEnd(13:24);
qFlipped... |
function [tM] = random_NOMEM(A, s, tMax, c_eps)
% random - Simulate the 'Friend meetup' Model
% Fast Simulation with minimal memory consumption
% No Graphs
%
% INPUT:
% [A] = NxN Adjacency Matrix of the Network
% [s] = Nx1 Vector of the Intrisic Beliefs
% [tMax] = Maximum number o... |
function [fit_para,V_zfl_next]=fit(V,j)
[row,col]=size(V);%3*5 row=3固定,为3序
V_zfl_next=zeros(row,1); %3*1 3序的下一个值
fit_para =zeros(row,5); %3*3 3序对应函数系数
% fit_para =zeros(row,9); %看设置函数系数的个数来确定 5个系数
frequency=j-1;
for i=1:row %row=3固定,为3序
temp_V=V(i,:);
%fun=inline('a(1)*exp(a(2)*t)+a(3)',... |
%plot histogram of Qs
load('fits_top_atten_39dB_180811.mat')
inds = dev_nums > 50;
p_fits_sel = p_fits(inds);
Qtots = [];
Qis = [];
wls = [];
for ii = 1:length(p_fits_sel)
% ii
p_fit = p_fits_sel(ii);
[Qtot, Q_all] = getQs(p_fit);
Qtots(ii) = Qtot;
Qis(ii) = min([Q_all.Qi_ssided_uc, Q_all.Qi_ssid... |
function [] = write_tangent_points_to_file(path, tangent_points)
fid = fopen([path, 'tangent_points.txt'],'wt');
for i = 1:length(tangent_points)
if (~isempty(tangent_points{i}))
fprintf(fid,'%.15g ', tangent_points{i}.v1);
fprintf(fid,'%.15g ', tangent_points{i}.v2);
fprintf(fid,'... |
%% oscillations
condition(1,1:38)=1;
condition(1,39:56)=2;
condition(1,57:74)=3;
n=1;
litter(1:5)=n; n=n+1;
litter(6:7)=n; n=n+1;
litter(8)=n; n=n+1;
litter(9:14)=n; n=n+1;
litter(15)=n; n=n+1;
litter(16:19)=n; n=n+1;
litter(20:23)=n; n=n+1;
litter(24:30)=n; n=n+1;
litter(31)=n; n=n+1;
litter(32:33)=n; n=n+1;
litter(3... |
function TabObjectDemo(Action);
persistent T;
% function GUOdemo(Action);
%
% Demonstrates the tabobject class.
% The Action argument selects the button callback code
% and should not be supplied from the command line.
%
% Copyright (c) SINUS Messtechnik GmbH 2002-2003
% www.sinusmess.de - Sound & Vibrati... |
% This is a sample code from Appendix A.5 of the following book:
%
% Zhuang Jiao, YangQuan Chen, Igor Podlubny,
% Distributed-Order Dynamic Systems: Stability, Simulation,
% Applications and Perspectives (Springer, London, 2012),
% ISBN ISBN 978-1-4471-2851-9,
% http://www.springer.com/engineering/cont... |
a = imread('436.tif');
subplot(3,3,1),imshow(a);
[M,N] = size(a);
P = 2*M; Q=2*N;
%b
b = uint8(zeros(P,Q));
for i=1:1:M
for j=1:1:N
b(i,j)=a(i,j);
end
end
subplot(3,3,2),imshow(b);
%c
c = move2center(b,P,Q);
subplot(3,3,3),imshow(c);
%d
dtmp = im2double(c);
ft = fft2(dtmp);
d = log(abs(ft)+1);
subpl... |
%% make a figure with 3 panels (from FSL data)
%% some things to think about:
% 1) the script lives in a particular place, where are you going to
% save it
% 2) data? where are they?
% 3) load nifti images?
% 4) what is the function to make a histogram?
% 5) read in text files to get data po... |
%zihang zhou
%861090400
%April 30, 2016
%CS 171
%PS 3i
function problem3
%load data
S = load('phishing.dat');
%split x and y
X = [S(:,1:end-1)];
Y = [S(:,end)];
%prealocate mem for dim 2
sized2 = 0;
for i = 1:size(X,2)
sized2 = sized2 + i;
end
d2 = zeros(size(X,1), sized2);
%calculate dim 2
pos = 1;
for k = 1:s... |
clf;
clc;
clear all;
map =[0,0;60,0;60,45;45,45;45,59;106,59;106,105;0,105];
disp('This example shows a simple procedure for updating your particles');
disp('First create a vector with N botSim object, one for each particle');
num =200;
botSim = BotSim(map);
hold on;
botSim.drawMap();
axis equal;
for i... |
function MoveEdge(app,step)
if app.key_direction == 1
if app.edge_key
if app.edge2 <= app.waveform(1,length(app.waveform(1,:)))- step
app.edge2 = app.edge2 + app.key_direction * app.xstep * step;
app.DrawFigure;
end
else
if app.edge1 <= app.waveform(1,length(app.w... |
%
% rad2dmsstring
%
% Convert angle in radians to DMS.
%
% INPUTS:
%
% rad: Angle in radians.
%
% AUTHOR:
%
% Matthew Wood - mdwood@astro.ucla.edu - 2009-05-11
%
% VERSION:
%
% $Id: rad2dmsstring.m,v 3.1 2009/12/16 00:39:27 matthew Exp $
%
function str = rad2dmsstring(rad)
deg = mod(rad... |
classdef (Sealed) UTestPump < graph.GraphFixture
%UTestBatchLoader Unit test of writing graph batches to files using a
%data pump.
% This class includes unit tests of Writers and related runners that
% save graphs to files.
%=========================== PROPERTIES ===========================... |
function [x] = gaussElim(A,b)
% File gaussElim.m
% This subroutine will perform Gaussian elmination
% on the matrix that you pass to it.
% i.e., given A and b it can be used to find x,
% Ax = b
%
% To run this file you will need to specify several
% things:
% A - matrix for the left hand side.
% b ... |
%% TASK 3: LEAST SQUARES AND OVERFITTING
clear all, close all, clc
load('task3_data.mat', 'x','y');
lam = 1;
figure;
for n = 0:2:14
th_LS = poly_ls(x, y, n);
th_ridge = poly_ridge(x, y, n, lam);
xx = linspace(min(x), max(x), 100)';
yy = secret_function(xx);
yy_LS = xx.^(n:-1:0)*t... |
function [z] = origin(ndim)
% File: origin.m
% Author: Ioannis Filippidis, jfilippidis@gmail.com
% Date: 2011.04.21 -
% Language: MATLAB R2012a
% Purpose: zero column vector of appropriate dimension
% Copyright: Ioannis Filippidis, 2011-
if nargin < 1
ndim = 3;
end
z = zeros(ndim, 1);... |
features_raw=[0 % r_peak
1 % r_peak_value
1 %rr_pre_interval
1 %rr_post_interval
1 %p_onset
1 %p_onset_val
1 %p_peak
1 %p_peak_va
0 %p_end
1 %p_end_va
1 %qrs_onset
0 %qrs_onset_val
1 %qr... |
function plot_cov_ellipse(mu, covMat, varargin)
% PLOT_COV_ELLIPSE plots covariance matrix as a linear a transformation
% specified by mean M and covariance C Dimentionality of
% should match M and C
%
% Syntax: PLOT_COV_ELLIPSE(mu, covMat, 'showMean' true, ...
% 'legendText', "abc", 'labe... |
%%
% * Замена переменных. Исследование сетки с автоматическим выравниванием экстремумов.
% * ksi = 1/y; delta - экстремумы, полученные на сетке с ksi.
% * eta(i) = ksi(i) + 0.5*(ksi(i+1)-ksi(i-1))*tau*(1+sqrt(delta(i-0.5)/delta(i+0.5)))/(1-sqrt(delta(i-0.5)/delta(i+0.5)))
% * tau = 0.5
% tau = 0.5;
% tau= 1;
%... |
clearvars;
close all;
clc;
I = (imread('lena.bmp'));
figure;
I = imresize(I,[128,128]);
subplot(2,3,1);
imshow(imadjust(I,[0, 1],[0, 31/255]),[]);
subplot(2,3,2);
imshow(imadjust(I,[0, 1],[0, 15/255]),[]);
subplot(2,3,3);
imshow(imadjust(I,[0, 1],[0, 7/255]),[]);
subplot(2,3,4);
imshow(imadjust(I,[0, 1],[0, 3/355]),... |
function [fnorm8,kspace,RE,IM] = csireconabs_20170319(path,lb,deblurring)
% syntax: [fnorm8,RE,IM] = csirecon(path,lb,deblurring
% code by Steve Kadlecek.
% edited by MP on 10/2/15
% close all;
% updated by MP to check the bandwidth
% updated by MP to give the real and imaginary signals as an output.
%
% 6/19/16
% ... |
% CoFE SOL 101 - Linear statics solution and sensitivities w.r.t sizing design variables
% Anthony Ricciardi
%
% Required Inputs:
% K_G = [ndof,ndof] Global elastic stiffness matrix
% M_G = [ndof,ndof] Global mass matrix
% Gm = [length(m),length(n)] Global multipoint constraint matrix
% p = [ndof,1] Global f... |
function comparts
% Solution of a linear compartment model with constant input
% using MATLAB expm
% example see: Walter / Contreras p.181
% $Ekkehard Holzbecher $Date: 2006/04/08 $
%--------------------------------------------------------------------------
T = 10; %... |
function s = fixedlengthint(num,le,align)
% generate string s that contains the integer num
% and always has total length le.
% if align = 'l', will left align num
% if align = 'r', will right align num
s = num2str(num,'%i');
ls = length(s);
if ls > le
fprintf('warning: number longer than le. Printing full numbe... |
function [] = indep_test_per_worker_log_2(pathds,pathlistindep,nodeidx,nNodes,alpha,N,S,pathlog)
%This function is to be run in parallel on several nodes, it allocate to a
%given node a list of independences to test and log the results in a
%dedicated directory for the HSIC+bootstrap
% Inputs:
% pathds = path to ... |
clear all; close all; clc
addpath('F:/openEMS/matlab');
addpath('F:/openEMS/hyp2mat/matlab');
physical_constants;
f_max = 20e9;
pcbfile = 'ViaExample.HYP';
CSX = InitCSX();
CSX = ImportHyperLynx(CSX, pcbfile, 'arc-precision', 0.0000254);
FDTD = InitFDTD();
FDTD = SetGaussExcite(FDTD, f_max/2, f_max/2... |
function AO = buildmml_sextupole_harmonic(AO, Field)
AO.SQSHF.FamilyName = 'SQSHF';
AO.SQSHF.DeviceList = [1 1; 1 2; 2 1; 2 2; 3 1; 3 2; 4 1; 4 2; 5 1; 5 2; 6 1; 6 2; 7 1; 7 2; 8 1; 8 2; 9 1; 9 2; 10 1; 10 2; 11 1; 11 2; 12 1; 12 2; ];
AO.SQSHF.BaseName = getname_local('Caen');
AO.SQSHF.DeviceType = {
'Caen SY366... |
opts.offset_dir='F:\Bharti\RGBObjectDetection\data\rgb_object_detection-15-person-test-4794images-offset-rmse-new-loss-new-imdb\Results\143\';
opts.img_dir='F:\Bharti\RGBObjectDetection\data\VOC2012\JPEGImages\';
filename='2011_002075';
threshold=500;
bin_size=[1,1];
%load offset
load(fullfile(opts.offset_dir,sprint... |
function [vel] = getVel()
% getVel - Gets the translational velocity of the robot.
% ========================================================================
%
% [vel] = getVel()
%
% Description:
% This function returns an integer value of the current translational
% velicty of the robot.
%
% Output:
% v... |
function F = ActionsInTheEye
F.ReadEyeTrackingData = @ReadEyeTrackingData;
F.CalculateMapping = @CalculateMapping;
end
function valueSet = ReadEyeTrackingData(moviePath)
if regexp( moviePath, '.*ucf.*')
gazeFolder = 'gaze_ucfsa';
regexResult = regexp(moviePath,'\','split');
... |
%% kmeans
% distance between xi and center 1& 2
clc
clear
center1=[3;2];
center2=[4;0];
x=[[1;0],[0;2],[1;3],[3;0],[3;1]]
N=size(x,2);
for i=1:N
disp('iteration i:')
i
distance1=norm(x(:,i)-center1) % distacne to cluster 1
distance2=norm(x(:,i)-center2)
end
|
re=-(sin(-1)+cos(-1))+sin(1)-cos(1);
I1=1/3*sqrt(3)*sin(1/3*sqrt(3))-1/3*sqrt(3)*sin(-1/3*sqrt(3));
I2=5/9*1/5*sqrt(15)*sin(1/5*sqrt(15))-5/9*1/5*sqrt(15)*sin(-1/5*sqrt(15));
I3=1/36*(18+sqrt(30))*1/35*sqrt(525-70*sqrt(30))*sin(1/35*sqrt(525-70*sqrt(30)))...
-1/36*(18+sqrt(30))*1/35*sqrt(525-70*sqrt(30))*sin(-1/... |
function [DmatX,DmatYnorm] = designMatrixBuilder_touchFeature(U,selectedCells,touchOrderFields,viewWindow,numInterpPts)
% v2.0 of decoding design matrix. Instead of interpolating, this function
% bootstraps data in each sampled motor bin then choosing a resampNum to
% grab from each bin to use as the input design matr... |
function [FlagS,R] = STA_LTA_single(X,Th)
%%STA/LTA_Method_in_Akram's_Paper
Fs = 4000; % Sampling frequency
T = 1/Fs; % Sample time
L = length(X);
%%以下为运算主程序段
%CF————特征值
%SS————短序列长度
%LL————长序列长度
% SS = input('请输入Short Window Length:');%Short Time points
% LL = inp... |
function PackCurrent = BattPowerToCurrent(BattPower,X,OCV,model)
global Param
Tc = X(10);
R0 = getParamESC('R0Param',Tc,model); % Ohmic resistance
% Series Resistance
Rtab = 0.000125; % 125 microOhm resistance for each tab
R0_eq = R0 + 2*Rtab; % add tab resistance to cell ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Author: Shamus Roeder
% WAV File Extraction program for the RION DA-20
%
% DA-20 Manual Download Link: https://www.viaxys.com/app/download/10048456/DA-20+Instruction+Manual+40750.pdf
% THIS FILE'S PURPOSE ... |
clear all;
clc;
addpath('.\GridData');
% %% MOPSO parameters
% psomopt.CostFunction = @(x) objfunc_24(x); % Cost Function
% psomopt.nVar = 5*24; % Number of Decision Variables
% psomopt.VarSize = [1 5*24]; % Size of Decision Variables Matrix
% psomopt.VarMin = zeros(1,5... |
clear all
clc
% make dna
d=['atcg']
DNA=datasample(d,1000);
%Detrmine GC content
blockSize=10;
numBlocks=(DNA/blockSize);
A=('a')
T=('t')
C=('c')
G=('g')
for count = 1:numBlocks
% calculate the indices for the block
start = 1 + blockSize*(count-1);
stop = blockSize*count;
% extract the block
block =... |
function [ s ] = calc_s2( a,b,n,x)
s = zeros(1,n);
c = (2/3)*pi*x - (1/3)*pi;
%%calc actual values
s(1)= a(1);
for j = 1:2*n
a(n+1)= a(n+1)*cos(c(j));
end
for k=2:n-1
for j=1:2*n
s(k) = s(k) + a(k+1).*cos(k*c(j)) + b(k).*sin(k*c(j));
end
end
|
function [U_mesh, ax_mesh, ay_mesh] = potential_path_mesh(xs, ys, param)
% param.dim = 2;
% param.m = 2;
% param.n = 2;
% param.xi = 1;
% param.umeta = 1;
% param.rho0 = 0.5;
dim = param.dim;
m = param.m;
n = param.n;
xi = param.xi;
umeta = param.umeta;
rho0 = param.rho0;
q_goal = param.q_goal;
q_obs = param.q_obs;
U... |
function Analyse_Visual_Response(cfg)
spike = mmn_spike(cfg);
if strcmp(spike,'err')
fprintf('Channel %i was skipped\n', cfg.chan)
return
end
log = cfg;
clear SDF sig base_rate uresp_rate pref SI*
for unit = 1:length(spike.label)
%skip excluded spikes
if strcmp(spike.label{unit},'clus0... |
function [KA] = tukeySelfCalib(TF,w,h,numparams,corrs)
%this function , given a camera center and a focal length and a series of fundamental
%matrices computes the error with respect to a fundamental matrix
plotting=0;
[m,numFs]=size(TF);
[Weights]=findRobustWeightsTEST(TF,corrs,w,h,1);
funcOption='regularweighted';
n... |
function Xcorr = fastXcorr(spike_matrix, maxLag)
spike_matrix = sparse(spike_matrix);
num_units = size(spike_matrix, 1);
num_pairs = factorial(num_units) / (2 * factorial(num_units - 2));
Xcorr = zeros(num_pairs, 2 * maxLag + 1);
for iUnit = 1 : num_units - 1
idxXcorr = (num_units * (iUnit - 1) - sum(1 : iU... |
%% EGB342 Assignment 2B Template
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Run the initialise.m script if you have not already done so.
clear all, close all, clc % clearing and preparing a clean workspace.
%
% Please use variable names identified throughout the brief.
% Where p... |
generate_mat('video', 2);
generate_mat('video', 4);
clear;close all;
function generate_mat(dataset, scale)
%% settings
folderrgb = strcat('C:\data\FLIR_ADAS_1_3\', dataset, '\registered_rgb\');
folderir = strcat('C:\data\FLIR_ADAS_1_3\', dataset, '\thermal_8_bit\');
%% generate data
filepathsrgb = dir(fullfile(folde... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%% Design length n MinMax LP Filter %%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Parameter
n = 19 ; % Filter Length
k = (n-1)/2; %
m = k+2; % Local Maximum points = 11
edge = 0.4; ... |
function [s,ds] = pcw_dls( x, t)
%PCW_DLS - Papadopulos Cooper dimensionless solution in the well
%
% Syntax: [s,ds] = pcw_dls( x, t)
%
% x(1) = Cd
% t = time
%
% Description:
% Calculates the Dimensionless solution at the pumping well
%
% Reference: Papadopulos, I.S., and H.H.J. Cooper. 1967. Drawdown in a
%... |
function [error_l2, error_energy, velocity_error, pressure_error] = error_analysis(params, paramsP, ...
stifness_matrix_reference, rhs_reference, parameter_test_set, B_velocity, ...
B_pressure, grid, para_test_1, para_test_2, linear_side_reference, ...
red_dim_velocity, red_dim_pressure, reference_factor)
... |
global t y y1 a b;
temperature (); |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 用MATLAB结合PushBear、TrackingMore API实现物流信息自动推送至微信。
% 功能:
% 定时查询,默认十五分钟查询一次。
% 根据运单号自动判断快递公司。
% 需设置:
% PushBear key;TrackingMore API key
% Author: github.com/chouj
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function [fold_loc, hold_fold_loc] = cv_split_GZSL(task, Ytr, class_order, CV_hold_ind, CV_hold_loc)
fold_loc = []; hold_fold_loc = [];
if (strcmp(task, 'train') || strcmp(task, 'val'))
nr_fold = 5;
labelSet = unique(Ytr);
labelSetSize = length(labelSet);
fold_size = floor(labelSetSize / nr_fold);
... |
function varargout = Biosinergy(varargin)
% BIOSINERGY MATLAB code for Biosinergy.fig
% BIOSINERGY, by itself, creates a new BIOSINERGY or raises the existing
% singleton*.
%
% H = BIOSINERGY returns the handle to a new BIOSINERGY or the handle to
% the existing singleton*.
%
% BIOSINERGY('CALL... |
function c=get_soundspeed(trans_obj,idx_r)
arguments
trans_obj transceiver_cl
idx_r {mustBeNumeric}=[]
end
c=2*diff(trans_obj.get_transceiver_range())/trans_obj.get_params_value('SampleInterval',1);
c=[c;c(end)];
if ~isempty(idx_r)
c=c(idx_r) ;
end
end |
function [Gl Gr]=monogenf(dev,wlfr,Jinc_fr,angle_fr)
% get device parameters
x=dev.node.pos;
nn=dev.mesh.num_nod;
x(nn+1:2*nn-1)=0.5*(x(1:nn-1)+x(2:nn));
x=sort(x);
n_pass=dev.Optical.npass;
Rf=dev.bc.top.Rint;
Rb=dev.bc.bottom.Rint;
if strcmp(dev.bc.top.Rextfile,'constant')
R... |
[x,y] = meshgrid((-10:10),(-10:10));
c = [0 0 0 0 1];
[z dxdy] = zernikeXY(c, [x(:) y(:)], 10);
subplot(1,4,1);
imagesc(reshape(z,21,21),[-1 1]); axis image; colorbar;
subplot(1,4,2);
imagesc(reshape(dxdy(:,1),21,21),[-1 1]); axis image; colorbar;
subplot(1,4,3);
imagesc(reshape(dxdy(:,2),21,21),[-1 1]); axis ima... |
function linearODESolveomarP2X4cooppotent1()
global k1 k2 k3 k4 k5 k6 k7 k8 k9 k10 k11 k12 k13 k14 k15 k16 k17 k18 k19 k20 k21 k22 k21 k22 k23 k24 L10 L20 L30 L40 L50 L60 L11 L21 L31 L41 L51 L61 L12 L22 L32 L42 L52 L62 L13 L23 L33 L43 L53 L63 H1 H2 H3 H4 g1 g2 E1 E2 delta epsilon mu A J V n1 n2 n3 a1 p0 Acell Tsoln I ... |
%/**
% Скрипт создает html-документ с полученными картинками
%*/
clear
close all
clc
BOCsin = 1; BOCcos = 2; BPSK = 3;
farr = 1164:1184; fmax = length(farr); % Нормированный центральные частоты
m8max = 80; n8max = 80;
fprintf('<!DOCTYPE html> \n');
fprintf('<html><head><title>!DOCTYPE</title> \n');
fpr... |
function P=cal_PK(s)
%P=cal_PK(s)
%输入s:B样条曲线参数s
%输出P:[x(s);y(s);|V(s)|;thelta(s);K(s)],K(s)曲率
C=[0 2 2 -2 -2 0 %原始控制点
0 0.5 2.5 2.5 4.5 5];
V1=[1;0]; %起点速度方向
V2=[1;0]; %终点速度方向
L=0.254;
NC=length(C);
%增加控制点,保证过起点和终点
RC=[C(:,1)-V1*L,C(:,1),C(:,1)+V1*L,C(:,2:NC-1),C(:,NC)-V2*L,C(:,NC),C(:,NC)+V2*... |
function [xRef, uRef, xhat] = calc_reference_V3(x_func, y_func, currIndex, finalIndex, deltaT, varargin)
% PURPOSE: Calculates positions and reference feedbacks for the model
% based on the input position functions
%
% INPUTS: x_func and y_func are self-explanatory
% currIndex --> the current index. Will be 1 ... |
function [k,x,val]=dfp(fun,gfun,x0,epsilon,N)
%功能:DFP算法求解无约束问题:min f(x)
%输入:fun,gfun分别是目标函数及其梯度,x0是初始点,
% epsilon是容许误差,N是最大迭代次数
%输出:k是迭代次数,x,val分别是近似最优点和最优值
if nargin<5, N=1000; end
if nargin<4, epsilon=1.e-5; end
beta=0.55; sigma=0.4;
n=length(x0); Hk=eye(n); k=0;
while(k<N)
gk=feval(gfun,x0); %计算梯度
if(norm... |
function [map, edges] = createMap(featureResolution, genomeLength, varargin)
%createMap - Defines map struct and feature space cell divisions
%
% Syntax: [map, edges] = createMap(featureResolution, genomeLength)
%
% Inputs:
% featureResolution - [1XN] - Number of bins in N dimensions
% featureResolution - [1X1] ... |
clear all ; close all;
%{
subs = {'alex','dina','genevieve','jeremie','karl','russell','sukhman','tegan','valerie'} ;
comps = {[4,5,6,7,8,9,10,11,12,13,14,15,17,20,21,22,23,25,26,28,30,38],[5,7,8,9,13,17,18,19,20,25,26,28,29,37,47,58],...
[4,5,6,7,8,9,11,13,14,15,16,17,20,21,23,25,26,27,28,35],[3,5,8,9,10... |
function readAndExposeImages(dir, dirName)
[numFiles, dummy] = size(dir);
for n = 1:numFiles
filename = dir(n).name;
filename = strcat(dirName, filename);
image = imread(filename);
createExposures(image, filename);
end |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2010 - 2015 Moon Express, Inc.
% All Rights Reserved.
%
% PROPRIETARY DATA NOTICE:
% The data herein include Proprietary Data and are restricted under the
% Data Rights provisions of Lunar CATALYST Space Act Agreement
% No. SAAM ID#... |
function [R,means]=train_lda(scores,class);
[m,t]=size(scores);
C = zeros(m,m);
n = max(class);
for i=1:n;
C = C + cov(scores(:,find(class==i))',1)/n;
end;
R = inv(sqrtm(C));
scores = R*scores;
means = zeros(m,n);
for i=1:n;
s=scores(:,find(class==i));
means(:,i) = mean(s')';
end;
|
function mask = dxxmask()
%DXXMASK Summary of this function goes here
% Detailed explanation goes here
mask = [0 0 0 0 0; 0 0 0 0 0; 0 1 -2 1 0; 0 0 0 0 0; 0 0 0 0 0];
end
|
%figure
subplot(2,2,1)
h = animatedline;
h.MarkerSize = 50;
h.Marker='o';
grid on
axis([min(HEOGmV),max(HEOGmV),min(VEOGmV),max(VEOGmV)])
subplot(2,2,2)
g = animatedline;
%h.Marker = 'x';
g.MarkerSize = 10;
axis([0,150,min(ECGmV),max(ECGmV)])
m = decimate(ECGmV,2);
%t = decimate(TimeSec,1);
tt = ... |
StoreVariables
ExportUntouched % I do not want recalculation of model for whole matrix, on Export.
ReferenceModel
model_name = 'SRTM2';
%
% Dialog 1
%
prompt={'k2p'};
[answer, imlook4d_current_handles] = ModelDialog( imlook4d_current_handles, model_name, prompt, {'0.2'} );
k2p = str2num( answer{1});
%
% Dialog 2 ( T... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.