text stringlengths 8 6.12M |
|---|
% wm_ttw.m
% 171214
% Animation of a travlling [1D] sinusoidal wave propagating in Z direction
% Animation of the motion can be saved as an animated gif or avi. file
% John A Sims
% email: john.sims@ufabc.edu.br
% Universidade Federal do ABC
% http://www.ufabc.edu.br/
% Biomedical Engineering Department,
% Centro... |
%%%% FUNÇÃO DICIONÁRIO
function [Dic ] = dic_time(N, H, P)
Dic = zeros(N,H);
resol = 1/P;
k = 0:resol:N-resol;
i = 1;
for n=0:N-1;
Dic(i,:) = exp(-1j*2*pi*k*n/N);
%Dfm(i,:) = cos(2*pi*k*n/N)-1j*sin(2*pi*k*n/N);
i=i+1;
end
% Normalização
for i=1:length(k)
norm1_col(i) = sum(abs(Dic(:,i)));
Dic(:... |
function [I_eye1, I_eye2, I_nose, I_mouth] = preProcessing(I)
%MIXEDSUPERVISION Summary of this function goes here
% Detailed explanation goes here
% ojos
EYES = [];
i = 30;
while isempty(EYES)==1
i = i - 1;
EyeDetect = vision.CascadeObjectDetector('EyePairSmall','MergeThreshold',i);
EYES=... |
clear
clc
format long
f = @(x, y) 8 * pi^2 * sin(2 * pi .* x) * cos(2 * pi .* y)
DeltaU = f;
h1 = 1 / 10;
h2 = 1 / 20;
a = 0; b = 1; c = 0; d = 1;
bound = @(x) sin(2 * pi * x)
uex = @(x, y) sin(2 * pi * x) * cos(2 * pi * y)
[u1, x1, y1, error1] = poissonfd(a, c, b, d, (b - a) / h1, (b - a) / h1, f, bound, uex);
[... |
clear;clc;
delta=0.001;
totalTime=10;
totalStep=totalTime/delta;
x1array=[1:totalStep]*0;x2array=x1array;
z1array=x1array;z2array=x1array;
x1array(1)=2;x2array(1)=-1;%init condition
for i=1:totalStep
x1=x1array(i);x2=x2array(i);
u=(-(7.5*x1^5+10.5*x1^2*x2+14*x1*x2)-82*x1-2*(0.5*x1^3+7*x2))/7;
x1_dot=0.5*x... |
% Wasserstein metric based mixture fitting: 2-component mixture family
% 'theta_initial' is the initial parameter for the mixture family
function [iteration_hist, density_figure ] = mixture_W2obj_minimization( T_start, T_end, dt, theta_initial, density_target,method )
%% time window
tt=T_start:dt:T_end;
... |
function crossarray=crossarrayfun(X)%定义函数,求列阵的交叉反对称阵
crossarray=[0 -X(3) X(2);
X(3) 0 -X(1);
-X(2) X(1) 0 ];
|
% written by professor Jay McClelland
function [record] = trainAgent(epoch)
%% This function trains the network n trials
% initialize parameters
global p d a;
initParamsEtc(epoch);
initPlot();
% preallocate
record.a = cell(1,epoch);
record.steps = nan(1,epoch);
record.indices = cell(1,epoch);
% train the m... |
function Z = scatterFrequency(data,idx,fldArr)
e = zeros(size(fldArr))
for i=1:length(data)
d0 = data(i,idx)
if isnan(d0)
continue
end
for k = 1:length(fldArr)
if d0 == fldArr(k)
e(k)=e(k)+1
end
end
if i==200
... |
BaseP='C:\DCE\John\Database\DCEOut\';
D=dir(BaseP);
D=D([D.isdir]);
D=D(3:end);
D=D(~strhas({D.name},'SmVl'));
D=D(~strhas({D.name},'LiHa'));
%%
for p=1:numel(D)
try
disp('a');
WorkingP=[BaseP D(p).name filesep];
USStr='';
SimFN=[WorkingP 'Sim.mat'];
SimPKMFN=[WorkingP 'SimPK... |
clear;
format long;
load('PV-RO-ERD data (365days) calculated in 07-Aug-2014.mat');
eff_pv=.15;
q_f0=q_f_max_ntr_erd;
q_p0=q_p_max_ntr_erd;
load('P_out fron PV.mat');
num_PV=20;
w_sun=num_PV*P_max*eff_pv*1e-3;%month 12
fos=73.45/100;%bar*kg/g
c_f0=35;
c_b=0.1;
fai=0.5;
pi_f0=c_f0*fos;
eff_erd=.98;
eff_hp=.9;
eff... |
% Generate and saves the contour levers used to plot
expNames = { '100x100x30',...
'200x100x30',...
'300x100x30',...
'200x100x66',...
'300x100x66',...
'200x100x100',...
'300x100x100'};
for kk=1... |
function db = getDatabaseSubset(db, ind, varargin)
% Helper to get only a subset of a database.
%
% db = getDatabaseSubset(db, ind)
%
% See also:
% getDatabaseType
%
% ----------
% Jean-Francois Lalonde
nohash = false;
parseVarargin(varargin{:});
if isa(db, 'containers.Map')
% we've got a map. do this fo... |
% VIVID facial features module
% Christian S. Pilz
% 2017
clear all; close all;
%the object to access the mex dll
face_analyser=FacialAlignment;
fps=25;
seconds=25;
% h is a handle to the canvas
h = imshow(zeros(480,640));
hold on;
idx=1;
while idx<=(seconds*fps)
%check for available da... |
function q = curvspace_app(app,p,N)
%% initial settings %%
currentpt = p(1,:); % current point
indfirst = 2; % index of the most closest point in p from curpt
len = size(p,1); % length of p
q = currentpt; % output point
k = 0;
%% distance between points in p %%
dist_bet_pts=NaN(len-1,1);
for k0 = 1:len-1
... |
clear
array_num = 9;
R = 1; % Radius is 0.5m
boresight = [45; 45]; % [azimuth; elevation]
array_obj = phased.UCA(array_num, R);
array_azm = (-(array_num - 1)/2 + (1:array_num)' - 1)*360/array_num; % Elements azimuth
sv_obj = phased.SteeringVector('SensorArray', array_obj);
fc = 300e6; % f_c =... |
function [mlep] = mlepUpdateSysIDParam(mlep)
% Update parameters to index
if isfield(mlep.data,'sysIDinputIndex')
index = mlep.data.sysIDinputIndex;
if isfield(mlep.data,'sysIDinputParam')
if ~isempty(mlep.data.sysIDinputParam)
set(mlep.sysIDeditConrolStep,'String',num2str(mlep.data.... |
clc;
clear all;
%% No coupling between secondary
Vin=127;
Ip=7.1475*sqrt(2);
Is1=4.0409*sqrt(2);
Is2=1.4371*sqrt(2);
% theta=16.16;
% alfa=-87.1726;
% beta=-101.316;
Vout=110.6*sqrt(2);
w=2*pi*150*1e3;
M1=17.89e-6;
M2=16.34e-6;
% Ms=13.76e-6;
%% No coupling between secondary
% Vin=127;
% Is1=4.041*sq... |
function new_pairs = reconcile_pairs(pairs, posterior, range)
new_pairs = pairs;
consistency = ibd2_consistent(new_pairs);
new_pairs = ibd2_reconcile(new_pairs, posterior);
new_pairs = ibd1_reconcile(new_pairs, posterior, range);
consistency = ibd2_consistent(new_pairs);
end |
function [centers, radii, M, scaling] = find_htrack_hmodel_transformation(centers, radii, blocks, beta, names_map, verbose, D)
%% Manual scaling
scaling_factor = 27;
for i = 1:length(centers)
centers{i} = centers{i} * scaling_factor + beta(1:3);
radii{i} = radii{i} * scaling_factor;
end
%% Find scaling
htrack... |
function [Q,R] = gramschmidt(A)
[n,m] = size(A);
Q = zeros(n,m);
R = zeros(m,m);
R(1,1) = norm(A(:,1)); Q(:,1) = A(:,1)/R(1,1);
for k = 2:m
v = A(:,k);
for j = 1:k-1
R(j,k) = Q(:,j)'*A(:,k);
v = v - R(j,k)*Q(:,j);
end
R(k,k) = norm(v); Q(:,k) = v/R(k,k);
end
end
|
function ee150_protonbeam(v0, B, Ei, dE, Ef)
for E=Ei:dE:Ef
dt=1e-9;
a=0;
b=10e-6;
q=1.602e-19;
m=1.672e-27;
w=q*B/m;
a_e=q*E/m;
j=(b-a)/dt;
v=zeros(1,j+1);
x=zeros(1,j+1);
v(1,1)=v0;
x(1,1)=0;
v(2,1)=0;
x(2,1)=0;
for i=1:j
v(1,i+1)=v(1,i)+w*v(2,i)*dt;
v(2,i+1)=v(2,i)+(-w*v(1,i)+a_e)*dt;
x(1,i+1)=x(1,i)+v(1,i)*dt;
x(2,... |
function sir_llh = PFfilter(PFObj,Model)
% PFFILTER run a particle filter
% Input:
% PFObj : A particle filter object storing specifications to run a
% particle filter
% Model : The model to run the particle filter
% Output:
% sir_llh : The estimate log-likelihood of the input... |
run('../vlfeat-0.9.20/toolbox/vl_setup')
img1 = imread('../Stitch_Dataset/974-1.jpg');
img2 = imread('../Stitch_Dataset/975-1.jpg');
%% Feature detection using SIFT and matching
[f1, d1] = vl_sift(single(rgb2gray(img1))) ;
% [f2, d2] = vl_sift(single(rgb2gray(img2)),'PeakThresh', 0,'edgethresh',500) ;
[f2, d2] = vl_... |
% imbibition capillary pressure curve
% Written by Ali A. Eftekhari
% Note that pc_max_o is specified as pc_min in the input json files for
% slightly more consistency witht the polynomial Pc
function res=pc_imb(sw, pce_w, pce_o, swc, sor, labda_w, labda_o, pc_max_w, pc_max_o)
pc1=pc_drain(sw, pce_w, swc, labda_w, pc... |
classdef (Hidden, Sealed) RelaxGaussSeidel < amg.relax.AbstractRelax
%RELAXGAUSSSEIDEL Gauss-Seidel relaxation scheme.
% This class executes Gauss-Seidel relaxation sweeps in lexicographic
% order (A-column order) to the linear system Ax=b.
%
% See also: RELAX.
%===============... |
io = dsp2.io.get_dsp_h5();
p = dsp2.io.get_path( 'signals', 'complete', 'targacq' );
days = io.get_days( p );
cue = io.read( p, 'only', days{end} );
%%
subbed = dsp2.process.reference.reference_subtract_within_day( cue );
bla = subbed.rm( {'acc', 'ref', 'errors'} );
acc = subbed.rm( {'bla', 'ref', 'errors'} );
% N ... |
function [X, index] = userParamsToMatrix(u, userId, model)
%USERPARAMSTOMATRIX [X, index] = userParamsToMatrix(u, userId, model)
%
% Convert the param vector (u) used in the optimization procedure to the
% input matrix. Specifically, u is the set of all unique parameters to the
% function f_i of the user with userI... |
%%%%%%
%Simulation
clear all
clc
global puck mallet table fig score goalsize comp e;
global width height input output mutability crossover population;
puck.d = 1.5;
puck.m = .1;
mallet.m = 5;
mallet.d = 2;
mallet.v = [0,0];
comp.m = mallet.m;
comp.d = mallet.d;
comp.v = [0,0];
puck.v = [0,15];
score = [0,0];
e = 0.9;
... |
function [z,R] = UKF_get_measurement_sample(position,velocity,acceleration,i,boolPosition,boolInit)
if not(exist('boolPosition','var'))
boolPosition = false;
end
if not(exist('boolInit','var'))
boolInit = false;
end
varianceAngularRate = 10;
boolUseUpsampling = false;
boolUseSavitsky = false;
if boolInit
... |
% set_colormap selects colormap
%
function set_colormap(clmap)
hfig=gcf;
cmsplot_prop=get(hfig,'userdata');
p=clmap;
iflip=findstr('flipud',cmsplot_prop.colormap);
if ~isempty(iflip), % add flipud
p=remblank(p);
p=['flipud(',p,')'];
end
cmsplot_prop.colormap=p;
set(hfig,'userdata',cmsplot_prop);
cmsplot_now;
|
function d = distance( obj, p1, p2 )
% DISTANCE calculates the distance along the shortest path between given
% points along the network.
% p1 = [e1, d1]: edge index & distance along this edge for point one
% p2 = [e2, d2; ...]: same for point two but can be MATRIX of points
%warning('Obsolete function');
e1 = p1(:,1... |
function intensity = get_intensity(filename, threshold)
im = imread(filename);
% Grab the R,G, or B component of the photo
im = squeeze(im(:,:,1));
%im = double(im);
figure, imshow(im);
%% Background counts by samping image border
% Generate a border mask
border_mask ... |
function [m_p,V_m,I_m] = s3p1(Iph,n_STC,N_Cell,Vt,Isat,Rs,G,Isc,Voc)
%Iph=[0.4791,0,0.4414,0.3985];n_STC=2.6492;N_Cell=2;Vt=0.0278;Isat=3.159e-15;Rs=0.19;G=[870,0,776,673];Isc=[0.4791,0,0.4414,0.3985];Voc=[4.8155,-5.89322759461873e-20,4.8034,4.7883];
pi=0;
pow=[];
cur=[];
vol=[];
k=0;
V=5.3;
net_I=0;
if(G(1)==... |
function px_spm8_reorient(fdp,para)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FORMAT px_spm8_reorient(fdp,para)
% Usage This function is used to batchly reorient image by calling spm8.
% input
% fdp.scan - fullpaths of the image files to reorient.
% ... |
function decrypted_image = image_decryption(streamkey,encrypted_image) % Decrypts encrypted image using secret stream key
r=size(encrypted_image,1);
c=size(encrypted_image,2);
decrypted_image=zeros(r,c,'uint8');
temp_p=false(1,8);
temp_b=false(1,8);
temp_d=false(1,8);
for i=1:r
for j=1:c
... |
function plot_neuron_sample( R, pop, sample_ind, seg_input )
% this function completely emulates the single neuron behavior in the C++
% simulator
% dump parameters
dt = R.dt;
step_tot = R.step_tot;
dt_reduced = R.reduced.dt;
step_tot_reduced = R.reduced.step_tot;
check_cpp_matlab_match = 1;
if nargin == 2
fo... |
%tasıma
A=imread('C:\Users\HP\Desktop\GoruntuIsleme\Safari_RGB.jpg');
B=zeros(size(A));
B=uint8(B);
B=A;
sat=size(B)(1);
sut=size(B)(2);
xsh=70;
ysh=30;
for i=1:sat
for j=1:sut
ii=i+xsh;
jj=j+ysh;
C(ii,jj,1)=B(i,j,1);
C(ii,jj,2)=B(i,j,2);
C(ii,jj,3)=B(i,j,3);
end
end
%imshow(B);
imwrite... |
% %create 2D spatiotemporal RFs
clear;
clc;
%First load in parameters of Gabor fit and RF data
addpath('~/yossi_local/visualRFNNMatlab/global_code/');
filepath = '~/Dropbox/visualRFNN/Datasets/Dataset_4_new/nnResults/500_passes/10-Dec_abs_lam_-7n400.mat';
load(filepath,'theta');
load('/home/yossi/Dropbox/visualRFNN/D... |
function temperature = resistanceToTemp(resistance)
%RES2TEMP Calculate the temperature (in Kelvin) of the Parts Pal thermistor
% from a measured resistance.
% Based on a simplification of the Steinhart-Hart equation
% The resistance argument may be either a scalar or an array.
temp0 = 298.15; % refere... |
function model = ibpmultigpUpdateA(model)
% IBPMULTIGPUPDATEA
% IBPMULTIGP
% % Compute Kfutilde = E[ZdqSdq]*Kfu
% model.Kfutilde = cell(model.nout, model.nlf);
% for q=1:model.nlf
% for d=1:model.nout
% %model.Kfutilde{d, q} = model.EZdqSdq(d,q)*model.Kfu{d,q};
% model.Kfutilde{d, q} = (model.muS... |
function [beta,predictProbLearning,predictProbTest,predictClassTest,OptCO_log_reg,name_beta]= ...
runLogisticNL(depLearning,explLearning,explTest,explLearning1,depLearningQual,name_var)
[TT,KK]=size(explLearning);
explLearningNL = explLearning;
explTestNL = explTest;
%% croisement... |
%% LoadLocData
% Load location.csv file exported from ANY-MAZE
% 2018 Knowblesse
%% Load Data
% [filename, pathname] = uigetfile('.csv','Load EPM location file from ANYMAZE');
filename = 'EPM - Test 2.csv';
pathname = 'data\';
fileID = fopen([pathname,filename],'r');
formatSpec = '%s%f%f%f%f%f%f%f';
dataArray = texts... |
function resetEnv()
% reset simulator environment
global mpx mpy mapsize
global posX posY th
global wheelD wheelW wheelDis sensorDis
% 生成地图
[mpx,mpy,mapsize] = mapGen();
% 小车参数
wheelD = 5.6;%轮子直径
wheelW = 2;%轮宽
wheelDis = 13;%两轮间距
sensorDis = 6.5;%传感器与车轴中心的距离
% 小车初始化
posX = 0;
posY = -1;
th =0;%小车航向角 以x轴为正向,单位rad
... |
function [L] = addLink(l, angle, x5, EE, theta)
% This outputs the L = T * T * R matrix for a joint with a link (tube)
% l is the length of the pipe (from motor-center to motor-center)
% angle is the rotational offset (twist) of the link
% Note: this is the transformation between the input to the motor
% (described by... |
% kwwfitrun--automated picosecond fit routine. JDM 4/2008
% Note: see text at bottom of script for calculating weighted
% time constants.
global IRFx IRFy MAXTIME;
% User must edit the following lines.
DataFile='jyf071613-n2-mag-s1.asc'; % don't get the data and irf files
% mixed up, ... |
function varargout = conic_option_type(varargin)
%CONIC_OPTION_TYPE Get type info for a particular option.
%
% char = CONIC_OPTION_TYPE(char name, char op)
%
%
%
%
[varargout{1:nargout}] = casadiMEX(795, varargin{:});
end
|
%Vinicius -- feito com a rotina do aguirre
clc
close all
clear all
N = 700;
b = 6;
j = 1;
for i = 1:3
m = i;
y = prbs(N,b,m);
figure(j);
stairs(y); axis([0 N -1 2]);
hold off
figure(j+1);
[t,r,l,B]=myccf2([y'],350,1,1,'k');
j = j+2;
end |
function [albedoImage, surfaceNormals] = photometricStereo(imArray, lightDirs)
% PHOTOMETRICSTEREO compute intrinsic image decomposition from images
% [ALBEDOIMAGE, SURFACENORMALS] = PHOTOMETRICSTEREO(IMARRAY, LIGHTDIRS)
% comptutes the ALBEDOIMAGE and SURFACENORMALS from an array of images
% with their lighting ... |
%% Problem 1 for Homework 3: Single-View Metrology
%--------------------------------------------------%
% Read image
%--------------------------------------------------%
im = imread('kyoto_street.JPG');
%--------------------------------------------------%
% A.1 Get three orthogonal Vinishing points
%-------------------... |
function S = prolateSurfaceArea(elli, varargin)
%PROLATESURFACEAREA Approximated surface area of a prolate ellipsoid.
%
% S = prolateSurfaceArea(R1,R2)
%
% Example
% prolateSurfaceArea
%
% See also
% geom3d, ellipsoidSurfaceArea, oblateSurfaceArea
%
% ------
% Author: David Legland
% E-mail: david.legland@... |
#include "com_codename1_ui_SideMenuBar_CommandWrapper.h"
const struct clazz *base_interfaces_for_com_codename1_ui_SideMenuBar_CommandWrapper[] = {};
struct clazz class__com_codename1_ui_SideMenuBar_CommandWrapper = {
DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_com_codename1_ui_SideMenuBar_... |
function [imputed_alleles error] = imputation(alleles_all, range, kinship2ex)
error = 0;
imputed_alleles = [];
global debug_mode;
%%
if( isempty(range) )
error = 1;
disp('error in family structures');
return;
end
genotyped = range.family_range;
nGENO = length(genotyped);
nIND = length(range.pedigree_ran... |
function [err_measure, deva_bbs, global_model_map, global_fiducials] = find_error_measure(path, number_of_samples)
%
load([path '/belhumeur_data/intermediate_results/global_fiducials.mat']);
load([path '/belhumeur_data/intermediate_results/global_model_map.mat']);
posemap = 90:-15:-90;
load('face_p... |
function scatterCC(x, y, markerColour, textX, textY)
% [num,dem] = rat(parulaFraction);
% colours = parula(dem);
c = fitlm(x,y);
H = plot(c);
H(1).Color = markerColour;
H(2).Color = [.5 .5 .5];
H(3).Color = [.5 .5 .5];
H(4).Color = [.5 .5 .5];
legend('off')
text(textX,textY,strcat("r^2 = "... |
% Ver 1_4:
% - Uses 'Detect_Sphero_Initial_Ver2_5' and 'Detect_Sphero_Ver2_5'
%
%%%%%%%%%%%%%%%%%%%%%
% 3D reconstruction %
%%%%%%%%%%%%%%%%%%%%%
function SpheroState = SpheroDetectionTracking_Ver1_4(iitr, SpheroState, CameraParam)
col = CameraParam.col; % Detection color
cam = Camera... |
function [R] = ELM_AE_Reconstruct(testP, model)
Weights = model.W;
Hn = model.Hn;
sig = model.sig;
no_of_Layers = model.no_hidden_Layers;
InputData = testP;
for i=1:1:no_of_Layers
tempH_test=(Weights{i})*(InputData);
if Hn(i+1) == Hn(i)
InputData = tempH_test;
else
InputData = 1 ./ (1 + ex... |
function y = findangles(Sys,Exp,Opt);
cori0 = [Sys.coria Sys.corib Sys.coric]*pi/180; % initial crystal orientation
nL = [1;0;0]; % rotation axis along lab x axis
Sys.lwpp = 0.7;
Sys1 = Sys;
Sys1.gFrame = [Sys.gframea1 Sys.gframeb1 Sys.gframec1]*pi/180;
Sys2 = Sys... |
function [] = drawCubeSide(corners, internalMatrix, color)
%DRAWCUBESIDE Takes corners in camera coordinates, and draws the side as a
%filled quadrilateral over the figure.
% Convert camera coordinates to pixel coordinates
corners = cameraToPixel(corners, internalMatrix);
% Idenfity which order is sequential around th... |
clear all;
close all;
clc;
m=input('How many inputs : ');
for i=1:1:m
y(i)=input('');
yy(i)=y(i);
end
n=input('Enter Zero index : ');
p=1-n;
Fdif=p
for i=1:1:m
x(i)=p;
xx(i)=x(i);
p=p+1;
end
Ldif=p-1
m1=input('How many inputs : ');
for i=1:1:m1
y1(i)=input('');
yy1(i)=y1(i);
end
n1=input... |
% Small technical example.
% Demonstrates an expedient for showing an image.
%
disp('Small technical example.');
disp('Demonstrates an expedient for showing an image.');
disp('FOR MORE INFORMATION: help printshop');
disp(' ');
disp('See also the report http://repository.cwi.nl:8888/cwi_repository/docs/IV/04/04178D.pdf... |
function meioitic_segregants=plot_compute_meiotic_segregants()
% PLOT_COMPUTE_MEIOTIC_SEGREGATNS plots meoitic segregant data
% returns counts of BC187 like and YJM978. Computes mean and area metric.
path_data='/Users/RenanEscalante/Dropbox/Phenotypic_diversity/var_facs/20120427_meiotic_segregant_classification/outpu... |
% clc;
% clear all;
% close all;
load net21.mat %net21 is the name given for the trained data
% nnet = IndoorHomeScene;
path1= 'C:\Users\Praveen RI\Desktop\CNN\Test'; %location where the test images are present in a folder
[filename, pathname] = uigetfile('*.jpg', 'Pick an Image');
img= imread([pathname file... |
function [D]= random_walk_3d_simulation ( step_num, walk_num )
%*****************************************************************************80
%
%% RANDOM_WALK_3D_SIMULATION simulates a random walk in 3D.
%
% Discussion:
%
% The expectation should be that, the average distance squared D^2
% is equal to the ti... |
%% HW5
% This is Carina Vallefuoco's Homework 5.
%% Problem 1
% In this problem I am using an image of myself and adapting it so that
% there is a left flip, right flip, and an average of the left and right
% flip.
img=imread('Symmetry Photo.jpg'); % read in the image
img=im2double(img); % converts image to double perc... |
function ipat = getObjImage(ipat)
% ipat should be an n x 2 matrix where n is the number of training
% examples of cups and bowls. The first column represents the relative
% height of an object and the second column represents the relative width
% of the object. This function use the information to create a simple
% ob... |
function [] = ques_eight()
n=5:5:100;
MeanTime1=zeros(1,100);
MeanTime2=zeros(1,100);
y=zeros(1,100);
for (i=5:5:100)
y(i)=0.5*n(i/5)*log(n(i/5));
for (j=1:30)
[G,temp1]=RGP(n(i/5),1);
[G,temp2]=RGP(n(i/5),2);
MeanTime1(i)... |
function rm_tonotopic
close all
clear all
clc;
joe;
thor;
function joe
f32 = 'C:\all Data\JoeData\';
xcl = 'C:\all Data\';
cd(xcl);
[NUMERIC,TXT] = xlsread('Joe-data.xlsx');
TXT = TXT(2:end,:);
sel = strcmpi(TXT(:,3),'tonerough');
NUMERIC = NUMERIC(2:end,:);
x = NUMERIC(sel,5);
y = NUMERIC(sel,6)... |
function Zgyr = get_zin_gyr(num_den, syms_H)
if nargin == 2
syms s Rgyr Cgyr BWP RL positive;
else
s = tf('s');
Rgyr = 39e3;
Cgyr = 10e-9;
BWP = 3e6;
RL = 51;
end
K = 1/(1+(s/(2*pi*BWP)));
num = s*Cgyr*Rgyr*RL + RL;
den = s*Cgyr*(Rgyr*(1-K)+RL)+1;
if nargin == 0
Zgyr = num/den;
... |
clear all;
data = dataPaths();
[~,my_foldername] = fileparts(pwd);
path_results = fullfile(data.resultsdir, ['Holger/2018_JR/ConnectomeTwoDrivers/' my_foldername]);
results = load(fullfile( path_results, 'all_coh.mat'));
paramSizes = cellfun(@length, results.paramValues);
drivStrength = cell2mat(results.paramValues{... |
function ret=activation_out(x,type,deriv)
%type
%1->tanh
%2->ReLu
%3->linear
%deriv
%1->normal
%2->derived
if(deriv==1)%normal
if(type==1)%tanh
ret=2./(1+exp(-x))-1;
elseif(type==2)%ReLu
ret=log(1+exp(x));
elseif(type==3)%linear
ret=x;
end
elseif(deriv==2)
if... |
%% Electrolyte Properties from DUALFOIL
% Created July 5, 2012 by Scott Moura
% nprop = 11; LiPF6 in EC:DMC (liquid)
c_e = linspace(500,1500,101);
% Diffusion coefficient in electrolyte
D_e = 5.34e-10*exp(-0.65*c_e/1000.0);
% Electrolyte conductivity
kappa = (0.0911+1.9101*c_e/1000.0 - ...
1.052*((c... |
function [eigenvalues, eigenvectors] = pca_different_algorithms(X, cent_crit, scal_crit, pca_algorithm)
[centered_scaled_X, centerings] = center(X, cent_crit);
[centered_scaled_X, scalings] = scale(centered_scaled_X, X, scal_crit);
[n_obs, n_vars] = size(X);
% PCA with eigendecomposition of the covariance matrix:
if... |
function [Q,H,K] = HPIEPViaUpdates(z,w,p)
% Solves the Hessenbeg pencil IEP using an updating procedure
%
%INPUT:
% z = nodes
% w = weights
% p = poles of rational Krylov subspace (RKS)
%OUPUT:
% Q = orthogonal basis for RKS with given p
% (H,K) = Hessenberg pencil such that Q*ZQK = H, with Z = diag... |
function valid = check_segment(a, b, obstacles)
valid = all(cellfun(@(obs) isempty(polyxpoly([a(1) b(1)], [a(2) b(2)], obs(1,:), obs(2,:))), obstacles)); |
function APF = AnalysisProtFilt(fs,pfBW,L,beta)
%
% AnalysisProtFilt(fs,chBW,L)
% Generates a Nyquist filter as a prototype filter for a non-maximally
% decimated (NMD) analysis channelizer (perfect reconstruction filter bank).
% The prototype analysis filter is based on a Kaiser-windowed sinc pulse
% The pro... |
function [ FDMCObject, control ] = evaluateFDMC( FDMCObject, yDesired, yCurrent )
% Komentarz odnośnie działania.
% Wyznaczanie trajektorii zadanej ( przedłużenie wartości zadanej na cały
% horyzont predykcji N.
yDesiredTrajectory = zeros( FDMCObject.model.outputsNo*FDMCObject.N, 1 );
for i = 1 : FDMCObjec... |
clear all;
close all;
clc;
img = [13 13 12 12 12 11 11 11;
13 12 12 12 11 11 11 10;
12 12 8 7 6 5 10 10;
12 12 7 6 5 4 10 10;
12 11 6 5 4 3 10 9;
11 11 5 4 3 2 ... |
function mickey_pool(~,~,hfig)
CmsCoreProp=get(hfig,'userdata');
axes(CmsCoreProp.handles.pool_axes);
% global knum;
pt = get(CmsCoreProp.handles.pool_axes, 'CurrentPoint');
i=round(pt(1,2));
j=round(pt(1,1));
knum_pool=cpos2knum(i,j,CmsCoreProp.pool.mminj);
if (knum_pool && CmsCoreProp.pool.s(knum_pool).color > ... |
%
% Fig6
% Author: Catalina Chaparro
% Last modification: 20/5/2021
%
% This rutine makes figure 6 of the paper entitled "Fast
% environmental change and eco- evolutionary feedbacks can drive
% regime shifts in ecosystems before tipping points are crossed"
clear
%Parameters--------------------------------------------... |
function R_e_a_e = R_e_a_e_func(k,C_e_a,C_t,C_e_a_e,C_e_t)
parameters;
%
R_e_a_e = k*C_e_t*C_e_a - ...
k*C_e_a_e*C_t;
end
|
%************************************
%求解一维热传导偏微分方程的一个综合函数程序
%************************************
m = 0;
x = linspace(0, 1, 20); %xmesh
t = linspace(0, 2, 20); %tspan
%************
%以 pde 求解
%************
sol = pdepe(m, @func_20_1, @ic20_1, @bc20_1, x, t);
u = sol(:,:,1); %取出答案
%************
%绘图输出
%******... |
clear all;
clc;
close all;
filename = '7_6_unmanned_flight_3_data.txt'
calib_time =30;
threshold_factor = 3;
cutoff_freq = .03;
[time , drone_pos , drone_vel , drone_att , lidar_pos , lidar_att] = temp_navdata_filtering(filename , calib_time, threshold_factor , cutoff_freq);
plot3D_drone(drone_pos);
... |
seed = 1983;
row = 384;
list = 384;
test = 'embed.png';
original = 'girl.jpg';
wavelet = 'db6';
level = 2;
alpha = 0.1;
%---------------------------R层作为水印图像
mark = imread('9999.jpg');
mark = double(mark)/255;
mark_R = mark(:,:,1);
%---------------------------将水印图像... |
%bacteriaRadialDistribution: Calculate the distance of each bacteria from
%the approximate center of the gut. This analysis will use the spots found
%in the gut using our classifier. The center of the gut will be defined
%(since we don't have a good marker for the edge of the gut in this data)
%as the centroid of t... |
% util.XC_DEF was generated on Sun Jan 05, 2014 11:07:21 PM by xcpp
%
% Provides the definition of the objects that the functions in
% this package return. Provide no arguments to obtain the whole
% map. If you need only one definition then provide the key.
%
function obj = xc_def(varargin)
persistent defs;
if ... |
function [vx, vy, vz] = mni2vox(mx, my, mz, xVector, yVector, zVector)
% converts MNI coors in [mm] to voxel indices
% (c) Jiri, Oct15
vx = closestval(xVector, mx);
vy = closestval(yVector, my);
vz = closestval(zVector, mz);
|
function [a,x,humma]= sum_square_diff(n)
summa=0;
for i=1:n
summa=summa+i;
end
x=summa^2;
humma=0;
for i=1:n;
humma=humma + i^2;
end
a=abs(x-humma);
|
% DECOMPOSECAMERA Decomposition of a camera projection matrix
%
% Usage: [K, R, C, pp, pv] = decomposecamera(P);
%
% P is decomposed into the form P = K*[R -R*C]
%
% Argument: P - 3 x 4 camera projection matrix
% Returns:
% K - Calibration matrix of the form
% | ax s x0 |
% ... |
function tstr = format_t(tval)
%function pstr = format_p(pval)
tstr = ['t=',num2str(round(tval*1000)/1000)];
end |
function y = Fault_decision_b1m1_t1(u)
global st1
% Using model defined by the structure st1 to make decision about type1 fault in the pitch beta1m1
sker=st1.x2sup+(abs(u))'*abs(u)*ones(st1.Nlsup,1)-2*st1.xsup*abs(u);
y=(st1.w)'*exp(-sker./(2*(st1.sigma).^2))+st1.b;
if y>=0
y=1;
else
y=0;
end
en... |
% digitized gravity profiles by sampling Elizabeth's snapshots
% created by: Yu Geng
% 2017-10-21
clc
clf
clear all
close all
%% Profile 1.
% sample the left half of the profile curve
% this has to be done manually
X_l1 = [-10, -8, -6, -4, -2, 0];
Y_l1 = [20, 25, 33, 42, 50, 53];
% create a smoothed full profile cu... |
function [concentration]=generate_logNdistribution(UPb_mean,UPb_std,nbin,nage)
% generate a lognormal distribution of U-Pb ages, assuming that nages ages
% were measured
mu = log((UPb_mean^2)/sqrt(UPb_std+UPb_mean^2));
sigma = sqrt(log(UPb_std/(UPb_mean^2)+1));
age_distribution = lognrnd(mu,sigma,[1,nage]);
% estima... |
max24bit = 8388608; % Maximum absolute value that can be displayed with signed 24 bits.
refVoltage = 1.2;
GAIN = 1;
numOfSamples = 512; % Ideally power of two for fft.
yLimits = [-refVoltage/GAIN * 1.2, refVoltage/GAIN * 1.2];
xLimits = [1, numOfSamples];
scaleFactor = 1 / max24bit * refVoltage / GAIN;
refreshR... |
%------------------------------------
% Plot
%------------------------------------
class_colors= 'rgbcmyk';
% chair = 1 = r
% table = 2 = b
% look for points pertaining to this part
[n_p l_p] = size(points);
part_points_indexes = find( points(:, l_p) == p_id);
part_points = points( part_points_... |
%#############################
function [Sinal]=NMESAbreTXT(filename,pathname)
% Abrindo Dados
% try
% temp = importdata([pathname,filename], '\t', 1);
% Sinal.Dado=temp.data;
% Sinal.Nome=temp.colheaders;
% catch
% [s, msg] = replaceinfile(',', '.', [pathname,filename], '-nobak'); %substitui virgula p... |
function cams(varargin)
global S
%{
Cam Simulator
To launch, simply type cams in the MATLAB command window with this in the current
directory. Alternatively, you can choose Debug -> Run from this editor window,
or press F5.
Helpful Notes:
- The first edit box column is to contain the motion type(s). Each ... |
x = linspace(1, 10, 100);
y =sin(x)+rand(size(x), 1);
plot(x,y, 'b*');
analyzer_angles=linspace(min(x),max(x),100);
data = [x;y];
%Ein=[1;0]';
IG =[1, 1, 1, 1,1, 1, 1,1];
index_collector =zeros(size(analyzer_angles));
for ind = 1: length(analyzer_angles)
P =fittingfunction(data, IG);
Ein =... |
function [c_labels, centroids] = myKMeansClustering(data, K)
%% Implements a k-means clustering algorithm
%
% Input:
% data: num_features x num_data_points matrix, containing the data features
% K: int, parameter for the kNN classifier
% Output:
% c_labels: 1 x num_data_points vecto... |
function b = plot_eigenvalues(eigenvalues, varargin)
line_width = 1;
b = bar(eigenvalues, 'LineWidth', line_width, 'BarWidth', 1, 'FaceColor', 'flat');
red = [0.9 0.1 0.1];
green = [0.1 0.9 0.1];
blue = [0.1 0.1 0.9];
colormap(build_colormap(max([3, size(eigenvalues,2)]), 1, [red; green; blue]))... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.