text stringlengths 8 6.12M |
|---|
function Tfit=T_dis(Tmin,Tmax,T)
if T>Tmax
Tfit=0;
elseif T<Tmin
Tfit=0;
else
Tfit=(0.006/1.1394*(T-Tmin)^2*(1-exp(0.04*(T-Tmax))));
end
end |
% 仿真结果
% norminv(rand,C(1,1),C(1,2))
tic
load C % 系数既方差矩阵
N = 100000; % 仿真次数
X = [];
Y = [];
for n = 1:1
R = []; % 最低准备金
for k = 1:N
t = 0; % 当前金额
mint = t; % 最少金额
for m = 1:365
% t = t + (tinv(rand,C(2,3))-C(2,2))/C(2,1);
t2 = norminv(rand,0,C(n,2));
... |
%% polynomial regression
% measureing 10 homes with different square ft to see how much electricity
% they use in kilowatt hours per month
clear all; close all; clc;
sf = [1290 1350 1470 1600 1710 1840 1980 2230 2400 2930];
kw = [1182 1172 1264 1493 1571 1711 1804 1840 1956 1954];
plot(sf,kw,'ko');
xlabel('S... |
//
// GameData.m
// MoonHerder
//
// Created by Roger Engelbert on 10/9/12.
// Copyright Done With Computers 2012. All rights reserved.
//
#import "GameData.h"
#import "Game.h"
// GameData implementation
@implementation GameData
@synthesize score = _score;
@synthesize level = _level;
@synthesize lives = _lives;... |
classdef OutputCarteira < handle
% OutputCarteira: Objeto que indica a evolução da carteira de processos
% no tempo
properties
% tSim deve ser o primeiro atributo, os outros não importam
tsim
nProcesso
nPedido
nAcordo
nConden... |
function [const,maps,dim]=load_distr_maps(par)
%% Load in main files
filename=strcat(par.paths.DATA_FOLDER,'physics_constants.mat');
const=load(filename);
filename=strcat(par.paths.DATA_FOLDER,'XZsmall_fields_tokamak_pre_collapse.mat');
maps=load(filename,'size_X','size_Z','Bphi_XZsmall_map','BpolX_initial_XZsmall_map'... |
function phiFaceAverage = upwindMean2D(phi, u)
% This function gets the value of the field variable phi defined
% over the MeshStructure and calculates the upwind average on
% the cell faces, based on the direction of the velocity vector for a uniform mesh.
%
% SYNOPSIS:
% phiFaceAverage = upwindMean2D(phi, u)
%
% PA... |
dataset='KKI';
pipes=['pipeline_abide_run__ANTS/ '; 'pipeline_abide_run__ANTS__freq-filter/ '; ...
'pipeline_abide_run__ANTS__scrub/ '; 'pipeline_abide_run__ANTS__freq-filter__scrub/ '; ...
'pipeline_abide_run__FNIRT/ '; 'pipeline_abide_run__FNIRT__... |
function [x,Iteration,Error] = bandSOR(A,x0,b,omega,epsilon)
% Goal: This code solves the linear system Ax=b, where A is a symmetric banded
% matrix, using banded SOR. A is first stored in compact storage mode
% and next SOR is applied to the compact storage.
% Input: This code accepts a symmetric banded ... |
filepath = '../build/sr0_4.pcd';
data = dlmread(filepath, ' ', 10, 0);
cloud = reshape(data(:,3), 176, 144)';
cloud = fliplr(cloud); % flip left to right
surf(cloud, 'EdgeColor', 'none');
%axis equal
colormap gray
view(0, 90);
|
function ventricular_pressure_yellin(cycle_length, dt, points_one_cycle_ventricle, points_one_cycle_atrium, base_name, suffix)
% Copyright (c) 2019, Alexander D. Kaiser
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the followi... |
%% Esempio funzionamento
img = imread('esempio_funzionamento.PNG');
image(img)
title('Esempio di funzionamento con 4 processori e dimensione dei vettori pari a 100000');
|
% Daniel Couch
% Jonathan Rice
% mapk.m
% GUI for MAPK pathway
%
%
function varargout = mapk(varargin)
% MAPK MATLAB code for mapk.fig
% MAPK, by itself, creates a new MAPK or raises the existing
% singleton*.
%
% H = MAPK returns the handle to a new MAPK or the handle to
% the existing singleton*.... |
function basaritotal=odev2(edata,tdata)
[x,y]=arffoku('C:\Users\Melike Nur Mermer\Desktop\36uci\36uci\d159.arff');
[satir,sutun]=size(x);
sinifsay=max(y);
%eorn{1,1}=1.foldun eğitim seti, eorn{1,2}=2.foldun eğitim seti
%datasetin yarısı eğitim orneği yarısı test
eornsay=length(edata);
tornsay=length(tdata);
ensmsay=25;... |
% define an objective function and gradient
function [f, dfdtheta] = f_df_mlp_actreg(theta, v, args, test)
% [f, dfdtheta] = f_df_actreg(theta, v, args)
% multlayer perceptron
%postive tanh with activity regularization
%---------------------------------------------------
%preliminaries
rho1 = 1.7159;
rho2 = 2/3;
numd... |
function varargout = ellipsoidMesh(elli, varargin)
%ELLIPSOIDMESH Convert a 3D ellipsoid to face-vertex mesh representation.
%
% [V, F] = ellipsoidMesh(ELLI)
% ELLI is given by:
% [XC YC ZC A B C PHI THETA PSI],
% where (XC, YC, ZC) is the ellipsoid center, A, B and C are the half
% lengths of the ellipsoid... |
function [ped_f,ped_label,car00_f,car00_label,car45_f,car45_label,car90_f,car90_label] = read_data()
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
scalar = [1.0 0.6 0.4 0.3];
scalar_num = size(scalar, 2);
ped_sizex = 160;
ped_sizey = 96;
car_sizex = 120;
car_sizey = 192;
for r = 1... |
function [mb_coords] = get_mb_coords(slice_num, tile_num)
currfnm = 'Slice4_tile6_slice149_mb_all.txt';
filename = fullfile('Documents','LPS_PC1_PB_work', 'xy_coords_of_mb','xy_coords_of_mb', currfnm);
fileID = fopen(filename);
mb_coords = textscan(fileID, '%12f %12f... |
function [results, success, raw] = scopf_execute(om, model, mpopt)
%SCOPF_EXECUTE Executes the SCOPF specified by an OPF model object.
% [RESULTS, SUCCESS, RAW] = SCOPF_EXECUTE(OM, MPOPT)
%
% RESULTS are returned with internal indexing, all equipment
% in-service, etc.
%
% See also OPF, OPF_SETUP.
% MATPOWE... |
close all;
%clear;
D = 3; RAND_MAX = 32767;
w1 = 1; w2 = 50; damping = 0.1;
settings.w1 = w1; settings.w2 = w2;
settings.fov = 15;
downscaling_factor = 6;
settings.H = 480/downscaling_factor;
settings.W = 636/downscaling_factor;
settings.D = D;
settings.sparse_data = false;
settings.RAND_MAX = 32767;
settings.side = 'f... |
function res = T2(G,n)
S = graphconncomp(sparse(G));
if (S==1)
res=true;
else res=false;
end
end |
%% Template for worksheet set answers
%% Answers to in-class worksheet ##
Name = 'Angel_Garcia'; % << your name here...
WS = 4; % << number of problem set or work sheet...
%% THE LINES BELOW ARE TO HELP ME GRADE
% PLEASE COPY AND PASTE THIS (WITH ALL THE "%" SIGNS)
% INTO YOUR SCRIPT BELOW YOU... |
clear all;
if strcmp(computer('arch'),'win32'), addpath '.\mex_files\32bit'; end % If the MATLAB is 32bit
if strcmp(computer('arch'),'win64'), addpath '.\mex_files\64bit'; end % If the MATLAB is 64bit
ports = OptoPorts(3); % For 3 axis sensors - Get an instance of the... |
%%%%%%%%%%% exponential of identity functions %%%%%%%%%%%%%%%%%%
function expstruct = make_exp()
expstruct.fn = @exp_fn;
expstruct.dfdx = @exp_dfdx;
expstruct.dfdp = @exp_dfdp;
expstruct.d2fdx2 = @exp_d2fdx2;
expstruct.d2fdxdp = @exp_d2fdxdp;
end
|
function [ Normaltheta ] = Normalization( features,price )
Normaltheta=(((features.')*features)^(-1))*((features.')*price);
end
|
function [y,detVariance]=sampleProposalContinuous(typeSampling,currentModelIndex,proposedModelIndex,modelProblem,algorithm,nReactions,reactionType,N,priorRange,d1,intermediateCurrentInfluentialReactions,intermediateProposedInfluentialReactions,proposedWithinModelMoveNumber,delta,withinModel,proposalType,centeringLocati... |
function ts_out = UnionTS(cfg_in,ts1,ts2)
% function ts_out = UnionTS(cfg,ts1,ts2)
%
% union of ts objects
%
% output is resorted based on start times (ascending)
%
% MvdM 2014-08-28 initial version
cfg_def = [];
cfg = ProcessConfig(cfg_def,cfg_in);
mfun = mfilename;
%% Sanity checks
if isempty(ts1) % function shoul... |
% STRUCTUREFROMMOTION Reconstruct the 3D structure of an object based on a
% set of tracked points
%
% [M S] = structureFromMotion(Points, show_output, color)
%
% Parameters are:
% Points = The set of tracked points
%
% Returns:
% M = Motion matrix
% S = Shape matr... |
function InitializeNet()
%INITIALIZENET Initialize the network's weights and activation functions
% TODO: The current implementation is for a linear perceptron. Change it.
mpath = strrep(which(mfilename),[mfilename '.m'],'');
addpath([mpath 'ActivationFunctions']);
% Set the network's dimensions
N = [10,30,30,1];
L ... |
clc; clear all; close all;
hold on
% Полюса
bottom = -3*pi; top = 3*pi; span = 2*pi;
poles = bottom:span:top;
% Границы
left_border = -6; right_border = 8; bottom_border = bottom - 1; top_border = top + 1;
% Оси
line([left_border;0],[0; 0],'linewidth', 1.5, 'color', 'black');
line([0;right_border],[0; 0],'linewidth'... |
function [data, names] = preprocessTestSFEW(imgList, opts, dagnet)
% takes in a cell array of img files of the form:
% /data/raw/SUBSET/EMOTION/IMG_NAME.PNG
% and returns an h x w x 3 x N data array containing
% the images.
% Use a reduced image set on my local machine
LOCAL_LIMIT = 1000;
if opts.local
numImage... |
function [weights_to_damage, num_damaged] = damagefn(weights_to_damage, pie_chart, high_weight, coeff, sigma)
% this function damages the weights randomly
% the damage is split over four types:
% Red (blockage), Orange (Reflection), Yellow (Filtering) and Green (Transmision)
num_weights = length(weights_to_damag... |
function print(hdl, folder, fname, arg)
os.mkdir(folder);
print(gcf,[folder, filesep, fname], arg);
end |
clear
clc
data = [810 735 259 1290 1125 528 622 468 664 717]
dataM = mean(data)
sd = sqrt((sum((data-mean(data)).^2)/(numel(data)-1)))
|
%@(#) siminput.m 1.2 97/11/25 08:00:48
%
function siminput
blist=[0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 5500 6000 6500 6938 6939]';
% Observera sista steget i blist, skall vara 1 EFPH mer sista riktiga steget
bocfile='/cm/f2/c14/bbyt/short/boc.dat';
conrod=['73=8,41=10,57=65'
'73=8,41=17,57=... |
% plot_Ray_Ric_channel.m
clear, clf
N=200000; level=30; K_dB=[-40 15];
gss=['k-s'; 'b-o'; 'r-^'];
% Rayleigh model
Rayleigh_ch=Ray_model(N);
[temp,x]=hist(abs(Rayleigh_ch(1,:)),level);
plot(x,temp,gss(1,:)), hold on
% Rician model
for i=1:length(K_dB);
Rician_ch(i,:) = Ric_model(K_dB(i),N);
[temp x] = hist(a... |
function [ dg ] = configSegGraph()
global seg;
dg = sparse(size(seg,1),0);
for i = 1:size(seg,1)
source = seg(i);
for j = 1:size(source.n,1)
dg(i,source.n(j)) = size(source.p2n{source.n(j)},1);
sprintf('%d,%d',i,source.n(j))
%input('check');
end
end
%h = view(biograph(dg))
... |
function F = FreeEnergy(X,mu,sigma,pie,lambda0)
% Variational Estep for our models.
%
% Inputs:
% mu: D กม K matrix of means
% pie: 1 กม K vector of priors on s
% lambda0: initial values for lambda
% Outputs:
% F: lower bound on the likelihood
[N,D] = size(X);
self_m = diag(mu'*mu)'; % self product for mu
self_X =... |
save_path = '/Users/Yossi/Dropbox/DPhilProject1/trainingAndTestData';
save_name = '/formatted_dataset_2';
save(strcat(save_path,save_name),'concatTestArray', 'concatTrainArray');
|
function corr_stats(wrkshtcol1,wkrshtcol2)
corrcoef(wrkshtcol1(~isnan(wrkshtcol1)&~isnan(wkrshtcol2)),wkrshtcol2(~isnan(wrkshtcol1)&~isnan(wkrshtcol2)))
% sprintf('%s%% correlated',num2str(corrcoef(wrkshtcol1(~isnan(wrkshtcol1)&~isnan(wkrshtcol2)),wkrshtcol2(~isnan(wrkshtcol1)&~isnan(wkrshtcol2)))*100))
end |
clear; clc;
% Load groundtruth data
filename = '/Users/rogermei/Desktop/Umich 20 Winter/EECS_568/Final_project/visual_odometry/';
oxts = loadOxtsliteData(filename);
pose_matrices = convertOxtsToPose(oxts);
length(pose_matrices)
for i = 2 : length(pose_matrices)
Relative{i-1} = pose_matrices{i-1}^(-1)*pose_matrices{... |
function i = getClassMaxFP(mdl,M)
cvmodel = mdl.crossval('kfold',10);
target = getSimplex(mdl.Y,M);
output = getSimplex(cvmodel.kfoldPredict,M);
[err,mat_conf,idx_of_samps_with_ith_target,~] = ...
confusion(target,output);
disp(err);
h = plotconfusion(target,output);
idxDiagnal = 1:M+1:numel(mat_conf);
mat_conf(idxDiag... |
function [H, inlierIdx] = RANSAC_fit_Homography(pts1,pts2)
sampleSize = 4;
target=0.99;
threshold=5;
totalCorrspondences = size(pts1,2);
sample_count=0;
p=0;
while p<target
sample_count=sample_count+1;
randomSampleIdx=randIndex(totalCorrspondences, sampleSize);
HHyp=vgg_H_from_x_lin(pts1(:,randomS... |
function [const,CI,Idx]=dnf_asympt(arr,eps)
%QUESTION 3 SECTION B
%the function recgonizes the index and value of a graph's convergence point.
%INPUTS: arr - one dimensional array. eps - stabilization criterion.
%OUTPUTS: const - estimated constant. CI - confidence interval. Idx - the
%index of the convergence poi... |
function [VarStruct, StatOpt, IsMAT]=w_uiLoadMat(varargin)
if nargin==0
PDir=pwd;
elseif nargin==1
PDir=varargin{1};
else
error('Invalid Input');
end
if exist(PDir, 'file')==2
PDir=fileparts(PDir);
elseif exist(PDir, 'dir')==7
PDir=PDir;
else
PDir=pwd;
end
VarStruct=[];
StatOpt=[];
[File, Pat... |
%WINONTOP
% WINONTOP(FH) set "topmost" property of the figure specified by handle
% FH to state "on".
%
% WINONTOP(FH,1) same as WINONTOP(FH)
%
% WINONTOP(FH,0) set "topmost" property of the figure specified by handle
% FH to state "off".
%
% * Copyright (c) 2011, John Anderson
% * Alterations made by Eckhard... |
function [psnr, ssim] = myQuality1(x, y)
psnr = myPSNR1(x,y);
ssim = mySSIM1(x,y);
|
% returns some kind of norm for the transformation
% may be changed
function R = measureTransformation( trans, vector )
checkSize('trans', trans, [3, 3]);
checkSize('vector', vector, [5, NaN]);
transformed = transform(trans, vector(1:2, :));
R = measureTheDifference( transformed, vector(3:... |
% Demo for Structured Edge Detector (please see readme.txt first).
%% set opts for training (see edgesTrain.m)
opts=edgesTrain(); % default options (good settings)
opts.modelDir='models/'; % model will be in models/forest
opts.modelFnm='modelBsds'; % model name
opts.nPos=5e5; opts.nNeg=5... |
classdef MhInfEng < InfEng
% Metropolis Hastings
% Model must support the following methods
% lp = logprob(model, x, false) % unnormalized log posterior
% xinit = mcmcInitSample(model, visVars, visVals);
properties
Nsamples; Nburnin; thin;
proposal;
symmetric;
Nchains;
... |
function[A] = GenMat(n,ncond)
% generador de matrices de dimensi?n n con n?mero de condici?n ncond.
ncond = sqrt(ncond);
randn('state',1);
R = randn(n);
[U,L,V] = svd(R);
D(1,1) = 1.0d0;
for i=2:n
D(i,i) = ncond^( -1/(n-i+1));
end
A = U*D*U';
condA =... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Res = Findnearest(XX)
[n,p] = size(XX);
if ~isempty(n)&~isempty(p)
Res = zeros(n,(p*2+3));
if n > 1
for i = 1:n
dsq = zeros(n,1);
current = XX(i,1:p)... |
function [varargout]=esplot(varargin)
% fh=esplot(commands)
%
% Commands:
% 'figure', figurenumber, file-prefix
% The format and plot action command, given the figurenumber of
% orginal figure and file-prefix.
%
% 'style', styles
% Defines the styles to be used. Argument styles is ... |
function [c,n] = puntofijo(g,x0,tol,MaxIt)
if nargin < 3
tol = 1e-4; % esto es 10^-4
end
if nargin < 4
MaxIt = 100;
end
n = 0;
x = x0;
E = abs(g(x)-x);
while E > tol && n < MaxIt
n = n + 1;
x = g(x);
E = abs(g(x)-x);
end
c = x;
end |
function [ output_args ] = plotall( )
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
tau = [0.1, 0.3, 0.8,2,10];
[a,b,c] = lxlrc(0.8);
linespec = {'b', 'r', 'g','k','m'}
figure;
scatter(a,b,'y','*');
lo = length(tau)
for i = 1:lo
hold on;
[a,b,c] = lxlrc(tau(i));
data = [a... |
% train a multi-SVM
% need to pre-run: loadHandWritingData.m
clc
t = templateSVM('KernelFunction', 'linear')
mdl = fitcecoc(trainSet, trainLabel, 'Learners',t)
% for 'Learners' with t = templateSVM('KernelFunction', 'polynomial'),
% successRatio = 0.9831 (numError = 16), it takes about 2 miniutes
%% predict
predict... |
% part 2.2
% hamming window
Hs = hamming(224);
Hp = hamming(216);
hamming_window = Hs * Hp.';
figure
subplot(1,3,1)
imshow(hamming_window)
title('hamming window')
%plot origin magnnitude image
k_space_data = load('K_space_data.mat');
k_space = k_space_data.K_space_slice18;
X = ifft2(k_space);
subplot(1,3,2)
imshow(... |
% 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... |
% 2017 Fall Numerical Optimization Homework #1
% 2017. 09. 25
% 20161216 HAN SANGJUN
%% Problem 1 - find local minima (3*x^2 - 6*x + 7)
clc;
clear;
close all;
syms x;
f = symfun(3*x^2 - 6*x + 7, x);
% first derivative
fx = diff(f, x);
% ======================== Bisection method ======================... |
%1.1
figure(1) %designates plot as figure 1
t=0:0.01:10; %sets t as 1001 long vector
subplot(311) %sets plot as 1x3 grid of subplots
p1=cos(3*pi/5*t); %calculates sinusoidal wave with w=3pi/5
plot(t,p1) %plots waveform vs t a... |
function [W, H, cost] = cnmfsc(V, num_basis_elems, context_len, config)
% cnmfsc Decompose a non-negative matrix V into WH using convolutive NMF
% with sparseness constraints [1]. W is a time-varying basis tensor and H
% is the encoding matrix that encodes the input V in terms of the basis W.
%
% Inputs:
% V: [non-n... |
%authors: Johannes Gätjen, Lorena Morton
close all;
occurences = [1 1; 1 0; 0 1; 0 0];
gamma =1;
stats = [gamma/4, 0.5 - gamma / 4, 0.5 - gamma / 4, gamma / 4];
ranges = cumsum(stats);
samples = 10000;
randoms = rand(samples, 1);
idxs = repmat(randoms, 1, 4) < repmat(ranges, samples, 1);
inputs = zeros(samples, 2);
for... |
% Script to illustrate the sensitivity issue with naive NCR
% Even "negative" samples with low level background activity will trigger
% the cascade, and the timing with which the signals for positve and
% negative samples is quite close, even given relatively large initial
% differences
clear
close all
addpath('../ut... |
function z=isobserver(x)
%ISOBSERVER Check for valid observer specification
% Part of the OptProp toolbox, $Version: 2.1 $
% Author: Jerker Wågberg, More Research & DPC, Sweden
% Email: ['jerker.wagberg' char(64) 'more.se']
% $Id: isobserver.m 23 2007-01-28 22:55:34Z jerkerw $
z=~isempty(observer(x));
|
function array2 = checkCollision(array)
array2 = array;
addIndexes = [];
addx = [];
addy = [];
for i = 1:length(array)
if array(i).in_play
for j = (i + 1):length(array)
if array(j).in_play
x_difference = (array(i).pos_x - array(j).pos_x)^2;
y_difference = (array(i... |
function y = huffman_test( Px )
list = cell( 1, length( Px ) - 1 );
for i = 1:length( list )
list{ i } = cell( 1, 3 );
endfor
Px = sort( Px, "descend" );
list{ 1 }{ 1 } = Px;
for i = 2:( length( Px ) - 1 )
list{ i }{ 1 } = list{ i - 1 }{ 1 }( 1:( end - 2 ) );
list{ i }{ 1 }( end + 1 )... |
function [loglik, path] = viterbi_path(prior, transmat, obslik)
% VITERBI Find the most-probable (Viterbi) path through the HMM state trellis.
% path = viterbi(prior, transmat, obslik)
%
% Inputs:
% prior(i) = Pr(Q(1) = i)
% transmat(i,j) = Pr(Q(t+1)=j | Q(t)=i)
% obslik(i,t) = Pr(y(t) | Q(t)=i)
%
% Outputs:
% loglik
%... |
function [constant c coord_stations p1 refstation rtdstations sigma_toa sigma_rtd x y z LOS_T]=...
load_scenario(scenario)
% global constant c coord_stations p1 refstation rtdstations sigma_toa sigma_rtd x y z
LOS_T=0;
%% Innsbruck WAM System, Takeoff Line
if strcmp(scenario,'Innsbruck1') % strcmp = C... |
function [ afValues, afTimes ] = GetSolarRadiationFromALookUpTable( tSignal )
% starting from the current data a costant pattern (always null) for
% the Solar Radiation, for the next requested hours
%
afValues = [];
afTimes = [];
CONSTANT_SOLAR_RADIATION_VALUE = 0;
%
try %
%
iNumberOfHourlySamp... |
function varargout = optionpricegui2(varargin)
% OPTIONPRICEGUI2 M-file for optionpricegui2.fig
% OPTIONPRICEGUI2, by itself, creates a new OPTIONPRICEGUI2 or raises the existing
% singleton*.
%
% H = OPTIONPRICEGUI2 returns the handle to a new OPTIONPRICEGUI2 or the handle to
% the existing singlet... |
function [J, grad] = costFunctionReg(theta, X, y, lambda)
%COSTFUNCTIONREG Compute cost and gradient for logistic regression with regularization
% J = COSTFUNCTIONREG(theta, X, y, lambda) computes the cost of using
% theta as the parameter for regularized logistic regression and the
% gradient of the cost w.r.t. ... |
% Label pitch of wave files in a given directory
addpath d:/users/jang/matlab/toolbox/utility -end
addpath d:/users/jang/matlab/toolbox/sap -end
close all; clear all;
% Directory of the wave files
auDir='D:\users\jang\books\audioSignalProcessing\programmingContest\pitchTracking\exampleProgram\waveFile\rogerJan... |
function p = tmc_gss( t, s )
% TMC_GSS - First guess for the parameters of the Theis model with a constant head boundary for multiple rate tests
%
% Syntax: p = tmc_gss(t,s)
%
% p(1) = b = slope of Jacob straight line for late time (= 0.183/T)
% p(2) = t0 = intercept with the horizontal axis for s = 0
% p(3) = ... |
%Tema 1 Interpolacion....salvado de datos
%Ejemplo de diferencias divididas
x=[1,1.3,1.9,2.2]
y=besselj(0,x) %J0 de Bessel
format long
d=difdiv(x,y) %esto te da la tabla de las difdiv
p=ifn(x,y) % ifn o tmb ifn2 es el programa que da interpolante en forma de newton
P=char(p)
fplot(p,[1,2.2]) %pinta la aprox
hold on
pl... |
%close all
clear all
% Time settings
tI = 0; % Init time
tE = 7; % Ending time (acquisition stops just before tE)
N = 256; % nr. of points
Te = (tE-tI)/N; % sampling period
Fe = 1/Te; % sampling frequency
t = tI:Te:tE-Te; % last point: tEnd, is NOT in t
f0 = 2.74; % Hz
% Window:... |
function result = f_capOptimal(Y,dis,X,sm,verb)
% - get optimal value of m for f_cap
%
% USAGE: result = f_capOptimal(Y,'dis',X,sm,verb);
%
% Y = matrix of response variables (rows = obs, cols = variables)
% dis = dissimilarity measure to apply to Y
% (e.g., dis = 'bc'; see help for f_dis)
%
% X = (1) vecto... |
%Executando metodos
fprintf('Bissecao\n');
raizBissecao = metodoBissecao();
fprintf('IterativoLinear\n');
raizIteracao = metodoIterativoLinear();
fprintf('NewtonRaphson\n');
raizNewton = metodoNewtonRaphson(); |
classdef RegionAutomaton
properties
S
Lambda
Gamma
Delta
iota
lambda_e
gamma_e
lambda_s
gamma_s
b
c
F
p
reg
state
Prev
type
zeno
flow_time
end
methods
% Constructor
... |
function ObtainPWAFunction( tController )
%Getting the solution of the Explicit Problem
%
try %
%
%
% Obtaining TpolyObject
%
tPolyUnion = mpt_mpsol2pu(tController.tSolution);
tPolyUnion.toMatlab('C:\Users\fabietti\Documents\GitHub\OpenTestbed\Software\Matlab\Comparisons\CO2\OriginalPWAfunction', 'primal... |
format long;
clear all;
close all;
clc;
%Ejercicio 3_2
%PVI
f = @(t, y) y + 2*exp(-1*t);
y0 = 1;
I = [0,1];
h1 = 1/10;
m1 = 1/h1;
[T,Wt1,kt1] = mTrapE_estados(f, y0, I, m1);
%Solucion exacta
y = @(t) (2-exp(-2*t))*exp(t);
%error global 1
Et_1=abs(y(1)-Wt1(end));
%hacemos h mas pequena
h2 = h1*0.5;
m2 = 1/h2;
[T,Wt2... |
function [ M data ] = mobilesvm()
%MOBILESVM Summary of this function goes here
% Detailed explanation goes here
% A = importdata('data1.txt');
% M = [];
% for i = 1:numel(A)
% M=[M;json2mat(A{i})];
% end
M=json2mat('data1.txt');
%sensor list
[~,n1]=size(M.alist);
[~,n2]=size(M.glist);
[~,n3]=size(M.gvyList);... |
function sim = gaussianKernel(x1, x2, sigma)
%RBFKERNEL returns a radial basis function kernel between x1 and x2
% sim = gaussianKernel(x1, x2) returns a gaussian kernel between x1 and x2
% and returns the value in sim
% Ensure that x1 and x2 are column vectors
x1 = x1(:); x2 = x2(:);
% We need to return the foll... |
% Example code for multi-output prediction using some simulated data (It is
% not the code for the following paper, there are some sight differences)
%
% Copyright: Magica Chen 2019/07/16
% email: sxtpy2010@gmail.com
%
% Reference :
% [1] Chen, Zexun, Bo Wang, and Alexander N. Gorban. "Multivariate
% Gaus... |
function xyzLimits = setAxisRange(dataIn, offset)
sizeData = size(dataIn);
if sizeData(1) < 4 % detect each row
xyzLimits = zeros(1,sizeData(1)*2);
for i = 1 : sizeData(1)
xyzLimits(i*2-1) = min(dataIn(i,:)) - offset;
xyzLimits(i*2) = max(dataIn(i,:)) + offset;
end
else
xyzLimits = ze... |
% Christian Sherland
% 2-28-13
% Single Class SVM Signal Segmentation
clear;
clc;
globalVar;
cd .
numFeatures = 3;
load devFeatures.mat;
load training.mat;
train_mfcc = cellfun(@(x) x(:,1:numFeatures), trainingCeps, 'UniformOutput', false);
trainFeature = [train_STEnergy train_Centroid] ;
devFeature =[devSTE devCent... |
%%Code for Element Generation
function elout=elcalc(elin,xn,yn,mat)
err=1e-12;
elout=elin;
elout(:,4)=1/2*(xn(elout(:,2)).*yn(elout(:,3))+xn(elout(:,1)).*yn(elout(:,2))+...
xn(elout(:,3)).*yn(elout(:,2))+...
xn(elout(:,3)).*yn(elout(:,1))-xn(elout(:,2)).*yn(elout(:,1))-...
xn(elout(:,3)).*yn(elout(... |
%Get constants
clear all;
run Constants.m
%Full state information => C = [1 1 1] => y_t = x_t
%function x_(t+1) = h(x) = Ax_t + Bu_t
h = @(x,u) A*x+B*u;
%Start condition
Y = [x0];
U = [0];
y = x0;
for n = 0:N-1
%%Solve QP-problem
beq(1:nx) = A*y;
z = quadprog(G,[], [], [], Aeq, beq, lb, ub);
%Extract s... |
%--time series
clear
clc
%data_path='/Users/hcq/workspace/MCS_2016_private/data/';
data_path='/home/hxm_stu/WORK1/hcq/MCS/data/';
data_name3= 'record_num_exp3.txt';
% data_name = 'record_num_region.txt';
record_num3 = load (fullfile(data_path, data_name3));
[xt3,i3] = sort(record_num3(:,1));
yn3 = record_num3(i3,2);... |
function c = K_correct_coef(alpha,N_mean)
% alpha = 1.5;
% N_mean = 80;
r = alpha;
p = alpha./(alpha+N_mean);
N1 = nbinrnd(r,p,1,10000);
N2 = nbinrnd(r,p,1,10000);
Nmin = min([N1;N2]);
c = mean(Nmin)/N_mean;
% fprintf('To correct : y = y/a and the corrected coefficient a = 1/c is %.4f \n',1/c);
|
% Örnek dosyanın 3x3 konvolüsyon ile Sobel Filtresini alan fonksiyon
clear all;
A1 = imread ('C:\Users\HP\Desktop\GoruntuIsleme\yesiltop3.jpg');
A2 = rgb2hsv(A1);
sat=size(A2)(1);
sut=size(A2)(2);
A=uint8(255*A2(:,:,1));
esik=120;
A3=0;
for i=1:sat
for j=1:sut
if A(i,j)>esik
A3(i,j)=1;
else
A3(i,j)=0;... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Author: Hamza Bourbouh <hamza.bourbouh@nasa.gov>
% Notices:
%
% Copyright @ 2020 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration. All
% Rights Reserved.
%
% Disclaimers
%
% No Warranty:... |
function plotGradientDescIter( savePath, pauseTime, iters, rfids, plotIds )
%PLOTGRADIENTDESCITER Summary of this function goes here
% Detailed explanation goes here
if nargin<1 || isempty(savePath)
savePath = pwd;
end
if nargin<2 || isempty(pauseTime)
pauseTime=0.1;
end
if nargin<3 || isempty(iters)
tmp=dir(f... |
function obj = predecessorXML(obj,predecessor)
%predecessorXML Parsing the XML to the corresponding classes and properties
%
%----------------------------------------------------------------------
% BSD 3-Clause License
%
% Copyright (c) 2020, Jonas Wurst, Alberto Flores Fernández
% All righ... |
clear
set(0,'DefaultAxesFontSize', 18)
beta=1;
g=0.25;
b=0.25;
R0=beta/(b+g);
N=100;
init=2;
dt=0.01;
time=25;
sim=3;
for j=1:sim
i(1)=init;
for t=1:time/dt
r=rand; % uniform random number
birth=beta*i(t)*(N-i(t))/N*dt;
death=(b+g)*i(t)*dt;
if r<=birth
i(t+1)=i(t)+1;
elseif r>birth && r<=birth+death
i(t+1)=i(t)-1;
els... |
clear all
close all
clc
format compact
addpath ../../coreFiles -end
% - - - - - - - - - - - - - - - - - - - - - - - - -
buoyNumber = 52406;
%run(strcat('../buoyData/buoy',num2str(buoyNumber),'_data.m'));
load ../buoyData/buoy52406_Dart_Data
pMaxInd = round(mean(find(p==max(p))));
% - - - - - - - - - - - - - - -... |
%function to train and test spectral model
function [sp len] = hsmm(train, test, Nobs, Nhid_true, Dmin_true, Dmax_true, A1_true, A_true, D_true, O_true, flg)
disp('Spectral Training ...');
[rootTensor ...
tailTensor ...
obsTensor ...
tranTensor ...
durTensor ] = learnSpectModel2(train, Nobs, Nhid_true, Dmin_t... |
function [ camData ] = GenCam( path, plotCam, range, dataset, idx )
%GENCAM Generates camera transformations
%--------------------------------------------------------------------------
% Required Inputs:
%--------------------------------------------------------------------------
% path- path to the dataset to use
%... |
clear all
close all
clc
% Load paths dynamically
load('C:/pathsave/pathsave.mat');
% Declaring path variables. End the string with a "\"
global PATH_WRKDIR PATH_DATA PATH_EEGLAB PATH_RESULTS
PATH_WRKDIR = 'C:\Users\Jeffrey Benistant\Desktop\Mathlab\';
PATH_DATA = [ PATH_WRKDIR 'Data\Raw\' ];
PATH_EEGLAB ... |
function output = Normalization(input)
%%
% This function is to normal the data
% Author : Bo Yu Huang
% Date : 2018.7.31
% title : Normalization
%% [I-mean(I)] / sigma(I)
output = (input - mean(input)) / std(input);
end |
function ceshi_Excel
%利用MATLAB生成Excel文档
% ceshi_Excel
%
% Copyright 2009 - 2010 xiezhh.
% $Revision: 1.0.0.0 $ $Date: 2009/12/14 20:40:00 $
% 设定测试Excel文件名和路径
filespec_user = [pwd '\测试.xls'];
% 判断Excel是否已经打开,若已打开,就在打开的Excel中进行操作,否则就打开Excel
try
% 若Excel服务器已经打开,返回其句柄Excel
Excel = actxGetRunn... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.