text stringlengths 8 6.12M |
|---|
clear all
close all
clc
a_champ = 6838000;
e_champ = 0.004;
i_champ = 87*pi()/180;
w_champ = 0;
W_champ = 0;
M_champ = 0;
GM = 398600.44;
w_earth=2*pi()/86164;
initial = [a_champ e_champ i_champ w_champ W_champ M_champ];
%% Perturbed Keplerian elements
[dw, dW, dM, n] = disturb(a_champ,e_champ,i_champ);
T = 4*pi()... |
%% READ CSV FILE
% open attribute name csv file and store data in attrlines
fstr = 'EntityRiskData_Levels_noCont_simplified_transposed';
fstr = 'attributes_fun';
fid = fopen([fstr '.csv'],'r');
attrlines = textscan(fid,'%s','endofline','\r\n','delimiter','\r\n');
attrlines = attrlines{1};
fclose(fid);
% loop over all... |
%Генерируем случайную величину по НОРМАЛЬНОМУ ЗРВ
function X = gererateRandom( range, count,classes, attribute)
%range - диапазон случайной величины
%count - количество наблюдений для iого класса
%classes - количество классов
%attribute - количество признаков
%----------------------------------------------------... |
function [tnList,ynList,hList,rList,nfun] = ImplicitTrapezoidAdaptiveStep...
(func,Jacob,tspan,N,Y0,abstol,reltol,controller)
%
% This function solves a general first-order Initial Value Problem
% of the form
% dot_y = f(y,t), y(tstart) = tbegin
%
% using Trapezoid Method in n steps (constant step s... |
%%% script to calculate STF
h=fspecial('average',[1 100]);
array='AU';
f=['stack_uncorr_0.05_2HZ_' array '.txt' ];
uncorr=load(f);
f=['stack_corr_0.05_2HZ_' array '.txt' ];
corr=load(f);
%{
array='AU';
f=['stack_uncorr_' array '.txt' ];
uncorr=load(f);
f=['stack_corr_' array '.txt' ];
corr=load(f);
array='AU';
f=... |
function myTimerFcn(src,evt,params)
% myTimerFcn(src,evt,params) My timer callback function
%
% Inputs:
% src
% Reference to the timer object triggering this callback
% evt
% Reserved for event data
% params
% Parameters supplied by the user at assignment of timer.TimerFcn.
% Display a simple elapse... |
function createTestDataNOIZEUS()
% Generates sound files for testing.
% Generates a range of training data, varying by the number of utterances
% (sentences) provided to train on.
% Generates a range of test data, varying by the SNR.
%
% Will output files:
% - <x>ut/train_SoI.wav, where x is the number of utterances
... |
function [value,isterminal,direction] = falldetect(t,y, model, params, externalForce)
value = y(3) - 0.1;
isterminal= 1;
direction = 0; |
classdef VonMises2 < handle
% VonMises2 - fast fitting of vonMises tuning curves.
% For usage example, execute and examine covest.lib.VonMises2.test
%
% Dimitri Yatsenko, 2012-07-09
properties(SetAccess = private)
w % nx5 matrix of coefs in equation
% w1 + w2 * exp(c-1) + w3 *... |
function [Y F] = kernel_PCA(X, K, d)
% X: columns of data
% L: labels, tow dimension, [start, end]
% d_pac: PCA wanted dimension
% d: wanted dimension
% compute means
% K = gaussian_kernel(X, X, 10^7);
% [Apca, D] = eigs(K, [], Dpca);
[F, D] = eig(K);
[D, index] = sort(diag(D), 'descend');
F = F(:, index(1 : d));
Y = ... |
%function [NCC_A, matches] = normCross(img1,img2,Corners_A)
img1 = rgb2gray(ImageA);
img2 = rgb2gray(ImageB);
windowR = 2;
temp_img = zeros(windowR*2+1,windowR*2+1);
[row, col] = size(img1);
NCC_A = zeros(row,col);
[A_x,A_y] = find(Corners_A>100);
matches = zeros(2,length(A_x));
for i = 1:length(A_x)
if A_x(i)... |
%
% 15-811
% HW1
% Author: Rosario Scalise
% Date: 9-12-15
%
% 1.)
%Test of algorithm
A=[2 1 1; 3 6 -5; -7 7 9];
[P L D U] = PLDU3(A);
% 2a.)
A=[4 7 0; 2 2 -6; 1 2 1];
%LDU
[L U]=lu(A);
D = diag(diag(U));
U = D\U;
%SVD
[U S V] = svd(A);
% 2b.)
A=[4 ... |
clear all;
data = [1 2 3; 3 1 2; 2 3 1];
target = [1 2 3];
siz = [3 3 3 3];
hyp = struct;
hyp.init = 1;
hyp.lr = 1;
hyp.mom = 0.01;
hyp.reg = 3e-4;
hyp.epochs = 10;
figure;
hold on;
%lr = [0.001, 0.01, 0.1, 0.3, 1];
%mom = [0.001, 0.01, 0.1, 0.3, 1];
%reg = [0.0001, 0.0003, 0.001, 0.003, 0.01];
cma... |
% Problem 3 (c)
% Marty Fuhry
% 2/13/2011
% Compiled and ran using GNU Octave, version 3.2.4 configured for "x86_64-pc-linux-gnu".
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Consider the heat equation %
% u_t = k u_xx ... |
function [ memory_in_use ] = mem_to_MB(mem_elements)
%ref: https://in.mathworks.com/matlabcentral/answers/uploaded_files/1861/monitor_memory_whos.m
if size(mem_elements,1) > 0
for i = 1:size(mem_elements,1)
memory_array(i) = mem_elements(i).bytes;
end
memory_in_use = sum(memory_array);
memory... |
function data = ThermalSummary(filename)
data = LabviewData(filename);
time = (1:length(data{300:end,4}))/100;
%%
%%
figure(1)
%%
%
%LSM ACCEL
subplot(2,2,1)
yyaxis left
plot(time,data{300:end,30}-mean(data{300:800,30}),time,data{300:end,33}...
-mean(data{300:800,33}),time,data{300:end,36}-mean(data{300:800,36}))
... |
%% structs
global s;
s = struct('OriginalImages',{},'ResampledImages',{},'Names',{}, 'Segmentation',{}, 'BinarySegmentation', {});
global p;
p = struct('iterations',[],'delta_time',[],'gac_weight',[],'propagation_weight',...
[],'mu',[],'resolution',{}, 'subsamplingIsOn',[], 'smoothDistanceFieldIsOn',[],...
'gau... |
% Intrinsic and Extrinsic Camera Parameters
%
% This script file can be directly excecuted under Matlab to recover the camera intrinsic and extrinsic parameters.
% IMPORTANT: This file contains neither the structure of the calibration objects nor the image coordinates of the calibration points.
% All those c... |
%%
%% This function is used to find the range of the highest mountain in the image
% The input must be a Complex matrix
% The target mountain must be symmetrical with the X axis and Y axis
% The half width of target mountain is Trough_x and Trough_y
% The peak's position coordinates is row_max_image and column_max_imag... |
function make_HPtheta_spikephase
cd('D:\XY_matdata\AllSessions\')
d2 = dir('*.mat');
for idir = 1:size(d2,1)
cd('D:\XY_matdata\AllSessions\')
load(d2(idir).name,'dirname','TT','spikedata','HP_Theta','LFP_Electrodes','pos')
s = spikedata(:,1:2); clear spikedata
p = HP_Theta; clear HP_T... |
function [Set]=SetDefault(Set)
%% geometry
% Examples of cell centers
if ~isfield(Set,'e')
Set.e=1;
end
% Seeding method==1 % Bounding box
% method==2 % DistanceFunction
if ~isfield(Set,'SeedingMethod')
Set.SeedingMethod=1;
end
% Tuning parameters
if ~isfield(Set,'s')
Set.s=1.5... |
function [m_fHhat, s_fRate] = m_fEncDec(m_fH, s_fDesRate, stSettings)
% Encode and decode a matrix using a lossy source code
%
% Syntax
% -------------------------------------------------------
% [m_fHhat, s_fRate] = m_fEncDec(m_fH, s_fDesRate, stSettings)
%
% INPUT:
% ----------------------------------------... |
%my IFFT algorithm for a vector using the inverse approch from myFFT
function x_n=myIFFT(X_k)
j=sqrt(-1);
N=length(X_k); %number of samples
a_n=X_k;
%step 1 reverse through the butterfly segmentation
for i=log2(N):-1:1
for k=1:power(2,i):N
for l=0:power(2,i-1)-1
stage(k+l)=(a_n(k+l)+a_n(k+l+po... |
clc;clear; clf;
xmin = 0;
xmax = 24;
xstep = 1;
ymin = 0;
ymax = 100;
ystep = 0.5;
x = xmin:xstep:xmax;
y = ymin:ystep:ymax;
[x,y] = meshgrid(x,y);
f = fxy(x,y);
surf(x,y,f);
shading interp; box on;
ylabel('Distance from you (ft)');ylim([0 50]);
xlabel('Time (hrs/day)');xlim([0 24]);
zlabel('Happiness s... |
function result = bilinear_interpolation(image, row, col)
% function result = bilinear_interpolation(image, row, col)
%
% row and col are non-integer coordinates, and this function
% computes the value at those coordinates using bilinear interpolation.
% Get the bounding square.
top = floor(row);
left = floo... |
function [mode, grpSize] = modeID(eigE, eigVec, d, N, T, floqRef, urms)
n = 5; % no. groups to be estimated
maxFreq = 10;
wrappi=@(x)(x-floor(x/pi)*2*(pi));
[floqTst,grp] = pickFloq(eigE,eigVec,n,d,N,T,urms,maxFreq);
% identify the mode closest to a group of the reference solution
grpI... |
% Function to load a .csv file
% input: path -> Address where the files are stored
% input: file_name -> String file name to be uploaded
% input: type -> True is a table / false is a structure
% return: File uploaded to worspace
% Example to use:
% data = csv_Load_Data(raw_data_path,'file',true)
% More examples: https... |
% latent heat of vaporization
latheat=2.26e6; % J/kg
%Lv=2.500*10^6; % J/kg
cp=1000.; % J/(kg K) cp for dry air
Ra=287.; % J/(kg K) gas constant for dry air
Rv=461.; % J/(kg K) gas constant for water vapor
T0=280.; % K surface temperature
p0=100000.; % Pa
rh0=0.8;
kappa=Ra/cp;
r_dry=Ra;
epsilon=Ra/Rv;
grav=9.81;
a_ear... |
function [B, D] = best_mathces(im1, images, idx)
D = [];
for i = 1 : size(images, 1)
if i == idx
D = [D; 100]; % if images is same than image
else
D = [D; comparehistograms(im1, images(i, :), 'hellinger')];
end
end
[D, B] = sort(D);
D = D(... |
function J = computeCost(X, y, theta)
m = length(y);
J = (1/(2*m))*sum(power((X*theta - y),2));
end |
function [F, varargout] = IWAN4FORCE(ut, pars, totcol, occol)
Fs = pars(:, occol(1));
Kt = pars(:, occol(2));
Chi = pars(:, occol(3));
Bt = pars(:, occol(4));
PhiMx = Fs.*(1+Bt)./(Kt.*(Bt+(Chi+1)./(Chi+2)));
CoefE = (Kt.*(Kt.*(Bt+(Chi+1)./(Chi+2))./(Fs.*(1+Bt))).^(1+ ...
... |
%Time
t=linspace(0, 10, 101)';
%Voltage
v=linspace(0, 1, 101)'; |
function [result] = LUdecomposition(coeff, b, handles)
tic;
% coeff.result = b
% n the number of variables
% coeff = L.U
format long;
[n, ~] = size(coeff);
% indexing starts from 1
L = zeros(n, n);
U = coeff;
y = zeros(n, 1);
x = zeros(n, 1);
for i = 1:n
%partial pivoting
for j = i + 1 : n
if U(i, i)... |
%data = importdata('text.mat');
%load fisheriris
%X = meas(:,3:4);
X = [0 2;1 1; 1 2; 5 4; 5 5; 6 5;]; % notebook example
%X = [1.0 1.0;1.5 2.0; 3.0 4.0;5.0 7.0; 3.5 5.0;4.5 5.0;3.5 4.5;] %internet
%example http://mnemstudio.org/clustering-k-means-example-1.htm
%for i= 1:size(X,1) % normalization
% ... |
function initializeChipconRSSI(varargin)
%initializeChipconRSSI()
%
import net.tinyos.*
import net.tinyos.message.*
import net.tinyos.chipconRSSI.*
if length(varargin)<4 varargin{4}=1; end %by default, rf power is set to smallest possible
global CHIPCON
CHIPCON.transmitters=varargin{1};
CHIPCON.receivers=varargin{2}... |
%CHOL_INCOMPLETE Incomplete Cholesky decomposition for dense matrix
% [LFACT,PIND] = CHOL_INCOMPLETE(N,ASEL,MAXD,PVTHRES,...)
% Incomplete Cholesky decomposition for dense symmetric positive
% definite matrix A (N-by-N).
% Result is N-by-k lower triangular L, s.t. L*L' can be used as
% low-rank approximation of P'... |
%% analyze_behavior_minimizing_threat
% This script performs the main behavioral analyses for the article
% "Minimizing threat via heuristic and optimal policies recruits
% hippocampus and medial prefrontal cortex" by Korn & Bach;
% for more information contact: christoph.w.korn@gmail.com
% subfunctions
... |
%% 1228 for Experiment
addpath('../');
%% read data
filename = '1228'
vidObj = VideoReader(strcat(filename,'.wmv'));
vidHeight = vidObj.Height;
vidWidth = vidObj.Width;
s = struct('cdata',zeros(vidHeight,vidWidth,3,'uint8'),...
'colormap',[]);
k = 1;
%% define cx cy = center.x center.y Width and Height
cy ... |
function ReturnFlag=SendMailNet(MailInfo)
ReturnFlag=0;
[MFilePath, MFileName]=fileparts(mfilename('fullpath'));
TempIndex=strfind(MFilePath, '\');
ProgramPath=MFilePath(1:TempIndex(end));
try
%Check .NET framework V4.0 or above available
[Status, Result]=dos([ProgramPath, 'Utils\clrver.exe']);
... |
% Ex3
% c)
TIER_2_SUBS = 5000;
TIER_3_SUBS = 2500;
SUBS_TOTAL = TIER_2_SUBS * 10 + TIER_3_SUBS * 25;
% N => número de servidores calculados na alínea b)
N = 76;
% ASs calculated in a)
% ==> 10, 13, 16, 21, 30
% Dado que os ASs escolhidos vão comunicar apenas com os servidores que
% estão no máximo a um salto de dis... |
%%%% Algorytm Mallata %%%%%
clear all;
clc;
level = 1;
wname = 'db2';
I=imread('pekniecie1.jpg');
X=double(rgb2gray(I))/255;
% Load original image.
%X=imread('lena.jpg');
%[X,map] = gray2ind(X,128);
% X contains the loaded image.
% map contains the loaded colormap.
%nbcol = size(map,1);
%subplot(2,... |
function [ a,b,vr ] = separacijskaRavnina( T1,T2 )
%iscemo separacijsko premico y = a*x+b za skupini tock T1 in T2
%ce ta obstaja vrnemo tisto, ki ima najvecjo vertikalno razdaljo do tock
%T1 = {(x1,y1),...,(xn,yn)}, T2 = {(u1,v1),...,(um,vm)}
%Vhod:
% T1 matrika tock nx2 za katere velja T1 > y=a*x+b (lezijo nad premic... |
% Code Section to find the Lat-Longs of TSR
%% Import CSV File
[fileName,directoryName] = uigetfile('*.csv','Please click the data recording file in the directory');
if(fileName == 0)
dispaly('No file is selected. Please select the right data file');
return;
else
[~,BB,raw] = xlsread([directoryName... |
function mddVal = MaxDrawDownVal(nav)
% daniel 2013/10/16
nP = size(nav,1);
maxNow = nan(nP,1);
for i = 2:nP
maxNow(i) = max(nav(1:i));
end
drawdown = maxNow-nav;
mddVal = max(drawdown);
end
|
function [ res ] = insertData( left,right,num )
res = zeros(num,1);
part = (right - left)/(num+1);
for i = 1:num
res(i) = left+part*i;
end
end
|
%Seyit Yiğit SIZLAYAN / 1876861
%%INIT
clc;
close all;
clear
load('measurement_30_09_2018_sinus_1_0.mat')
clear;
load('QOptimized_RfromDataSheet.mat'); % Add gryo input model
Gyro_Kalman
clc;
close all;
%% Data Import
global N
global dt
global pedal
global t
pedal.groundTruthTheta = smoothedState_vectors(1,:);
A = ... |
% regression
version = '1.0 alpha';
global eps = 1e-4; % limit for parameter change in iteration
global max_iter = 1000; % maximal number of iteration
% regression circle
function [x0, y0, r] = circle(points)
res=[points(:,1) points(:,2) ones(rows(points),1)] \ [-(points(:,1).^2+points(:,2).^2)];
x0 = -0.5 ... |
% This example file shows how to make 3D plots on a flux surface
%input
Boozerfile='/afs/ipp-garching.mpg.de/home/s/smithh/Forskning/Stellarator/sfincs/gitsfincs/equilibria/w7x-sc1.bc';
rnormwish=0.9;
Ntheta=41; %must be odd
Nzeta=41; %must be odd
min_Bmn=0; %only load Bmn's bigger than this
max_m=inf;
maxabs_n=inf;
... |
function [ gallery_features, gallery_labels, test_features, test_labels] = ...
load_dataset(base_dir, dataset )
switch dataset
case 'sun397'
load([base_dir, 'SUN397/sun397_vggfc7_gallery.mat'], 'gallery_features', 'gallery_labels');
load([base_dir, 'SUN397... |
function [normv] = normmat_col(X)
normv = zeros(1,size(X,2));
for i = 1:size(X,2)
normv(i) = norm(X(:,i));
end |
function [Par,FrameStart, RecordedValues] = TPA_FindFrameSync(Par,RecordedValues,FigNum)
%DTP_FindFrameSync - uses physiology data from different experiments and different configurations
% and determines the frame sync
% Inputs:
% Par - structure additional params
% RecordedValues - N x K matrix of K cha... |
function [frames, descriptors] = PhowFeature(img)
% DESCRIPTION: Generate Multi-Scale Color Dense SIFT local features for a given image.
% INPUT: %img Image from which local features are to be
% extracted
% OUTPUT: %frames Descriptor information
% ... |
function createfigure(X1, Y1, X2, Y2, X3, Y3, X4, Y4)
%CREATEFIGURE(X1, Y1, X2, Y2, X3, Y3, X4, Y4)
% X1: vector of x data
% Y1: vector of y data
% X2: vector of x data
% Y2: vector of y data
% X3: vector of x data
% Y3: vector of y data
% X4: vector of x data
% Y4: vector of y data
% Auto-generated b... |
function [beta_m K] = gain_rkhs( Xi , c , kernel, lambda, epsilon, alpha, K_prev, diag)
% Returns the gain computed at particle locations Xi using an RKHS
% tic;
N = length(Xi);
K_prev = zeros(1,N);
simplified = 1; % 0 for the optimal solution, 1 for the reduced complexity solution
% Evaluation of kernel matrices
... |
function [fitness] = fitnessFunction (tour, graph)
fitness = 0;
for i = 1 : length(tour) - 1
currentNode = tour(i);
nextNode = tour(i+1);
fitness = fitness + graph.edges(currentNode, nextNode);
end
end |
function fgSal= calfgDistributionSal(salSup,Isum,x_vals,y_vals,m,n,spnum,number)
comSal = calDistribution(salSup,Isum,x_vals,y_vals,m,n,spnum,number);
fgSal = comSal;
index =comSal > mean(comSal);
%mean是对comSal的每个元素进行求和,comSal是个cenNum*1的列向量,
%大于号的返回值是一个cenNum*1的行向量,大于时,对应位置赋值为1(背景点),否则为0(前景点)
fgSal(i... |
function output = log_sum_mat(A)
output = A(:,1);
for i=1:size(A,1)
for j=2:size(A,2)
output(i) = log_sum(output(i), A(i,j));
end
end
end |
function [hyperbolic] = ITCanalysis(choice,v1,d1,v2,d2,RT, participant)
% calculate the percentage of times the participant chose the 'now' option
percentNow = (sum(choice == 0) / length(choice)) * 100;
% find indifference k values for each option
indiffk = (v2 - v1) ./ ((v1.*d2) - (v2.*d1));
%find the minimum and m... |
function matEvaluateRHS( obj, fphys2d, fphys3d )
%MATEVALUATERHS Summary of this function goes here
% Detailed explanation goes here
for m = 1:obj.Nmesh
mesh2d = obj.mesh2d(m);
mesh3d = obj.mesh3d(m);
% evaluate 2d PCE volume integral term
fphys2d{m} = obj.matEvaluate2dHorizonMomentum( mesh3d, .... |
% Crank-Nicolson method for calculating diffusion equation for diffusion of
% He in diamonds together with build up of 4He from radioactive decay of U and Th
% This model was generated for Weiss et al., 2021,
% Helium in diamonds unravels over a billion years of craton metasomatism, Nature Communications
% Please ... |
function A=kuroda3(A0, u,v)
[n,m]=size(A0);
A0(A0==0)=1e-6;
u0=sum(A0, 2);
v0=sum(A0, 1);
coefs=zeros(1, n*m);
c=zeros(1, n*m);
for i=1:n
for j=1:m
coefs(m*(i-1)+j)=1/(u(i)*u(i))+1/(v(j)*v(j));
c(m*(i-1)+j)=-A0(i,j)*( 1/(u(i)*u0(i))+1/(v(j)*v0(j)) );
... |
function d = effectsize_rmanova(rmanovatable,conditionsname,repeatmsrname)
% conditionsname can be multiple conditions in cell array, i.e. {'strain',
% 'dose'} or character array 'strain:dose'
% repeatmsrname = repeated measures name, can be in cell or char
D = rmanovatable; % get relevant data
% process repeatmsrnam... |
function maghdg = getheading(H,eul)
%------------------------------------------------------------------
% function maghdg = getheading(H,eul)
%
% getheading returns the magnetic heading given magnetic field
% measurements (H) in the body coordinated system and euler angles
% (eul) describin... |
%% Post-process RDF averages
clear
load('E1V_nm_stress_conc_data')
% Box and bin dimensions (Seed 1 - last damp without efield
box = [-6.8920100281133756e-01 4.2604373712814919e+01;
-3.9211809832795872e+00 4.5836353693286085e+01;
-5.3723467213784559e-01 4.2452407382139313e+01];
dx=box(1,2)-box(1,1);
L=dx/10;
x=0:L/20... |
function adp_img=adaptive(imgg)
%I=imread('Platon2.jpg');
%I=rgb2gray(I);
%figure
%imshow(I);
I=medfilt2(imgg);
%H=fspecial('gaussian');
%I=imfilter(I,H,'replicate');
%figure
%imshow(I);
%T = adaptthresh(I, 0.79);
%BW = ~imbinarize(I,T);
%bw=~im2bw(I);
%crp=imcrop(I,[0 0 80 50]);
%imshow(crp)
%thresh2=graythresh(I);
%... |
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR
% Autores: Gonzalo Pajares y Jesús Manuel de la Cruz
% Copyright RA-MA, 2007
% Ejercicio 1.6: Representación de imágenes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1.6.4 Operaciones sobre el contenido de las imágenes
%%%%%%%%%%%%... |
%%
[D, als_data] = avg_als_impute(D, 100);
%% invert right bias
D_cat = [cat_decathlon_structs(D_als(1:2)) D_als(3)];
for i=1:numel(D)
[~,p] = groupFields(standardize_fieldnames(D(i).fields), 'right_bias');
D(i).data(:,p) = D(i).data(:,p).*-1;
end
%%
groups = [{'Circadian speed';'Circadian nBouts';'Circadi... |
classdef iApertus < handle
% Some code was inspired by Jan Fröhlich
properties (SetAccess = protected)
settings
exposure
lines
count
cmvreg
note
subdir
last_base_path
fpn_mat
end
methods
function obj = iApertus(settings)
% set up default sensor setup and a base set of capture parameters.
... |
classdef CustomMsgConsts
%CustomMsgConsts This class stores all message types
% The message types are constant properties, which in turn resolve
% to the strings of the actual types.
% Copyright 2014-2018 The MathWorks, Inc.
properties (Constant)
ur_msgs_Analog = 'ur_msgs/Ana... |
%-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
% basic analysis of wind field in RCE experiments from CAM
%
% it appears that cam5 has 30 vertical levels, with the 30th being 992.5
% cam6 has 32 levels, with the lowest being 992.5
%
% the time dimension is given in hours. the original... |
classdef White
% White Auxiliary class for whiting out quoted or bracketed text in source code.
properties (Constant)
LABEL_PATTERN = '"[^"\n]*"|''[^''\n]*''' % Regexp pattern to match labels in IRIS source files.
WHITEOUT_CHAR = ' ' % Default white-out character.
end
... |
function [dup_list, unique_duplicated_names, all_duplicates] = find_duplicates(nodes)
% Removing duplicate names if the file is in more than one location
% NEED TO WORK OUT HOW TO DEAL WITH THIS SITUATION.
hsdf = NaN(length(nodes),1);
for hs = 1:length(nodes)
jd = 0;
for se = 1:length(nodes)
if strcmp(n... |
close all;
clear;
clc;
%% Initialization
a =[3/10,7/10];
mu = [9,4;5,12];
cov(:,:,1) = [9,1;1,14];
cov(:,:,2) = [13,1;1,7];
N = 5000;
[X, label] = gaussianGenerate(N,a,mu,cov);
%% Sample Ploting
figure(1);
plotclass(X,2,label,a,mu,cov);
%% MAP
[indexMAP, pEminERM] = classifyMAP(X, label, mu, cov, N, a);
plot4data(X... |
clear
clc
% A = rand(20,20);
A = [2, -5, 3; -1, 8, 5; 4, -1, 7; -1, 3, 2];
b = [3, 5, -2, 4]';
[m, n] = size(A);
U = A;
for j = 1:n
if j ~= m
[v, beta] = HH(A(j:m,j));
I = eye(length(v),length(v));
A(j:m, j:n) = (I - beta*(v*v'))*A(j:m,j:n);
if j < m
A((j+1):m, j) = v(2... |
function V = vecnod(order,npc)
%
% Calcul du vecteur nodal d'une NURBS ayant npc points de contrôle et dont
% l'ordre est order
% La NURBS interpole le point de depart et d'arrivee
total = order + npc;
delta = 1/total;
%
V = delta:delta:1;
% lorsque l'écart entre chaque nœud consécutifs est identique,
%le vecteur es... |
function DataOut = PIV_TiffRead(PathIn, varargin)
%%% Load data from a TIFF file
%%%
%%% DataOut = PIV_TiffRead(PathIn, NumberImages)
%%%
%%% PathIn is the complete path to the .tif file
%%% NumberImages is the number of images to load from the TIFF file
%%%
%%% DataOut is the data in the TIFF file, in the form... |
function [ dWe, dS, dtheta, dX ] = lista_bprop( X, Zstar, Z, We, S, theta, C, B, T)
%LISTA_BPROP Summary of this function goes here
% [ dWe, dS, dtheta, dX ] = lista_bprop( Zstar, X, We, S, theta, Z, C, B)
% Detailed explanation goes here
dC=zeros(size(C));
%%
dB=zeros(size(B));
dS=zeros(size(S));
dtheta... |
function varargout = UI(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @UI_OpeningFcn, ...
'gui_OutputFcn', @UI_OutputFcn, ...
'gui_LayoutFcn', [] , ...... |
clearvars -except net; close all; clc
%% 1.Train NN
% Parameters Initialization
sigma = 10; rho=28; beta=8/3;
% Initial Condition
x0=[-10; 10; 0];
% Domain Definition
dt = 0.01;
tspan=dt:dt:8;
% Solution
options = odeset('RelTol',1e-10,'AbsTol',1e-11);
[t,x]=ode45(@(t,x) lorenz_rhs(t,x, [], sigma,beta,rho),tspan,x0... |
%% Stelling 8
%
% Bij het uitvoeren van de onderstaande code is de
% variabele 'naam' een character vector.
%
% ------------code--------------
% naam = 'Biostatica Matlab';
% naam(3) ... |
%% plot parameters
subplot(3,2,1),plot(betaONEvect),title('Beta')
subplot(3,2,2),plot(epsilonvect),title('Epsilon')
subplot(3,2,3),plot(gammavect),title('gamma')
subplot(3,2,4),plot(etavect),title('eta')
subplot(3,2,5),plot(thetavect),title('theta')
subplot(3,2,6),plot(lambdavect),title('lambda')
%% get acceptance rat... |
load input.txt;
m = input;
n = length(m);
x = [];
y = [];
cur_lvl=0;
last_non_zero_lvl=-1;
for i=1:n
x=[x i-1 i];
if(m(i)==0)
y=[y cur_lvl cur_lvl];
else
if(cur_lvl~=0)
y=[y 0 0];
cur_lvl=0;
else
y=[y -last_non_zero_lvl -last_non_ze... |
function X=to_row(A)
%%This Function converts input matrix to row matrix
[m,n]=size(A);
X=zeros(1,1);
for i=1:m
X=[X A(i,:)];
end
X=X(1,2:(m*n)+1); |
function [e] = nrmse(x, y, mask)
%NRMSE [e] = nrmse(x, y, mask)
narginchk(2, 3);
if nargin < 3
mask = true(size(x));
end
e = rmse(x, y, mask);
e = e / range(vec(x));
end
|
function ECG_com(n)
if(n < 10)
name_before = strcat('b00', num2str(n));
name_after = strcat('p00', num2str(n));
else
name_before = strcat('b0',num2str(n));
name_after = strcat('p0',num2str(n));
end
result_before = ECG_10s(name_before);
result_after = ECG_10s(name_after);
x = (1:50000);
subplot(3,1,1)... |
% Driver code for the Three Wave´s circuit with breeding.
%
% This code integrates the three wave system
%
clear all;
close all;
clc;
% specify dimension
dim=3;
% specify rk4 stepsize
h2=0.001; %STEP=0.01;
h=h2;
tfinal=10.0;
% specify transient time
numtrans=1000;
% specify integration time
%numstep=... |
function [ D ] = MascarasLaplacianas( )
%Este programa lee una imagen devolviendo dos imagenes con convolucion
%manual y dos con convolucion por comando.
% Las Mascaras Laplacianas L1 y L2 son creadas en el programa y se
% implementan en la imagen de manera manual mediante ciclos y de manera
% m?s autom?tica med... |
load('Rawdata.mat');%The faults in Rawdata are set in variables 2, 3, 15
%% PCA-based process monitoring
X_train = X_data(1:700,:); %Training set
X_test = X_data(701:end,:); %Test set
X_mean = mean(X_train);
X_std = std(X_train);
[X_row,X_col] = size(X_train);
X_train=(X_train-repmat(X_... |
% Lec 5.6 :Newton Raphson (Multi variable)
% To solve sequence of non-linear equations using Newton Raphson
%% Initial Conditions
X0 = [-1;-1;1];
maxIter = 50;
tolX = 1e-6;
%% Computation using Newton Raphson
X = X0;
Xold = X0;
for i = 1:maxIter
[f,j] = lorenzSysNR(X);
X = X-inv(j)*f; % x(n+1) = x(n)-f(x)/f'(... |
% expl. Euler mit Reibung (3x)
% Omega
% Geschw./Partikel
% Verlust
function [] = Num_1_Wirbelstroemung_GUI_02(h,t,nue1,nue2,nue3,omega,video_jn,video_name)
%% Hauptteil
% Ein/Aus Geschw: Num_1_Wirbelstroemung_GUI_Geschw_EinAus(...)
% u_EA_L = U_EA(1,1);
% u_EA_R = U_EA(2,1);
% u_EA_O = U_EA(3,1);
% u_EA_U = U_EA(4,... |
close all;
clear;
clc;
eva = [ 50 1901 4593 14452;
100 1984 4619 17887;
150 2060 4693 19817;
200 1817 4617 21356]
fig = figure('Position',[0 250 800 350]);
h = bar(eva(1:end,1)',eva(1:end,2:4));
set(h(1),'FaceColor','red');
set(h(2),'FaceColor','black');
s... |
function [coeff score] = FS_PreMotor_PCA2(Cal,A)
% concat evertthing, leke nathan talked about
A{1};
AlignBound = 150:200;%Alignment Boundries ((Aln{1}-20):(Aln{1}+80))
for group = 1:2;%1:size(Cal,2) % Each 'Group' is a subset of aligned data
clear CaSignal;
clear GG
for trial = 1:size(Cal{1,group}{1,1... |
%%
clear all;
image_name = 'test2';
folder = ['../image/original/' image_name];
file_path = [image_name '_result'];
if ~exist(file_path, 'dir')
mkdir(file_path);
end
%smoothness factor for gsolve
lambda = 10;
disp('Read in images with different exposures...');
[imag... |
function DataProcessing(Ant_Selected,Sens_Selected,AntN,SensN,AID,SID, ...
strAID,strSID,Data,Span,Method_Selected,minTemp,maxTemp,val1,val2)
if (ismember('All',Ant_Selected,'rows')) && (ismember('All',Sens_Selected,'rows'))
for i=1:AntN
for j=1:SensN
CurrData = Data((Data(:,3)==AID(i)... |
net = setwb(net,fireflies(f,:));
% policzenie mocy swiatla
result = net(l_data);
errMatrixL = zeros(3,3);
for i = 1:L_SIZE
[maxval,evalIndex] = max(result(:,i));
%evalIndex
errMatrixL(evalIndex,l_data_correct(i)) = errMatrixL(evalIndex,l_data_correct(i))+1;
end
corrects = (errMatrixL(1,1)... |
%% VISION 1 - HISTOGRAMAS, NORMALIZACION Y DETECCION DE MOVIMIENTO
clear all
close all
clc
%% CARGA DE IMAGENES Y VIDEOS
imgen=imread('ejvisionruido.jpg'); %Funcion propia de MATLAB, reemplazar imagen por una en su PC
im=iread('ejvisionruido.jpg'); %Funcion TOOLBOX, reemplazar imagen po... |
globals_mii;
mii_us_per_sample = 10; %microsecond per sample
mii_separation = 100; %only take events separated by 100 samples (i.e., 1 ms)
for i = 1:100
% inititialize
m100x( C_.INIT );
m110dx( C_.INIT );
m110dx( C_.CLOCK, mii_us_per_sample);
m110dx( C_.MODE, M_.PST );
%Start clock
... |
function z=vdp_junk(x)
global alpha
epsilon=alpha;
A=x(1);B=x(2);C=x(3);P=x(4);Q=x(5);omega=x(6);
z = [ -A*omega^2+A-(1/2)*epsilon*P*B*C*omega+(1/4)*epsilon*B^2*Q*omega+(1/4)*epsilon*A^2*Q*omega-(1/4)*epsilon*C^2*Q*omega;
(1/2)*epsilon*Q*C*B*omega+(1/2)*epsilon*B^2*A*omega+(1/2)*A*P^2*epsilon*omega-(1/4)*A^2*P*e... |
%profile on
t_range = [0 1];
%can change the number 5
dt = 0.0001;
%0.0001 is test to be a good time step given how it follows the volume and
%area constraint
%can change the number 0.1
sphere
%ellipse
Vmin =Volume(v,nt,x)/3 ;
%1/3 volume is the volume that makes surface intersect
Vmax =Volume(v,nt,x);
a_plot = 0.7;... |
function [CFG] = Enter_screen_size(CFG)
prompt_login = {'?????? ?????? ?? ??????????? ? ??:'; 'Horizontal screen size, cm:'};
prompt_folder = {'?????? ?????? ?? ????????? ? ??:'; 'Verical screen size, cm:'};
prompt = [prompt_login, prompt_folder];
CFG.general.root_folder = 'C:\toolbox\eSports_Cognitive_Tests\';
defaul... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.