text stringlengths 8 6.12M |
|---|
function [ i] = rotate( img )
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
[h theta rho]=hough(img);
p=houghpeaks(h,1);
line=houghlines(img,theta,rho,p);
line.theta
if (abs(line.theta)>90)
i=imrotate(img,abs(line.theta)-90,'crop');
figure(3),imshow(i);
else
i=imrotate(img... |
clear all;tic
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This RF-CIW-ELM code achieves the following:
%-if M = 1600, an error rate on MNIST of about 98.3% correct on test data in about 30 seconds (on a four core computer using multithreading)
%-if M = ... |
function [F, M, trpy, drpy] = controller(qd, t, qn, params)
% CONTROLLER quadrotor controller
% The current states are:
% qd{qn}.pos, qd{qn}.vel, qd{qn}.euler = [roll;pitch;yaw], qd{qn}.omega
% The desired states are:
% qd{qn}.pos_des, qd{qn}.vel_des, qd{qn}.acc_des, qd{qn}.yaw_des, qd{qn}.yawdot_des
% Using these curr... |
%% Initialization
close all
clear
bool_discrete_time = 0;
% Folder containing the various over-approximation methods
addpath('../OA_methods')
% Folder containing useful tools and functions
addpath('../Utilities')
%% Choice of the example system
global system_choice
% system_choice = 1; % Unicycle
% system_... |
function [neuralNetInput, chosenFrequencies, indexesChosenFrequencies] = generateInput(rawInput, frequencyDivisions, corrFigHandle, greenFrequencies, greenValues, frequencyVector)
f = frequencyVector;
if isempty(frequencyDivisions)
set(corrFigHandle, 'Visible', 'on');
set(0, 'currentfigure', corrFigHandl... |
% Creates the frame structure
for sess = 1:params.n_sessions
indx = data.session == sess;
% Initialize
firsts = zeros(1,params.n_trials_session);
firsts(1) = 1;
firsts(end) = 1;
lengths = params.block_max + 1;
% Loop until criteria are met
while (any(lengths > params.bl... |
function taovalue = tao( ticks0 , yields )
% 与r不同,tao一次计算ticks0一整天的下单成交时间,方便计算,灵活性差
% @luhuaibao
% 2014.5.29
% tao:
% time-after-order, 下单后潜在等待时间;
% tao.labels, 数据矩阵标签
% tao.values, 数据矩阵
% tao为给定下单方式下,后验看,成交需等待时间
% inputs:
% ticks0,为AnaTicks类,取出其ticks用以计算
% yields, 下限价单时,让利的大小
if ~exist... |
% This script provides an application example
% of the PAWN sensitivity analysis approach (Pianosi and Wagener, 2015)
%
% MODEL AND STUDY AREA
%
% The model under study is the rainfall-runoff model Hymod
% (see help of function hymod_sim.m for more details)
% applied to the Leaf catchment in Mississipi, USA
% (see hea... |
%Sa se reprezinte in acelasi grafic functiile sin si cos pe intervalul[0,4]
x = linspace(0, 4*pi, 200)
y = sin(x);
z = cos(x);
plot(x,y,'b-',x,z,'r-'); |
function concatTiles(dir_in, dir_out, trans_ch)
%concatTile concatenates all image files generated from Nikon Element's
%Scan Large Image module into image files containing only a single image
%channel
% input :
% dir_in : String variable that points to the directory containing
% the images to concatenate... |
% Calculate a path from qStart to xGoal
% input: qStart -> 1x4 joint vector describing starting configuration of
% arm
% xGoal -> 3x1 position describing desired position of end effector
% sphereCenter -> 3x1 position of center of spherical obstacle
% sphereRadius -> radius of obs... |
%Andrew Dhawan
%9th April 2017
%Code for logistic growth of cells following radiotherapy
function dy=dLogistic(t,y,rho)
K = 10^6; % this is the max carrying capacity for the logistic growth
dy = rho * y * (1 - (y / K) ) ;
end
|
function [blkDiagComponents] = block_diagonal(matrix, nTxs, nSubbands)
% Function:
% - decompose matrix into block-diagonal components
%
% Input:
% - matrix [(nTxs * nSubbands) * (nTxs * nSubbands)]: target square matrix
% - nTxs (M): number of transmit antennas
% - nSubbands (N): nu... |
function savefile(filename,) |
% exercise 2 : stability of systems
addpath('/Users/olivier/M/Cours/MSCV/M1TS/0TP/TP1_SignalSysteme');
N=10;
%Q1
f=step(4,N); % example of signal
F = prim(f);
figure(10), plot(1:N, f, 'b*-', 1:N, F, 'r*-');
title('primite of the step function');
% the primitive operator as a system is unstable:
% the ouput increase... |
function sigma = generate2D_CS_scheme(N,ratio,opts)
%
% function sigma = generate2D_CS_scheme(N,ratio,opts)
%
% Creates a 2D sampling scheme of size N:
%
% Input: - N: a 1 x 2 vector of positive integers (size of acquisition
% matrix)
% - ratio : ratio of measured coefficients
% - opts .type : sampling st... |
% Saliency detection Demo
% [HISTORY]
% Nov 23, 2011 : created by Hae Jong Seo
% close all;
clear all;
clc;
% parameters for local self-resemblance
param.P = 3; % LARK window size
param.alpha = 0.42; % LARK sensitivity parameter
param.h = 0.2; % smoothing parameter for LARK
param.L = 7; % # of LARK in the feature ma... |
% 2013.11.25 constructed by Hwang, Hsin-Te:
% 2013.11.25 modified by Hwang, Hsin-Te
% Computing contexture and dynamic features
function output_sequence=dynamic_contexture_feature_ver1(static_feature_seq,dynamic_flag,contexture_flag)
% static_feature_seq: static feature sequence
% dynamic_flag: 1=>delta, 2=> delta^2
... |
function [r,ptr,sep,rk,rw]=de_runs_1sep(biny,lenr,cbook,ptr)
flg=biny(ptr); ptr=ptr+1;
if flg<0.5 %length(z)>600
[thd,ptr]=decode_stationary_source_lenr(biny,cbook,1,ptr); %thd
%decoding sep --------------------------------------------------------
lastBit=biny(ptr); ptr=ptr+1;
[codebook,ptr] = deSFcode... |
clc;
clear all;
Img=imread('D:\STUDY\DIP\img_lib\cameraman.bmp');
subplot(2,3,1);
imshow(Img);
title('Original Image');
[x,y] = size(Img);
R = 2;
Z = uint8(zeros(R*x,R*y));
% Zero interlacing
for x = 1:256
for y = 1:256
Z(R*x,R*y) = Img(x,y);
end
end
% Replication
M = [1 1;1 1];
REP_Img = uint8(conv2(Z... |
function [ f ] = EvaluateHorizontalOrthogonalFunc( obj, N1, td, r, s )
td1 = mod( td - 1, obj.Nph ) + 1;
[ f ] = tri_orthogonal_func( N1, td1, r, s );
end
function [ fval ] = tri_orthogonal_func( N, td, r, s )
%ORTHOGONAL_FUNC Get the values of the orthgonal basis
% Get the i-th orthgonal function value at the coo... |
function MI = MIbins(grandMetrics, grandIX)
Nlist = [16,32,64,128,256,512,1024,2048,4096];
for Nn = 1:length(Nlist)
nBins = Nlist(Nn);
MI(Nn,:) = measureMI(grandMetrics, grandIX, nBins);
end
image(MI','CDataMapping','scaled'); |
function[grouping, angles] = groupLetters(image, strokeWidthImg, components, compInfo)
% This function performs grouping of components to identify text on a single line
%
% Usage:
% groupedComponents = groupLetters(image, strokeWidthImg, components)
%
% Input:
% image - RGB image for which s... |
function anchors = getAnchors(modelName)
% getAnchors function returns the anchors used in the training of the
% specified pretrained YOLO v4 model.
% Copyright 2021 The MathWorks, Inc.
if isequal(modelName, 'YOLOv4-coco')
anchors.anchorBoxes = [16 12; 36 19; 28 40;...
75 36; 55 76; 146 7... |
function optimise_flip_angles_for_T1_fat(MRI_dir, Scan_IDs, T10_Seq_filename, flip_angle_optimisation_type, Fat_ROIs_Struct, varargin)
% Check we have correct number of input arguments
if nargin < 5
disp(sprintf('Usage: %s(MRI_dir, Scan_IDs, T10_Seq_filename, flip_angle_optimisation_type, Fat_ROIs_Struct);', mfilena... |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 这个函数的作用在于将日期按频率切片。fre可供选项有1日;2周;3月;4季度;5半年;6年。sty
% 可供选项1自然日;2交易日。返回日期是否属于切片后区间起始日期的逻辑数组。
% 输入参数: Day(vector||date),日期序列
% fre(int),步长,可供选项:1-日;2-周;3-月;4-季;5-半年;6-年。
% sty (int), 日期类型,可供选项:,1-自然日;2-交易日。
% 输出参数: output,起始... |
function myPlot()
close all; %to close all plots
clear all;
clc;
%deviding
% Time interval from -2 to 2 with 0.1 as extreem point excluded
t_0 = -2:0.01:-0.11;
t0 = -0.09:0.01:2;
my_Plot = figure;
hold on;
%set window name
set(my_Plot,'name','Analytical Solution','numbertitle','off');
% p() is the analytical sol... |
function [DFA_mean DFA_std DFA_sem DFA_list] = util_get_fractal_DFA( spif, gnds, varargin )
%UTIL_GET_FRACTAL_DIM Get the fractal hurst exponent of the array.
% For details, see also estimate_hurst_exponent
% Input:
% spif: Spike information structure
% gnds: Grouding electrodes... |
function [wji, wkj, rss] = backpropagation_number(wji,wkj,data_x,data_t)
% data_x: input, column vectors
% data_t: target
n = size(data_x,2); % data_x: 2 by 4 --> n = 4;
eta = 1;
z_set = [];
for p=1:n
% data
x = data_x(:,p);
t = data_t(:,p);
% feedforward
y = sigmoid_func(wji*x);
z = soft... |
function [xr] = check_win_length(ax,bx,N)
L = bx - ax; %Length of patch
if((L < 2 ) && (ax ==1))
xr = [ax, ax:bx];
elseif((L<2) && (bx ==N))
xr = [ax:bx,bx];
else
xr = ax:bx;
end
|
% Code for computing QR factorization using Householder vectors
% Copyright (c) 2016 by Pranay Seshadri
function [Q,R] = qr_Householder(A, varargin)
if isempty(varargin)
thin = 0;
else
thin = 1;
end
% Size of A
[m,n] = size(A);
for j = 1 : n
[v,betav] = house(A(j:m,j));
% Problem is the step below! R... |
function p=projectionND(v,d)
%Calculate projection between a vector and a set of dots in multi dimensional space
%v = [1 x N] - vector
%d = [M X N] - M dot locations
%calculate the cos angle between vector and dots
cosAng=v*d'./(sqrt(sum(v.^2))*sqrt(sum(d'.^2)));
p=cosAng.*sqrt(sum(d'.^2));
|
function p2 = linear_classifier_of_durationreplay_withPFC(thisdir,label)
load(thisdir,[label '_PFCreplayspikes_binned'],[label '_PFCreplayspikes_list'],...
[label '_replay_stnd'],[label '_replay_singlebothjoint'],'other_cells',[label '_Cand_sig_modu_include'])
eval(['replaystnd = ' label '_replay_stnd;'])
... |
function [lambda2,fval,exitflag2,output2] = solveLambda2(vawt, iTSR, ith, lambda1, alphaAnt)
%SOLVELAMBDA2 Solve interference factor at an azimuthal angle
% position
%
% [lambda1,fval,exitflag1,output1] = vawt.solveLambda1(iTSR, ith, alphaAnt)
% returns the interference factor (lambda2) f... |
function [ S ] = RecClus( R, alpha, beta, gamma, c, miter )
%UNTITLED10 Summary of this function goes here
% Detailed explanation goes here
disp('Parameters: ')
fprintf('max number iterations: %d\n', miter)
fprintf('alpha=%f\n', alpha)
fprintf('beta=%f\n', beta)
fprintf('gamma=%f\n', gamma)
fprintf('num of clusters=... |
function [a] = drawKm(result)
long = result(find(result(:,1) >=0),2);
short = result(find(result(:,1) <0),2);
%long = sort(long);
%short = sort(short);
ecdf(long, 'function', 'survivor');
hold on;
ecdf(short, 'function', 'survivor');
end |
function regrouped_Callback(hObject, eventdata, handles)
% hObject handle to regrouped (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
regrouped = handles.regrouped2;
figure;
imagesc(regrouped(:,:,2)); |
function [granger, fitted, freq_band_centers, ids, C] = ...
permuted_granger(signals, var_specifiers, n_trials_per_perm, n_perms, varargin)
% PERMUTED_GRANGER -- Calculate spectral Granger causality by repeated
% sub-sampling.
%
% [G, f, ids] = permuted_granger( signals, 'regions', 100, 1000 )
% calcu... |
function objectCreationTest()
% Try instantiating every class.
nprobs = 0;
excludeList = {'Graphlayout','GraphlayoutNode'};
classes = setdiff(getClasses(PMTKroot()),excludeList);
fprintf('will try to instantiate %d classes\n', length(classes));
for i=1:numel(classes)
if ~isabstra... |
function [mdata] = generateDataMatrixOld(N)
mdata= ceil(randperm(1000,N)); % Initial data of sensors in unit KB6*
end
|
function B = weighted_cov( P, r, h )
%COV_B creates weighted-covariance matrix B from points p in P[], and r
% note: P also includes r
% calls:
% mls_weight.m
% eucDist.m
% get dimensions
[M N] = size(P);
% get weights ( M x 1 vector )
weights = mls_calculate_weights(P, r, h);
% remove mean ... |
function [] = validationsvm(y, results,xx)
TP = 0;FP = 0;TN = 0; FN = 0;
trueMat = y;
predictedMat = results;
adder = trueMat + predictedMat;
TP = length(find(adder == 2));
TN = length(find(adder == 0));
subtr = trueMat - predictedMat;
FP = length(find(subtr == -1));
FN = length(find(subtr == 1));
Sn = TP/... |
function a = sigd(a)
a = a .* (1 - a);
end
|
%main
clear;
clc;
format long
%n
W=zeros(100,3);
for j=1:3
delta=10^(-3-j+1);
for i=3:100
n=i;
[pS,Sigma]=Mtest4(delta, n);
%[Sigma]=P1singular(n,delta);
W(i,j)=Sigma;
end
end
figure
plot(3:100, W(3:100, 1),'--s','LineWidth',1);
hold on
plot(3:100, W(3:100, ... |
%% Set parameters for single class COVID model
%1
alpha= 0.000678169516617; % 0.002411269034240; % 0.264427629177580; % 0.3052; % 0.3355; % .5;
%2 not in list = has its own vector
beta = 0.000000000522566; % 1.86044e-09; % 1.0284e-09; % 6.67e-09; % susc to exp
%2
deltaI = 0.081961233707576; % 0.079634414418192; % ... |
function y = CubicInterpolate( v_0, v_1, v_2, v_3, x )
N_0 = v_1;
N_1 = v_2;
G_0 = 0.5*( v_2 - v_0 );
G_1 = 0.5*( v_3 - v_1 );
A = N_0;
B = G_0;
C = -3*N_0 + 3*N_1 -2*G_0 - G_1;
D = 2*N_0 - 2*N_1 + G_0 + G_1;
x_2 = x*x;
x_3 = x_2 * x;
y = A + B*x + C*x_2 + D*x_3; |
function HW1(filename)
data = importdata(filename);
figure;
errorbar(data(:, 1),data(:, 2),data(:, 3),'rx');
hold on;
Weighted_Ballistic_Inversion(data(:, 1), data(:, 2), data(:, 3), 2.0);
Weighted_Ballistic_Inversion(data(:, 1), data(:, 2), data(:, 3), 1.0);
Weighted_Ballistic_Inversion(dat... |
function createfigureErrorIt(Y1,name)
%CREATEFIGURE(Y1, Y2, Y3)
% Y1: vector of y data
% Y2: vector of y data
% Y3: vector of y data
% Auto-generated by MATLAB on 21-Apr-2017 15:22:48
% Create figure
figure1 = figure('Name',name);
% Create axes
axes1 = axes('Parent',figure1);
box(axes1,'on');
hold(axes1,'on')... |
clear variables
%CONSTANTS
L = 3; %Channel delay
D = 100; %Number of inputs
N = 100; %Number of observations
M = 2; %Receptors
h_expectation = [1 0 0 0;-1 0 0 0]; %Channel init, if either M or L are changed, the dimensions of this
% have to be consistent (h -> Mx(L+1) vector)
N_ESTIMATIONS = 1; %Number of cha... |
function [dem,pr] = get_next(index,inp1,inp2)
global demand_values;
global price_vector;
global P_1;
global P_2;
global P_3;
global P_4;
global P_5;
global P2;
%***********************************************************************
if inp1 == demand_values(1)
temp = 1;
else if inp1 == demand_values(2)
... |
function Active_Set = Gap_Safe_Screen(X, Active_Set, y_lambda, theta, residual, R_)
%
% sqrt(alpha^2*norm(residual)^2-2*alpha*residual'*y_lambda+norm(y_lambda)^2-R_^2)
a = abs(X'*residual); b = norm(residual, 2)^2; c = residual'*y_lambda; d = norm(y_lambda, 2)^2 - R_^2;
v = 1/max(a);
alpha = min(max(-v, y... |
%% This is originally a copy of "GP_TrFiPr.m"
clear all;
clc
%% Training/Testing set 1_11.xlsx and 2_13.xlsx
% Same name but in different folders
train_no_1 = xlsread('./ssdf_data/sin_train_data/1_11_.xlsx');
train_no_2 = xlsread('./ssdf_data/sin_train_data/2_13_.xlsx');
test_no_1 = xlsread('./ssdf_data/test_data/1... |
function trt = picktraits(csvfiles,trtlist,idlist,nohdr,saveas)
% Select a list of traits from the HCP data
%
% Usage:
% trt = picktraits(csvfiles,trtlist,idlist,nohdr,saveas)
%
% - csvfiles : List of restricted, unrestricted, and perhaps other
% HCP files containing the traits. If more than one,
% ... |
function [ outSequ ] = min_future_sequ( inSequ,N )
%% min_future_sequ find smallest in future (or in the next N slices, including current slice)
% outSequ(i) = min(inSequ(i+1:end)), when N is not specified;
% outSequ(i) = min(inSequ(i:i+N-1)), when N is specified;
%%
if nargin == 1
outSequ = -max_future_sequ(-inSeq... |
function [points, R, Ix, Iy, E1, E2] = myHarrisCornerDetector(inp_img1)
inp_img = double(inp_img1)/255;
[m,n] = size(inp_img);
%%
sigma = 1;
k = 0.04;
threshold = 1;
Gxy = fspecial('gaussian', max(1, fix(6*sigma)), sigma);
% Gxy = ones(3);
%%
dx = [-1 0 1; -2 0 2; -1 0 1];
... |
function [ DataOut ] = InterpolateMissionPlannerData( Data, MessageForTime )
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
Messages = fieldnames(Data);
if ~ismember(MessageForTime,Messages)
error('%s not a message in data!');
end
CommonTime = Data.(Mess... |
% 7/29/13
% desiredTraj.m
% desired quadrotor trajectory input
% Dependencies: findTraj.m, plotTraj.m, findTrajCorr.m, evaluateTraj.m
% findContConstraints.m, findFixedConstraints.m, findDerivativeCoeff.m, findCostMatrix.m
%
% inputs:
% t: real value, current time
% g, mQ, JQ: real values, constants
% outputs:
%... |
% bad segment definition
function badsegind = badseg(EEG,chlb)
[EEG.data,EEG.nbchan,~,~] = eegecgsep(EEG.data,EEG.nbchan,EEG.pnts,chlb);
ext = 0.3;
dscdt = 0.3;
sgn = EEG.data;
sgn = eegfilt(sgn,EEG.srate,1,0,0,3*fix(EEG.srate),0,'fir1',0);
nbch = EEG.nbchan;
smsz = EEG.pnts;
sgnmn = mean(EEG.data,2);
sgnstd = std(EEG.... |
function write_flatten_nii(nii_name, thres)
y = niftiread(nii_name);
Size = size(y);
a = Size(1);
b = Size(2);
c = Size(3);
d = Size(4);
itemp = 1;
for i = 1:a
for j = 1:b
for k = 1:c
if (mean(y(i,j,k,:)) > thres)
number(:,itemp) = y(i,j,k,:);
itemp = itemp + 1;
end
end
end
end
... |
function [im, ii_im] = LoadImage(im_fname)
global SanityCheck eps;
im = double(imread(im_fname));
mu = mean(im(:));
std1 = std(im(:))+realmin('double');
im = (im-mu)./std1;
ii_im = cumsum(cumsum(im,1),2);
%Sanity Check
if SanityCheck
if abs(mean(im(:)))>eps || abs(std(im(:))-1)>eps
error('This image i... |
function [hfig,haxes] = AMIGO_plotParsinBounds(p, lower_bound, upper_bound, ptrue,h, par_names)
%AMIGO_plotParsinBounds plots the parameters in their bounded domain
%represented by rectangles.
% AMIGO_plotParsinBounds(p, lb, ub) plots the (Nx1) parameter vector p
% in the bounds such that lb(i)<p(i)<ub(i). If P is ... |
%% Import data from text file
% Script for importing data from the following text file:
%
% filename: /media/teamlary/Team_Lary_1/gitGubRepos/Lakitha/mintsDataAnalysis/FWNode/MINTS_001e06323a06_GPSGPGGA_2019_04_29.csv
%
% Auto-generated by MATLAB on 04-Jun-2019 17:44:06
%% Setup the Import Options
opts = delimited... |
close all;
clear all;
%% Programm initialization
Fs = 4.5e9; % sampling frequency
c = 3e8;
dt = 1/Fs; % sampling interval
% calculate PRF
AveRate = 8;
PRI = 511*512*256*AveRate/Fs;
PRF = 1/PRI;
% read dataset
file='Slow.0000000000';
[Ch1,Ch2] = ReadMeodat(file);
[NSampleCo... |
multi_scan_vertical
scan_maps
%run_row, which is in the vertical direction (fixed col, row changing)
rk=int16(zeros(1,len)); rw=rk;
rn=0; rn0=0; rnw=0; Nr=0;
map_new=int8(zeros(sz));
for n=1:len
rnw=rnw+1;
row=rout_row(1,n); col=rout_row(2,n);
if subcf(row,col)~=0
rn=rn+1;
if map(row,col,1... |
function retval = snowflake (its)
length=1;
theta=pi/3;
p1=[0,0];
p2=[length/2, length*sin(theta)];
p3=[length, 0];
fp=[p1;p2;p3];
for index=1:its
np=size(fp, 1);
newp=zeros(np*3,2);
for i=1:np;
p=fp(i,:);
if i==np
v=fp(1,:)-fp(i,:);
else
... |
function [U, X1, X2, theVs, tus, err, theVsoriginal] = optimizeHouseholder_decomposition(Q, h)
%% Householder decomposition of an orthonormal matrix, Section II of the paper
tic;
[n, ~] = size(Q);
% an initialization of Householder reflectors by QR decomposition
% [AA, theUs] = QR_tria_hh(Data, h);
% D = eye(n);
% fo... |
% A measure of acceleration capability from static equilibrium
% Author : Jonathan EDEN
% Created : 2016
% Description : Implementation of the SEACM
classdef SEACMetric < WorkspaceMetricBase
% Constants that needs to be defined from parent
properties (Constant)
type = WorkspaceMetricType.... |
clc
clear
close all
%% init
q0 = [1;0;0;0];
dt = 1e-2;
%% plotting
x0 = [1;0;0];
y0 = [0;1;0];
z0 = [0;0;1];
q = q0;
figure
hold on
grid on
view(60, 30)
%% timeseries
for t = 0:dt:10
w = [randn()*0.02; t/10 + randn()*0.02; sin(t/20) + randn()*0.02];
%% RK-4 scheme
wq = [0;w]; % w vect to quat form
... |
function [ U ] = FormingU( N )
% Forming the column vector U (label)
% U(x, y) = sin(pi * x) * sin(pi * y)
% input:
% N: the number of grids each row.
n=N-1; % to save time repeatedly computing N-1:
U=zeros(n,n);
for i=1:n
for j=1:n
U(i,j)=sin(pi*i/N)*sin(pi*j/N);
end
end
U=U(:);
end
|
function [xres yres]= map_coord(x, y, omap)
% By Yiren Lu at University of Pennsylvania
% Mar 18 2016
% ESE 650 Project 4
% This function converts senser's coordinates to map's coordinates
% and sort out the bad points;
xres = ceil((x-omap.minx)./omap.res);
yres = ceil((y-omap.miny)./omap.res);
indGood = (xres > 1) &... |
function [Hessian, ModelEvaluations, ExpDesign] = uq_hessian(X, fcn_, M_X, h)
% Hessian = UQ_HESSIAN(X,fcn)
% Calculate the Hessian Matrix of the limit state function, fcn,
% for a given point X.
%
% Hessian = UQ_HESSIAN(X,fcn,M_X)
% Calculate the Hessian Matrix of the limit state function, fcn,
% for a given point X. ... |
% +STAT Package for running Matlab statistical models
% MATLAB Version 9.7 (R2019b Update 5) 18-Jun-2020
%
% Helper (Math) Functions
% getCleanSpikeRates - Return smoothed single-trial fits using Poisson GLME
% getSS - Return sum of squares struct for data and prediction... |
function display(c)
%
% NAME
%
% function display(c)
%
% ARGUMENTS
% INPUT
% c class cortical parellation class
%
% OPTIONAL
%
% DESCRIPTION
%
% 'display' writes the internals of the class to stdout. It simply
% converts the class to a struct and displays the struct.
%
% NOTE:
%
% HISTORY
% 12 June 2007
% o Initial ... |
%求解积分S0-piS0-2pi (ysin(x)+x(cos(y))dxdy 的数值
integrnd = @(x,y)y*sin(x)+x*cos(y);
xmin=pi;
xmax=2*pi;
ymin=0;
ymax=pi;
result=dblquad(integrnd,xmin,xmax,ymin,ymax)
x=[-1:0.05:1];
y=[0:0.05:1];
[X,Y]=meshgrid(x,y);
f510=inline('sqrt(max(1-x.*x-y.*y,0))','x','y');
z=f510(X,Y);
d=inline('sqrt(max(1-x.*x,0))','x');
b=1;a=-1... |
%% Initial
clear all; addpath('../../routines');
input_file_folder='input';
%% th ELKC and derivatives
input_file_name='lognormal_2D.es';
p=f_read_input(input_file_folder, input_file_name);
p.hitting_set.thresholds=f_set_thresholds(-3, 3, 0.01, 'log10');
p=f_set_gauss_parameter(p);
elkc=@(j) f_elkc(j, p.geometrical,... |
function plane_input_sturct = Return_airway_interpol_para( varargin )
%These are the parameters used for the interpolation
%This is for the interpolation
plane_input_sturct = struct;
plane_input_sturct.physical_plane_length = 40;
plane_input_sturct.physical_sampling_interval= 0.3;
plane_input_sturct.spline_sam... |
% INIT_NN Initialize a NN
% Initialize a NN where DBN and Rprop optimization are applied to all the
% layers of the network
%
% Copyright (c) 2011 Roberto Calandra
% $Revision: 0.12 $
function [nn] = init_nn(size_layer,nn)
%%
assert(isfield(nn,'nlabels'))
assert(isfield(nn,'labels'))
%% Pa... |
clc;
clear all;
img = imread('imagepath''\polymersomes.tif');
imshow(img); title('original polymersomes image');
mean_g = 0;
mt = 0;
[row,col] = size(img); % obtain row and col values
figure(); imhist(img); title('histogram of image'); % obtain histogram of image
h = imhist(img);
pi... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Some simulations:
% OneNeuronExpInf(500, 0.01, 500, 281, 30, -70.6, -50.4, 1, 144, 80.5, 4, -50.4)
% OneNeuronExpInf(500, 0.01, 1000, 281, 30, -70.6, -50.4, 1, 144, 80.5, 4, -50.4)
% OneNeuronExpInf(800, 0.01, 1500, 281, 30, -60, -50.4, 1, 720, 80.5, 80, -47.4)
% OneNeuronExpInf... |
function VMT_BlankShoreline(X,Y,Map)
% This function is not implemented currently.
%
% Effectivly clips a contour plot to a shoreline boundary by overlaying a
% patch to block out land. Requires the mapping toolbox. X is the UTM
% easting vector of the data extent, Y is the northing vector, and Map is
% the MA... |
function [Chromosomes] = GenerateRandomChromosomes(NumOfChromosomes, ...
AllowedGeneValues,NumOfAllowedGeneValues)
% All Genes of all Choromosomes get random values from AllowedGeneValues
%how many genes (task * operation) do we have?
NumOfGenes = size(NumOfAllowedGeneValues,2);
%make a zero matrix w... |
y = z;
function [chTable] = getHFO(z, ampThresh, chanNum)%for one channel
tempTable = table([0],[0],[0],[0],'VariableNames',{'chanNum','numCross','lowerbound','upbound'});
%Step3
numCross = 0;
ms = 262; %data points per 128ms - start and finish are 128 ms before and after hFO main peak
len = length(y);
count = 1;... |
function nu = rootFinder(f,t0,nu0,t,p,e,mu,N)
tInterval = t-t0;
%Newtons Method
nu_k = nu0 + deg2rad(5);
for i = 1:N
g_nu = timeChangeIntegral(f,nu0,nu_k,p,e,mu,N) - tInterval; %given function
dg_nu = sqrt(p^3/mu)/((1+e*cos(nu_k))^2); %derivative of given function
nu_kk = nu_k - (g_nu / dg_nu); ... |
function varargout = MITOMIAnalysis_ImageManipulation(varargin)
% MITOMIANALYSIS_GUI MATLAB code for MITOMIAnalysis_GUI.fig
% MITOMIANALYSIS_GUI, by itself, creates a new MITOMIANALYSIS_GUI or raises the existing
% singleton*.
%
% H = MITOMIANALYSIS_GUI returns the handle to a new MITOMIANALYSIS_GUI or t... |
classdef BernoulliDist < DiscreteDist
methods
function model = BernoulliDist(varargin)
model = model@DiscreteDist(varargin{:});
end
function L = logPdf(model,D)
% Override to do more efficiently than DiscreteDist, since we can
% transform the data to [0,... |
function [fullFace, PartFace] = LBPfeatures(pathFull, pathPartial)
imlist = dir([pathFull '*.png']);
fullFace = zeros(length(imlist),59);
for i = 1:length(imlist)
im = imread([pathFull imlist(i).name]);
im = imresize(im,[25 32]);
if size(im,3)==3
img=rgb2gra... |
% converts a cell array of clusters to a grouping vector
function c_v= convert_cluster_cell_to_vec(clusts)
c_v = zeros(1, 40);
for clu=1:numel(clusts)
c_v(clusts{clu}) = clu;
end
end |
%% Laplacian of Gaussian
function [f] = lofg(sigma, n)
[x,y] = meshgrid(-n:n, -n:n);
f = (-1/(3.14*(sigma^4)))*(1 - x.^2/(2*sigma^2) - ...
y.^2/(2*sigma^2)).*exp(-x.^2/(2*sigma^2)-y.^2/(2*sigma^2));
end |
%% Main
bits = 8;
epsilon = 0.1;
block_size = 2;
%% lena small for VQ training
image_small = double(imread('lena_small.tif'));
[clusters, Temp_clusters] = VectorQuantizer(image_small, bits, epsilon, block_size);
qImage_small = ApplyVectorQuantizer(image_small, clusters, block_size);
%% Huff... |
function [fits, sems, th] = getML_psyPerformanceCT(fn, recompute)
% use [fits(:,i),sems(:,i),stats] = quickTs_fit(fit_dat,afun,bfun,[],[],time_bins);
% to get behavioral threshold
if nargin < 1
return;
elseif nargin < 2
recompute = 1;
end
[home_dir, lab_dir, current_dir, tmat_dir] = dirnames;
savepath = [tma... |
function [ukfout] = UKF_bhm3(i,Param,z_ukf,state_ukf,w_ukf,est_ukf,P,Q,R,dt,ndim,zdim)
%#codegen
%function [P,state_ukf,est_ukf, SOC] = UKF_bhm3(i,Param,z_ukf,state_ukf,w_ukf,est_ukf,P,Q,R,dt,ndim,zdim)
%function [t_predict,P,state_ukf,est_ukf] = UKF_bhm(z_ukf,tau_model,state_ukf,w_ukf,est_ukf,P,Q,R,dt,xa0,ndim)
% Fun... |
clear all;
x_train = Get_MNIST('train-images-idx3-ubyte');
y_train = uint8(Get_MNISTLABEL('train-labels-idx1-ubyte'));
x_test = Get_MNIST('t10k-images-idx3-ubyte');
y_test = uint8(Get_MNISTLABEL('t10k-labels-idx1-ubyte'));
train_size = size(y_train);
train_size = train_size(1);
x_train_list = x_train.';
y_train_list... |
clear
close all
A=imread('oilspill.jpg');
targetR = 0; targetG = 0; targetB = 0;
R = A(:,:,1);
G = A(:,:,2);
B = A(:,:,3);
matches = R == targetR & G == targetG & B == targetB;
base = [1.3903e+03 890.7500];
N = -20.71613271;
W = -43.82682358;
S = -20.74471033;
E = -43.77901375;
mapWidth = abs(deg2km(E-W)*... |
function [ log_like ] = objective( heat,mask,weight )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
end
|
clear all
clc
load('datSemAguaSemNaN.mat');
bp2 = [];
bp4 = [];
bacc = 100000;
acc = 0;
dados2 = xTest(find(outClasse==0),:);
dados4 = xTest(find(outClasse==1),:);
while(true)
p1 = rand/20+.025;
pos2 = randperm(size(dados2,1),round(a*b*p1));
pos4 = randperm(size(dados4,1),round((... |
function [reformOrig, coordTable] = raicar_3Dto2D (orig, mask)
%
% function [reformOrig, coordTable] = raicar_3Dto2D (orig, mask)
%
% Author: Zhi Yang
% Last change: May 10, 2014
%
% Purpose:
% reform the input data into 2-D matrix and return the mapping table
%
% Input:
% orig: 3-D form EPI data. Thi... |
function KG = assemblyK(dim,Kel,Td)
%Global stiffness matrix calculation
KG = zeros(dim.ndof,dim.ndof);
for ee = 1:dim.nel
for ii = 1:dim.nne*dim.ni
I = Td(ee, ii);
for jj = 1:dim.nne*dim.ni
J = Td(ee,jj);
KG(I,J) = KG(I,J) + Kel(ii,jj,ee);
end
end
end
... |
%mel coefficient
clear;
clc;
close all;
addpath('H:\dev\small_programs\movie_music\voicebox\voicebox');
[S,FS,Nbits] = wavread('H:\dev\small_programs\movie_music\ffmpeg-0.5\ffmpeg-0.5\234.wav');
C=melcepst(S(1:1018,1),FS,12,20);
for i=1:1514
voice_feature(i,:,:) = melcepst(S(1018*(i-1)+1:1018*i,1),FS,12,20);
end
... |
function d = checkImages(filename)
d = [];
txt= sprintf('[s w] = unix(''ls --color=never -lh /home/cbassuser/fits/%s*'');', filename);
eval(txt);
entVals = strfind(w, '.fit');
for m=1:length(entVals)
entry{m} = w(entVals(m)-15:entVals(m)+3);
end
for m=1:length(entry)
eval(sprintf('thisFits = fitsread2(''/ho... |
% Load x and y from dataset
addpath(genpath('./'));
load('./forstudents/cleandata_students.mat');
[bestNets, bestErrors, bestConfig] = crossValidationEvaluation(10, x, y);
results = {bestNets, bestErrors, bestConfig};
save('crossValEval.mat', 'results');
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.