text stringlengths 8 6.12M |
|---|
% Demonstration file for Elhorst Panel Data code
%
% Dataset downloaded from www.wiley.co.uk/baltagi/
% Spatial weights matrix constructed by Elhorst
%
% written by: J.Paul Elhorst summer 2010
% University of Groningen
% Department of Economics
% 9700AV Groningen
% the Netherlands
% j.p.elhorst@rug.nl
%
% REFERENCE:
%... |
function [] = init_networks(handles)
disp('initializing networks start.');
global LMS_net;
global RLMS_net;
global IF_net;
global GD_net;
global MGD_net;
global BPD_net;
global init_status;
global train_status;
set(handles.create_networks,'Enable','off');
set(handles.tr... |
function [ a ] = e_greedy_selection( theta , s, epsilon, centroids, dev )
% e_greedy_selection selects an action using Epsilon-greedy strategy
% Q: the Qtable
% s: the current state
actions = size(theta,2);
if (rand()>epsilon)
[a, max_Q] = GetBestAction(theta,s, centroids, dev);
else
% selects a random ac... |
function LineManipulator(lineHandle,controlMode)
%% LineManipulator(LINEHANDLE,CONTROLMODE)
% Adds ButtonDown, ButtonMotion and Keypress-functions to the figure that
% contains LINEHANDLE allowing mouse-based data manipulation.
% Be aware that the figure, the axes, the line and its UserData will be changed.
% ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% 06/14/2016
%%%%
%%%% (1)Calulate and plot all the simulated waveforms for 335 nm and 485 nm
%%%% band emission at One Temperatures set with TT
%%%% (2) compare calculated waveforms with experimentally recorded
%%%% waveforms of ... |
% if (time<0)
% Efield_X_map_phi_next=zeros(NB_PHI,NB_THETA,size_r);
% Efield_Z_map_phi_next=zeros(NB_PHI,NB_THETA,size_r);
% E_potential_PR_map_phi=zeros(NB_PHI,NB_THETA,size_r);
% grad_psi_star_map_phi=zeros(NB_PHI,NB_THETA,size_r);
% Epot_map_phi_next=E_potential_PR_map_phi;
% else
if tim... |
function [ feats ] = getFeatures( docs )
addpath('libraries/strnearest/');
%getFeatures Creates features from the given data.
% docs should be a cell array of cell arrays. The inner cell array is a
% document and the outer one is a list of all the documents. labels
% should be a cell array of vectors that label ... |
function true_risk = calc_true_risk(costs,class_pred)
% costs is N_test x L
% class_pred is length N_test
N_test = size(costs,1);
true_risk = 0;
for i = 1:N_test
true_risk = true_risk+costs(i,class_pred(i));
end
true_risk = true_risk/N_test;
end
|
classdef CommandLineFeedback < nnet.train.FeedbackHandler
% Copyright 2007-2014 The MathWorks, Inc.
methods
function enable = enableImpl(this,useSPMD,data,net,tr,options,status)
enable = net.trainParam.showCommandLine && ~isnan(net.trainParam.show);
end
function startImpl(this,useSPMD,data,ne... |
close all;
clear all;
% generated with semopy_bic.py in py_vgdl
filenames = {
%fullfile(get_mat_dir(false), 'semopy_GLM_109_lmes.mat'),
%fullfile(get_mat_dir(false), 'semopy_GLM_120_lmes.mat'),
'/n/home_fasse/mtomov13/py_vgdl/mat/semopy_GLM_109_lmes.mat',
'/n/home_fasse/mtomov13/py_vgdl/mat/semopy_GLM_... |
function wsVox = vdoVox(src, parVox, varargin)
% Over-segment the image sequence into super-voxels.
%
% Input
% src - video src
% parVox - voxel parameter
% varargin
% save option
%
% Output
% wsVox - voxel result
% Ls - label
% mSeg - #segments
% A - adjacency matrix, mSeg ... |
function pComTorso = pComTorso_gen(in1)
%PCOMTORSO_GEN
% PCOMTORSO = PCOMTORSO_GEN(IN1)
% This function was generated by the Symbolic Math Toolbox version 8.3.
% 20-Oct-2019 14:02:15
q3 = in1(5,:);
x = in1(1,:);
y = in1(2,:);
pComTorso = [x+sin(q3)./2.0;y+cos(q3)./2.0];
|
close all; clc; clear all;
%% Load data
load ('data\\cell_compositing_all.mat'); % load cell_compositing_all
nComp = length(cell_compositing_all);
for i = 1:nComp
F(i, :) = cell_compositing_all{i}{1}(1, :); % a row is an observation
B(i, :) = cell_compositing_all{i}{1}(2, :);
end
... |
clc
clearvars
fitness_function = @(x) 2*(x^2 + 1);
population_size = 25;
crossing_probability = 0.85;
mutation_probability = 0.05;
population(1,1).genotype = [];
population(1,1).fitness = [];
population(1,1).selection_probability = [];
for i = 1 : population_size
population(1,i).genotype = dec2bin(rand() * 127, ... |
% Erzeuge PKM mit EE-FG 3T0R
% Moritz Schappler, moritz.schappler@imes.uni-hannover.de, 2020-03
% (C) Institut für Mechatronische Systeme, Universität Hannover
clear
settings = struct( ...
'EE_FG', logical([1 1 1 0 0 0]), ... % 3T0R
'dryrun', false, ...
'max_actuation_idx', 1);
parroblib_add_robots_symact(... |
classdef MLP
%MLP Summary of this class goes here
% Detailed explanation goes here
properties
epocaMax
alpha
alphaDecai
erroMin
pesoBiasEscondida
pesoBiasSaida
pesoEscondida
pesoSaida
n
k
p
entrada
end... |
function [out] = skript_test_for_Amelio(n, VOLUME, TESSLEVEL)
verbose = 1;
%currDir = pwd;
%extract graph and region info
%cd(vPath);
%imgNames = dir('I00000*_seg.png');
%cd(currDir);
[graphInfo, regionInfo, NodeToImgM] = buildGraphAndRegionInfo(VOLUME, n, TESSLEVEL);
disp('building weight Matrix');
weightMatrixDist... |
clc
clear all
% Find all windows of type figure, which have an empty FileName attribute.
allPlots = findall(0, 'Type', 'figure', 'FileName', []);
% Close.
delete(allPlots);
verbose = 6;
format long
eta=0;
f1=0;
%%%%%%%%%conditions
figure_shape = 'ellipse';
dispersion = 'no';
N_intervals_x = 3;
N_intervals_y = 3;
N... |
classdef MvnInvGammaDist < ProbDist
% p(m,s2|params) = N(m|mu, s2 Sigma) IG(s2| a,b)
properties
mu;
Sigma;
a;
b;
end
%% main methods
methods
function m = MvnInvGammaDist(varargin)
if nargin == 0, varargin = {}; end
[mu... |
function [TL TL_RGB Stats_table] = ThresLabNBs(toThreshold,parameters)
[remove1 diskSize WatershedParameter remove2 Thicken] = parameters{:};
%T=im2bw(toThreshold(:,:,f),0.7);
T = imregionalmax(toThreshold,4);
%Tf = imfill(T, 'holes');
Tfar = bwareaopen(T,remove1,4);
%se ... |
function load_secondary_freq_win(main_figure,rotate)
secondary_freq=init_secondary_axes_struct();
curr_disp=get_esp3_prop('curr_disp');
if curr_disp.DispSecFreqs<=0
setappdata(main_figure,'Secondary_freq',secondary_freq);
return;
end
curr_disp=get_esp3_prop('curr_disp');
layer=get_current_layer();
if isempty... |
%% Без подбора коэффициента остывания
data = dlmread('tdata.txt',' ');
te = data(:,1); % время
Te = data(:,2); % температура
plot(te,Te,'ro'), grid on, hold on;
xlabel('t, c'); ylabel('T, grad');
t(1) = te(1); % начальный момент времени
Ts = 22; % начальная температура в комнате, град
r = 0.1; % ... |
%==================================================================
%--- Backward Feature selection by Correst Classification Rate ----
%--------------- Main Function ---------------------------------
%==================================================================
% function [ResultMat] = BackSel_main
% Matla... |
function [filt_mins filt_time] = filt_mins(fitting_time, fitting_mins, time, Ca, percent)
q = 0;
for i = 1:length(fitting_mins)-1
index = i-q;
difference = (fitting_mins(index+1)-fitting_mins(index))./...
(fitting_time(index+1)-fitting_time(index));
if difference > abs((max(Ca)-min(Ca))/(max(time)... |
%Function Dat1 = SpectrumCalibrate(Dat,AppEff,Source,Beam)
%Input: Dat - x2 double of observational data
% AppEff - doubel apperture efficiency of the telescope
% Source - double source size in arcsec, enter as 0 if unknown
% Beam - beam size in arcsec, enter as 0 if unknown
%Output: Dat1 - x3 dou... |
function forceCallBack1(handles, sysVal)
%
%
% input
% handles = array of all handles in program
% sysVal = a binary number to recognize if open loop or closed loop
% 0 = closed loop, 1 = open loop
content = cellstr(get(handles.drawMenu, 'String'));
selected = content{get... |
% File: Example5_04.m for Example 5-4
clear;
clf
Ac = 1
fc = 4;
fa = 1;
Ta = 1/fa;
dt = 2*Ta/200;
wc = 2*pi*fc;
wa = 2*pi*fa;
t = 0:dt:2*Ta;
% Sinusoidal modulation is
x = sin(wa*t);
x = x(:);
% Obtain the Hilbert Transform from Table A-7
y = -cos(wa*t);
y = y(:);
carrierx = cos(wc*t);
carrierx = carrierx(:);
... |
%Intraclass Correlation Coefficient
%Based on Speech Enhancement: Theory and Practice (2nd Ed.) by Philipos C. Louizou
%Pages 473-474
%Start by making a master array of Files as Rows, Participants as columns
close all
clear all
% clc
addpath('../Functions/');
addpath('Functions/');
recalculate = 1;
% load('Results_... |
function [ret,x0,str,ts,xts]=sdm(t,x,u,flag);
%SDM is the M-file description of the SIMULINK system named SDM.
% The block-diagram can be displayed by typing: SDM.
%
% SYS=SDM(T,X,U,FLAG) returns depending on FLAG certain
% system values given time point, T, current state vector, X,
% and input vector, U.
% FLAG... |
%% aoStimReconMany
%
% Description:
% Call aoStimRecon with many combinations of parameters.
%
% See also: aoStimRecon
% History:
% 08/15/22 dhb Wrote after converting aoStimRecon to a function
% 08/26/22 dhb, chr Convert to main file, edit cone mosaic options
% 09/22/22 chr Convert to its own dichrom f... |
oldpath = path;
% YOUR PATH GOES HERE |
% |
% |
% v
path(oldpath,'C:\Users\enizm\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64'); |
function create_dot_LGN_mask(session_dir,func,gfeatNum,zthresh)
% Creates:
%
% lh.<func>.LGN.nii.gz
% rh.<func>.LGN.nii.gz
%
% in the session directory, based on a moving dot functional localizer.
%
% Usage:
% create_dot_LGN_mask(session_dir,gfeatNum,zthresh)
%
% Written by Andrew S Bock Nov 2015
%% set d... |
T = 2;
T1_ex1_p1_Rotaru_Adrian(0:0.002:T,1) % 2ms = 0.002s
T1_ex1_p1_Rotaru_Adrian(0:0.02:T,2) % 20ms = 0.02s
T1_ex1_p1_Rotaru_Adrian(0:0.2:T,3) % 200ms = 0.2s |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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:/... |
% ****************************************************************
% MAIN FILE
% ****************************************************************
% Code for the nonlinear model described in the Appendix B in the
% "Sovereign Default Risk Premia, Fiscal Limits, and Fiscal Policy"
% (Huixin Bi, 2012)
% Aim :
%
% (c) ... |
function LABPaint
% Herramienta de dibujo / Drawing tool
%
% Versiones:
%
% - Versión 0.1.0 : * 07/07/2014
% * Versión inicial
%
% - Versión 0.2.0 : * 16/01/2016
% * Soporte multi-lenguaje (Inglés/Español)
%
% =================================
% LAB... |
function setHijosM = mutacionIndividuo(setHijos)
setHijosM = [];
for p = 1:50
c = mutacion(setHijos(p,:));
setHijosM = [setHijosM;c];
end
setHijosM;
end |
function L = djs_bwlable(im)
%Effect: label the binary image 'im' via disjoint set data structure
%Inputs:
% im: binary image
%Outputs:
% L: the label image with 8-connection
%Author: Su dongcai at 2012/1/23
im = reshape(double(im(:)), size(im));
%the core rountine implementing 'bwlable' with 8-connection in ... |
function [randVarInRange] = randBetween(x, y, varargin)
% Picks random number between x and y input. order doesn't matter.
% varargin input 'both' to randomly multiply the output by -1 or 1.
% ie randBetween(.25, .5, 'both'), will lead to a random number between
% 0.25 and 0.5 OR -0.25 and -0.5. -psm
%randVarInRang... |
function [sm] = subMask(outerMask, innerMask)
%Obie maski są tego samego rozmiaru. Wyjściowa maska ma rozmiar liczby
%elementów wybieranych przez zewnętrzną maskę i jedynki w miejscach w
%których wyznacza wewnętrzna maska.
sm = innerMask(outerMask); |
function varargout = pyproxy(funcname,ring,varargin)
%Convert structures to a form accessible in python
func=str2func(funcname);
[outp{1:nargout}]=func(ring(:), varargin{:});
varargout=cellfun(@convert,outp,'UniformOutput',false);
function argout=convert(argin)
if isstruct(argin)
argout=struct... |
% function [dcell, Ffr, kernel] = run_deconvolution2(Ff, Fneu, f0, kernel)
isroi = [stat.mrs]./[stat.mrs0]<1.2 & [stat.npix]>20 & [stat.npix]<200;
Ff = Fcell{1}(isroi, :);
Fneu = FcellNeu{1}(isroi, :);
load('D:\CODE\MariusBox\SpikeDetection\kernel.mat')
f0 = 3;
Ff = Ff';
Fneu = -Fneu';
sd = std(Ff - my_conv2(Ff, 2,... |
%change the grid sizes n
%let a equal to a fixed value
n = 3:10; % test value range 3:20
a = 2;
error = zeros(length(n), 1);
h = zeros(length(n), 1);
for i = 1:length(n)
error(i) = L2ErrorNorm(n(i), a);
h(i) = 1 / n(i);
end
sampleNum = length(h);
figure(5)
p2 = polyfit(h, error, 2);
f2 = polyval(p2, h);
myEqu... |
file_count = 10;
in = input("Enter superpixel count: ");
cluster_count = input("Enter cluster count: ");
threshold = input("Enter neighbourhood threshold: ");
if in < 1
in = 500;
end
if cluster_count < 1
cluster_count = 100;
end
images = cell(file_count, 1);
wavelengths = [10 15 20 25];
orientations = [0 45 9... |
N = 1000;
A = rand(1, N);
B = zeros(1, N);
for i = 1:length(B)
p = randi(length(A));
B(i) = A(p);
A(p) = [];
end
best = 0;
count = 0;
for i = 1:length(B)
if B(i) > best
best = B(i);
count = count + 1;
end
end
disp(best);
disp(count);
|
%@(#) lagervalue.m 1.4 97/01/10 12:41:44
%
%function lagervalue(titel,matfil,prifil,plotta,savefile)
%function lagervalue(titel,matfil,fid,plotta,savefile)
%Computes the rest-value all fuel
%Input:
% matfil - Output from bunhist (cf. that m-file),
% default='/cm/fx/div/bunhist/utfil.mat'... |
function questao3()
%%Gaussiana com passa-baixa
imagem=imread('lena_gnoise21.bmp');
A=rgb2gray(imagem);
pq = paddedsize(size(A));
d0 = 0.05*pq(1);
h = lpfilter('gaussian', pq(1), pq(2), d0);
f=fft2(double(A),size(h,1),size(h,2));
lpfgaussiano=real(ifft2(h.*f));
lpfgaussiano=lpfgaussiano(1:size(A,1), 1:size(A,2));
f... |
%Name: David George
%Student Number: 251004930
%Excercise 1)
%Excercise a)
greetings("John", "Smith");
%Excercise b)
disp(calc_id("John", "Smith"));
%Excercise c)
greetings("John", "Smith");
%Excercise 2
%part a) Using a for loop
disp("Using the for loop to calcualte the fctorial... |
% Skripta za primerjavo Gurobi in intlinprog hitrost resevanja
% Uporablja testne podatke iz MIPLIB2017 (http://miplib.zib.de/)
%
% @author David Rubin (david.rubin@student.um.si)
% Optimizacijske metode, FERI, Maribor, 2020
N = 3; % faktor ponovitev merjenja za vsak primer
TIMEOUT = 1800; % cas preden... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Question 1-a: Auto Regression
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc;
% load data
load('data/stockIndex.mat');
% we depend on the 4th column, which is the close price
y = stockIndex(:,4);
% get stock index (monthly) from 1/May/1997 to 1/May/2007
% and this will b... |
close all;
%% TASK 1B
%% load psi
load('psi_w005.mat');
t = compass(1,:);
psi1 = compass(2,:);
load('psi_w05.mat');
psi2 = compass(2,:);
%% Plot psi
subplot(2,2,1);
plot(t, psi1); title('Task 1b, w = 0.005'); legend('Psi(t, w=0.005)'); xlabel('time [s]'); ylabel('course [deg]');
subplot(2,2,2);
plot(t, psi2); t... |
function [param]=pp2b_2(input)
% [qp]=pp2b_2(input)
% PID B-2 pole placement controller for 2nd order processes.
% This function computes parameters of the controller (r0, q0, q1, q2, p1, p2).
% The dynamic behavoiour of the closed-loop is defined by its
% poles: z1 = alfa+j*omega, z2 = alfa-j*omega, z3,z4 = alf... |
%USER SETTING
times = [10 50 100 150 200 300 400 500 600];
%OUTPUT SETTING
%OUTPUT can be PROBABILITY or TIMES
OUTPUT = 'PROBABILITY';
switch OUTPUT
case 'PROBABILITY'
%find the probability for specific times
PT=zeros(length(times),7);
PT(:,1)=P1(times+1);
PT(:,2)=P2(times+1);
PT(:,3)=P3(... |
classdef Master < handle
% mix-in class for dj.Relvar classes to make them process parts in a
% master/part relationship.
methods
function list = getParts(self)
% find classnames that begin with me and are dj.Part
info = meta.class.fromName(class(self));
clas... |
% demonstrate loops in matlab (pg 341)
for i=1:3,
disp('Hello');
end
i=0;
while i<3,
disp('Goodbye');
i=i+1;
end
|
% GRADED FUNCTION: nnCostFunction
function [J grad] = nnCostFunction(nn_params, input_layer_size, ...
hidden_layer_size, ...
num_labels, ...
X, y, lambda)
Theta1 = reshape(nn_params(1:hidden_layer_size * (input_lay... |
clear all ; close all ;
subs = {'sub_alex','sub_charest','sub_esteban','sub_fabio','sub_gab','sub_gabriella','sub_genevieve','sub_gina','sub_guillaume','sub_jeremie','sub_julie',...
'sub_katrine','sub_lisa','sub_marc','sub_marie','sub_mathieu','sub_maxime','sub_mingham','sub_patricia','sub_po','sub_russell','sub_sun... |
function [L,U,P,det,flag] = LUDecomp(A)
% LUDecomp realize LU decomposition determining L, U and P matrix.
% Inicializations
flag = true;
A_size = size(A);
% Check if decomposition is possible (A is a square matrix)
if A_size(1) ~= A_size(2)
flag = false;
return;
end
% Initializations
det = 1;
detL = 1;
detU... |
uploadPath = '/home/czt/research/data/nossdav15_Thunder Crystal/10月份上传能力及速度/';
uploadStructRaw = readDataFromFile( strcat (uploadPath, '1020') );
uploadDataRaw = uploadStructRaw.data;
contentPath = '/home/czt/research/data/output/video/';
contentStructRaw = readDataFromFile( strcat (contentPath, 'videoinfo.txt') );
co... |
%create action list for changin indices
actions = cell(8,1); %define actions in terms of strings.
actions{1} = [0, 1]; %right r
actions{2} = [0, -1]; %left l
actions{3} = [-1, 0]; %up u
actions{4} = [1, 0]; %down d
actions{5} = [-1, 1]; %top right ur
actions{6} = [-1, -1]; %top left ul
actions{7} = [1,-1]; %bottom lef... |
clc
clear
f = @(x) (x/(1+x));
x0 = input('Enter the value of initial limit x0=');
xn = input('Enter the value of final limit xn=');
N = input('Enter the total no of terms N=');
h = ((xn-x0)/N);
area = 0;
while(x0<xn)
area = area+(h/2)*(f(x0)+f(x0+h));
x0 = x0+h;
end
fprintf('Integration using trapezoidal is... |
function out = tasklist(extended)
% out = tasklist([extended])
%
% Read the current tasklist (-> TaskManager), only for Windows XP!!!
%
%
% The list is returned with the fields
% .name Name of process
% .pid Process ID (PID)
% .session Sessio... |
function [PLT_Be_0,PLT_Be_1,PLT_Be_2,PLT_Be_3]=PLT_Be(n_e,T_e);
global n_e_data_PLT_Be;
global T_e_data_PLT_Be;
global Table_PLT_Be_0;
global Table_PLT_Be_1;
global Table_PLT_Be_2;
global Table_PLT_Be_3;
PLT_Be_0=interp2(n_e_data_PLT_Be,T_e_data_PLT_Be,Table_PLT_Be_0,n_e,T_e,'spline');
PLT... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Trimming of imperfect hemispherical shell including point mass distributions %
% Fig.3 Mode shape of the imperfect shell %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
rng(200);
x = 2*rand(100,10)-1;
y = 2*x.^2 + normrnd(0,sqrt(0.1),100,10);
%g1-------------------------------------------------------
gmse = zeros(100,1);
for i = 1:100
sse = 0;
for j = 1:10
sse = sse + (1-y(i,j))^2;
end
gmse(i) = sse/10;
end
hist(gmse);
xlabel('Mean squared error');
ylabel('F... |
function [ v3 ] = Separation( Boids,numBoids,vmax,rSep )
%Separation etc
%Determine Nosey Neighbors
noseyNeighbors(1:numBoids)=struct('neighbors', Boids(1:numBoids));
noseyNeighborcount=zeros(1,numBoids);
for k=1:numBoids
for j=1:numBoids
dist=norm(Boids(k).pos-Boids(j).pos);
if dist<=rSep
... |
function ndat_cell = plotMultiLevelTree(gall,nodenames,mycolors,colorByLevel,opts)
% plotMultiLevelTree: Plots a multi-level tree with hard clustering.
%
% INPUT:
% - gall: [N L] array, N: # nodes, L: # grouping levels.
% each [N 1] column is a list of group indices at the level.
% - nodenames: [N 1] cel... |
function [N]=numConnect(F,V)
%Get patch face/vertex connectivity matrices
[~,IND_V]=patchIND(F,V,1);
%Count point connectivity
N=sum(IND_V>0,2); %Number of vertex neighbours |
function [ w, S ] = OS(X, y, s)
%OS Summary of this function goes here
% Detailed explanation goes here
X = X';
n = size(X, 1);
p = size(X, 2);
w = zeros(p, 1);
S = 1;
S = S';
eta = 0.1;
m = 1;
for i = 2:p
XS = X(:,S);
wS = w(S);
u = X(:,S)* w(S);
g... |
function [Uf]=fvc_general_interpolate(U, xC, xF, scheme, directionFlux)
% Gives a general face interpolated field from cell centered field
%
% [Uf]=fvm_general_interpolate(U, xC, xF, scheme, directionFlux)
%
% U: cell centered field
% Uf: face interpolated field
% xC: cell centers
% xF:... |
function [pepFull,pepB,pepY,pepC,pepZ] = pepMW(varargin)
%PEPMW: Calculate peptide molecular weight or its mass to charge ratio
%
% Synatx:
% [pepFull,pepB,pepY,pepC,pepZ]=pepMW(peptidestring,z)
%
% Input:
% peptidestring: peptide string containing modifications in <>, e.g.
% Y<s> denotes tyrosine sulfati... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2010 - 2015 Moon Express, Inc.
% All Rights Reserved.
%
% PROPRIETARY DATA NOTICE:
% The data herein include Proprietary Data and are restricted under the
% Data Rights provisions of Lunar CATALYST Space Act Agreement
% No. SAAM ID#... |
function [ output_args ] = CentreDeMasse( centres, masses )
%CentreDeMasse Calcul le centre de masse global des objets
% centres : Liste de vecteurs colonnes représentant les centres de masses
% ex : [ x1 x2; y1 y2; z1 z2]
% masses : Liste de masse des solides
%
% IMPORTANT : L'ordre des centre de mas... |
function net = train(net,x,y,opts)
m = 10000;
numbatches = m / opts.batchsize;
net.rl = [];
for i = 1:opts.numepochs
disp (['epoch' num2str(i) '/' num2str(opts.numepochs)]);
kk = randperm(m);
tic;
for l = 1 :numbatches
batch_x = ... |
function NewImage = resize_image_dimensions(Image)
if length(size(Image)) == 2
Image(:,:,1) = Image(:,:);
Image(:,:,2) = Image(:,:,1);
Image(:,:,3) = Image(:,:,1);
end
NewImage = Image;
end |
function result = f_mle(M,B,grp,txt,verb,pdf,iter,bs,tol)
% - maximum likelihood estimator of mixture proportions via an EM algorithm
%
% USAGE: result = f_mle(M,B,grp,txt,verb,pdf,iter,bs,tol)
%
% M = mixture data (= UNKNOWN SET) (rows = obs, cols = variables)
% B = baseline data (= TRAINING SET)
% g... |
clear
clc
close all
%%
% CHIRP params
% ===================================
% ===== User-defined paramaters =====
% ===================================
Pchirp = 0.2; % CHIRP Pulse Length (s)
sliceheight = 0.350; %mm
PreCPMGdelay = 40e-6; %s
nPts = 76; % # of acqu points
nEchoes = 64; % Echoes
tD = 8e-6; % dwell time... |
classdef ConnectomeAnalysis < Gridjob
%ConnectomeAnalysis Summary of this class goes here
% Detailed explanation goes here
properties
end
methods
%% Subclass Constructor: initialize standard parameters:
function this = ConnectomeAnalysis(varargin)
% Call superclass const... |
classdef Quat13_Model < MODEL_CLASS
% Discrete time model
properties
fig
end
methods
function obj = Quat13_Model(args)
obj= obj@MODEL_CLASS("Quat13_Model",args);
%obj.id = self.id
%
% 詳細説明をここに記述
if isprop(arg... |
function [xstar, vstar] = ipm(c, A, b, mu, x_init, gamma, epsilon)
OPTIONS = [];
[m, n] = size(A);
%bring to standard form
% interior point method for LPs of the form min c'*x : A*x <= b
s = b - A*x_init; % Assegno valore alle slack in funzione del punto iniziale x_init
x = [ x_init ; s ]; %... |
function testPathStorage
% A = (th1_B, th2_B2, goal_iter, ToP)
% th1_B = theta1 * (num_theta/2pi)
% where num_theta = number of thetas taken in discretization
% and theta1 = first angle for initial belt configuration
% goal_iter = index of goal configuration
% where num_x = number of discr... |
%% Beaglebone matlab interface test
clear,clc
t = tcpip('192.168.100.107',6969);
fopen(t)
figure(1)
data = zeros(50,4);
for i=1:1000
%datain = strcat(num2str(randi(1000)),',',num2str(randi(1000)),',',num2str(randi(1000)));
datain = fgets(t);
data = [data(2:end,:) ; str2num(datain)]
plot(... |
function [output1] = dJb_LeftRotationJoint(var1,var2)
if coder.target('MATLAB')
[output1] = dJb_LeftRotationJoint_mex(var1,var2);
else
coder.cinclude('dJb_LeftRotationJoint_src.h');
output1 = zeros(6, 20);
coder.ceval('dJb_LeftRotationJoint_src' ...
... |
clc
close all
clear
fo = 1; %freq1 do sinal
fs = 10; %freq de amostragem
Ts = 1/fs; %periodo de amostragem
L = 20;
n = 0:(L-1);
t = Ts*n;
x = sin(2*pi*fo*t+pi/2)
%Gráfico para o sinal discretizado
figure
stem(t,x)
xlabel('t')
ylabel('x(t)')
grid
title('Sinal discretizado');
%y = 0.9048
%... |
% 带通滤波器
% x 原始信号
% fs 采样频率
% lf 低通截止
% hf 高通截止
function [xx] = mybpf(x,fs,lf,hf)
N = length(x);
len=N;
F = fft(x);
L = round(lf/fs*len);
H = round(hf/fs*len);
%dd = len-cc;
F(1:L)=0;
F(N-L+2:N)=0;
F(H:N-H+2)=0;
aa =F;
xx = ifft(aa);
end |
function features = conseqopt_features(data,S,choices)
% data is in common format
% S is [N,K]
% choices: struct with fields
% ('append_lib_contexts','append_down_levels','append_type')
% features is cell array length N. features{i} is [L,d]
% this function is for data with environment + element features
% does not ma... |
classdef IDassumptions < handle
%% restrictions class describes restrictions on IRF in SVARs
%
% This version: 3.21.2017
% Last edited by Bulat Gafarov
%%
properties (Access = public)
shockLabel ='UnknownShock';
end
properties (Access = private)
... |
function poolbur_listbox_callback(src,~,hfig)
% global knum;
CmsCoreProp=get(hfig,'userdata');
axes(CmsCoreProp.handles.pool_axes);
% toplistvalue=get(CmsCoreProp.handles.poolbur_listbox,'ListboxTop');
ival=get(src,'Value');
CmsCoreProp.pool_j=CmsCoreProp.pool.s(ival).pos(2);
CmsCoreProp.pool_i=CmsCoreProp.pool.s(... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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:/... |
x = [-1 0.2 -0.7 0.4 0.9 1 -0.3 -0.5 0.5 -0.8];
w = [0 0.1 0.7 0.2 0.8 0.3 0.9 0.4 1 0.5];
b = 0;
N = size(x);
nsum = 0;
for i = 1:N(2)
v(i) = w(i) * x(i);
nsum = nsum + v(i);
end
v_out = nsum+b;
%a = 1;
%c = exp(-a*v_out);
%phi = 1/(1+c);
z = -8;
for i = 1:160
a(i) = z;
c(i) = exp(-a(i)*v_out);
p... |
classdef SoftmaxLayer < nnet.cnn.layer.Layer
% SoftmaxLayer Softmax layer
%
% A softmax layer. This layer is useful for classification problems.
%
% SoftmaxLayer properties:
% Name - A name for the layer
%
% Example:
% Create a softmax layer.
... |
% t-domain wave eqn BIE: scattering (exterior Dirichlet BVP). Convergence.
% paper fig version, Barnett 1/14/19.
% dx coupled with dt, convergence at point (x0,0,z0).
run('../../../bie3dsetup');
% fsparse crashes for big probs (on desktop not laptop)
rmpath ~/matlab/stenglib/Fast
clear;
Ttot = 10.0; % total time ... |
close all
clear all
patt = '/home/mmoriche/channel/cont99.%spxz'
%x0 =
%xf =
%y0 =
%yf =
%z0 =
%zf =
% ux
filename = sprintf(patt, 'u');
[time,x,posy,z,wkux]=fields.readfieldxz(filename);
%uxmean = zeros(length(posy),1);
%for iy = 1:length(posy)
%auxarray = wkux(iy,:,:);
%uxmean(iy) = mean(auxarray(:))... |
function [ best_w, best_lambda, min_err ] = RegQuardLossFunc( X,y )
%REGEMPRISK Summary of this function goes here
%
% solve the regularized empirical risk
% min |X*w - y|^2 + \lambda |w|^2
%
% X nsample x nfeat
% Y nsample x 1
% using leave-one-out cross-validation
[nsample,nfeat] = size(X);
K ... |
function MLEMDumpExtraction(FileNames,iSims)
% Read in interaction data from Polimi dump file for the mask
fid = fopen(FileNames.DUMN1{iSims});
Dumn1Data = reshape(fscanf(fid, '%f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f\n'),16,[])';
fclose(fid);
% Save variable to file
save(fullfile(pwd,['Dumn1Data' num2str... |
function Henon = make_Henon()
Henon.ode = @Henon_ode;
Henon.fun = @Henon_fun;
Henon.dfdx = @Henon_dfdx;
Henon.dfdp = @Henon_dfdp;
Henon.d2fdx2 = @Henon_d2fdx2;
Henon.d2fdxdp = @Henon_d2fdxdp;
end
function fnval = Henon_ode(times,y,p,more)
r = y;
r(1) = 1- p(1)*y(1)^2 + y(2);
r(2) = p(2)*y(1);
fnval = ... |
% refraction_02.m
% REFRACTION [2D]
% Animation of the refraction of a travelling wave
% Ian Cooper
% School of Physics, University of Sydney
% email: ian.cooper@sydney.edu.au
% https://d-arora.github.io/Doing-Physics-With-Matlab/
% 170529
clear all
close all
clc
tic
% Setup for saving images (im) ================... |
pkg load geometry
function degrees = compute_degrees(A)
degrees = normalizeVector(sum(A)) * size(A)(1);
endfunction
A = load("double-house.txt");
degrees = compute_degrees(A)
function avgdegree = compute_avgdegree(A)
avgdegree = mean(sum(A));
endfunction
avgdegree = compute_avgdegree(A)
|
function vals = streamRange(s,start,nElem)
% STREAMRANGE Cut a range of a stream
s1 = s;
for i=1:start-1
s1 = streamCdr(s1);
end
vals = cell(1,nElem);
for i=1:nElem
vals{i} = streamCar(s1);
s1 = streamCdr(s1);
end
|
function [] = write_2_var( V, params )
nq = params.nq;
mg = params.mg;
nb = params.nb;
u0sm = V(1 : params.nvel_tot);
u0bg = engorge( u0sm, params );
u0 = reshape( u0bg, nq, mg );
[~,~] = system('rm output/*.chd');
[~,~] = system('rm output/q_init.var');
fileID = fopen('output/q_init.var','w','b');
for j ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.