text stringlengths 8 6.12M |
|---|
function K = evalK(nb_rows, nb_col, camera)
u0 = nb_col/2;
v0 = nb_rows/2;
f = (camera.focal/camera.sensorLength)*nb_col ;
K = [f 0 u0;
0 f v0;
0 0 1];
end
|
%% F - tomography
% 2015-12-04
%Useful commands include: find,imagesc,conv2,meshgrid,fft, and fftshift
%% 2.2 Show next to each other
figure(2);
fbp |
%toeFaded_aggregateAnalysis3
for ii = 1:length(naturalMouse_aggregateData)
cc_map= rot90((cat(3,naturalMouse_aggregateData(ii).coherence_map_v2)));
horz_ret = naturalMouse_aggregateData(ii).HorizontalRetinotopy;
vert_ret = naturalMouse_aggregateData(ii).VerticalRetinotopy;
temp = struct2cell(naturalMo... |
function [theta, grad,cost] = optimize(w,X,Y,iter,rate)
options = optimset('GradObj', 'on', 'MaxIter', iter);
[theta, grad, cost] = ...
fminunc(@(t)(prop(t, X, Y, rate)), w, options);
end |
%--------------------------------------------------------------
% Elektrische Systeme 1
% Musterlösung - Aufgabe 4
% Prof. Dr.-Ing. V. Sommer, Beuth Hochschule für Technik Berlin
%--------------------------------------------------------------
clear
close all
home
alpha20 = 4e-3;
R20 = 120;
R = 188;
th... |
% Extract orders for torus and cruller, the longer T=50 runs from 12/20/18.
% Barnett 1/7/19
clear
fnam = {'torus/t','wobblytorus/wt'};
nams = {'torus','cruller'};
surfareas = [19.7392088021787 22.6225981826694];
ps = [4 6 8]
lt = {'+-','.-','o-'};
figure(1);
for type=1:2 % dt-conv then dx-conv
for shape=1:2 % t... |
% addNoise(...) gives the option to add read and shot noise.
%
% INPUT
% J_sig: image series of expected number of photon counts from signal i.e.
% values range from [0,1]
function [J,shot_noise_ser,wg_noise_ser] = addNoise(J_sig,varargin)
read_noise = 0;
shot_noise = 0;
for i = 1:length(varargin)
if any... |
% main script
% Steps:
% 1) loading simulated cortical sources, remove dc offset, bandpass filtering [1-45], extract trials
% 2) Functional connectivity, plot simulated networks
% 3) EEG direct problem
% 4) EEG inverse problem
% 5) Functional connectivity, plot estimated networks
% 6) Accuracy assessment
% This code ... |
function generate_dictionary_dsift
%GENERATE_DICTIONARY Extract SIFT descriptors from all images to forma
%visual dictionary
% Loop through all available images to extract SIFT descriptors and form
% a visual dictionary
clc; clear; close all;
% change this path if you install the VOC code elsewhere
ad... |
% clear;
% clc;
% global save_path;
% % save_path = '/home/star/datasets/hangzhoujiahe/new_nodeid/';
% save_path = '/home/star/datasets/hangzhoujiahe/test_time/';
% diary([save_path, 'seperate_file_according_to_position.log']);
% tic;
%
% fid = fopen('/home/star/datasets/hangzhoujiahe/new_nodeid/historydata_node_10_tr... |
%% Matrix fractional norm implementation
function f = fNorm(X, Frac)
elemFrac = X.^Frac;
upperLimit = 100;
if Frac < 0
elemFrac(find(elemFrac>upperLimit)) = upperLimit;
end
f = sum(sum(elemFrac));
end |
% Robotarium Test Data Plot
% Sangjun Lee
% 2/19/2018
clear; close all; clc;
% Import Data
load 2_26_2018_rundata.mat
[lim_row, lim_col] = size(data.pose);
N = data.N;
disp(data)
% General Settings
lineW = 1.3;
axisS = 15;
labelS = 17;
t_test = 45; % Actual test time (sec)
t = linspace(0,t_test,lim_row/3);
% Trajec... |
writeDigitalPin(a,'D13',1);
pause(0.5);
writeDigitalPin(a,'D13',0);
pause(0.5);
writeDigitalPin(a,'D13',1);
pause(1);
writeDigitalPin(a,'D13',0); |
%% L-C band dobson et. al. & hallikainen et. al
%figure 3
%%
clc
clear all
%close all
%% Dobson et. al.
c=3*10^8;
w=0:0.01:.35;
S=65;
C=4;
theta=00;
e_real= 2.37+(-5.24+0.55*S+0.15*C).*w+(146.04-0.74*S-0.85*C)*w.^2;
e_img= 0.06+(6.69+0.0367*S-0.0620*C).*w+(16.17-0.30*S+0.27*C)*w.^2;
lambda=((3*10^8)/(1.4*... |
%
% Project Title: Data for FJSP in MATLAB
%
% Developer: ZZM in HUST
%
% Contact Info:hust_zzm@hust.edu.cn
%
clc;
clear;
close all;
job_num=randi([12,18]);
machine=[1:1:randi([10,16])];
job_info=cell(4);
total_process=0;
for j=1:job_num
process_num=randi([5,20]);
total_process=total_process... |
a=[1 -1.5 0.7];
b=[1 0.5];
%k=1;
c=polmul([1 0.3],[1 -0.7]);
[r,s,g]=dsnmv(a,b,k,c)
q=0;
pause
[ap,bp,kp]=clloop(a,b,k,c,r,s,q,2)
[ap,bp,kp]=clloop(a,b,k,c,r,s,q,4)
|
function svScoresVSphnDist_sliced(phnDistScores, svScores, key, numSlices)
%
%
%
% Example:
% (phnDistScores) - load('F:/Pablo/scr/scr_SRE08_m_short2-10sec_chunkedFiles_1sec_Clean_matchIDmap_phnDistScores_euclidean.mat');
% (svScores) - load('F:/Pablo/scr/scr_SRE08_m_short2-10sec_c... |
function [ xr ] = iDFB_eig( Y, DFBtype )
%IDFB_EIG Summary of this function goes here
% Detailed explanation goes here
if iscell(Y)
lhat = ceil(log2(length(Y)));
else
lhat = 0;
xr = Y;
return
end
if nargin < 2, DFBtype = 'r'; end
switch DFBtype
case 'r'
switch lhat
... |
function tlslattice
% TLS 2003 lattice file is generated for loco.
% Peace Chang, Dec 17, 2002.
% M.H. Wang, January 06,2003
% Peace Chang, January 06, 2003
% Peace Chang, January 15, 2009
% Peace Chang, March 25, 2009
% Physics parameters
PP.pi = 3.1415926535897932384626433;
PP.CLight = 299792... |
function [X0, F0, NC, NFE] = GLOBAL(FUN, LB, UB, OPTS)
%==========================================================================
% GLOBAL - A stochastic global optimization method for MATLAB, based on
% the article:
%
% Tibor Csendes, László Pál, J. Oscar H. Sendín, Julio R. Banga:
% The GLOBAL Optimization Met... |
function [M] = compute_RTS_N_points_3d(left_points, right_points)
% left_points should be 3xN, where each column is a point and N > 3
% right_points should be 3xN, where each column is a point and N > 3
N = size(left_points, 2);
left_mean = mean(left_points, 2);
right_mean = mean(right_p... |
function [DGprev_east,DGprev_west,DGprev_nort,DGprev_sout] = problem_boundaryconditions_phi(DGprev,data)
[DGprev_east,DGprev_west,DGprev_nort,DGprev_sout] = problem_boundaryconditions_psi(DGprev,data);
end
|
function h = get_fitness_handle( sys_input, time_points, rk_steps )
% Calling the outer function get_fitness_handle sets up everything to solve
% the model given system input (initial values and time range), the model
% parameters and number of integration steps. It returns a handle to anonymous
% function evaluate_fit... |
A_t = [[transpose(A_t_005.A_t);transpose(A_t_01.A_t);transpose(A_t_025.A_t);],...
[time_ms;time_ms;time_ms],...
[0.05*ones(size(time_ms));0.1*ones(size(time_ms));0.25*ones(size(time_ms))]]; |
close all;
clc;
clear;
% register the generator
setpaths;
m = gbs_Matrix('m', 4, 6); % three 2D measurements
syms a b c; % three unknown lambda factors
s=[a^2,a,b,b*c^2,b*c,1].';
eq=m*s;
unknown={'a','b','c'};
known={'m11','m12','m13','m14','m15','m16',...
'm21','m22','m23','m24','m25','m26',...
'm31',... |
function [lambada, lambada_d] = noise_var(i,x)
%%% constant sampling variance, 0.01
lambada = 0.01 * ones(1,size(x,2));
% lambada = 0 * ones(1,size(x,2)); % for debug
if nargout > 1
lambada_d = zeros(size(x));
end
% %%% varying sampling variance
% [d, m]=size(x); % d - dimension, m - number of poin... |
function [W,B,delw]=initialise(l,no)
for k=1:l-1
for i=1:no(k)
for j=1:no(k+1)
W(i,j,k)=rand-0.5;
delw(i,j,k)=0;
end;
end;
end;
disp('initial Weight Matrix W= ');
disp(W);
for k=2:l
for i=1:no(k)
B(i,k)=rand;
delb(i,k)=0... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fonction qui d�finit le vent en fonction du temps
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [z]= vent(tps,choix_traj)
if choix_traj==1 % sans vent
v1= 0; v2=0; v3=0;
elseif choix_traj==2 % vent constan... |
function imo = CS4640_median(im,s)
% CS4640_median - compute median value at each pixel
% On input:
% im (MxN array): input image
% s (int): median window side length (must be odd)
% On output:
% imo (MxN array): median filtered image
% Call:
% imo = CS4640_median(im);
% Author:
% T. Henderson
% ... |
function [Marker] = Marker(image,Magnitude,G_kernel,Gderiv_kernel)
% Quantized Magnitude
Quantized_Magnitude=uint8(Magnitude);
figure(4), imshow(double(Quantized_Magnitude))
title('Marker Watershed: Magnitude')
[height,width,~]=size(image);
% Double threshold on original image
output = double_thresho... |
function Rotax = Cx(theta)
Rotax=[1 0 0 ;...
0 cos(theta) sin(theta);...
0 -sin(theta) cos(theta) ];
end
|
function [M S W l rate time] = testEM(g,mode)
%функция производит тестирование и оценку качества ЕМ алгоритма
%Если g == 1 происходит построение графиков
%mode - выбор алгоритма. 'e' - обычный EM, 's' - стохастический
%параметры модельных данных
n = 1000;
p = 1/3;
mu1 = 1;
mu2 = 3;
sigma1 = 1;
sigma2 = 1;
%генерация ... |
function [ X_w ] = fft_outer_middle_ear( X )
%[ X_w ] = outer_middle_ear( X )
% Applies the weighting of the outer and middle ear as per
% ITU-R BS.1387-1 Section 2.1.4
% Equations 7-9
global debug_var
if debug_var
disp(' Outer and Middle Ear')
end
fs = 44100;
N = 2048;
f = linspace(0,fs/2,N/2+1);
fkHz = f... |
function [X,Y,Z,P] = get_data(fname,iteration)
if (regexp(fname,'Exhaustive'))
filepath = ['../Datasets/DREAM4/',fname];
else
filepath = ['../Datasets/',fname];
end
X_file_name = ['Edgelist_A_',num2str(iteration),'.csv'];
Y_file_name = ['Edgelist_B_',num2str(iteration),'.csv'];
Z... |
clc;
clear;
close all;
fID = fopen('data.txt', 'r');
maxRatio = 4;
X = [];
Y = [];
for i = 1:20
n = fscanf(fID, '\r\nDistance: %dcm\r\n\r\n');
if (n == -1)
break;
end
data = fscanf(fID, '%d', 30);
diff = abs(data - median(data));
avDiff = mean(diff);
... |
classdef WREmulator<handle
properties(Constant)
BAUDRATE = 38400;
PARITY = "even";
STATIC_RESPONSES = WREmulator.builtStaticResponseMap(); %static method to keep code clean
READ_MESSAGE_RESPONSE = uint8([170, 54, 245, 1, 0, 0, 1, 0, 0, 0, 28, 0, 72, 32, 2, 1, 3, 0, 0, 0... |
function [jpo,djpdp1,djpdp2,djpddv]=a_jp(h,up,p1,p2,dv)
%compute terms so division by zero is avoided
%if abs(dv)<1e-10
% evp=1+dv;
% tp=1;
% ttp=p2;
%else
% evp=exp(dv);
% tp=dv./(evp-1);
% ttp=(p2.*evp-p1)./(evp-1);
%end
z=(abs(dv)<1.e-10);
x=(abs(dv)>=1.e-10);
evp(z)=1+dv(z);
tp(z)=1;
ttp(z)=p2(z)... |
function [G] = geometry(D)
%GEOMETRY The geometry of a myelinated motor axon
% [G] = geometry(D)
%
%Note D in um
di = -0.468*D/(0.018*D-1);
G.D = D*1e-6;
G.di = (-0.468*D/(0.018*D-1))*1e-6;
G.dn = 1e-6*(di + 0.67)/2.72;
G.nl = round(23.13 - 1.89*di + 142.79*log10(di));
G.l = 1e-6;
G.L = 1e-6*(-91.1 - 20.2*di + 17... |
time1=[0 0 0.026 0.156 1.219 9.895 78.276];
mat_size=[3 10 100 200 400 800 1600];
figure
xlabel('MATsize');
ylabel('Time(s)');
n_3=[nthroot(78.276,21),nthroot(78.276,18),nthroot(78.276,15),nthroot(78.276,12),nthroot(78.276,9),nthroot(78.276,3),78.276];
loglog([mat_size;mat_size], [time1;n_3], '-s')
lagend('LU Decompo... |
function [y] = Phase_permute(x)
if size(x,2)==1
x=x';
end
signal=x(~isnan(x));
L=length(signal);
Nfft=L+(~mod(L,2));
% initializations
trialsignal_fft_phase_perm=zeros(1,Nfft);
% phase calculation
trialsignal_fft=fftshift( fft( signal,Nfft) );
trialsignal_fft_phase=angle( trialsignal_fft );
% select lef... |
function dy = test( t, y, a )
% a simple exponential decay model
% dy must be one column
% or you can say dy = zeros(2,1)
% then dy(1) = ...; dy(2) = ...;
dy(1,1) = -a * y(1);
dy(2,1) = y(1) * 100;
end
|
function result = BulirschCEL2( KC, A, B )
%BULIRSCHCEL2 Complete Bulirsch's elliptic integral of the second kind.
% BULIRSCHCEL3(KC,A,B) is the Bulirsch's complete elliptic integral of
% the 2nd kind of the elements of KC, A and B. KC, A and B must all be
% real and of the same size or any of them can be s... |
function [u_result,x_result,Objective_result,Objective_result2,V_f_result,l_N_result] = Controller_suboptimal_MPC(x0_var,u_tilde)
global N_horizon
global N_inputs
global A_dis
global B_dis
global int_in_bounds
global max_state_bounds
global R
global Q
global P
%% Objective Functi... |
hold on;
for i=-5:5
for j=-5:5
%define scalar and vector
vecR=sqrt(i.^2+j.^2);
distR=i.^2+j.^2;
%length of the electric field
x=(0-i)/vecR/distR;
y=(0-j)/vecR/distR;
%update
x=i+x;
y=j+y;
a(1)=i;
a(2)=j;
... |
function x_1 = OneNorm( x )
% ÇóxµÄ1-·¶Êý
x_1 = 0;
[a,b] = size(x);
for j = 1:a
sum = 0;
for i = 1:b
sum = sum + abs(x(i,j));
end
if x_1 < sum
x_1 = sum;
end
end
|
function vox = displaysingleflame(flame,outpath)
h = gcf;
if(~iscell(flame))
t = flame;
flame = cell(1);
flame{1} = t;
end
for i = length(flame):-1:1
if(length(flame) > 1)
progressbar((length(flame)-i)/length(flame))
end
thisflame = flame{i};
% vox{i} = newrenderskeleton( thisflam... |
%
% Map from motor space to image space
%
% Input
% pt: [n x 2] points (rows) in motor coordinates
%
% Output
% new_pt: [n x 2] points (rows) in image coordinates
function new_pt = space_motor_to_img(pt)
if iscell(pt)
new_pt = apply_to_nested(pt,@(x)space_motor_to_img(x));
return;
end
... |
function out = dial(str)
out = [];
ex = [(33:34),(36:39),(43:44),(46:47),(58:64),81,(90:127)];
toascii = double(str);
for jj = 1:length(str)
out(jj) = 0;
end
for ww = 1:length(toascii)
for nn = 1:length(ex)
if toascii(ww) == ex(nn)
out = [];
... |
function newBarplot3(BusArray_before,BusArray_after,tunit,BMnew,BMold)
% Correct the time according to used unit
if tunit==1%seconds
correct = 3600;
elseif tunit==2%minutes
correct = 60;
else %hours
correct = 1;
end
% get the number of Bus to Plot
[~,nr_bus]=size(BusArray_after);
% Prepare some arrays
Y=... |
% BARBERPOLEFLANGER2
% This function can be used to create a barber-pole flanger.
% Specifically, the function is meant to crossfade between two
% flangers so that the rising flanger has a smooth transition
% at the start of each sawtooth ramp.
%
% Input Variables
% in : single sample of the input signal
% buffer :... |
function [DGprediction_cell,thisresidual] = predictor_solver(DGprev_cell,this,data)
thetaT = data.thetaT;
cells_per_region = data.cells_per_region;
region_per_dimension = data.region_per_dimension;
rx_param = data.rx_param;
ry_param = data.ry_param;
rz_param = data.rz_param;
space_dims = data.space_dims;
main_cell = d... |
function add_blk(newblock,baseblock,refPos,offset,size)
% pos = get_param(refblock,'Position');
% orient = get_param(refblock,'Orientation');
% pos
% pos = [posReff(1) posReff(2)-siz(2)/2 posReff(1)+siz(1) posReff(2)+siz(2)/2]
pos = [refPos(1)+offset(1) refPos(2)+offset(2)-size(2)/2 refPos(3)+offset(1)+size(1) refPos(... |
vrmaglev
ssc_solenoid_magnetic
%ssc_solenoid %similar to the example model |
U = kron(dctmtx(32)',dctmtx(32)');
RU = zeros(49*15,1024);
for m = 1:1024
um = U(:,m);
um = reshape(um,32,32);
R = radon(um, 0:12:168);
RU(:,m) = reshape(R,49*15,1);
end
RU = normc(RU);
C = abs(RU'*RU);
offdiag_idx = logical(1-eye(1024));
mu = max(max(C(offdiag_idx)))
histogram(C(offdiag_idx));
|
function F = shear_force(t,x)
%adds shear force to all cells
alpha = 0.05;
T = 10;
F=0;
if t<T;
[R,P] = matricize(x);
realforce = R*[0 alpha; 0 0];
refforce = P*[0 0; 0 0];
F = columnize(realforce,refforce);
end |
s = linspace(0,1,51);
theI3 = 1;
I2{1} = sum_atan([0 1 .05 theI3 1], s);
I2{2} = sum_atan([0 1 1 theI3 1], s);
I2{3} = sum_atan([0 1 1.5 theI3 1], s);
I2{4} = sum_atan([0 1 2 theI3 1], s);
I2{5} = sum_atan([0 1 50 theI3 1], s);
I3{1} = sum_atan([0 1 1 .5 1], s);
I3{2} = sum_atan([0 1 1 1 1], s);
I3{3} = sum_atan([0... |
function [fileinfo,CHINFO]=cp42mea(meafile,graf);
% CP42MEA
% Read MGCplus Data files, recorded with CP42
%
% [fileinfo,CHINFO]=cp42mea([meafile],[graph])
%
% meafile is the complete filename of the CP42 DAQ file.
% graph is a string of length 1. If it is different from 'n... |
function [CTable] = GetContingencyTable(data,trainingAndTest,minleaf)
%%
%% 随机产生训练集/测试集
trainNum = 3000; %训练集数据数
Train = data(trainingAndTest(1:trainNum),:); %训练集
Test = data(trainingAndTest(trainNum + 1:end),:); ... |
function RM= R2(beta)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
RM=[ cos(beta) , 0 ,-sin(beta) ;...
0 , 1 0, ;...
sin(beta) , 0 , cos(beta) ];
end
|
function [CData] = convole_3D(data,szConv,varargin)
% CONVOLE_3D 3D convolution.
% data
% The 3 dimensional data to be convolved
if (3==nargin)
GH = varargin{1};
else
%load DGKernel;
halfsize = double(round(szConv/2.0));
sigma = double(szConv/3.0);
% X = double(repmat(repmat((1:szC... |
function result = isPositiveIntegral(a)
%ISPOSITIVEINTEGRAL True for arrays with positive integer elements.
% ISPOSITIVEINTEGRAL(A) returns true if A is an array of positive
% integers and false otherwise. A's element type need not be an integer
% data type.
%
% Example:
% isPositiveIntegral([1 3]) returns... |
%CNRL.m
% RL CIRCUIT
% Finite Difference Method for RL circuit analysis
% Ian Cooper
% email: ian.cooper@sydney.edu.au
% School of Physics, University of Sydney
% DOING PHYSICS WITH MATLAB
% https://d-arora.github.io/Doing-Physics-With-Matlab/
% 180212
clear all
close all
clc
% ===============================... |
function [ average_pitch_fun ] = average_pitch( nlp )
%average_pitch constraint for average_pitch
% Creates SymFunction for a average_pitch constraint
%
% Author: Ross Hartley
% Date: 2018-03-19
% Compute function for average_pitch constraint
X = cell(1,nlp.NumNode);
for i = 1:nlp.NumNode
X{i} =... |
%%
%initializing inverted five-bar robot
%%
function robot = init_5brobot()
%dimensions in mm
robot.R = 150;
robot.r = 20;
robot.L1 = 250;
robot.L2 = 250;
%angle in rad
robot.phi = [0,pi];
end |
function ParamSensitivity3(param_set, param_name, outpath)
perturb_coefficient = logspace(log10(0.01),log10(100),11);
%% load wildtype trait and a set of parameters
load('../metaData/trait_extraction/wildtype_1c.mat')
wt_trait_1c = trait;
load('../metaData/trait_extraction/wildtype_1r.mat')
wt_trait_1r = trait;
% th... |
function [ rayleigh_samples ] = rayleigh_dist( muestras )
%RAYLEIGH_DIST Muestras distribucion Rayleigh
% Metodo Monte Carlo, muestras con distribucion Rayleigh
samples = unifrnd(0,1,1, muestras);
rayleigh_samples = sqrt(-2*log(samples));
end
|
% Constant pressure pump
tau_pump = 500e-3; % pump time constant
pref = 170e5; % pump reference pressure
Kp = 1e-9; % pump flow pressure constant
Be_p= 1300e6; % effective bulk modulus of pump line
V_p = 3e-3; % pump line volume
pt = 1e5; % tank pressure
% Hydraulic Valve
tau_valve = 1.59e-2;
... |
% Function to call interpolated values for pressure, temperature, wind
% direction and wind speed for the balloon position at time
% INPUTS:
% fileName = file name: stationID,year,month,day,time in a string
% height = height of the balloon as a numerical value
% position = [lat lon] latitude and longit... |
function [struct_el] = structel_cvip(kType, kSize, kArgs)
% STRUCTEL_CVIP - Create structuring element or kernel.
% The function creates the structuring element or kernel,which is
% typically used in morphological operationsto probe or interact with a
% given image.The available shapes are disk,square,rectangle and... |
function [x,k] = iterative(L,U,A,x,b,t,d)
r = b - A*x;
e = 1;
n = norm(r);
k = 0;
while e > t
z = L \ r;
z = U \ z;
if d
y = z';
w = y*r / (y*A*z);
x = x + w*z;
else
x = x + z;
end
r = b - A*x;
e = norm(r) / n;
k = k + 1;
end
end
|
function y = diffd(x,d)
% diffd(x,d) gives differences with lag d; x(k+d)-x(k), k=1,2,...,
% Brockwell page 31
n=length(x);
if nargin == 1
d = 1;
end
y = x(d+1:n) - x(1:n-d);
|
%% Test
img = coco.loadImgs(581061);
I = imread(fullfile('~/proj/fbsear/',sprintf('images/%s/%s',dataType,img.file_name)));
imagesc(I); axis('image'); set(gca,'XTick',[],'YTick',[]);
%% Take image and randomly gaussian sample from it
[xx,yy] = meshgrid(1:size(I,2),1:size(I,1));
n = 100;
gfilts = zeros(size(I,1),size(... |
function[X,Y] = create_signals_2(N, delay, signal, snr)
%Create signals X and Y from a common one but delayed with respect to each
%other
%N: Number of samples
%delay: Number of samples to be delayed
%Common signal
%snr: Siganl to noise ratio for the additive uncorrelated Gaussian noise
S = transpose(signal(1:(N+delay... |
% Determine if a graph is connected
% Theorem 10.17 Let G be a graph with V = {v1, v2, ..., vn} and let X
% be the adjacency matrixofG.LetY =[yij]be the matrix Y =X+X^2+...+X^n?1.
% Then G is connected if and only if for all distinct i, j, Yi,j ~= 0.
% That is, if and only if Y has no zero entries off the main diagona... |
classdef controller < matlab.System & matlab.system.mixin.Propagates
% untitled Add summary here
% This template includes the minimum set of functions required
% to define a System object with discrete state.
properties
% Public, tunable properties.
end
properties (DiscreteState)
end
properties (Acce... |
function varargout = mUConv(varargin)
% MUCONV MATLAB code for mUConv.fig
% MUCONV, by itself, creates a new MUCONV or raises the existing
% singleton*.
%
% H = MUCONV returns the handle to a new MUCONV or the handle to
% the existing singleton*.
%
% MUCONV('CALLBACK',hObject,eventData,handles,... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2010 - 2015 Moon Express, Inc.
% All Rights Reserved.
%
% PROPRIETARY DATA NOTICE:
% The data herein include Proprietary Data and are restricted under the
% Data Rights provisions of Lunar CATALYST Space Act Agreement
% No. SAAM ID#... |
function [notified_ntw,coord_ntw] = retrieve_ntc_id(conn)
%%
%Accessing table com_el
tablename = 'com_el';
%selectquery = ['SELECT ntc_id,sat_name,long_nom,f_active FROM ' tablename ' WHERE ' 'sat_name=' satName];
selectquery = ['SELECT ntc_id,adm,sat_name,long_nom,ntf_rsn,d_rcv,ntc_type FROM ' tablename];
cu... |
%@(#) knum2cpos.m 1.3 01/03/05 08:22:21
%
%function yx=knum2cpos(kannum,mminj)
function yx=knum2cpos(kannum,mminj)
ll=length(mminj)+2;
csum=cumsum(ll-2*mminj);
yx=[];
for i=1:length(kannum)
if kannum(i)>sum(ll-2*mminj)
yx='kannum is greater than number of channels in core'
else
k=min(find(kannum(i)<=... |
% Script to benchmark the iterative regulariation algorithm
% Juan S. Castano C. 26 Jan 2013;
clear; close all; clc;
nip_init();
% Load data (Leadfield, etc...) to be used
Nd = 2000;
load(strcat('data/montreal',num2str(Nd),'_10-10'))
cfg.L = L;
cfg.cortex = cortex_mesh;
cfg.t = 0:1/256:0.5;
model = nip_create_model(... |
%Erdos-Renyi
clear all
clc
clf
n = 1500;
p = 0.1;
pos = generateCircularPos(n);
A = triu(rand(n) < p,1);
A = A + A';
%gplot(A,pos,'-*');
%
list = zeros(n,1);
A2 = A*A;
for i = 1:n
list(i) = A2(i,i);
end
toPlot = countOcc(list);
toPlot(:,2) = toPlot(:,2)/sum(toPlot(:,2));
plot(toPlot(:,1),toPlot(:,2),'.r');
hold on... |
function PlotMesh2D()
% function PlotMesh2D()
% Purpose: Show unstructured finite element grid
Globals2D_DG;
axis equal
xmax = max(max(x)); xmin = min(min(x));
ymax = max(max(y)); ymin = min(min(y));
Lx = xmax-xmin;
Ly = ymax-ymin;
xmax = xmax+.1*Lx; xmin = xmin-.1*Lx;
ymax = ymax+.1*Ly; ymin = ymin-.1*Ly;
axis([x... |
% Figure 7.21 Feedback Control of Dynamic Systems, 5e
% Franklin, Powell, Emami
%
% Script to generate fig. 7.21.
clf;
num=1;
den=[1 0 0 0 0];
rlocus(num,den);
title('Fig. 7.21 Symmetric root locus for satellite system')
grid;
|
% path to parallel tempering scripts
addpath('/shared2/LabUserFiles/Sanjana_Gupta/Original/ptempest/core/');
% path to supplementary distributions
addpath('/shared2/LabUserFiles/Sanjana_Gupta/Original/ptempest/core/distr/');
job = [1e29,1e29]; %dummy job index to initialize file
dlmwrite('jobs_wolasso.txt',job,'-append... |
function [forces, fib_forces, fibers_n, bnd_nodes, nodes_n] = ...
calc_forces_periodic(nodes, fibers, init_lens, fibtype, fib_areas, rve_size)
%% calc_forces_periodic calculated the forces on nodes and in fibers under periodic boundary conditions
% INPUTS: nodes-Nx3 matrix of internal nodal locations x,y,z
% ... |
function demoHMMbigram
%DEMOHMMBIGRAM(Exercício 23.4) demo of HHM for the bigram typing scenario
import brml.*
load freq % http://www.data-compression.com/english.shtml
l = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' '};
load typing % lendo a matriz A de t... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This script runs the simulation for the WCST
% changing the self-excitation parameter for Wsma and Wpfc
% runWCST_Wsmapfc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear; clc;
% Results are stored in a structure dependent_vars
% with a field for every dependent variab... |
%%%%%%%%%%%%%%%% MAKE TEXT MEASURE %%%%%%%%%%%%%%%%
%
% Removes blobs that are likely clumps, whose mean solidity is too low,
% whose mean area is too high, or who exist for too few frames. Adds the
% good IDs to frame2blob.
%
% Inputs:
% textMeasure - options:
% motion -
%... |
%% Hyper-parameters
clc;
clear all;
% Number of randomized Haar-features
nbrHaarFeatures = 130;
% Number of training images, will be evenly split between faces and
% non-faces. (Should be even.)
nbrTrainImages = 1000;
% Number of weak classifiers
nbrWeakClassifiers =70;
%% Load face and non-face data and p... |
function [a,b,p] = EM_estimate(a, b, p, X, nIter)
M=2;
K=2;
for i=1:nIter
[Gamma, Xi] = E_step(a, b, p, X);
[a, b, p] = M_step(Gamma, Xi, X, M, K);
end
end
|
classdef ParWorkerCommunicator < rl.comm.AbstractWorkerCommunicator
% PARWORKERCOMMUNICATOR
% Revised: 10-16-2018
% Copyright 2018 The MathWorks, Inc.
properties (Access = private)
WorkerNode_
end
methods
function this = ParWorkerCommunicator(workerNode)
this.WorkerNode_ = work... |
function [x,S,B0,k] = loop_exact_eval(V,F,f,bc,AF,varargin)
% LOOP_EXACT_EVAL Exactly evaluate the limit position of point on a a Loop
% subdivision surface (V,F) specified by the face f and barycentric
% coordinates bc
%
%[x,S,B0,k] = loop_exact_eval(V,F,f,bc)
%[x,S,B0,k] = loop_exact_eval(V,F,f,bc,AF)
%... |
%Optimum Alpha taken as 5.5 found from the previous code
clc;
clear all;
close all;
%generating random bits
data = randi([0 1],1024,1,'int8');
%modulating as QPPSK symbols to generate X
sym = nrSymbolModulate(data,'QPSK','OutputDataType','single');
sym = sym * sqrt(2);
X = diag(sym);
% This is the only change from Q... |
function [EQ, ER, EW] = LLdK_exp( lam, d, K, Gbar, g, w_range )
% Here we obtain the mean response time for LL(d,k,delta)
dw=w_range(2)-w_range(1);
if K == 1
EW=0;
for n=1:10^7
term = lam^(d*n)/(1+n*(d-1));
EW = EW + term;
if term < 10^(-20)
break;
end
end
... |
function [C, sigma] = dataset3Params(X, y, Xval, yval)
%DATASET3PARAMS returns your choice of C and sigma for Part 3 of the exercise
%where you select the optimal (C, sigma) learning parameters to use for SVM
%with RBF kernel
% [C, sigma] = DATASET3PARAMS(X, y, Xval, yval) returns your choice of C and
% sigma. You... |
function [Path_new,sum_dist]=treatment_arrive(Path,RobotNum,Goal,D)
size_n=size(D,2);
Path_num=cell(RobotNum,1);
Path_new=cell(RobotNum,1);
for rob=1:RobotNum
Path_num{rob,1}=[Path_num{rob,1}, Path{rob,1}(:,2)+(Path{rob,1}(:,1)-1)*size_n];
end
sum_dist=0;
for rob =1:RobotNum
index_goal=find(Path_num{rob,1}=... |
% ============================================
% Author: Alex Chen
% email: alextpf@gmail.com
% 2014
% ============================================
function Write2Stl(verts,tri,FILE_NAME)
fid = fopen(FILE_NAME,'w');
headerSize = 80;
header = zeros(headerSize,1);
numTri = size(tri,1);
% write header
fwrite(fid,header... |
function RC_Values = RLS_Parameters_to_RC_Values(theta_vector)
% Sampling time of the system is T = 1
T = 1; % Take this value as an function argument when sampling time
% is changed
a = (theta_vector(4) - theta_vector(3) - theta_vector(5)) / ...
(1 + theta_vector(1) - theta_v... |
close all; clear; clc
%% Adding to path
addpath(genpath(fileparts(pwd)))
%% Figure Initialization
load('MagellanoColorMap.mat');
DefaultOrderColor = get(0, 'DefaultAxesColorOrder');
NewOrderColor = [0.9490 0.4745 0.3137
0.1020 0.6667 0.74120
155/255 155/255 155/25... |
clear all;
close all;
% Prepare image
f = zeros(30,30);
f(5:24,13:17) = 1;
imshow(f)
% Compute Fourier Transform
F = fft2(f,256,256);
F = fftshift(F); % Center FFT
% Measure the minimum and maximum value of the transform amplitude
min(min(abs(F))) % 0
max(max(abs(F))) % 100
figure; imshow(abs(F),[0,100]); colormap(je... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.