text stringlengths 8 6.12M |
|---|
function [Uddy2]=ddy2(U,dy)
% computes the second partial derivative of the variable U wrt y
% y is the second index of the array
% dy is constant, uniform grid
% for 2D
% using higher order central difference formula
% need to improve on the y boundary
Uddy2=U; %to copy the array size
Uddy2(:,3:end-2)=(-... |
function [h,header]=readsr1(filename);
% READSR1 reads SR1 file
% [h]=READSR1(filename);
[fid,msg]=fopen(filename,'r');
if fid<0 error(msg); end;
header=fread(fid,256,'char');
h=fread(fid,inf,'float32');
fclose(fid);
|
%assignment3
clear all; close all; clc;
disp('assignment 3')
A = [10 21 13 6 2 4 9];
B = [8 7 2 3 5 3];
C = [11 12 4 8];
odd_matrix_A = odd_finder(A)
odd_matrix_B = odd_finder(B)
odd_matrix_C = odd_finder(C) |
function [ scale_axis ] = genCaxis( img, std_factor )
%GENCAXIS Summary of this function goes here
% Detailed explanation goes here
if nargin < 2
std_factor = 3;
end
img = single(img);
if norm(imag(img(:))) > 0
% complex => convert to magnitude image
img_avg = mean( abs(img(img~=0)) );
img_std = st... |
function [R_y] = RY(Y_angle)
%ROTATION ABOUT Y AXIS
R_y=[cos(Y_angle), 0, sin(Y_angle), 0;
0 , 1, 0, 0;
-sin(Y_angle), 0, cos(Y_angle) , 0;
0 , 0, 0 , 1];
end |
function [funv_array, xopt, resi_array, num_iter, cput] = alg_cgd( x0, data, model, opts )
% This function uses CGD to solve l1-regularized logistic regression
% problem. The decription of the algorithm can be found in our paper:
% M.-C. Yue, Z. Zhou, A. M.-C. So:
% "A Family of Inexact SQA Methods for Non-Sm... |
% Transfer align trajector simulation for the vc60 Demo_CAligntf example.
% See also test_align_transfer_imu_simu, test_align_transfer.
% Copyright(c) 2009-2021, by Gongmin Yan, All rights reserved.
% Northwestern Polytechnical University, Xi An, P.R.China
% 23/04/2021
glvs
ts = 0.01;
vel0 = 180;
avp0 = avpset([0;0;-3... |
classdef qCloudPlatform < handle
% Quantum Computing Cloud Platform backend
% http://quantumcomputer.ac.cn/index.html
% Copyright 2018 Yulin Wu, USTC
% mail4ywu@gmail.com/mail4ywu@icloud.com
properties(SetAccess = private)
status = 'OFFLINE' % 'OFFLINE','MAINTENANCE','ACTIVE','CALIBRATION'
... |
function [parents, local_start, local_end] = simple_forward_model( L, N, debug )
%[parents, local_start, local_end] = simple_forward_model( L, N, debug )
% Create the graph of a simple hmm forward model
% Input:
% L -- A vector containing the length of the individual sub-models
% N -- Option... |
function [Qt] = Qout(f,Q,time)
%Builds half wave rectified sinusoid modified for f,Q
l=linspace(0,time,time*1000);
sig=sin(2*pi*f*l);
for t=1:time*1000
if sin(2*pi*f*l(t))<=0
sig(t)=0;
else
sig(t) = sin(2*pi*f*l(t));
end
end
Qt = sig*Q;
end
|
clear all;
clc;
xdim=500;
time_tot=200;
xsource=250;
S=1;
epsilon0=1;
mu0=1;
c=1;
delta=1;
deltat=S*delta/c;
Ez=zeros(1,xdim);
Hy=zeros(1,xdim);
epsilon=epsilon0*ones(1,xdim);
epsilon(1,1:(xdim/2))=1.0;
epsilon(1,(xdim/2):xdim)=1.0;
mu=mu0*ones(1,xdim);
% gaussian=0;
sine=1;
impulse=0;
lamb... |
function [px,ri,rs]=acplot(ac,x,in,peakrange,int)
%ACPLOT Draw autocorrelation graph
% [ri,rs,px]=acplot(ac,x,in,peakrange)
% draws autocorrelation graph
% ac: autocorrelation info (see autoco)
% x: lag
% in: confidence interval
% peakrange: find peak btween peakrange(1) and peakrange(2)
% and compute rhythmicity inde... |
classdef SpikeNetwork % defining a class for Spike Neural Network (SNN)
properties
neural; % neuron layers
weights; % synapse layers
connections; % connection matrix
layers; % count of layers
time; ... |
function presetgui
addpath('/usr/share/tascar/matlab');
javaaddpath('netutil-1.0.0.jar');
p0 = get(0,'Screensize');
xr = 0.6;
yr = 0.6;
h = figure('NumberTitle','off','Menubar','none',...
'Name','Preset GUI',...
'Position',round([p0(3)*(1-xr),p0(4)*(1-yr),p0(3)*xr,p0(4)*yr]));
cLabels = {...
... |
function [] = kingsimulator()
global g_tave g_tstd g_vave g_vstd g_nc g_runs g_run init_nc end_nc fixed_tlc
global clockmax_queen realtime_simulation
g_runs = 50;
init_vel = .7;
end_vel = 1.5;
init_tlc = 3;
end_tlc = 5;
g_vave = zeros(1, g_runs);
g_vstd = zeros(1, g_r... |
%based on DDFT_nucleation13
%use isotropic_cutoff
addpath('../../CHACR/GIP')
runoptim = true;
L = [5,5];
N = [256,256];
n = prod(N);
params.N = N;
params.L = L;
params.dx = L./N;
[k2,k] = formk(N,L);
k0 = 10;
alpha = 5;
params.C = exp(-(sqrt(k2)-k0).^2/(2*alpha^2))*0.95;
if ~exist('t2','var')
tic;
[t1,y1,params... |
function [confusionMatrix, avgRec, avgPrec, avgMeas] = confusionMatrixForOptimalResultsClean(x, y, results)
k = 10;
[~,~, ~, ~, vs, ve] = crossValidationIndexes(k, x, y);
confusionMatrix = zeros(6, 6);
recalls = cell(k,6);
precisions = cell(k,6);
measures = cell(k,6);
... |
warning('off'); % matrices are rank deficient ...
% main regression
fg2010 = readtable('../data/FG2010.csv');
M = table2array( fg2010(:, {'playerID', 'period', 'cont', 'belief', 'predictedcontribution'}) );
% de-mean variables
for i = 3:5
K = mean(reshape(M(:, i), [10,140]), 1);
M(:, i) = M(:, i)-kron(K(:), on... |
close all;
clear all;
clc;
% параметры устройства
d = 0.0003; % диаметр отверстия
t = 100e-6; % толщина отверстия
h = 0.0007; % высота отверстия
format long
height = 4e-3;
width = 4e-3;
pxW = 752;
pxH = 752;
pxSize = width / pxW;
angle = deg2rad(0 : 359); % вспомога... |
%VX_bank_nothing.m
% ======= This program performs an FFT analysis and oscillator bank
% synthesis
clear;clf;
%-----------user data ------------
n1 = 200; % analysis step
n2 = n1; %synthesis step
s_win = 2048; %window size
[DAFx_in,FS] = audioread('la.wav');
%----------- initialize windows ,arrays, etc--------
w1 ... |
% read avi. videos
addpath(genpath(pwd));
v = VideoReader('fc2_save_2018-03-27-153236-0000.avi');
FrameRate = round(v.FrameRate);
Duration = floor(v.Duration);
FrameNum = FrameRate * Duration;
FrameSum = zeros(FrameNum,1);
for i=1:FrameNum
video = readFrame(v);
FrameSum(i)=sum(sum(sum(video)));
... |
% -----------------------------------------------------------------------
%
% Last revision: 9-July-2010
%
% Authors: Lester Mackey and David Weiss
% License: MIT License
%
% Copyright (c) 2010 Lester Mackey & David Weiss
%
% Permission is hereby granted, free of charge, to any person obtaining
% a cop... |
% sine800hzsamp.m: simulated sampling of the 800 Hz sine wave
f=800; time=0.007; Tu=1/80000; t=Tu:Tu:time; % freq and time vectors
w=sin(2*pi*f*t+0.3); % create sine wave w(t)
M=10; % take 1 in M samples
wk=w(1:M:end); ... |
function depl_aquirc(matl, mimg, mfold )
natl = 20;
nimg = 29;
nfld = 10;
% sge_id = str2num( sge_id );
% mfold = mod( sge_id, nfld );
% mimg = mod( (sge_id - mfold) / nfld, nimg );
% matl = (sge_id - mfold - nfld*mimg) / (nimg*nfld);
%
matl = str2num( matl);
mimg = str2num(mimg... |
function xx=TSP_sort(pts, concordePath)
% function xx=TSP_sort(pts, concordePath)
%
% Sort the points in pts (a d x n array of coordonates) using the concorde
% solver.
% concordePath is the path of the concorde folder. (default ./concorde/)
%
n=size(pts,2);
d=size(pts,1);
n_max=10000;
if n>n_max
xx=[TSP_sort(pt... |
% Find seperation distance for a set of different hues
% (Blue-white-red style)
clear;
% close all;
%% Parameters
% CIELab bwr: 296, 40
% UPLab bwr: 309, 54.75
% handpicked_hue1 = 309; %[]; % 290; % Blue
% handpicked_hue2 = 54.75; %[]; % 41; % Red
% hue1_range = 307:.25:312; %200:320; %260:315; %0:359; %260:315;
%... |
t = 0;
outerCorr = 0;
i_t = 1;
createInterfaceFields
fprintf('\nInitializing the flow solution for FLOW TIME = %f\n\n',t)
PanelMethod2D_v9_rev_wcs211
newPlotTimeStepFig
nodes(:,1) = (nodes_new(:,1) - nodes_new(1,1))*cos(atan(-2*pi*ramped(i_t)*h_c*c*f*cos(2*pi*f*t)/Qinf));
nodes(:,2) = ramped(i_t)*h_c*c*sin(2*pi*f*t) +... |
k=15;
x_k = funcX(k);
y_k = funcY(k);
% a.1
X = fft(x_k);
Y = fft(y_k);
% a.3
X_hat = replaceSmallest(X);
Y_hat = replaceSmallest(Y);
% a.4
x_k_hat_2 = ifft(X_hat);
y_k_hat_2 = ifft(Y_hat);
table_1_2 = [X.' abs(X).' X_hat.'];
table_2_2 = [Y.' abs(Y).' Y_hat.'];
table_3_2 = [x_k.' x_k_hat_2.'];
table_4_2 = [y_k.' y... |
function [h2, centerbins, freq] = plot_loglog(x, varargin)
linespec = 'o';
step = 1;
xmin = min(x);
xmax = max(x);
show = true;
while ~isempty(varargin)
switch lower(varargin{1})
case 'linespec'
linespec = varargin{2};
case 'step'
step = varargin{2};
cas... |
%Basic code reference
% https://www.mathworks.com/matlabcentral/fileexchange/64725-thresholdsegmentationbot
classdef ImageSegmentation < handle
properties
threshold_low,
threshold_upper
Img
ImageSettingControl
img_axis
watershed_segmentation_img
... |
function [pntsMap] = world_to_map_coordinates(pntsWorld, gridSize, offset)
% Convert points from the world coordinates frame to the map frame.
% pntsWorld is a matrix of N points with each column representing a point in world coordinates (meters).
% gridSize is the size of each grid in meters.
% offset = [offsetX; offs... |
function [E,P]=EF_initialize(X,labels,parameters)
% Inputs:
% X - Inputdata, reshaped hyperspectral image treats each pixel as column vector, d by N
% parameters - struct - parameter structure which can be set using the EF_parameters() function
% labels - binary the same size as input data, indicates posi... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Experiment: Leave-out-out cross-validation for a given A and E
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function gridSearchAandE(datasetNum, voxNum)
%% Dataset
dataset = ['dataset', num2str(datasetNum, '%... |
% Example state matrix: A global timer triggers passage through two infinite loops. It is
% triggered in the first state, but begins measuring its 3-second Duration
% after a 1.5s onset delay. During the onset delay, an infinite loop
% toggles two port LEDs (Port1, Port3) at low intensity. When the timer begins measur... |
clear all; close all; clc
matriz = importdata('dados_grupo1.txt');
vazao = matriz.data;
temp = datetime(matriz.rowheaders);
%--------Média Semanal---------%
%Considerando o ciclo contendo 7 dias;
%Desconsiderano o resto da divisão por 7, por exemplo, se temos 37
%dias, consideramos 5 semanas e desconsideram... |
%% Trajectory
% This scripts generates the interpolated data for the reference trajectory
close all; clc; clear all;
load('exportWP')
for i = 0:length(exportWP)-1
WP(i+1,:) = exportWP(length(exportWP)-i).Position;
end
for i = 1:length(exportWP)-1
distWP(i) = sqrt((WP(i+1,1)-WP(i,1))^2+(WP(i+1,2)-WP(i,2))^2);... |
function [B] = web_surfer(A,p)
n=max(size(A));
B=p*A+((1-p)/n)*ones(n,n);
return |
function Manager_applyLabelChanges(source,~)
h = guidata(source);
gui = h.gui;
data = gui.allData;
inds = gui.allPopulated;
mpre=0; spre='';
for i = 1:size(inds,1)
m = inds(i,1);
if(m~=mpre)
disp(' ');
disp(['Mouse ' num2str(m)]);
mpre = m;
end
sess = ['session' ... |
function lambdaValue = lambdaFunctionBusiness(t)
% ============================================================================
% DESCRIPTION
%
% usage: lambdaValue = lambdaFunction(t)
%
% Function describing Business segment arrival rate of the Nonhomogeneous
% Poisson Process over time.
%
% -------------------------... |
%% Preprocess lengths notes
load in_tune_lengths.mat;
%%
all_res = zeros(length(lengths_list), 5, 3);
R = 3e-2;
for i = 1:length(lengths_list)
l = lengths_list(i);
fprintf("Processing l = %f (%i / %i) \n", l, i, length(lengths_list));
all_res(i,:,:) = init_resonator_fun(l, R);
end
%%
save("all_res.mat"... |
function [ price_list , name_list ] = extract_values_from_file( file )
%set limit for tranversing the file
limit_a = 50;
prices_array = [];
name_array = [];
fid = fopen( file , 'r' );
if isequal( fid , -1 )
prices_array = 0;
name_array = 0;
else
tline = fgetl( ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% COMS W4733 Computational Aspects of Robotics Fall 2014
%
% Homework 2
%
% Team Number: 4
% Team Leader: Luis Tolosa (let2120)
% Team Members: Emily Pries (ep2642)
% Ernesto Sandoval Castillo (es3187)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
% Calculate minimal parameter regressor of potential energy for
% %RN%
% Use Code from Maple symbolic Code Generation
%
% Input:
% %INPUT_QJ%
% g [3x1]
% gravitation vector in mdh base frame [m/s^2]
% %INPUT_PKIN%
%
% Output:
% U_reg [1x%NMPVFIXB%]
% minimal parameter regressor of Potential energy
% %VERSIONINFO... |
%function takes X data quantised to 0.125 steps in the range [-1 to 0.875]
%and and produces two outputs. one of the inputs converted into
% ***** NOTE NOT 2s complement binary *** sign magnitude binary with a shift
% so -8 = 1111 and -1 = 1000
% the other splits each of the bits of these binary
%inputs and converts t... |
Read_Display_Data
load(matFile)
N = 8;
labeltsize=35;
fw = 'normal'; %%是否加粗斜体之类
fn='Times New Roman';
linewide1=3;
mkft = 15;
% Range = 17;
[row,col] = size(sig);
if col>row
sig = sig.';
end
[M,L] = size(sig);
figure()
imagesc(abs(sig))
xlabel('Range Cell')
ylabel('Pulse Number ')
set(gca,'FontSize',labeltsize,'F... |
% Malina K. Iwanski (Hendricks Lab, McGill University) 29 May 2019
% with Adam G. Hendricks (transient MSD over sliding window 10 April 2019)
% function to find local alpha-values using a rolling MSD over a window;
% assigns alpha value to middle point in window (except at end points the first and last calculated alph... |
% fig 3 of Zou and Hastie JRSSB 2005
clear; close all; clc;
load('prostate.mat');
ndx = find(istrain);
y = y(ndx); X = X(ndx,:);
%X = diabetes.x2;
X = normalize(X);
%y = diabetes.y;
y = center(y);
[n p] = size(X);
lambda2 = 1000;
b1 = larsen(X, y, lambda2, 0, 1);
t1 = sum(abs(b1),2)/max(sum(abs(b1),... |
function [peakDeg,peakStd] = phase_kernel_density(signal,plotIt)
% expects time x channels
numChans = size(signal,2);
peakDeg = nan(1,numChans);
peakStd = nan(1,numChans);
for i = 1:numChans
if sum(~isnan(signal(:,i)))
[peakDensity,xi] = ksdensity(rad2deg(signal(:,i)));
[maxDensity,peakIndex,p... |
function pred = predict(Theta1, Theta2, X)
%PREDICT Predict the label of an input given a trained neural network
% p = PREDICT(Theta1, Theta2, X) outputs the predicted label of X given the
% trained weights of a neural network (Theta1, Theta2)
% Useful values
m = size(X, 1);
num_labels = size(Theta2, 1);
% You ne... |
function fitAllSTRFs(runName, isNancy, fitType, dts)
% fitAllSTRFs(runName, isNancy, fitType, dts)
%
% n.b. make sure to add path to mASD and cbrewer
%
if nargin < 4
dts = {};
end
if isNancy
mnkNm = 'nancy';
else
mnkNm = 'pat';
end
if isempty(dts)
stimdir = '..'... |
function [features,labels] = prepare_features_for_class_app(training,str)
%PREPARE_FEATURES_FOR_CLASS_APP Summary of this function goes here
% Detailed explanation goes here
if strcmp(str,'temporal')
features = change_structure_period(training.features.temporal);
elseif strcmp(str,'spectral')
features = ch... |
function g = ReLUGradient(a)
g = zeros(size(a));
g(a > 0) = 1;
end
|
function R = resultingRow(row, col, imageSize)
R = zeros(1,imageSize(1)*imageSize(2));
flag = isOutOfBound(row, col, imageSize);
if(flag)
return
else
a = row - floor(row);
b = col - floor(col);
floorRow = floor(row);
floorCol = floor(col);
ce... |
function J = computeCost(X, y, theta)
% Initialize some useful values
m = length(y); % number of training examples
J = 0;
%Compute the cost of a particular choice of theta
J = sum((X * theta - y) .^ 2) / (2*m);
end
|
function IM = myimreconstruct(Marker,Mask)
%%% Réalise une reconstruction par ouverture
B = ones(3,3);
h1 = Marker;
h2 = imdilate(h1,B) & Mask;
while isequal(h1,h2) == 0,
h1 = h2;
h2 = imdilate(h1,B)& Mask;
end
IM = h2;
end
|
% mdscale_robust
% available at https://github.com/jooh/matlab-plotting/blob/master/mdscale_robust.m
% an adjusted version of mdscale which circumvents Matlab's thresholds for colocation
% call mdscale as usual, but handle ColocatedPoints error by adding fake
% dissimilarities to data, and NoSolution error by multi... |
function showpupiltrial(p,trialnum)
% given a pupil data structure and a trial number
% graphs an overlay plot of the trial
if trialnum>0
plotmanipulator([p.NormedPupTrials(trialnum,:); 0.05.*min(20,p.EventTrials(trialnum,1:size(p.TrialSeconds,2)))]',p.TrialSeconds);
else
plotmanipulator([p.NormedPupTrials; ... |
function null_interSb_reproMap = generateNullRepro (obj, numIter)
totalTrials = size (obj.result.trialTab, 1);
subNum = obj.setup.subNum;
null_interSb_reproMap = zeros (subNum*(subNum-1)/2, numIter);
%null_compRepro = zeros (100,1);
pos = zeros (totalTrials, 1);
fprintf ('------------------------------------\n');
fpr... |
function [s, flag] = setupSerial(comPort)
% Initialize the serial port communication between Arduino and MATLAB
% We ensure that the arduino is also communicating with MATLAB at this
% time. A predefined code on the Arduino acknowledges this.
% If setup is complete then value of setup is returned as 1 else 0
flag ... |
function [prediction,DV]=dv2gridpred(data,clsfr,grid_markers_idx,grid_markers,copyspell_letters,copyspell_target_idx,GRID_LETTERS)
sliced_data=[];target_markers=[];prediction=[];DV=[];
for i=1:numel(copyspell_letters)
target_markers_idx=find(grid_markers_idx>copyspell_target_idx(i) & grid_markers_idx<copys... |
function R=rand(pD,nData)
%R=rand(pD,nData) returns random scalars drawn from given Discrete Distribution.
%
%Input:
%pD= DiscreteD object
%nData= scalar defining number of wanted random data elements
%
%Result:
%R= row vector with integer random data drawn from the DiscreteD object pD
% (size(R)= [1, nData]
%
%--... |
clear;
%{
Params = SETUP;
Params = OVERWRITE(Params, 'Benchmark');
Params = COMMON(Params);
VfiSs0Result = VFI(Params);
SimulateSs0Result = SIMULATE(VfiSs0Result, Params);
AggregateSs0Result = AGGREGATE(SimulateSs0Result, Params);
%{
Params = SETUP;
Params = OVERWRITE(Params, 'Benchmark', 'Exhc');
Params.ControlSpec ... |
%% Choice of over-approximation methods, submethods and definition of their internal parameters
% All variables defined here are stored in the structure 'parameter', which
% is partially read in the relevant functions.
% The user can modify any of the variables defined in this file:
% - either to ask for a specific ov... |
function FlySongSegmenterWAV(wav_file,channel_num,song_range,params_path)
%Perform FlySongSegmenter on multiple wav files in a folder
%e.g. FlySongSegmenterWAV('/misc/public/Troy/',3,[1 1000000],'./params.m');
%processes the first million tics
%
[poolavail,isOpen] = check_open_pool;
fprintf(['Reading daq file header... |
dirs = dir('G:\RGB-T_unfit_dataset');
file_num = 108;
for i = 112:size(dirs)
if ~exist(['G:\data\' num2str(file_num)],'dir')
mkdir(['G:\data\' num2str(file_num)]);
end
try
current_dir = dirs(i).name;
rgb_v=VideoReader(['G:\RGB-T_unfit_dataset\' current_di... |
function [ T ] = chebychev_silhouette( f, width, height, p, q )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
% disp ('p = ')
% disp (p)
% disp(' q = ')
% disp(q)
%
% disp( 'w =' )
% disp (width)
% disp( 'h=')
% disp (height)
% conversion du type uint8 vers le type doubl... |
%% comparison of SOS formulation and not using SOS formulation
clear
clc
options = optimoptions('fmincon','Display','iter','Algorithm','interior-point');
% options = optimoptions('fmincon','Display','iter','Algorithm','SQP');
obj = @(x)-x(1);
%% quadratic testing
% load the matrix
% load('data/A.mat');
% load('data... |
function x = LU_solve(A, b)%A - матрица, b - вектор
[L, U] = LU(A);
s = size(A);
r = s(1);
x = zeros(1,r);
y = zeros(1,r);
y(1) = b(1);
%решение Ly = b
for i = 2:r
y(i) = b(i);
for j =1:i-1
y(i) = y(i) - L(i,j)*y(j);
end
end
%решение Ux = y
x(r) = y(r)/U(r,r);
for i = r-1:-1:1
x(i) = y(i);
f... |
%buildBiDirectionalRRT.m
%author: wreid
%date: 20150107
function [T1,T2,pathJ,pathC] = buildBiDirectionalRRT(nInit,nGoal,NUM_NODES,jointLimits,cartesianLimits,panHeight,HGAINS,NODE_SIZE,U,U_SIZE,dt,Dt,kC,ankleThreshold,exhaustive,threshold,goalSeedFreq,uBDot,legNum,TP2B)
%buildRRT Icrementally builds a rapidly explori... |
function result = Rot(axis, angle)
switch axis
case 'X'
result = [ 1, 0, 0, 0;
0, cos(angle), -sin(angle),0;
0, sin(angle), cos(angle), 0;
0, 0, 0, 1;
];
case 'Y'
result = [ cos(angle), 0, sin(angle), 0;
... |
%UX_fomove_cepstrum.m
%===== This function performs a formant warping with cepstrum
clear;clf;
%------- user data -------
[DAFX_in,SR] = audioread('la.wav');
n1 = 512;
n2 = n1;
s_win = 2048;
order = 50;
r = 0.99;
%-------- initializations ------
w1 = hanning(s_win,'periodic');
w2 = w1;
hs_win = s_win/2;
L = length(DA... |
% TODO
% normalize the eigenfunction caxis([0 1])
function plotthething3holes(filename,xx,yy,Z,outer,inner,inner2,inner3,fignr,xticksvec,yticksvec)
terrain = [0 166 0
22 174 0
45 182 0
71 190 0
99 198 0
128 206 0
160 214 0
194 222 0
230 230 0
2... |
function eq=find_equilibrium_a_log(productivities, param)
%%% denotes my comments
options_fsolve=optimset('TolFun', 1e-5, 'Display','off','MaxFunEvals', 1000); % Option to display output
par_init = log([1, 1]);
[xopt,fval,exitflag]=fsolve(@(x) market_conditions_s(x,productivities,param), par_init, options_fsolv... |
% write face and pupil to binary file
function [fileframes, avgframe, avgmotion] = WriteBinFile(handles)
sc = handles.sc;
tsc = handles.tsc;
nX = handles.nX;
nY = handles.nY;
nXc = sc * floor(nX/sc);
nYc = sc * floor(nY/sc);
ispupil = handles.whichROIs(1);
if ispupil
fidp = fopen(handle... |
function [modelStructTrc, modelStructImu] = makeModel_mergeModel(overallModelStruct)
% copy out the link offsets for kinematic transform
kinT = {};
for i = 1:length(overallModelStruct)
for j = 1:length(overallModelStruct(1).kinematicTransform)
kinT{j}{i} = overallModelStruct(i).kinemati... |
function [enc,pix1] = encrypt_dwt(mat,pix,per)
pix = ceil(abs(pix));
if(pix <= 0)
pix = 0;
end
pix = pix+1;
% mat = bitxor(mat,pix);
mat(1,1) =bitxor(pix,mat(1,1));
[LL ,LH, HL, HH] = dwt2(mat,'haar');
% kk = LL-floor(LL+0.2);
% ll = floor(LL+0.2);
val=mod(per*pix,1);
[xsin,xlog] = chaotic_map(val,LL);
xsin = 1... |
function [theta, sterr, u_hat, non_par_u_hat, u_hat_conditional_w1w2] = nested_AppLoglikelihood_APS3A(y, x1, x2, z1, z2, us, theta0, random_seed)
Options = optimset('TolX', 1e-8, 'TolFun', 1e-8, 'MaxIter', 20000, 'MaxFunEvals', 6 * 20000, 'Display', 'Off');
[theta, logMLE, grad, hessian] = fminunc(@AppLoglikeli... |
% function [nx1, ny1, charge_p, charge_n, bg_charge, phi, Vp, Vn, xmax, ymax, qD, cpsp, scatGaAs, scatGaAs_hole, Gm, p_icpg, n_icpg, left_pts, right_pts, valley, particles] = init_core()
function [nx1, ny1] = init_core()
%UNTITLED 此处显示有关此函数的摘要
% 此处显示详细说明
%include hole
dope_type=1;
cdop=1e23;
hd=3;%highly doped mear ... |
classdef Shaft
%SHAFT This class implements some geometrical concepts and parameters
% for cylindrical shafts.
%
% References:
% [1] Budynas, R., Nisbett, J. (2015). Shigley's Mechanical
% Engineering Design. 10th ed. New York: McGraw-Hill
% [2] Neto M. A., Amaro A., Roseiro L., Cirne J., ... |
% Converting a (nx X ny) matrix to a column vector
% Counting by rows from the top
function V=MtoV(M,nx,ny)
k=1;
V=zeros(nx*ny,1);
for i=1:nx
for j=1:ny
V(k,1)=M(i,j);
k=k+1;
end
end
end |
function [ hfig ] = plot_px_rho_R( self )
%PLOT_DELTA_S 画delta~S的图
% ---------------------
% 吴云峰,20160130
% 吴云峰,20160316,基于copy的数据做研究
%% 预处理
% TODO: 相关预处理
% 将旧的变量进行保存
copy = self.getCopy();
[ L1, L2 ] = size( copy.optPricers );
%% 画图
r = 0.005:0.005:0.095;
for j = 1:L1
for i = 1:L2
copy.optPricers( j... |
clear all; clc; close all;
%% For problem 3 we convert RGB to YCgCo
%% Read the image
img = imread('flowers.bmp');
%% Color space conversion algorithm
Y = double(0.25*img(:,:,1)+0.5*img(:,:,2)+0.25*img(:,:,3)); % Y Component
Cg = double(-0.25*img(:,:,1)+0.5*img(:,:,2)-0.25*img(:,:,3)); % Cg component
Co = double(0.... |
acer=0;
%%
if acer==0
addpath('/home/raleman/Documents/MATLAB/analysis-tools-master'); %Open Ephys data loader.
addpath('/home/raleman/Documents/GitHub/CorticoHippocampal')
addpath('/home/raleman/Documents/internship')
else
addpath('D:\internship\analysis-tools-master'); %Open Ephys data loader.
addpath('C:\Users\Wel... |
clear;
% Точное решение системы.
function q= fi(x)
q=119/296-exp(6*x)+1/24*(52*x.^3+114*x.^2-30*x+39)-6*sin(x)/37-cos(x)/37;
end
% Правая часть дифференциального уравнения.
function y=g(t, x)
y=6*x-13*t^3-22*t^2+17*t-11+sin(t);
end
function test()
% Определение параметров управления ходом решения уравнения.
% RelTo... |
%% Load the data
[time,ssh,loc] = saveRange;
%% Put all times in one array
timeT = cellfun(@(x) x', time,'UniformOutput',0);
allTime = [timeT{:}];
%% Look at the distribution
[nums,edges] = histcounts(allTime,75);
% Find highest density
[val,ind] = max(nums);
edg1 = edges(ind);
edg2 = edges(ind + 1);
%% Plot the Da... |
classdef TRIAL_TYPE_DEF
properties (Constant)
CORRECT = 'c'; % correct
ERROR = 'e'; % error
FIXBREAK = 'b'; % fix break
ABORT = 'a'; % abort
UNKNOWN = 'x'; % abnormal
end
methods ( Access = private )
function obj = TRIAL_TYPE_DEF()
end
end
end |
dataSet = [];
for i=1:29
str = ['images/rgb_' num2str(i) '.jpg'];
im = imread(str);
dataSet = [dataSet;invariant_desc(rgb2gray(im))];
end
t = linkage(dataSet,'single');
dendrogram(t); |
% Copyright is with the following author(s):
%
% (c) 2012 Juraj Oravec, Slovak University of Technology in Bratislava,
% juraj.oravec@stuba.sk
% (c) 2012 Monika Bakosova, Slovak University of Technology in Bratislava,
% monika.bakosova@stuba.sk
% ------------------------------------------------------------------------... |
addpath('evaluation');
%load('relationship_det_result.mat', 'rlp_labels_ours', ...
% 'rlp_confs_ours', 'sub_bboxes_ours', 'obj_bboxes_ours');
%{
load('union_epoch_150_vgg_relationship_det_result.mat', 'rlp_labels_ours', ...
'rlp_confs_ours', 'sub_bboxes_ours', 'obj_bboxes_ours');
%}
load('test_rel_preds_1_2_3_4_... |
function quads = stateInit()
quads.ax(1) = 0;
quads.ay(1) = 0;
quads.az(1) = 0;
quads.vx(1) = 0;
quads.vy(1) = 0;
quads.vz(1) = 0;
quads.px(1) = 0;
quads.py(1) = 0;
quads.pz(1) = 0;
quads.R = zeros(3,3,1);
quads.R(:,:,1) = eye(3);
quads.omega = zeros(3,1);
end |
fid = fopen('1GTO.rc');
%fid = fopen('withheader-1GTO.grid');
isovalue = 0.1;
gridsize= fscanf(fid, '%d',1);
rawdata = fscanf(fid, '%f');
fclose(fid);
rawindex = 1;
volumedata = zeros(gridsize, gridsize, gridsize);
for x=1:gridsize
for y=1:gridsize
for z=1:gridsize
volumedata(x,y,z) = rawdata(... |
%Prob. 2(c)
n = 0:49;
x1 = 0.9.^n;
x2 = 1 - 0.8.^n;
[X1,X2] = tworealDFTs(x1,x2);
X1_dft = fft(x1);
X2_dft = fft(x2);
dX1 = X1 - X1_dft;
dX2 = X2 - X2_dft;
figure
stem(n, abs(X1))
title('X1')
xlabel('k')
ylabel('|X1|')
figure
stem(n, abs(X2))
title('X2')
xlabel('k')
ylabel('|X2|')
figure
stem(n, abs(dX1))
title('di... |
function pic=DHfk_Robot1_JC(th1,th2,th3,th4,fcla)
global Link
Build_Robot1_JC;
radius = 10;
len = 20;
joint_col = 0;
Link(2).th= Link(2).th+th1*pi/180;
Link(3).th=Link(3).th+th2*pi/180;
Link(4).th=Link(4).th+th3*pi/180;
Link(5).th=Link(5).th+th4*pi/180;
for i=1:5
Matrix_DH_Ln(i);
end
for i=2:5
Lin... |
%% ベクトル場の可視化
% 参考:https://www.math.kyoto-u.ac.jp/~karel/files/notes_biseki2matlab_2018.pdf
%
%
% $$\frac{\mathrm{dx}}{\mathrm{dt}}=x\left(1-x\right)$$
% 微分方程式を定義
f = @(t,x) x.*(1-x); % ソルバーで解く為には引数を(t,x0,x1...)の順にする必要がある
fsurf(f, [0,2,0,10]);
view([113.8 37.2]);
% 格子点の定義
t = 0:0.25:10;
x = 0:0.25:2;
[T,X] = mesh... |
W_parameters = '';
for k=1:7
filename =sprintf('%s%d%s','D:\Neethu\Projects\R2\WinParameters\Window', k, '.dat');
delimiter = ' ';
%% Read columns of data as text:
% For more information, see the TEXTSCAN documentation.
formatSpec = '%s%[^\n\r]';
... |
function [smartInfo]=readAllSmarticlesPos(filename,varargin)
% function [smartPos simParams frameInfo]=readAllSmarticlesPos(filename,varargin)
% filename='D:\SimResults\Chrono\SmarticleU\tests\PostProcess\Stress.txt';
%read in all data
% path = 'D:\SimResults\Chrono\SmarticleU\tests\BoxAngChangeTorPct30v2\';
% a=dir(... |
function [Xr,outs] = ...
MatrixIRLS(prob,lambda,opts)
% Given partial observations of a matrix, attempts to find a low-rank completion.
%
% Implements the algorithm Matrix Iteratively Reweighted Least Squares
% (MatrixIRLS) for optimizing a smoothed log-det/Schatten-p objective with
% updated smoothing, as describe... |
function trackOutlineForPressure
[vecfilenames,pathname] = uigetfile('*.vec','Choose vector files', ...
'MultiSelect','on');
if isempty(pathname)
return;
end
vectok = regexp(vecfilenames, '(.*)(\d{6}).T\d+.D\d+.P(\d+).H\d+.L.vec', 'once','tokens');
vecnum = zeros(size(vecfilenames));
Pnum = NaN(size(vecfilen... |
clear;clc;close all;
sift_path='.\test images\';
sift_path_list = dir(strcat(sift_path,'*.dsift'));
sift_num = length(sift_path_list);
img_code_path='.\';
%% vlad匹配
for i = 1:sift_num
sift_name = sift_path_list(i).name;
indlas=strfind(sift_name,'.');
sift_head_name=sift_nam... |
function y=bruitage(x,RSB)
b = randn(size(x));
alpha=10^(0.5*log10((x*x')/(b*b'))-0.05*RSB);
bruit=alpha*b;
y = bruit;
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.