text stringlengths 8 6.12M |
|---|
%@(#) findtestdir.m 1.2 06/03/22 09:31:56
%
%For test directories with one extra level, cf. findreakdir
%(No P4 functionality)
%
%function testdir=findtestdir
%Extracts '/cm/yourdir/yoursubdir' from cwd
%
% Or testdir=findtestdir(unit)
%
function testdir=findtestdir(unit)
direc=pwd;
if nargin>0,
if strcmp('c... |
function [first, last] = whatcoef2QL(level, colorF, o, L)
%------------------------------------------------------------------------------
%
% This function determines where to find a 2D gridfunction in the
% 1D storage vector (heap).
% The output is the first and last index within the heap.
% They are supposed to be un... |
x = <x0>;
y = [<x1[0, 0]>, <x1[0, 1]>, <x1[0, 2]>; <x1[1, 0]>, <x1[1, 1]>, <x1[1, 2]>; <x1[2, 0]>, <x1[2, 1]>, <x1[2, 2]>];
output = x*det(y);
if ~ exist('OutputFiles', 'dir')
status = mkdir('OutputFiles');
end
csvwrite(sprintf('OutputFiles/oupt.out'),output);
|
function th=forward(Ze)
% Usage: th=forward(Ze)
%------------------------------------------------------------------
% Some input administration
if nargin<3,
Zt=[];
mode=0;
elseif nargin<4
mode=0;
end
%------------------------------------------------------------------
N=length(Ze);
%--------------------------------... |
function SURF_Features( Image )
imshow(Image);
hold on;
points = detectSURFFeatures(rgb2gray(Image));
plot(points);
end
|
function [X,genelist]=r_SoupX(selpath)
%Run SoupX decontamination
%
% https://cran.r-project.org/web/packages/SoupX/vignettes/pbmcTutorial.html
%
% see also: run.r_decontX
oldpth=pwd();
X=[];
genelist=[];
[isok,msg]=commoncheck_R('R_SoupX');
if ~isok, error(msg); return; end
if nargin<1
selpath = uigetdir([],'Cel... |
function [retval] = home (m)
pkg load io;
opcion_menu_principal = 0;
opcion_menu_metodo_aproximacion = 0;
opcion_menu_aproximacion = 0;
prompt_valores = {"Cantidad de decimales"}; #Faltaria que agregar que seleccione el directorio de output
rowscols = [1]; #1.10 , se agrega el tamano del textbox
default = {'1'}
wh... |
clc
clear
load data_robot network
activeFcn = network.activeType;
W = network.weight;
b = network.bias;
numSim = 10000;
%inputInterval = [-5,5; -5,5];
inputInterval = [pi/3,2*pi/3; pi/3,2*pi/3];
ffnn = ffnetwork(W,b,activeFcn);
generateFcn(ffnn);
fprintf('Generate interval computation file. Press enter to continue.\n... |
function majority = majority_class(set)
%Return amount of rows.
rows = @(x) size(x,1);
%Initialise all the counts.
setosaCount = 0;
versicolor = 0;
virginica = 0;
%Loop over each value in the data set and count each
%of the unique classes; Setos... |
% Version : 4.1
% Author : Dano Bagus
clear all;
clc;
close all;
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% create_gabor is a s script . it's purpose is to craete a file
% with name 'gabor.mat'.
% This file contains a cell array matrix with name 'G'
% and 'G' has 40 32x32 matrixes cores... |
%{
size = 100;
A = zeros(11*size+1, 11*size+1);
b = zeros(11*size+1, 1);
A(1,1) = 1;
b(1) = T_0;
A(11*size+1, 11*size+1) = 1;
b(11*size+1) = T_11;
dx = 1/size;
for ind=2:11*size
i = ind-1;
x = i*dx;
A(ind, ind-1) = -1;
A(ind, ind+1) = -1;
A(ind, ind) = 2 + 0.1 * x * dx^2;
b(ind) = 0.1 * x * dx^2... |
clear all ; close all;
cd E:\angelina_2;
eegs = dir('*_luteal_0*vhdr');
for i=1:length(eegs)
eeg = pop_loadbv('.',eegs(i).name) ;
eeg = pop_chanedit(eeg,'lookup','C:\mscripts2\eeglab13_6_5b\plugins\dipfit2.3\standard_BESA\standard-10-5-cap385.elp') ;
eeg = pop_resample(eeg,256);
if i==1; merged = eeg ; else... |
function [Distance] = fmm(n, src, F, disp = false, method = 'spherical')
%--------------------input----------------------------------
% n : # of points in grid in one dimension
% src : coord of the source points "fire sources"
% F : matrix of weigths (n x n; progation "slowness" )
% disp : 0 : not display ;1 : display... |
function [obj, grid_var] = AddPhaseVariable(obj, rbm, grid_var)
%% Argument Validation
arguments
obj (1,1) NLP
rbm (1,1) DynamicalSystem
grid_var (1,1) struct
end
%{
Define 2 sets of phase variables (time and phase)
Not as decision variables, but calculated variables
Defining as decision vari... |
function [network,data] = getStaticNetwork(NUM_VERTICES,NUM_EDGES,NUM_SAMPLES,MAX_DEGREE,THETA_MIN,THETA_MAX)
if nargin<1, NUM_VERTICES = 10; end
if nargin<2, NUM_EDGES = floor(sqrt(NUM_VERTICES)); end
if nargin<3, NUM_SAMPLES = 100; end
global MAX_DEGREE; global THETA_MIN; global THETA_MAX
if nargin<4, MAX_DEGREE = ... |
Bits=100; %number of bits
SNR = 0:2:30; %snr in db
data = randint(1,Bits);%data array
data_detect = zeros(1,Bits);
BER = zeros(1,length(SNR));
BER_th = zeros(1,length(SNR));
for x=1:length(SNR)
error = 0;
data_channel = awgn(data,SNR(x),'measured'); % data+noise
for y = 1:Bits
... |
function AnswerCheck(SubjectName)
%%
%关闭所有绘图窗口并清除所有变量
close all;
% clear;
%关闭已经打开的Psych窗口
sca;
%显示部分设置
%执行默认设置2
%相当于执行了以下三条语句:
%“AssertOpenGL;” 确保Screen函数被正确安装
%“KbName('UnifyKeyNames');” 设置一套适用于所有操作系统的统一的KeyCode(按键码)和KeyName(按键名)对(MacOS-X),使用“ KbName('KeyNamesOSX')”查看
%在创建窗口后立刻执行“Screen('ColorRange', P... |
#############################################################################################################
# Part of the Bayesian Spectrum Analysis (BSA) package in Octave, by Emma
# Granqvist & Richard J. Morris, June 2011
# This code is only proof-of-principle, it is released freely and without any warranty
# For ... |
function [Bezier_curve_points]= eval_decasteljau(matrice,resolution)
tmp=matrice;
n=size(matrice,2)-1;
temps=1:resolution;
for t=temps
tmp=matrice;
for k=1:n
for i=1:n-k +1
tmp(1, i)=((t-1)/resolution)*(tmp(1, i+1)) + (1-((t-1)/resolution))*(tmp(1, i));
tmp(2, i)=((t-1)/resolutio... |
%% Import data from spreadsheet
% Script for importing data from the following spreadsheet:
%
% Workbook: C:\Users\User\Desktop\vertical-5.xls
% Worksheet: Sheet1
%
% To extend the code for use with different selected data or a different
% spreadsheet, generate a function instead of a script.
% Generate... |
%{
% Author: Brennen Green
% Assignment: EGR102-001 Roughness Classifier
% Date: 10/30/2019
% Purpose: An algorithm that classifies the type of material the sensor is
% reading
table
%}
%Connect_Arduino();
analog = zeros(1,5); %holds voltage reads
for index = 1:5 %run values 1 to 5
analog(index) = readVolta... |
%% Initialize
clear
addpath('./functions');
%% Memory Allocation
ProgramMemory = zeros(16, 8);
SetProgramMemory;
Register = zeros(2, 4);
CarryFlag = 0;
InputPort = zeros(1, 4);
OutputPort = zeros(1, 4);
%% Emulation
i = 1;
while (i <= length(ProgramMemory))
ImData = ProgramMemory(i, 1:4);
Oper... |
function [game_names_ordered, sprite_types_ordered] = get_game_names_ordered(subj_id)
if subj_id <= 11
game_names_ordered = {'vgfmri3_chase','vgfmri3_helper','vgfmri3_bait','vgfmri3_lemmings','vgfmri3_plaqueAttack','vgfmri3_zelda'};
sprite_types_ordered = {
{ 'wall', 'carcass', 'angry', ... |
clc;
clear;
close all;
global M m1 m2 L1 L2 g d1 d2 d3 w1 w2 w3
M = 2;m1 = 0.2;m2 = m1;
L1 = 0.5;L2 = L1;
g = 9.81;
d1=0;d2=0;d3=0;
w1=0;w2=0;w3=0;
[A,B,C,D]=State_Space();
%%
Abar = [A zeros(6,2);-C eye(2,2)];
Bbar = [B;zeros(2,2)];
rank(ctrb(Abar,Bbar))
desired_poles = [-1+1j -1-1j -2+2j -2-2j -2 -... |
%kyle magness
%Chaos plotting
clc;clear;
%% Variables
w=1920*3; %width of image
h=1080*3; %height
pixels=zeros(h,w); %allocate space for image
weight=1; %used in adding light to the image
rmin=1;
rmax=4;
%% Math
for r=linspace(rmin,rmax,w) %loop over a bunch of r values
y=zeros(1,250);
y... |
function [areas, xDs, yDs] = computeRegionSpa(L, cSegs, mSeg)
% Compute spatial prior of each region.
%
% Input
% L - label image, h x w
% cSegs - segment index, 1 x mSeg
% mSeg - #region
%
% Output
% areas - area size, mSeg x 1
% xDs - differency sum in X position, mSeg x 1
% yDs ... |
% ================== Testing Block ZORO algorithm ================ %
% Testing Block_ZORO on Sparse Quadric, for problems of increasing size.
% Daniel Mckenzie
% August 2020
% ================================================================ %
clear, close all, clc
% ================================ ZORO Parameters ==... |
function [Rout, varargout] = ringpass(ring, Rin, varargin)
%RINGPASS tracks particles through each element of the cell array RING
% calling the element-specific tracking function specified in the
% RING{i}.PassMethod field.
%
% ROUT=RINGPASS(RING,RIN,NTURNS) tracks particle(s) with initial
% condition(s) RIN for NTU... |
% rng(42,'twister')
% addpath(genpath('isc'))
%
%% Compute LBO
nLBO = 300;
extract_lbo('F:\BU3D\BU3D_remeshed\shapes', 'F:\BU3D\BU3D_remeshed\LBOs', nLBO);
%% Compute GEOVEC
%% train and test should be divied!!!
nGEOVEC = 150;
geovec_params = estimate_geovec_params('F:\BU3D\BU3D_remeshed\LBOs', nGEOVEC);
extract_geov... |
function testGaborFilter
%% by dzhg: zhgdai@126.com
%% This code is to search the direction of the vessel for each point of
%% the Image. I apply Gabor Filter to this work and the corresponding
%% output Gabor filter will be choosed to be the direction of the vessel.
%% if you have any question about this code, pl... |
function [ m ] = getm( g,r,u,p )
%% 二分查找确定使用最少的机器个数
m1=1;
m2=length(r);
m=m2;
flag=1;
while flag
n=fix((m1+m2)/2);
[flag,~]=shedule(n * g,r,u,p);
%存在可行解
if flag
m=n;
m2=n;
else%不存在可行解
m1=n;
end
... |
function [pos,errs,candidates] = NVposition2(im,NVsize,sensitivity,spatial_filter,ax)
% Takes filtered and cropped image and returns position of NVs
% Position is in pixels (pos is 2*N)
% Candidates are the approximate peaks found
% errs are the adjusted rsquared values (use to filter pos)
%
% O... |
function driftComputeAndApply(F,Visible)
%driftApply(F) creates a binary file with the translated values
% setup
RefStack = F.Analysis.RefStack;
RefIndex = F.Analysis.RefIndex;
RefLayers = F.Analysis.RefLayers;
% create wrapper object
m = adapted4DMatrix(F,'source');
mRef = false;
... |
function [lGrid] = tasRLCwaveletX(iDim, iOut, iDepth, iOrder, ...
max_points, maxIter, fTolerance_init, run_real, grid_name, verbose, mTransformAB)
%% hard parameters
refine_criteria = 'fds';
refinement_rate = 2;
%% if refinement had started, reload grid
try
lGrid = tsgReloadGrid(grid_name);
catch
%%... |
close all
clear all
decision_map_path = '/usr/not-backed-up/1_convlstm/convLSTM_prediction6_exit/';
addpath('../')
addpath(genpath('../Persistence1D'))
expand_range = 50;
%gt
testSeqPath = '/usr/not-backed-up/1_DATABASE';
load(fullfile(testSeqPath,'gt1_exit.mat'))
% load(fullfile(testSeqPath,'gt1_exit_new_H.mat'))
% gt... |
% move the robot a certain distance
% distance: distance to move in cm
% power: the speed at which the motors turn
% forward: a boolean value that indicates whether the robot
% should move forward or backward
%false left
function manoeuvre_r(leftMot, rightMot, power, direction)
move_r(leftMot, rightMot, 19... |
function [CROP_MOVIE,ROIS]=stan_cadata_crop_movie(FRAMES,ROIS,MOTIF,PAD)
% given ROI x and y points, crop out movie
%
%
%
if nargin<4 | isempty(PAD)
PAD=50;
end
if nargin<3 | isempty(MOTIF)
MOTIF=2;
end
nrois=length(ROIS.coordinates);
CROP_MOVIE=cell(nrois,length(FRAMES));
CROP_ROIS=cell(nrois,1);
% given a set ... |
dir = '/home/jtao/robo7_vision/ACF_detection/ras/models/Luv+Mag_3data/test.avi';
v = VideoReader(dir);
while hasFrame(v)
image = readFrame(v);
imshow(image);
pause;
end |
classdef gCloud < handle
% Interface from Matlab to Google Cloud Platform
%
% Syntax
% gcp = gCloud(...)
%
% Description
% This function sets up a k8s cluster on the google cloud platform.
% The arguments set up various defaults (account, the docker image,
% the storage buck... |
%% Documentation
% Description:
% Component-wise sparse recovery of the Lorenz96 system using
% l1 minimization techniques. Uses quadratic tensorized generalized
% Legendre polynomials as the bounded orthonormal system for recovery.
% Randomly sampled data and subsequent "bursts" used to construct
% a dictionary ... |
function [E,D_gt_val] = disp_error_map (D_gt,D_est)
D_gt_val = D_gt>=0;
E = abs(D_gt-D_est);
E(D_gt_val==0) = 0;
|
%% Fault-Tolerant Control of a Passenger Jet
% This example shows how to tune a fixed-structure controller for multiple
% operating modes of the plant.
% Copyright 1986-2012 The MathWorks, Inc.
%% Background
% This example deals with fault-tolerant flight control of passenger jet
% undergoing outages in the elevator ... |
classdef System2 < handle
properties
N
boxSize
agents
dt
XLim;YLim;
K
x0s
v0s
end
properties (Dependent)
centerOfMass
meanV
x
v
end
methods
%% constructor with circle radius, number of agents
%{
N: number of agents
boxSize: size of the region wherein agents will... |
function varargout = GUI(varargin)
% GUI MATLAB code for GUI.fig
% GUI, by itself, creates a new GUI or raises the existing
% singleton*.
%
% H = GUI returns the handle to a new GUI or the handle to
% the existing singleton*.
%
% GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% ... |
function plot_harris(im_name_1, im_name_2)
% We load the images
im1 = imread(im_name_1);
im2 = imread(im_name_2);
% Store the relevant keypoints
[~, r1, c1] = harris(im1, 2, 1000, 10, 0);
[~, r2, c2] = harris(im2, 2, 1000, 10, 0);
% Set a window size
win_size = 20;
f... |
function pc = PlotBottom_v1(handles,parenthandles,oneargouts,argnumber)
%
% function PlotBottom_v1(handles,parenthandles,oneargouts,argnumber)
%
% Will be called from plotargout.m in order to plot the appropriat graph
% on the bottom plot of the gui.
% handles = the handles structure from the plotargout gui
% parenthan... |
function [fscore_train, fscore_val] = svmlearningcurve(X, y, X_val, y_val, learning_steps)
%LEARNING_CURVE returns learning curve data
m = size(X, 1);
step_size = floor(m / learning_steps);
fscore_train = zeros(learning_steps, 1);
fscore_val = zeros(learning_steps, 1);
for i=1:learning_steps
num_training_example... |
function train_represent_error( X_Data, x_mn, x_plot )
% if full_rank
n_tot = rank( X_Data );
X_trn_subt = X_Data - x_mn;
RMSE_err = zeros(n_tot, 1);
for r = 1 : n_tot
W_r = get_EigenFace( X_trn_subt, r ); % W -- eigenfaces
Y_r = X_trn_subt * W_r; % 25 eigenvectors basis
... |
clear all ; close all;
cd e:/sim/saved;
% xcorrs(sub,scan,freq,rsn,:)
rsn_titles = {'Anterior Visual','Default Mode','Higher-order Visual','Primary Visual','Motor'};
nogsr = load('sortpower_gsr') ; nogsr = nogsr.sortpower_gsr;
nogsr(isnan(nogsr)) = 0;
temp = zeros(size(nogsr,1),4,size(nogsr,3),size(nogs... |
temp = imread('temp.jpg');
shot = imread('camtemp1.jpg');
% vid = videoinput('macvideo', 1);
% set(vid,'FramesPerTrigger',inf);
% set(vid, 'ReturnedColorSpace', 'RGB');
%
% shot = getsnapshot(vid);
%%
%figure
%imshow(shot);
%%
% imhist(shot(:,:,3))
% title('Histogram of the Red Band (Band 3)')
%%
strshot = ... |
function resetGlobals()
% Set gloabal variables to unity
setGlobal_f(1,1,1);
setGlobal_c(1,1,1);
setGlobal_g(1,1,1);
setGlobal_h(1,1,1);
setGlobalStrings('1', '', '', 'F(s)');
setGlobalStrings('1', '', '', 'G(s)');
setGlobalStrings('1', '', '', 'C(s)');
setGlobalStrings('1', '', '', 'H(s)');
|
function [t,rec] = hiP2X7(ton,toff,ttot)
taude=normrnd(6,0.5);
tauact=min(0.15,max(normrnd(0.1,0.05),0.05));
ampfast=normrnd(2500,200);
ampslow=normrnd(1000,200);
ampnipple=normrnd(140,20);
thold=toff-ton;
tclosed=unifrnd(0.02,0.04);
topen=ton;%+tclosed;
dt=0.5;
tfast=min(1,max(normrnd(2,0.5),3));
tslow=topen+... |
function Bajar_Puntero()
global Puntero
bajar_P = -0.5:0.1:0.5;
vect_Punt = getfield(Puntero, 'translation');
for b=1:length(bajar_P)
Puntero.translation = [0 vect_Punt(1,2) bajar_P(b)];
pause(0.01);
end
end |
function helperPlotSVM(SVMModel,TestData)
%helperPlotSVM Generate SVM boundary and view outliers.
%
% This function is only in support of
% CentrifugalPumpFaultDiagnosisUsingSteadyStateExperimentsExample. It may
% change in a future release.
% Copyright 2017-2018 The MathWorks, Inc.
svInd = SVMModel.IsSupportVector;
... |
%% TNM087 - Labb 1
% Christoffer Engelbrektsson & Johan Nordin
% MT3
%% Dot 1
% Read in and plot the gfun
clear all;
makegfun;
load('gfun.mat');
plot(gfun);
hold on
plot(2.^gfun)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Spara bilderna i en 4-dim matris
load('gfun.mat');
% Lad... |
function varargout = createCubeOctahedron()
%CREATECUBEOCTAHEDRON Create a 3D mesh representing a cube-octahedron.
%
% [V, E, F] = createCubeOctahedron;
% Cubeoctahedron can be seen either as a truncated cube, or as a
% truncated octahedron.
% V is the 12-by-3 array of vertex coordinates
% E is the 27-... |
function [A,CAL] = autocalacc(s,p,t,CAL,test)
% [A,CAL] = autocalacc(s,p,tempr,CAL,[test])
% Automatically performs a calibration sequence on the raw
% accelerometer data in raw sensor matrix s. Calls calacc.m
% for the actual calibration steps.
%
% mark johnson
% majohnson@whoi.edu
% last ... |
modulos =[]
load "videosTr.gz";
#Ejercicio1
function [modulo] = calcularModulo(matr)
sum = 0;
for i =matr
sum+=i**2;
end;
modulo =sqrt(sum);
end;
[Row,Column] =size(data);
for x = 1:Row
modulos(end+1) = calcularModulo(data(x,1:Column-1));
end;
#Ejercicio2
#Ejercicio 3 vectores unitarios
function[dataUni... |
function [ G ] = normalizeFSturm( F,w,h,typicalF )
K=[1 0 0 ; 0 1 0 ; w/2 h/2 1];
KT=K';
G1=K*F*KT;
FF=[ typicalF 0 0 ; 0 typicalF 0 ; 0 0 1];
G2=FF*G1*FF;
if( abs(G2(3,3))>0.00000001)
G=G2/G2(3,3);
else
G=G2;
end
% K_norm=zeros(3,3);
% K_norm(1,1)= typicalF;
% K_norm(2,2)= typicalF;
% K_norm(3,3)= 1;
% K... |
clear all
close all
clc
run('../config/config_tool');
path1 = 'D:\dataset\CDN\dynamicBackground\canoe\similar';
path2 = 'D:\result\canoe\similarty';
format_img = 'png';
% run('config/config_tool');
[files_img2 data_img2] = loadData_plus(path2,format_img);
[files_img1 data_img1] = loadData_plus(path1,format_img);... |
function [meann, maxx] = matJacc(correlations, Matrix, correlatingGenes, genesToCheck)
assert(size(correlations,1) == size(correlations,2));
assert(correlatingGenes>0);
assert(correlatingGenes<size(correlations,1))
if ~exist('genesToCheck', 'var')
genesToCheck = size(correlations,1);
end ... |
function [sigma_D, K_D]=transform_g_conditional_HIW_cell(sigma_B, g, cliques, delta, B, D)
% inputs: 1. sigma_B~HIW(g, delta, B), the p x p covariance
% 2. g, the p x p symmetric matrix with
% respect to an original ordering v_1, ..., v_p
% 3. cliques, a 1 x t cell array of a perfect sequence of
% (nonempty) cliqu... |
clear all;
close all;
% PWM_level = .2:.1:1;
% pred_napelniania = [8.69 39.9 59.52 75.97 89.99 102.46 115.05 128.27 139.79];
PWM_level = .3:.1:1;
pred_napelniania = [39.9 59.52 75.97 89.99 102.46 115.05 128.27 139.79];
figure()
plot(PWM_level, pred_napelniania, 'r*');
hold on;
p1 = polyfit(PWM_level, pred_napelniania... |
function ventriloquist3_gaze
close all
clear all
clc
subject = 5;
switch subject
case 1
cd('E:\DATA\Audiovisual\Audiovisual Reference Frame\MW-RG-2012-03-18'); % datadir
fname = 'MW-RG-2012-03-18-0001';
case 2
cd('E:\DATA\Audiovisual\Audiovisual Reference Frame\MW-DM-2012-04-20'); % subject
f... |
function [amis corrs] = ami(xy,nBins,nLags)
% AMI computes and plots average mutual information (ami) and correlation for
% lagged vector of univariate or bivariate time series.
%
% USAGE:
% [amis corrs] = ami(xy,nBins,nLags)
%
% INPUT:
% xy: either univariate (x) or bivariate ([x y]) time se... |
function [T,puma_T] = pumaFK(joint_angles, puma)
L1 = puma.parameters.L_1;
L2 = puma.parameters.L_2;
L3 = puma.parameters.L_3;
L4 = puma.parameters.L_4;
a1 = puma.parameters.a1;
a2 = puma.parameters.a2;
a3 = puma.parameters.a3;
a4 = puma.parameters.a4;
T01 = dhtf(0,0,0,joint_angles(1));
T12 = dhtf(a1,... |
function error = calculateError(y, pixels, dc)
phi1_error_up = pxToDeg(round(y(1)-pixels));
phi2_error_up = pxToDeg(round(y(2)-pixels));
phi1_error_down = pxToDeg(round(y(1)+pixels));
phi2_error_down = pxToDeg(round(y(2)+pixels));
%disp([phi1_error_up*180/pi phi2_error_up*180/pi ; phi1_err... |
function S = Simpson(funItg, a, b, n)
%Simpson's rule
h = (b-a)/2/n;
xodd = [a+h:2*h:b-h];
xeven = [a+2*h:2*h:b-2*h];
S = feval(funItg,a) + feval(funItg,b) + 4*sum(feval(funItg, xodd)) + 2*sum(feval(funItg,xeven));
S = S * h/3;
end
|
%% Signal generation
% pulrecsig.m: create pulse shaped received signal
N=10000; M=20; Ts=.0001; % # symbols, oversampling factor
time=Ts*N*M; t=Ts:Ts:time; % sampling interval & time vector
m=pam(N,4,5); % 4-level signal of length N
mup=zeros(1,N*M);
mup(1:M:N*M)=m; % oversample by integer ... |
% INPUT:
% --------
% srgb : a Nx3 matrix, [0..1]
%
% OUTPUT:
% --------
% RGBint: a Nx3 matrix with one RGB value per row, in [0..255]
%
function RGBint = srgb_2_RGBint(srgb)
if size(srgb,2) ~= 3
error('each input row is expected to be one XYZ entry');
end
ThrLin2Gamma = 0.0031308;
indexGamma = find(srgb > ... |
function ode = modelPulseODEpotentP2X4(ton,toff)
global k1 k2 k3 k4 k5 k6 k7 k8 k9 k10 k11 k12 kd0 ku0 kd1 ku1 kd2 ku2 kd3 ku3 L1 L2 L3 L4 L5 L6 H1 H2 H3 H4 g1 g2 E1 E2 delta epsilon mu A J V n1 n2 n3 v1 v2 v3 r1 r2 r3 alpha a1 a2 a3 A0 J0 IVMon IVMoff;
ATP=@(t) 0;
for i=1:length(ton)
ATP= @(t) ATP(t) + (A0*(heavi... |
% This is material illustrating the methods from the book
% Financial Modelling - Theory, Implementation and Practice with Matlab
% source
% Wiley Finance Series
% ISBN 978-0-470-74489-5
%
% Date: 02.05.2012
%
% Authors: Joerg Kienitz
% Daniel Wetterau
%
% Please send comments, suggestions, bugs,... |
clear; clc; ca;
n_pdt_arr = 2; % N by 1 array (number of predictors)
pitch_range_arr = 0; % N by 2 array (ranges of pitch variations)
n_helix_arr = 1; % N by 1 array (number of helices)
deg_inc = 2;
for ppp = 1:size(pitch_range_arr,1) % pitch range
pitch_range = pitch_range_arr(ppp,:);
dpname = ['pitch_'... |
function []= display1(im)
% im=(im-min(im(:)))/(max(im(:))-min(im(:)));
im(im<0)=0;
im = im/max(im(:));
imshow(im);
end |
function invnormim = iminvnorm(normim, height, width, normtform, udata, vdata)
%
% Perform inverse normalization on a normalized image
%
% Input:
% normim: normalized grayscale image
% height, width: size of the original (unnormalized) image
% normtform: tform of normalization
% udata, vdata: coordinate... |
function v_des = modified_FollowerStopper2(d_rel,v_rel,v_av,r)
% d_rel : relative distance (x_l - x_f)
% v_rel : relative speed (v_l-v_f)
% v_av : subject vehicle absolute speed
% v_des : desired speed of the subject vehicle at next time step.
% d_rel,v_rel,v_av, and v_des are double arrays (matrices) of same dimensio... |
function [handle] = PlotElement_Disp(coord, ele, val, cMap)
if nargin < 4; cMap=gray; end
ne = length(ele);
elePoint = NaN(ne,8);
for ii = 1:ne
nodes = ele{ii};
elePoint(ii,1:length(nodes)) = nodes;
end
%val = sqrt(sum(val.^2))';
handle = patch('Faces',elePoint,'Vertices',coord,'FaceVer... |
classdef BlurConeResponse < ConeResponsePeripheral
properties (Access = public)
blurSD;
end
methods(Access = public)
function this = BlurConeResponse(eccX, eccY, blurSD, varargin)
this@ConeResponsePeripheral(eccX, eccY, varargin{:});
this.blurSD = blurSD;
... |
s_original = readtable('Strain.csv');
d = readtable('destinations.csv');
s = s_original;
s.site_name = categorical(s.site_name);
s.posa_continent = categorical(s.posa_continent);
s.user_location_country = categorical(s.user_location_country);
s.is_mobile = categorical(s.is_mobile);
s.is_package = categorical(s.is_pac... |
function [W]=lda(X, xl, k=256)
D = rows(X); # dimensiones
n = columns(X); # número de muestras
m = sum(X')' / columns(X); # valor medio para cada dimensión
# Cálculo de Sb y Sw
Sb = zeros(D, D);
Sw = zeros(D, D);
for c=unique(xl)
indc = find(xl == c);
nc = columns(indc);
... |
%EKF test for spin stabalized s/c
%THIS IS NOT GOOD. NEED TO REDO WITH QUATERNION TO AVOID SINGULARITIES
%state: [roll pitch yaw wx wy wz]
%measurements: sun sensor, gyro
dt = 0.05;
tf = 4*60;
t = 0:dt:tf;
n = length(t);
mu = zeros(6,n);
mz = zeros(6,n);
gyro_noise = (pi/180)*(0.1)/(24*60*60); %accurate to within 0... |
% SynchronousOneBufferedAI.m
%
% Example Category:
% AI
% Matlab(2010 or 2010 above)
%
% Description:
% This example demonstrates how to use Synchronous One Buffered AI
% function.
%
% Instructions for Running:
% 1. Set the 'deviceDescription' for opening the device.
% 2. Set the 'startCha... |
% Problem 2.5(a) - 1
x1 = [1 0 0 0 0 0];
x2 = [0 1 0 0 0 0];
x3 = [1 2 0 0 0 0];
nx = 0:5;
xe1 = [0 0 x1];
xe2 = [0 0 x2];
xe3 = [0 0 x3];
w1 = x1;
w2 = x2;
w3 = x3;
for i = 3:8
w1(i-2) = xe1(i) - xe1(i-1) - xe1(i-2);
w2(i-2) = xe2(i) - xe2(i-1) - xe2(i-2);
w3(i-2) = xe3(i) - xe3(i-1) - xe3(i-2);
end
w... |
% function afMassFlows = VentingPercentageToMassFlowQuadraticCase( faVentingPercentages , strKindOfDuct )
%
function afMassFlows = VentingPercentageToMassFlowQuadraticCase( afVentingPercentages, strKindOfDuct )
%
try %
%
% if afVentingPercentages > 100
% %
% warning('Warning: The percentage must be ... |
clear
clc
a=5;
b=7;
if a>0
c=b+a;
else
c=b-a;
end
|
classdef HamiltonianNN < abstractMeganetElement
% Double Layer Hamiltonian block
%
% Z_k+1 = Z_k - h*act(K(theta_k)'*Y_k + b),
% Y_k+1 = Y_k + h*act(K(theta_k)* Z_k+1 + b)
%
% theta_k is the sampling time t_k
%
% The input features are divided into Y and Z here based on the sizes
... |
clear; clc;
fid = fopen('rules.txt');
%% rules row
result = 0;
A(36,1) = "b";
A(44,1) = "a";
while 1
tline = fgetl(fid);
if ~ischar(tline)
break;
end
indexsSemi = strfind(tline,':');
index = str2num(tline(1:indexsSemi(1)-1))+1;
if index == 9
dfgdfg=1;
end
... |
function [] = self_contained
clear; clc; D = 2;
%% Set parameters
w1 = 1; w2 = 30; w3 = 100; damping = 0.1; num_iters = 50;
%% Load data
load('radii.mat'); load('blocks.mat'); load('centers.mat');
%% Set up data structures
parents = {[], 1, 2};
limits = cell(length(blocks), 1);
for i = 1:length(blocks)
limits{i... |
% ---------------------------------------------------------------------
% Book: MVA
% ---------------------------------------------------------------------
% Quantlet: MVApcp8
% ---------------------------------------------------------------------
% Description: Computes curve parallel coordinates plo... |
% Example Progressive Vector Diagram
%
% by David L. Jones, 2002
%
% This file is part of the FATHOM Toolbox for Matlab and
% is released under the GNU General Public License, version 2.
% File: '.../examples/vecPlot.mat'
% Load the data:
load vecPlot.mat
%
% Create plot:
f_vecDiagram(u,v,0,1);
|
syms q1 q2 q3 q4 q5 q6
tbl = [
[0 128 0 90 ]; %1
[0 0 -612 0 ]; %2
[0 0 -572.3 0 ]; %3
[0 163.941 0 90 ]; %4
[0 115.7 0 -90]; %5
[0 92.2 0 0 ]; %6
];
wtcp = [-471 -782.73 201.03 -179.88 -24.48 -158];
q = [45 45 45 45 45 45];
qtest = [-... |
function [O_error, O_grad]=bspline_registration_gradient(O_grid,sizes,Spacing,I1,I2,options,MaskI1,MaskI2,Points1,Points2,PStrength)
% Function registration_gradient. This function will calculate a registration
% error value and gradient after b-spline non-rigid registration
% of two images / volumes.
%
% [error, ... |
function [W,G] = meshfix(V,F)
% Call Marco Atene's MESHFIX on a mesh
%
% [W,G] = meshfix(V,F)
%
% Inputs:
% V #V by 3 list of mesh vertex positions
% F #F by 3 list of triangle indices
% Outputs:
% W #W by 3 list of output mesh vertex positions
% G #G by 3 list of output triangle indic... |
%Project #2: Part 1 - ME 303
%Sebastien Blanchet, Timothy Wulff
%Intialize script
close all
clear variables
clc
%Create symbolic variables for computation of integrals
syms n t x S L K T_L T_0 alpha ;
%Set integral functions, view equations in report
g(x)= ((S*((L^2)-(x^2))/(2*K)))+T_L;
p(x)= (T_0-g(x))*cos((n*pi*x)... |
% MRLDWNC.M
% To read slider
% for new dwelln time (mrsdweln) and gm
% Called by MRLRM
% Sets new dwelln (mrldweln) and calc new gm
% Check for replot turned on ***********
if mrlreplv == 1 ;
set(mrluirepl, 'Visible', 'off') ;
set(mrlreplb, 'Visible', 'off') ;
mrlreplv = 0 ;
end ;
% Proceed *************
mrld... |
function setbtsdes
% BTS configuration
% SETBTSDES set CurrSetpt values stored in a file to CurrSetptDes
% filed for standardizing
BTSCONFIGDIRECTORY = getfamilydata('Directory','BTS');
if nargin==0
BTSCONFIGFILENAME = uigetfile(BTSCONFIGDIRECTORY);
end
if BTSCONFIGFILENAME ==0
disp(' No BTS configuration loa... |
function value = initial1(x)
%INITIAL1: MATLAB function M-file that specifies the initial condition
%for a PDE in time and one space dimension.
value =100*2*x/(1+x^2);
|
% Authors: Rasoul Shafipour, Ali Khodabakhsh
% Reference:
% R. Shafipour, A. Khodabakhsh, G. Mateos, and E. Nikolova. A directed graph Fourier transform with spread frequency components. IEEE Trans. Signal Process., 67(4):946?960, Feb 2019
% This function outputs the DGFT frequencies and basis vectorts given an N by N... |
%% Initialise
clc;
clear;
close all;
addpath(genpath('..\GCMex\'));
tic;
%% Parameters & Properties
% change this value to change the weight of smoothness or prior term. high value = encourage smoothness between neightbours
ratio = 65; % ratio = number of patches per dimension (65)
% higher = more patches, sm... |
function plot_cdcondition_polar(cdc)
%
%
%
%
%
%
%
angles = [0 30 60 90 120 150 180 210 240 270 300 330];
radians = (angles * pi) / 180;
radians = [radians 0];
epochs = {'CD1','CD2','CD3','CD4'};
for i = 1:4,
figure();
resps = cdc.(epochs{i}).resps.normresps_aligned_site_avg;
resps = [resps r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.