text stringlengths 8 6.12M |
|---|
function read_plot_eye_pos_with_codes(FILENAME, BLOCKLEN, EXPLEN)
% READ_PLOT_EYE_POS_WITH_CODES(FILENAME, BLOCKLEN, EXPLEN)
%
% Example (for a 4 min. experiment with 20s blocks):
% read_plot_eye_pos_with_codes('20060609_n010', 20, 240);
%
% Open's eye position data saved in Sam's format and plots
% 4 eye traces.
%... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%plot data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%plot(x,y,'o')
%x=linspace(0,pi,101)';
a=[1,0.1]';
sigma=0.5;
y_fit = @(x,a1,a2,a3) a1.*exp(a2.*x).*cos(a3.*x); %Change to anon function
%y=A*a... |
function[more_stronge] = biology_competition_float_Ackley(cell_pred_desc)
format long g
[cell_out] = delete_repeated_float_Ackley(cell_pred_desc);
len_bc = length(cell_out);
len_bc_two = len_bc/2;
cell_str = zeros(len_bc_two,5);
cell_str = num2cell(cell_str);
for str = 1:len_bc_two
cell_str(str,:) = cell_out(st... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SCRIPT for the extraction of eReefs data layers
% Yves-Marie Bozec, University of Queensland - Sep 2019
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear
% First create vector of dates (text)
% We only select... |
function [ globalScore, classScore] = evaluatingClassifiers( samples, labels )
Nfold = 10;
[~, Nf] = size(samples);
hNf = Nf/2;
part = 1:hNf;
Fin1 = part(randperm(hNf));
Fin1 = reshape(Fin1, hNf/Nfold, [])';
part = hNf+1:Nf;
Fin2 = part(randperm(hNf));
Fin2 ... |
x=[ 1,5,1;
3,5,1;
4,7,1;
4,9,1;
6,9,1;
3,1,1
];
y=[-1;-1;1;1;1;-1];
w=zeros(50,3);
normk=zeros(50,1);
normk(1,:)=1;
k=1;
flag=0;
gama= 5/sqrt(20);
beta=0.5;
BetaGama= gama*beta;
for m=1:100
j=1;
for i=1:6
Check(k)=y(i)*(sum(w(k,:).*x(i,:)))/normk(k);
if(y(i)*(sum(w(k,:).*... |
function [t,y,errorFlag] = thetaODESolver(a,b,f,N,y0,theta,df)
% THETAODESOLVER implements theta-shceme method for intial value problem
%
% [t,y,errorFlag] = thetaODESolver(a,b,f,N,y0,theta,df)
%
% Inputs: a,b - limits of interval for t
% f - RHS of the differential equation for IVP
% N - nu... |
function [y] = f_bmi(x)
% [y] = f_bmi(x)
%
% The function returns the value of the cubic BMI function on the evidence x
%
% Input arguments:
% - y the value of the cubic BMI function on the evidence x
%
% Output arguments:
% - x the evidence
y = 6.4 .* (x - 0.5).^3 + 0.4 .* (x - 0.5);
end |
function A = cycleGraph(n)
% CYCLEGRAPH Creates sparse adjacency matrix for a cycle graph
%
% Other m-files required: none
% Subfunctions: none
% MAT-files required: none
%
% Author: Gabriel Moreira
% email: gmoreira (at) isr.tecnico.ulisboa.pt
% Website: https://www.github.com/gabmoreira/maks
% La... |
beta = 0.1;
sigma = 0.1;
mu1 = sqrt(sigma)*randn;
mu2 = sqrt(sigma)*randn;
mu3 = sqrt(sigma)*randn;
n = 200;
Y = zeros(2,n+1);
z = zeros(1,n+1);
alpha_1 = [-0.5 1 0.5];
alpha_2 = [0.5 -1 -0.5];
mode = randi(3);
for t = 2:n+1
alpha1 = alpha_1(mode);
alpha2 = alpha_2(mode);
Y(2... |
%2D wave equation
close all;clear;clc;
format long e;
%%
n=250;
len=0.2;
U=-1*ones(n,n);
x=linspace(0,len,n);
y=linspace(0,len,n);
dx=x(2)-x(1);
dy=dx;
%% Initialization
% READ FROM IMAGE FILE
grain=imresize(rgb2gray(imread('grain.png')),[n,n]);
for i=1:n
for j=1:n
if grain(i,j)>127
U(i,j)=1;
... |
% True posterior mean = 2.5
% True posterior variance = 0.5
clear; close all;
% Scale proposal mean and variance
qs = [2.5 5; 2.5 1; 2.5 0.5; 2.5 0.25];
for i=1:size(qs,1)
[x F geweke(i)] = fe_gauss_test(qs(i,1),qs(i,2));
allX(:,i) = x';
allF(:,i) = F';
end
f_final = mean(allF(end-100:end,:),1);
f_initi... |
function DPABI_TDA_Surf_run(Cfg)
% FORMAT DPABI_TDA_Surf_run(Cfg
% Perform temporal dynamics analysis and concordance analysis for surface (and volume)
% Input:
% Cfg - the parameters for temporal dynamics analysis.
% Output:
% The processed results that you want.
%__________________________________________________... |
%
% FY
%
% En bézierkurvas y kordinat vid tiden t
function f=fy(p1,b,c,p2,t)
p1y=p1(2);
p2y=p2(2);
by=b(2);
cy=c(2);
f=(1-t)^3*p1y+3*(1-t)^2*t*by+3*(1-t)*t^2*cy+t^3*p2y;
|
function graph_laplacian = read_gset_laplacian(graph_number)
%READ_GSET_LAPLACIAN Reads Gset graph into a Laplacian matrix
% graph_laplacian = READ_GSET_LAPLACIAN(graph_number) reads a graph from
% https://web.stanford.edu/~yyye/yyye/Gset/G#, where # = graph_number,
% into a Laplacian matrix
url = strcat('https... |
% extract beta coefficients for masks
function confirmatory_betas_for_masks(glmodel, contrast, Num, sphere)
%clear all;
%glmodel = 102;
%contrast = 'theory_change_flag';
%Num = 1;
%sphere = 10;
%confirmatory_regressors = {'theory_change_flag', 'up', 'down', 'left', 'right', 'spacebar', 'new_sprites', 'killed_sprites... |
classdef OKH
% Training routine for OKH method
%
% INPUTS
% Xtrain - (float) n x d matrix where n is number of points
% and d is the dimensionality
%
% Ytrain - (int) n x l matrix containing labels, for unsupervised datasets
% might be empty, e.g., LabelMe.
%
% NOTES
% Adapted from origi... |
function [Kp, Kd] = calc_gains(I,zeta, rise_time)
%given inertia matrix, damping ratio, rise time (seconds)
%return Kp and Kd for system
Ixx = I(1,1);
Iyy = I(2,2);
Izz = I(3,3);
gain_margin = 1.5;
w_n = (pi-atan(sqrt(1-zeta^2)/zeta))/(rise_time*sqrt(1-zeta^2)); %natural frequency
Kpx = gain_margin * Ixx * w_n^2;
Kp... |
function des_mensaje = deshacer_sustitucion(matriz, mensaje)
% Funcion que deshace la sustitucion de un caracter por dos caracteres de
% la cifra ADFGVX.
% Compruebo la matriz introducida
[filas,columnas] = size(matriz);
if (filas~=6 && columnas~=6)
disp('Error [deshacer_sustitucion]: la mat... |
% process all data
% This script is able to load all data sets:
% low power blue and red locking + E2O measurement
% blue: ./Lock_E2O/B_run02/ and ./Lock_E2O/B_run03/
% red: ./Lock_E2O/R_run03/
% high power omegam detuned O2O, E2O and O2E measurements
% .\StepLaser\Run04\*
% high power cl... |
function X_rec = recoverData(Z, U, K, mu)
X_rec = Z * U(:,1:K)' + repmat(mu, size(Z, 1), 1);
end |
function [out] = check_if_line_graph(sub_G3)
% this function reads a sub-graph and checks whether it is a line
% graph or not. The checks are if the start and end between centrality
% is zero, and if the minimum spanning tree is isomorphic with the
% graph itself
bw_cent = centrality(sub_G3,'betweenness');
T=mi... |
function [Moda , ncont] = iModa(x)
% A matlab script to find the mode of vector x.
% There are two options at the end so that it is possible to perform a checksum
% on data and plot the vector of frequencies, just uncomment the right lines!
%
% Isaac M. M. INOGS, Trieste(Italy). January 10, 2005 @01h46:44
% De... |
function writeToResults( fidLog, fidRF, numPaths, testLevel, testNameMain, testNameSub, testResults, testCriteria )
%test level definitions
%test level 1 = main test
%test level 2 = sub test
try
switch testLevel
case 1
testLevel = 'GENERAL';
case 2
testLevel = 'DET';
e... |
function ret=In_nonadj_cand_pts(p,q,close_nonadj_pts,count_nonadj)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% In_nonadj_cand_pts function identifies the point pair in which close
% nonadjacent point pairs
% Params:
% p,q are the point pairs
% close_adj_pts records... |
function player = create_player(handles)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
player = audioplayer(handles.mdata.x, handles.speed_modifier * handles.mdata.fs);
is_toggled = get(handles.r_timestamps, 'Value');
set_ticks(is_toggled, handles);
... |
%function [CCG_SMOOTH]=gaussfilt(CCG_CORR,size,center,sigma);
%
% This is a guassian filter of length "size" and width "sigma"
% center is the peak of the filter (so if size is 5 and center is
% 3, the peak of the filter is in the middle).
%
% CCG_CORR is a list of ccgs (or really any continuous data) to be
% sm... |
TS_init('INP_ts.mat');
TS_compute(1);
TS_normalize('scaledRobustSigmoid',[0.8,1.0]);
distanceMetricRow = 'euclidean'; % time-series feature distance
linkageMethodRow = 'average'; % linkage method
distanceMetricCol = 'corr_fast'; % a (poor) approximation of correlations with NaNs
linkageMethodCol = 'average'; % li... |
syms t
ft=heaviside(t-2);
lf=laplace(ft,t,s) |
function [K_LIR,M_LIR,dof_sets_LIR,T_LIR] = LIR(K_CB,M_CB,dof_sets,options)
% Dimitri Krattiger
%
% Description
% ===========
% This code uses local interface reduction (LIR) to reduce the interface
% partition of Craig-Bampton mass and stiffness matrices.
%
% inputs
% ======
% K_CB = free Craig-Bampto... |
function [s, target, mlIndex] = weibullGridFit(y, slopeGrid, threshGrid)
% function [s, target] = weibullGridFit(y, slopeGrid, threshGrid)
% INPUTS :
% y : is a struct that has the following fields : levels, correctRate (correct Rate per level), and
% levelLth (number of trials per level).
% s... |
%Problem 3
load('clustering_data.mat');
rng(2016);
[m, n] = size(x);
K = 3;
clust_assignment = zeros(m, 1);
clust1 = zeros(0, 2);
clust2 = zeros(0, 2);
clust3 = zeros(0, 2);
trajectory1 = zeros(0, 2);
trajectory2 = zeros(0, 2);
trajectory3 = zeros(0, 2);
objective_per_iteration = zeros(0, 2);
%... |
function s = Modulation(c)
% [Moldulation]
% Useing BPSK: 0 -> 1(+sqrt(Eb)), 1 -> -1(-sqrt(Eb))
% Argument:
% c: encode codeword
% Returen:
% s: modulation results
c(c==1) = -1;
c(c==0) = 1;
s = c;
end |
function P = bspline_gui(n)
% Get control points of uniform B-spline interactively.
% The user is shown a figure window in which to choose B-spline control
% points. As points are placed in the axes, the B-spline of specified order
% is drawn progressively. The user may terminate adding control points by
% pressing ENT... |
function [t,xx] = eks(A,x0,tspan,i,n,example) %Solve ODE
CC = A(1:n,1+n:2*n);
AA = A(1:n,1:n);
[t,xx] = ode45(@(tt,x) dfx(tt,x,AA,CC,i,example),tspan,x0');
end |
function svm_2d_plot(mdl,X,group)
d = 0.01;
[x1Grid,x2Grid] = meshgrid(min(X(:,1)):d:max(X(:,1)),...
min(X(:,2)):d:max(X(:,2)));
xGrid = [x1Grid(:),x2Grid(:)];
[~,scores] = predict(mdl,xGrid);
figure;
h(1:2) = gscatter(X(:,1),X(:,2),group,'rb','.');
hold on
contour(x1Grid,x2Grid,reshape(scores(:,2),size(x1Grid)),[... |
function [I,J,K]=cart2im(X,Y,Z,v)
% function [I J K]=cart2im(X,Y,Z,v)
% ------------------------------------------------------------------------
% This function converts the cartesian coordinates X,Y,Z to image
% coordinates I,J,K using the voxel dimension v.
%
% X,Y,Z can be scalars, vectors or matrices.
% v... |
function varargout = save_boo(varargin)
% SAVE_BOO M-file for save_boo.fig
% SAVE_BOO, by itself, creates a new SAVE_BOO or raises the existing
% singleton*.
%
%
% SAVE_BOO('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in SAVE_BOO.M with the given input argumen... |
%% Haar Wavelet method to solve system of linear differential equations
% KAUSHIK IYER
% y1'(t) = y3(t) - cos(t), y1(0) = 1
% y2'(t) = y3(t) - exp(t), y2(0) = 0
% y3'(t) = y1(t) - y2(t), y3(0) = 2
% the exact solution is
% ... |
function hPtsin = updtptsin(s_number,b_number,pts_in,hPtsin)
for i=1:b_number
for ii=1:s_number
if isempty(find(pts_in{i,ii})>0)==0
set(hPtsin(i,ii),'xdata',pts_in{i,ii}(:,1),'ydata',pts_in{i,ii}(:,2));
hold on
end
end
end
end |
figure(1)
semilogy(BaseV,abs(CollectorI))
xlabel('Base-Emitter Voltage [V]')
ylabel('Collector Current [mA]')
grid on
axis([-0.8 -0.1 1e-14 1])
figure(2)
plot(CollectorV1,CollectorI1*10^3)
hold on
plot(CollectorV2,CollectorI2*10^3)
plot(CollectorV3,CollectorI3*10^3)
plot(CollectorV4,CollectorI4*10^3)
plot(CollectorV5,... |
%--plot time series
clear
clc
%data_path='/Users/hcq/workspace/MCS_2016_private/data/space/';
data_path='/home/hxm_stu/WORK1/hcq/MCS/data/';
% data_name = 'duirnal_global';
data_name0 = 'duirnal_sea';
data_name1 = 'duirnal_land';
data0 = load (fullfile(data_path, data_name0));
data1 = load (fullfile(data_path, data_na... |
%
% 2D Wave Equation
% Euler Explicit Scheme
% Boundary u=0
%
close all
clear all
dx=0.01; dy=0.01; dt=0.001;
x=0:dx:1; y=0:dy:1; lx=length(x); ly=length(y);
%f= @(x,y) max(0,0.1-2*(x+y-5).^2);
%u=f
%ub=f;
u=zeros(lx,ly);
ub=zeros(lx,ly);
un=zeros(lx,ly);
u(50:55,50:55)=4;
ub(50:55,50:55)=4;
u=u';
ub=ub';
figure(1)... |
matsize = 10;
p=matsize;
q=matsize;
r=matsize;
fp = fopen('C:\Octave\output_CN_10x10x10.bin');
B = fread(fp,Inf,'double');
fclose(fp);
size(B)
nummatrices = size(B)/(matsize^3)
Bans = reshape(B, r, q, p, nummatrices);
for t=1:nummatrices
surfc(Bans(:,:,ceil((q)/2),t));
set(gca,'ZLim',[0,5... |
function L = lambdafcns(inmf, op)
%LAMBDAFCNS Lambda functions for a set of fuzzy rules.
% L = LAMBDAFCNS(INMF, OP) creates a set of lambda functions
% (rule strength functions) corresponding to a set of fuzzy rules.
% L is a cell array of function handles. INMF is an M-by-N matrix
% of input membership function h... |
function Analyze(matFilePath)
% Loading
loader = MatFileSpectrumLoader;
spectrum = loader.Load(matFilePath);
% Scaling
scaleRange = Range(217,3849);
spectrumScaler = EquidistantSpectrumScaler(InterpolationMethod.Spline, ...
scaleRange, 2);
scaledSpectrum = spectrumScaler.Scale(spect... |
function [ final_image ]=image_inpainting(img,window_size)
%img='test_im1.bmp';
im1 = imread(img);
size(im1);
figure
imshow(im1)
test_image=zeros(size(im1,1),size(im1,2));
final_image=im1;
%temp=[];
%window_size=15;
MaxErrThreshold = 0.3;
k=0;
while (min(min(final_image)) == 0) ;
progress=0;
pixel_list=Unfille... |
clc,clear all
echo off
disp('FName LName and my UH ID is 0000000')
% E3 practice with Solution
%background:temperatures taken at Houston Zoo
%throughout 2013 at 12noon daily. There are 52 rows
% (weeks) and 7 columns (days of week). Column 1
% represents "Sunday"...Column 2 represents "Monday" etc.
% the dat... |
function new_obj = dsp__remove_if_subtraction_fails(obj, within, varargin)
objs = obj.enumerate( within );
new_obj = Container();
for i = 1:numel(objs)
current = objs{i};
try
new_obj = new_obj.append( current.subtract_across(varargin{:}) );
catch
continue;
end
end
end |
function g = glmderiv(net, x)
%GLMDERIV Evaluate derivatives of GLM outputs with respect to weights.
% Check arguments for consistency
errstring = consist(net, 'glm', x);
if ~isempty(errstring)
error(errstring);
end
ndata = size(x, 1);
if isfield(net, 'mask')
nwts = size(find(net.mask), 1);
temp = zeros(1, ne... |
clc;
clear;
inputFile = ''; %Sample input image for which we want to extract
%intermediate results. If intermed = 0, this value is
%not requried.
meanFile = ''; %Path to the mean file of the dataset
cmp = 0; %If cmp == 1, program checks the intermediate resu... |
function result = mInverseEllipticNome( Q )
%MINVERSEELLIPTICNOME Ellipticparameter function.
% MINVERSEELLIPTICNOME(Q) is the elliptic parameter of the elements of
% nome Q. Elements of Q must all be real and are limited to the
% interval [0,1].
%
% MINVERSEELLIPTICNOME is a wrapper function which mimics ... |
classdef APT < handle
%A simple class to super-class the APT devices which will also work for
%the APT server (thus handle, and not a module)
%If a control figure is closed, a new one will be spawned by
%reinitializing
%Note, this is not singleton, but it's children should be!
... |
%% calculate HD distance matrix
load t1.mat
t = cputime;
n = length(t1);
hd = zeros(n*(n-1)/2,1,'double');
count = 1;
for i = 1:(n-1)
for j = (i+1):n
hd(count) = getdistance(t1{i},m1{i},t1{j},m1{j});
count = count + 1;
end
fprintf('i=%d/%d\n',i,n);
end
save('hd.mat','hd');
fprintf(... |
%% create daq object
daqObj = daq.createSession('ni');
daqObj.addAnalogOutputChannel('Dev1', [0:1], 'Voltage');
% daq AO_0 is laser power
% daq AO_1 is thermistor control
% set experiment params
numReps = 5;
timeOn = 120;
timeOff = 120;
laserPowerOn = -3.3;
laserPowerOff = -4.99;
thermistorOn = 5;
thermistorOff = 0;
... |
% BE491 Group Project Vowel Pitch Detection
% Echo: A Voice Recognition and Playback System
% Davy Huang, Blake Oberfeld, Arjun Patel, Allison Ramsey, and Kate Ryan
% Lab Section B3
%% This script is designed to show the inner workings of the analyzer by generating:
% (1) plot the time domain of a stressed vowel... |
function elem=atringparam(fname,varargin)
%ATRINGPARAM Creates a RingParameter Element which should go at the beginning of the ring
%
% atringparam(FAMNAME,E0,NBPERIODS)
%
% INPUTS
% 1. FAMNAME - Family name which may be used as name of Ring
% 2. E0 - Energy of electrons
% 3. NBPERIODS - Periodicity of the... |
function [output1] = T_BasePosX(var1)
if coder.target('MATLAB')
[output1] = T_BasePosX_mex(var1);
else
coder.cinclude('T_BasePosX_src.h');
output1 = zeros(4, 4);
coder.ceval('T_BasePosX_src' ...
,coder.wref(output1) ...
,coder.rref(var1)... |
function fh = plotSweepFrequency( pressure,Fs,varargin )
%绘制扫频数据
pp = varargin;
varargin = {};
STFT.windowSectionPointNums = 512;
STFT.noverlap = floor(STFT.windowSectionPointNums*3/4);
STFT.nfft=2^nextpow2(STFT.windowSectionPointNums);
while length(pp)>=2
prop =pp{1};
val=pp{2}... |
function samplepac
colorlist = [
0 0.0 1
0 0.5 0
];
theta = [pi:0.001:2*pi;0:0.001:pi];
figname = {'trough-max-pac';'peak-max-pac'};
for t = 1:2
figure('Color','none','Name',figname{t});
plot(theta(t,:),sin(theta(t,:)) + (0.05+0.1*abs(sin(theta(t,:)))).*sin(15*theta(t,:)), ...
'Color',col... |
function [str, str_nice] = getTrainConfig_str(trainConfig)
if isfield(trainConfig, 'adaptiveMethod')
adaptiveMethod = lower(trainConfig.adaptiveMethod);
isAdadelta = strcmp(adaptiveMethod, 'adadelta');
isRMSprop = strcmp(adaptiveMethod, 'rmsprop');
isVSGD = strcmp(adaptiveM... |
function x = amatinit(v,k)
%AMATINIT Initialize audi matrix.
% x = AMATINIT(v) for a double array v is an audi array
% of n=numel(v) independent variables of order k with
% size(x) = size(v) and values x{0} = v.
%
% See also: ainit
if nargin==1
k = 1;
end
for i = numel(v):-1:1
x(i,1) = audi... |
function obj = irComputeSpikes(obj, varargin)
% Computes the spiking rgcPhys mosaic responses to an input
%
% ir = irComputeSpikes(ir)
%
% Inputs:
% ir: inner retina object
% input - the irPhys object with the linear responses of each RGC already
% computed.
%
% Computes the linear and spike responses for ... |
function [assymetry] = calcAssymetry(dat)
assymetry = {};
for i = 1:size(dat,2)
assymetry{i} = {[0 0],[0 0]};
Fp1A = dat{i}{1,2}{1}; %alpha
Fp2A = dat{i}{2,2}{1};
F3A = dat{i}{4,2}{1};
F4A = dat{i}{6,2}{1};
assymetry{i}{1}(1) = log(F4A) - lo... |
clear all
A=[
-0.0258,-0.0272,-0.007,-0.1709,0,-0.0097,0.0102,-0.0049,0.0023;
0.0071,-0.0733,0.0455,0,0.1709,0,-0.0048,-0.0101,-0.3811;
0.1402,-0.0054,-0.5581,0,0.0097,0,0.3844,-0.008,-0.001;
0,0,0,0,0,0,1,0,0;
0,0,0,0,0,0,0,1,0;
0,0,0,0,0,0,0,0,1;
1.2403,0.6055,-1.0832,0,0.0016,0,-0.94... |
function Nv = Advect(mat,U,Vo,V)
% mat is the initial/previous values
% U is the x-velocity at the final time step
% V is the y-velocity at the final time step
% Vo is the initial y-velocity
dx = 4736.745349870635; % interval of longitude in meters
dy = 4907.190566378487; % interval of latitude in meters
dt = 2; % tim... |
phi_nTAE=2*pi*(phi_rank-1)/(NB_PHI-1);
if UNIFORM_TAE_PROPAGATION==0
omega_values=kTAE*vAvalues';
else
omega_values=omega_TAE;
end
% vAmin=min(vAvalues);
% vAmax=max(vAvalues);
% % Rmin=min(Rvalues);
% % Rmax=max(Rvalues);
% mtheta=0*theta;
% % mtheta(find(Rvalues>=R0))=0.5+mtheta1-0.5*(Rvalues(find(Rvalues... |
% File: Example5_09.m for Example 5-9
clear;
clf
% Calculate & Plot Originate Modem Transmit Spectrum
f2 = 1070;
fl = 1270;
% Note: f1>f2
R = 300;
h = (fl-f2)/R;
Ac = 1;
n = 0:1:10;
xn = 0.5*pi*(h-n);
xp = 0.5*pi*(h+n);
fc = 0.5*(fl+f2);
fn = 0.5*n*R + fc;
% Computing the one-sided spectrum, i.e the spectrum fo... |
clear;
type compact;
a=2; % value of a
b=3; % value of b
% change value of a and b
a=a+b;
b=a-b;
a=a-b;
disp(a);
disp(b); |
function localRunTest_hdl_matmul
hdl_matmul_tb_cosim;
end
|
clc,clear all,close all;
tic;
%% generating room planes of interior environment
[house_facet,house_vertices,house_norm_vector]=house_stl_reading("202003experiment.stl");
% house_stl_matplot(house_facet,house_vertices,house_norm_vector);
[room_facet,room_vertices,room_norm_vector]=room_walls_obtaining(house_facet,hous... |
function out = calc7(in)
%excersise 2: Morris-Lecar neuron
%function out = calc5(in)
%Primoz Pirih, Sietse van Netten 2014
%
%The Morris-Lecar model is a biological neuron model developed by
%Catherine Morris and Harold Lecar to reproduce the variety of oscillatory behavior
%in relation to Ca++ and K+ conducta... |
% plot the model tracer concentration against
% the observed tracer concentration using a joint
% cumulative density distribution
function [D, X, Y] = mk2dcpdf(data_obs, data_mod, ikeep, dVt)
data = [data_obs(ikeep),data_mod(ikeep)];
dmin = min(data(:));
dmax = max(data(:));
%pad the range by 5% because kernel... |
function result = RMS_calc(data, window_size)
% data: Row vectors of varaibles
if window_size > 0
col_count = size(data, 1);
result = zeros(size(data));
padded_data = [zeros(col_count, window_size - 1) data];
data_window = zeros(col_count, window_size);
for i = window_size : length(padded... |
%% Initialization
clear ; close all; clc
%% ===============Part1 : Loading and visualizing data==========
% This data contains
%1. Number of times pregnant
%2. Plasma glucose concentration a 2 hours in an oral glucose tolerance test
%3. Diastolic blood pressure (mm Hg)
%4. Triceps skin fold thickness (mm)
%5. 2-Ho... |
%% ASEN 2004 - Rocket Bottle Lab - Rocket Equation Model
%{
Authors: Jashan Chopra (107689146)
Adapted from 2012 Project 2
Date Created: March 20th, 2018
[ Rocket Equation Model - Model 2 ]
Script Purposes and goals:
1) Import static test stand data
2) Integrate test stand data to get Isp
3) S... |
function [Yf,f]=freqspec(yt,Fs)
%This function calculates the frequency spectrum of yt
%Fs:采样频率,单位时间(1s)内采样点数
% Ns=512;
% F=abs(fft(x,Ns));
% fr=(1/y)*(0:Ns/2-1)/Ns;
L = length(yt);
% 加Hanning窗
w = hann(L);
yt = yt(:).*w(:);
NFFT = 2^nextpow2(L);
Yf = fft(yt,NFFT)/L;
Yf = 2*abs(Yf(1:NFFT/2+1));
f... |
function status = OutputFfsatPos_fromX(filename, x, ratio)
% 2018-06-12
% gnuplotで位置を描画するためのファイルを出力
% filename :出力ファイル名
% x :状態ベクトル
% ratio :倍率.省略可能
if nargin == 2
ratio = 1;
end
numMirSat = floor(length(x) / 6 - 1);
status = -1; % 異常終了
str = '';
% for i = 1:numMirSat
% str = strcat(str,... |
function [ x_new, T ] = lab3_1_5_func( x, K)
X = fft(x);
N = length(X);
% for part 1.2 with partial DFT
Xpart = X(K,end);
x_new = zeros(1,N);
for i = N-K:N
x_new = Xpart(N - i);
end
x_new = ifft(x_new);
end
|
clc; clear all; close all;
load('100m.mat');
x=val(1,:);
ecg=x';
figure(1);
plot(ecg);
N=8; M=8;
k=input('enter the total no.of samples ');
% n=0:1:k;
ecg1=ecg(1:2*k);
figure(2);
plot(ecg1);
n=1:1:2*k
for i=0:1:7
x=ecg(n);
y=ecg(n+i+1);
z=ecg(n+i);
y1=y-z;
... |
%%%%%%%%%%%%%%%%%%%%%%%%% 15.02 %%%%%%%%%%%%%%%%%%%%%%%%%
% Entrando no doc filter(p.e.) e querendo executar um exemplo:
% - Selecionar as linhas que deseja executar e apertar F9
% linspace -> escaka linear
% logspace -> escala logaritmica
% SINAL DE ENTRADA x[n]
t = linspace(-pi,pi,100);
rng default % controla a ger... |
function [w,h] = type1_dft(N,wc)
M = (N-1)/2;
% Create vector of equally-spaced frequencies
w=0:2*pi/N:2*pi*(N-1)/N;
% Create ideal amplitude response of low-pass filter
for b=1:N
if 2*pi*b/N <= wc
Ad(b) = 1;
elseif 2*pi*b/N >= (2*pi-wc)
Ad(b) = 1;
else
Ad(b) = 0;
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Design of Communication Systems and Equipment
% file: idealSystemQPSK.m
% System with QPSK modulation and including:
% - PLL timing synchronization: timingRecoveryPLLQPSK.m
% - PLL phase synchronization: phaseRecoveryPLLQPSK.m
% - Dis... |
function fStackIID(fStackPath, resDir, gamma3, tol)
%% global params
expName = 'fStackIID';
if nargin<2
resDir = fullfile(fStackPath,'results');
gamma3 = 0.1;
tol = 1.0;
end
if nargin<3
gamma3 = 0.1;
tol = 1.0;
end
if nargin<4
tol = 1.0;
end
if ~exist(resDir,'dir')
mkdir(resDir);
end
if ~ex... |
run(global_var_file);
for indm=1:length(all_sc_m)
sc_m=all_sc_m(indm);
sc_n=sc_m-1;
intra_shell_max = 10;
inter_shell_max = 10;
% here the length scale adopts a=2.46A = 1
tbh_filename_here = ['TwBLG_BZscan_',num2str(sc_m),'_',num2str(sc_n),'_' interlayer_model '-inter'];
kp_filename_... |
%% =====================================================================
% === Setting up stuff ===
% =====================================================================
%Create the mesh
[X,Y] = meshgrid(-2:.1:2, -2:.1:2);
Z = sin(X*2.6).*sin(Y*5.1)*0.1;%.* exp(-X.^2 -... |
% Hello world!
fprintf('Hello world!\n');
% Read the file
%[data,varnames,casenames] = tblread('training_set.tab', '\t');
scores(1:4400,1:2) = 0;
for row=1:length(casenames)
positive_sum = 0;
positive_count = 0;
negative_sum = 0;
negative_count = 0;
for col=1:length(varnames)
i... |
clear; clc;
addpath('src')
addpath('Results')
addpath('Utilities')
HO=21; % horizon we want to look at for FEVDS
Nregion=1; % 1 regions for national
% first do RtoV regional
yearlab=(1998.00:(1/12):2018.75)';
load N_RtoV_gr.mat
% get impulse response functions of return wrt its corresponding illiq
% me... |
classdef BernoulliDist < BinomDist
methods
function obj = BernoulliDist(varargin)
% mu(j) is success probablity for j'th distribution
[obj.mu, obj.prior, obj.support, obj.productDist] = processArgs(varargin, ...
'-mu', [], '-prior', NoPrior, '-support',[1,0], '-productDist', false);
... |
%% Create Ground Vehicle Trajectory
% The |waypointTrajectory| object calculates pose based on specified
% sampling rate, waypoints, times of arrival, and orientation. Specify the
% parameters of a circular trajectory for the ground vehicle.
imuFs = 100;
gpsFs = 1;
% Trajectory parameters
r = 8.42; % (m)
speed = 2.50; ... |
function s=daisyReserved(arg)
% MMBUILTIN Builtin Function Names. (MM)
% MMBUILTIN returns a cell array of strings containing the
% names of built in functions or reserved names in MATLAB.
% D.C. Hanselman, University of Maine, Orono ME 04469
% 3/25/00
% Mastering MATLAB 5, Prentice Hall, ISBN 0-13-858366-8
% www.eec... |
%plot_results_acoustic_analysis_morphs
function plot_results_acoustic_analysis_morphs(morphFolder,delta_pitch_tag)
function_dir = '/Users/tamaregev/Dropbox/postdoc/Fedorenko/Prosody/Prosody-meaning/GitHub/prosody_meaning';
addpath(genpath(function_dir))
T = readtable([morphFolder filesep 'analysis_dp_' delt... |
%% Demo for the CocoApi (see CocoApi.m)
close all;
clear ;
%% initialize COCO api (please specify dataType/annType below)
annTypes = { 'instances'};
dataType='val2014'; annType=annTypes{1}; % specify dataType/annType
annFile=sprintf('../annotations/%s_%s.json',annType,dataType);
coco=CocoApi(annFile);
%% display COCO... |
function result = Robin_fun_pb(x,t)
result = 1;
end
|
function [neighbors] = findNeighbors(G,x)
%This function returns the neighbors of x
%Inputs
% G: N*N matrix representing the graph
% x: The node
%Output:
% Neighbors: list of neigbors of x
if size(G,1) ~= size(G,2)
error('The matrix must be square');
end
%Test symetry
[ix,iy] = find(G);
[iX,iY] = find(G');
... |
function result = mpEllipticF( Phi, M )
%MPELLIPTICF Legendre elliptic integral of the first kind.
% MPELLIPTICF(Phi,M) is elliptic integral of 1st kind of the
% elements of Phi (argument) and M (parameter). Phi and M must be real and
% the same size or any of them can be scalar.
%
% MPELLIPTICF(M) is the co... |
function logpo=logposter(lntheta_eta,x_es,y_es)
% compute log posterior distribution
%Input: x_es=Nxd ; y_es=Nx1 ;
%lntheta_eta=log([length scale d1; length scale d2;.... ;output scale;noise variance; eta])
% Output: loglikelihood = 1x1
d=size(x_es,2);
ymin=min(y_es);
eta=exp(lntheta_eta(d+3));
loglik... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
%
%
%
%
% problem 1- Unilateral Laplace Transform computation
syms s t
f=-1.25+3.5*t*exp(-2*t) +1.25*exp(-2*t);
F=laplace(f,s);
simplify (F);
pretty(ans)
%verification
f=ilaplace(F,t);
simplify(f... |
function sir_llh = lstmSVsmc(mdl,N,y)
% Particle Filter for the LSTM-SV model
T = length(y);
z = zeros(N,T);
h = zeros(N,T);
eta = zeros(N,T);
memory_cell = zeros(N,T);
weights = zeros(N,T);
indx = zeros(N,T); % Store N resampling index in each of T time step
% sample particles ... |
function hideArm(t)
sendCommand(t,sprintf('<s>\n'));
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.