text stringlengths 8 6.12M |
|---|
function [List_Drift_local] = Local_drift(Trajectory,T)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
%Calculates the local exponent \alpha by calculating over T steps the power law
%exponent of the TAMSD over windows of size [1,WindowMax]
%The first T/2 and last T/2 values expon... |
function [Aligned_pulses,Model] = alignpulses(array,reps)
%[Model,Aligned_pulses] = alignpulses(array,reps)
%[poolavail,isOpen] = check_open_pool;
%take mean of columns
Z = array;
M = mean(Z);
[n_samples,total_length] = size(Z);
%uncomment to test performance of fit
%deviation = zeros(reps);
%fprintf('Aligning "true" ... |
function delta = findBestDelta(XTest, R, M, V)
% search for optimal variance regularization toward common variance
% across all conditions
delta = exp(-4:.05:0);
L = nan(size(delta));
idx = floor(length(delta)/2)+(1:2);
for i=idx
L(i) = cove.vloss(XTest, R, M, V, delta(i));
end
assert(~any(isinf(L(idx))))
if L(idx(... |
% Converts a millivolt change to a pulse width based on
% sensitivity measured on ATLAS
function Tout = convertSigtoT(SigOut)
%not used currently as have full /millivolts to freq relationship.
%subslope = log10(exp(1))/(0.026*1.35);
%logI = (SigOut./1000).*subslope;
%logItoF =
%Tout = SigOut.*gm.*ItoF;
% THis relat... |
function values = atgetfieldvalues(ring,varargin)
%ATGETFIELDVALUES retrieves the field values AT cell array of elements
%
% VALUES = ATGETFIELDVALUES(RING,'field') extracts the values of
% the field 'field' in all the elements of RING
%
% VALUES = ATGETFIELDVALUES(RING,INDEX,'field') extracts the values of
% the field... |
classdef(SharedTestFixtures = {DownloadPretrainedCRAFTFixture}) tTextDetection < matlab.unittest.TestCase
% Test for TextDetection
% Copyright 2021 The MathWorks, Inc.
% The shared test fixture downloads the model. Here we check the
% inference on the pretrained model.
properties
... |
#a=[1,1,1,0,0,0;1,1,1,0,0,0;1,1,1,0,0,0;1,1,1,0,0,0;1,1,1,0,0,0;1,1,1,0,0,0;];
#b=[-1,0,1;-2,0,2;-1,0,1];
#c=conv2(a,b);
Output = zeros (size(I,1),size(I,2), "uint8");
I=double(imread('horizonal_weiss_balken.png')); %read image
figure;
subplot(1,2,1), imshow(double(I));
title ("Original");
#I_2=double(I);
In=I; ... |
% open the port, change COM19 to match your port namclce
%[y1,Fs1]=audioread('37-A.mp3');
%[y2,Fs2]=audioread('39-B.mp3');
mySerial = serial('COM4');
mySerial.baudrate=2400;
mySerial.timeout=1000;
mySerial.Databits=8;
record=zeros(1000,2);
i=1;
fopen(mySerial);
disp('Reading...');
t2=0;
t3=0;
while (1)
%pause(0.02);
t... |
clc; clearvars; close all;
% Load geometry
load input_data_2017.mat
% Modulus of elasticity
E = 10e9; %Pa/m^2
% Poisson's ratio
v = 0.3;
ep = [E v];
k = 1e3; % bar stiffness?
% Thickness, plane strain conditions assumed
t = 10e-3; %m
load_dof = 248;
free_nodes = (1:ndof)';
free_nodes(bc(:,1)) = [];
% Extract coord... |
function [J,dJdtheta] = CostAndGradRegularizer(x,y,theta,lambda)
m = length(y);
pos = y == 1;
%calculation cost function J having theta & lambda
J_pos = Sigmoid ( x(pos,:)*theta );
J_neg = Sigmoid ( x(~pos,:)*theta );
J = -( sum( log(J_pos) ) + sum( log (1-J_neg) ) )+ ...
... |
function [DetSolStruct,CovMatStruct]=lnaStruct_v1(y0,t0,t1,M,CovMat0,param,dimension)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% ... |
clear
clc
if(ispc)
addpath E:\EFY_GNSS_INS\base;
else
addpath E:/EFY_GNSS_INS/base;
end
q0 = sym('q0','real'); %%四元数
q1 = sym('q1','real');
q2 = sym('q2','real');
q3 = sym('q3','real');
bwx = sym('bwx','real'); %%陀螺零偏
bwy = sym('bwy','real');
bwz = sym('bwz','real');
rotErr1 = sym('rotErr1','real')... |
%
% Day 12, Advent of code 2017 (Jonas Nockert / @lemonad)
%
content = fileread('day12.in');
[n_id0, n_groups] = solve(content);
fprintf('Number of programs in same group as id 0: %d\n', n_id0);
fprintf('Number of groups: %d\n', n_groups);
assert(n_id0 == 141 && n_groups == 171)
%
% Test sample given in problem desc... |
%---INNER PRODUCT OF SINUSOIDS
N = 40;
n = 0:N-1;
k = 0; % 1, 2, 2.5
omega = (2*pi/N) * k;
x = exp(j * omega * n).';
subplot(211)
stem(n,real(x),'b','Marker','none','LineWidth',2); hold on
stem(n,imag(x),'r','Marker','none','LineWidth',2); hold off
title('Real part = Blue, Imaginary part = Red','fontsize',18)
k = 1;
... |
function SupervisedClassification_Callback(hObject, eventdata, handles)
% This function uses a convolutional neural network, trained in
% "TrainSupervisedClassifier_Callback.m", to classify USVs.
[FileName,PathName] = uigetfile(fullfile(handles.data.squeakfolder,'Clustering Models','*.mat'),'Select Network');
net = l... |
% Probability of getting a 6 in die simulation
y=ceil(6*(rand(1,1000)));
z=find(y==6);
x=length(z);
p=x/1000 |
function [Track] = TrackUTMtoWGS84(x,y,UTMCentralMeridian_result,s_or_n)
n = length(x);
S_unit = ones(n,1);
UTMCentralMeridian_S = UTMCentralMeridian_result * S_unit;
[x1,y1] = UTMXYToLatLon(x,y,s_or_n);
[s_log,s_lat] = MapXYToLatLon(x1,y1,UTMCentralMeridian_S);
[Track] = output(s_log,s_lat);
e... |
%% Set initial info and function
initSeed = 1;
batchSize = 2000;
confLevel = 0.95;
% Time and area
L = 20; XInt = [-L,L];
T = 1; TInt = [0,T];
% Numerical precision, number of points
refN = 2^17;
refh = (TInt(2)-TInt(1))/refN;
N = 2.^(5:13); % Time
h = (TInt(2)-TInt(1))./N;
numN = length(N);
M = 2^11; % Space
dx = (XI... |
classdef vtolController
%
% This class inherits other controllers in order to organize multiple controllers.
%
%----------------------------
properties
hCtrl
zCtrl
thetaCtrl
fe
d
limit
end
%----------------------------
methods
%... |
function getAlphaZeroLift(profile)
%GETAPLHAZEROLIFT Compute the angle of attack at zero lift.
%
% profile.getAlphaZeroLift computes the angle of attack at zero lift of
% the profile.
alpha=profile.naca.alpha(abs(profile.naca.alphaDeg)<90);
Cl=profile.naca.Cl(abs(profile.naca.alphaDeg)<90);
profile.alpha... |
function error = findDistanceErrors(plotBar,fignum,plotName,ad1,ad2,ad3,ad4,bd1,bd2,bd3,bd4,cd1,cd2,cd3,cd4,dd1,dd2,dd3,dd4)
% error = findDistanceErrors(plotBar,ad1,ad2,ad3,ad4,bd1,bd2,bd3,bd4,cd1,cd2,cd3,cd4,dd1,dd2,dd3,dd4)
%
%
dtrue = [0 700 900 1140; 700 0 1140 900; 900 1140 0 700; 1140 900 700 0];
erro... |
%-----------------------------------------------------------------------------
% TEST SCRIPT - For navigator echoes
%-----------------------------------------------------------------------------
%-----------------------------------------------------------------------------
% Load Dynamic series
%--------------... |
%% Description
% This script generates plots of estimates of the states, the ground truth, errors and the
% estimation error standard deviations for first 5 seconds
%% System Initialization
clear all
close all
clc
rho_0 = 3.4 * 10^(-3);
g = 32.2;
k_rho = 2.2 * 10^(4);
x_0_mean = 10^(5);
x_0_var = 5 * 10^(2);
y_0_m... |
% Example 3.12
%
clf;
figure(1)
setfsize(500,300);
echo on
clc
pause % 键入任意键继续
clc
P = [-3.0 +2.0];
T = [+0.4 +0.8];
pause
clc
wv = -4:0.4:7.6;
bv = -4:0.4:7.6;
es = errsurf(P,T,wv,bv,'logsig');
plotes(wv,bv,es,[60 30]);
pause
clc
net=newff(minmax(P),[1],{'logsig'},'traingd','learngd','sse');
net.iw{1,1}
net.b{1}
pause... |
% script to inverse the 3D shear velocity structure of PNG, using ambient noise and earthquake rayleigh wave inversion
% using same 1D initial model
% adding water depth variation
%
% written by Ge Jin, jinwar@gmail.com
clear
tic
load tomo.mat
load png_topo.mat
moho = load('data/moho.mat');
[xi yi] = ndgrid(xnode,yno... |
classdef Atmospheric < dynamicprops
properties(Constant,Hidden)
% Conversion constants
knotsSecondPerMeter = 1.94384449; % knots / (m/s)
feetPerMeter = 3.2808399; % ft/m
gravity = 9.80665; % m/s2
pascalsPerInHg = 3386; % Pa/inHg
millibarsPerPascal = .01; %mbar/Pa
end
properties(Hidden)
... |
% A simple demo to show how to use STSBL-EM to recover ambulatory EEG
% signals after compression. The EEG signals are raw signals recorded
% during car-driving. So there are huge noise in the signals. The signals
% are compressed immediately without any filtering, and later are recovered
% by STSBL-EM.
%
% Author: Z... |
%--------------------------------------------------------------------------
% Gauss_nodes.m
% determines Gauss nodes
%--------------------------------------------------------------------------
% tau = Gauss_nodes(N)
% N: number of nodes minus 1, should be an integer greater than 0
% tau: Gauss nodes
%---------... |
n =1; % Initialise index for position in final result
for i = 1:size(Inormalised_all_ATPase_GFP,1) % loop through rows in matrix of intensity traces Inormalised_all:
Inormalised_row0 = Inormalised_all_ATPase_GFP(i,:); % take that row.
Inormalised_row = Inormalised_row0(Inormalised_row0 ~= 0); % exclude val... |
syms t
A = 0.04;
rho = 1.2;
cw = 0.8;
m = 1.5;
g = 9.8;
eqn = t^2*g/2 - cw*rho*A*g^2*t^4/(2*3*4*m) == 15;
double(solve(eqn,t)) |
function [ alpha, beta ] = resample_alphabeta(Y, Z, theta)
K = size(Y,1);
J = size(Y,2);
%eta for alpha and beta
eta = zeros(K,2);
b0 = zeros(2,1);
B0 = eye(2);
theta_star = ones(J, 2);
theta_star(:,1) = theta;
E = pinv(theta_star'*theta_star + pinv(B0));
e = ((Z*theta_star) + repmat((pinv(B0)*b0)',[K 1]))*E;
for i... |
function [ output_args ] = test_features( input_args )
%UNTITLED3 此处显示有关此函数的摘要
% 此处显示详细说明
end
|
function [sizerange, nodatasize] = marker_size()
global gsettings
% sizerange = 6:.5:20;
% nodatasize = 5;
sizerange = gsettings.marker_sizerange;
nodatasize = gsettings.novalue_marker_size; |
% ego
Large = 1; Orval = 2; Dia45 = 3; Dia135 = 4; Dia90 = 5; Dia180 = 6;
ego_v = 2050;
radius = 184;
sla.pow_n = 2;
target_angle = 180;
param_alpha = (2 * ego_v^2 / (radius^2 * (target_angle * pi / 180) / 2));
turn_mode = Dia180;
dt = 0.001/4;
is_dia_mode = false;
tmp_x = -45;
tmp_y = -45;
%start_offse... |
function fig = CustomVehTypeFig()
% This is the machine-generated representation of a Handle Graphics object
% and its children. Note that handle values may change when these objects
% are re-created. This may cause problems with any callbacks written to
% depend on the value of the handle at the time the object was s... |
fSample = 1500;
nSamples = 1500;
variance = 0.05;
nSegs = 3;
lengthSeg = 500;
freqFunc = @(n) ((1 <= n) & (n <= 500)) .* 100 + ((501 <= n) & (n <= 1000)) .* (100 + (n - 500) / 2) + ((1001 <= n) & (n <= 1500)) .* (100 + ((n - 1000) / 25) .^ 2);
freqSeq = freqFunc(1: nSamples);
phaseSeq = cumsum(freqSeq);
orderFilter = 1... |
clc
clear all
%% Load Data
load('data.mat')
data = reshape(face,[],600)';
% data = zscore(data); % Standardize the data to have 0 mean and std 1
data = data - mean(data,1);
%% PCA
PCA_data = PCA_fun(data);
%% Test train split
test_data = PCA_data(2:3:end,:);
train_data = PCA_data;
train_data(2:3:end,:) ... |
hold on
grid on
plot(averagegroup(r10.Host_Peer_Count,rep),averagegroup(r10.DHT_MsgFwd_Count,rep),'bo-')
plot(averagegroup(r20.Host_Peer_Count,rep),averagegroup(r20.DHT_MsgFwd_Count,rep),'b*-')
plot(averagegroup(r30.Host_Peer_Count,rep),averagegroup(r30.DHT_MsgFwd_Count,rep),'bx-')
plot(averagegroup(r40.Host_Pee... |
%% Interpret Results
node_names = {'O1', 'O2', 'P3', 'P4', 'P7', 'P8', 'T7', 'T8', 'C3', ...
'C4', 'F3', 'F4', 'F7', 'F8'};
nnode = length(node_names);
merge_nodes = [ 3 5;... % 'P3' + 'P7' => 'PL'
4 6;... % 'P4' + 'P8' => 'PR'
11 13;... % 'F3' + 'F7' => 'FL'
... |
% An algorithm to compute the centroid point.
%
% Please cite the following paper when using this algorithm:
% M. Gouttefarde, J. Lamaury, C. Reichert and T. Bruckmann, "A Versatile
% Tension Distribution Algorithm for n-DOF Parallel Robots Driven by n+2
% Cables", IEEE Trans. Robot., vol. 31, no. 6, pp. 1444-1457, 201... |
%hvrunaverage - issue 1.1 (12/06/09) - HVLab HRV Toolbox
%-------------------------------------------------------
%[outdata] = hrunvaverage(indata, method, window-length, increment, mode)
% Running average of successive points in data sets, using a rectangular
% window
%
% outdata = HVLab data structure con... |
function [ outputImage ] = myBilinearInterpolation( inputImage )
% The function implements the technique of bilinear interpolation on the image passed to it as inputImage
% to give an enlarged image having almost twice as columns and thrice as rows
[M N] = size(inputImage); % Compute the dimension of the image M: ... |
function img = draw_red_boundary_box(img, corner_points, top_row, top_col)
mat_size = size(corner_points);
groups = mat_size(2);
THICKNESS = 5;
matrix_size = size(img);
MAX_ROW = matrix_size(1);
MAX_COLUMN = matrix_size(2);
for i=1:groups
% Loop through every group
% Now... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 本函数用于计算beta系数
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function betaC =betaCoefficient( R,Rm)
loc = isnan(R) | isnan(Rm);
R (loc) = [];
Rm (loc) = [];
if size(R,1)>1
covRRm = cov(R,Rm);
betaC = covRR... |
%%% Convert dense BSV model into sparse BSV model
%Load dense BSV model (dense_net)
mynet=dense_net;
%Set hyperparameter
delta=1.2;
W1=mynet.IW{1};
W2=mynet.LW{2,1};
W3=mynet.LW{3,2};
W4=mynet.LW{4,3};
for i=1:size(W1,1)
for j=1:size(W1,2)
wtemp = W1(i,j);
W1(i,j) = 0;
if cond... |
function [struct] = extrai_markov(img,mask,janela,struct)
%
% Calcula os parametros de textura por um campo aleatorio de markov
% gaussiano, utilizando Estimativa dos Minimos Quadrados
%
ordens = 1:5;
nErros = 0;
struct = aloca_espaco(struct,ordens,mask);
fprintf('Iniciando calculo das texturas por Markov (MRF)...\... |
function [zunique, idx_missing] = get_unique_z_from_idx( dims, idx, ...
runmissing )
[~, ~, z] = ind2sub(dims, idx);
zunique = unique(z);
idx_missing = [];
if runmissing
delta = diff(zunique);
idx_missing = find(delta > 1);
end
end |
function [feat age id]= extract_bif_feat(path,ext)
% path = 'E:\Computer Vision\Database\AgingData_FGNET\Images_norm_w260_crop_medium';%
% ext = 'BMP';
fls = dir([path '/' '*.' ext]);
if length(fls) == 0
error('No image was found.');
end
nTheta = 12;
%
% mex Pool.cpp;
FS1 = 4:2:14;
FS2 = 6:2:16;
... |
function filter_output=retro_marginal_local_np(filter_retro,filter_output,i,Nhyp_i,Nx)
%This function calculates the marginal distribution of the trajectory after
%an OOS measurement. The hypothesis is non-present/present.
for j=1:Nhyp_i %We go through all hypotheses
prob_length_j=filter_retro.tracks{i}.prob... |
function [map,lo,hi] = cubehelix(N,start,rots,hue,gamma,rng)
% Colormaps of Dave Green's Cubehelix colorscheme, with brightness control.
%
% (c) 2013 Stephen Cobeldick
%
% ### Function ###
%
% Returns a colormap with colors defined by Dave Green's Cubehelix colorscheme.
% The colorscheme is made of nodes along ... |
function varargout = ConstrGui(varargin)
% CONSTRGUI MATLAB code for ConstrGui.fig
% CONSTRGUI, by itself, creates a new CONSTRGUI or raises the existing
% singleton*.
%
% H = CONSTRGUI returns the handle to a new CONSTRGUI or the handle to
% the existing singleton*.
%
% CONSTRGUI('CALLBACK',hO... |
% data pre-processing
load BankSet;
load Survived_Banks;
load Failed_Banks;
All = AllBanks;
Survived = Survived_Banks;
Failed = Failed_Banks;
%calculate Nan Percent for all banks
Total_Banks = size(All, 1);
NaN_Rows = isnan(All);
NaN_Sum = sum(isnan(All(:,(3:12))));
Nan_Sum_Percent = htet_cal_nan_percent(NaN_Sum, 10,... |
% Process model
%
% Copyright is with the following author(s):
%
% (c) 2012 Juraj Oravec, Slovak University of Technology in Bratislava,
% juraj.oravec@stuba.sk
% (c) 2012 Monika Bakosova, Slovak University of Technology in Bratislava,
% monika.bakosova@stuba.sk
% ------------------------------------------------------... |
% Written by Amirkhosro Vosughi, Washington State University
%This Script calculated vulnerability of each state. The calculation is
% done thorugh distributed Controllability analysis
function ErrVariacne = SE_distributed(A,B,C)
Tt=50;
d = size(A,1);
%%% Initialize the P matrix
P0=C;
P=zeros(Tt,d);
P(1,:)=P0;
... |
function [ simState ] ...
= simulateCoverage(pathToSaveResults, ...
dirToLidarFiles, lidarFileAbsDirs, ...
lidarFileXYCoveragePolyshapes, cellAntsXYH, simConfigs)
%SIMULATECOVERAGE Generate coverage and blockage maps via channel
%simulations.
%
% This function is based on:
% lib/analyzeCoverageViaChannelS... |
function S=s_lambda(A,B,C,D,lambda,tol)
%S_LAMBDA Geometric Subspace S_lambda (See Chapter 3 for definition)
%
% S = s_lambda(A,B,C,D,lambda)
%
% computes a matrix whose columns span S_{\lambda} for a
% system characterized by (A,B,C,D), where 'lambda' is
% either a real or... |
%
% Make a decent contrast effect.
% Same target, but one is an increment on the local background and
% the other is a decrement on the local background.
%
cd /home/brian/book/09col/fig/subContrast
target = ones(10,10)*201; %square
background = ones(100,200); %rectangle
background = background*diag(1:200);
backgroun... |
function [queryset1,queryset2,target,j1,j2,x1,x2] = dataset2queriesv02(dataset1,dataset2,x,nq0,nq1,sd)
%
% create a set of queries.
% target(i) = 0 means that there is j s.t queryset1(:,i) = dataset1(:,j)
% and queryset2(:,i) = dataset2(:,j).
% target(i) = 1 means that queryset1(:,i) = dataset1(:,j1)
% a... |
clc; clear;
% incremental_image = zeros(1080,1920,3);
%
% [col, row, ~] = size(incremental_image);
% x=0;
% for j=1:col
% for i=1:row
% in = bitand(x,255);
% incremental_image(j,i,1)=in;
% incremental_image(j,i,2)=in;
% incremental_image(j,i,3)=in;
% x=x+1;
% end
% end
%... |
function ms = testlabel3d_cbf(Pfile, doGetraw)
if nargin>1
if doGetraw
str=['!~hernan/scripts/getraw ' Pfile];
eval(str)
end
end
!rm *.nii
%sprec1_3d(Pfile,'m','n',64);
%sprec1_3d(Pfile,'N','h','n',64, 'fx', 'fy');
%sprec1_3d(Pfile,'m','fy','l');
sprec1_3d(Pfile,'N', 'fy','fx', 'l');
%sprec1_3d(Pfile,'h', ... |
function c = case9_contingencies
%% contingencies
% type: 0 - no contingency, 1- line trip, 2 - generator trip
% CONT_TYPE CONT_IDX LOAD_MULT LINE_MULT CONT_PROB
c = [
% 0 0 1 0 % neutral scenario
% 0 0 1.1 0 % 10% load increase
% 0 ... |
function [im1,phase] = POCSMUSE(k0,sens,iter,im0,flag)
% This is the implementation of POCSMUSE for multi-shot DWI reconstruction.
% While there is one thing to be fixed: phase update needs to be included as in POCS-ICE.
% Input:
% k0: nx-ny-nc-ns
% sens: nx-ny-1-nc
% iter: number of iterations
% im0: initial... |
Li=load("L1.dat");
Lk=load("L2.dat");
Li=Li';
Lk=Lk';
printf("Li generated\n");
printf("Lk generated\n");
gtx = [1 5 6 .5 .2 .3]';
gtX = v2t(gtx);
np = 3;
for i = [1:size(Li)(2)]
#Li(1:3, i) /= norm(Li(1:3, i));
Lj(:,i) = plane_remapCartesian(gtX, Li(:,i));
endfor;
printf("Generating Lj\n");
X=eye(4);
Omega=eye... |
function write_bin(M, name)
% write_bin - write a file to .bin format readable by scilab.
%
% write_bin(M, name);
% OR
% write_bin(name);
%
% Convert to 8 bits graylevel images before writing.
%
% name should not contain .bin extension (automatically added).
%
% Copyright (c) 2008 Gabriel Peyre
if isstr(... |
addpath(genpath('QETLAB-0.9'))
%{
%%%%%%% Interconversion using MISC for qubit channels using the complete set of monotones as given in the paper 'Dynamical Resource Theory of Quantum Cohernce' by Gaurav Saxena, Eric Chitambar, and Gilad Gour.
This code is written by Gaurav Saxena.
This code is designed specifically f... |
clear all
time=0:0.5:200;
height=100;
width=200;
WinHei=35;
as=[0.02, 0.05, 0.02, 0.02]; %WT, trkA, sinR, ktrA
taus=[300, 550, 300, 650];
cs=[10, 10, 10, 10];
phis=[0.43, 0.43, 0.74, 0.51];
name={'WT';'Delta trkA';'Delta sinR';'Delta ktrA'};
row=13;
v_th=0.6;
Tab=load('/home/xiaoling/SpiralWave/data/F17_4Strains... |
classdef RayTracer < handle
%RAYTRACER Ray Tracer
% Ray Tracing for emag simulations
properties
simSize = [120,120,120]; % Pixels
end
methods
function obj=RayTracer()
% RayTracer Constructor for Ray Tracer Object
end
end
meth... |
function Accuracy = findAccuracy(y_actual, YResult)
% NumInputs = length(y_actual);
%
% diff = y_actual - YResult;
%
% NumDiffs = sum(abs(diff));
%
% Accuracy = ((NumInputs - NumDiffs)*100)/NumInputs;
Accuracy = (mean(YResult == y_actual))*100; |
function demo_0306_plot(ATL03_file, x_atc_0, w)
%files=glob('/Volumes/ice1/ben/sdt/ATLxx_example/PIG_Collab_v13B_NoFirn_NoDz_noDx/ATL03_subset/run_1/rep_*/Track_530-Pair_1_D2a.h5');
% note: for Track 530 Pair 1, rep 6 is great, rep 7 is so-so, 12 is pretty bad,
% smooth region; 2.8473e+07, +- 1 km
% demo_0306_plot(fi... |
function [duvidq] = Compute_duvidq(obj)
%Compute_duvidq Summary of this function goes here
% Detailed explanation goes here
duvidq = Compute_duvidq@GSM(obj);
duvidq = obj.ComputeComplexDerivative(duvidq);
end
|
spiketimes = [100:50:450 1000]
tau_mem =32;
tau_in = 1.8;
A = 144;
u = 0.26;
tau_rec = 1000;
dt = 0.25;
x(1) = 1;
y(1) = 0
V(1) = 0;
t = 0;
tmax = 1200;
ind = 1;
kk = 1;
while t< tmax
%if spike arrives
if t>= spiketimes(kk) & t<spiketimes(kk)+dt
x(ind+1) = x(ind) + dt*((1-x(ind)... |
clear all; close all; clc;
data = LoadFunctionData;
xRange = linspace(-5,5,201);
MAXIMUM_CHROMOSOME_LENGTH = 1024;
populationSize = 200;
minInitialChromosomeSize = 4;
maxInitialChromosomeSize = 100;
constantRegisters = [1, -1];
variableRegisters = 5;
instructions = 4; %{+,-,*,/}
numberOfGenerations = 50000;
numberOfDat... |
function [r2_acc,r2_pred,sse_acc,sse_pred,beta_best,Rn] = filtered_mlr_crossvalid(X,Y,k,L,bf,af)
%MLR_CROSSVALID Summary of this function goes here
% Detailed explanation goes here
[N] = size(X,1);
span = floor(N/k);
n = 1:N;
r2_acc = zeros(k,1);
r2_pred = zeros(k,1);
sse_acc = zeros(k,1);
sse_pred = zeros(k,1);
bet... |
wt = 0: 0.05: 3*pi;
v=120*sin(wt); % Sinusoidal voltage
i=100*sin(wt-pi/4); % Sinusoidal current
p=v.*i; % Instantaneous power
subplot(2, 2, 1),plot(wt,v, wt,i); % Plot of v & i versus wt
title('Voltage & current')
xlabel('wt, radians ')... |
%Problem3c
clear
clc
dt = 0.01;
et = 2.5;
t = 0:dt:et;
x = exp(1j*2*pi*t);
y = real(x);
z = imag(x);
plot3(y,z,t);
xlabel('real part');
ylabel('imaginary part');
zlabel('t'); |
function [ PowSavePerc ] = PowSavings( PowOrig, PowNew )
% Returns percentage of power savings
PowSavePerc = ((PowOrig - PowNew)./PowOrig).*100;
end
|
% Task1 Morphological operation
im_sawtooth = im2double(imread( 'sawtooth.bmp' ));
im_sawtooth = round(im_sawtooth);
%% (1)Extract the boundary
SE_1 = strel('disk',3);
im_sawtooth_dilate = imdilate(im_sawtooth,SE_1);
im_sawtooth_bundary = xor(im_sawtooth,im_sawtooth_dilate);
figure(1)
subplot(1,3,1);imshow(im_s... |
% Parameter M adjacency matrix where M_i,j represents the link from 'j' to 'i', such that for all 'j'
% sum(i, M_i,j) = 1
% Parameter d damping factor
% Parameter v_quadratic_error quadratic error for v
% Return v, a vector of ranks such that v_i is the i-th rank from [0, 1]
function [v] = rank2(M, d, v_quadratic_... |
% Es 14
% Given H(z) = 1 - 0.8 z^-1
% Plot its impulse response
close all
clearvars
clc
%% define H(z)
% denominator coefficients (from a_0 to a_D)
A_z = 1;
% numerator coefficients (from b_0 to b_N)
B_z = [1, -.8];
%% H(f)
N = 100;
% you can use 'whole' to compute the Frequency response on 2pi
[H_omega_2pi, ome... |
%% Checks whether or not contingency matches reduced state matrix modes
% contignum = the contingency to simulate
% noise = white noise amount (input as percentage the max amplitude)
% window = percentage of full view into power network
% implemented by randomly removing subset of voltage readings
functi... |
function c=ComputeCdenVsDen(x,l,den,beta,times)
for i=1:times
for j=1:length(den)
cden(i,j)=GenNw(x,l,den(j),beta)
end
end
|
% Interactive findpeaks script with peak-zoom feature,
% for pre-defined data in x,y.
% Load a typical data set into the vectors x,y, then run this
% m-file and adjust the 5 sliders to determine what values of the
% parameters give the most reliable peak detection. Peak number and
% position, height, and widt... |
function dicomObj = constructorParser(dicomObj, modality, varargin )
%CONSTRUCTOR PARSER is a helper function that is used by all the DicomObj based classes.
% this function is not required for anything else.
% dicomObj = constructorParser(dicomObj, modality, varargin)
% varargin{1} can be a DicomObj or a file path.
... |
function test_accuracy_validation = cross(data_train,labels,regularisation_para_C)
% change label 0 to -1
labels(labels==0) = -1;
label_train = labels';
% Cross Validation
[Train, validation] = crossvalind('HoldOut', label_train, 0.5);
trainSample = data_train(Train,:);
train_Label = label_train(Train,1);
validati... |
%Difference betweeen original image and gaussian filtered image
clc
clear all
I=imread("imagename.jpg");
I=I(:,:,1);
X=DIFF(I);
imshow(X) |
function result = randMat(n)
%randMat: Takes an integer input and outputs a random, symmetric,
% positive definite, dense n x n matrix
% This generates a matrix of random numbers between -1 and 1.
A = -1 + 2 * rand(n);
% In the following, A.' is the transpose of matrix A and eye(n)
% is the nxn identity matrix.
r... |
function result = canny3(image, sigma, t1, t2);
% function result = canny3(image, sigma, t1, t2);
result = canny4(image, sigma, 1.35, t1, t2);
|
clc
clear all
vidObj = VideoReader('/Users/INNOCENTBOY/Desktop/1.mp4');
vidObj.CurrentTime = 520;
frame1 = readFrame(vidObj);
frame2 = readFrame(vidObj);
frame2 = readFrame(vidObj);
frame2 = readFrame(vidObj);
frame2 = readFrame(vidObj);
p = 3;
blocksize = 8;
frame1 = double(rgb2gray(frame1));
frame2 = double(rgb2... |
function peaks = houghPeaks(H,numPeaks)
% Copy H into HCopy
HCopy = H;
%Initiate peaks matrix
peaks = zeros(numPeaks,2);
numP = 0;
threshold = 0.6*max(H(:));
while(numP<numPeaks)
if(threshold<=max(HCopy(:)))
numP = numP + 1;
[rows,cols] = find(HCopy == max(H... |
classdef AnalysisRobot2 < AutoTrader
properties
%TradeTimes
TradeTimes
%Saving Spots
SpotHistory
AskHistory
BidHistory
CallDeltaPos
%Depths to be loaded in
StockDepth
Call800Depth
... |
%% Step 2.4
% The objective is to minimise a cost function, given in the assignment.
% The difference between this step and step 2.3, is that now we have to
% optimize over the boundaries u_i. The previous method does not work
% anymore. This files has one function, that computes the cost, as a
% function of a_i, b_i a... |
function [matrix1, matrix2] = makeTertiary(matrix1, matrix2)
for i=1:size(matrix1,1)
idx = find(matrix1(i,:));
if (length(idx)>5)
matrix1(i,idx(end-1)) = -1*matrix1(i,idx(end-1));
matrix2(i,idx(end-1)) = -1*matrix2(i,idx(end-1));
end
if (length(idx)>10)
matrix1(i,idx(end-2)) = -... |
function [coords, counts, means, stds] = binCorrelation(error, state, n_bins, binType)
% NOTE: this expects input vector observations to be in rows, but switches
% convention to be columns for easier output. input should be (axis, obs)
error = error';
state = state';
% coords(n_bins, n_state) = edges of bins
... |
% create a circular polygon to be the outline of the mesh
clear
clc
% Parameters
Radius = 2000; % meter
SegmentSize = 100; % meter
Npoints = ceil(Radius*pi / SegmentSize);
t = linspace(0,2*pi,Npoints);
circle_points = Radius*[cos(t); sin(t)]';
domain.Geometry = 'Polygon';
domain.X = [circle_points(:,1)' nan];
domain.Y... |
%{
Situazione Italia: prelockdown, lockdown
Alla fine plot dela simulazione del modello in entrambe le fasi.
%}
clear all
close all
clc
% controllo blocchi codice: posso fermare lockdown e riepilogo
lock = 1;
riep = 1;
%% DATI
% Upload dati protezione civile
tmp = fullfile('..','00 - dpc_data','2020-06-30',... |
% visangle = width2visangle(width, dist_to_screen)
%
% Converts a measure of physical distance on the screen, WIDTH, to a
% measure of visual angle (in degrees), given the distance from the plane
% of the eye to the center of the screen DIST_TO_SCREEN. WIDTH and
% DIST_TO_SCREEN may be any units of measurements as lon... |
%ABSTRACT
% Library function for SDCM. Tool for status/log messages.
% Works like fprinf, but accepts a status level as first input
% parameter. Only if the status level is <= the one initially
% OutputLevelForThisSession' special syntax are displayed.
function s = SDCM_printStatus(varargin)
%Configure status level ... |
% LoadPlotDelayData_CB
% CallBack for LoadPlotDelayData
switch lower(gcbo)
case findobj('Tag', 'DData_file')
LoadPlotDelayData;
PlotDData;
case findobj('Tag', 'DData_Plot')
PlotDData;
case findobj('Tag', 'DData_NamePSTH')
%disp(TrialStr);
%disp([... |
clear all
close all
clc
% 275 frame pour 452 pt par frame
pt_par_frame = 452;
nb_frame = 275;
a= load('BSCAN1.csv');
b = zeros(275,452);
for x = 1:275
b(x,:) = a( ((x-1)*pt_par_frame + 1 :pt_par_frame + (x-1)*pt_par_frame));
end
exi
imagesc(b);
|
thermVidRd = VideoReader(strcat(filenamebase, 'Thermal.mj2'));
%%
nframes = thermVidRd.NumberOfFrames;
meanTemps = [];
for i = 1:20:nframes
xl = [32 48];
tIm = read(thermVidRd,i);
tIm = convertThermalImage(tIm);
figure(1);
imagesc(tIm, xl);
colormap jet
colorbar
drawnow
figure(2);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.