text stringlengths 8 6.12M |
|---|
%> @file run.m
%> @brief Holds all the information needed to execute a single experiment with K-Means
%> @details Holds the parameters, run-time data, and results for a K-Means experiment
%> @author Ben Nordin
%> @date 2011-09-01
% ======================================================================
%> @brief Holds a... |
function [ret] = pcz_checkfieldAll(model,varargin)
%% Script pcz_checkfieldAll
%
% File: pcz_checkfieldAll.m
% Author: Peter Polcz (ppolcz@gmail.com)
%
% Created on 2018. March 28.
%
%%
ret = all(cellfun(@(name) isfield(model,name), varargin));
end |
function [modulatedSignalBPSK,time] = BPSKModulator(encodedSignal,t,A,Wc,Ts,Tb)
%BPSKMODULATOR Summary of this function goes here
% Detailed explanation goes here
samplingTime=Ts:Ts:Tb;
j=1;
for i=1:length(encodedSignal)
if (encodedSignal(i)==0)
modulatedSignalBPSK(1,j:j+(Tb/Ts)-1)=-A*cos(Wc*samplingTime... |
function [u1 , u2] = compute_partial_solutions(model,model_data)
model.decomp_mode = 1;
[A,r] = model.operators(model,model_data);
model.decomp_mode = 2;
[Acoeff,rcoeff] = model.operators(model,model_data);
A1_diff = Acoeff{2}(1)*A{2}{1};
A1_adv = Acoeff{2}(3)*A{2}{3};
A1_dir = Acoeff... |
function save_interaction_by_threshold(threshold, is_used_for_weighted_graph)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
load('genesPhenes.mat')
% set filename for different situation
if is_used_for_weighted_graph
ggi_filename = sprintf('ggi_%.1f_weighted.txt',threshold);
els... |
function mm=minmax(a)
% function MINMAX(A)
% Return minimum, maximum and mean value of matrix A
%
% See also MMIN MMAX MMEAN CLOSEST
% d menemenlis 8/21/94
ix=find(~isnan(a));
mm(1)=min(a(ix));
mm(2)=max(a(ix));
mm(3)=mean(a(ix));
|
function [Ees,Eei,Eer,Epcs,Epci,Epcr]=Error(So,Io,Ro,t)
N=So+Io+Ro;
a=0.125;
b=0.9;
%resolucion usando metodos implementados en octave
tl=0:0.01:t;
pasos=length(tl);
pazoz=1:pasos;
function sir=f(x,t);
a=0.125;
b=0.9;
sir(1)=-b*(x(1))*(x(2));
sir(2)=(x(2))*(b*(x(1))-a);
sir(3)=a*(x(2));
endfunction
x=lsode("f",[S... |
clc;clear;close all
char_C = [0 0 0 0 0 0 0 0 0;
0 0 0 1 1 1 1 0 0;
0 0 1 1 1 1 1 1 0;
0 1 1 1 0 0 1 1 0;
0 1 1 0 0 0 0 0 0;
0 1 1 0 0 0 0 0 0;
0 1 1 0 0 0 0 0 0;
0 1 1 0 0 0 0 0 0;
0 1 1 1 0 0 1 1 0;
0 0 1 1 1 1 1 1 0;
0 0 0 1 1 1 1 0 0;
0 0 0 0 0 0 0 0 0];
[N,P] = size... |
% 基于迈克耳孙干涉仪的自相关仪
c = 299792458;
l = 20e-9; % 30 nm
L = 20e-3; % 2 cm
t = 2*l/c; t = t*1e15 % fs
T = L/l *t; % fs
T = T*1e-3 % ps
f = 1/T; % THz
f = f*1e3 % GHz
|
function [ y ] = Difsigmoid(x)
% Summary of this function goes here
% This function gives the differentiation of sigmoid function
% Detailed explanation goes here
y = 1 + x*0;
end
|
% 3.12 Rotorcraft trim
clear all
clc
h = 100; % flight altitude
[~,~,~,rho] = atmosisa(h);
%table_trim_states = readtable('trim_result_no_redundant.csv');
%% build object
run init_build.m
%% hover/foward trim X,Y,Z,L,M,N=0,[theta_0,theta_diff,theta_1c,theta_1s,theta,phi,v_i1,v_i2]
Rotorcraft.DoubleRotorHelicopter.U ... |
% 2018-07-06 Dylan Royston
%
% Copied from jeff's spikeSortToIDataSS
%
% Takes in (spikes, times) from FUNC_SpikeSort_returnData and replaces relevant fields in idata for later processing
%
%
%
%
%
%%
function ss = FUNC_insert_sorted_idata(subject, spikes,times)
% get spike sort output back into idata format
switch ... |
%% Fine eye movements and different types
nTrials = 500;
% Integration time
tStep = 10; % Adequate for absorptions (ms)
% Cone mosaic field of view in degrees
coneMosaicFOV = 0.25;
% Scene field of view
sceneFOV = 0.35;
% Spatial scale that controls visual angle of each display pixel The rule is 6/sc
% arc sec... |
function [dict,dict_norm,lut,phantom,density,T1_phantom,T2_phantom,df_phantom]= generate_dict_phantom()
% this function generates IR-BSSFP dictionary and synthetic MRF data from
% Brainweb phantom
% Outputs:
% dict: IR-BSSFP dictionaty (noormalized)
% dict_norm: fingerprints norm
% ... |
function status=writeTrc(trc_struct,filename)
%Writes a trc strucutre into a trc motion capture file
%Open file for writing
fid = fopen(filename,'w');
%Write PathFileType and pathfilename
fprintf(fid,'PathFileType\t4\t(X/Y/Z)\t%s\t\r\n',filename);
%Write header fields and their values
fprintf(fid,'%s\t',trc_struct.h... |
function y1 = ponto_central(x0, y0, h)
f = funcao(x0, y0);
y1 = y0 + h*funcao(x0+h/2, y0 + h/2*f);
end
|
function [J, grad] = costFunction(theta, X, y)
%COSTFUNCTION Compute cost and gradient for logistic regression
% J = COSTFUNCTION(theta, X, y) computes the cost of using theta as the
% parameter for logistic regression and the gradient of the cost
% w.r.t. to the parameters.
% Initialize some useful values
m = l... |
function [P TS]= idxmapper(P1Test, P2Test, P1Ref, P2Ref);
% Get Variable Time-Stretching Ratio and pointing index
%
% [P TS]= idxmapper(P1Test, P2Test, P1Ref, P2Ref);
%
% P1 : The index of windowing start
% P2 : The index of windowing end
%
% XTest(P1Test:P2Test) -----> Match ----> XRef(P1Ref:P2Ref)
%
% ... |
% Un sistema de ecuaciones de una sola variable (digamos, x_1) se puede definir como una
% funcion de linea ( f( ) ). El objetivo de definirlo de esta forma es encontrar
% los valores de x_1 tal que, f(x_1) = 0. Es decir, se desea encontrar
% las raices de f(x_1).
% Definir f( ).
f = @(x) ( sin(x).*x.^2 + 3.... |
function [output]=bin2frac(a,ibits,fbits);
% [output]=frac2bin(a,ibits, fbits);
% a=array to be converted to real numbers
% ibits=integer part bits , must be an integer >0
% fbits=number of fractio nal bits, must be an integer>=0
% This returns a real number in [outpu... |
function coef = sgmga_vcn_coef ( dim_num, level_weight, x, q_max )
%*****************************************************************************80
%
%% SGMGA_VCN_COEF returns the "next" constrained vector's coefficient.
%
% Discussion:
%
% The related code "SGMGA_VCN_COEF_NAIVE" represents a "naive" approach to
%... |
function A = so31(p)
p = [imag(p),real(p)];
A = [0,p(1),p(2),p(3);...
p(1),0,-p(6),p(5);...
p(2),p(6),0,-p(4);...
p(3),-p(5),p(4),0];
end
|
clear all
close all
f = 0:0.001:10;
parameters = load('question01parameters.mat');
%% Tube 1
E1tests = [ 9e6 8e6 7e6 6e6 5e6 ];
ZinCReal = cell(length(E1tests),1);
ZinCImag = cell(length(E1tests),1);
legendCell = cell(length(E1tests),1);
for k = 1:length(E1tests);
parameters.E1 = E1tests(k);
[ZinCReal{k},Zin... |
dndist = @(d1,d2) (sum( (d1./sum(d1) - d2./sum(d2)).^2 ));
IUBD = @(s,a,b) (1./(2*besselk(0,2*sqrt(a.*b))) .* exp(-b.*s - a./s)./s); % via eqn 13
lognpdf2 = @(x,a,b) ((1./(b*sqrt(2*pi))).*exp(-(log(x)-a).^2/(2*b.^2))); % via eqn 18 (no 1/x)
x = 0.01:0.01:4; %in micrometers
figure;
hold on;
title('For EMD3(1), using ... |
function [w] = learn(X, y)
[n m] = size(X);
bias_column = ones(n, 1);
X_tilda = [X bias_column];
w = zeros(m + 1);
[Q R] = Householder(X_tilda);
y_tilda = Q' * y;
w = SST(R,y_tilda);
end
|
H = [ 0.45-0.14j 0.2+0.03j; 0.4+0.11j 0.1-0.13j; 0.15+0.17j 0.3-0.24j]
[U,S,V] = svd(H);
%the channel gains decomposition
SS = S.^2
% V is V
V
log2(2) |
% annual electricity demand [MWh]
annual_load = [
85577570 % 'Heilongjiang'
52046179 % 'Jilin'
104177680 % 'Liaoning'
85321605 % 'Shaanxi'
61260913 % 'Gansu'
32422210 % 'Qinghai'
44623200 % 'Ningxia'
151846276 % 'Beijing'
88504686 % 'Tianjin'
100679494 % 'Hebei'
129518197 % 'Shanxi'
105542826 % 'Mengxi'
247176690 % 'S... |
%this function calculates 3 similarity metrics that relate an expected
%synergy set (Tr) to the actual synergy set (Val) of a dataset
%Navid Lambert-Shirzad 20170105
function [AvgReconsErr_Val, RegCoeff_Val, RSquared_Val, AvgValueDP, nCommonMethod2] = calc_similarity(DOF, ValFullSet, Synergies_Tr, Synergies_Val) %nC... |
function res = compute_residue(A,x,b)
new_b = A*x;
res = sum((new_b - b).^2);
res = sqrt(res);
end |
function displayMatching(cdata,varargin)
delta = 1;
showFeature = false;
drawEllipse = false;
grayImage = false;
blackBG = true;
linewidth = 1;
color = {'r','g','b','c','y','m'};
ivargin = 1;
while ivargin <= length(varargin)
switch lower(varargin{ivargin})
case 'delta'
ivargin = ivargin + 1;
... |
clear all
close all
clc
%% sec 1.1
boxImage = imread('stapleRemover.jpg');
figure(1)
imshow(boxImage);
title('box image');
%% sec 1.2
sceneImage = imread('clutteredDesk.jpg');
figure(2)
imshow(sceneImage);
title('scene image');
%% sec 1.3
point_box = detectSURFFeatures(boxImage);
point_scene = detectSU... |
clear;
[file,path]=uigetfile("*.tif*"); %for extracting filepath %
dir_path=path; %path of the input file excluding the input file name%
path=fullfile(path,file);
a=imread(path);
arr_dim=size(a);
w=arr_dim(1);
h=arr_dim(2);
k_1=zeros(w+2,h+2);
for x=1:w
for y=1:h
k... |
%% Walking in the park using alternating constrants
% NOTE ACCIDENTALLY SWITCHED LEFT AND RIGHT FOOT SENSORS DURING COLLECTION
%In this version each IMU uses their magnetometer
addpath('../../');
addpath('../');
addpath(genpath('C:\asl_git\kalmanfilter\ik_framework\common\ars'));
data_path = 'C:\aslab\data\Gait_lowe... |
classdef ClassifierMixin < handle
% Mixin class for all classifier estimators in sklearn-matlab.
properties
estimator_type = 'classifier';
end
methods
end
end
|
function [hash] = githash(fname, gitdir)
if ~exist('fname', 'var')
fname = '.';
else
fname = ['-- ' fname];
end
if ~exist('gitdir', 'var')
gitdir = '--git-dir=./chipod_gust/.git/';
else
gitdir = ['--git-dir=' gitdir];
if isempty(findstr(gitdir, '.git'))
... |
function I_rec = my_col2im(X, patch, im_size)
% Provides the functionality of col2im function of the image processing
% toolbox.
%
% INPUT
% X: (d x n) observations matrix. Obviously d=patch*patch and n is the
% number of patches extracted
% patch: The size of the square patches extracted
% im_size: Size o... |
function var_est = auto_cov( whole_in )
%% estimate the auto-covaraince of the input g(x)
var_est = zeros(1, 6);
seq_length = length(whole_in);
%% batch estimate
batch_len = [10 20 30];
for i_bat = 1:length(batch_len)
a = reshape(whole_in, batch_len(i_bat), []);
a = mean(a);
var_est(i_bat) = var(a);
end
... |
% Script to exercise the DIRECT optimization Algorithm with ADVISOR.
%
% 1) initialize workspace
% 2) define the problem
% 3) run optimizer
% 4) save results
%
clear all
clc
SetAdvisorPath;
% initiate timer
tic
% initialize the workspace
if 1% 1=initialize, 0=don't initial - for continuation runs
% %Pass the small p... |
function [sza_out hour_out] = get_sza_angle(mfile,grlfile)
% sza = get_sza_angle(mfile,grlfile)
%
% read solar zenith angle of the ftir measurement
% needs the grl file, too
[sza names year day hour lat lon alt tins pins hins tout pout hout sia] = ...
read_zenith_angles(grlfile,90);
runs = str2num(names(:,end-3... |
function Q3_CountTrainImagesByLabels()
load('Train.mat','trainData', 'trainLabels');
count = uint8(zeros(40, 1));
n = size(trainLabels, 1);
for i =1:n
count(trainLabels(i)) = count(trainLabels(i)) + 1;
end
csvwrite('Q3_CountTrainImagesByLabels.csv', count);
end
|
function [Cpmnew,B] = conds( Cpm,E,e,B )
%{
Condition a set of cpms (Cpm) by given evidence (E,e)
Input:
Cpm: Ncpm x 1 cell array of cpm
E: 1 x Ne array of evidence variable
e: 1 x Ne array of evidence state
B: Nx x 1 cell array of basic state indicator
Output:
Cpmnew: Ncpm x 1 cell array of cpm aft... |
function x=SeamPlot(x,SeamVector,orient)
% SEAMPLOT takes as input an image and the SeamVector array and produces
% an image with the seam line superimposed upon the input image, x, for
% display purposes.
%
% Author: Danny Luong
% http://danluong.com
%
% Last updated: 12/20/07
value=1.5*max(x(:));
if(strcmp(... |
n = input('Numero de Cifras Significativas')
Es=0.5*(10^(2-n))
disp('Porcentaje de Tolerancia')
disp(Es) |
function displayTracksCallback( track )
% assume tracks are given in "RFS GPS" coordinates
% assume the imported map is align with North at the top of the image
% assume the fire hydrant is (0,0) where x is East and y is North
global G_displayTracks
if isempty( G_displayTracks )
error('Do not call this function ... |
function [response mu EMplot]= EMG(flag,img,k)
close all;
%rng(1331);
%img = 'stadium.bmp';
%k = 12;
%flag = 0;
%[img cmap] = imread('stadium.bmp');
[img cmap] = imread(img);
img_rgb = ind2rgb(img,cmap);
img_double = im2double(img_rgb);
[n m] = size(img);
strip = reshape(img_double,[n*m 3]);
idx = kmeans(strip,k,'Ma... |
function feat = lbpExtract(szPatch,sift_fac,scales,faces)
%%
table=getmapping(8,'u2');
table=double(table.table);
lenCode=59;
szImage = size(faces{1});
parfor indImg =1 : length(faces)
if numel(faces{indImg})>0
feat{indImg} = PMLBP(faces{indImg}, scales, szPatch, sift_fac, szImage, table, lenCode);
... |
clc, clear all, close all
tic % start computation time
% for calling helper functions
addpath(genpath('\\bmi-nas-01\Contreras-UH\Infantdata\Infantdata\code\Zachs_Infant_decoding_files'))
%% Annotation for Infant Data
files = dir('\\bmi-nas-01\Contreras-UH\Infantdata\Infantdata\Data\'); % assume starting fro... |
function I = reciprocate(V,head,Imax)
%I=RECIPROCATE(V,HEAD,IMAX)
% determine the TES montage that targets the sources expressed in
% scalp potentials V, generated as a linear combination of the columns of R,
% and constrained to a maximum delivered current of Imax
%
% V: nElectrodes-by-1 vector of EEG
% head... |
function [data, layout, title] = convertFigure(f, strip_style)
% convertFigure - converts a matlab figure object into data and layout
% plotly structs.
% [data, layout] = convertFigure(f)
% f - root figure object in the form of a struct. Use f = get(gcf); to
% get the current figure struct.
% st... |
function [info] = mtspImportTxtDump
%mtspImportTxtDump - get a list of the annotations for each of the files in
% the main folder
% Main directory?
fold = '/Volumes/JSM/DB/Metaspace/NewEngineDump/Raw/';
% Get a list of folders in this folder
allF = folderList(fold);
numF = size(allF,1);
% For each of these, get the ... |
function [y] = dbn(x,mindb)
% [y] = db(x,mindb)
% convert x to db normalized to 0dB max and optionally clipped to mindb - see also db(), undb()
mx = max(abs(x));
if nargin > 1,
if (mindb > 0), mindb = - mindb; end;
else
mindb = -1000;
end;
if (mx >= eps),
x = x/mx;
end;
scl = (10... |
function plotCovariance(IX, MI, MIshuff, metricLabels, varargin)
% [B, IX] = sort(MIshuff(:,1),'descend');
for n=1:length(IX)
orderedLabels{n} = metricLabels{IX(n)};
end
ffsubplot(1,3,1:2);
image(MI(IX,IX),'CDataMapping','scaled');
title('Sorted by #1');
set(gca,'YT... |
%{
Copyright (c) 2006, Douglas M. Schwarz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions an... |
%% EX 2.1
% b
N=1000;
realisations = 1; % change for 1 or 100 realisations
a = [0.1, 0.8];
order = length(a);
var = 0.25;
% Generate Model
model = arima('Constant', 0, 'AR', a, 'Variance', var);
X = simulate(model, N, 'NumPaths', realisations);
%LMS
mu=0.05;
error = zeros(realisations,N);
A1 = zeros(leng... |
%
% Plot the data
%
cd /wusr5/brian/book/06space/fig/subLocalization
load mckwest
% The data set contain two subjects in the first and 2nd columns
p = seplot(angle,offset, err)
plotParms(p)
grid on
xtick = [ 0:15:120];
ytick = [0:2:20];
xlim = [0 100];
ylim = [0 10];
set(gca,'xtick',xtick,'ytick',ytick,'xlim',xlim... |
%function [freq,amp,phi,ambient,distortion,raw,raw_ambient,Fs]=...
% freq_resp_take(filename,freq,chan_out,chan_in,stim_amp,atten,nreps)
%
% amp is RMS amplitude
% atten is how much attenuation you have applied with the resistive divider
% in dB
%
% freq_resp_take([],logspace(1,4,13),[0-1],[0-15],10,80,10);... |
addpath('/n/home09/jguo/SAM_drymodel/Drycore/');
addpath('/n/home09/jguo/WRFV3.3/stat');
%% set up global variables
global dx dz dt nr nzm nz r rm rout z zm zz t t_end Nstep time_interval caseid
global cp rd fcor ccrit ggr tau taum cd ce alpha ztop zsponge cs;
global doEddy doSponge doDiffusion doRadcooling doLatenthe... |
function result = show_trajectory(trajectory, rows, cols)
step_image = zeros(rows, cols);
number = size(trajectory, 1);
for i = 1:(number-1)
point1 = trajectory(i,:);
point2 = trajectory(i+1,:);
step_image = draw_line_value(step_image, point1, point2, number-i);
end
result = color_code(step_image);
... |
% Function is supposed to filter the phase offset using state space model,
% it is a Kalman filter in a particular case with known phi_hat
%
%sigma_phi - is defined as a constant term
%sigma_m - may vary in time
%
% B(n)A+B(n)+A
% B(n+1)=---------------
% B(n)+A
%
% A ... |
function S = cntrable(A,B)
% H. Saadat 1998
clc
% discr=[
%' The function S=cntrable(A,B) returns the transformation matrix '
%' S = [B AB A^2B . . . A^(n-1)B]. The system is completely state '
%' controllable if and only if S has a rank of n. '
%' ... |
function[answer] = NegativeMatrix(matrix)
answer = true;
[n,m] = size(matrix);
if(n ~= m)
error1 = "La matriz no es cuadrada"
answer = False;
end
for i=1:n
submatrix = matrix(1:i,1:i);
module = mod(i,2)
if(det(submatrix) == 0)
... |
clear all;clc;
Data = importdata('KF_EDDW_FDIA_timecom.txt');
timeo=Data.data(:,7);
timen=Data.data(:,8);
sumo=0;
sumn=0;
for i=1:148
sumo=sumo+timeo(i);
sumn=sumn+timen(i);
end
x=4;
z=zeros(1,12);
for y=1:12
z(y)=(y*y)/(x*y+x*x);
end
Fonts=18;
k=1:12;
fig1=figure(1);
set(fig1, 'Positio... |
function shift = calc_sol_shift(mfile,wn_shift,labpath,solar_line_file,sol_shift_wn)
% measurement
[t,wn] = read_ftir_spectrum(mfile,[sol_shift_wn-5 sol_shift_wn+5]);
f = ggg_ils(2,length(wn),median(wn),median(diff(wn)),45,0);
t = conv(t,f,'same')./max(t);
t = interp1(wn+wn_shift,t,wn,'linear','extrap');
% sol
sol = ... |
function main
% By BYC at 2018/10/08
close all
clear all
warning off
file_path = 'D:\ION\2018_rotation\CJW\data0105\heading';
subject{1} = 'CJW';
subject{2} = 'YZX';
subject{2} = 'PPY';
subject{3} = 'DQS';
no_choice_version = 0; % 1 for no choice version; other number for choise version
error_set = [7 ... |
%% Function to cluster the images seen by the 3D point
% Date 1/10/2015
% Author : Zakaria Laskar
function [ Local_Copies] = make_3D_copies( pix_cord, NViews, partition)
%% Iterate over the Views and do online clustering
numViews = numel(NViews);
copyCnt = 0;
for i = 1 : numViews
%... |
function writeJSON(js, filepath)
% write a structure to a json file
str = jsonencode( js );
raw = char(str);
fid = fopen(filepath, 'w');
fwrite(fid,raw);
fclose(fid);
end
|
function P=power_signal(x)
%Computes power of signal
%power_signal(x)
L=length(x);
P=(norm(x)^2)/L;
end |
clc;
Ts=0.0001;
t=0:0.00001:20*Ts;
sig=sin(2000*pi*t)+cos(2000*pi*t);
maxsig=max(sig);%signal max
interv=2*maxsig/(2^3-1);
u=maxsig+interv;
partition=[-maxsig:interv:maxsig];
disp(partition);
codebook=[-maxsig:interv:u];
[index,quants]=quantiz(sig,partition,codebook);
disp(index);
plot(t,sig,'-'... |
function result = compute_current_frame_scores(depth_image, last_frame_features, model, parameters)
% function result = compute_current_frame_scores(depth_image, last_frame_features, dataset, parameters)
global debug;
models = model.T;
number_of_models = numel(models);
current_frame = last_frame_features.frame... |
function n=palin_product(dig,lim)
% palin_product(2,9010)=9009 - 91,99
% n = factor(lim)
a = 10^(dig-1);
b = 10^dig -1;
c = (a:b);
kraj = false;
n=0;
if a*a>=lim
return
end
for i= b:-1:a
kraj = false;
for j=b:-1:a
s = i*j;
if s>=lim
continue
end
if s<n
... |
function params = genDefaultParams
% params.meta = [];
params.event_list = {'number';'startTime';'endTime';'result';'ctrHold';...
'tgtOnTime';'goCueTime';'tgtDir';'tgtCtr';'bumpTime';'ctrHoldBump';...
'bumpDir'};
% params.array_alias = {};
% params.exclude_units = {};
% params.trial_results = {'R'};
% params.e... |
function a=DeRe_using_matrix(a,Mat1,Mat2)
M=length(Mat1);
[H,W]=size(a);
for ia=1:H/M
idx=(ia-1)*M+1:ia*M;
a(idx,:)=Mat1*a(idx,:);
end
a=a';
for ia=1:W/M
idx=(ia-1)*M+1:ia*M;
a(idx,:)=Mat2*a(idx,:);
end
a=a';
|
clc; close all; clear;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Gibbs Sampling Method to compute P(X|E)
%% load datasets
load('E:\04_course\23_Probabilistic Graphical Models\Homework\Proj1\codes\parameter.mat');
load('E:\04_course\23_Probabilistic Graphical Models\Homework\Proj1\cod... |
% ---------------------------------------------------------
% dynIsBeamOn
% ---------------------------------------------------------
% Dyanlog Analysis Package
% Michael Hughes 2010-2011
% ---------------------------------------------------------
% Checks if beam was on for specified dose fraction.
%
% Returns 1 if Be... |
function y = f_dx(x, v)
if (v == 0)
y = tanh(x) * sech(x) - sin(x);
else
x2 = x + v;
y = (f(x) - f(x2)) / (x - x2);
end
|
function [X] = Line_Lq_weiszfeld(A, L0, q, iterations, projFunc)
% Ps are the point projection matrices
% points2d do not need to correspond, they just need to be on the lines
L = L0;
numLines = size(L, 2);
numSubspaces = length(A);
for l=1:numLines
Lcur = L(:, l);
%hold on, plot(Xcur(1), Xcur(2), 'ro');
... |
function genPlotScalarBVP(bvp,info,U,stitle,verbose)
Th=bvp.Th;
is_solex=false;
if isfield(info,'solex') && ~isempty(info.solex)
Uex=Th.eval(info.solex);
E=abs(U-Uex);
is_solex=true;
end
if verbose>=2, fprintf('*** Graphic representations\n');end
if Th.d==2
figure(1)
fc_siplt.pl... |
%% Opdracht 1
% Maak een variabele aan met de naam: ikbeneenvariabele.
% Geef de variabele de waarde 22 |
n = 0:199;
x = input('Input: ')
for k = 1:200
if n(k) == 0
y(k) = -1.5*x(k) + 2*x(k+1) - 0.5*x(k+2);
elseif n(k)>0 & n(k)<199
y(k) = 0.5*x(k+1) - 0.5*x(k-1);
else
y(k) = 1.5*x(k) - 2*x(k-1) + 0.5*x(k-2);
end
end
plot(n,x)
hold
plot(n,y) |
function [cfr] = bigrls_dprimal(bX, bY, opt)
% bigrls_dprimal(X,y,opt)
% computes a classifier for the primal formulation of RLS.
% The regularization parameter is set to the one found in opt.paramsel (set by the bigparamsel_* routines).
% In case of multiclass problems, the regularizers need to be combined with the o... |
function [w,trainMSE,testMSE] = regression()
M = loadData();
numInstances = size(M,1);
numAttributes = size(M,2);
disp('Separating the data');
X = M(:,1:(numAttributes-1));
Y = M(:,numAttributes);
clear M;
disp('Adding column of ones (bias term)');
X = [X ones(numInstances,1)];
disp('Separate training a... |
clear;
clc;
sampleperiod = 0.0005;
noise = dlmread('bloutooth_file_transfer.txt','\t');
numofsamples = size(noise,1);
numofchannels = size(noise,2);
t = sampleperiod:sampleperiod:(numofsamples*sampleperiod);
for i = 1:numofchannels
legendInfo{i} = ['Channel ' num2str(i+10)];
end
for i = 1:numofchannels
norm_... |
clear all;
clc;
fid=fopen('sx119.pcm','r');
[rw,lenght]=fread(fid,inf,'short');
fclose(fid);
p=16; % Initialization of order of LPC
ws=320; %Initialization of window size of anylysis frame.Possible values 160, 320, 480, 640, 960, 1280
as=80; ... |
function [x,y,e1,dd,exitflag] = descend(x,y,sigma,n_images)
%Relaxes a single string when one sphere doesn't move
% INPUT:
% x and y are n x 2 arrays containing position data of the particles at
% a saddle point and a point just before the saddle.
% sigma contains the radii information in an n x n ... |
function [STRUCT] = plotThicknesses(STRUCT,caseNum)
x = STRUCT(caseNum).X(1,:);
y = STRUCT(caseNum).Y(:,1);
plot(x,y(STRUCT(caseNum).thickness_upper));
plot(x,y(STRUCT(caseNum).thickness_lower));
plot(x,STRUCT(caseNum).middle,'k','LineWidth', 4);
end |
function [c,theta] = PromptData
%PromptData Prompts data for triangle
c = input('Input the c, or hypotenuse');
theta = input('Input theta in radians');
end
|
% Set path for the code and experiments in this dir.
% minFunc
addpath external/minFunc_2012/minFunc/
addpath external/minFunc_2012/autoDif
addpath external/minFunc_2012/minFunc/compiled/
% Ahmed, Recht, Romberg
addpath external/aliahmed/Script' to generate Figures 6, 7, and 8 (image deblurring)'/
% tfocs_pl and fri... |
function [ StiffMatrix, LBRHS, RBRHS ] = matAssembleGlobalStiffMatrix(obj)
meshUnion = obj.meshUnion;
mesh2d = obj.meshUnion.mesh2d;
DiffusionCoefficient = ones(size(obj.meshUnion(1).x));
BottomEidM = meshUnion.cell.Fmask(meshUnion.cell.Fmask(:,end-1)~=0,end-1);
UpEidM = meshUnion.cell.Fmask(meshUnion.cel... |
function [ data ] = getTiledData( obj, varargin )
%GETTILEDDATA Retrieves image data when the input is not tiled
% This method retrieves the image data (or a subset of it) in the case of
% images that multiple tiles. The user can specify subset
% of the images by specifying the dimension and the interval of inter... |
% Use REGEXP function for faster execution time!!!
% Use cell array for faster execution time!
% Expression of NEWLINE (\n) is char(10) => strfind(text,char(10))
clear all
close all
feature('DefaultCharacterSet','UTF8');
%%%% DEFINITION OF FILENAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fileref = 'G_D... |
function ShowFrancisQR()
% function ShowFrancisQR()
% Illustrate the Francis double implicit shift QR iteration...
% GVL4: Algorithms 7.5.1 and 7.5.2
n = 20; A = randn(n,n); H = hess(A ); tol = .00000000001;
% Zero a random subdiagonal entry...
k = ceil(rand(1,1)*(n-1)); H(k+1,k)=0; H0 = H;
% Initialization... |
function x = badd(x, m)
x = bsxfun(@plus, x, m); |
function [spread,contra,shape,L] = basis_STO3G (name)
if name =='F'
spread1s=[ 166.6791300 , 30.3608120 , 8.2168207 ];
spread2s=[6.4648032, 1.5022812 , 0.4885885 ];
spread2p=[6.4648032, 1.5022812 , 0.4885885 ];
contra1s=[ 0.15432897, 0.53532814, 0.44463454 ];
contra2s=[ -0.09996723 , 0.39951283 , 0.70011547 ]... |
function tmpa = PreadCOH(fnm)
if nargin < 1
tmpa = 0;
return
end
fid = fopen(fnm, 'r');
tmp = fscanf(fid, '%f');
fclose(fid);
tmpa = reshape(tmp, [2, length(tmp)/2])';
|
function [traceData] = stpReadTraceData(fin, sampNum, dataFormat)
% 这是一个读取一道数据的程序
%
% 输出
% traceData 读取出来是一个 sampNum*1的向量
%
% 输入
% fin 是打开文件后的句柄
% sampNum 是采样数量
% dataFormat 是数据格式
% 读取该道的采样数据
if dataFormat == 1 % IBM浮点数读取
traceData = fread... |
function [H] = gen_transmit(N,r,a,num_stream_each_transmit, num_unwanted_users)
for i = 1:num_unwanted_users
H_rand = chanel(N).*(r.^(a/2));%gen chanel for each user to BS
[U,sig,V_H] = svd(H_rand);
F = V_H(:,1:num_stream_each_transmit(i));
HjFj = H_rand*F;
H{i} = HjFj;... |
function FileListing = searchsubdirectories(parentDir,validExt,ignoreStr)
%SEARCHSUBDIRECTORIES Summary of this function goes here
% Detailed explanation goes here
Dir1Array = dir(parentDir);
nDir1 = numel(Dir1Array);
FileListing = struct;
ii = 1; % independent counter
for i1 = 1:nDir1
if strcmp('.',Dir1A... |
% boundImageValues
% ================
% Bounds image values to the [0,1] domain
% Makes sure that an image contains only values in the [0,1] domain.
% Values outside this range will be set to the nearer boundary
function I = boundImageValues(I)
I(I>1) = 1;
I(I<0) = 0;
end
|
% calculate rate of OH + 4-Ethyltoluene -> products
% Updated 6/10/15
% Based on MCM v. 3.3
% rate = kOH4ethyltoluene(T,M)
%
function j = kOH4ethyltoluene(T,M)
j = 1.18e-11; |
function varargout = levelsequence(varargin)
% LEVELSEQUENCE M-file for levelsequence.fig
%
% LEVELSEQUENCE is a graphical user interface for creating a
% sequence file using the Oddball paradigm.
% Last Modified by GUIDE v2.5 22-Nov-2007 19:02:16
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_Stat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.