text stringlengths 8 6.12M |
|---|
t=0:1/8192:4;
y=chirp(t,0,1,1000);
soundsc(y);
figure,specgram(y);
%%
y1=filter([0.0675 0.1349 0.0675],[1 -1.143 0.4128],y);
soundsc(y1);
figure,specgram(y1);
figure,freqz([0.0675 0.1349 0.0675],[1 -1.143 0.4128]);
|
clear;
d=2;
N_large = 28;
downsample_factor = 4;
%Load training data
test_images = loadMNISTImages('data/t10k-images-idx3-ubyte');
test_labels = loadMNISTLabels('data/t10k-labels-idx1-ubyte');
SAMPLE_NO = size(test_images,2);
%Store images in cell, original and downsampled
test_images_cell = cell(1, SAMPLE_NO);
bor... |
%Lista de exercícios – Carregamento transversal
%Esboçar gráficos no Matlab de esforço cortante e momento fletor p/ os
%carregamentos abaixo. (Lista 8 numero 4)
clear all
close all
clc
disp('|*******************************************************|');
disp('| Programa que Esboça gráficos de ... |
clear all
clc
% Real model: y(x1,x2) = 3*[sin(x1)]^2 + 7*e^(x2) - x2^2
global x_1
global x_2
n = 4;
range_x1 = [-2:2];
range_x2 = [-2:2];
x1_min = min(range_x1);
x1_max = max(range_x2);
x2_max = max(range_x1);
x2_min = min(range_x2);
a = n^(1/4);
noise = 0.1*rand;
matrix = matrixDesign(x1_max,x1_min,x2... |
function X = normalizeXM(X, metaData)
# normalizeXM(X) takes as input a matrix X
# returns the normalized version in X (-1 < X < 1)
# X is an m x n matrix, metaData is a 2 x n matrix
# The max and min values for each column of X is given in metaData
# metaData(1,:) gives the cluster id for each column of X
# metaData(... |
function opencv2mat(filename,outfile)
fin = fopen(filename,'r');
fout = fopen(outfile,'w');
while ~feof(fin);
s = fgetl(fin);
s = strrep(s, '%YAML:1.0', '');
s=strrep(s, '!!opencv-matrix', '');
% s=strrep(s, ' -', '');
% s=strrep(s, '"p', '''p');
% s=strrep(s, 'g"', 'g''');
fprintf(fout,'%s\... |
%% Main Animation
function obj = Animate(obj, flag)
%Initialize figure
obj.Ani = figure('Color', 'w', 'OuterPosition', [0, 0, 960, 1080], 'PaperPosition', [0, 0, 11, (6/8)*11]);
%figure properties
font_size = 25;
line_size = 15;
line_width = 2;
set(gcf,'Renderer','OpenGL');
set(gca,'FontSize',20)
axis equal
xlabel('... |
% row picture
% |2 -1||x| = |0|
% |-1 2||y| |3|
% first row: 2x - y = 0
% second row: -x + 2y = 3
% look each row in the equation, every row could has a line in the plane,
% the 2 row has a cross point, this point is the solution.
x = -5:1:5;
y1 = 2*x;
y2 = (3+x)/2;
figure
plot(x,y1,'-o', 'MarkerIndices... |
%%Numerical test
clc
clear all
%Data set : svmguide1
%{
filename = 'svmguide1';
method = 0;
%% Set
Set.Minibatch = 100; %BatchSize
Set.Epoch = 10; %Epoch
Set.Overlap = 1 ; %Overlap
%% Trade-Off
%C = 5;
TF.C = 1;
TF.C1 = 100; %TrainLoss
TF.C2 = 0.1; %Syn
TF.C3 = 0.1; %Prox
%% Opt
Opt.eta... |
cfg();
global bects_default;
addpath(genpath(bects_default.bectsnetworkstoolbox))
addpath(genpath(bects_default.fcnetworkinference))
addpath(genpath(bects_default.chronuxtoolbox))
addpath(genpath(bects_default.mgh))
DATAPATH = bects_default.datapath;
OUTDATAPATH = bects_default.outdatapathpwr;
data_directory = di... |
addpath( '../util' );
% --- create a very simple POMDP --- %
% basic stuff: the start_dist is a parameter used in simulations for where
% the real start state should be (can be different from the assumed start)
pomdp.nrActions = 2;
pomdp.nrStates = 4;
pomdp.nrObservations = 3;
pomdp.gamma = .95;
pomdp.start = [ 0 .5 .... |
function applyMarkersToVisualization(vis, mdl, dataInstance, frameInd, cur_ass_mes, matchMatrix)
% add markers
colours.mdl = [0 0 0 0]; % model sensor name
colours.mesEkfExactMatch = [0.5 0 0.5 1]; % in mes and assigned to an ekf entry
colours.mesEkfNotExactMatch = [0 1 1 1]; ... |
classdef Adv_DiffAbstract < NdgPhysMat
%ADVABSTRACTVARFLOW3D Summary of this class goes here
% Detailed explanation goes here
properties( Abstract )
%> Number of physical field
Nfield
%> Number of variable field
Nvar
%> field index of variable field
var... |
function makeTuples( obj, key )
% image statistics
[ik im is ic ib mn] = fetchn(StatsImages(key,'statparam = 1'),'im_kurtosis','im_mean',...
'im_std','im_pwz_corr','im_bispectrum','movie_num');
sim_traces = fetchn(StatsSim(key),'sim_traces');
try
ori_traces = fetch1(StatsOri(key,'ori_param = 1'),'R');
catch
... |
%% Stelling 14
%
% De dimensies van de volgende matrix zijn 4 en 3:
% A = [3 1 9 1; 32 91 23 10; 29 1 2 10]
%
Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
|
function [low_reward high_reward] = get_low_high_reward_LFP(session, ...
electrode, SpikeInfo, ...
SpikeData)
raw_signal = SpikeData{SpikeInfo.LFPIndex(SpikeInfo.LFPID == electrode)};
% LFP is saved as an array of integ... |
function [ sI ] = findStartIndex( samples )
y = 1000*samples.^2;
sI = 1;
for i = 1:100:length(samples)-100
num = 0;
for j=1:100
if(y(i + j) > 2)
num = num + 1;
end
end
if(num > 20)
sI = i + j;
break;
end
end
end |
function [ Phi_basic ] = GenerateRandomProjection( block_size, s_q )
%GENERATEBASICPROJECTION 此处显示有关此函数的摘要
% 此处显示详细说明
basic_phi_filename = 'basicPhi';
N = block_size * block_size;
M = round(s_q * N);
if exist(basic_phi_filename, 'file') %是否存在这个文件
load(basic_phi_filename);
else
Phi = orth(randn(N, N))';
... |
function x = massFractions(a)
% MASSFRACTIONS - Mass fractions.
%
% massFractions(phase);
%
% returns the array of species mass fractions for phase 'phase'. If
% no output argument is specified, a bar plot is produced.
%
x = phase_get(a.tp_id,21);
if nargout == 0
figure
set(gcf,'Name','Mass Fractio... |
function [ pt ] = adamMoulton( p0, tstep, tend)
% This function defines the right hand side f, the first derivative of the right hand side
%with respect to y, initial value p0, the stepsize dt and the end time tend. The output
%of the function is a vector containing all computed approximate values for
%y using Adam... |
function [Q, R] = zgivensqr(A)
%compute QR decomposition based on givens rotation
[m, n] = size(A);
if m ~= n
error('support square matrix')
end
Q = eye(n);
temp = A;
for k=1:n-1
for j = m:-1:k+1
[c, s] = zgivens(temp(j-1,k), temp(j,k));
%update the original matrix
for l=k:n
... |
%%% this script handles the (first) inversion. It is written to behave like
%%% a function; inputs are re-named before use in a rather confusing way to
%%% preserve them for comparison or other uses.
weights=ones(size(amp2)); %%% a placeholder in case weights are applicable
%%% Weighted inversions were validated on... |
% ENC PHASE
clear all; clc
testing=0;
for o1=1:1 % Documentation
col.SceneStim=[1 2];
col.SimDis=3;
col.Trialnum=4;
col.ContextBlock=5; % 1=Context shown, 0=No Context
col.Blocknum=13;
%
col.ItemCorrectResp=6; % 1=Natural, 2=Man-made, 3=Upside down
%
col.ItemType=7; % 1=Natur... |
function [OSy, OSyy] = wykresyZal(N, A)
alfan = wyznaczAlfe(A, N);
% alfan = sqrt(2*2)/2;
OSx = linspace(alfan-0.01,alfan+0.01,1000); % x - tworzy wektor punktów
%dla których rysowane są wykresy
OSy = zeros(1,1000);
OSyy = zeros(1,1000);
A = @(z) det(MacierzA(z,N));
% pętla ... |
%%=========================================================%%
% Pole Placement Controller
%%=========================================================%%
% Masters Thesis, Continuum Actuator, Mechatronics, KTH
% Written by Seshagopalan T M and Ruihao Zhu
% 8th October 2020
%%========================... |
function [] = register(input_dir, mip_input_dir, output_dir)
config = get_config();
write_config(output_dir);
regtype = config('registration_type');
disp(['Registering with ' regtype '...']);
if strcmp(regtype, 'ransac')
ransac(input_dir, mip_input_dir, output_dir);
elseif strcmp(regty... |
function submit(part)
addpath('./lib');
conf.assignmentKey = '1RFc-gNfEeapUhL5oS3IIQ';
conf.itemName = 'Markov Networks for OCR';
conf.partArrays = { ...
{ ...
'Ga9CX', ...
{ 'ComputeSingletonFactors.m' }, ...
'', ...
}, ...
{ ...
'Y6ud3', ...
{ 'ComputeSingletonFacto... |
function flist = get_ccast_fname(stime, etime, path)
% function flist = get_ccast_fname(stime, etime, path)
%
% stime - start mtime
% etime - end mtime
% path - path to the data set
%
% Search the 'path' for file names of the form:
%
% path/yyyy/ddd/SDR_dyyyymmdd_tHHMMSSF.mat
%
% that span the requested... |
function [mu,numerator,denominator] = LumaThres(ymin,ymax,histogram)
numerator = 0;
denominator = 0;
for y=ymin:ymax
numerator = numerator + histogram(y+1)*double(y);%here y+1 used cause histogram x index is from 1-256 but y values are from 0-255
denominator = denominator + histogram(y+1);
end
mu = numerator... |
function Yprime = pend(t,Y)
Yprime=[Y(2),-sin(Y(1))]';
end
% function [thetaprime,fiprime]=pend(t,theta,fi)
% thetaprime=fi;
% fiprime=-sin(theta);
% end |
function write(key, val, root)
% read config file. val is the value asociated with key
%
if isnumeric(val)
isNumber = true;
val = num2str(val);
else
isNumber = false;
end
if ~exist('root','var')
root = inifile('uvms_config.ini', 'read', {'','','uvms_root_folder'});
... |
function GR = Play_Rec()
% ...
% GR = Play_Rec :: Funcion que reproduce y graba la opcion seleccionada:
% .SineSweep : arg(T) [segundos]-- (Reproduce y graba el SineSweep)
% .InverseFilter : arg(T) [segundos]-- (Reproduce y graba el InverseFilter)
% .RuidoRosa : arg(T) [segundos]... |
function plot_electrode_positions(headmodel, electrode_configuration, opts)
figure('visible', opts.figure_windows)
ft_plot_sens(electrode_configuration, 'style', '.');
% hold on;
ft_plot_mesh(headmodel.bnd(1), ...
'facealpha', 0.85, ...
'edgecolor', 'none', ...
'facecolor', ... |
points = 5000;
count = 0;
a = 1
b = 0.5
%scatter points and see if they lie under the curve
for i = 1 : points
x = a*rand(1);
y = b*rand(1);
if ((x^2)/(a^2)+(y^2)/(b^2)) < 1
count = count + 1;
end
end
quadrant = count/points*(a*b); %area in one quadrant
total = quadrant*4 %total a... |
function [I,rI] = ReliabInterc(NS,NC,I1,I2,I3,REL_INT)
% ReliabInterc.m
%
% [I,rI] = ReliabInterc(NS,NC,I1,I2,I3);
% %NS,NC - integer, number of sensors, computers
% %Ii - Integer {1,2,3,4,5,6,7} type of interconnection
% This function returns the interconnections' reliability matrix rI necessary to call
% t... |
function [ slope ] = FindOutlineSlope(boundaryMask, idx)
% FindOutlineSlope.m - Find the angle of the boundary edge
%
% Inputs
% boundaryMask = list [row,col] of foreground pixels in the image
% idx is the index to a point on one of the outlines [row col]
%
% Optional Inputs
%
% Outputs
% slope = the absolute ang... |
function y = YCbCr(x)
% matrix multiply
convertMat = [0.257 -0.148 0.439; 0.564 -0.291 -0.368; 0.098 0.439 -0.071];
bias = [16 128 128];
y = x * convertMat + bias;
y(y>255) = 255;
y(y<0) = 0;
|
function mini=optimummmm
dz=0.14*1.075;
di=dz:1e-4:0.4;
k=koszt(di);
df(di);
mini=fsolve(@(di) df(di),0.25);
Ti=Tizo(mini);
disp(mini)
function k=koszt(di)
di=0:0.001:0.5;
Z=1507;
dw=0.14;
dz=1.075.*dw;
ke=koszt_e(di);
ki=koszt_izo(di,Z,dz);
k=ke+ki;
function dff=df(di)
h=1e-6;
dff=(koszt(di-h... |
%16-107
l = input("length of bar AB in m: ");
v = input("velocity of roller A in m/s: ");
a = input("acceleration of roller A in m/ss: ");
%distance to IC is l because going perpendicular from the walls forms a
%equlateral triangle
omega = v / l;
vB = omega * l;
%relative acveleration equation
%Ab = Aa + alpha x Rb/a... |
function stablization(imgA,imgB,j,output_dict)
imgA=imread(imgA);
imgB=imread(imgB);
imgA=imgA(69:311,60:281,:);
imgB=imgB(69:311,60:281,:);
imgA_gray=rgb2gray(imgA);
imgB_gray=rgb2gray(imgB);
imshowpair(imgA_gray,imgB_gray)%
ptThresh=0.1;
pointsA = detectFASTFeatures(imgA_gray,'MinContrast',0.1);
pointsB=detectFASTFea... |
function c = vdisp(c, alevel, aM, varargin)
%
% NAME
%
% function c = vdisp(c, alevel, aM, varargin)
%
% ARGUMENTS
% INPUT
% c class cortical parellation class
% alevel int verbosity level threshold
% aM matrix Matrix to 'disp'
%
% OPTIONAL
%
%
% DESCRIPTION
%
% This function method conditionally does a disp(aM... |
function drawPlot(m,theta,CoDDA_array)
[n,~] = size(CoDDA_array);
figure(99)
x = 1:n; % x轴的范围
y1 = CoDDA_array(:,1); % Fsame
y2 = CoDDA_array(:,2); % NMI
y3 = CoDDA_array(:,3); % Q
x_smooth = linspace(min(x),max(x));
y_smooth = interp1(x,y1,x_smooth,'cublic');
subplot(3,1,1)
semilogy(x_smooth,y_smooth... |
function P = energy_sphere(q,robot)
n_rods = length(q)/6;
n_base = length(robot.base)/6;
x = zeros(6,n_rods + n_base);
g = 9.8;
for i = 1:n_base
x(1:3,i) = [ robot.base((i-1)*6 + 1)
robot.base((i-1)*6 + 2)
robot.base((i-1)*6 + 3) ];
... |
function [iflags, isite] = site_dcc_random(head, prof, idtest, instrument);
% function [iflags, isite] = site_dcc_random(head, prof, idtest, instrument);
%
% Select CrIS FOVs for fixed sites, high clouds (aka Deep Convective
% Clouds) or random.
%
% Input:
% head - [structure] RTP header with required fields: (i... |
% Python Questions Question 7
%
function [] = python_q7()
%Obtain X,Y then convert to matrix
csv = input('Input number value for X and Y using format: X,Y','s');
XY = csv2mat(csv);
%Convert to scalar
X = int32(XY(1));
Y = int32(XY(2));
%Create ma... |
function plot_coord_sys(obj, axis_len, index)
% Function to plot a coordinate system using an element
% For internal use only
% get rotmat
[rotmat, state1] = obj.get_rotmat(index);
[vector, state2] = obj.get_vector(index);
% check if get_rotmat() and get_vector were successful
if ~(st... |
function [clsfr,res,X]=train_erp_clsfr(X,Y,varargin)
% train a simple ERP classifer.
%
% [clsfr,res,X]=train_erp_clsfr(X,Y....);
%
% Inputs:
% X - [ ch x time x epoch ] data set
% Y - [ nEpoch x 1 ] set of data class labels
% Options:
% ch_pos - [3 x nCh] 3-d co-ordinates of the data electrodes
%... |
function [ EToV ] = makeCounterclockwiseVertexOrder( EToV, vx, vy )
K = size(EToV, 2);
for k = 1:K
vertId = EToV(:, k);
vxk = vx( EToV(:, k) );
vyk = vy( EToV(:, k) );
vertOrder = convhull(vxk, vyk);
EToV(:, k) = vertId( vertOrder(1:end-1) );
end
end% func |
function setArmPos(Serial, angles)
command = '';
for i = 1:length(angles)
command = [command,'#', num2str(i-1), ' P', num2str(angles(i)) ];
if(i == length(angles) )
command = strcat(command,' T500');
else
command = [command,' '];
end
end
%com... |
%% gamma coefficients
function w=gamma_coefficients(f0,gamma,f);
w = 1./(gamma*sqrt(2*pi))*exp(-(f-f0).^2/(2*(gamma.^2)));
|
function [out,varargout] = runningExtreme(input,nSamples,type)
% runningmin - Computes a running extreme of an input vector or matrix
% Optional file header info (to give more details about the function than in the H1 line)
% Syntax: out = runningmin(input,nSamples,type)
% input - vector or matrix of data to return the... |
%% The following function creates a radomly generated matrix that contains
%% values representing the squares of a minesweeper board.
% Variables:
% Output:
% A - a matix representing the minesweeper board
% minecount - the number of mines
% Input:
% dimA - dimension of matrix A, matrix a is squa... |
function [cat] = loadenergycomcattemp(pathname1,catname1)
cat.file = pathname1;
cat.name = catname1;
fid = fopen(cat.file, 'rt');
S = textscan(fid,'%f %f %f %f %f %f %f %f %f %f %f %f %f %f');
fclose(fid);
add19 = S{1,1}(1:1568,1);
matrix = zeros(length(add19),1);
nineteen = matrix+19;
years1 = [nineteen,add19];
year... |
function DMSStructOut = CalTransform(DMSStructIn,NewCal)
% CALTRANSFORM Calibration transformation for DMS data
% DMSStructIn is the structure containing the DMS data, which must include
% Angle, X, Y, and MeasurementParameters
% MeasurementParameters and NewCal are structures containing fields
% EmuPerVolt, YCC, SSC, ... |
function [raices, errores,contadorAritmetico1,contadorAritmetico2] = newtonRaphsonMult2(funciones, x0, tolerancia, n)
jacobiano = jacobian(funciones);
variables = findsym(funciones);
raices = [];
errores = [];
contadorAritmetico1 = 0;
contadorAritmetico2 = 0;
for i = 1 :n
feval = sub... |
RMSE1 = get_RMSE(abs(nm_ch3_roi(:)),abs(ym_ch3_roi(:)));
RMSE2 = get_RMSE(abs(nm_ch3_roi(:)),abs(spectra_CSrecon_ch3_roi(:))); |
function d = polynomial_distance(p, point)
F = length(p) - 1;
x0 = point(:,1)';
y0 = point(:,2)';
n = size(point,1);
da = polyder(p)
b = conv(p,da)
h = [zeros(n, 2*F-2), ones(n,1), ones(n,1) * -x0]
c = b - y0 * [zeros(n, F), da] + h;
X = roots(c);
X = X(imag(X)==0);
Y = polyval(p,X);
d = m... |
function [answer] = gui(playernr)
%GUI Summary of this function goes here
% Detailed explanation goes here
% Obsolet
prompt = {'angle:','power:'};
dlg_title = strcat('Player:',num2str(playernr));
num_lines = 1;
defaultans = {'45','100'};
answer = inputdlg(prompt,dlg_title,num_lines,defaultans);
end
... |
clc; clear ;
directory = '../plates';
img_names = dir(fullfile(directory,'*.bmp'))';
noises = 0.0 : 0.03 : 0.0;
scales = 0.3 : 0.1: 0.7;
imsize = 256;
image = [];
for i = 1:size(img_names, 2)
img = im2double(rgb2gray(imread(fullfile(directory, img_names(i).name))));
img = img([1:end,end,end,end,end],:);
... |
function YCbCr_v = stats_predErr_ord3_min_H_Enc(img_Y,img_Cb,img_Cr, Y_pred, CbCr_pred)
%STATS_COND Summary of this function goes here
% Detailed explanation goes here
img_Y_original = img_Y;
img_Cb_original = img_Cb;
img_Cr_original = img_Cr;
[ ORIGINAL_height ORIGINAL_width ORIGINAL_dimensions ] = size(img_Y);... |
function x0=flocalizaraizquadrada(C)
NExp=fNExp(C);%determina exponte de C
M=C/10^(NExp);
%2p+q=NExp;
p=floor(NExp/2);%menor inteiro
q=mod(NExp,2);%resto inteiro
% q=1; %Impar
% q=0; %Par
x0=(1.68-1.29/(0.84+M))*10^p*3.16^q;
end |
%**********************************************************************************************
%******************************** CHAPTER 11: ROBOT CONTROL *********************************
%**********************************************************************************************
function [taumat,thetamat] ... |
function [param]=Parameters(param,do,location)
% Written by Sigal Saar 10.25.05
%==============================================================
if nargin==0
load('parameters.mat');
elseif ~isempty(do) & location(1)~=0
if do(1:4)=='init' | do(1:4)=='Init'
param... |
function dy = Pcopy(t,y)
x=y(1:4); % plant state
v=y(5:7); % exosystem state
z=y(8:13); % internal model state
x_hat=y(14:17); % observer state of plant state
A=[0 0 1 0;
0 0 0 1;
-1.7117 0 -0.3249 0;
0 0 0 -1.0004];
B=[0 0;
0 0;
0.0503 0.0959;
-0.1228 0.1];
C=[1 0 0 0;... |
function operation_button_bdquote( hObject , eventdata , handles )
% 标的的瞬时行情
% 吴云峰 20170416
global QMS_INSTANCE;
stkQuote_ = QMS_INSTANCE.stkquotes_.quotestk510050;
stkQuote_.fillQuote;
quote_data_ = cell(11, 4);
quote_data_(:, 1) = {'卖5价';'卖4价';'卖3价';'卖2价';'卖1价';'最新价';'买1价';'买2价';'买3价';'买4价';'买5价'};
quote_data_(:,... |
% Prepares the new image for inpainting.
k = 2;
downsample = 0.3;
% Read in the image in grayscale
f = rgb2gray(imread('no_tree.jpg'));
% Threshold to handle MS paint not painting all pixels at 255
f(f>240) = 255;
% Create mask
M = (f == 255);
% Manually fix mask
M(281:389, 513:734) = 0;
M(354, 443) = 1;... |
function per=percentage (predicted, trainY)
k=size(predicted, 1);
per=0;
for i=1:k
if predicted(i)==trainY(i)
per=per+1;
end
end
per=per/k;
end |
classdef yearE7
properties (SetAccess = private) % private = cant config variable from outside
Value =1;
LeapYear = false;
M = [31 28 31 30 31 30 31 31 30 31 30 31];
end
methods
function Y=yearE7(Yv)
if nargin==1
if isscalar(... |
function CE_save_data(varargin)
H=varargin{1};
handles=guidata(H);
dataFolder=handles.dataFolder;
globalProperties=handles.globalProperties;
folderProperties=handles.folderProperties;
%%% Process folder properties
nFolders=length(folderProperties);
for iFolder=1:nFolders
P=folderProperties(iFolder);
... |
function whaleExport(readDir,writeDir)
% Get all the images in 'directory'
images = imageSet(readDir);
% Define the filename format of the output image
formatStr = 'PreProc%d.jpg'; % Output format
imgCounter=0;
% Loop through all images
for i=1:images.Count
% Read an image
I = read(images,i);
% Sca... |
murange=[0,0.4];
deltarange=[0.2,0.2];
vzrange=[0,0.4];
[pr,x]=gen(murange,deltarange,vzrange); %Generate data
y=PCAn(x,2); %PCA
label=kmeans(y,3); %kmeans
kk=3;%% number of classes
%SVM
SVMModels = cell(kk,1);
classes = unique(label);
for j = 1:numel(classes)
indx=(label==classes(j));
SVMModels{j} = fitcsv... |
clear all;
gosolve=1;
istsai=0;
isweert=1;
isschoof=0;
load_data_Cornford_weert=1;
load_data_Cornford_tsai=0;
isquad=1;
cluster=0;
hmin=4000;
if(isquad==1);
Lx=640000;
Ly=80000;
nx=Lx/(10000);
ny=Ly/(4000);
md=squaremesh(model,Lx,Ly,nx,ny);
else
md=triangle(model,'./Exp/MismipDomain.exp',10000... |
clear all; close all hidden; clc; %#ok<CLALL>
p = genpath('.');
addpath(p);
subj = input('Please subject ID:', 's');
fig_num=99;
USB_ch=1;
FS_tag = 3;
[f1RZ,PS.RP,FS]=load_play_circuit(FS_tag,fig_num,USB_ch);
%% Stim & Experimental parameters
L=70; %dB SPL
ntrials = 300;
nconds =1;
jitlist =... |
function [mtest] = MergeMetadata( metatable, test,index )
%MERGEMETADATA Merge test into metatable row of index
% Detailed explanation goes here
mtest = metatable.Tests(index);
fields = fieldnames(test);
fields(cellfun(@(x)strcmp(x,'files'),fields))=[];
for i = 1:length(fields)
mtest.(fields{i}) = test.(fields... |
%Criar um gaussiana sem o randn apenas com o rand
Nexp = 100000;
U1 = rand(1,Nexp);
U2 = rand(1,Nexp);
SU = -0.1:0.05:1.1;
freq_U1 = hist(U1,SU);
pdf_U1 = freq_U1 / trapz(SU,freq_U1);
freq_U2 = hist(U2,SU);
pdf_U2 = freq_U2 / trapz(SU,freq_U2);
figure(1)
subplot(2,2,1);
bar(SU,pdf_U1);
subplot(2,2,2);
bar(SU,pd... |
close all
clear all
clc
%% Connecting with Arduino
instrreset
arduinoSerial = serial('COM7','BAUD', 9600);
connectToArduino(arduinoSerial)
%% Testing connection with Arduino
disp('Starting test measurement.');
[RPM1, measuredCurrent1] = setCurrent1GetRPM1AndCurrent1(arduinoSerial,30);
disp(['Test RPM1: ',num2str(RPM1... |
function [Output] = DHMatrix(alpha,a,d,theta)
alpha = alpha*pi/180; % Deg to Rad
theta = theta*pi/180; % Deg to Rad
c = cos(theta);
s = sin(theta);
ca = cos(alpha);
sa = sin(alpha);
Output = [ c -s 0 a;
s*ca c*ca -sa -sa*d;
s*sa c*sa ca ca*d;
0 ... |
% $Header: svn://.../trunk/AMIGO2R2016/Preprocessor/AMIGO_merge_struct.m 2132 2015-09-21 09:56:12Z evabalsa $
function [opts] = AMIGO_merge_struct(default,opts,parentName)
% [opts] = AMIGO_merge_struct(default,opts,parentName) merge the structures: defaults and opts.
% Iteratively goes through the fields in opts and fi... |
function [EV_Data, EV_Info] = compute_EV_maps(MRI_dir, analysis_dir, Scan_ID, ROI_3D_idx, DCE_filename)
EV_Data = []; EV_Info = [];
% Load DCE-MRI Data
DCE_MRI_Struct = load_DCE_MRI_data(MRI_dir, Scan_ID, DCE_filename);
if isempty(DCE_MRI_Struct)
disp(sprintf('%s: empty DCE_MRI_Struct returned...', mfilename));
r... |
function [SOC, B, co2] = mult_diff_like_mass_Transfer(us_n, ub_n, uco2_n, ksmult, kb, Nx, Ny, Iteration, alpha, dt, Imic, Y, omega, max_iter, tol, theta)
BDF = @(cbp, kbp) cbp .* kbp;
DF = @(csp, cbp, ksmultp) ksmultp .* csp .* cbp;
init_totC=sum([us_n(:); ub_n(:); uco2_n(:)]);
SOC = uco2_n; % unknown SOC at new time l... |
% mlp_classify_bayes
% Copyright (C) 2015 Hao Wang
% Adapted from code by KyungHyun Cho, Tapani Raiko, Alexander Ilin
%
%This program is free software; you can redistribute it and/or
%modify it under the terms of the GNU General Public License
%as published by the Free Software Foundation; either version 2
%of the Lice... |
function [M] = garow(M,c,s,i,k,j1,j2)
for j = j1 : j2
t1 = M(i,j);
t2 = M(k,j);
M(i,j) = c*t1 - s*t2;
M(k,j) = s*t1 + c*t2;
end
end |
classdef GpModel < Model
properties % derived from abstract class "Model"
dim % dimension of the input space X (determined from x_mean)
trainGeneration = -1; % # of the generation when the model was built
trainMean % mean of the generation when the model was trained
tr... |
function [voicedComponents,region_margin] = VoiceFilteringSTE(signal,t,wintype,winlen,winamp,out,Fs)
% generate the window
win = (winamp *(window(str2func(wintype),winlen))).';
% enery calculation
x2 = signal.^2;
En = winconv(x2,wintype,win,winlen);
STE = En(out);
% figure;
% plot(t,ST... |
%Trapezoid Method for Solving Initial Value Problems
%Use with ydot.m to evaluate rhs of differential equation
% Input: interval [a,b], initial value y0, n is the intervals or steps
% Output: time steps t, solution y
% Example usage: [t y]=trapezoid2([0 1],[1,0],4);
function [t,y]=trapezoid2(int,y0,n)
t(1)=int(1); y(1,... |
%% half-shaft angle calc
% in-board point is set as the origin to make understanding of the inputs
% and outputs easier
inboardPoint = [0 0 0];
% points, here, are
x = (9.625+.5*1.887)-(9.25+.5*3.691);
y = 14.75;
z = (13 + 13/16) - 17.5;
deltaZmax = 8.75;
outBoardExt = [x y z];
u = outBoardExt;
uprime = [x 0 z];
le... |
%%
% This function generates a system with different terminal functions and constraints but
% with same size. The constraint are preconditioned accodingly.
% We solve the method using different methods. First formulated using
% 1) Gurobi-IP 2) Gurobi-AS directly
clear all;
close all;
clear model;
clc;
Nm=5; % Number o... |
function [y1,y2] = squareAndCubeThisNumber(x)
y1 = x^2;
y2 = x^3; |
function map = settings()
map = containers.Map;
map('data_path_base') = '/Users/irieger/apertus/data';
map('matlab_code_dir') = '/Users/irieger/apertus/matlab';
map('apertus_script') = strcat(map('matlab_code_dir'), '/apertus_com.bash');
map('tmp_dir') = strcat(map('data_path_base'), '/tmp');
end |
function [S, P] = getSerParGenSets( nint, a, b )
% getSerParGenSets produces the generating reaction sets for all serial and
% parallel modules within a particular topological class
%
% [S, P] = getSerParGenSets( nint , a, b ) takes as input the number of
% internal vertices (metabolites) nint in the module and the two... |
function [RR]=parratt(Q,lambda,sld,d,sigma)
% MATLAB function from:
% "Elements of Modern X-ray Physics" by Jens Als-Nielsen and Des McMorrow
%
% Calculates: Parratt reflectivity of a multilayer
% Inputs: Q wavevector transfer 1/Angs
% lambda wavelength of radiation Angs
% sld scattering length density 1/Angs^2... |
% clear; close all;
J=5; %number of decompositions to do
load('ims.mat');
load('filter_coeffs.mat');
% h=[1 1];
% g=[1 -1];
% wv = 'bior3.5';
% [Rf,Df] = biorwavf(wv);
% [g,h,LoR,HiR] = biorfilt(h,h);
rng(3);
g=g/norm(g); %need to be normalized to 1
h=h/norm(h);
g=[0 g];
h=[0 h];
jtbx=log2(256)-J;
cfg.ti=1;
% figure(1)... |
%% Input images
dset_dir = fullfile(setup_data.DATA_DIR, 'iCubWorldUltimate_centroid256_disp_finaltree');
%dset_dir = fullfile(DATA_DIR, 'iCubWorldUltimate_centroid384_disp_finaltree');
%dset_dir = fullfile(DATA_DIR, 'iCubWorldUltimate_bb60_disp_finaltree');
%dset_dir = fullfile(DATA_DIR, 'iCubWorldUltimate_bb30_disp_... |
% proc_epoch() - epoch about task-specific events and remove epoch baselines (optional)
%
% Usage:
% >> OUTEEG = proc_epoch(INEEG, varargin);
%
% Inputs:
% INEEG - input EEG dataset
% 'events' - specify events to epoch around
% ['ALL'|'all'] = unique({EEG.event.type}); (default)
% ... |
% Simple function that takes in a value and an array and determines
% if the value is in the array.
%
% Copyright (c) 2016 by Pranay Seshadri
% University of Cambridge
%
function [yesOrNo, location] = amIinarray(value, array)
for i = 1 : length(array)
if value == array(i)
location = i;
yesOrNo = 't... |
%% BMI Calculator
% file: BMIcalc.m
%
% by Nathaniel Chang
% Created: 09/03/2021
% last edited: 09/03/2021
% programing (MATLAB and C) Semester 1
% -------------------- initialize values -------------------
weight = 0;
height = 0;
BMI = 0;
% ------------------ asking for user input -----------------
weight = in... |
%% Constants
g = 9.81; %m^2/s
rhosaltwater = 1027; %kg/m^3
rhofreshwater = 997; %kg/m^3
NeutralVolumeSW = 0.002989378523; %m^3
NeutralVolumeFW = 0.002539995113; %m^3
FpushSW = 30.1176; %N
FpushFW = 24.8426; %N
FbSW = 180.5833; %N
FbFW = 175.3082; %N
AUVWeight = 150.4656; %N
Cd = 0.91; %unitless
A = 0.246; %m^2
D = 20;... |
function [ F ] = FormingF( N, eps )
% Forming the column vector F
% F(x, y) = (1 + eps) * pi ^ 2 * sin(pi * x) * sin(pi * y)
n=N-1; % to save time repeatedly computing N-1:
F=zeros(n,n);
for i=1:n
for j=1:n
F(i,j)=(1+eps)*pi*pi*sin(pi*i/N)*sin(pi*j/N);
end
end
F=F(:);
end |
%Fs--------------------------------------------------------------------
%
%script setupCryoNew
% set up parameters for CryoDet<xyz>.slx
% Original 2-3-2016 / SSmith
% Copied & Modlfied for new AMC HW Alg / JED May 2017
%
% Update History:
% <07-31-2017 JED>: added simulink_period var
% <09-22-2017 SRS>... |
function [alldat] = Crack_align(alldat)
%% decide to continue or not
opts.Interpreter = 'tex'; % Include the desired Default answer
opts.Default = 'Y'; % Use the TeX interpreter to format the question
quest = 'Is the crack on the x axis?';
reply = questdlg(quest,'Bounda... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.