text stringlengths 8 6.12M |
|---|
%% Constant head test
% This demonstrates the interpretation of discharge rate in the test well
% with the Jacob and Lohman (1952) solution
%
% MIT License
% Copyright (c) 2017 Philippe Renard - University of Neuchâtel (CHYN)
%%
% The data set for this example comes from the following reference:
% Lohman (1965) Geolo... |
%motor constant V/(rad/s)
K=0.1838
%Armature resistance OHM
R=11.5
%Armature inductance H
L=0.1
%Rotor damping
b=0.0221
%Load inertia Kg*m*m
J=2.8033e-5
%gear ratio
n=1/48
|
run('nastavitve_program.m')
mesci=[{"Januar"; "Februar"; "Marec"; "April"; "Maj";...
"Junij"; "Julij"; "Avgust"; "September"; "Oktober"; "November";"December"}];
teden=weeknum(datenum(leto,mesec,dan));
mapa=strcat('/home/urban/Documents/Projekti/Vreme/',num2str(leto),'/Podatki');
if strcmp(obdobje,'mesec')
ime_da... |
function find_signal(abus)
global bus_signal_count
global bus_signals
load('buses.mat');
for i = 1:length(abus.Elements)
% if isa(abus.Elements(i),'Simulink.Bus')
if strcmp(abus.Elements(i).DataType(1:4),'Bus:')
newbus_name = abus.Elements(i).DataType(6:end);
eval(['new_bus =... |
function markersOut = pose2markers02(state)
translation = state(1:3)';
quaternion = state(7:10)';
% Get the original markers centered around the origin.
cm = [-1.5 -3 -4.5;... % cm = clean markers
-1.5 -3 1.5;...
-1.5 1 -4.5;...
-1.5 1 1.... |
% Made by Ben Thomsen in January 2018 to go along with paper:
% Benjamin Thomsen, Anuradha M. Annaswamy, and Eugene Lavretsky. "Shared
% Control Between Human and Adaptive Autopilots", 2018 AIAA Guidance,
% Navigation, and Control Conference, AIAA SciTech Forum, (AIAA 2018-1574)
%
% https://doi.org/10.2514/6.2018-157... |
ssh = ncread('/project/expeditions/eddies_project_data/ssh_data/data/h/dt_ref_global_merged_msla_h_qd_19930106_19930106_20100503.nc', 'Grid_0001');
lat = ncread('/project/expeditions/eddies_project_data/ssh_data/data/h/dt_ref_global_merged_msla_h_qd_19930106_19930106_20100503.nc', 'NbLatitudes');
lon = ncread('/project... |
function d=distMatrix(A,B)
[hA,wA]=size(A);
[hB,wB]=size(B);
for k=1:wA
C{k}= repmat(A(:,k),1,hB);
D{k}= repmat(B(:,k),1,hA);
endfor
S=zeros(hA,hB);
for k=1:wA`
S=S+(C{k}-D{k}').^2;
endfor
d=sqrt(S);
|
function P3(w)
aa=size(w);
aa=aa(1)
hold on
axis([-10 10 -10 10])
color=['y' 'b' 'm' 'c' 'r' 'g' 'w'];
for ii=1:aa
tmp=w(ii,:);
if tmp(1)==tmp(3)
plot([tmp(1) tmp(3)],[-10 10],'color',color(ii));
plot([tmp(1) tmp(3)],[tmp(2) tmp(4)],'-o','color',color(ii))
else
a=-(tm... |
%Second try today, using mean found by calculation not the bar value
%provided with the data. Tha bar value looks suspicious. Crosstream
%velocity is too high.
clear all;clc;
load adcp_main.mat;
% %%Converting date
date=datetime(time,'Convertfrom','datenum');
% d=juliandate(date);
% dn=datenum(date)-daten... |
function [cx, cy] = topologyCut(xv,yv,xcut,ycut)
% polyline²Ã¼ô
TOL = 10^(-6); % ÅжÏx==yµÄ¾«¶ÈÏÞ²î
% [xI,yI] = curveintersect(xv, yv, xcut, ycut);
[xI,yI] = polyintersect(xv, yv, xcut, ycut, TOL);
if isempty(xI) || isempty(yI)
cx = {xv};
cy = {yv};
return;
end
cx = [];
cy = [];
npts = l... |
%% Perform Barnes-Hut t-SNE on mouse gene data
clear variables
close all
addpath('../bh-tsne');
%% Load data (currently for a single brain)
disp('Load data');
datadir = '/home/mvandegiessen/data/tSNE_ABA/AllenMouseBrain_sagittal/';
outdir = 'results_mouse_genes_slice_sagittal/';
expressionlevels = load([datadir 'expr... |
function G = SRD_dynamics_derive_GeneralizedGravitationalForces(varargin)
Parser = inputParser;
Parser.FunctionName = 'SRD_dynamics_derive_GeneralizedGravitationalForces';
Parser.addOptional('SymbolicEngine', []);
Parser.addOptional('GravitationalConstant', [0; 0; -9.8]);
% Parser.addOptional('Symbolic_UseParallelizedS... |
function roc(genuine_cs,imposter_cs)
score=[genuine_cs imposter_cs];
sc=max(max(score));
genuine_cs=genuine_cs./sc;
imposter_cs=imposter_cs./sc;
%Error Rates
[FRR_cs FAR_cs]=cal_error_rates(genuine_cs,imposter_cs);
GAR_cs=100-FRR_cs;
figure,semilogx(FAR_cs,GAR_cs);
xlabel('FAR');
ylabel('GAR');
tit... |
close all
clear all
% Note for 1st time use :
% ======================
% Upon completed connection with the Hue-Bridge, you will get an appID,
% stored to a mat file "userNameWQuotes.mat" for later use.
% Keep an eye to this newly generated file
% testType = 'AroundHues'; %SingleColors, AroundHues, None
% testType... |
function simmatrix = gtom_similarity_matrix_2d( images, anglesteps )
simmatrix = cgtom_similarity_matrix_2d(images, anglesteps);
simmatrix = max(simmatrix, simmatrix');
end |
function [ U,V,W ] = InitUVW(P,J,Y,U,V,W,X,XX,param)
[l,k] = size(U);
[d,k] = size(W);
[k,n] = size(V);
obj_old = [];
last = 0;
lambda = param.lambda;
for i=1:param.maxIter
U= upu(P,U,J,Y,V,param,l,k) ;
V =upv(P,V,J,Y,U,W,X,param,k,n);
... |
function [x,s] = convlatlong(x,latlong,fmt,silent)
%
% [x,s] = convlatlong(s,latlong,fmt,silent)
% Convert string or cell array of strings into decimal degrees.
% latlong must be 'lat' or 'lon'. Valid strings are: -ddd.dddddd,
% -ddd mm.mmmm or -ddd mm ss.ss. 4th argument is optional.
%
% [x,s] = ... |
function p = setViewdist(p, newdist, forceUpdate)
% function p = pds.display.setViewdist(p, newdist)
%
% Update any display variables that are dependent on viewing distance
% **Generally unnecessary to call this function directly**
% Best practice to update value of [p.static.display.viewdist],
% then allow object... |
function process_deconvolutions()
sdata = csvread('features_fileid_sex_sexpredictiondnn_duration_avgfreq_avgvol_direction_peaks_breaks_broadband_tremolo_complex.csv');
data_path = './deconv/';
dirs = dir(data_path);
% process the corellation of neurons in the individual layers ... |
% Simplex Algorithm:
|
clear all;
clc;
load('IQdate.mat');
fc = 250e3;
fs = 10 * fc;
t = 1/fs:1/fs:length(IQdata) * 1/fs;
PLoRa_data = [];
for i = 1 : symbol_num
PLoRa_data = [PLoRa_data circshift( downChirp, [ 1, shift_num_per_symbol(i) ] )];
end
IQdata = [ IQdata, PLoRa_data ];
back_data = IQdata .* cos(2*pi*fc*t);
... |
function Combo_Output = Combo_Cell(old,new)
old = old(1:end-1,1:end-1);
new = new(1:end-1,1:end-1);
Genestr = [old(2:end,1); new(2:end,1)];
Gene = unique(Genestr);
oldrow = old(1,1:end);
oldcol = old(1:end,1);
newrow = new(1,1:end);
newcol = new(1:end,1);
Cell = [old(1,2:end) new(1,2:end)];
ComboColLen = length(Ge... |
% This is material illustrating the methods from the book
% Financial Modelling - Theory, Implementation and Practice with Matlab
% source
% Wiley Finance Series
% ISBN 978-0-470-74489-5
%
% Date: 02.05.2012
%
% Authors: Joerg Kienitz
% Daniel Wetterau
%
% Please send comments, suggestions, bugs,... |
function [x,fval] = benchmark_getmin(data,stringid)
%BENCHMARK_GETMIN Find minimum from benchmark data.
ff = fieldnames(data);
x = [];
fval = Inf;
for iField = 1:numel(ff)
idx = strfind(ff{iField}, ['_' stringid '_']);
if isempty(idx); continue; end
history = data.(ff{iField}).history;
for iHist = 1:... |
%=========================================================================
%
% Bivariate normal distribution properties
%
%=========================================================================
clear all
clc
y1 = -4:0.2:4;
y2 = -4:0.2:4;
%********************************************************************
%***... |
function [t, y] = euler_solver(odefun, tspan, y0, dt)
% Solve differential equation y' = f(t,y), from time tspan = [t0 t_final],
% with initial condition y0. Here odefun must be a function with signature
% odefun(t,y), which for a scalar t and a vector y returns a column vector
% corresponding to f(t,y). The solver ... |
% fkn_dbl_exp_fit_k - makes a double-exponential curve fit of F(k,t)/F(k,0)
% [dy,y_fit]=fkn_dbl_exp_fit_k(p,t,Fr,k) where:
%
% dy = the error in the fit
% y_fit = the fitted values of F(k,t)/F(k,0)
%
% p(1) = gamma0 (the fraction of immobile molecules)
% p(2) = D2 (the diffusion coefficient of compone... |
function [L33]=computeDisplacementKernelsSurfaceGravity(shz,nu,x)
% INPUT:
%
% shz geometry.shearZone object
% nu Poisson's ratio
% x coordinates of observation point (east, north, up)
% vecsize number of component for displacement vector
%
%
% DATA LAYOUT:
%
% /e1 \
% |n1 ... |
% One of the Termination Criteria: KKT residual (AUT)
% Based on the quad_wright code.
% 2014.7.14
% Yi.
function flag = TC_KKT_AUT(rd,rp,p_max,mu,epsilon)
flag = 0;
temp1 = max([abs(rp);abs(rd)]);
phi = temp1/p_max;
if((phi<=epsilon)&&(mu<=epsilon))
flag = 1;
end
end |
close all
clear all
dur=input('How long do you want to record?')
sr = 44100; % Hz
soundcard = audiorecorder(sr,16,1);
disp('Start Speaking');
recordblocking(soundcard,dur);
disp('Stop Speaking');
signal = getaudiodata(soundcard);
sound(signal,sr);
nsamp = numel(signal);
sampidx = 1:1:nsamp;
time = sampidx/sr;
figure
pl... |
function OutputVector = CCM(X,Y,ParamDim,tau)
addpath('../utils');
% Set time step ("tau")
% [These are just Matlab indicies; conversion to appropriate
% time values need to be done before reporting.]
%tau = 1;
% Set the parameter space dimension (must be >= 2)
if( (ParamDim < 2) || (ParamDim+1 > length(X)/2) ),
... |
discrimination_choice_FSham=xlsread('/Users/kdelevic/Dropbox/D2 DMS OVX project/eLife submission/transparent reporting info/modeling for github/Fig1_TrialHistories','F_Sham_Disc');
discrimination_choice_FOVX=xlsread('/Users/kdelevic/Dropbox/D2 DMS OVX project/eLife submission/transparent reporting info/modeling for git... |
function [arg_out, gain_factor] = fourierMask(imSize_arg, freqRange, freqRange_type, opt)
if nargin < 4
opt = struct;
end
if ~isfield(opt, 'applyFourierMaskGainFactor')
opt.applyFourierMaskGainFactor = 0;
end
if numel(imSize_arg) <= 3
imSize = imSize_arg;
... |
%CALC_RADIAL_TRAJ_DISTANCE Calculates radial sampling.
% CALC_RADIAL_TRAJ_DISTANCE(header) calculates the radial sampling
% defined by the scan parmeters (receiver BW, t_off, tramp, npts, etc).
% Returns the radial distances, as well as the gradients, and ideal
% radial distances (distance assuming gradients ... |
function [J grad] = nnCostFunction(nn_params, ...
input_layer_size, ...
hidden_layer_size, ...
num_labels, ...
X, y, lambda)
%NNCOSTFUNCTION Implements the neural network cost func... |
% initialize workspace
clear; close all
R = 2; N = 32;
alph = pi-pi/6; % my value so you can check your series (but use your own)
gap = pi/4;
delta_psi = 0.02; %
C = 0;
% coordinates of grid (adjust these!)
dth = pi/50; dr = (R-1)/20;
[th,ra] = meshgrid(0:dth:2*pi,1:dr:R);
[xx,yy] = pol2cart(th,ra);
phi = C ... |
[~,~,list] = xlsread('FVC2004DB2_list.xlsx');
[row,col] = size(list);
for i = 1:row
for j = 1:col
file = char(list(i,j));
file = strcat(file,'.xlsx');
disp (file);
mint_data = xlsread(file);
end
end |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2012 Analog Devices, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http:/... |
function X = drawMultinom(k)
% Draw size(k,2) samples from a Multinomial distribution
% Copyright (C) 2020 Pravitasari, et al
k = cumsum(k);
kmax = max(max(k))+1;
u = repmat(rand(1,size(k,2)).*k(end,:), size(k,1), 1);
m = (u < k) .* (kmax-k);
X = argmax(m);
|
%%%%%%%%%%%%%%%% PLOT SNAKES%%%%%%%%%%%%%%%%
%
% Plots the extracted snake boundaries on each image and saves the images.
%
% Inputs:
% plotS - sets the background image
% options: 'original' - original image
% 'originalA' - brightness and contrast enha... |
% Using Least Square Approximations to estimate missing values in the time
% series
% A matrix M must be obtained which would be used to calculate the values
% of the missing points.
M1 = zeros(24,47);
W1 = [];
for i = 1:24
for j = 1:47
Z1 = i^j;
W1 = [W1, Z1];
end
M1(i,:)= W1;
W1 = [... |
function [J grad] = ll(theta, X,y,n)
Ky = exp_cov(X,X,theta)+(theta(3)^2)*eye(n);
Kyi = inv(Ky);
J = (1/2)*y'*Kyi*y+(1/2)*log(det(Ky))+(n/2)*log(2*pi);
grad = zeros(3,1);
alpha = Ky\y;
al = alpha*alpha';
A = al-Kyi;
grad(1) =(1/2)*trace(A*(2/theta(1))*Ky);
d = pdist2(X,X);
... |
clear all;
M = 100;
H = @(x,k) x^2*k^2;
function [N,L,x,k,dx,dk] = setup_grid(M)
N = 2*M+1;
L = sqrt(2*pi*N);
dx = L/N;
dk = 2*pi/L;
x = (-M:1:M)*dx; #x = linspace(-M,M,N)*dx
k = (-M:1:M)*dk; #k = linspace(-M,M,N)*dk
endfunction
function rv = dimGetAndCheck(x,y)
# Checks if x,y are v... |
function setpoints_normalized = filter_SetPointsNormalized(setpoints_normalized)
%FILTER_SETPOINTSNORMALIZED filters data using the values of BC187 and
%plots the filtered data
% Compute standard deviation and length of the vector
BC187_vals_vector=cell2mat(setpoints_normalized(:,1));
BC187_mean=nanmean(BC187_vals_... |
function yy = abc(xx,F)
yy=zeros(size(xx));
j=1;
for i=0.2:0.1:3
yy(j)=F(xx(j));
j=j+1;
end |
function [signals,SNRdB,ch] = TestConfronto(link,sp,signal,amp,pdbm,singlepol,gpu)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Link parameters %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LL = ... |
% Ce script Matlab automatise la production de resultats
% lorsqu'on doit faire une serie de simulations en
% variant un des parametres d'entree.
%
%% ConfigFile %%
%%%%%%%%%%%%%%%%
rowNames = {'x0','y0','z0','vx0','vy0','vz0','m','R','Cx'};
varNames = {'Soleil', 'Terre', 'Lune', 'Halley' };
... |
function [docNode]=addLoadsLevel_FEB_v1p2(docNode,FEB_struct)
%%
disp('Adding Loads level')
febio_spec = docNode.getDocumentElement;
if isfield(FEB_struct,'Loads')
%Check for Loads level
if docNode.getElementsByTagName('<Loads>').getLength==0; %level does not exist yet
ElementAdd... |
function [] = draw_conic_surfaces_analytically(c1, c2, r1, r2, color)
z = c1 + (c2 - c1) * r1 / (r1 - r2);
beta = asin((r1 - r2) /norm(c1 - c2));
r = r1 * cos(beta);
%% External conic surface
translation_vector = z;
cone_direction = (c1 - c2) / norm(c1 - c2);
eta1 = r1 * sin(beta);
s1 = c1 - eta1 * cone_direction;
... |
function [ outputExpected ]= firstguess_get_expectedOutput(refData, commonData, dimX, dimY, pollNumber)
%outputExpected=zeros(size(emi,1)+2*(intermediateResult.radius-2),size(emi,2)+2*(intermediateResult.radius-2));
%outputExpected=zeros(dimX+2*(refData.radius-2),dimY+2*(refData.radius-2));
outputExpected=zeros(dim... |
img=imread('/Users/gonglaoshi/Desktop/实验一/lena.bmp'); %读取图像
gaussian_noise=imnoise(img,'gaussian',0.02); %添加高斯噪声
subplot(1,3,1); %绘图,下同
imshow(gaussian_noise); %显示图片,下同
title('高斯噪声'); %添加标题,下同
salt_and_pepper_noise=imnoise(img,'salt & pepper',0.02); %添加椒盐噪声
subplot(1,3,2);
imshow(salt_and_pepper_noise);
title('椒盐噪声')... |
function penvec = penchants2E(C,E1,E2,nbins)
[tstructC, countsC] = hist_extra(C,nbins);
[tstructE1, countsE1] = hist_extra(E1,nbins);
[tstructE2, countsE2] = hist_extra(E2,nbins);
binUpperC = zeros(1,length(tstructC));
binLowerC = zeros(1,length(tstructC));
binUpperE1 = zeros(1,length(tstructE1));
binLowerE1 = zeros(... |
% load('deltaW_NBI_data.mat', 'deltaW_fast_hat')
% Bphi0=Bavg;
Te_profile=TE_profile_interp_ini*eV;
Ne_profile=NE_profile_interp_ini;
Ne0=NE_profile_interp_ini(1)
Te0=TE_profile_interp_ini(1)*eV
%
Btot_PR_map=sqrt(BX_PR_map.^2+BZ_PR_map.^2+Btor_PR_map.^2);
derq=gradient(q_initial_profile,radial_r_value_flux);
derP=g... |
%Returns
% W1 W1ytest W1ref W1ytestref TC on future data with WN or same input stats as training
% W2 W2ytest W2ref W2ytestref SS on future data with WN or same input stats as training
% WDC WDCytest WDCref WDCytestref DC on future data with WN or same input stats as training
% WOr WO... |
function ret = lab1locmaxmin(img, k, m)
if(length(size(img))==3)
img = rgb2gray(img);
end
[r, c] =size(img);
new=zeros(r,c);
img = double(img);
for i =k+1:1:r-k-1
for j=k+1:1:c-k-1
subimg=img(i-k:i+k, j-k:j+k);
if(m==1)
value = max(subimg(:));
end
if(m==2)
... |
function foods = create_foods(size, number_foods, nest, visibility)
range_foods = [-size + 1, size - 1];
foods = zeros(number_foods,2);
j = 1;
while (j <= number_foods)
fd = [randi(range_foods),randi(range_foods)];
if (is_in_circle(fd,nest,2*visibility) == 0)
foods(j,:) = fd(1,:);
j = j + 1;
... |
function runex(xmlFile,repeats,outfile,~)
% function runex(xmlFile,repeats,outfile,demoMode)
%
% main Ex function.
%
% xmlFile: the xml file name for the desired experiment
% repeats (optional): the number of blocks to run. overrides the variable
% 'rpts' in the xml file
% outfile: if present, the full list ... |
function flag = isNotParallelData(data)
% isNotParallelData True for data that is not "parallel data"
%
% Syntax:
% isNotParallelData(data)
%
% Inputs:
% data -- structure or composite of structures of data as generated
% by nntraining.setup
%
% See also: nntraining.setup.
% Copyright 2014-20... |
function pass = getpass(prompt)
%GETPASS Open up a dialog box for the user to enter password. Password
%will be hidden as the user enters text. You can pass in an optional
%argument prompt to be used as the dialog box title. Defaults to "Enter
%password".
if nargin < 1
prompt = 'Enter password';
end
screenSize =... |
%DEMO_BESSELWAVE_MP Bessel wave system is solved as a two-parameter eigenvalue problem
% with Chebyshev collocation and multiprecision refinement
%
% This example reconstructs Table 1
% Lew Yan Voon & Willatzen, Helmholtz equation in parabolic rotational
% coordinates: application to wave problems in quantum mech... |
function [rs] = isJacobiConv(A)
rs = max(abs(eig(Jacobi_Matrix(A))));
if sign(rs - 1) < 0
disp('Converge');
else
disp('Nu conv');
endif
endfunction
|
% Build and draw our scatter plots
function scattman( fname )
% Draw a scatter plot for the training data
all_moms = importdata(fname);
x_plot = zeros(1,24);
y_plot = zeros(1,24);
colour = zeros(24,3);
area = [];
num = 24;
for i = 1 : num
x_plot(i) = all_moms(i,1);
y_plot(i) = all_moms(i,... |
# Traitement d'Image
pkg load image
# TP1
# 1 - Définitions
printf("> Quelle est la taille minimale entre 2 objets pour qu’ils soient distinguables à 30cm?\n");
# On utilise le théorème de Pythagore étendu (loi des cosinus)
# $a^2 = b^2 + c^2 - 2 b c \cos(\alpha)$
taille_min_cm = sqrt(30^2 * ( 2 - 2 * cosd(1/60))... |
clear
clc
close all
global L R dt waypoints r_a r_nm
%% Simulation Parameters (Need to be simplified) (Need to input into an Excel file)
% Waypoints should be input by excel files for different robots(id): is an
% N-by-(2*nb) matrix where N is number of waypoints for each robot (each
% robot must have the same number o... |
%%%%%%%%%%%%% function pecstrum.m %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Purpose:
% Computes pecstrum of the object
%
% Input Variables:
% size_distribution Size distribution of the object
% area Actual area of the object.
%
% Returned Results:
% f ... |
function [s, chi] = sign_decoding(sigma,chi,CX,D,p,mx,i,j)
[m,n] = size(sigma);
load('Table_SC.mat');
%p = p + 1;
if(CX(p)==9)
end
% if(CX(p)==9)
% idx = 5;
% Xc = Table_SC(idx,3);
%
% elseif(CX(p)==10)
% H = 0;
% if((mx+i-1)==1)
% V = min(1,max(-1,sigma(mx+i,j)*(1-2*chi(mx+i... |
function odesample(tol)
% odesample.m
% Sample code for solving a system of ODEs in matlab.
% Solves v'' = v^2 + (v')^2 - v -1 with v(0)=1, v'(0)=0
% with true solution v(t) = cos(t).
% Rewritten as a first order system.
% From http://www.amath.washington.edu/~rjl/fdmbook/chapter5 (2007)
global fcnev... |
function [offset] = calcLaneOffsetLine(obj,s,offset)
%CALCLANEOFFSETLINE Get the laneOffset for given s points
%
%----------------------------------------------------------------------
% BSD 3-Clause License
%
% Copyright (c) 2020, Jonas Wurst, Alberto Flores Fernández
% All rights re... |
%Create the PHOG descriptors
clear all;
clc;
I = '1.jpg';
img = imread(I);
bin = 8;
angle = 360;
L=3;
roi = [1;size(img,1);1;size(img,2)];
p1{:} = phog(I,bin,angle,L,roi);
x=p1{1}
figure(1),hist(cell2mat(x(4)))
saveas(gcf,'4.jpg');
%{
I = '2.jpg';
img = imread(I);
bin = 8;
angle = 360;
L=3;
roi = [1;size(img,1);1;siz... |
function num_of_symbol_errors = symbol_errors(est_X, X)
est_X = round(est_X);
X = round(X);
num_of_symbol_errors = sum(sum(X ~= est_X));
end |
clear all;
P = [0 2];
T = [0 1];
net = newp(P,T);
%观察生成的神经网络
inputweights = net.inputweights{1,1}
biases = net.biases{1} |
function s = stimulus_orientations(category_params, category, nStimuli, category_type)
switch category_type
case 'same_mean_diff_std'
if category==1
s = category_params.sigma_1 * randn(1,nStimuli);
elseif category==2
s = category_params.sigma_2 * randn(1,nStimuli);
e... |
function [v, fft_phi] = fct_SQG2(fft_T,model)
% Compute the Fourier transform of the velocity and of the streamfunction from
% the Fourier trasform of the temperature
%% Grid
M=prod(model.grid.MX);
if any( mod(model.grid.MX,2)~=0)
error('the number of grid points by axis need to be even');
end
PX=model.grid.MX/2;
... |
function springs_write( dir_input , nodes , springs , varargin )
if ~exist( dir_input ,'dir')
mkdir( dir_input ) ;
end
if numel(varargin) > 0
for ff = fieldnames(varargin{1})'
network_param.(ff{1}) = varargin{1}.(ff{1}) ;
end
end
network_param.num_points = size( nodes.position ,1) ;
network_param... |
function gX = constraintLogLikeGradientsLDA(model)
% CONSTRAINTLOGLIKEGRADIENTSLDA Returns gradients of loglikelihood
%
% Description:
% for LDA constraints
%
% OPTIONS = CONSTRAINTLOGLIKEGRADIENTSLDA(MODEL) Returns loglikelihood
% for LDAPos constraint
% Returns:
% OPTIONS - Returns loglikelihood
% Arguments:
% ... |
clearvars -except T1_experiment;
% Remove repeated data
% I found in the water measurements that there is repeated files in the
% data.
nf = length(T1_experiment);
% order = [10 8 5 2 9 6 3 7 4 1]; % Water
% order = 1:10;
order = [10 8 5 2 9 6 3 7 4 1];
refe = 10;
%% ====== Mean T1 from all the T1s =======
% Find t... |
function [H,f,ir] = absorptiontaper(N,fs,d,amin,amax)
% [H,f,ir] = absorptiontaper(N,fs,d,amin,amax)
% Estimate the frequency response of a filter that matches
% the absorption of the ocean over d meters.
% e.g., [H,f]=absorptiontaper(1024,96e3,1500,-1,-15);
% N is the number of frequencies to us... |
Adjacency_matrix=abs(1-CorrelationMatrix_PerRepeat);
Adjacency_matrix(isnan(Adjacency_matrix))=0;
Qopt2=[];
gamma = 0.05:0.1:3;
omega = 0.05:0.1:3;
for test=1:100
Qmat2=[];
for i=1:length(gamma)
parfor j=1:length(omega)
N=(size(Adjacency_matrix,1));
T=(size(Adjacency... |
% MATLAB R2015a function
% S. M. Farzaneh, farzaneh@nyu.edu
% Created: September 25, 2017
% Title: Carrier density as a function of Fermi level in bilayer graphene
function [n] = carrier_fermi_bilayer(ef, del)
% ef: Fermi level [J]
% del: energy asymmetry [J]
% n: carrier density [1/m^2]
%% initialization
% initializ... |
function tests = test_intersectEdgePolygon3d
% Test suite for the file intersectEdgePolygon3d.
%
% Test suite for the file intersectEdgePolygon3d
%
% Example
% test_intersectEdgePolygon3d
%
% See also
% intersectEdgePolygon3d
% ------
% Author: David Legland
% e-mail: david.legland@inrae.fr
% Created: 2021... |
function [ mErr ] = MQfn( Tmax,dt,mu )
numRuns = 100;
T = linspace(0,Tmax,Tmax/dt);
dW = randn(numRuns,length(T));
X = zeros(numRuns,length(T));
lambda = -1.0;
theta = 0.5;
% %EM scheme
% for i = 1:numRuns
% X_j = 1.1;
% X(i,1) = X_j;
% for j = 2:length(T)
% X_j = X_j - lambda*X_j*(1-X_j)*d... |
% MR03_make_dataset.m
% McClelland and Rogers (2003)
% pcho4@jhu.edu
ncol = 48;
format_string = '%s';
for ii = 1:ncol
format_string = [format_string, ' %d'];
end
fid = fopen('EightThings.pat');
C = textscan(fid, format_string);
fclose(fid);
example_names = C{1};
trainingset = double([C{2:end}]);
ind_item = 1:8;
... |
function plotgraph(matrix,chanlocs,varargin)
% matrix - NxN symmetric connectivity matrix, where N is the number of channels
% chanlocs - 1xN EEGLAB chanlocs structure specifying channel locations
% OPTIONAL ARGUMENTS
% plotqt - proportion of strongest edges to plot
% minfo - 1xN module affiliation vector. Will be ca... |
function printRowInfoCharacteristics(dataLoc,name)
load([dataLoc 'data.mat']);
labels = data(:,numFeatures+1:numFeatures + numLabels);
labelType = 'Numeric';
if sum(sum(data ~= 1 & data ~= 0)) == 0
labelType = 'Nominal';
end
labelDensity = mean(sum(labels,2)) ./ numLabels;
uniqueCombos = unique(labels,'rows');
pro... |
function gatedf = unsupervised_gating(df, frac, nbins, xVal, yVal, logScale)
% Automatically gates the data based on the density of the dat points on
% the xVal and yVal 2D histogram.
% Parameters
% ----------
% df : table
% table containing the raw data to be gated. This must be a table object
% since the name... |
function varargout = set_reference_stateD(varargin)
[varargout{1:nargout}] = CoolProp_wrap(328,varargin{:});
end
|
% Ran Ma
% 7/4/2018
% read Neper .tesr file
if(~exist('fname','var'))
fname = 'n10-id1.tesr';
end
fid = fopen(fname,'r');
if(fid==-1)
error(strcat('>>>Error: ',fname,' does not exist ...'));
end
while (1)
currLine = fgetl(fid);
if(strcmp(currLine,'***tesr'))
continue;
elseif(strcmp(currL... |
function [ verticesInfo ] = calculateVertices( L_img, neighbours )
% With a labelled image as input, the objective is get all vertex for each
% cell
ratio=4;
se=strel('disk',ratio);
neighboursVertices = buildTripletsOfNeighs( neighbours );%intersect dilatation of each cell of triplet
vertic... |
function figure2Gen(subjectName, expType, stimType)
% Generate Figure 2
plotsFolder = '/home/me/GammaHarmonicData/Plots';
makeDirectory(plotsFolder);
saveFolder = '/home/me/GammaHarmonicData/savedData';
makeDirectory(saveFolder);
if isfile(fullfile(saveFolder,[subjectName expType stimType '.ma... |
function varargout = define_rephasing_nonrephasing(varargin)
% DEFINE_REPHASING_NONREPHASING MATLAB code for define_rephasing_nonrephasing.fig
% DEFINE_REPHASING_NONREPHASING, by itself, creates a new DEFINE_REPHASING_NONREPHASING or raises the existing
% singleton*.
%
% H = DEFINE_REPHASING_NONREPHASING... |
%Figure 4.23 Feedback Control of Dynamic Systems, 5e
% Franklin, Powell, Emami
%
% script to generate Figure 4.22, 4.23, and 4.25
% case I, P control by reaction curve data.
% First, input the plant model and compute the reaction curve.
sysp=tf(1,[600 70 1])
set(sysp,'InputDelay', 5)
... |
dim=2;
delta=1;
siz = [5,5]
data_points = [2,2]
largo_datos=size(data_points,1);
% hay que ver el tipo de conectividad
% estan ordenados en x,y,z,etc
vecinos=[1 0;-1 0;0 1;0 -1];
num_vecinos=size(vecinos,1);
% la mayoria infinito (los far away)
F=ones(siz(1),siz(2));
T=ones(siz(1),siz(2))*inf;
u=zeros(dim,1);
m=zeros(... |
function rgb = light_steel_blue
rgb = [0.69019, 0.76862, 0.87058];
end |
function this = getFromFigure(hf)
% getFromFigure Get surfacegroup object from a figure.
%
% This static method tries to extract a surfacegroup object from a
% figure, whose handle is given in argument.
%
% See also: shapes.surfacegroup.getFromFile
% Jean-Yves Tinevez - November ... |
function [Ft3]=tri6_subtri3(Ft6,Vt6)
% function [Ft3]=tri6_subtri3(Ft6,Vt6)
% ------------------------------------------------------------------------
% The input 6-node triangles are either oriented such that the first node
% is a corner node or that the first node is a mid-edge node. The two cases
% are highlighted ... |
function logsum = functionone(lambda, c, t)
N0 = 100000;
logsum = log(N0) + (lambda*(1 - exp(-c*t)));
end
|
% wav_SoundRecording.m
% Generate and save sound files for two frequency inputs
% Ian Cooper
% School of Physics, University of Sydney
% email: ian.cooper@sydney.edu.au
% https://d-arora.github.io/Doing-Physics-With-Matlab/
% 170511
% Ignore Warning about clipping
clear all
close all
clc
% Frequency inputs
f1 =... |
%% a: Reading audio and Plotting Frequency Spectrum
[audioA,fs]=audioread('/Users/user/Desktop/MT_94109205_3/Piano.wav');
SamplesA = size(audioA,1);
durationA= SamplesA/fs; %seconds
fourierA = fftshift(fft(audioA)); % Fourier Transform
f= fs* ( (0:SamplesA-1)/SamplesA ) - fs/2; %from -fs/2 to fs/2 and e... |
function [ nodes ] = dmodihuberloss( nodes, neighbors )
%dmodihubloss Summary of this function goes here
% Detailed explanation goes here
%
% Distributed modified Huber loss
%
% nodes
% - t_data : nsample x nfeat
% - t_gnd : nsample x 1
%
% neighobrs
%
%
% Created by Junhao Hua (huajh7@gmail.com), on June 8, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.