text stringlengths 8 6.12M |
|---|
clc,clear all, close all,
%Abre el video
video = videoinput('winvideo',1,'yuy2_640x480');
set(video,'ReturnedColorSpace','rgb');
preview(video);
%Toma 9 fotografías para completar la vuelta completa
for i=1:9
foto=getsnapshot(video);
numero=num2str(i);
nombre=strcat('scrcap',numero,'.jpg');
pause; %Espe... |
% Activity: MATLAB 2 Bonus, Task 3
% File: ML2_ACT_Task3_katherto.m
% Date: 22 November 2015
% By: Kathryn Atherton
% katherto
% Ryan Hellyer
% rhellyer
% Natalie Zimmermann
% zimmermn
%
% Section: 04
% Team: 59
%
% ELECTRONIC SIGNATURE
% Kathryn Atherton
% Ryan Hellyer
% Natalie Zimmermann
%
% The electronic signatur... |
clear all;
r3=0;
a=0.8;
b=0.01;
k=0;
bias=pi;
r1=-2*pi:0.01:2*pi;
r2=r1;
figure
for n=1:length(r1)
U(n,:)=-((1+k)*cos(r1-r2(n)-r3)+(1-k)*cos(r1+r2(n)+r3)+a*cos(2*r2(n)+bias-r3/a))+(1+2*a)^2*(1-k^2)/(2*a*b*(1+2*a-k^2))*r3.^2;
end
surfl(r1,r2,U);
shading interp;
colormap(bone(512));
xlabel('\gamma_a');
ylabel('\gamma... |
function [ConValue,ConVar,CI95,CI99]=ConMCM(N,M,int_S1,int_S2,T,t,sigma1,sigma2,rho,r)
%% T partation %%
tau=T-t;
ConGBm=zeros(N,4);
%% Sampling %%
tic
for i=1:N
[a,b,c,d]=ConMilstein(M,int_S1,int_S2,tau,sigma1,sigma2,rho,r);
ConGBm(i,:)=[a,b,c,d];
end
%% Control Monte Carlo %%
tm... |
function [T_LightD,T_FoodD,WeightD,BoxD] = IndxD_Godfrey(T1,WeightD,BoxD,DarkBoxD_Entry)
%{
No prreparation of StatisticsLightDarkBoxD needed
T1 must be StatisticsLightDarkBoxD;
Used in the function CreateStrucLDB_Godfrey.m
Uses the following functions:
TableMaker_Godfrey.m
AddVariable_Godfrey.m
merge... |
%% Opdracht 10
% Maak een functie aan met de naam: 'opdracht_10'.
%
% Deze functie heeft 2 inputs: een hoek in radialen (hoekRad) en een
% hoek in Graden (hoekGraden).
% Deze functie heeft 4 outputs: de cosinus en de sinus berekent uit de
% hoekRad en de cosinus en sinus berekend vanuit de hoekGraden.
%
% Maak gebr... |
close all;
clear all;
fprintf('Reminder: You must be in folder with read.m \n');
%startup commands
addpath(pwd);
addpath([pwd,'\library']);
%read all bmatrix from files
dirname = input('Enter directory name: ', 's');
fprintf('\nReading all directors and storing into allbmatrix...\n See allbmatrix \n');
fdata = dir(d... |
%mGPUgaussMLE GPU based MLE of single molecule position, emission rate and background
%
% [X Y N BG S CRLBx CRLBy CRLBn CRLBb CRLBs LogL]=GPUgaussMLE(data,PSFSigma,iterations,fittype)
%
% This code performs a maximum likelihood estimate of particle position,
% emission rate (photons/frame), and background rate (... |
function hyperObj = getRidgeHyperObj_grid(X, Y, obj, scoreObj)
hyperObj.name = 'ridge_grid';
% define grid
lbs = 1e-3; ubs = 1e-3; ns = 1;
hypergrid = tools.gridCartesianProduct(lbs, ubs, ns);
% set cross-val fold inds
nfolds = 5;
foldinds = obj.foldinds;
hyperObj.fitFcn = @reg.cv... |
%% IQ mixer calibration for 2 channels
data_taking.public.calibration.iqChnl(...
'awgName','da_ustc_1','chnlSet','b05_2_1','maxSbFreq',200e6,'sbFreqStep',20e6,...
'loFreqStart',4.5e9,'loFreqStop',6.5e9,'loFreqStep',100e6,'spcAvgNum',1,...
'notes','DAC B05, I:CH2, Q CH1','gui',true,'save',true); |
function output = avg_retransmission(varargin)
output = feval(varargin{:});
function output = init
global rsc
orig_bytes = statistic('byte_offset', 'realSource');
dg_bytes = statistic('byte_offset', 'dataGenerated');
forward_bytes = statistic('byte_offset', 'forwardPacket');
tr_bytes = statistic('byte_offset... |
# BollingerBanksBackTesting
[Data,~,Raw]=xlsread('BA_Bollinger.xlsx',7,'A1:E1281');
Date=datetime(Raw(2:end,1),'Convertfrom','excel','Format','MM/dd/yyyy');
Datee=Raw(2:end,1);
Dateee=datenum(Datee);
Price=Data(:,4);
% MV=20, Upper and Lower Std Factor=2
[record,Summary]=AllinReversingfunction(Price,Dateee,20,2,2);
% o... |
function clickHigh_prs(obj, evt, stage)
hndl = get(gcf, 'Userdata');
hndl = get(hndl.mainFig, 'Userdata');
switch stage
case 1
hndl.setting.Pre.modulation.clickHigh = str2double(get(obj, 'String'));
set(obj, 'String', hndl.setting.Pre.modulation.clickHigh);
hndl.setting.Post.mod... |
function [time, data, avg_labels] = apply_2class( model_path, file_path, file_num, electrode, fp )
model_file = load(model_path);
model = model_file.best_model;
mus = model_file.mu;
sigmas = model_file.sigma;
decimator = 5;
f_sampling = 50000/decimator;
d = load([file_path file_num]);
... |
function C = dippingPreprocessing(modelPath, resolution, pad)
B = VOXELISE(resolution- 2*pad,resolution - 2*pad,resolution- 2*pad,modelPath,'xyz');
C = zeros(resolution, resolution, resolution);
C((pad+1):(end-pad),(pad+1):(end-pad), (pad+1):(end-pad)) = B;
end
|
function [cf,z,sn,cf1]=coef_sign54(coef,lev)
load H2_5x4
n=hn{lev};
len=length(n);
cf=int16(zeros(1,len));
for ia=1:len
cf(ia)=coef(n(2,ia),n(1,ia));
end
cf1=int16(zeros(1,len));
z=uint8(zeros(1,len));
pc1=0;
for ia=1:len
if cf(ia)~=0
pc1=pc1+1;
cf1(pc1)=cf(ia);
z(ia)=1;
end
end
cf1=cf1(1:... |
clear all;tic
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This CIW-ELM code achieves the following:
%-if M = 1600, an error rate on MNIST of about 96.5% correct on test data in about 16 seconds (on a four core computer using multithreading)
%Author: Ass... |
function Q = ElGamalDigitalSigAuthenticate_FM(P,r,s,A,p,g)
% Q = ElGamalDigitalSigAuthenticate_FM(P,r,s,A,p,g)
left = mod(FastExp(A,r,p)*FastExp(r,s,p),p);
right = FastExp(g,P,p);
if left == right
Q = P; %authentic digital signature
else
printf('\rDigital signature does not authenticate.\n\r')
end
|
classdef testIROS < Quad_ZMPplanner
properties(SetAccess = protected)
com_guess
A_com
Q_w
end
methods
function obj = testIROS(robot_mass,parser,A_com, com_height_guess)
obj = obj@Quad_ZMPplanner(robot_mass,parser);
if(any(size(parser.com_guess)~=[3,obj.nT]))
error('com_guess... |
%% -------------- Task 1 --------------
temp_even = [9.2 9.0 6.8 5.9 7.2 9.2 10.9 10.6 10.3 8.2 8.8 7.5];
temp_odd = [9.6 7.7 6.0 4.3 8.9 10.2 10.6 10.7 8.6 8.0 7.1 7.5];
time_even = [0 2 4 6 8 10 12 14 16 18 20 22];
time_odd = [1 3 5 7 9 11 13 15 17 19 21 23];
time = (0:1:23);
%Actual temp vs time
temp = [temp_eve... |
% deform amination
x1 = 0; x2 = 2*pi; % space domain
N = 3; nElement = 20; delta_x = (x2 - x1)/nElement;
[Nv, VX, K, EToV] = Utilities.Mesh.MeshGen1D(x1, x2, nElement);
FinalTime = 10; nT = 40;
t = linspace(0, FinalTime, nT);
w = 2*pi/(FinalTime/3); % period T = finalTime/3 = 3.3s
x = VX;
for it = 1:nT
temp = VX +... |
%Written by Kalyan Chilukuri
%Adapted by Helen Searle
%Read in the curve.txt nodes and then output the Lengths in to a folder
%called lengths, the lengths are calculated from the node placed near the lips as the zero point
%PLEASE NOTE: If you would like MRI images included in plot, first run
%imageimport.m in this fol... |
addpath(genpath('./MALSAR-master/MALSAR/functions/')); % load function
addpath('./MALSAR-master/MALSAR/utils/'); % load utilities
addpath('./functions/'); % load utilities
% addpath(genpath('/home/yuanshu2/MALSAR1.1/MALSAR/functions/')); % load function
% addpath('/home/yuanshu2/MALSAR1.1/MALSAR/utils/'); % load utilit... |
%MatrixA
matrixa = -2 + (2+2)*rand(1024);
%MatrixB
matrixb = -2 +(2+2) * rand(1024);
%The matrix we want to input to
matrixc = zeros(1024,1024);
%Perform the brute multuplication between two matrices
N = 1024
for i = 1:N
for j = 1:N
for k = 1:N
matrixc(i,j) = matrixc(i,j) + ... |
%Flow-vis processing
clear all; close all; clc
steady = 1;
transient = 2;
%% Inputs
vname = 'steady off to steady on 2.mp4';
suffix = 'transient';
movie_name = 'activation steady69.avi';
save_steps = 0;
bubble_threshold = 0.075;
big_bubble_filter = 1.1;
bubble_intensity = 80;
black_thresh = 30;
white... |
function toolbox_chk
% Requires 3 matlab toolboxes ( Released later than 2017) :
% Computer vision system, image processing, parallel computing
warning('on')
matlab_version=ver;
toolbox_names={matlab_version(:).Name};
toolbox_Release={matlab_version(:).Release};
Index_matlab = find(strcmp(toolbox_names,'MA... |
runProcessedData =importdata([fileSave filesep 'runProcessedData.mat']);
params =importdata([fileSave filesep 'params.mat']);
BCI_params;
channelList = {'C3','Cz','C4'};
spectrogramData = preprocess_runs_spectrogram(runProcessedData,params.params_spectrogram);
spec2Plot = false;
saveProcess = false;
analysis_spectr... |
function log(varargin)
%JGIT.LOG Show the commit log.
% JGIT.LOG(PARAMETER,VALUE,...) uses any combination of the following
% PARAMETER, VALUE pairs.
% 'maxCount' <integer> [] Maximum count of commit logs to show.
% 'skip' <integer> [] Number of commits logs to skip.
% 'since' <char> [] Show log of newer comm... |
while (1)
while (1)
if (1==1)
error('cuol');
end
end
t=5
end |
addpath(genpath(fileparts(mfilename('fullpath'))));
|
function [robot, sys] = LoadModel()
robot = Model.acrobot();
robot.configureDynamics();
[frame, fric_coef, geom] = Model.GetContactFrame(robot);
robot = addContact(robot,frame,fric_coef,geom);
%% relative degree two outputs:
ya_2 = robot.States.x(4:end);
t = SymVariable('t');
... |
function [imageBasisAbsorptions,imageBasisCurrent] = csfPCA(params)
% Make the principal component images for the absorptions and photocurrent
%
% The input argument is a struct that must include all the parameters
% needed to produce a vernier stimulus.
%
% We used to do this separately for absorptions and current, bu... |
% exm1_ztrans.m
% 例1:ztrans示例
% 北京邮电大学,尹霄丽
% 2018年12月
syms n k z w
x1=2^n;
X1=ztrans(x1);
x2=sin(k*n);
X2=ztrans(x2);
x3=cos(n*k);
X3=ztrans(x3,k,z);
|
clear
clc
[FileName,PathName]=uigetfile(...
{'*.SAC','SAC Files(*.SAC)';'*.*','All Files(*.*)'},...
'选择文件');
SACfile=strcat(PathName,FileName);
[hd,stime,sdata]=rdSac(SACfile);
% 从SAC头文件中读入所需参数
delta=hd{1,1}(1,1);
STLA=hd{1,1}(32,1); %Station latitude (degrees, north positive).
STLO=hd{1,1}(33,1); %Station long... |
function A = Az(angle)
c = cos(angle);
s = sin(angle);
A = [c, -s, 0;
s, c, 0;
0, 0, 1];
end
|
% ADVISOR data file: ESS_NIMH6.m
%
% Data source:
%
% Insight file created from NREL lab test data
% NREL test data from testing entire Insight Battery Pack Jan.2001 (Insight Model Year 2000)
%
% Insight pack is reported to be same technology as Japanese Prius (1998) with 20 modules instead of 40
% ... |
function [arc] = find_arc_by_nodes_fast(net, node_o, node_d)
n = size(net,1);
first = 1;
last = n;
a = net(:,1);
while (first < last)
mid = fix(first + (last - first) / 2);
if (node_o <= a(mid))
last = mid;
else
first = mid + 1;
... |
function [ P_f,P_d,idx_Channel,if_vacant,E,E_ori,lamda_d,P_d_th,a_w,a_r ] = test_CSS_Denoised_CS( SNR,CS_ratio,Sparsity,Pf,lamdaRatio )
% Denoised_CS returns the error number of recovery signal (of the 40
% channels) in one trial using both traditional and proposed denoised CS algorithm
% input SNR is the signal to noi... |
function [e,p] = Raster_Scan_DPCM(image)
%use the same value as its neighbor to pad the left and up side of the image
im= padarray(image,[1 1],'replicate','pre');
[r,c] = size(im);
im_d = double(im);
p=zeros(r-1, c-1);
e=zeros(r-1, c-1);
%Calculate the predicted value
p=(2*im_d(2:r,1:(c-1))+im_d(1:(r-1)... |
function [tex] = C2Tex(obj,c)
%C2Tex Summary of this function goes here
% Detailed explanation goes here
tex = obj.pca.Coeff2Data(obj.mu,obj.pc(:,1:obj.n_c),c);
end
|
function x_new = sparsify(x, L)
% function x_new = sparsify(x, L)
% -----------------------------------------------
% Author: Tiep Vu, thv102@psu.edu, Fri 08 Jul 2016 05:30:37 PM EST
% (http://www.personal.psu.edu/thv102/)
% -----------------------------------------------
x_new = x;
k = size(x, 1);
... |
function [ ] = logout( self )
%LOGOUT 登出的函数
% --------------------------
% 朱江,20160621
if self.is_Counter_Login
ret = xspeedcounterlogout(self.counterId);
if ret
self.is_Counter_Login = false;
self.counterId = 0;
else
disp('登出失败');
end
end
end
|
%% Homework 5
% Author Minhyuk Nam
% Date 05/21/2018
syms x
f(x) = x^2 + x + 3
g(x) = cos(x)
h(x) = exp(x)
double(limit(f(x), x, 10))
double(limit(g(x), x, 10))
double(limit(h(x), x, 10))
subs(diff(f(x), x), 10)
subs(diff(g(x), x), 10)
subs(diff(h(x), x), 10)
int(f(x), x, 1, 10)
int(g(x), x, 1, 10... |
function [ new_strct ] = invert_player( strct )
% Alters the board perspective so it appears that player two played
% first and player one played second.
% This is used to create more data with which to train.
new_strct = strct;
for i = 1:size(new_strct.board,1)
for j = 1:size(new_strct.bo... |
if isunix==0
home='C:\Users\Loukianos';
home_bci='D:\';
else
home='~/Documents/';
home_bci='/media/Storage';
end
addpath([home '/ls_brain/global'])
addpath([home_bci '/BCI_code/toolboxes/jf_bci'])
addpath([home_bci '/BCI_code/toolboxes/jf_bci/biosemi'])
addpath([home_bci '/BCI_code/toolboxes/jf_bci/re... |
%The function reads text file and return the map with root points for each
%branch
function [map] = readBranchesRoots(textFileNameArray, folder)
if nargin < 2
folder = "";
end
branchesCount = size(textFileNameArray, 1);
map = containers.Map('keyType', 'int32', 'valueType', 'any');
for fileIn... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Exploration: Leaving out parts of the data in train vs. test:
% - Leaving out certain classes
% - k-fold cross-validation
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Choose a subset of images
datasetN... |
function [ modulated_data ] = modulation( input_data, type_of_mod )
%UNTITLED4 Summary of this function goes here
% Modulation of the data
if strcmp(type_of_mod, 'qpsk') == 1
modulated_data=qpsk(input_data);
% disp('the data is mapped qpsk');
elseif strcmp(type_of_mod, 'bpsk') == 1
modulated_data... |
% userinput = inputyn(prompt)
%
% Collects string input until the user enters either (Y)es or (N)o.
% Returns 1 if yes and 0 if no.
%
% PROMPT is the optional prompt to display in the INPUT function
%
% 02.17.11 - S.Fraundorf - First version
function userinput = inputyn(prompt)
acceptableresponses = {'y','n','yes','n... |
%function [WIJ,WJK,ThetaJ,ThetaK] = ANN_Train(n,m,l,iter,numd,a)
I=10000; J=4; K=4; L=8;
iter=3000;
numd=12*8;
a=0.5;
% Initialization
WIJ = rand(I,J);ThetaJ = rand(J,1);
WJK = rand(J,K);ThetaK = rand(K,1);
WKL = rand(K,L);ThetaL = rand(L,1);
YJ = rand(J,1); YK = rand(K,1); YL = rand(L,1);
DeltaL = rand(L,1); DeltaK = ... |
% calculate rate of CH3O + NO2 -> CH3ONO2
% Updated 7/18/06 AEP
% Based on JPL Data Evaluation #15
% rate=kNO2CH3Ob(T,M)
function j=kNO2CH3Ob(T,M)
k10o=5.3e-29.*(T./300).^(-4.4).*M;
k10oo=1.9e-11.*(T./300).^(-1.8);
k10=(k10o./(1+(k10o./k10oo))).*0.6.^((1+(log10(k10o./k10oo)).^2).^(-1.0));
j=k10; |
function [score_vec,panel_scores_mat,data_continuity_score_vec,lists,cost_vec,subobjective_scores,dc_matrices,orbits] = RBES_Evaluate_MissionSet(mission_set)
%% RBES_Evaluate_MissionSet.m
%
% Usage:
% [score_vec,panel_scores_mat,data_continuity_score_vec,lists,cost_vec] = RBES_Evaluate_MissionSet(mission_set)
%
global ... |
function DepthLumCorr
% This function loads the results of preceptual experiment
% and plots subject's responses as a function of relative
% luminance-depth correlatoin in manipulated images
%
%absolute path should always work
mpath = strtok(userpath, pathsep);
path = fullfile(mpath, 'scene-filter-s... |
clearvars
close all
clc
%suma szeregu leibiza
n = input("Podaj liczbe iteracji: "); %wczytanie liczby iteracji od użytkownika
A1 = (1:2:2*n);
A2 = (2:2:2*n);
A1 = 1./A1;
A2 = 1./A2;
A = sum(A1)-sum(A2);
B1 = (1:2:2*n);
B1 = 1./B1;
B = sum(B1);
C1 = (2:2:2*n);
C1 = 1./C1;
C = -sum(C1);
disp(A); %... |
function varname = PKImportDyn(filepath)
%PKIMPORTDYN Import data from a PK dynamic file
% Assuming that 'filepath' is the path to a data file of the correct format.
%
% T Hennen 2013
[a, filename, extension] = fileparts(filepath);
DELIMITER = '\t';
% Should be larger than total lines in file
HEADERLINES = 10000... |
function [newData1] = importfile(fileToRead1,HEADERLINES)
%IMPORTFILE(FILETOREAD1)
% Imports data from the specified file
% FILETOREAD1: file to read
% Auto-generated by MATLAB on 20-Oct-2020 13:54:54
DELIMITER = ' ';
% Import the file
newData1 = importdata(fileToRead1, DELIMITER, HEADERLINES);
|
function [mean_x,var_x,median_x,min_x,max_x,u]=stats(x);
mean_x=mean(x); var_x=var(x);
median_x=median(x);
min_x=min(x); max_x=max(x);
u=srsum(x);
return;
function f=srsum(x);
f=sum(sqrt(x));
return; |
function [Tj] = TRAJECTORY_GENERATOR(M,steps,xc,yc,zc)
%UNTITLED2 Summary of this function goes here
%
sz=size(M);
r=sz(1);
c=sz(2);
for(j=1:1:r-1)
for(k=1:1:(steps))
% Tj((k+1)+((j-1)*steps),1)=M(j,1)-((M(j,1)-M(j+1,1))*sin(pi/2*(k/steps)));
% Tj((k+1)+((j-1)*steps),2)=M(j,2)-((M(j,2)-M(j+1,2))*sin(pi/2... |
function [feature] = convertToSparse(sample)
[i,j,v] = find(sample(:)); %we want X as a vector
feature = "";
clock
for k = 1:size(i,1)
feature = sprintf("%s %d:%d ",feature,i(k),v(k));
endfor
clock
end |
function varargout = prama(varargin)
% PRAMA MATLAB code for prama.fig
% PRAMA, by itself, creates a new PRAMA or raises the existing
% singleton*.
%
% H = PRAMA returns the handle to a new PRAMA or the handle to
% the existing singleton*.
%
% PRAMA('CALLBACK',hObject,eventData,handles,...) cal... |
% Clearing everything
clc; clear; close all
% Adding path for common functions
addpath('../common')
% Reading data
data = csvread('../../data/balanced_data.csv');
% Storing number of samples and attributes
sample_count = size(data, 1);
num_attributes = size(data, 2);
% Choosing k for k-fold cross validation
k = 3;
... |
function result=findDerivative(data)
result(10)=0;
for k=2:size(data,2)-1
x_t=0;y_t=0;
for j=1:1
x_t=x_t+j*(data(1,k+j)-data(1,k-j));
y_t=y_t+j*(data(2,k+j)-data(2,k-j));
end
x_t=x_t/2;
y_t=y_t/2;
result(1,k)=x_t;
result(2,k)=y_t;
end
result = result(:,2:end);
e... |
clc
clear all
r=rotx(30);%%assuming
p=[1 2 3]';%%assuming
q=[2 2 5]';%%assuming
% lhs=norm(r*p-r*q)
% rhs=norm(p-q)
% %%checking the equality
% rhs==lhs
(cross(p,q))
lhs=r*(cross(p,q))
rhs=cross((r*p),(r*q)) |
close all
clear
clc
% Create a dymmy data to fill tables
UsersData = [];
for i=1:5
a = randi(100,1);
b = randi(100,1);
LocalData = [a;b];
UsersData = [UsersData LocalData];
end
UsersData;
% The first spet is defining a Mode for a table.
% The should be at least one Mode in order to print a tabble
Coulmns... |
function ar_globalRegression(fileStruct, paramStruct)
%% Initialize
% Assign input structures to variables
assignInputs(paramStruct.globalRegression.EEG, 'createOnly')
assignInputs(fileStruct.analysis.globalRegression.EEG, 'createOnly')
% Load the EEG data
oldData = load(eegDataFile);
% Initialize function-specific ... |
function plotMotCorr_normImg(mouse, imagingFolder, mdfFileNumber, showMov)
% Assess motion correction. Also see how normalizing the movie worked (in
% order to make pixel intensities uniform before running CNMF).
%
% The very first script to run right after preproc
%
% Right after you are done with preproc on the clust... |
clear;clc
%計算1到5的總和
total(1)=1; %設定初始total為1
for i=2:5 %將變數i依序設定成向量裡的每一個元素值,然後執行敘述主體
%起始值與終止值和間隔值
%執行到最後一個i小於等於終止值為止
total(i) = total(i-1) + i; %把下一個i加到total裡
fprintf('i= %d, total(%d)=%d \n',i,i,total(i))
end
fprintf('2.. i=%d total=%d \n',i,total(i))
fprintf('3.. total=%d %d %d %d %d ... |
function [x_0,y_0,Cov,BhattCoff,iterations,p_u]=rgbTracking(image,...
imgWidth,imgHeight,centerX,centerY,...
q_u,candidate_pos,candidateKernel,...
omega,frameNo)
MAX_ITER=15;
EPSILON=0.05;
redBins=16;
greenBins=16;
blueBins=16;
rb=256/redBins;
gb=256/greenBins;
bb=256/blueBins;
iteration... |
% load('tjc_pro.mat');
% clear;
close all;
load('./results/CASIA/res_sub_tjc.mat');
% load('../HMMdata4ASL/exp1/HDPHMMDPstatsiter400trial1.mat');
X = res_sub_tjc;
X = X.';
X = reshape(X,size(X,1)/2,size(X,2)*2);
X = mat2cell(X,size(X,1),2*ones(1,size(X,2)/2));
X = X.';
stateSeq = S.stateSeq;
idx = 2;
Ns = S.stateCount... |
% SAMPLE8.M - Visual presentation of words, reading and logging serial bytes
config_display(0);
config_data( 'sample8.dat' );
config_log( 'sample8.log' );
config_serial( 1 )
start_cogent;
% Draw fixation point in display buffer 2
preparestring( '+', 2 );
for i = 1:countdatarows
t0 = time;
% Draw word in dis... |
%----------------------------------------------------------
%
% Program: bhattacharyyaError
%
% Purpose: gives the bhattahcaryya bound to probability of error
%
% P(error) <= Chernoff Error Bound <= Bhatacharyya Error Bound
%
% Inputs:
%
% x = n-D feature vector
% u = n-D mean vector for class... |
%--------------------------------------------------------------------------
%
% Exercise 2-4: Topocentric satellite motion
%
% Last modified: 2015/08/12 M. Mahooti
%
%--------------------------------------------------------------------------
TLE2RV
clc
close all
clear all
format long g
global counter AuxParam eop... |
% project_logo.m is the test file for the University of
% Pennsylvania's Coursera course Robotics:Perception, week 2 assignment, to
% project a logo onto a given area in a target image
% Written for the University of Pennsylvania's Robotics:Perception course
% Note: You don't have to change this script for the assignm... |
function ManualClipPanel()
clear, close all,clc;
%---Main Layout of the Main Panel
hFigureBase = figure('Name', 'Rawdata showing...', ...
'Units', 'normalized', ...
'Position', [0 0 1 0.9], ...
'MenuBar', 'none', ...
'ToolBar', 'none', ...
... |
function x = my_roots(eq)
% Resolució equacions segon grau
if length(eq) == 3
a = eq(1); b = eq(2); c = eq(3);
if (a == 0) x = -c/b;
else
dis = b^2 - 4*a*c;
if dis < 0
disp('No hi ha solució');
elseif dis > 0
x(1) ... |
function mAEWing2_componments_dat(groups,design_folder,design_file_name)
groups_bdf_number=size(groups,2);
for groups_num=1:groups_bdf_number
file_folder_path=[design_folder '\' design_file_name '_' groups{groups_num} '.bdf'];
bdf_node_elem=read_bdf(file_folder_path);
fid102=fopen([d... |
classdef PlayerRandom < Player
properties
end
methods
function Obj = PlayerRandom(Colour)
Obj = Obj@Player(Colour);
end
function R = TakeMove(Obj)
global B
switch Obj.Colour
case 'white'
... |
function modStr = make_modulator(funobj, parvec, estimate, name)
if nargin < 4, name = 'beta'; end
if nargin < 3, estimate = 1; end
if ~strcmp(class(funobj),'function_handle') && ...
~isa_basis(funobj) && ...
~isa_fd(funobj) && ...
~isa_fdPar(funobj)
error(['FUNOBJ is not a function handle, basis, fd ob... |
function [ realization ] = rng_from_pdf( pdf, n )
%RNG_FROM_PDF( pdf, n ) gives n realizations of a r.v. with specified pdf
cdf = cumsum(pdf);
[y, x] = unique(cdf);
realization = interp1([0;y],[0; x]+0.5,rand(1,n));
end |
function dq = dqblend(dq_list,weights)
% Input:
% dq_list : 8*N
% weights : 1*N
% Out: 8*1
weights = weights / sum(weights);
c = zeros(8,1);
for i =1:size(dq_list,2)
c = c + weights(i)*dq_list(:,i); %
end
%
c0 = c(1:4) ;
c1 = c(5:8);
c_norm = norm(c0);
c0 = c0 / c_norm ;
c1 = c1 / c_no... |
% Autor: Boyan Naydenov
% Instructors: Manel Soria i Arnau Miro
% Gravity turn. Treball Sistemes Propulsius GRETA 2B 2014/2015
clear all; close all; clc
DATA = dataariane(1); %pren dades inicals del coet a treballar. Per veure les del Vega canviar totes les "dataariane" per "datavega".
n=DATA.n; %agafa les etap... |
function [x_rotated,y_rotated] = Rz_group(cord,Phi,cord0)
x =cord(:,1);
y = cord(:,2);
for ii = 1:length(x)
cord_new=Rz([x(ii) y(ii) 0],Phi/pi*180,cord0);
x_rotated(ii) = cord_new(1);
y_rotated(ii) = cord_new(2);
end |
length=1000;M=3;N=3;statenum=2^(M-1);error=zeros(1,101);
for xyz=1:1:101
DX=(xyz-1)/10;
origin=randi([0,1],1,length);generate=[0,1,1;0,0,1;1,1,1];
encodeori=zeros(length,N);PSKmaker=zeros(length,N);
send=zeros(length,N);demodule=zeros(length,N);recover=zeros(1,length);
shift=zeros(length,M);
shi... |
function [] = rememberboxes(model, ds)
%UNTITLED5 Summary of this function goes here
% Detailed explanation goes here
x1 = ds(:,1);
y1 = ds(:,2);
x2 = ds(:,3);
y2 = ds(:,4);
ds_file = fopen(strcat('tps/results/',model.class,'_bbox.txt'),'w');
% ds_file
for j = 1:length(x1)
fprintf(ds_file,'%f %f %f %f\n', x1(j... |
%% Attempt to develop theoretical curve for SKAB performance.
clear
SKAB_results = load('SKAB_analysis6.mat');
R_auto_cor = SKAB_results.R_auto_cor;
R_auto_cor2 = SKAB_results.R_auto_cor2;
SNR_vec_dB = SKAB_results.SNR_vec_dB;
P_D = SKAB_results.P_D;
Pd_auto_rho = SKAB_results.Pd_auto_rho;
Pd_SK_auto_rho1 =... |
% LIN_MAP Map linearly from a given range to another
%
% USAGE:
% Y = lin_map(X, lims_out, lims_in)
%
% X can be of any size. Elements of lims_in or lims_out don't have to be in
% an ascending order.
%
% if lims_in is not specified, the minimum and maximum values are used.
%
% Example:
%
% x = cos((1:50)/3) +... |
if show_energy_plots==1
% tic
disp(['Plotting results...']);
P_Electrical_Sources = P_Electrical_Sources/3600/1000; %[kWh]
P_Electrical_Storage = P_Electrical_Storage/3600/1000; %[kWh]
P_Electrical_Regeneration = P_Electrical_Regeneration/3600/1000; %[kWh]
P_Photovoltaic = P_Photovoltaic/3600/10... |
clear all
% Open Data
[FileName,PathName] = uigetfile('*.nii','Select the Nifti file');
file=strcat(PathName,FileName)
B=MRIread(file);
D=double(B.vol);
clear B
S1=size(D);
imgdata=reshape(D,[S1(1),S1(2)*S1(3),S1(4)]);
% t = Tiff(strcat(file(1:size(file,2)-4),'2D.tiff'),'w');
% tagstruct.ImageLength = size(imgdata... |
function J_toe = J_toe(in1)
%J_TOE
% J_TOE = J_TOE(IN1)
% This function was generated by the Symbolic Math Toolbox version 8.5.
% 17-Oct-2020 02:19:11
q_t1 = in1(:,1);
q_t2 = in1(:,2);
q_t3 = in1(:,3);
q_t4 = in1(:,4);
q_t5 = in1(:,5);
q_t6 = in1(:,6);
t2 = q_t1+q_t2;
t13 = atan(5.1825122282900... |
function test_findClosestCentroids()
% 1 / 5 Find Closest Centroids (findClosestCentroids.m)
X = reshape(tan(1:165), 15, 11);
centroids = reshape(sec(1:121), 11, 11); centroids = centroids(1:5, :);
idx = findClosestCentroids(X, centroids);
a = [2
4
5
1
2
4
1
... |
function [e,a]=select_dir(select_flag)
global MAP map_stat min_ele max_ele min_azi max_azi min_res_azi min_res_ele n_ele n_azi
if (nargin <1)
select_flag='exclusive';
end;
if (nargin==1)
if ~isstr(select_flag) error('Choose exclusive, and'); end;
end;
[l,c]=find(map_stat==30);
if s... |
function [bsf,ind] = EA_ED_Search(x,y,bsf)
%x is the data, y is the query
m = length(y);
n = length(x);
y = zNorm(y);
%compute x stats -- O(n)
meanx = movmean(x,[m-1 0]);
sigmax = movstd(x,[m-1 0],1);
b2 = bsf^2;
ind = -1;
for i = 1:n-m+1
S = 0;
for j = 0:m-1
S = S + ( (x(i+j) - meanx(i+m-1))/s... |
function o = leastsquare( x,y,m )
n=size(x);
if n < m+1
printf('Incorrect Input');
else
for i = 1:m+1
for j=1:i
k=i+j-2;
sum=0;
for l=1:n
sum=sum+(x(l)^k);
end
a(i,j)=sum;
a(j,i)=sum;
end
... |
function [H, c] = findHessian(A_large,B_large, A_T, B_T, x0)
%FINDHESSIAN Summary of this function goes here
% Detailed explanation goes here
n = length(x0);
m = length(B_T(1, :));
Ae = [eye(n); A_large]; %; A_T];
Be = [zeros(n, m); B_large]; %; B_T];
H = 2 * (Be.' * Be) + 2 * eye(length(Be(1, :)));
c = 2 * x0.' * ... |
function y = Verhulst(x,r)
y = -r*(x.^2) + (1+r)*x;
end |
%% FORCE MATRIX
% p -- distributed transverse force
% Mx -- distributed moment about x-axis
% My -- distributed moment about y-axis
function [FORCE]=LinearForceMatrix(FEM)
gDOF=FEM.GDof;
[FORCE]=zeros(gDOF,1);
% Fx=FEM.Fx;
% Fy=FEM.Fy;
p=FEM.p;
Mx=FEM.Mx;
My=FEM.My;
[GaussWeights,GaussLocations]=gaussQuadrature(FEM.... |
% sample input file which contains user defined parameters for simulation
%
% Tianxiang Wu 2021/06/30
% wtx@zju.edu.cn
%-----------------------------------------------------------------------------------
np = 1e4; % Number of photons to be simulated.
nl = 2; % Number of layers (not include the medium above and ... |
%BITWISE_OR Calculates the per-element bit-wise disjunction of two arrays or an array and a scalar
%
% dst = cv.bitwise_or(src1, src2)
% dst = cv.bitwise_or(src1, src2, 'OptionName', optionValue, ...)
%
% ## Input
% * __src1__ first input array or a scalar.
% * __src2__ second input array or a scalar. In case bo... |
% created by: Zoya Bylinskii, Sept 2014
% based on code by Tilke Judd
% This function applies the chosen center bias
% and blur parameters to the saliency maps
% in salDir to produce the saliency maps in resDir.
function adjustSalMaps(salDir,resDir,centWeight,blurSigma,targetHist,showOutput)
% salDir contains all the... |
% Estimate a sign for the sorted dTdz as the sign(hourly median(reference dTdz))
%
% function [sgn] = get_wda_sign(time_vec, refTz, min_dTdz)
%
% Inputs:
% time_vec: time vector for the sorted gradient
% Tz : reference dTdz to extract sign from
% min_dTdz : when less than minimum value, use a ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.