text stringlengths 8 6.12M |
|---|
% ACCEL - Calculate force and advance velocity
ai = zeros(N,1);
a = zeros(N,1);
% Redistribute force to particles
% For weight equal to zero (NGP)
if weight == 0
for j=1:N
if ((x(j) ~= 0) && (x(j) ~= 1))
if (x(j) <= (gridx(1)+0.5*gridx(2)))
a(j) = -qm*E(1);
end
end
if ((ionx(j) ~= 0) && (ionx(j... |
% 29 April created by Rob Romijnders
% Information is on my github io at
% robromijnders.github.io
clear all
close all
clc
%Command works only when music_data is in the scope of the current folder
direc_list = dir('music_data');
labels = {'mb','dm'};
num_music = length(direc_list);
names_music = {};
[n... |
function str = logical_cond_2str(logical_cond, single_atom_species)
str = '[';
for i = 1:length(logical_cond)
im = logical_cond(i);
if i > 1
str = [str, ' '];
end
str = [str, int2str(im), ' ', single_atom_species{abs(im)}];
if i < length(logical_cond)
... |
function Difusion(order, file)
% Plot frequency map
% plot_fmap('fmap.out')
%
% Laurent S. Nadolski, SOLEIL, 03/04
%
% Change it to use scatter(qx,qy,1,diff)
%% grille par defaut
set(0,'DefaultAxesXgrid','on');
set(0,'DefaultAxesZgrid','on');
if nargin ==0
help (mfilename)
file ='fmap.out';
order=4;
end
if narg... |
function [x,y,z,knotV, ctrlp] = bspcurvefit (x,y,z, varargin)
% Fits a set of 3D points with a B-spline curve.
%
% -------------------------------------------------------------------------
% USE:
%
% [XO, YO, ZO] = bspcurvefit(X, Y, Z) fit a B-spline curve to a set of
% points whose coordinates are X, Y and Z. The coo... |
function nest = create_nest(size,visibility)
range_nest = [-size + 1 + 2*visibility, size - 1 - 2*visibility];
nest = [randi(range_nest),randi(range_nest)];
end
|
function [ lhs ] = split_solve( A, AT, rhs )
%SPLIT_SOLVE Summary of this function goes here
% Detailed explanation goes here
global free_num
% 'split solve'
rhs1 = rhs([1:free_num]);
rhs2 = rhs([free_num+1:2*free_num]);
lhs_c = [rhs1, rhs2];
lhs_c(:, :) = A \ (AT \ [rhs1, rhs2]);
lhs = rhs;
lhs([1:free_num]) ... |
function minRow = selectMinRow(X)
[~,iRow] = min(X(1,:));
minRow = X(iRow,:);
end |
clf;
pet_labels = {'german_shorthaired', 'Abyssinian', 'american_bulldog', 'american_pit_bull_terrier', 'basset_hound', 'beagle', 'Bengal', 'Birman', 'boxer', 'British_Shorthair', 'chihuahua', 'Egyptian_Mau', 'english_cocker_spaniel', 'english_setter', 'Bombay', 'great_pyrenees', 'havanese', 'japanese_chin', 'keeshond'... |
%% Test Normal
rng(0)
t = distribution.Normal.fromMeanStd(-4, 0.2);
locallyCompare(t)
%% Test LogNormal
rng(0)
t = distribution.LogNormal.fromMuSigma(2.5, 0.5);
locallyCompare(t)
%% Test Beta
rng(0)
t = distribution.Beta.fromAB(2, 3);
locallyCompare(t)
%% Test Gamma
rng(0)
t = distribution.Gamma.fromAlphaBe... |
function [xt1]=RungeKutta45(state,step,Drag12state,pnoise)
h=step;
k1=diff_eq(state,Drag12state,pnoise);
k2=diff_eq(state+h*k1/2,Drag12state,pnoise);
k3=diff_eq(state+h*k2/2,Drag12state,pnoise);
k4=diff_eq(state+h*k3,Drag12state,pnoise);
xt1=state+h*(k1+2*k2+2*k3+k4)/6;
end |
function smoothData = singleExponentialSmoother(data, nPoints)
% Calculates single exponentially smoothed data. Typically includes weight parameter
% alpha, but for our purposes alpha=1
alpha = 1;
n = length(data);
smoothData = zeros(nPoints,1);
smoothData(2) = data(1);
for i = 3:nPoints
if... |
function PlotGlobalCoherence(patientnr, nightnr, savefigure)
LoadFolderNames;
load([folderGlobalCoherence 'glo_coh_p' int2str(patientnr) '_night' int2str(nightnr) '.mat']);
h = figure;
imagesc(GC.time, GC.freq, GC.globalCoherence');
set(gca, 'YDir', 'normal');
title('Global ... |
function [ulX, ulY, width, height, newclusters] = CheckClusters(clusters)
% Update the short-term memory of recently seen "clusters", or attended
% regions. Only keep regions in memory for a short period of time before
% forgetting about them.
CUTOFF_THRESHOLD = -60; % number of frames past 0 to inhibit the reg... |
% NL-means algorithm
clc;clear;
image = im2double(imread('lena.jpg'));
% img = img(820:1220,720:1120);
image = imresize(image,[512,512]);
image_size = size(image);
figure(1);
imshow(image);
title('original image');
% parameters initiliazation
L = 9;
h = 0.15;
nlock_size = 2;
window_size = 10;
sigma = 25;
%noise image... |
[d,const_sym] = get_sym(64,'qpsk');
mu = 1.5;
a=1;
epsilon0 = 0.00001;
epsiloni = 0.00000000001;
for k = 1:10
v=0.00000005*10^k;
t(k,1) =v;
initialtime = cputime;
[s,sf,sfup,l]= barrier_window(d,8,[9:15],mu,v,epsiloni,a);
... |
function y=EvaluadorDeNewton2(x,c,xe)
n=length(x);
% m=length(xe);
for i=0:n
if i>0
r(i+1)=c(i+1)*Prod(x(1:i),xe);
else
r(1)=c(1);
end
end
for i=1:n-1
y=r(i)+r(i+1);
end
function y = Prod(x,xe)
n=length(x);
y(n)=xe-x(n);
if(n>1)
y(1:n-1)=Prod(x(1:n-1),xe)*y(n);
en... |
function varargout = daqstopbutton(fig,obj,varargin);
%DAQSTOPBUTTON Add a stop/start button to a data acquisition application
%
% DAQSTOPBUTTON(FIG,OBJ) adds a start/stop button to figure FIG. This
% button can be used to start and stop data acquisition object OBJ.
% DAQSTOPBBUTTON will also delete OBJ wh... |
function [dataout] = ft_regressTFRPower_permute_clusterplot(cfg,data)
%
% Written in MATLAB R2017b
% Last modified by Hause Lin 21-08-18 20:22 hauselin@gmail.com
%% Check input
if ~isfield(cfg,'chan')
error('Indicate one channel!');
end
if isa(cfg.chan,'cell')
error('Indicate only one channel!');
end
if... |
function P_rad_C_total=P_rad_C_nse(n_e, T_e,n_C_0,n_C_1, n_C_2, n_C_3, n_C_4,n_C_5,n_C_6,Vp,Vv,VnD,VnBe,VnC,VnN,VnO);
%free electron power loss due to C radiation including excitation, recombination and bremsstrahlung.
[PLT_C_0,PLT_C_1,PLT_C_2,PLT_C_3,PLT_C_4,PLT_C_5]=PLT_C(n_e,T_e);
PLT_C_M=[PLT_C_0,PLT_C_1,PLT_C... |
%% Boost converter calculations
Vs = 14;
Vout = 28;
Rl = 1000;
C = 20e-6;
esr = 40e-3;
L = 43e-6;
D = 0.5;
fs = 150e3;
Il = Vs/((1-D)^2*Rl);
deltI = Vs*D/(L*fs);
ilmin = Il - deltI/2;
ilmax = Il + deltI/2;
deltVout_esr = ilmax*esr;
C = linspace(8e-8, 20e-6, 1000);
for i=1:1:1000
rippleVoltage(i) ... |
function fdot = Quaterror(f)
R1=0.1*eye(3,3);
Q1=eye(3,3);
%--------------------------------------------------------------------------
q0=f(1);
qv=[f(2);f(3);f(4)];
p1=[f(5) f(6) f(7);f(8) f(9) f(10);f(11) f(12) f(13)];
B1=0.5*[0,-f(4),f(3);f(4),0,-f(2);-f(3),f(2),0]+q0*eye(3,3);%equation(26.2)
v1=-inv(R1)*B1'*... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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#... |
% fVentingPercentage = MassFlowToVentingPercentageQuadraticCase( fMassFlow , strKindOfDuct )
%
function fVentingPercentage = MassFlowToVentingPercentageQuadraticCase( fMassFlow , strKindOfDuct )
%
try
%
switch strKindOfDuct
%
case 'V' % Venting Duct
p1 = -1.885e-05;
p2 = 0.004564;
... |
%Plot and analyze a single time point
function [totRed, totGr] = analyzeSingleTimePoint(param, nStd,bacMat, bacCut,titleStr, plotData)
origDir = pwd;
cd(param.dataSaveDirectory);
load('Analysis_Scan1.mat');
NtimePoints = 1;
boxwidth = 5;
intensitybins = 100:100:4000;
[bkgCut(1),threshCutoff(1)] = mi... |
function[starimg]=recombinePSF(row,col,xmin,xmax,ymin,ymax,prjX,prjY,lcdimg,loclength,lcdmapccd)
%row和col为给出的LCD屏幕上一点,slicer和slicec存的是CCD像素对应LCD小框的中心点坐标
width=(loclength-1)/2;
height=(loclength-1)/2;
tempimg=zeros(prjX,prjY);
camX=xmax-xmin+1;
camY=ymax-ymin+1;
starimg=zeros(camX,camY);
for i=row-height:1:row... |
function test_points_to_lines
a = 0.1;
b = 1;
c = 1;
% Definition of lines
linexs = [0 a (a+b)/2 (a+b)/4 (a+b)/2 1 1.2];
lineys = [0 c c/2 c/4 c/2 0 0];
% Check vertices
xs = [0 a (a+b)/2 (a+b)/4 (a+b)/2 1 1.2];
ys = [0 c c/2 c/4 c/2 0 0];
distances = points_to_lines(xs, ys, linexs, lineys);
... |
%%% Script used to produce Figure Fig A.23 in Chapter 2 of the thesis
%%% Here, we show how the epidemiological criteria for an ASF outbreak
%%% cannot be matched for a varying carcass degradation rate without a
%%% survivor class
%%% Running Simulations representative of Estonia under natural conditions
%%% w... |
%@(#) kinf2mlab.m 1.4 97/11/05 12:23:03
%
%function kinf=kinf2mlab(distfile,option,masfile,void,vikt)
%Available options '3D','BURC','NOBURC' or 'AUTBURC'.
%Default 2D, NOBURC
%If masfile='DISTMASTER' then MASFIL from distfile is used. (Default)
function kinf=kinf2mlab(distfile,option,masfile,void,vikt);
if narg... |
%
% Make cross-sections of 3D objects defined in the Wavefront .obj file
%
% read the data file (Wavefront .obj file saved into a matlab structure, e.g., using read_wobj)
load( 'stomach+duodenum+pancreas.mat', 'O' );
% load( '12140_Skull_v3_L2.mat', 'O' );
% count the number of objects in the file
nobj = 0;
for i = 1... |
function [ ost ] = edgeExtraction( ost )
[row,col] = size(ost);
src = ost;
%边缘检测算子
topso=[1 1 1;0 0 0;-1 -1 -1];
% botso=[-1 -1 -1;0 0 0;1 1 1];
lefso=[1 0 -1;1 0 -1;1 0 -1];
% rigso=[-1 0 1;-1 0 1;-1 0 1];
for i=2:row-1
for j=2:col-1
%取出以改点为中心,与算子同样大小的区域temp
temp=src(i-1:i+1,j-1:j+1);
%垂直方向... |
function [direct_points,mirror_points] = findBoardPoints(imNum,iBoard,img,allPoints,mirrors,cameraParams)
%findBoardPoints
% Detailed explanation goes here
disp(['image ' imNum ': Outline ' mirrors{iBoard} ' mirror checkerboard'])
warning('off','all');
mirror=roipoly(img);
close all;
disp(['image ' imNum ': Ou... |
num = 3000;
%%
c = zeros(num,1);
m = zeros(num,1);
n = zeros(num,1);
hbar = zeros(num,1);
V = zeros(num,1);
%%
alpha_n = @(V) 0.01*(10 - V)/(exp((10-V)/10) - 1);
alpha_m = @(V) 0.1*(25 - V)/(exp((25-V)/10) - 1);
alpha_hbar = @(V) 0.07*exp(-V/20);
beta_n = @(V) 0.125*exp(-V/80);
beta_m = @(V) 4*exp(-V/18);
beta_hbar = ... |
function showFix(wptr, wrect, fix, time)
% show fixation
Screen('CopyWindow', fix.ptr, wptr, fix.rect, CenterRect(fix.rect, [wrect(1), wrect(2), wrect(3), wrect(4)]));
Screen('Flip', wptr);
WaitSecs(time); |
function y = L( v )
[n,m]=size(v);
sigma=0.4;
r=0.05;
D=0.02;
y(1,:)=r*(v(2,:)-v(1,:))-(r-D)*v(1,:);
for i=2:n-1
y(i,:)=i^2*sigma^2/2*(v(i-1,:)-2*v(i,:)+v(i+1,:))+i*(r-D)/2*(v(i+1,:)-v(i-1,:))-r*v(i,:);
end
y(n,:)=n*(r-D)*(v(n,:)-v(n-1,:))-r*v(n,:);
|
function [dictionary] = getDictionary(imgPaths, alpha, K, method)
% Generate the filter bank and the dictionary of visual words
% Inputs:
% imgPaths: array of strings that repesent paths to the images
% alpha: num of points
% K: K means parameters
% method: string 'random' o... |
%% worked out from textbook
function = ustep(t)
y = (t>=0);
end;
|
classdef Wing
%WING
% Units
properties
velocity
mach
end
% Wing Data
properties
c_d
c_l
alpha
step
end
properties
chord
span
sweep % Angle in degrees
taper % Ratio
planform
Asp... |
%
% VLINJEFUNC
%
% Hittar ,givet ett x värde, y värdet där vikingaskeppet skär
% vattenytan. Utnyttjar 'spunkter' som är kända skärningar.
function stop=vlinjefunc(x,spunkter,search)
if search>size(spunkter,1) | x<spunkter(1,1)
stop=0;
else
if x>spunkter(search,1)
stop=vlinjefunc(x,spunkter,search+1);
else
... |
function plotEEV(output,modelparams,images_dir)
% SDDP parameters
params = sddpSettings('yalmip.declareVariables',@()declareVariables(modelparams),...
'algo.McCount',5, ...
'algo.iterationMax',5,...
'termination.checkStdMc',false,..... |
function GraphPoint = CalGarphPoint(Graph)
%计算每个点在图像中的位置
%输入:Graph:图结构
%输出:GraphPoint:图在图像中的位置,二维数组
len = length(Graph);
PointNum = max(Graph{len});
GraphPoint = zeros(PointNum, 2);
temp = 1;
for i = 1 : len
len2 = length(Graph{i});%本层节点数
for j = 1 : length(Graph{i})
GraphPoint(temp, 1) = i*5;
G... |
clear all; close all; clc;
%w2problem9
x=0:0.1:(10*pi)
for idx=1:length(x)
y(idx)=((sin(x(idx)))^2)/x(idx)
end
plot(x,y,'r','linewidth',2)
axis([0,ifn,0,ifn]) |
(* ::Package:: *)
clearvars
close all
x=3:9;
y=[-2 3 4 6 13 14 16];
plot(x,y,'.','markersize',20);
xlabel('x axis')
ylabel('y axis')
% First we fit a line to this data
n=numel(x);
A=[ones(n,1) x']
coeff=A\y'% compute the coeff by least squares
xplot=2:0.02:10;
yfit=coeff(1) + coeff(2)*xplot;
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 [cleanString, cleanValue] = CleanNumberString(string)
% Processes a string hopefully containing a number, cleans it up, and
% returns a cleansed string in engineering format, as well as the sanitized
% value representation
if iscell(string)
string = string{1};
end
cleanValue = sscanf(string, '%g', 1)... |
function He = laminar_He(H)
%
% function He = laminar_He(H)
%
% Provides energy shape factor He as function of shape factor H.
% Based on Eppler & Somers' expressions for H(He).
% For H < 1.855: He = 1.742
% 1.855 < H < 2.591 1.742 > He > 1.573 (analytical inversion)
% 2.591 < H < 4.029... |
function [handlesIV,figureIV] = I_V( Valeurs,sweepVoltage,Npoints,...
FilePathNAME,figname,xlabelstring,ylabelstring)
% This function recevies the valeus from the user after they have bee
% "translated" by the translateData function and calculate and plot
% the I-V
% for the inp... |
function expectValue= E_tau0(lambda,T)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
expectValue = 0 ;
expectValue=1/lambda - (T*lambda + 1)/(lambda*exp(T*lambda)) ;
end
%expectValue=1/lambda - (T*lambda + 1)/(lambda*exp(T*lambda)) ;
%1/lambda - (T*lambda + 1)/(lambda*exp(T*lambda)) |
function decoded = decoder_hamming(received_data)
v = reshape( received_data, [7,ceil(length(received_data)/7)] );
v = v';
q = size(v,1);
fixed = v;
x1 = xor(v(:,4), xor(v(:,5), xor(v(:,6), v(:,7))));
x2 = xor(v(:,2), xor(v(:,3), xor(v(:,6), v(:,7))));
x3 = xor(v(:,1), xor(v(:,3), xor(v(:,5), v(:,7))));... |
function rgb = fuchsia
rgb = [1.0, 0.0, 1.0];
end |
clear all;
close all;
%Il segnale audio è di natura causale.
[y fc] = audioread("test.wav");
y = y(1:8000)'; % prendiamo solo i primi 8000 campioni convertiamo righe in colonne
sinc = 1/fc;
dur = length(y)/fc;
t = [0:sinc:dur-sinc];
binsize = 10; %passo di campionamento delle frequenze.
F = [0:binsize:fc-binsize];... |
function [tag_NUB] = NUBjudge(Process_bitplane1,block_size,fnub)
% 函数输入:Process_bitplane1(重排图像,已自嵌typeimage)
% 此处显示详细说明
[row,col] = size(Process_bitplane1); %统计图像的行列数
block_m = floor(row/block_size); %分块大小为block_size*block_size
block_n = floor(col/block_size); %分块个数为block_m*block_n,每行有block_m个分块
tag_N... |
function print_pso(pesos, nombre_archivo)
save('resultados/pesos_salida.mat', 'pesos')
fp = fopen(nombre_archivo, "w");
for weight_index = 1: length(pesos)
fprintf(fp,'peso de salida pso: %f %s',pesos(weight_index,1),"\r\n");
endfor
fclose(fp);
endfunction
|
function g = sgplvmGradient(params, model)
% SGPLVMGRADIENT sGP-LVM gradient wrapper.
% FORMAT
% DESC is a wrapper function for the gradient of the negative log
% likelihood of an sgplvm model with respect to the latent
% positions and model parameters
% ARG params : model parameters for which gradient is to be... |
% plot kappas vs n_c
%% load data
load('./steplaser_highpower/fitres_all.mat')
%% one typical high power sideband sweep and fit
lnfmt = {'color',[0.8500, 0.3250, 0.0980],'linewidth',1.5};
mkrfmt = {'-o', 'markersize', 4,'MarkerEdgeColor','blue',...
'markerfacecolor', [0, 0.4470, 0.7410]};
fname = './steplase... |
%% This function converts combines 2D FLAIR images to single T1rho image
function out_img = T1rho(in_img,slice_num)
[sx sy sz] = size(in_img(1,1).img);
time = 0:20:100;
time(1) = 1;
%% create image mask for ,threshold set at 25
mask = zeros(sx, sy);
mask(in_img(1,1).img(:,:,slice_num) >= 25) = 1; %thresholding
mask_t... |
classdef MultiPositionResults < Results
properties
PosNames = {};
ByPosition = []; % Flag that says which of the headers is by positon.
PosProperties
end
properties (Dependent = true)%If false, property value is stored in object. If true, property value is not... |
function [ ] = writeBMP(filePath, singleIm1 )
%WRITEGIF Summary of this function goes here
% Detailed explanation goes here
singleIm1(singleIm1<0) = 0;
singleIm1(singleIm1>1) = 1;
im1 = uint8(255*singleIm1);
imwrite(im1,filePath);
return;
|
function [ res ] = holiday( month, day )
holidays = [ 1, 1; 7, 4; 12, 25; 12, 31 ];
res = ismember([month,day], holidays, 'rows');
end |
% least square with constraints
% x = lsqlin(C,d,A,b)
load allUnitrawPSTH.mat
DAindex = strcmp(brainArea, 'Dopamine');
inputIndex = ~ismember(brainArea, {'Dopamine','VTA type3','VTA type2'});
striatumIndex = ismember(brainArea(inputIndex), {'Ventral striatum','Dorsal striatum'});
trialType = [1 2 4 5 6 7];
dataIndex... |
classdef Gvizlayout < Abstractlayout
% Use the graphVIZ package to determine the optimal layout for a graph.
%
% Matthew Dunham
% University of British Columbia
% http://www.cs.ubc.ca/~mdunham/
properties
xmin; % The left most point on the graph axis in data units
xmax; ... |
function DataFileTable = readDataFromRawEcho(RadarFileName)
% 这个位置是写文档用的
% ref https://ww2.mathworks.cn/matlabcentral/answers/385608-how-to-process-a-large-binary-file-with-set-skipping-patterns
% 打开文件为读, 获取文件指针
% 2021/7/15 修改结束标志, 直接按照波门宽度采样,少一个点也没问题
FileHandleId = fopen(RadarFileName, 'rb', 'ieee-le');
if (FileHandle... |
%% Create and Save Figures and Data
RDvideoplot = figure;
plot(avg_bit, avg_PSNR, 'DisplayName', 'Original Video Codec Foreman');
hold on
% plot(avg_bit_still, avg_PSNR_still, 'DisplayName', 'Original Still Image Codec');
axis([0 5 28 44])
ylabel('PSNR [dB]')
xlabel('Rate [bit/pixel]')
title('Rate Distortion Pl... |
% Tim Truster
% 04/30/2013
%
% -Example 3D linear elastic solid element
% -Demonstrates the behavior of shifting dof ordering in FEAP
% -In isw=1 case, the element turns off all dofs that exceed ndm=3 because
% they are not used for pure-displacement.
% -The same solution will be obtained, regardless of DG elem... |
%% Functioning Serial Monitor for Arduino
% The following program receives serial data from an Arduino microprocessor
% and displays the incoming numerical data as a live plot of value over
% time.
%% Clear the workspace and close all figures
clear all
close all;
%% Create serial object for Arduino
s = serialport("COM6... |
function B = heap_increase_key(A, i, k)
D = A;
if k < D(i)
return;
end
D(i) = k;
flag = 0;
while flag == 0
n = int8(parent(i));
p = D(n);
if p >= D(i)
flag = 1;
else
D(n) = D(i);
D(i) = p;
i = n;
end
end
B = D;
end |
%% odd (3Hz) based on jackknife
clear
load pretest.mat
load post_test_odd.mat
idx_odd = [1,2,5,8,11,13,16,19,21,23,25]; % odd
width_pretest = width_pretest(:,:,idx_odd);
fs = 30;
N = 64;
subs = 11;
shift = 0.2;
f = (0:N/2)*fs/N;
t = ((1:24)/fs)'+shift;
alpha = 0.05;
gaussianwindow = 3;
detrendnumber = 1;
k = 4;
for s... |
function y = iGNSFF11(k, eps_out, eps_in, rc, n, x, rr, rs, pr, ps, zr, zs, i, j)
%%% - 09.10.2017 -
%%% calculates the integrand of the scattered part of the Green's tensor of the fiber;
%%% k - k-vector value, 2pi/\lambda_0;
%%% eps_out, eps_in - eps outside and inside
%%% rc - radius
%%% n - mode order
%%% x... |
function showFunctions(data)
text(1,250,char("Z="+num2str(mean(data))))
text(1,230,char("Ra="+num2str(roughness(data))))
text(1,210,char("Rq="+num2str(rootMeansSquare(data))))
[max,min]=maxPeakDepth(data)
text(1,190,char("Max="+num2str(max)))
text(1,170,char("Min="+num2str(min)))
text(1,150,... |
function [idlTotal,optModels,LL,selfanalysis] = runEbFret(data, dt, model, params)
% runEbFret Empirical Bayes model optimization and idealization.
%
% [IDL,MODEL] = runVbFret(DATA,STATES) finds the most likely model given the
% data using the empirical Bayes method (see below) and creates idealized
% FRET tr... |
SNRdB=0:0.5:8;
BER=zeros(1,17);
for v=1:1
sum=0;
for var=1:2000
K=4;
g1=[1 1 0 1];
g2=[1 1 1 1];
k=500;
p=0.5;
input_encoder=randi(2,1,k)-1;
a=zeros(1,K-1);
input_encoder=[input_encoder,a];
%disp('input_encoder : ');
%disp(input_encoder);
init_input=... |
function [DataN,DataID]= mGlobe_interpolation(LonI,LatI,DataI,LonN,LatN,continent)
%MGLOBE_INTERPOLATION Interpolation of spherical/ellipsoidal data
% Function is used for the interpolation of data in ellipsoidal
% coordinates, i.e. with a jump at the 180 deg meridian, e.g. for
% longitude [..179 179.5 -179.5 -179..]
... |
function [batteryChange, currentX, currentY] = droneMovementWithoutCorrection(goalX, goalY, currentX, currentY, meanA, meanR, SDR, SDA,numberOfIntervals, batteryChange)
for n=1:numberOfIntervals
hyp(n)=sqrt((goalX(n)-currentX(n)).^2+(goalY(n)-currentY(n)).^2);
%number=randi(length(randDists));
%randomR... |
function Texture = GTexture(Taille,Param)
%
%function Texture = GTexture(Taille,Param)
%
%Taille : taille de la texture generee
%
%Param : si Param est un nombre n, le masque est
% la matrice identite n*n;
% si Param est un vecteur [n,a], le
% masque est une matrice n*n remplie de a;
% ... |
% First Program in MATLAB, useful for clearing terminal as well as testing
% MATLAB itself
fprintf('Hello World!/n');
clc
|
close all;
clear;
clc;
% Phase 1 Test cases
Tinf = 20;
% Set the dimensions
Lz = 0.5;
Lx = 0.5;
Ly = 0.5;
Pp = 0.4; % exposed perimeter of the pipe
% Set the material properties - km for metal, ke for environment
km = 12; % W/ (m * deg K)
ke = 8; % water conduction
% Define the convection to the environment
h =... |
function da = forwardprop(dn,n,a,param)
%RADBASN.FORWARDPROP Forward propagate derivatives from input to output.
% Copyright 2012-2015 The MathWorks, Inc.
if isa(dn,'gpuArray')
da = iForwardpropGPU(dn,n,a);
else
da = iForwardpropCPU(dn,n,a);
end
end
function da = iForwardpropCPU(dn,n,a)
[S,Q,N] = siz... |
function [ data_env ] = SignalEnveloppe( data, time_window )
%DATA_ENVELOPPE returns the enveloppe of the frequency power from the data
% Computes window's average based
% Size of window calculated from n% of the datasize
B = 1/floor(time_window*ones(time_window,1));
data_env = filter(B,1,data);
end
|
function var=profile_variables(pf)
row_size=size(pf,1);
if row_size==1 & length(pf{1,1})==0
var=[];
else
var=[];
for i=1:row_size
var=union(pf{i,3},var);
end
end |
function s = CS4640_FT_sum(im,u,v)
% CS4640_FT_sum - Fourier Transform sum
% On input:
% im (MxN float array): input image
% u (float): x frequency value
% v (float): y frequency value
% On output:
% s (complex): Fourier Transform sum
% Call:
% s = CS4640_FT_sum(im,2,3);
% Author:
% T. Henderson... |
%% Fig10
% please run Cal_ESMs_2.m before running this code
color2=colorscheme_RGB.precipitation_8_RGB;
Pre_b585_126_m10_change=squeeze(mean(Pre_rec_b585_126_m10(:,:,673:1032,:)-Pre_rec_b585_126_m10(:,:,1:12*30,:),3)*12);
Pre_b585_245_m10_change=squeeze(mean(Pre_rec_b585_245_m10(:,:,673:1032,:)-Pre_rec_b585_245_m... |
clear
close all
color_order = [ 0 0.4470 0.7410
0.8500 0.3250 0.0980
0.9290 0.6940 0.1250
0.4940 0.1840 0.5560
0.4660 0.6740 0.1880
0.3010 0.7450 0.9330
0.6350 0.0780 0.1840];
folder = uigetdir();
listing = dir(folder);
int_array = false(length(list... |
%interpolation
clear
clc
upper = input("Input the upper");
lower = input("Input the lower");
upVal = input("First val");
lowVal = input("Second val");
intVal = input("Input the value needs interpolates");
gradient = (upVal-lowVal)/(upper-lower);
b = upVal-gradient*upper;
finalVal = gradient * intVal + b
|
function [output1] = dT_LeftThighJoint(var1,var2)
if coder.target('MATLAB')
[output1] = dT_LeftThighJoint_mex(var1,var2);
else
coder.cinclude('dT_LeftThighJoint_src.h');
output1 = zeros(4, 4);
coder.ceval('dT_LeftThighJoint_src' ...
,coder.wref(outp... |
function [centroid,radius]=findBoundingSphere(object)
% Finds a bounding sphere for an object.
bbox=findBboxVertex3D(object);
sides=bbox(2:2:end)-bbox(1:2:end);
radius=0.5*max(sides);
centroid=[0.5*(bbox(1)+bbox(2)) 0.5*(bbox(3)+bbox(4)) 0.5*(bbox(5)+bbox(6))];
|
%
function IPM = ipm_on ( point, fungrad, name, factor , maxbar ,...
mu0 , TOL , separate );
%--------------------------------------------------------------------------
%
% IPM An Interior Point Method
% developed by the OTC at NU team.
% July, 2002.
%
%... |
clc
% clear all
close all
% Randomize signals.
% x = randperm(100, 40);
% h = randperm(100, 10);
% Reverse saw signal vs ramp signal.
x = repmat([20:-1:1, zeros(1, 5)], 1, 4);
h = 1:1:100;
% Convolution between real and imaginary part of same signal.
% complex = exp(1i * pi/18 .* (0:25 * pi));
% x = real(complex);
%... |
function [neighbors_list] = get_neighbors(b, block_indices, indices, neighbors_array)
if length(indices) == 1
if indices(1) == block_indices(1),
count = 1;
else
if indices(1) == block_indices(2),
count = 2;
else
count = 3;
end
end
end
if length(ind... |
% contrast experiment
contrast=linspace(0, 1, 5);
size=2:2:12;
nc = [5 6 5 6 4;
4 6 8 9 9;
6 5 7 10 8;
3 5 8 9 10;
6 5 8 10 9];
% image(contrast, size, pc);
% colormap(gray(10))
% ylabel('contrast')
% xlabel('size');
set(gca, 'XTick', contrast)
set(gca, 'XTickLabel', contras... |
function M = linearSourceTerm1D(k)
% Matrix of coefficients for a linear source term in the form of k \phi
% in 1D cartesian grid.
% k is a matrix of size [m,1], i.e., internal cells
%
% SYNOPSIS:
%
%
% PARAMETERS:
%
%
% RETURNS:
%
%
% EXAMPLE:
%
% SEE ALSO:
%
% extract data from the mesh structure
Nx = k.domain.dims(... |
function h = f_hist(Y)
% - create a normalized histogram plot of a column vector
%
% USAGE: h = f_hist(Y);
%
% Y = column vector of sample observations
% h = graphics handle
%
% SEE ALSO: hist
% -----Notes:-----
% Portions of the plot routine are modified after Mike Sheppard's 'allfitdist'
% function and my 'f_johnson... |
function targets = bbox_transform(ex_rois, gt_rois)
% Copyright (C) 2016 Hakan Bilen.
% All rights reserved.
%
% This file is part of the VLFeat library and is made available under
% the terms of the BSD license (see the COPYING file).
ex_widths = ex_rois(:, 3) - ex_rois(:, 1) + 1.0 ;
ex_heights = ex_rois(:, 4) - ex_r... |
function [flag, appr] = getDirHSV1(thisModel, Mdl, path1, path2, pathmask)
n_f = 5;
bins_hsv = [16 4 4];
parts = [0 0.5 1];
%{
path1 = 'D:/Documents/MTMCT/dataset/frames/';
path2 = 'E:/frames/';
pathmask = 'D:/Documents/MTMCT/dataset/masks/camera';
%}
% flag, whether the dir is valid; appr, appearance of... |
function [Yo,Uo] = Recortador(Yi, Ui, eq, var)
%RECORTADOR(Yi, Ui, eq, var)
% Recorta los valores del vector Yi y Ui en torno al punto de equilibrio.
%
% Ecuación del tipo y(k) = f(u(k), ...). Yi es el vector [y(1) ... y(n)]'
% y Ui = [u(1) ... u(n)]'. Recorta los valores de la salida Yi y la entrada
% Ui para ... |
% by Johnny MOON
live_buy=live_buy_orders_list(live_buy_orders_list(:,7)==1,:);
[prices,~,rowIdx]=unique(live_buy(:,3),'rows');
subtotal=accumarray(rowIdx,live_buy(:,4),[],@sum);
buy_lob_depth=sortrows([prices,subtotal],-1);
live_sell=live_sell_orders_list(live_sell_orders_list(:,7)==1,:);
[prices,~,rowIdx]=u... |
function Path_PLaning(OI,OF,TH4) % function take as input initial and
% final position and orientation
a1=1;
a2=1;
d1=1; % definition of robot parameters
d2=.1;
d=.1;
L=.3;
Xi=OI(1,1);
Yi=OI(2,1); % defi... |
close all;
clear vars;
sims=2000;
n=20;
x5=[];
y5=[];
t5=[];
for j=1:sims
x2=zeros(1,n);
y2=zeros(1,n);
av=zeros(1,n);
j=1;
x=0;
y=0;
for i=1:n
tmp1=randi([1,100]);
if(tmp1<=19)
y=y+1;
end
if(tmp1>19&&tmp1<=43)
y=y+1;
x=x+1;
end
if(tmp1>43&&tmp1<=60)
... |
clear
clc
close all
more off
t =linspace(-10,10,1000);
plot(t, f(t))
axis([-10 10 0 5])
|
% Random Arrival Model
% function percentage = RandomArrival(noofUAV,a,b)
% collision=0;
% randomArrival = (b-a).*rand(noofUAV,1) + a;
% for n = 1: (length(randomArrival)-1)
% firstpacketarrival = randomArrival(n);
% for k = n+1: length(randomArrival)
% if(n==k)
% continue ;
%
% else
% ... |
%% Assignemnt 4 Part 1: Formulation of MNA Analysis Base
%% Part 1
clc
%% Parameters
G1=1/1;
C2=0.25;
G2=0.5;
L=0.2;
G3=0.1;
G4=100;
G5=1/1000;
ALPHA=100;
Vin=10;
vx=-10;
%% Construction of G, C and F matrix
%X=[V1 Iin V2 V3 V4 V5 IL I4]
G=[-G1,1, G1, 0,0,0,0,0; ...
G1,0, -G1-G2,0,0,0,-1,0;...
0,0,0,-G3,0,0,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.