text stringlengths 8 6.12M |
|---|
function MATLAB_ROS
addpath('./image');
addpath('./bgm');
addpath('./class');
fig = figure('Name','Super MATLAB Bros.','NumberTitle','off');
gsc = get(groot,'ScreenSize');
fig.InnerPosition = [(gsc(3)-gsc(4))/2 gsc(2)+gsc(4)*0.1 gsc(4) gsc(4)*3/4];
set(gca,'Position',[0.1 0.1 0.8 0.8]);
screenSize = [16*24 16*1... |
function [Xtest, ind] = readfile2()
Dataset = csvread('test.csv');
sex = csvread('sextest.csv');
embarked = csvread('Embarkedtest.csv');
ind = Dataset(2:end, 1);
Xtest = [];
Xtest = [Xtest, Dataset(2:end, 2), sex, Dataset(2:end, 6:8), Dataset(2:end, 10), embarked];
end |
function [Fbar, FRbar] = FRbar_LL_exp(lam, d, w_range)
%
Fbar=(lam+(lam^(1-d)-lam)*exp((d-1)*w_range)).^(1/(1-d));
FRbar=(lam^d+(1-lam^d)*exp((d-1)*w_range)).^(1/(1-d));
end |
function data = importAgentLog(agentLog)
%% Replace this file with your custom code to load data from the agentLog file.
data = [];
end |
a = csvread('test_2Layer.dat',0,0);
%b = csvread('test_1Layer.dat',0,0);
c = a(:,1)';
t = 1:1:30000;
subplot(2,3,1);
hold on
plot(t,(a(:,1))', '-blue');
%plot(t,(b(:,1))', '-red');
subplot(2,3,2);
hold on;
plot(t,(a(:,2))', '-blue');
%plot(t,(b(:,2))', '-red');
subplot(2,3,3);
hold on;
plot(t,(a(:,3))', '-blue');
%... |
function osc_s = read_osc_settings()
% READ_OSC_SETTINGS - Read OSC settings from a preference file
% (eventually created with default values if it does not exist).
%
% Usage: osc_s = read_osc_settings()
%
osc_s = [];
% Preferences file name:
settings_file = '~/Library/Preferences/IRCAM/Orchidee/oscprefs';
% If pr... |
function [] = vnlsetp(m,n,L)
% Variational Nonlinear Schrodinger Equation
% Tensor-preconditioned Newton-Krylov method
% Polar coordinates
% m Gauss-Legendre-Lobatto nodes
% n Fourier modes, must be even
% Ansatz
spin=0; del=0; ep=pi/4; a0=2; a1=2; a2=a1;
%spin=1; del=pi/4; ep=pi/4; a0=1; a1=2.7903; a2=a1;
%spin=2; de... |
function [r_p_all,data]=CPM_external(all_mats,all_behav,cpm,part_var,motion_var)
% Test CPM in external dataset
% written by Aaron Kucyi, Northeastern University
% INPUTS:
% all_mats (required) : ROI x ROI x trials FC matrix (or single vector
% for one ROI/edge) from test dataset
% all_behav (... |
function poly = HermiteF_nd(x, ndim, norder)
%
% HermiteF_nd.m - Compute multi-dimensional Hermite polynomials
% up to a given order at a given coordinate.
%
% Syntax: poly = HermiteF_nd(x, ndim, norder);
%
% Input : x = (1,ndim) array containing a ndim-coordinates
% ndim = dimension of space
% ... |
% Utility to save standard plots
% Jschott
% CDI700
function [h] = savePicture(x,y,series,xname,yname)
[h] = plot(x,y,'--rs',...
'LineWidth',3,...
'Color',[0,0,0],...
'MarkerEdgeColor','k',...
'MarkerFaceColor','k',...
'MarkerSize',3);
set(gca,'FontS... |
function patches=GeneratePatches3(Img, parameters)
% function patches=GeneratePatches3(Img,parameters) generates patches that
% cover the root in the image Img. It does that by first extracting the
% midline, then computing the spline approximation of the midline, finding
% the tangent vectors and then extracting patch... |
%PLOTPRIORPREDICTIVE Show data sampled from the model's prior
% it requires a data struct so that it knows how many trials to sample (and
% for models that require it, what distractors to imagine, etc).
%
% figHand = PlotPriorPredictive(model, data, [optionalParameters])
%
% Optional parameters:
% 'NumberOfBins' - t... |
function [out] = GLCM_Features(glcmin,pairs)
%
% GLCM_Features1 helps to calculate the features from the different GLCMs
% that are input to the function. The GLCMs are stored in a i x j x n
% matrix, where n is the number of GLCMs calculated usually due to the
% different orientation and displacements used in the alg... |
%% ==============================================
% FortyTwo FEM
% Author:
% Arthur Bauville
%
% Started on: 13.03.2015
% ===============================================
clc, clear, close all
%% Add paths
addpath ./MUTILS/SuiteSparse
addpath ./MUTILS/mutils/quadtree
addpath ./MUTILS/mutils/interp
addpa... |
function [ ] = O_loop( L, n, W, G, B, w )
for i = 1:L
[ I, AI, x_hat ] = I_loop( n, W, w, G, B, d, k );
I_L(i) = AI;
X_hat(i) = x_hat;
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:/... |
% Figure 3.26 Feedback Control of Dynamic Systems, 5e
% Franklin, Powell, Emami
%script to generate Fig. 3.26
clf;
a=1;
zeta=.5;
k=1/zeta;
den=[1 1 1];
num=[k/a 1];
t=0:.1:10;
yT=step(num,den,t);
num=[0 1];
yo=step(num,den,t);
num=[k/a 0];
yd=step(num,den,t);
axis([0 10... |
function e = Laguerre_e2_1d(order, alpha)
%
% Laguerre_e2_1d.m - Evaluate the inner product of 1d Laguerre-chaos doubles
%
% Syntax e = Laguerre_e2_1d(order, alpha)
%
% Input: order = order of Laguerre-chaos
% alpha = parameters of Laguerre-chaos (alpha>-1)
% Output: e = 1 x (p+1) row vector conta... |
function[rho] = AutoCorrelation(x)
x=inpaint_nans(x);
variance =0;
top=0;
N=length(x);
x = x - mean(x,'omitnan');
for i =1:N
variance = variance + (x(i))^2;
end
variance = variance/N;
for k = 0:N/2 %k is the time lag
for i= 1:(N-k)
top = top +(x(i))*(x(i+k));
end
... |
% This scripts makes use of the Streamfunction Color function:
% https://uk.mathworks.com/matlabcentral/fileexchange/69268-streamfunction-color
function Fig9FixedChill(output_dir, frames, figure_output_dir)
if nargin < 1
% Remote
%baseDir = '/network/group/aopp/oceans/AW002_PARKINSON_MUSH/';
%... |
function theta = angle2Points(varargin)
%ANGLE2POINTS Compute horizontal angle between 2 points.
%
% ALPHA = angle2Points(P1, P2),
% Pi are either [1*2] arrays, or [N*2] arrays, in this case ALPHA is a
% [N*1] array. The angle computed is the horizontal angle of the line
% (P1 P2)
% Result is always ... |
function out= rot(v, theta)
% v is a column verctor in 2D.
M = [cos(theta) sin(theta);
-sin(theta) cos(theta)];
out = M*v;
end
|
%% Assignment 6 - Part 2
% Roy E. Crippen IV
% ENG 101
% Due 9/17/2019
%
%% Computing the first 6 digit Fibonacci number
% The goal of this code is to compute the first 6 digit number of the
% Fibonacci sequence. I will achieve this by using a calculating the sequence using a
% while loop and checking my values each it... |
function [costToGo,next]=dynProg1D(parallelHybrid,tVec,disc,J_T);
% dynProg1D - Dynamic programming for 1 state with arc costs as a matrix.
%
% [cost,path]=dynProg1D(funName,tVec,disc,J_T);
%
% Solves a dynamic programming problem for one state variable, supporting a matrix loss
% function implementation. This func... |
function [ locationOut ] = nutrientDecisionNeighborhood( location, max)
up = [-1 0]; down = [1 0]; left = [0 -1]; right = [0 1];
nutrientMotion = [ down; up; right; left];
if location(1) < 2 || location(1) > (max - 1) || location(2) < 2 || location(2) > (max - 1)
locationOut = [];
else
... |
function [] = LeapYear(year)
% LeapYear Determines if the given year is a leap year
if (mod(year,400)==0 || mod(year,4)==0 && mod(year,100)~=0)
disp([num2str(year), ' is a leap year']);
else
disp([num2str(year), ' is not a leap year']);
end
end |
classdef cut_id
% Helper class generating a number, which uniquely defines bragg index
% and cut direction or restores bragg index and cut direction from this
% number.
%
% The id-s are uniquely defined for bragg indexes in -10+10 range.
% [-10 +89]?
properties(Constant,Access=private)
... |
function runCMS_method2(handles)
% set up data
pkl = handles.sys.weight(:,5);
ellip = handles.opt.ellipsoid;
site_ptr = handles.pop_site.Value;
h = handles.h;
h.p = h.p(site_ptr,:);
h.param = h.param;
h.value = h.value(site_ptr,:);
r0 = gps2xyz(h.p,ellip);
Tcond ... |
function results = run_SSRDCF(seq, res_path, bSaveImage, parameters)
% function results = run_SSRDCF()
% bSaveImage = 1;
% video_path = 'sequences/Hiding';
% [seq, ~] = load_video_info_zc(video_path);
close all
addpath(genpath('Processing/'));
addpath(genpath('training/'));
seq.format = 'otb';
params = SetParams(seq... |
%% 仿真参数
global SYS_BW;
global NB_ANT_NUM;
global UE_ANT_NUM;
global MODULATION;
global IFFT_SIZE;
global T;%一个子帧上的采样点数
global SUBCARRIER_SPACE;
global SYMBOL_PER_SUBFRAME;
global NL;%流数
global DATA_NUM;%可用RE个数
global BLOCK_NUM;
%% DMRS图样
global DMRS_FREQUENCY;
global DMRS_TIME;
global RS_MAP_MATRIX;
global DMRS_LO... |
function [R C]=corr1(X,v)
%function to calculate autocorrelation in timeseries A with itself after a
%lag. v is the vector with integers lags in it.
xsize = length(X);
nsize = length(v);
R = zeros(nsize,1);
C = zeros(nsize,1);
for i=1:nsize
end1 = xsize-v(i);
X2 = X(1:end1);
start2 = v(i)+1;
Y = X(start... |
% Ran ma
% 3/8/2019
%
% extract grain boundary element and assign normal direction
%
% run the following bash script first
%
% #!/bin/bash
% NEPER="neper --rcfile none"
% if [ -a "gene_morp_2.tess" ]
% then
% $NEPER -T -loadtess gene_morp_2.tess -format tess,tesr -tesrsize 64 -o gene_form_1
% else
% $NEPER -T -n 20... |
function obj = initialize_algo( obj )
num_nodes = size(obj.nodes,1);
id_node = (1:num_nodes)';
K = get_K( obj, id_node );
% plot the current graph
if obj.plot_EM || obj.plot_graph
figure;
end
if obj.plot_EM && obj.plot_graph
subplot(2,1,1,'replace');
... |
%-------------------------------------------------------
function rot_mat = rot_vec(v,theta)
x= v(1);
y= v(2);
z= v(3);
rot_mat=[
cos(theta)+(1-cos(theta))*x^2 -z*sin(theta)+(1-cos(theta))*x*y y*sin(theta)+(1-cos(theta))*x*z
z*sin(theta)+(1-cos(theta))*x*y cos(theta)+(1-cos(theta))... |
function [x1,jAfn,xAfn]=A_fnsum(NEIG,rver)
% [iAfn,jAfn,xAfn]=A_fnsum(NEIG,rver);
%
% or Afn=A_fnsum(NEIG,rver);
%
NTOT=size(NEIG,1);
iAfn=zeros(NTOT,6);
xAfn=iAfn;
ivec=(1:NTOT)';
ett=ones(NTOT,1);
for i=1:6,
if i<5, R=1.0; else R=rver;end
iAfn(:,i)=ivec;
xAfn(:,i)=ett*R;
end
iAfn=iAfn(:);
jAfn=NEIG(:);
x... |
% Interpretable cnn for big five pesonality traits using audio data %
% Generate cam mapping on clip-spectrogram %
% Data loader.
camfolder = '.../path/to/load/cam/of/each/personality/trait';
spectofolder = '.../path/to/load/corresponding/input/spectrogram';
% Load cam data.
filePattern = fullfile(camfolder, '*.mat')... |
function GU_ExM_JaneliaCluster_SampleScanProcessing171129YFPSample(ex)
ex = str2double(ex);
% GU_ExM_SampleStackDeskewRotateWorkspace.m
%
rt = '/groups/betzig/betziglab/4Stephan/171129_YFPsample4/Stitch_Igor/increased-x-distance/export.n5/';
psfrt = '/groups/betzig/betziglab/4Stephan/171129_YFPsample4/PSFs_objective/'... |
%%
%Frequencias de Corte
fcorte1 = 800/(fs/2);
fcorte2 = 2300/(fs/2);
%filtro do sinal de f=800hz
[B1,A1] = butter(4,[fcorte1-0.1 fcorte1]);
y1=filter(B1,A1,sinal);
[B1,A1] = butter(4,fcorte1);
y1 = abs(y1);
y1=filter(B1,A1,y1);
%filtro do sinal de f=2000hz
[B2,A2] = butter(4,[fcorte2 fcorte2+0.1]... |
% This is a test case that I used to troubleshoot this code. It also
% shows what a large deformation would look like (hard to tell if the
% deformed shape plot is working with the small deformations that occur
% in the 5 provided cases).
clear all; close all; clc; % Clear everything, close everything.
% TRUSS ... |
function info = test_ap(varargin)
% CNN_IMAGENET_EVALUATE Evauate MatConvNet models on ImageNet
run ../matlab/vl_setupnn;
addpath('./Union');
addpath('./range_intersection/');
opts.dataDir = fullfile('..', '..','st-slice-cnn-tar','data', 'THUMOS14'); % modify this line to set up the data path
opts.expDir = fullfile... |
function img = make_grating_image_for_SLM(pitches, grating_template)
% This function returns a 512x512 img for the SLM. Each column is a grating
% function with properties determined by the grating_template.
% pitches, 512 element array of pitch values, or a waveform object
% grating_template, Waveform object to use... |
d = 5:10:65;
N = [10 100 1000 1e04];
anna = load('speed_anna.mat');
elsa = load('speed_elsa.mat');
for n=N
T = time_to_destination(40, 'speed_anna.mat', n);
Tint = integral(@(z) 1./velocity(z, 'speed_anna.mat'), 0, 40);
disp(['Approx. on ', num2str(n), ' intervals = ', datestr(hours(T),'HH:MM:SS')]);
d... |
function [ trajectories, velocities, accelerations, MarkerHelp] = TrajectoryInfo( vicon, S )
% Pulls trajectory info from vicon
MarkerNames=vicon.GetMarkerNames(S);
names=length(MarkerNames);
trajectories=cell(names,1); velocities=cell(names,1); accelerations=cell(names,1);
frameRate=vicon.GetFrameRate;
[ startF... |
function outDayOfYear = DayOfYear(DateTime)
% This functions return the day of year (e.g.: 2 for the 2nd January, 33 for the 2nd of February)
%
% It takes leap year into account, which leads to a 366th day every 4 years
%
% NOTE: This function is very slow as I was not able to vectorize the processing
%
%*****... |
function himage = getimagehandle(this)
haxes = this.handleaxes;
himage = findobj(haxes,'-depth',1,'Type','image');
end |
clc;clear all;close all force;
addpath('../funkce')
cesta='../../../data_ruzne_davky\ruzne_davky_preproces';
listing=subdir([cesta '/*data.mat']);
soubory={listing(:).name};
load('logistic_21f_norm_whole.mat')
prah=0;
for k=136:length(soubory)%upravit 1 - pro pokračování od jiného čísla
k
... |
function g_normalize
global goose
isdone = find(goose.analysis.framedone);
mpoly = mean(goose.analysis.fitp(:, isdone), 2);
meanbase_goosepix = polyval(mpoly, goose.set.analysis.goosepix);
isgoose = goose.analysis.framedone & (goose.analysis.amp > goose.set.analysis.fac(1)*meanbase_goosepix);
nogoose = goose.an... |
function [W, H, G, cost] = convexnmf(V, num_basis_elems, config)
% convexnmf Decompose a matrix V into VGH using Convex-NMF [1] by
% minimizing the Euclidean distance between V and VGH. W = VG is a basis
% matrix, where the columns of G form convex combinations of the data
% points in V, and H is the encoding matrix th... |
function new_image = kuwahara_filter_cvip( imageP,W)
% KUWAHARA_FILTER_CVIP - an edge preserving,smoothing filter.
%
% Syntax :
% -------
% new_image = kuwahara_filter_cvip( imageP,W)
%
% Input Parameters include:
% -------------------------
%
% 'imageP' Input image can be gray image or rgb image ... |
function []=test2_with_fminsearch_tail()
clc;
close all;
Exp_matrix=load('20K_per_minute.txt.txt'); %%%% change the value for every beta
n=size(Exp_matrix,1);
c=0.1002;
Beta= [20/60]; %%%%% change the value for every beta
p=1;
for i=1:10:n %%%%% change the middle value for every beta
if (Exp_matrix(... |
function CS4640_week1
%
% Matlab image file (indexed)
load trees
who % show current (local variables)
imshow(X,map);
X(1:5,1:5) % indexes
map(1:5,:) % rgb values for indexes
Xg = ind2gray(X,map); % convert indexed image to gray level
max(Xg(:)) % treat Xg as linear array
Xt = Xg>0.8;
imshow(Xt);
X_cc = bw... |
% DEMCMDSROADDATA This script uses classical MDS to visualise some road distance data.
% DIMRED
% Plot axes.
minLong = -15;
maxLong = 50;
minLat = 30;
maxLat = 65;
% Load in data.
if isoctave
nums = csvread('../../../dimred/matlab/europeDistance.csv');
names = textread('../../../dimred/matlab/europeCities.csv', ... |
% run beta_str -0.25 to 1.5 (by 0.01) against SMA activation
% beta_str: STRIATUM saturation threshold
clear; clc;
beta_sma = 0.5*(ones(1,6));
beta_str = 0.4*(ones(1,6));
beta_thal = 0.5*(ones(1,6));
alpha_thal = 6; %6
alpha_str = 5;
alpha_thal_var = 0:0.5:10;
for cc = 1:length(alpha_thal_var)
alpha_thal = alph... |
index = randsample(1:length(foo), 1);
bar = foo(index,:); |
pCancroMamog = 0.9;
pNaoCancroMamog = 0.1;
pCancro = 1/1000;
pNaoCancro = 1 - pCancro;
%pela lei da prob total
pPosit = pCancroMamog* pCancro + pNaoCancroMamog*pNaoCancro;
%por causa efeito
prob = (pCancroMamog * pCancro) / pPosit |
function box = mergeBoxes(box1, box2)
%MERGEBOXES Merge two boxes, by computing their greatest extent.
%
% BOX = mergeBoxes(BOX1, BOX2);
%
% Example
% box1 = [5 20 5 30];
% box2 = [0 15 0 15];
% mergeBoxes(box1, box2)
% ans =
% 0 20 0 30
%
%
% See also
% boxes2d, drawBox, intersect... |
function []=Al3(varargin)
narginchk(1,3);
if nargin==1
h3 = varargin{1};
[y,m,d,h,min,sec,lon,lat,pre,tem]=getPara(h3);
elseif nargin==3
data = varargin{1};
addEW = varargin{2};
signNS = varargin{3};
[y,m,d,h,min,sec,lon,lat,pre,tem]=readFile(data);
lon = lon+addEW;
lat = signNS*lat;
end
%需要转化为的数值或者其... |
function [node_pairs,shortest_path_length,paths_all] = getPaths(C,pairs1,pairs2,maxPathLength,minPathNum)
%GETPATHS Summary of this function goes here
% Detailed explanation goes here
% find paths between each pair of nodes (non-symmetric). store paths,
% shortest path lengths and pairs
nodes = 1:size(C,1);
paths_a... |
function expFitMinSearch(x,data)
pred=x(2)+(x(1)-x(2))*exp(-(0:(length(data)-1))/x(3));
rmse=sqrt((data-pred).^2);
end |
function [classname]=generateOptimizationMPCMHE(SYSD,T,L,S,error_norm,input_norm)
% classname=generateOptimization(T,L)
%
% Generate class to do estimation and system model, with:
% T - length of MPC forward horizon
%
% L - length of MHE backward horizon
%
% S - number of inputs to ap... |
% for phi_rank=1:17
% imagesc(squeeze(Efield_X_map_phi(phi_rank,:,:)))
% pause(0.1)
% end
% for phi_rank=1:17
% imagesc(squeeze(bsX_map_phi(phi_rank,:,:).^2+bsZ_map_phi(phi_rank,:,:).^2))
% pause(0.1)
% end
for phi_rank=1:17
imagesc(squeeze(BsX_map_phi(phi_rank,:,:)))
pause(0.1)
end |
p0 = [0 0]; % Coordinate of the first point p0
load('param.mat');
w=2*pi*150e3;
i=2;
Lp= 88e-6;
Ls=68.8e-6;
M1= param.k1(i)*sqrt(Lp*Ls);
M2 = param.k2(i)*sqrt(Lp*Ls);
Ms= -param.ks(i)*Ls;
Vin= param.Vin(i)*sqrt(2);
Vout1= param.Vout1(i)*sqrt(2);
Vout2= param.Vout2(i)*sqrt(2);
Is1= param.Is1(i)*sqrt(2)... |
function bscore = HINT_score2binary(score, varargin)
%% DESCRIPTION:
%
% Function to convert scoring arrays to a binary outcome for use with
% HINT and other similar tests.
%
% This is designed to work specifically with the scoring matrix generated
% by modcheck_HINT_GUI, but should be adaptable to other circum... |
clc;
clear all;
close all;
% Name of the company: Think Soft Research;
% Project Name:3D plot;
% Date: Feb 8, 2019
% Time: 1:40PM
t = 0.01:.01:20*pi;
x=cos(t);
y=sin(t);
z=t.^3;
plot3(x,y,z);
xlabel('x');
ylabel('y');
zlabel('z');
|
clear all;
im = imread('Frame.1.jpg');
im = rgb2gray(im);
figure
imshow(im);
hist = zeros(2,256);
for i=1:256,
hist(1, i) = i-1;
hist(2, i) = sum(im(:) == i-1);
end
plot(hist(1,1:256), hist(2,1:256))
|
%1. Plot the function
y = @(t) (2-t).*(t>=0 & t<=2) + (2+t).*(t<0 & t>=-2) + 0.*(t>2) + 0.*(t<-2);
Fs = 10; % Sampling frequency
resulotion = 0.01;
N=Fs/resulotion;
T = 1/Fs; % Sampling Time
t = -2:T:2;
x = 2*tripuls(t,4);
%nfft = Fs/resulotion;
X = fft(x,N);
X = abs(X);
X = fftshift(X... |
clc
BASE_PATH = '/home/SharedData/omkar/data/'
data_exp4 = 'apy_50_400_cc1_data_part4_';
data_exp5 = 'apy_50_400_cc1_data_part5_';
train_classes = [7, 8, 10, 12, 13, 17, 21, 22, 23, 24];
margin = 0.0;
p = 1;
if 1
for j = 1:length(train_classes)
for k = 1:length(train_classes)
if (j ~= k)
str... |
n=input('Introduzca un número: ');
primosmenores(n) |
function [stat_family_size pedigree error] = family_size(pedigree)
% split families into connected components
% statistics about family size
% assign new family id
error = 0;
[rows, cols] = size(pedigree);
stat_family_size(1:rows) = 0;
if( rows == 0 || cols < 7 )
error = 1;
disp('error in pedigree struc... |
function nLines = struct2SMARTSinput(C,filename)
% nLines = struct2file(C,fileID)
%convert output from SetSMARTS295 into text file to send to smarts295.exe
%C = output from SetSMARTS295.m
%filename - full path to create input file for smarts295bat.exe
%nLines returns the number of lines written to the file
file... |
function [IGray_filtered] = med_filter(IGray, N1, N2)
% med_filter Wende Median Filter an.
% [Image] = med_filter(IGray)
% Diese Funktion wendet einen Median Filter der Filterlänge [N1 N2] auf das
% Grauwertbild IGray an und liefert das Ergebnis zurück.
%
% Erstellt: Juli 2019
N1_h = f... |
%% Puerto serial
if (exist('s'))
fclose(s);
end
clear all
s = serial('COM4', 'BaudRate', 115200,'DataBits', 8, 'OutputBufferSize', 1024, 'InputBufferSize', 1024);
fopen(s);
%% Vectores de prueba
a1 = uint8([0:31 0:31]);
a2 = uint8(0:2:31);
a3 = uint8(zeros(1,64) + 255);
a4 = uint8([1 9 0 7 1 9 9 4]... |
function [train,labels] = createTestFold(h,m,ind)
[_,folds] = size(h);
train = [];
labels = [];
for i = 1:folds
if i != ind
[rows_h,cols_h] = size(h(i).histogram);
[rows_m,cols_m] = size(m(i).histogram);
train = vertcat(train,h(i).histogram);
train = vertcat(train,m(i).hist... |
%% Matt McFarland
%
% E91, lab 5, question 4
%
function [] = q4script()
close all; clear all;
%% Define Constants and Functions
%
% *Constants*
start_t = 1;
end_t = 2;
start_y = -1;
n_end = 15;
n = 0:n_end;
methods = 5;
%%... |
function order_option_tab(main_figure)
tab_group=getappdata(main_figure,'option_tab_panel');
tags={tab_group.Children(:).Tag};
tag_order={'disp' 'laylist' 'map' 'proc' 'cal' 'env' 'reglist' 'sv_f' 'st_tracks' 'ts_f' 'lines'};
tag_order(~ismember(tag_order,tags))=[];
idx=cellfun(@(x) find(strcmpi(x,tags)),tag_order);
... |
% snapshot Extract snapshots (fixed times)
%
% This method extracts position-dependent information from a mesh1 object at
% fixed times.
% >> [position,data]=snapshot(object,time);
% When the object stores multi-dimensional data, specific variables can be
% extracted with a third input.
% >> [time,data]=snapshot(... |
function s = num2str(b)
% Copyright 2010 The MathWorks, Inc.
if isempty(b)
s = '[]';
elseif numel(b) == 1
s = num2str(b);
else
s = sprintf(['[%gx%g ' class(b) ']'],size(b,1),size(b,2));
end
|
%% System Matrices
A = zeros(10);
A(1:3,5:7) = eye(3);
A(5:7,8:10) = eye(3);
B = zeros(10,3);
B(8:10,1:3) = eye(3);
C1 = zeros(4,6);
%% Tuning Riccati Matrix
P_ris = [];
P = [];
R = eye(3);
%Q = diag([10^-3,10^-3,10^-3,10^-5,10^-8,10^-8,10^-8,10^-8,10^-8,10^-8]);
Q= 5000*eye(10);
for i=1:501... |
%% Generate a random unit vector w and rotation amount t.
syms w t
w = rand(3,1);
w = w/norm(w);
t = rand(1)*10;
%% Compare the rotation matrix generated with two methods.
R_1 = axang2rotm([w.',t]); %rotation matrix generated with axang2rotm
R_2 = expm(angvel2skew(w)*t); %rotation matrix generated with angvel2skew and... |
% clear;
% clc;
function [SRCnew_index2,Data_SRCnew_sort]=SRCnew(input,label)
%要求:特征除去NAN 0, label 1,2,1在前,2在后
index_nan=find(~isnan(mean(input)));
index_zero=find(mean(input)~=0);
index_nanandzero=intersect(index_nan,index_zero) ;
features_nozeroandnan=input(:,index_nanandzero);
input=features_nozeroandnan;
[n_x,n_... |
%PROGRESS_EXAMPLE2 Progress bar example.
%
% Creates some data and fits a CART tree to it. The experiment investigates
% the effect of how much data is used to fit a linear regression. It is repeated
% 50 times. Progress bars are manually included.
%
% See also: PROGRESS, PROG
%Author: Richard Stapenhurst
%$Date: 6/07... |
% This script generates synthetic data for feature selection with Ccor
% Mixture of copulas: C = p*C_s + (1-p)*\Pi, where C_s is a singular copula
% representing the deterministic relationship so that its support S has
% Lebesgue measure zero, \Pi corresponds to the independent copula \Pi(u,v)
% = uv (the uniform distr... |
function Stats_changes_matrix = stats_sensitivity(Auto_seg_img, Corrected_seg_img)
% Description : This function calculates the sensitivity of the axon
% segmentation performed by SegmentationGUI by comparing the result with
% the image obtained by correcting the segmentation (by using
% ManualCorrectionGUI).
% Auto_se... |
function quat = eu2q_vec(ac)
% \details
%
% yaw = ac(1)
% pitch = ac(2)
% roll = ac(3)
%
%
% Assumes:
% - dimension 3 is the rank 2
% - quaternion scalar component is the 4th position
%
if ~size(ac,2) == 3,
error('Second dimension of ac must be 3');
end
npoints=size(ac,1);
quat=zeros(npoints,4);
cy ... |
function [Pw_z, Pz_d] = PLSA(X, T, epsilon, lambdaB)
%
%
% learns plsa model with T topics from words x docs counts data
%
% X : (W x D) term-document matrix (observed data)
% X(i,j) stores number of occurrences of word i in document j
% T (scalar) : desired number of topics
% epsilon (scalar) : EM ... |
% max Determine maximum density value/location
%
% line segments defined by a five-column table: [x0 y0 Lx Ly theta]
%
% ADD INDEX!!!e
function [value,location]=max(object,mode,table)
%% manage input
assert(nargin>=2,'ERROR: insufficient input');
assert(ischar(mode),'ERROR: invalid mode');
mode=lower(mode);
switch m... |
m = Model('modelFileTest.model');
d = struct( );
d.x = Series(-10:20, @rand);
d.y = Series(-10:20, @rand);
d.cx = Series(-10:30, @rand);
dd = postprocess(m, d, 1:20, 'prependInput', true);
|
movnm = 'cell002_during.tif';
outname = 'cell002_during_eucl.tif';
if exist(['.' filesep outname],'file'), delete(outname); end
ml = length(imfinfo(movnm));
ss = size(imread(movnm));
num = 50;
fr = 0;
while fr < ml;
img = zeros(ss);
for i = [1, floor(num/2), num]
img = img + double(imread(movnm,f... |
function viirs2mat(vnp14filename)
% Take data from a vnp14/IMFTS hdf pair and save to .mat, needs vnp14
% filename as input.
str=regexp(vnp14filename, '\.hdf' , 'match');
if (isempty(str))
error('Passed a non-hdf file')
end
vnp14date=char(regexp(vnp14filename, 'A[0-9]+\.[0-9]+\.[0-9]+', 'match'));
IMF... |
function puinter
%pomiary
U=[210 215 220 225 230 235];
%P=[2.51 2.62 2.72 2.8 2.88 3.01];
P=[441.0 462.25 484.0 506.25 529.0 552.25];
%punkty interpolacyjne
Ui=[210:1:235];
[nUi,mUi]=size(Ui);
x=U; y=P;
xi=Ui;
ynearest = interp1(x,y,xi,'nearest');
ylinear = interp1(x,y,xi,'linear');
ycubic = interp1(x,y,xi,'cubic')... |
% https://www.allaboutcircuits.com/technical-articles/digital-signal-processing-in-scilab-how-to-decode-an-fsk-signal/
% mducng, SoC team, G2touch
% For MPP2.0: 256 pressure level by DC offset
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc; clear;
close all;
fbase = 18... |
clear
close all
radius = 20;
front_lens = sqrt(radius^2 - (x_front-radius).^2);
figure(1)
plot(40-x_optaxis,raymatrix','r') %Rays
hold on
%Plano-convex lens
line([40-thickness 40-thickness], [max(front_lens) -max(front_lens)],'color','black')
plot(40-x_front,front_lens,'black',40-x_front,-front_lens,'black') %Lens... |
function [ F, inlierIndices ] = estimateFundamental( matches)
nIterations = 200;
subsetSize = 8;
inlierDistanceThreshold = 35;
minInlierRatio = 20/size(matches,1);
[F, inlierIndices] = ransac(nIterations, subsetSize, inlierDistanceThreshold, minInlierRatio, matches);
disp('Number of inli... |
function prob=potenfn(i,w,A,bmatrix)
prob=zeros(1,size(w,2));
r=bmatrix(i);
for j=1:size(w,2)
pot=1;
edgepot=1;
bmatrix(i)=w(j);
for k=1:size(bmatrix,2)
pot=pot*exp(bmatrix(k));
endfor
for c=1:size(A,1)
for d=(c+1):size(A,1)
if(A(c,d)==1)
if(bmatrix(c)==bmatri... |
function X = nccaSequenceOptimise(model_in,model_obs,model_trans,X,type,iters,balancing,display)
% NCCASEQUENCEOPTIMISE Jointly optimise sequence and observations
% FORMAT
% DESC
% ARG model_in : observation model onto shared latent space
% ARG model_obs : model generating output domain
% ARG model_trans : dynamic mo... |
function [ out ] = sixteenAPSK( b )
R=0.4; %Choose inner circle radius
% Define coordinates according to the constellation
x1=cos(pi/4);
y1=x1;
x2=cos(pi/12);
y2=sin(pi/12);
x3=y2;
y3=x2;
x4=R*x1;
y4=R*y1;
% Pad zeros in the end if the length does not devide by 4
... |
function [ ] = display_image_and_offset( image, offset)
%DISPLAY_MASK_AND_OFFSET Summary of this function goes here
% Detailed explanation goes here
figure;
subplot(1,2,1);
%y is downwards
imshow(uint8(image));
%hold on ;
subplot(1,2,2);
%y is upwards
%quiver([1:size(offset,1)],sort([1:size(offset,2)],'descend'... |
classdef StudyCurator
%% STUDYCURATOR
% $Revision$
% was created 11-Jul-2019 18:20:18 by jjlee,
% last modified $LastChangedDate$ and placed into repository /Users/jjlee/MATLAB-Drive/mlraichle/src/+mlraichle.
%% It was developed on Matlab 9.5.0.1067069 (R2018b) Update 4 for MACI64. Copyright 2019 John J... |
clc; close all; clear;
load hospital;
C = hospital.BloodPressure(:,1);
CSR = mean(C)
COd = std(C)
h = histogram(C)
hold on;
c = sort(C);
Y = normpdf(c,CSR,COd)*100;
plot(c,Y);
|
function [f]=fscmb(x,y)
% Terme source
f=ones(size(x)); %matrice nb_noeud_bord*1
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.