text stringlengths 8 6.12M |
|---|
function varargout = MFSDA_GUI(varargin)
%figure1 MATLAB code file for figure1.fig
% figure1, by itself, creates a new figure1 or raises the existing
% singleton*.
%
% H = figure1 returns the handle to a new figure1 or the handle to
% the existing singleton*.
%
% figure1('Property','Value',...)... |
function noprealloc
N = 2000;
for ii = 1:N
for jj = 1:N
A(ii,jj) = ii*jj;
end
end
end
|
function result4=rhs4(x,y)
result4=(1-x^2)*y-x;
end
|
clear;
addpath(genpath('/home/scw4750/github/global_tool'));
load('five_lm2_data.mat');
% img=imread('/home/scw4750/github/IJCB2017/liufeng/without_3d/probe_cropped_by_algorithm/image/BRL_F0001_01_01_000.jpg');
% brl=imread('cylindrical_map/BRL_F0001.jpg');
% result=regAffineImage(brl,t);
% % hold off;close all;
% sub... |
function InitializeData(handles)
global gmSEQ
gmSEQ.Repeat=str2double(get(handles.Repeat,'String'));
gmSEQ.Passes=str2double(get(handles.Passes,'String'));
if get(handles.bAverage,'Value')
gmSEQ.Average=str2double(get(handles.Average,'String'));
else
gmSEQ.Average=1;
end
gmSEQ.SweepParam=gmSEQ.From:(gmSEQ.T... |
% mpNRsun.m
% Calculation ENERGY OUTPUT OF SUN
% Total energy from core of Sun from proton-proton cycle
% Energy output of Sun per year
% Lifetime of the Sun
% DOING PHYSICS WITH MATLAB:
% https://d-arora.github.io/Doing-Physics-With-Matlab/
% Documentation
% http://www.physics.usyd.edu.au/teach_res/mp/doc/mp... |
function [predictions_clean] = generate_predictions(im_red_hue_sat, threshold, lower_bound, upper_bound)
im_detection = (im_red_hue_sat > threshold);
predictions_raw = regionprops(im_detection, im_red_hue_sat, 'WeightedCentroid', 'Area');
predictions_clean = predictions_raw([predictions_raw.Area] > low... |
function def_bell(m)
% def_bell -- Called by WLBrowser
% Usage
% def_bell(m)
%
%
% Part of WaveLab Version 802
% Built Sunday, October 3, 1999 8:52:27 AM
% This is Copyrighted Material
% For Copying permissions see COPYING.m
% Comments? e-mail wavelab@stat.stanford.edu
%
|
% MTLT1VC.M
% For setting T1 values (to Variable)
% Called by MTLTM
% Set flags and backgrounds *****
if get(mtluit1v,'Value') == 1 ;
mtlt1v = str2num(get(mtluit1vv,'String')) ;
set(mtluit1i,'Value',0,'BackGroundColor',[.5 .5 .5]) ;
set(mtluit1v,'Value',1,'BackGroundColor','white') ;
mtlt1icv = 0 ;
set(mtluit1vv... |
function a = g_cutstruct(a,ii)
% function a=cutstruct(a,ii)
%
% reduce array size in structure
% get length of all fields
if isstruct(a)
fnames = fieldnames(a);
for n=1:size(fnames,1)
dummy = getfield(a,fnames{n});
[ly,lx]=size(dummy);
fieldlength(n) = max([ly,lx]);
end
else
error('first argument ... |
for k=1:5000; ra=ceil(31*rand(31,1));
xr=x3(ra);yr=y3(ra);
cc=corrcoef(xr,yr);rhr(k)=cc(1,2);
sl(k)=rhr(k)*std(yr)/std(xr);
in(k)=mean(yr)-sl(k)*mean(xr);
end
% a "for" loop is done with the variable k running through every single integer
% from 1 to 5000 inclusive; the results are stored in 5000-strong ... |
% Example 2.3
% from Parameter Estimation and Inverse Problems, 3rd edition, 2018
% by R. Aster, B. Borchers, C. Thurber
% make sure we have a clean environment
clear
rand('state',0);
randn('state',0);
% Generate the x and y values
x=(25:3:97)';
ytrue=10*x;
N=length(x);
% compute the noisy y values
y=ytrue+0.05*rand... |
%
% This code accompanies the paper:
%
% "Partial Functional Correspondence"
% Rodola, Cosmo, Bronstein, Torsello, Cremers
% Computer Graphics Forum 2016
%
% Please cite the paper above if you use this code in your research.
%
% Written by Luca Cosmo
%
classdef mumford_shah_Cu < handle
properties (Hidden = true, Se... |
% https://www.allaboutcircuits.com/technical-articles/digital-signal-processing-in-scilab-how-to-decode-an-fsk-signal/
% mducng, SoC team, G2touch
% For MPP2.0: Erase or Right click
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc; clear;
close all;
fbase = 25007;
f1 ... |
% example demonstrating the use of a stripline terminated by the pml
% (c) 2013 Thorsten Liebig
close all
clear
clc
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
physical_constants;
unit = 1e-6; % specify everything in um
SIW.FL=5e3;
SIW.LX = 10e3;
SIW.LY = 600;
SIW.CT=36e-6;
SIW.CC=41e6... |
function [Out,rowHead,colHead, Settings] = Pivot(In,Fun,noHeaders,Pad)
% PIVOT Group a flat dataset (m by 3 matrix) into a pivot table
%
% PIVOT(IN) Other inputs by default
% - In: single/double or cell (2 D). Size m by 3: two header columns and a value column.
% -- 1st column --> Row heade... |
%minBoundBox: For a binary mask and image return an image and mask
%containing the smallest bounding box around that mask
%
%
function [mask, im, range] = minBoundBox(mask, im)
x = sum(mask,2)>1;
xMin = find(x==1, 1, 'first');
xMax = find(x==1, 1, 'last');
y = sum(mask,1)>1;
yMin = find(y==1, 1, 'first')... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TITLE: Find circuit with optimal switch-like behaviour starting from a
% library of 4 transcripts and 8 promoters. Hill Kinetics.
% REF: Otero-Muras I and Banga JR 2014, BMC Systems Biology
% Single Objective
% Unconstrained proble... |
function [f, gradients] = jacobian_convsegment_attachment(p, c1, c2, r1, r2, gradients)
for var = 1:length(gradients)
dc1 = gradients{var}.dc1;
dc2 = gradients{var}.dc2;
dp = zeros(size(dc1));
dr1 = zeros(1, size(dc1, 2));
dr2 = zeros(1, size(dc2, 2));
%% u = c2 - c1; v =... |
function newLabel = annealingfcn(optimValues, problem, numLabel)
% Annealing scheme is similar to annealingfast, where the number of
% updated labels is proportional to the current temperature.
newLabel = optimValues.x;
initPercent = 0.1;
numUpdate = max(1, round(problem.nvar * initPercent / 100));
... |
function renameBatchFilesSubdirs(directory, fnSearchStr, oldchar, newchar, dryrun)
% change (batch) file names in every subdir of a directory
%
% Parameters
% ----------
% directory : str
% path to file to rename
% fnSearchStr : str
% string specifier to find files to rename
% oldchar : str
% string to replace ... |
function y = digamma(x)
%DIGAMMA Digamma function.
% DIGAMMA(X) returns digamma(x) = d log(gamma(x)) / dx
% If X is a matrix, returns the digamma function evaluated at each element.
% Reference:
%
% J Bernardo,
% Psi ( Digamma ) Function,
% Algorithm AS 103,
% Applied Statistics,
% Volume 25, Number 3... |
%*******************************************************************************
%* Program: clear_all_except
%* Description: clears all variables except ones specified.
%* Author: Andrew Kercher
%-------------------------------------------------------------------------------
%****************************************... |
function [fixed_dofs,fixed_nodes] = set_dirichlet_boundary(sys_vars,mesh_input_file,define_BC,dof)
n_dim = sys_vars.n_dim;
physics = sys_vars.physics;
if strcmp(physics,'thermo_elastic')
T0 = sys_vars.mat_para.T0;
end
%% OUTPUT VALUES
fixed_dofs = [];
fixed_nodes = [];
fixed_dofs_eboun = [];
fi... |
clearvars;
close all;
clc;
I = imread('lena.bmp');
fI = fftshift(fft2(I));
figure();
subplot(2,2,1);
imshow(I);
subplot(2,2,2);
imshow(fI);
AA = abs(fI);
AA = log10(AA+1);
subplot(2,2,3);
imshow(AA,[]);
F = angle(fI.*(AA>0.0001));
subplot(2,2,4);
imshow(F,[]);
[f1,f2] = freqspace(512, 'meshgrid');
Hd = ones(51... |
%
% min 1/2 \| A x - y\|^2 + 1/2 rsL2 * \|x\|_2^2 + \|lambda .* x\|_1
%
% @autor Jonathan Pokrass
function [x, funVal, ValueL] = solveLSL1(A, y, lambda, varargin)
%calc solution size
[m, n] = size(A);
solm = n;
soln = size(y, 2);
defaultOpt = [];
defaultOpt.rsL2 = 0;
defaultOpt.x0 = zeros(solm, soln)... |
close; clear; clc;
globalpar;
index = 5;
x_sim = zgrid(index);
for i = 1:length(piz)
P_dist = [P_dist, cumsum(piz(i, :))];
end
P_dist = transpose(reshape(P_dist, Nz, Nz));
for i = 1:sample_size - 1
[sample, index] = cdf_randomdraw(P_dist(index, :), zgrid);
x_sim = [x_sim, sample];
end
plot(x_sim); |
function x = gsamp(mu, covar, nsamp)
%GSAMP Sample from a Gaussian distribution.
d = size(covar, 1);
mu = reshape(mu, 1, d); % Ensure that mu is a row vector
[evec, eval] = eig(covar);
coeffs = randn(nsamp, d)*sqrt(eval);
x = ones(nsamp, 1)*mu + coeffs*evec';
|
function JitteringBackTex_RFObj(jitterSeq, checkersN, ...
waitframes, framesN, objContrast, backTex, pdStim)
% Screen is divided in background and object.
% background will display the given texture and will jitter it around
% as specified by jitterSeq.
% Object will be random binary checkers.
%... |
function test_suite = test_projPointOnPlane
%TEST_PROJPOINTONPLANE Test case for the file projPointOnPlane
%
% Test case for the file projPointOnPlane
% Example
% test_projPointOnPlane
%
% See also
%
%
% ------
% Author: David Legland
% e-mail: david.legland@grignon.inra.fr
% Created: 2013-07-03... |
function [ chi ] = RTeff( gas ,t_ch,t_dis)
%RTeff Round-trip efficiency
% Adds up the contributions of the several stages to compute the round
% trip efficiency
Work_in_ch = 0;
Work_out_dis = 0;
[~,n1] = size(gas.stage);
for i=1:n1
Work_in_ch = Work_in_ch - gas.stage(1,i).w*gas.state(1,i).mdot*t_ch;
Work_... |
classdef BeamPositionMonitor < handle
% BeamPositionMonitor class
%
% Properties:
% name
% buffer
% aperture
%
% Methods:
% Track
% ResetBuffer
% properties (Constant)
% length = 0; % length = 0 metres (constant)
% end % properties (Constant)
... |
function [channel] = CheckConnect( row,col,channel )
%UNTITLED7 Summary of this function goes here
% Detailed explanation goes here
if(channel(row,col)>0)
if(Adjacent_1_Num(row,col,channel)==0)
channel(row,col)=0;
else if(Adjacent_1_Num(row,col,channel)==1)
channel(row,... |
ft_dir = [app_dir 'fieldtrip/'];
% Load Head Model (vol)
load([ft_dir 'template/headmodel/standard_bem.mat'])
headmodel = vol;
% Load Elec postitions
elec = ft_read_sens([ft_dir 'template/electrode/standard_1020.elc']);
% !!! will need to select my 64 electrodes
% !!! check if I need to realign these!
elec_align = ... |
t = [0:0.01:0.98];
y1 = sin(2*pi*4*t);
subplot(1,2,1); % make the figure a one x two grid, access the first element
plot(t, y2 ,'r')
subplot(1,2,2); % make the figure a one x two grid, access the second element
plot(t, y1)
axis([0.5 1 -1 1]) %set range for the most recent plot
|
function outputTransitionTableNew(dataName, modelName, strategyList, chains, CIflag, CIbounds)
% OUTPUTTRANSITIONTABLE Print to file a latex table that gives the
% transition probabilities between strategies
% outputTransitionTable(dataName, modelName, strategyList, pi)
nStrategies = numel(strategyList);
pi = get_... |
function e = sibling_side_unpaired(f_geno, m_geno, freq)
% ibd not because of sharing parental alleles
% farther sharing
% not yet considering sharing between one individual
% a1:a2, a2:b2
% a1:a2, b1:a1
ibd1 = 2;
% a1:a2, a2:a1
ibd2 = 3;
ibs0 = 1;
ibs1 = 2;
ibs2 = 3;
ibs3 = 4; %missing
% change this, 1/2 does no... |
function x = nyquist()
rate = 2*5*pi;
disp("Nyquist rate : "+rate);
%printing nyquist rate
t_fine=0:0.0001:2;
x = cos(5*pi*t_fine);
y=partc(0.1);
%ts = 0.1s
subplot(131);
plot(t_fine,y,'g',t_fine,x,'r');
title('Aliasing for Ts=0.1');
xlabel('Time');
ylabel('Amplitude');
hold on;
t=0:0.1:2;
b = cos(... |
function M1=vary(M,t,T)
%功能:变异函数。M为待变异量,t为变异代数,T为总的代数。
%变异时采用随代数变小的变异方法,且变异后仍然满足约束条件
global bwMax;
global boMax;
global A;
r1=rand();
r2=randi([0,1],1,1);
aw=M(1);
bw=M(2);
bo=M(3);
%若r2为0,则向大处变异,并保证不超过最大值,若r2为1则向小处变异,并保证不小于0
if(r2==0)
bw1=bw+(bwMax-bw)*r1*(1-t/T)^2;
elseif(r2==1)
bw1=bw-bw*r1*(1-t/T)^2;
end
r1... |
% |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
% INFORMATION
% |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
%
% The code below can be run on other processes data (like the normalized
% EEG data). Just be sure to specify the variable ... |
%% =======================================================================%
% findspuds.m %
%=========================================================================%
% Function: findspuds %
% Author(s): ... |
clear all
close all
% load lattice
load /machfs/liuzzo/ESRF/StorageRing/LATTICE/AT/ESRF_fortol.mat
algedir='/machfs/liuzzo/EBS';
algeactfile=fullfile(algedir,'Actual_Position_Simu.xlsx');
rerr=SetESRFAlgeAlignmentError(ring,algeactfile,'',1);
figure('units','normalized','position',[0.1 0.4 0.65 0.35])
atplot(r... |
function newDict = update_Sym(data,dict,alpha,SPGD_opts)
%SGD_SYM Update the symmetric dictionary via SGD
%
% INUTS
% data - {} LDS data
% dict - {} LDS dictionary
% alpha - [] Sparse codes
%
% OUTPUTS
% newDict - {} Updated dictionary
% implemented by Wenbing Huanng, 20... |
function [res, renyiTab] = makeTable(particleIn, njetsIn, doData)
% function res = makeTable(particleIn, njetsIn, doData)
%
% particleIn: 1 ... ele, 2 ... muo
% njetsIn: 2,3,4
% doData:
% data{1} = {'Train + Test vs. Yield', 'train',1,0};
% data{2} = {'Train vs. Test', 'val',1,2};
% data{3} = {'Train + ... |
function [u_init,x,y]=u0(npts)
%Define domain
domain = [0 1 0 1];
nX = npts;
nY = nX;
hx = (domain(2)-domain(1))/(nX-1);
hy = (domain(4)-domain(3))/(nY-1);
x = (0:hx:1);
y = (0:hy:1);
[X,Y]=meshgrid(x,y);
u_init = -1*ones(nX,nY);
for i=1:nX
for j=1:nX
if (norm([X(i,j) Y(i,j)]-[0.35 0.35],10)<=0.17 || n... |
function [M S W l rate time] = testEM2(g)
%функция производит тестирование и оценку качества ЕМ алгоритма на
%двумерных данных
%Если g == 1 происходит построение графиков
%параметры модельных данных
n = 1000;
p = 1/3;
mu1 = [0 0];
mu2 = [4 5];
sigma1 = [1 0; 0 0.9];
sigma2 = [1 0; 0 1.5];
%генерация данных
X1 = mvnrn... |
clear all;
load('HCTSA_N.mat');
load('best_20_ops.mat');
idx = kmed.idx;
for i = 1:length(chosenOps)
memberList(i).opIdxs = find(idx == i);
memberList(i).opName = chosenOps(i).Name;
end
for i = 1:length(memberList)
opVec = kmed.C(i,:);
mOps = memberList(i).opIdxs;
corrs = [];
for j = 1:... |
%patient layer timePoint width height
%001A 20 40 256 256
%002A 24 50 128 128
%004B 24 90 128 128
%028B 20 60 128 128
%033A 20 60 12... |
function [ X_new ] = f_k(X,U,Ts,stop_angle)
% x=[u1,u2,phi, theta, dphi,dtheta,w1,w2]';
% y=[phi, theta, dphi,dtheta,w1,w2]'
g=9.81;
l1=0.1995;
l2=0.1743;
ml=0.280;
h=0.0298;
mw=0.158;
lw=0.090;
m1=0.3792;
m2=0.1739;
T1=1.1;
T2=0.33;
k1=1e-2;
k2=1.39e-2;
C1=2.50e-5;
C2=1.58e-6;
D1=2.90e-7;
D2=1.76e-7;
m=ml+m1+m2+mw;... |
function [ N, c, flatwin_c, d_c, l, k, B, prm_mat, filename_prm, R_S ] = define_param( )
N = 16;%偶数.奇数にする場合は
c = 1.5;% flat window function のパラメータ delta の比例定数.p.4 4.1 Inner Loop
flatwin_c = 1.2;% flat window function の台の大きさを決める比例定数.p.4 4.1 Inner Loop
d_c = 0.005;%d の比例定数.
l = 4;%L の比例定数.
k = 2^(N/2-1);% k
B = 2^... |
clc
clear all
close all
% add fieldtrip in path
restoredefaultpath
%addpath D:\YananSun\MEG110\fieldtrip-20180825; % change path if necessary
addpath C:\Work\fieldtrip-20180825; % change path if necessary
ft_defaults
fprintf('\nAdd Fieldtrip into path.\n')
% add scripts full path
%scriptpath='D:\YananS... |
function [sim_data] = meeg_sim_landmark(sim_data,bands)
%% Parameters
F_data1 = sim_data.functional.data1.F;
Svvdata1 = sim_data.functional.data1.Svv;
Lvj = sim_data.structural.L_data13D;
No = length(Lvj);
W = speye(No);
Ldata2 = sim_data.structural.L_data23D;
[S... |
% This is a demo showing how to use the RTBox as an analog-to-digital
% converter to check the timing and relative brightness of light. The two
% optional input are background color and the new color you like to change
% to, both from 0 to 255.
%
% You need to connect the light sensor to the light port, and attach it... |
%X1,X2,Y =>last hour,now,next hour
X1=zeros(5280,1);%5280=240X22
X2=zeros(5280,1);
Y=zeros(5280,1);
m=1;
size_one_row=length(csvread('train.csv',10,3,[10,3,10,24]));
for i=0:18:239*18
X1(m:m+size_one_row-1,1)=csvread('train.csv',10+i,3,[10+i,3,10+i,24])';
X2(m:m+size_one_row-1,1)=csvread('train.csv',10... |
function v_t=p_HMS_Reduced_game(clv,x,str)
% P_HMS_REDUCED_GAME computes from (v,x) all Hart/Mas-Colell reduced
% games on S at x of game v. Using Matlab's PCT.
%
% Usage: v_t=p_HMS_Reduced_game(clv,x,str)
%
% Define variables:
% output:
% v_t{:,1} -- All Hart-MasColell reduced games w.r.t. x.
% v_t{:,2} -- The cor... |
function rundynam
% This program is primarily based on examples from
% 'Advanced Mathematics and Mechanics Applications
% Using MATLAB', 3rd Ed., by Howard Wilson, Louis
% Turcotte, and David Halpern, CRC Press, 2002.
opt=100;
while 1 %opt~=13
clc, close, opt=listcases;
switch opt
case 1
di... |
function obij = getOpenBoundaryHorizontalGrid(gridDir, model, obij)
% -----------------------------------------------------------------------------
% Input structures or cell-array-of structures:
%
% gridDir : A string that points to the grid-info bindary files.
% model : Structure giving open bounda... |
% speed first
clear, clc
iou_target = 70;
models = {
'scannet_m8_rep1_residualFalse-000000470';
'scannet_m8_rep2_residualFalse-000000560';
'scannet_m8_rep2_residualTrue-000000530';
'scannet_m16_rep1_residualFalse-000000530';
'scannet_m16_rep2_residualFalse-000000570';
'scannet_m16_rep2_resid... |
clear all
% Desemnarea variabilei x ca si simbolica
x=sym('x');
% Calcularea celor trei limite
lim0=limit(1/x,x,0)
lim0_minus=limit(1/x,x,0,'left')
lim0_plus=limit(1/x,x,0,'right') |
classdef Node < handle
properties
Position, Parent, Cost, Line, Children, IsGoalNode
end
methods
function obj = Node(position, parent, cost, line_handle)
obj.Position = position;
obj.Parent = parent;
obj.Cost = cost;
obj.Line... |
function [] = linLinear_Classification_picture(N,e)
data1 = rand(1,N);
data2 = unifrnd (0.01,1,1, N);
for i = 1:N
x1(i) = data1(i);
y1(i) = 3*data1(i) + 3 * data2(i);
end
plot(x1,y1,'rs');
hold on;
for i = 1:N
x2(i) = data1(i);
y2(i) = 3*data1(i) - 3 * data2(i);
end
plot(x2,y2,'*');
hold... |
function imu_new = get_error(imu,Pos)
display([' Calculating error for ' imu.name]);
imu_new = imu;
l = size(imu.x_h,2);
imu_new.error = zeros(4,l);
% Calculate error for each axis
imu_new.error(1:3,:) = imu.x_h(1:3,:) - Pos';
% Calculate total error
imu_new.error(4,:) =... |
function [timestamps] = readtimestamps(filename)
fileID = fopen(filename,'r');
timestamps = [];
d2s = 24*3600;
while(~feof(fileID))
day = fscanf(fileID,'%s',1);
time = fscanf(fileID,'%s',1);
t = d2s*datenum(time);
timestamps = [timestamps;t];
end
end |
% A. Engler, Vorlesung FHV, 30.04.2016
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Leistungsberechnung
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for n=1 : SAMPLES
P(n) = 0.5*(u_alpha(n)*i_alpha(n)+u_beta(n)*i_beta(n));
Q(n) = 0.5*(u_beta(n)*i_alpha(n)-u_alpha(n)*i_beta(n));
end
h7 = ... |
function mat = rndUnitRowMatr(nrows, ncol)
mat = rand(nrows, ncol);
colsum = sum(mat,1);
mat = bsxfun(@rdivide, mat, colsum);
end |
%======== Effect of ILD level on the discharge pattern of chopper LSO cells =====================
%** model : LSO_synaptic_input.hoc ******
% 10/2004
% This script loads NEURON output files and plot PSTHs and spike interval statistics in response to binaural stimulation.
%***************** model specs **... |
function [ newClasses ] = classesToCell( classes, featureCell )
%classesToCell Summary of this function goes here
% Detailed explanation goes here
ind = 1;
newClasses = cell(size(featureCell,1),size(featureCell,2));
for m = 1:length(featureCell)
newClasses{m} = zeros(1,17);
eventStart = ind;
eventEnd = i... |
function [P,iter]= jacobi2(G,P,delta,maxIt)
%Input - G is the nonlinear system saved in the M-file G.m
% - P is the initial guess at the solution
% - delta is the error bound
% - maxIt is the number of iterations
%Output- P is the seidel approximation to the solution
% - iter is the number of itera... |
function varargout = DlgGeom(varargin)
% DLGGEOM MATLAB code for DlgGeom.fig
% DLGGEOM, by itself, creates a new DLGGEOM or raises the existing
% singleton*.
%
% H = DLGGEOM returns the handle to a new DLGGEOM or the handle to
% the existing singleton*.
%
% DLGGEOM('CALLBACK',hObject,eventData,... |
clc; clear;
k = 1;
for k=5:5:30
name = ['table_', num2str(k), 'cm_'];
figure;
for i=1:3
data = load([name, num2str(i), '.txt']);
[~,ia] = unique(data(:,3));
data = data(ia,3:4);
time = data(:,1);
origin = data(:,2);
offset = median(origin(1:500)... |
function I_array = partition(I,tol)
% partition an interval
%
% Syntax:
% I_array = partition(I,tol)
%
% Inputs:
% I - interval matrix
% tol - tolerance for terminating partitioning
%
% Outputs:
% I_array - an array of interval matrices after partitioning
% Author: Weiming Xiang
% Written: 02/25... |
function varargout = integrator_n_out(varargin)
%INTEGRATOR_N_OUT Get the number of integrator outputs.
%
% int = INTEGRATOR_N_OUT()
%
%
%
%
[varargout{1:nargout}] = casadiMEX(787, varargin{:});
end
|
% Computing variance based upon ABM means and the MLE based upon ABM
% variance
BFR_Young=dlmread('BFR_Raw_Young.txt');
BFR_Old=dlmread('BFR_Raw_Old7.txt');
BFR_Animal=[BFR_Young;BFR_Old];
MLE=0.;
for iprot=1:nprot
var0=0.;
for j=1:nnz(BFR_Animal(iprot,:))
var0=var0+(BFR_Animal(iprot,j)-BFRPeri(... |
function [trainImages, trainLabels, testImages, testLabels] = traintestMNIST(labels, ntrain, ntest)
%traintestMNIST Reads the MNIST datasets.
%
% [trainImages, trainLabels, testImages, testLabels] = traintestMNIST(labels, ntrain, ntest)
% Reads the MNIST dataset from the mnist_all.mat file.
% Then the select... |
%Velocity vs time curve
clear
close all;
prompt = 'Enter the file name to be imported : ';
str = input(prompt,'s');
[data_sheet,~,data_sheet_raw] = xlsread(str);
% x and y axis for graph plot
for i = 2:size(data_sheet)
if(data_sheet(i,5)==data_sheet(i-1,5))
x_axis = datetime(data_sheet_raw(601:1376,2),...
... |
% arma.EX1 generated on Tue Apr 15, 2014 12:54:17 PM by xcpp
%
% Armadillo example 2: Computes the determinant and inverse of a
% matrix.
%
% parameters:
%
% `A`: input matrix
%
function varargout = ex1(A, varargin)
tdump = excentury.dump.textdumper;
tdump.dump(A, 'A', {'T', {'R', '8'}... |
function homescreen()
axis equal;
%axis off;
% For BG
%Creates a background;
hold on;
rectangle('Position',[0 0 60 120], 'FaceColor', 'w');
rectangle('Position',[0 0 20 30], 'FaceColor', 'k');
rectangle('Position',[40 0 20 30], 'FaceColor', 'k');
rectangle('Position',[0 60 20 30], 'FaceColor', 'k');
rectangle('Positi... |
load('initial_DT_MB_distribution5.mat', 'density_part_ratio')
density_part_ratio=0.25*density_part_ratio;
load('initialG_DT_MB_all_pre_collapse.mat')
alphas_psi=interp2(scale_X,scale_Z,psi_norm_XZsmall_map',alphas_pos_x,alphas_pos_z);
volume_flux_psi(1)=0;
volume_flux_psi(2:Nradial)=volume_flux(2:end)-volume_flux(1:e... |
function docNode=add_boundary_conditions_support_FEB(docNode,FEB_struct)
% %function docNode=add_boundary_conditions_support_FEB(docNode,FEB_struct)
%
%
%
% CHANGE LOG:
% 29/08/2012, Kevin Mattheus Moerman
% 02/12/2013, Kevin Mattheus Moerman, added prescribed displacement boundary conditions
% 05/15/2014, Ke... |
function [Px, Py, X, Y] = evaluate_pressure_gradient(solution, varargin)
%EVALUTATE_PRESSURE evaluates the pressure at either regular grid over the
%reference cell or at specified target points. Uses the stresslet identity
%to identify points inside the domain. Supports periodic and non-periodic
%domains, and uses spe... |
function [ result ] = inverseGaborTransform( transform,windowFilter )
result = zeros([size(transform,1),size(transform,2)]);
for i = 1:size(transform,1)
for j=1:size(transform,2)
temp1 = transform(i,j,:,:);
temp1=squeeze(temp1);
temp = ifft2(temp1).*(circshift(windowFilter,[i-1,j-1]));
... |
function [delXO, delYO] = ObsDelta(vx, vy, ox, oy, obsRad, obsS, beta)
% This function gives delX, delY of repulsion caused by the obstacle
inf = 10;
dObs = sqrt((ox-vx)^2 + (oy-vy)^2); % distance bw obstacle and current position
thetaO = atan2((oy-vy),(ox-vx)); % angle between goal and current position
% de... |
clear
T=10000;
var_input=1;
u=0+sqrt(var_input).*randn(1,T);
save('consistency_input_data.mat','u','var_input') |
[X, T] = dataSample(@f22, 2, 2000);
plotData(X, T);
|
function [Vpp, Lat, Raw, parms] = load_mep(dataset, varargin)
% turn of warning, as we cant load all objects in mat
warning off
curdir = pwd;
cd ([fileparts(mfilename('fullpath')), filesep,'lz'])
load(dataset, 'obj');
cd (curdir);
warning on
% set arguments
args = struct('c... |
clc;close all;clear;
I=imread('hard.bmp');%读取图片
lamda=2;
num=4;%极值数量
J=rgb2gray(I);%灰度化
%I=myhistf( J,1.5,600 );
subplot(211)
imshow(I)
hold on
[m,n]=size(I);
% Sy=[-1,-1,-1;1,1,1];
% Sx=Sy';
% Syn=[1,1,1;-1,-1,-1];
% Sxn=Sy';
%
% Dyp=(conv2(double(I),double(Sy),'same'));
%Dxp=(conv2(double(I),double(Sx),'same'));
%g... |
clc;
clear all;
data=dlmread('ex1data1.txt');
X=data(:,1);
Y=data(:,2);
%plot(X,Y,'rx');
X=[ones(size(Y,1),1) X];
theta=rand([1 2]);
alpha=0.01;
%---------------------------------------------------------
%batch gradient descent
for j=1:300
%hypothesis
Hb=X*(theta');
%cost function
Jb(j)=sum(((Hb-Y).*(H... |
function online_test()
clc, clear all, close all
training_output = 'training_output';
load_A = load(strcat(training_output,'/model_2_invariant_matrix_A.mat'));
load_B = load(strcat(training_output,'/model_2_invariant_matrix_B.mat'));
% load_matrices
A = load_A.A;
B = load_B.B;
end |
base = importdata('twomoons.dat');
X = base(:,1:2)';
D = base(:,3)';
d1 = base(:,3);
x1 = base(:,1);
x2 = base(:,2);
sig = 0.1;
p = 2;
q = 5;
W = sig*randn(q,p+1);%pesos aleatórios
X = [ones(1,1001);X];
%função de ativação
u = W*X;
Z = 1./(1.+exp(-u));
Z = [ones(1,1001);Z];
M = D*Z'*((Z*Z')^(-1));
%... |
function [sig] = SigLookup(h)
%
% SigLookup finds the appropriate air density ratio for a given altitude
% using the lookup table from "Introduction to Aircraft Performance,
% Selection, and Design", and linear interpolation.
%
% h - altitude (ft)
%
% sig - air density ratio
%
% Recreate table from book
table = [... |
%To review the results load the matlab file
for ic=1:1:4
subplot(2,2,ic);
surf(res{ic}, 'LineStyle', 'none');
% xlabel('shift');
% ylabel('tscale');
end |
function [ac, lags] = acf(y,max_lag, make_plot)
% Compute the autocorrelation function (for 0-max_lag lags).
%
% Inputs:
% y - data -- a row- or column-vector for which to compute the ACF. If y contains any missing values, then the covariances are computed from the complete cases, so the resulting estimates m... |
classdef copse_model_bergman2004 < handle
% Time derivative and diagnostic variables (COPSE 'classic' Bergman etal 2004)
%
% Input:
% tmodel - model time (yr)
% S - state vector (struct)
%
% Output:
% dSdt - time derivative of state vector S (struct, fields m... |
% This code reproduces the analyses in the paper
% Urai AE, Braun A, Donner THD (2016) Pupil-linked arousal is driven
% by decision uncertainty and alters serial choice bias.
%
% Permission is hereby granted, free of charge, to any person obtaining a
% copy of this software and associated documentation files (the "... |
% Programa para analisar os esforços internos numa barra de um mecanismo,
% em função do ângulo theta no qual o mecanismo é posicionado.
%% Preparação do MATLAB
close all
clear all
clc
%% Definição das constantes no SI
L1 = 2; % Tamanho da barra levantadora
L2 = 0.8; % Tamanho da barra suporte
m1 = 20; % ... |
%
% Script to channelize a broadband input with narrow channels, then
% resynthesize a portion to capture a signal that spans multiple channels.
% Shows variable bandwidth channelizer capability.
%
%
clear all; close all;
PlotFlag = 1;
if ~(exist('PlotFlag'))
PlotFlag = 0;
end
%% Initial Setup
fs_in = 2000; ... |
%% Author: epokh
%% Website: www.epokh.org/drupy
%% This software is under GPL
%%output: rotation matrix along X axis by an angle expressed in degree
function [Rmat]=RotX(angle)
Rmat=[1 0 0 0;
0 cosd(angle) -sind(angle) 0;
0 sind(angle) cosd(angle) 0;
0 0 0 1];
end |
function [tx,ty] = gradaux(frame,step)
[m,n] = size(frame);%m=line and n=columns
gradx = zeros(size(frame));
grady = zeros(size(frame));
%--------------------------------------------------------------------------
%gradient in x direction
for i = 1:m
for j = 1:n
if abs(j - 1) < step || abs(j - n) < s... |
% plot boxplots and calculate p values for all palpation experiments
function plotPalpationStatistics(palpationMetrics)
timeVec=[[palpationMetrics(:,1).completionTime]';[palpationMetrics(:,2).completionTime]'];
timeCategory = [repmat({'Haptic'},length([palpationMetrics(:,1).completionTime]),1);
repm... |
function [coldestDay,warmestDay] = coldestwarmestdays(month)
coldestDay = +Inf;
warmestDay = -Inf;
[ndays,~] = size(month);
for i=1:ndays
meanDayT = mean(month(i,:));
if meanDayT <= coldestDay
coldestDay = meanDayT;
end
if meanDayT >= warmestDay
warmestDay = meanDayT;
end
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.