text stringlengths 8 6.12M |
|---|
function [A] = zadatak8(A)
[n] = size(A);
d1 = eye(n(1));
d2 = fliplr(d1);
maska = d1|d2;
elementi = A.*maska;
bez_elementi = A.*(~maska);
elementi = fliplr(elementi);
A = elementi+bez_elementi;
end |
function t=ndt_storage_table(m)
% t=ndt_storage_table(m)
% returns 6 storage indices for each of 27 neigbors as array size (6,3,3,3)
% t(1:3,...) row offsets 0 = this this row
switch m
case 27
% no row offset
t=zeros(4,3,3,3);
% flat indexing within the row
t(4,:,:,:)=reshape(1:27,... |
clc
close all
clear all
files = dir('data/fda_ue/*.f0ref');
audios = dir('data/fda_ue/*.wav');
n_files = length(files);
w_prior = [];
z_array = [];
figure
for f=1:n_files
w_prior = [w_prior; textread(strcat('data/fda_ue/',files(f).name))];
[x, f_s] = audioread(strcat('data/fda_ue/',audios(f).name... |
function d=delay095(t,x)
d=[t-exp(t)/(exp(t)+1);t-(0.75-0.25*sin(t)); t-exp(t)/(exp(t)+1);t-(0.75-0.25*sin(t))];
%d=[0.75-0.25*sin(t);0.75-0.25*sin(t)];
end |
function [ tracklet, k ] = getTracklet( tracklets, xyt, distanceThreshold )
x = xyt(1); y = xyt(2); t= xyt(3);
[~,~,N] = size(tracklets);
tracklet = [];
k = 0;
for n=1:N
if (pdist2([tracklets(t,1,n) tracklets(t,2,n)], [x y]) < distanceThreshold)
tracklet = tracklets(:,:,n);
k = n;
return;
... |
function [ tabs ] = lipidGrid(op,ass,fold)
%lipidGrid - uses the op and assignments to create a range of lipid maps
%for length .v. desaturations etc...
warning on all;
f0 = findobj('Name','Lipid Grid');
close(f0);
op.XPeaks = full(op.XPeaks);
op.XPeaksLog = full(op.XPeaksLog);
% Remove all NaN/Inf values from the ... |
%% RBES_Evaluate_Instrument.m
function [r,score,panel_scores] = RBES_Evaluate_Instrument(r,instr_name)
% Ex of usage: [r,score,panel_scores] = Evaluate_Iridium_Instrument('IRID_BIOMASS')
% Assumes a fact file exists with the name:
% C:\\Documents and Settings\\Dani\\My
% Documents\\PhD\\research\\projects\\Rule-based S... |
function [ newbars ] = getcut( obj, times, flag )
%UNTITLED 截断原bars作为newbars
% [ newbars ] = getcut( obj, times )
% times 两种格式,如果对时间要求不高,输入格式为[3:200],指定切出3:200行。
% 如果对时间精度要求高,输入格式为[20130101,20130801],指定输出2013年1月1日至2013年8月1日的数据
% flag 如果是格式1,flag为1;如果是格式2,flag为2
% ---------------------... |
function plot_wind_at_h(p,iheights,levels,alpha,timestep,windscale,heightscale)
x=p.xlat;
y=p.xlong;
clf
if ~exist('timestep','var'),
timestep=1;
end
if ~isscalar(timestep),
error('timestep must be scalar')
end
hgt=p.hgt(:,:,timestep); % terrain height
% wind at given height
for i=iheights(:)'
z=p.heights(i... |
clc
clear all
close all
getVariables;
getInitialisations;
RandomMatrix=randn(Samples, NumberOfTransceivers);
for i=1:NumberOfTransceivers;
OriginalSignal(:,i) = RandomMatrix(:,i);
end
|
function out=augEnKF(dynfun,M,data,time,x0,R,V,P0x,q0,P0q,Vq,N,param)
%
% augEnKF: Augmented Ensemble Kalman Filter
%
% This implements the ensemble kalman filter using the method from
% Evensen (2004). This implementation uses linear observations given by
% the observation matrix operator, M. This EnKF... |
circuit={'S','X','X2m','X2p','Z';...
'H','CZ','CZ','I','I';...
'X2m','Y2p','I','CZ','CZ';...
};
qubits = {'q9','q8','q7','q6','q5'};
p = sqc.op.physical.gateParser.parse(qubits,circuit);
p.Run();
%%
circuit = {'Y2p','Y2m';
'CZ','CZ';
'Rz(0)','Rz(3.1415)';
'','Y2p'};
p = sqc.op... |
% This function creates 4 graphics about
% an image's singular values.
function task5(image, k)
% Read image into matrix.
A = double(imread(image));
% Use own project's Ak computation function:
[A_k S] = task3(image, k);
[m n] = size(A);
y2 = y3 = y4 = [];
div = sum(diag(S)(1:min(m,... |
function [t] = v2t(v)
% Convert from vector form of pose to corresponding homogenous transformation
% v: 3x1 vector representing the robot pose [x; y; theta]
% t: 3x3 matrix representing the homogenous transformation
t = [cos(v(3)) -sin(v(3)) v(1);
sin(v(3)) cos(v(3)) v(2);
0 0 1];
end |
% Performance. The best way to determine where to improve the performance
% of your code is to use the Matlab profiler tool, demonstrated below.
%
% Profile on, off, and viewer are tools to help with this process
useLoop = 0 ;
nSamples = 5e6 ;
t = linspace(0,10,nSamples)' ;
% y = zeros(nSamples,1) ;
% Optio... |
function corrMats = convert_correlations_to_normal_variables(corrMats, ...
sigma, ...
doRegularize)
%CONVERT_CORRELATIONS_TO_NORMAL_VARIABLES converts correlations to z-scores
%
% CORRELATI... |
function [xnext,A,SQ] = processModelArm(x,~,param)
T = param.T;
A = [
1 T (1/2)*T^2
0 1 T
0 0 1
];
xnext = A*x;
SQ = param.SQ; |
clear all
close all
T = readtable('../AStract/PatientInfo_063021.csv','Headerlines',2);
for pt = 22:872
pt_id = T{pt,1}{1};
for i=1:4
if isfile(strcat('/Volumes/GoogleDrive/Shared drives/REU shared/ForwardEvaluation/nomHRs/', pt_id, '_val', num2str(i),'_nomHR.mat'))
load(strcat('/Volu... |
function create2dgif(rvec,hvec)
%filename = '2dfig04.gif';
% global HAND;
global deltamax;
% dr = 0.5;
% dh = -1;
% hi = 315.05;
% ri = -12.675;
% % dr = -0.5;
% % dh = 1;
% % hi = 90.05;
% % ri = 99.825;
opengl software
ri = rvec(1);
dr = rvec(2)-rvec(1);
hi = hvec(1);
dh = hvec(2)-hvec(1);
% for i = 1:length(rvec)... |
%% FINAL files format
% 'data', contains trade data in a 1x6 cell:
%
% 1 [hh, mm, ss] uint8
% 2 price single
% 3 size uint32
% 4 [G127 rule, correction] uint16
% 5 condition ... |
%{
Jacob Leonard
ITP 168 - Fall 2015
jaleonar@usc.edu
Revision History
Date Changes Programmer
-------------------------------------------------
9/2/2015 Original Jacob Leonard
%}
fprintf ('Average Calculator \n')
number1 = input('Please Enter First Number: ');
number2 = input(... |
table = [0 380; 0.25 200; 0.50 100; 0.75 20; 1.00 0];
syms a b
y = (a + b*table(1,1) - table(1,2))^2 + (a + b*table(2,1) - table(2,2))^2 + (a + b*table(3,1) - table(3,2))^2 + (a + b*table(4,1) - table(4,2))^2 + (a + b*table(5,1) - table(5,2))^2;
y_expanded = expand(y);
f_a = diff(y, a) == 0;
f_b = diff(y, b) == 0;
%... |
% Function that returns the index by label of allData file and Max index value.
% input (allData): allData file
% output (ILCH, IRCH, ILDF, ILPF, IRDF, IRPF, IDesc, idxMax): index values
% by label and Max index value. Using Imaginaery EEG Task
% Remember that for this experiment the labels represent:
% BEO, LCH, RCH,... |
function d2F = lapCS(F)
% lapCS = laplacian in Chebychev Space
% Subroutine for calculating d^2/dx^2 in Chebyshev space
% INPUT: F is a vector in Chebyshev Space
% OUTPUT: d2F is a vector in Chebyshev Space
% By Chiyu Jiang, 11/10/2015
d2F = derCS(derCS(F)); |
% Adobe Photoshop toolbox.
% Version 1.0 13-Dec-2006
%
% General.
% psconfig - Get and set the current preferences settings in Photoshop.
% psjavascript - Execute the given text as JavaScript and return the result.
% pslaunch - Launch Photoshop or attach to an already running Photosho... |
close all;
clear all;
more off;
SUM_COL = 3;
PATCH = [10 30 50 100 200 300];
PN = 6;
TAU = 1000;
TAUVAR_PERCENT = [0.1 0.5 0.7];
TVN = 3;
GN = 100;
TAUFILT = 0.001;
tauEst = TAU;
for p = 1:PN
for tv = 1:TVN
tauVar = TAU * TAUVAR_PERCENT(tv);
tau = abs(normrnd( TAU, tauVar, 1, 100) );
fprintf('tau ... |
function elem=atsbend(fname,varargin)
%ATRBEND(FAMNAME,LENGTH,BENDINGANGLE,K,PASSMETHOD)
% creates a rectangular bending magnet element with class 'Bend'
% FAMNAME family name
% LENGTH length of the arc for an on-energy particle [m]
% BENDINGANGLE total bending angle [rad]
% K focusing str... |
function D = samplemidi(MF,T,C,MX)
% D = samplemidi(MF,T,C,MX)
% Return D as a 127x... piano roll matrix of notes in the MIDI
% file named MF sampled at regularly-spaced times T sec apart
% (default 0.05 s = 20 frames/sec),
% including all channels specified in C (default: all except
% drums (10))
% ... |
% Loss_cross_entropy_softmax Compute Euclidean distance from the input
% and the ground truth
%
% [L, dLdy] = Loss_cross_entropy_softmax(x, y) computes the euclidean
% distance given input to the softmax layer x and ground truth y.
%
% Input:
% x = mx1 input to the softmax... |
% Tarif Riyad Rahman
% MATLAB syntax used
% This is the test bed for the function powerN
% sample cases are used for testing the correctness of the function
% Tested by:
% Mehreen Asad (Added 2 new test cases)
% Josh Silverman (good coverage)
% Antonio Cancio (Added a new test case)
function e=test_powerN()
e=0;
... |
%Andrew Dhawan
%9th April 2017
%This is the code that produces the data for the TCP curves, as well as
%recurrence time. This is the only file that needs to be run by the end
%user.
%this is the case where we vary the time of doubling between 10-100 days
close all
%generate the data
dbl_times_sens = 10:5:100; %the dou... |
%% Epoching
varExist = exist('spect2Plot','var');
if varExist == 0
spec2Plot = true;
end
alignEvent_MI = spectrogramData{1}.state.ST_MOV;
params.params_epoching.timeBeforeEventMI = 2;
params.params_epoching.timeAfterEventMI = 2;
epochs_ERD_ONSET = extract_epochs_runs(spectrogramData,...
alignEvent_Base,.... |
clear all
clc
close all
[Rezultati] = textread('Udarac 1.txt','%f');
% SAMO DOK NE POMNOZIM U KONTROLERU
Rezultati=Rezultati.*3.3;
%figure;
%plot(Rezultati);
data_1=[];
data_2=[];
data_3=[];
v=1;
k=1;
for i=1:length(Rezultati)
if v==1
data_1(k)=Rezultati(i);
k=k+1;
end
if v==2
... |
figure()
plot(xdata,ydata,'ko')
figure()
plotmatrix(VitroTest,VivoTest, 'ko')
|
function [edges] = RandGraphBA(n,m)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Generate an Barbasi-Albert type random graph
% with average initial degree = m (most interesting vals are m<1)
%
% INPUT:
% n - the number of nodes
% m - average initial degree
%
% OUTPUT:
% edges - an adj... |
function [errorCode,errorMsg] = Logout(connection,token)
import com.hundsun.esb.* com.hundsun.esb.data.*;
[errorCode, errorMsg] = CallService(connection,MakeRequestPacket(token));
end
function [message] = MakeRequestPacket(token)
import com.hundsun.esb.data.* com.hundsun.esb.impl.*;
message = jav... |
clear all
% Program reads the data from the sme files and writes the data in an
% output file used in carboeuroflux (Michael Boy June 2004)
% Open sme files for every month
YEAR = input('Year: ', 's');
year = eval(YEAR);
day_month_03 = [0 31 59 90 120 151 181 212 243 273 304 334];
day_month_04 = [0 31 6... |
function plot_spec0
xy=0;
% HH = -0.1:0.002:0.1;
% dH=0.01;
% spec = calc_spec(HH,dH, 0.1, 0.3, 0,0,0);
find_figure('plot_calc0'); clf; hold on;
% plot(HH, real(spec), 'r.-')
% plot(HH, imag(spec), 'b.-')
load 20141010_1mV.mat
mA2G = 2*pi*833000/2654/20378;
for hmin=[-500 -250 -150 -100 -50 0 50 ... |
load Mastermind % Loads Board (10x8 cell array), eight color blocks (red, green, blue, yellow, purple, pink, orange, turquoise), a white peg block and a black peg block.
imshow([Board{1,:};Board{2,:};Board{3,:};Board{4,:};Board{5,:};Board{6,:};Board{7,:};Board{8,:};Board{9,:};Board{10,:}]) % Show all 10 rows and 8 c... |
function [A, hG] = mrpln33_graphAdjacencyMatrix(fg, values, values_priors, robots, varargin)
% Construct adjacency matrix of the given factor graph of the joint
% multi-robot state and return its corresponding topological graph.
% Joint state X is defined as {Xr1, Xr2, ...} where Xri denotes the set of
% poses of the ... |
function parameters=solve_sdp_multi(parameters, x, sdp)
%[parameters] = solve_sdp(n_x, n_h, n_y, lambd, mu, Lip, ind_Lip, parameters)
%test
addpath(genpath('..\YALMIP-master'))
addpath(genpath('C:\Program Files\Mosek\9.2'))
%net_dim = x;
% net_dim = [2, 10, 10, 3];
fname = 'weights.json';
weights = jsonde... |
function itd = interpolateITDs(itds,ws)
% interpolateITDs linearly interpolates the ITDs specified in the vector
% itds with the weights ws.
%
% SYNOPSIS: itd = interpolateITDs(itds,ws)
%
% INPUT itds: a vector of ITDs of size n
% ws: a vector of weights of length n used for the interpolation
%
% OUTPUT h:... |
function [traces,out] = dfof(traces,fps,traceOpt)
traces = traces(:,:,1);
traces = traces+495424;
if isfield(traceOpt,'highPass') && ~isnan(traceOpt.highPass)
if traceOpt.highPass>0
k = hamming(round(fps/traceOpt.highPass)*2+1);
k = k/sum(k);
traces = traces./convmirr(traces,k)-1; % dF/F ... |
clc;clear; load excell_results.mat
figure(1)
x=1:10;
figure(1);clf;
subplot(1,2,1); hold on
X=[x(1:end),fliplr(x(1:end))];
Y=[NOR(1:end,2)',fliplr(NOR(1:end,1)')];
fill(X,Y, [0.65, 0.65, 0.65]);
plot(x(1:end), NOR(1:end,2), 'color', [0,0,0], 'lineWidth', 1)
plot(x(1:end), NOR(1:end,1), 'color', [0,0,0], 'lineWi... |
function gauss_jaccobi_method()
A = [5 -2 3 0;-3 9 1 -2;2 -1 -7 1; 4 3 -5 7]
b = [-1 2 3 0.5]'
[x, itr] = GaussJaccobi(A, b);
if itr > 0
fprintf('Number of iterations: %d\n', itr);
fprintf('Solution ');x
else
fprintf('Abort execution!\n');
endif
end
function [x, it... |
function [ent] = spatial_entropy(Grid,N)
% SPATIAL_ENTROPY calculates the spatial entropy by dividing the MxM Grid
% into sub-grids of size NxN.
M = size(Grid,1); % M^2: Grid size
k=0;
for i=1:M/N
for j=1:M/N
k=k+1;
SG = Grid( (i-1)*N+1:i*N, (j-1)*N+1:j*N ); % Split Grid
No... |
% proc_csd() - Convert EEG structured data to Current Source Density (CSD) or
% spherical spline surface laplacian (SP) via the CSD-toolbox
% See: Kayser J, Tenke CE, Clin Neurophysiol 2006;117(2):348-368
%
% Usage:
% >> OUTEEG = proc_csd(INEEG, varargin);
%
% Inputs:
% INEEG - inpu... |
clear;
% Load the provided Datasets
train_set = load('dataform_train.csv');
test_set = load('dataform_testA.csv');
% Define max rounds of iteration and the number of individuals
max_iter = 500;
num_features = 90;
num_ind = 100;
mean_cost = zeros(num_ind, max_iter + 1);
tic;
init_groups; % Implement group initiation... |
% requires to be called from parRunner
% figure(700);
disp(nikCell{1});
for i = 2:10
x = nikCell{i};
t = nikCell_t{i};
if t(end)>100 %happens only for non-table times
t = t./1000; % convert time to seconds - not for table feedback
end
[t ind] = unique(t); %a problem only for the i4
x = ... |
%% dac zeros offset callibration
chnl = 64;
data_taking.public.calibration.ustcDAZeroOffser(...
'awgName','da_ustc_1','chnl',chnl,'voltMeterName','vMeter_agl_34465_1','fineCallibration',false,...
'gui',true); |
function [a,b,c]=latticeFT(centers, limits, Depth, maxDepth)
xSubDiv=10;
ySubDiv=10;
zSubDiv=10;
lMin=limits(1);
lMax=limits(2);
mMin=limits(3);
mMax=limits(4);
nMin=limits(5);
nMax=limits(6);
lSteps=(lMax-lMin)/(xSubDiv-1);
mSteps=(mMax-mMin)/(ySubDiv-1);
nSteps=(nMax-nMin)/(zSubDiv-1);
x=centers(:,1);
y=centers(:... |
%
imgl=imread('DATA/tabuleiro_left/bmp/tabuleiro_left0.bmp');
imgr=imread('DATA/tabuleiro_right/bmp/tabuleiro_right0.bmp');
data=load('DATA/data.dat');
% Dados da camera
alpha=data.alpha;
% Dados da geometria
S0=data.S0;
S1=data.S1;
% Dados do arquivo
Hp=size(imgl,1)
Wp=size(imgl,2)
% Dados do matching
figure(1)
i... |
function Mo = unstackmat(Mi,Nx,Ny)
% The function takes a 2d matrix, picks out each column, and stack into a
% 3d configuration along the dimension dim.
% N1 and N2 are the size of the other two dimensions.
% INPUT1: Mi is the input 2d matrix
% INPUT2: dim is the dimension along which vectors are stacked.
% INPUT3: N1... |
function plot_area_pred_band (bpp, ac_pair, dim, file_name)
figure(); hold on;
set(gcf,'Position',[100, 0, 600, 600]);
set(gcf, 'PaperOrientation', 'landscape', 'PaperPositionMode', 'auto', 'color', 'white');
set(gca,'fontsize',14);
set(gca, 'ydir', 'reverse');
grid on; axis equal;
for j = 1:length(ac_pair);
area... |
function positions = gen_trajectories(sim_vars,speed,option)
% Recreate the time axis
t_end = sim_vars.t_end;
t_step = sim_vars.t_step;
t = [0:t_step:t_end];
% Generate different options
if option == 2 % Sine Wave Trajectory (0.2Hz)
x = [0:1:length(t)-1]*(speed*t_step) + 0.15;
... |
function [patt,freq]=NETFIT_compress_cols(H)
%Function compresses firing patterns into pattern x frequencies pairs.
% [patterns,frequencies]=NETFIT_compress_cols(H)
% H is a NxT matrix of firing patterns recorded on N neurons in T time-bins;
% pattern is a NxK matrix of unique firing patterns and frequencies is a
... |
%function [EER]=SVM(mainDir)
%Support Vector Machine with Linear Kernel
%[~, folders, ~, ~,~,...
% ~, ~, ~,...
% ~, ~, ~, ~, ~,...
% ~, ~, ~,...
% ~, SvmExe, SVMtrainConfig, ...
% SVMtestConfig, ~, ~]=getALIZEpath(mainDir);
mainDir='/home/jenniffer/Desktop/data/Comb_Room_Mic/';
eval(['cd ' mainDir '/'... |
%Read im0.png and im1.png from the specified path and read the given ndisp from calib.txt
function [I,ndisp] = input_data(scene_path)
S0 = dir(fullfile(scene_path,'im0.png')); % pattern to match filenames.
S1 = dir(fullfile(scene_path,'im1.png'));
S2 = dir(fullfile(scene_path,'calib.txt')); % pattern to match filenames... |
clc
clear all
close all
t1=clock;
ys_data=xlsread('data6.xlsx'); %读入原始数据,第一列放因变量
[n,p]=size(ys_data); %n行,p列
for i=2:p
Y=ys_data(:,1); %将因变量赋值给Y
X=ys_data(:,i); %逐个将自变量赋值给X
xs(1,i-1)=i; %将相关性系数数组的第一行添加变量所在列位置标记1:p
xs(2,i-1)=abs(corr(X,Y,'type','Pearson')); %逐个计算自变量与因变量间的Pearson相关性,保存至xs数组第二行
end
[n_x... |
function collision = collision_check_set(car, obstacles, states)
collision = zeros(1, size(states, 2));
for idx = 1:length(collision)
collision(idx) = collision_check(car, obstacles, states(:, idx));
end
end |
function love = ahhi()
global emiu;
if isempty('emiu')
emiu = 101;
for i = 1:10
emiu = emiu + 1;
end
disp('emiu not existed. Created one');
else
disp('emiu existed');
end
|
%--------------------------------------------------------------------------
% Marie Valenduc and Willem Melis (November 2016)
% System identification and modeling - Session 2
%--------------------------------------------------------------------------
clear all; close all;
% data
N_est = 1000; ... |
total_area_new_method = zeros(1,7);
facet_area = zeros (1,7);
for i = 7
nref = i;
%sphere
ellipsoid
new = zeros(nv,6);
for i_try1 = 1:nv
new(i_try1,:) = findface(v,nt,i_try1);
end
simple = [2 3 1];
area_vertex = zeros (nv,3);
for i_try1 = 1:nv
Note = new(i_try1,... |
% function build new test dataset
function buildTest(testDigitData,QBC,loop)
countA = 0;countB =0;countC = 0;countD = 0;s3 = '.bmp';
dimTest = size(testDigitData.Labels);
for i=1:dimTest
img = imread(testDigitData.Files{i});
if(testDigitData.Labels(i)=='A')
countA = countA... |
function setMenuIcon(menuObject,iconFile)
% SETMENUICON Add icons to UIMENU items.
% SETMENUICON(MENUOBJECT,ICONFILE) sets the icon of MENUOBJECT to
% ICONFILE. MENUOBJECT is a menu item created with MATLAB's own UIMENU.
% ICONFILE denotes the path to an image file containing the desired icon.
% This should wo... |
n=5
fprintf('linear array of %i cells\n',n)
B=sparse(2*n);
D=sparse(n,2*n);
C=sparse(n,2*n);
A=speye(2*n);
if n<200, B=full(B);D=full(D);C=full(C); end
for i=1:n
s=(i-1)*2+1:i*2; % span of local dofs
A(s,s)=diag([1,2]);
B(s,s)=[-1,0;0,1];
D(i,s)=[1,1];
C(i,s(end))=1;
if i<n,
C(i,s(end... |
%% Apply Demodulator:
% First Rx (Third Tx) CP tier:
sampl_offset = -1; % Aligns the sampling between the synthesis and analysis band
% corr_synchronizer(RxSignal, Lpreamble, M1, 0, 0);
channel = [1+0.87i 0.2+0.1i 0.1+0.2i];
% channel = [0.5i-0.8i -0.2i 0.2+0.1i 0.1+0.2i 0.01i-0.01];
CC = fft(channel,64);
Rx... |
% skeletonization_dt
% Generates the skeleton for an input binary image based on the distance
% transformation. This method allows for easy object reconstruction from
% the skeleton.
%
% Input
% --------------------
% Im Input binary image.
% Output
% --------------------
% ... |
function tign=perimeter_in(long,lat,fire_area,wrfout,time,interval,time_step,num_wrf, input_type)
% Volodymyr Kondratenko July 19 2013
% Ideas line 261
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Input:
% long,lat longtitude and latitude converted to meters
% ... |
function [Xf, Yf] = cal_point(Xs, Ys, angle, dist)
% Calculate point (Xf,Yf) at specific distance from start point (Xs,Ys)
% Using angle (angle) and distance (dist)
% Yf = angle*(Xf-Xs)+Ys
% (Xf-Xs)^2 + (Yf-Ys)^2 = dist^2
t = angle*Xs - Ys;
R0 = angle*angle + 1;
R1 = -2*(Xs + angle*Ys +... |
function FORCE_thermal = calculate_thermal_force(FEM,Laminate,Mat,Stru,T0T1,center,physical_length,Thermal)
gDOF = FEM.GDof;
FORCE_thermal = zeros(gDOF,1);
[GaussWeights,GaussLocations]=gaussQuadrature(FEM.GaussPointBend);
for elem =1:FEM.numberElements
NodeIndices=FEM.elementNodes(elem,:);
numberNodes... |
split_imaging_train_test
base = cd;
cd(base)
big_matrix = [];
the_matrix = [];
behav_response = [];
fold_ids = [];
for folds = 1:3;
temp_imaging_spk = [];
temp_imaging_spk = train_imaging_spk(trial_ids{folds});
[big_matrix_temp,big_matrix_ids,the_matrix_temp,the_matrix_ids,response_temp] = make_big_matrix_f... |
clear;clc;
warning off
addpath(genpath('Functions'))
addpath(genpath('../Input'))
outdir = ['..' filesep 'Output' filesep];
%% Set up parameters
rrho = 0.04;
bbeta = 1/(1+rrho);
ssigma = 1.5;
ddelta = 0.08; % depreciation rate
aalpha = 0.36; % capital share in Cobb-Douglas
ttheta = 0.9; ... |
function [] = AngleAndSpeedMovie(matrix, start, stop)
% sizeX = size(matrix, 1);
% sizeY = size(matrix, 2);
% angles = zeros(sizeX, sizeY, stop - start);
% speeds = zeros(sizeX, sizeY, stop - start);
hmap(1:255,1) = linspace(0,1,255);
hmap(:,[3]) = 1;
hmap(:,[2]) = 0.65;
huemap = hsv... |
%% GENERADOR DE TRAYECTORIAS DEL ROBOT RRR Lineal
% En primera instancia se disenara un GDT lineal.
function [ref] = GDT_RRR(in)
% Variables de entrada en la funcion
x_init = in(1);
y_init = in(2);
z_init = in(3);
x_fin = in(4);
y_fin = in(5);
z_fin = in(6);
n_ptos = in(7);
t_init = in(8... |
cla, close all;
clear all;
l = 0.5;
C = [1 0 0 ;
0 1 0;
0 0 1];
D = [0 0;
0 0
0 0];
states = {'x' 'y' 'theta'};
inputs = {'v' 'phi'};
outputs = {'x' 'y', 'theta'};
R = [ 0.1 0;
0 0.1 ];
Q = [1000 0 0 ;
0 1000 0;
0 0 0];
ts = 0.01;
r = [ 2.5654;
... |
% invert a general matrix A using the pseudoinverse
% return values are:
% inv_A - the pseudoinverse of A
% r - the rank of A
% P_R - the projection matrix onto the range(A)
% P_N - the projection matrix onto the null(A')
function [inv_A, r, P_R, P_N] = invertProjection(A, epsilon)
if nargin < 2... |
% GNU Octave file (may also work with MATLAB(R) )
Fs=8000;minF=10;maxF=Fs/2;
sweepF=logspace(log10(minF),log10(maxF),200);
[h,w]=freqz([1.526008445288920e-01 3.052016890577839e-01 1.526008445288920e-01],[1 -6.328855625361093e-01 2.432889406516772e-01],sweepF,Fs);
semilogx(w,20*log10(h))
title('SoX effect: lowpass gain=... |
function [Tonal_IA_meansurf] = if2space2(ILD_matrix,...
HRTF_freqaxis,...
if_meansurf,...
if_freqaxis,...
if_ildaxis,...
IA_bestloc_ind);
%Function that implements Line Integral method WITH ILD_distance correction
%ILD_matrix: ILD matrix (r=freqs,c=locs)
%HRTF_freqaxis: frequencies for ILD matri... |
clear; clc;
% This is the least squared norm but can be changed to any distance. KL
% Divergence could be here or perhaps we could some other metric here.
% Ground_Distance_Matrix_Func = @(v1,v2) norm(v1-v2,2);
Ground_Distance_Matrix_Func = @(v1,v2) KLDiv(v1',v2');
% the columns are the different features we have an... |
function SoC = estimate_soc_VDBSE(I, V, battery_capacity, dt, ...
SoCtimewindow, moving_step, restarts, lookup, scale_factors, time, verbose)
% estimate_soc_VDBSE estimates the SoC value SoC(t) for each t
%
% INPUT:
% I: array of Current measurements
% V: array of Voltage measur... |
function [KeyOut,IndsOut] = permInds(inds,intN)
%intParts is a vector of the integer partitions that will be used to
%organize the list of indices "inds"
%inds and intParts should both be vectors
KeyOut=(10.^(intN-1:-1:0)*nchoosek(inds,intN)')';
IndsOut=nchoosek(inds,intN);
end
... |
function y = BinomialCoeffient(alpha, k)
% Computes the binomial coefficient
y = [];
% Check if the inputs are valid
if (alpha~=floor(alpha)) || (k~=floor(k)) || (alpha<0) || (k<0)
fprintf('alpha and k should be positive integer\n')
return
end
if alpha < k
fprintf('alpha should be greater or equal than k\... |
function filename = fn_savefile(varargin)
% function filename = fn_savefile(varargin)
%--
% synonyme de "filename = fn_getfile('SAVE',varargin)"
%
% See also fn_getfile
% Thomas Deneux
% Copyright 2003-2012
filename = fn_getfile('SAVE',varargin{:}); |
function [T, Tsumm] = noisypl(varargin)
%EXPERIMENT.NOISELESSPL Noiseless PhaseLift experiments.
ip = inputParser;
ip.addParameter('verbosity', 0);
ip.addParameter('iterations', 5000);
ip.addParameter('test', false)
ip.addParameter('parallel', false);
ip.addParameter('signal', 'dual');
ip.addParameter('mask', 'octanar... |
function [yd,ye] = decompose_envelope(y, Fs, nlevel)
N = 2; %filter order
ye = envelope(y,Fs);
if nargin == 2
nlevel = 5;
end
yed = downsample(ye,100);
Fs = Fs/100;
%{
1. 'Slow' AM tier
2. 'Stress' AM tier
3. 'Syllable' AM tier
4. 'Sub-beat' AM tier
5. 'Fast' AM tier
%}
Fcs = [0.5 0.8; 0.8 2.... |
function [A,B,Na_new,Nb_new,Nc_new]=Unimolecular_to_Bimolecular_Bs(A,B,Nc,Na,Pf)
r1=rand(Na,1);
dtemp=(r1<Pf);
n=sum(dtemp);
Dtemp=A(dtemp,:);
Btemp=zeros(n,3);
for i=1:n
Btemp(i,:)=Dtemp(i,:);
end
B=[B;Btemp];
A(dtemp,:)=[];
Na_new=size(A,1);
Nb_new=size(B,1);
Nc_new=Nc+n;
|
classdef bd < hop.hop
properties
b1
b2
fm
m1
m2
m
n1
n2
n
i1
i2
end % properties
methods
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function self = bd(b1,b2,isrealin,fm)
assert((b1.m1 == b2.m1) && (... |
clear;
home = pwd;
sim_time = 200;
script_file = mfilename('fullpath');
[filepath, name, ext] = fileparts(script_file);
cd(filepath);
Simulink.importExternalCTypes('../include/bus.h');
dt = 0.001/4;
test_mode = 0; % straight
test_mode = 1; % slalom
% test_mode = 2; % pivot
% test_mode = 3; % back_s... |
% Grid representation in operational space
%
% Author : Jonathan EDEN
% Created : 2015
% Description :
% This is a work in progress its point will be to take a starting point
% and give the next grid point to achieve a uniform spacing in the task
% space. TODO: CHANGE task space to op_space
clas... |
%{
This code generates a figure of the time series and power spectra data for the native full model (high molecule number).
%}
%plots
figure(1);
%ComK values vs Time
subplot(3,5,1);
plot(ak_varname_time_00008/3600,ak_varname_Kvals_00008/10^4,'b','LineWidth',1.5)
axis([0 200 0 4.6])
ax = gca;
title('a_k = ');
yla... |
%#!/usr/local/bin/octave -qf
pp = 12;
nnet = [
0 0 ones(1, pp-2);
1 0 ones(1, pp-2);
zeros(pp-2, pp);
];
fd = fopen('net_12_net2_2.txt','w');
nnet = int2str(int32(nnet));
for jj=1:pp
fprintf(fd, '%s\n', nnet(jj,:));
end
fclose(fd);
|
function [mergedFrame, mergedLabel] = myMergeFrame(temp_mm, temp_label, nFrame, use_skip, use_testset, use_semiSkip)
size_mm = size(temp_mm, 1);
indexPointer = 0;
mergedFrame = [];
mergedLabel = [];
skipFlag = 0;
for ii=1:(size_mm-nFrame+1)
if(use_skip)
if(skipFlag>0)
skipFlag = skipFl... |
function [ c ] = to_cell( mat )
c = cell(size(mat, 1), 1);
for i = 1:size(mat, 1)
c{i} = mat(i,:);
end
end
|
% +LOG4M
%
% Files
% Appender - Interface for performing output of log messages.
% AppenderAttachable - Interface for attaching Appenders to objects.
% AppenderAttachableImpl - Internal class to ether.log4m. Do not use.
% ConsoleAppender - Writes log messages to stdout or stderr.
% Le... |
function [ f ] = MakeModelFiltersMotionEnergy( p )
%% Truncate temporal vector to positive times
t = p.t;
t = t(t>=0);
f.t = t;
%% Define temporal filters
% Note that these filters have unit L2 norm
% Second order exponential lowpass and its derivative
f.lp = sqrt(p.dt) .* 2 .* (p.tauLp^(-3/2)) .* double(t>=0) .* t... |
%#author Tom Minka
%#url http://research.microsoft.com/en-us/um/people/minka/software/fastfit/ |
function[tag_x_array, tag_y_array, x_ccd, y_ccd, angulos, gamma, mediana, sigma] = filtro_angulos_inusuales(tag_x_array, tag_y_array, x_ccd, y_ccd, angulos, gamma, cant_sigmas)
% filtro = true(size(angulos));
mediana = median(angulos);
sigma = std(angulos);
umbral_superior = median... |
clc
clear
%% Image Source
im = imread('/Users/INNOCENTBOY/Documents/MATLAB/pic/4.2.04.tiff');
% im = imread('/Users/INNOCENTBOY/Desktop/Ritesh.png');
im = rgb2gray(im);
[M ,N] = size(im);
im_1= zeros(M,N);
im_2= zeros(M,N);
im_3= zeros(M,N);
im_4= zeros(M,N);
im_5= zeros(M,N);
im_6= zeros(M,N);
im_7= zeros(M,N);
im_8=... |
function maxfigwin(hFig)
% maximize figure window
if nargin==0
hFig=gcf;
end
if ~strcmpi(get(hFig,'WindowStyle'),'docked')
jFrame = get(handle(hFig),'JavaFrame');
drawnow
jFrame.setMaximized(true) % may throw uncatchable java exception
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.