text stringlengths 8 6.12M |
|---|
%% Examining the Data to Create a Local Quadratic Regression Model
% vpreston
% Dec. 3, 2018
% Read the data in
format long g
dataoffit = readtable('data_to_fit.csv');
x = dataoffit.Smoothed_X(1:50:end);
y = dataoffit.Smoothed_Y(1:50:end);
z = dataoffit.Smoothed_Z(1:50:end);
all = [x,y,z];
% Get a random sample of t... |
function [l,particleDiameterClean,particle_storage,control0] = ...
imageAnalysis(All,path,strelRatio,limitParticleSize,pixelLength,shapeFactorMax,shapeFactorMin)
[n,~,l] = size(All);
for i = 1:l
I = All((n*0.15):(n*0.85),:,i);
I_storage(:,:,i) = I;
[bw,particle_percentage,background... |
%Heat Equation 1D - Cas homogène | Régime permanent | Sans source interne
clear all
clc
%Mur d’un four est composé de 2 couches
%Hypothèses : -Pas de source interne -Régime permanent -Problème 1D -Contact parfait
%Données
e1 = 0.2; %Epaisseur du mur 1 en m
e2 = 0.1; %Epaisseur du mur 2 en m
K1 = 1.38; %Conductivité ... |
% Clean up HyGA-MPETSc. |
function[p] = listLength_runSim(p)
% listLength_runSim -- controls flow of sessions. That is, sets necessary
% session specific parameters for whichever rat runSim was called for. As
% such, this function might better be defined as a script.
% called by: createSim
% calls: model
% input:
% p: experimental structure... |
function plot_data(data)
markers = ['+','o','*','.','x','s','d','^','v','>','<','p','h'];
for i = 1:length(data)
hold on
plot(data{i,1},data{i,2},markers(i))
end
addgrid()
end |
function [errmsg] = util_disp_ns_errcode( errcode, dodisp )
%UTIL_DISP_NS_ERRCODE Display the meaning of Neuroshare error code
% According to
% http://neuroshare.sourceforge.net/Matlab-Import-Filter/NeuroshareMatlabAPI-2-2.htm#Installation
%
% if 'dodisp' is true, the function will display the error messa... |
i = -1.01;
fprintf('%5.2f%10.2f%10.2f\n',i,-i,i) |
figure;
t = 0:pi/100:2*pi;
plot(t,sin(t));
hold on;
plot(t,cos(t),'r--');
hold off;
xlabel('Time(s)');
ylabel('Function value');
title('Sin and Cos function');
legend('Sin','Cos');
xlim([0 2*pi]);
ylim([-1.4 1.4]);
|
function [file, msg] = dicom_write_stream(file, data_streams)
%DICOM_WRITE_STREAM Write an encoded stream to a file.
% [FILE, MSG] = DICOM_WRITE_STREAM(FILE, STREAMS) writes the UINT8 data
% streams stored in the cell array STREAMS to the message specified in
% FILE. An updated FILE structure is returned a... |
%% prepare data sets
X = data1(:,1);
Y = data1(:,2);
s_theta = data1(:,3) + data2(:,3) + data3(:,3);
% 2 link train data
% x = {X(:)';Y(:)'};
% t = [data1(:,3)'; data2(:,3)'];
% 3 link train data
x = {X(:)'; Y(:)'; s_theta(:)'};
t = [data1(:,3)'; data2(:,3)'; data3(:,3)'];
%%
% Choose a Training Function
trainFcn = ... |
%% just to calculate the matrix of x
clc
clear
M = input ('Please enter the value of M= ');
N = input ('Please enter the value of N= ');
dx = input ('Please enter the value of dx= ');
U = zeros (1,M-2);
for idx = 1 : M-2
f = sin(dx *idx);
U(1,idx) = f;
end
%fprintf('%g ', U);
len = (M-2) * (N-1);
b = zeros(le... |
% acceptable error for solution
epsilon = 1e-4;
% chosen value of omega for SOR
omega = 1.32;
% produce matrices for initial guesses for each interval size
initial_mesh_100 = zeros(101,201);
initial_mesh_50 = zeros(51,101);
initial_mesh_25 = zeros(26, 51);
% populate the matrices with the boundary conditions
for j =... |
%% Things you need to imput/change.
filename = 'C:\Xcalibur\data\Owlstone\6th\ML2\AJC_ML_2.imzML'; % Location of the imzml file
imzMLConverterLocation = 'C:\Users\creeseay\Documents\MATLAB\imzMLConverter\imzMLConverter.jar'; % Location of the imzmlConverter software.
CFs=-1; %Starting CF
CFe=4; % Ending CF
ScanT=180... |
clear;
train=loadjson('train.json');
j=1;
for i=1:1604
x=train{1,i};
if(strcmp(x.inc_angle,'na')==1)
continue;
else
x=[(x.band_1+x.band_2)/2 x.inc_angle x.is_iceberg];
trainSet(j,:)=x;
j=j+1;
end
end
temp=trainSet(1:700,:);
save('trainSet.txt','temp','-ascii');
temp=trainSet(701:1471,:);
save('valid... |
function [data,statu,statu2,realn2,realn3] = Multi_With_Couple(data,statu,statu2,realn2,realn3,Couple_Num,e,d,Solution,Solution2,row,column)
n2=(column*row-1)/8; n3=(column*row-1)/4;
if realn2 ~= 0
for i =(n2-realn2+1) : (n2-realn2+Couple_Num*3)
A=Solution{n3-realn3+i,1};
[statu,st... |
[x,y]=meshgrid(0:0.01:1,0:0.01:1);
z=(x.^2).*1-(y.^0.5).*1;
mesh(x,y,z); |
function found = begin_with (line1,str)
% test if a given string begin with another shorter string
%
% Syntax : found = begin_with (line1,str)
%
% Param : line1, string, must be longer than or as long as str
%
% Param : str, string, must be shorter than or as long as line1
%
% Return : found, boolean, obvious
... |
%[2010]-"Firefly algorithm,stochastic test functions and design
%optimization"
% (9/12/2020)
function FA = jFireflyAlgorithm(feat,label,opts)
% Parameters
lb = 0;
ub = 1;
thres = 0.5;
alpha = 1; % constant
beta0 = 1; % light amplitude
gamma = 1; % absorbtion coefficient
theta = 0... |
function [obj,dObj] = obj_fwdDyn(x,q,p)
%% add the last column
x0 = p.mapA*x(:,1)-p.mapB;
x = [x,x0];
%%
[ceq,gradceq] = dynConst_forwardDyn(x,q,p);
obj = 0.5*(ceq.'*ceq);
% the gradient of the last column should be add on the first column
gradceq(1:p.numJ+2,:) = gradceq(1:p.numJ+2,:)+p.mapA*gradc... |
%% Housekeeping
clear
%% Values
Simulation_Time = 300;
out=sim('PID_Tuning_models',Simulation_Time);
K_m = 0.025;
tau_m = 1/12; % Mins (Dead time)
T_m = 1/2; % Mins
%% Run and Import Data from Simulink
% ZN 1st Method
x1 = out.tout;
y1 = out.ZN1.signals.values;
y1_MV = out.ZNMV1.signals.values; % Manipulated Var... |
function f=matleap_frame
% MATLEAP_FRAME Get a frame from the leap motion controller
f=matleap.frame();
|
function n = end(this, ~, ~)
% end Reference to last parameter variant.
%
% Backend IRIS function.
% No help provided.
% -IRIS Macroeconomic Modeling Toolbox.
% -Copyright (c) 2007-2017 IRIS Solutions Team.
%--------------------------------------------------------------------------
n = length(this.Vari... |
% Gather initial values for the parameters that will be fit via JAGS.
% These values are for the occasion when the random walk is initiated with
% a NULL model.
asd = data(or(data.ages=='1', or(data.ages=='2', or(data.ages=='3', data.ages=='4'))), :);
asd.cases(asd.ages=='1') = round(asd.cases(asd.ages=='1')./asd.pa... |
function [ NormCM ] = ConfusionMatrix_display( confusionmatrix, tasklabels )
%ConfusMatwithPrecVal takes the confusion matrix sample number and
% calculates and displays the training set classification percentage per
% square
% STEP 1: Calculate a 'normalized confusion matrix that is based on a
% percentage ... |
clear variables
close all
%%%% SVM
%% Choose the emotion labels we want to classify in the database
% 0:Neutral
% 1:Angry
% 2:Bored
% 3:Disgust
% 4:Fear
% 5:Happiness
% 6:Sadness
% 7:Surprise
emotionsUsed = [1 6];
%%%%%%%%%%%%%%%% EXTRACT DATA %%%%%%%%%%%%
[imagesData shapeData labels stringLabels] = extrac... |
clear; close all; clc;
tic;
global h; % make h a global variable so it can be used outside the main
% function. Useful when you do event handling and sequential move
SN = 83841563; % put in the serial number of the hardware
h = ACT_initialize(SN);
%in mm
sizeofstep = 0.01; %10 um
Totaldistance... |
function [x y]=generate_examples(nsamples)
if ~exist('nsamples','var')
nsamples = 100;
end
x = rand(1,nsamples);
y = zeros(1,nsamples);
for i=1:nsamples
id = floor(1./x(i));
if mod(id, 2) == 1
y(i) = 1;
else
y(i) = -1;
end
end
% [xr,index] = sort(x);
% yr = y(index);
% plot(xr,yr,'b-');
... |
function Arrow(sx,sy,ex,ey)
%% 用带箭头的直线连接两点 起点(x1,y1)-->终点(x2,y2)
%% len 箭头边长
x1=sx;
x2=ex;
y1=sy;
y2=ey;
cita=pi/12; %箭头夹角为30度
cos_cita=cos(cita);
sin_cita=sin(cita);
x=[x1 x2];
y=[y1 y2];
len=2;
r=len/sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); %箭头边长与线段长度的比值
hdl_line=line(x,y,'color',[0 0 0]);
... |
stimlist = dir('ferret_stim*.mat');
type_sound = 'same';
lowfreq = 200; %The low frequency cut-off
highfreq = 20000; %The high freuqncy cut-off
tdt_50k = 48828; %The sampling rate of the TDT
filt_order = 8; %The filter order
numrepeats = 10; %The number of repeats
db_target = 73; %How loud is the middle condition
atte... |
% mat_files = dir(fullfile(pwd,'csi_tool_matlab/Activity/data/fall_detection/corridor1/phase/*.mat'));
% ph_empty_ant1 = load('C:\Users\R00119847\Documents\MATLAB\csi_tool_matlab\Activity\data\fall_detection\corridor1\phase\ph_empty_corridor11.mat')
mat_files = dir(fullfile(pwd,'csi_tool_matlab/Activity/data/fall_d... |
function OutImage = CycIF_Segmentation_normfit_opencellsizeover5_medianpercell_v1(image_in,filename_out,options)
%For Myeloma
% clear all
% basefolder = 'D:\Myeloma_HSF1_2018-07-27\Myeloma_Segmentation\';
% imagefolder = 'Test_files\';
% %core = ['Field' num2str(prefix2(i2),dim) 'test.tif'];
% core = ['Field0002test.ti... |
nodesCoords = [];
for i = 1:length(nodes)
nodesCoords = [nodesCoords; nodes(i).coord];
end
for i = 1:length(nodes)
plot(nodesCoords(i,1), nodesCoords(i,2),'x')
hold on;
end
% nodesCoords = smooth(nodesCoords); |
function [L,U,rowpiv,colpiv] = OuterLU_RP(A)
% function [L,U,rowpiv,colpiv] = OuterLU_RP(A)
% Outer product LU with rook pivoting
% A is nxn
% L is nxn and unit lower triangular
% U is nxn and upper triangular
% rowpiv(1:n-1) houses the pivot row indices
% colpiv(1:n-1) houses the pivot column indices
% PAQ'... |
function quickcheckfits(headpath,fileexpnum)
cd('extracted2')
savefilename=strcat(fileexpnum,'_analysis2');
load(savefilename);
cd(headpath);
%add some errorchecking for indices you want to remove or something
%[sortednames,data]=cleantrials(data,fileexpnum,filelist,imskip,expskip);
filelist=dir;
filenames={filelist... |
function output = importfile(filename, startRow, endRow)
%IMPORTFILE Import numeric data from a text file as column vectors.
% [DESCRIPTION,ED412,ED443,ED488,ED510,ED555,ED665,EDPAR,EDGND,TEMP,DEPTH]
% = IMPORTFILE(FILENAME) Reads data from text file FILENAME for the
% default selection.
%
% [DESCRIPTION,... |
function func8_5(n)
if mod(n,2)==0
fprintf('%d is even\n',n);
else
fprintf('%d is odd\n',n);
end |
% The following papers are to be cited in the bibliography whenever the software is used
% as:
% C. G. Bampis, P. Gupta, R. Soundararajan and A. C. Bovik, "SpEED-QA: Spatial Efficient
% Entropic Differencing for Image and Video Quality", Signal Processing
% Letters, under review
% R. Soundararajan and A. C. Bovik... |
clear
clc
pkg load signal
% Frecuencia de la señal de información.
f1 = 20;
f2 = 60;
% Frecuencia de la portadora o carrier
fc = 5e3;
% Frecuencia de muestreo
fs = fc * 20;
fs2 = fs / 2;
filename1 = "message1.txt";
filename2 = "message2.txt";
f1 = fopen(filename1, "r");
f2 = fopen(filename2, "r");
M1 = [];
M2 = ... |
function [ ] = ellipse_fit( data,ci ,rate_vector,test_flag)
% function takes in a matrix of points (data) and a confidence interval
% (ci)and plots a 3d cone of the fire. rate_vector is best guess as what
% direction in which the fire spreads most rapidly
%test_flag =1 tells function you are
% using random data.... |
function [txt,anovastats,multstats,T,ST,ST2] = anova1_std_v2(data,group, Nname,varargin)
%% varargin
% input
if nargin<3
Nname = '';
end
ns = 1; % include p=n.s.
psig = 0.05; %
digit = 2;
pSave = '';
vararginProcessor
%% check input
if numel(data) ~= numel(group); error('x and g different size'); end
%% ano... |
function [dx, dy] = DKM_phone( qj, qdj)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
global L1 L2 L8 L9 sb
q1 = qj(1);
q2 = qj(2);
q3 = qj(3);
q9 = qj(8);
q10 = qj(9);
qd1 = qdj(1);
qd2 = qdj(2);
qd3 = qdj(3);
qd9 = qdj(8);
qd10 = qdj(9);
dx = - L1*cos(q1)*qd1 - L2*cos(q2)*qd2 - ... |
%% comp_autocorrelate.m
% Usage: comp_autocorrelate(ROOT_DIR)
% Purpose: template for matlab tools
%
% User Inputs:
% ROOT_DIR - Desired top-level working directory
% printFlag - 1 -- print
% 0 -- dont
%
% Function Requirements:
% stats.mat autocorr
function comp_autocorrelate(RO... |
% this function inserts sign_syncB1 into a beginning and an end of signal
function [sign_out] = insert_sync_b1(sign_inf, sign_sync, delay)
% input:
% sign_inf - information signal
% sign_sync - sync signal B1
% delay - time delay in a beginning of transmission (unit is bit)
% output:
% sign_out - informatio... |
function [y_q rate coef ] = SPL_Coding(y, quantizer_bitdepth, num_rows,num_cols, Phi)
y_max = max(y(:)); y_min = min(y(:));
q = (y_max - y_min)/2^quantizer_bitdepth;%┴┐╗»scale
DC_block = ones(256,1)*128;%256*1
DC_Measure = Phi*DC_block;
[yq, y_q y_index coef] = SPL_Encode(y,q,DC_Measure);
total_pixels = num_rows... |
classdef Cell<handle
%Cell is a class for living cells.
properties
id=0
x=0
y=0
HP=0
prol=0
Age=0
end
methods
function obj=Cell(x,y,HP,prol)
if nargin > 0
obj.x=x;
obj.y=y;
... |
clear;
load ../data/music_dataset.mat
[Xt_lyrics] = make_lyrics_sparse(train, vocab);
[Xq_lyrics] = make_lyrics_sparse(quiz, vocab);
Yt = zeros(numel(train), 1);
for i=1:numel(train)
Yt(i) = genre_class(train(i).genre);
end
Xt_audio = make_audio(train);
Xq_audio = make_audio(quiz);
%%conjoin audio training and... |
clear
close all
clc
addpath('./MIMOMU_plot');
addpath('../function2use');
EPOCH=10000;
SNR=-10:2:30;
N_user=[3];
N_trans=[16,64,256];
N_Len=length(N_trans);
% %%%%不同用户数%%%%%%%%%%%%
% C_miso_mf_user=zeros(length(SNR),N_Len);
% C_miso_zf_user=zeros(length(SNR),N_Len);
% C_miso_mmse_user=zeros(length(SNR),N_Len);
%
%... |
% %% Problem 1 Edge detection
clear
clc
close all
%% can detect rice grains
noise = [0:0.1:1];
for ii = 1:length(noise)
I1 = imread('rice.png');
I1_noise = I1+uint8(rand(size(I1)).*256.*noise(ii));
I2 = adapthisteq(I1_noise);
I3 = wiener2(I2,[5 5]);
bw1 = im2bw(I3, graythresh(I3));
% bw2 = imfill... |
%Mitchell Melisek
%PA-3: MC
m=9.109e-31; %mass of an electron
q=1.602e-19; %charge of an electron
x=0;
v=0;
t=0;
field=5; %Initializing field
force=field*q; %Inittializing force equation
dt=1e-8; %Wavelength of electron (mm) used for time step
v=zeros(1,1); %Setting velocity v to zero
x=zeros(1,1); %Setting positio... |
%hvwhos - issue 2.0 (10/12/2001) - HVLab HRV Toolbox
%---------------------------------------------------
% The equivalent of the Matlab 'whos' command but only lists HVLab datasets
% and provides more detail.
%
% THIS IS A SCRIPT. ANY WORKSPACE VARIABLES BEGINNING 'HVDIR_' MAY BE
% DELETED.
%
% Written TPG... |
function [ output_args ] = rawH5missing(allF)
%rawH5missing - find missing files, which need to be transferred or
%processed
% Where the final files are kept
procPath = '/Users/jmckenzi/Documents/Box Sync/H5 Convert/';
h5Files = fileFinderAll(procPath,'h5');
numF = size(allF,1);
chk = false(numF,1);
for n = 1:numF
... |
s11 = zeros(201,41);
s21 = s11;
for pow = 10:50
airfile = sprintf('75mm_coax_air_%ddbm_3-23-17.dat',pow);
[s_11,s_21,frequency] = s2pToComplexSParam_v4(airfile);
s11(:,pow-9) = s_11;
s21(:,pow-9) = s_21;
end
subplot(211)
plot(frequency/1e9,angle(s21))
xlabel('frequency (GHz)')
ylabel('magnitude')
title(... |
function [drp, binCenters] = densityRecoveryProfile(centers, numBins, binWidth, visualize)
% DENSITYRECOVERYPROFILE Profiles mosaic regularity
%
% Inputs:
% centers centers of each object in mosaic
% numBins number of annuli
% binWidth annulus width
% Optional I... |
function [f,g] = logistic_regression(theta, X, y)
%
% Arguments:
% theta - A column vector containing the parameter values to optimize.
% X - The examples stored in a matrix.
% X(i,j) is the i'th coordinate of the j'th example.
% y - The label for each example. y(j) is the j'th example's labe... |
function [] = csys_printf(ac, varargin)
%
% NAME
%
% function [] = csys_print(ac, format ...)
%
% ARGUMENTS
% INPUT
% ac class "standard" class
% format, ... string C-style format string
%
% DESCRIPTION
%
% A simple wrapper to sys_printf(...)
%
% PRECONDITIONS
%
% o Assumes class <c> exists in c... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function [ I, Ixx, Iyy, Ixy, Gxx, Gyy, Gxy, Hdense, Hnonmax, Corners] =
% harris_corner(Igray, parameters )
% purpose : Harris Corner Detector
%%%%%%%%%%%%%%... |
a0_list = zeros(1,100);
a1s_list = zeros(1,100);
a1c_list = zeros(1,100);
iu=1;
for u = 1:1:100
[a0,a1s,a1c] = Flapping2(u,0,0,deg2rad(12),0,0,10);
a0_list(iu) = a0;
a1s_list(iu) = a1s;
a1c_list(iu) = a1c;
iu=iu+1;
end
figure(1)
plot(1:1:100,rad2deg(a0_list),'linewidth',2)
xlabel('u');ylabel('... |
function configSync
%configures the DAQ device used to generate TTL pulses
global daq daqPort1state setupDefault
if setupDefault.useMCDaq==1
daq = DaqDeviceIndex;
if ~isempty(daq)
%port 0 is used for stimulus related TTL pulses
DaqDConfigPort(daq,0,0);
Daq... |
function output = json_read_slow(fid)
dat = fileread(fid);
txt = json_decode(dat);
keypoints = zeros(length(txt.keypoints),2,2,7);
scores = zeros(length(txt.keypoints),2,7);
for i = 1:length(txt.keypoints)
m1=txt.keypoints{i}{1};
m2=txt.keypoints{i}{2};
keypoints(i,1,:,:) = [[m1{1}{:}]; [m1{2}{:}]];
... |
%Homework 4
%By Yejing Zhou & Mengyan Li
%plant model
% Ap = [-1.3046, 1.0, -0.21420, 0; 47.411, 0, -104.83, 0; 0, 0, 0, 1.0; 0, 0, -1.2769, -1.356];
% Bp = [0;0;0;12769.0];
clear
clc
% actuator model
wn = 2*pi*11;
xi = 0.707;
% plant model with actuator
Ap_hw3 = [-1.3046,1.0, -0.21420, 0; 47.711, 0, -104.83, 0;0, 0,... |
%% Set vars for plotting (for popClassifier_setXYall)
% savefigs = 0;
% loadPostNameVars = 1; % set to 1 if this script is not called from imaging_prep_analysis
% traceType = '_'; % whether traces are S, C, or df/f
% traceType = '_C_';
% traceType = '_S_';
% traceType = '_dfof_';
trialHistAnalysis = 0;
iTiFlg = 2; ... |
classdef ustc_dc_v1 < qes.hwdriver.icinterface_compatible
% wrap ustcadda as dc source
% Copyright 2017 Yulin Wu, Institute of Physics, Chinese Academy of Sciences
% mail4ywu@gmail.com/mail4ywu@icloud.com
properties (SetAccess = private)
numChnls
end
properties (SetAccess = private, GetAc... |
clear all;
close all;
clc;
n=input('Enter the basis matrix dimension: ');
m=n;
for u=0:n-1
for v=0:n-1
for x=0:n-1
for y=0:n-1
powervalue=0;
sn=log2(n);
for i=0:sn-1
a=dec2bin(x,sn);
b=bin2dec(a(... |
alphaKQ = data_alpha; thetaKQ = data_theta; VmKQ = data_Vm;
%%
alphaKinf = data_alpha; thetaKinf = data_theta; VmKinf = data_Vm;
t = alphaKQ(:,1);
ref = thetaKQ(:,2);
figure(1)
clf
subplot(3,1,1) % Alpha
plot(t,alphaKQ(:,2), 'k:', 'LineWidth', 1.4)
hold on
plot(t,alphaKinf(:,2),'k')
legend('\alpha_{Q}','\alpha_{H_... |
% DYANMIC NETWORK SCRIPT EXAMPLE
clear all
% 1. LOAD DATA
data(1,:)=randn(1,20000);
data(2,:)=circshift(data(1,:),10);
data(3,:)=randn(1,20000);
model.data = data;
% 2. LOAD MODEL PARAMETERS
model.sampling_frequency = 500;
model.t = 1:1/model.sampling_frequency:size(data,2)/model.sampling_frequency;
model.window_step... |
files = dir('*.jpg');
for i = 1:size(files,1),
Y = imread(files(i).name);
Y = imresize(Y,[50 50]);
Y = reshape(Y,50*50,1);
X = [X;Y'];
end |
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% system_configuration_sample.m
% Configuration file for the whole system, including
% processors, applications, tasks, messages, custom contraints and modes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Simple configuration example
%%%%%%%... |
% Syntax
% [NRep, err] = PS_GetRepetitions(StimN, ChN)
% Description
% Gets number of repetitions - the number of times that the bi-phasic pulse or the arbitrary waveform (loaded from a text file) is repeated for channel ChN.
% StimN - stimulator number to query (starts from 1)
% ChN - channel number ... |
function [scan] = diagscan(N)
% DIAGSCAN Generate diagonal scanning pattern
%
% [scan] = DIAGSCAN(N) Produces a diagonal scanning index for
% an NxN matrix
%
% The first entry in the matrix is assumed to be the DC coefficient
% and is therefore not included in the scan
slast = N+1;
scan = slast;
while... |
function course_ch5(n)
% 第五章 彩色图像处理
% n=1 RGB图像
% n=2 索引图像
% n=3 索引图像
% n=4 预定义的彩色映射
% n=5 处理RGB与索引图像
% n=6 彩色图像平滑处理
% n=7 彩色图像锐化处理
% n=8 梯度检测彩色边缘
% n=9 图像分割
if(n == 1)
% RGB图像
rgbcube();
elseif(n == 2)
% 索引图像
... |
function [vtrans, vrot] = rs_visual_odometry(raw_image)
% [vtrans, vrot] = rs_visual_odometry(raw_image)
% Copyright (C) 2008 David Ball (d.ball@uq.edu.au) (MATLAB version)
% Michael Milford (m.milford1@uq.edu.au) & Gordon Wyeth (g.wyeth@uq.edu.au)
%
% This program is free software: you can redistribu... |
close all
clear all
clc
%Leer el Primer angulo
promt = 'introduzca el valor (grados):';
angDeg = input(promt);
angRad = deg2rad(angDeg);
%Leer el Segundo angulo con diferente variable
promt = 'introduzca el valor (grados) de la segunda articulacion:';
angDeg2 = input(promt);
angRad2 = deg2rad(an... |
function r = dos2lin(p)
% function r = dos2lin(p)
%
% dos formatinda verilen "p" stringindeki "\" karakterini
% lin format?ndaki kar??l??? olan "/" ile de?i?tir.
%
% Example:
% p = 'data\train'
% r = dos2lin(p)
r = strrep(p, '\', '/'); |
function fill64(data,scanrate,time)
% fill64(data,scanrate,time)
% Plots all 64 channels on screen, for envelope data
% time (optional) gives the time range [tmin,tmax) in seconds
% if time is absent, the whole range is plotted
set(0,'Units','pixels')
scnsize = get(0,'ScreenSize');
figure('Position',scnsize)
set(gcf,'D... |
filename = 'open_loop_ultimate.txt';
A = importdata(filename);
offset=20;
A=A(offset:end,1:5);
A(:,1)=A(:,1)-offset*0.1;
plot(A(:,1),A(:,3),'b-');hold on;
plot(A(:,1),10.1*ones(size(A(:,1),1)),'r-');
legend(...'setpoint level [cm]',... ...
'tank level [cm]','asymptotic value'...,'intial flow u_0 [ml.s^-1]','command... |
function plot_amp2(H1,H2,m2,m3,s1,s2,Q)
% H1 = 0.5;
% H2 = 0.6;
% m2 = 0.5;
% m3 = 0.25;
% s1 = 1.0;
% s2 = 1.0;
% Q = 1.0;
% H1 = 0.3;
% H2 = 0.85;
% m2 = 0.5;
% m3 = 0.25;
% s1 = 1.0;
% s2 = 1.0;
% Q = 1.0;
% H1 = 0.6;
... |
frame = imread('C:\Users\60069978\Documents\MATLAB\scan\frame_grados_01_004.png');
perfil = median(frame);
perfil = double(perfil)/2^4;
datos_x = [];
datos_y = [];
for i = 1:numel(perfil)
if perfil(i) ~= 0
datos_x = [datos_x i];
datos_y = [datos_y perfil(i)];
end
end
% digo qu... |
time2=1:65;
Xi=Xi(:,:);rXi=rXi(:,:);Xs=Xs(:,:);rXs=rXs(:,:);
Xi=fXi(:,:);rXi=frXi(:,:);Xs=fXs(:,:);rXs=frXs(:,:);
Xi=normc(Xi);rXi=normc(rXi);Xs=normc(Xs);rXs=normc(rXs);
Ns=size(Xs,1);Ni=size(Xi,1);
nex=size(Xi,2);rnex=size(rXi,2);
dtrn=1:round(nex*1/3);
drtrn=1:round(nex*1/3);
ctrn=numel(dtrn)+1:round(2*nex/3);
crtrn... |
[filenames, pathname, filterindex] = uigetfile( '*.wav', 'WAV-files (*.wav)','Pick a file', 'MultiSelect', 'on');
%in case only one selected
y = zeros(16000, length(filenames));
fs = zeros(length(filenames),1);
for K = 1 : length(filenames)
thisfullname = fullfile(pathname, filenames{K});
y1 ... |
%% Representación Gráfica de señales Sinusoidales
t = 0:2:59;
y = sin(t/6);
subplot 311
g1 = stem(t,y,"r");
grid on;
xlabel("tiempo s"); ylabel("Amplitud");
title("Resultado de stem en señal y(t)")
subplot 312
g2 = plot(t,y, "g"); g2.LineWidth = 2;
grid on
xlabel("tiempo s"); ylabel("Amplitud");
title("Resultado de ... |
function [P, PARENT, KINE, INER] = LegModel()
% Parameters (all in mm)
P.LT = .100; P.Lh = .200; P.Lt = .250; P.Ls = .250;
P.Lf = .150; P.Lw = .100; P.La = .050; P.Lb = .050; P.Lc = .010;
P.g = 9.8;
% Transformations from one joint to its proximal joint (proximal)^T_(dis... |
%{
# Optional parameters for event detection
psp_opt : smallint unsigned # event detection option index
---
low_pass = 100 : float # high pass filter
high_pass = 5 : float # low pass filter
min_amp = 2 : float # minimum allowable amplitud... |
function WF1 = WFLeg1()
% Leg 1: Engine start and warm up
% This value is taken from Roskam
WF1 = 0.99;
end
|
% Load images
clc;
clear all;
close all;
% for n=1:13
% images{n} = imread(sprintf('Images/Miscellaneous-USC-DataBase/misc/color_image/%03d.tiff',n));
% end
for K = 1 : 20
images = imresize(imread((sprintf('%d.jpg', K))),[256, 256]);
setfigurepos([100 100 900 1000]);
ax = subplot(4, 5, K);
imshow(images, 'Pa... |
function result = bitxor (arg1, arg2)
% bitxor bitwise xor of to numbers
% works much like bitxor in the Matlab library.
[errorcode, byte_vector1, byte_vector2] = common_size (arg1, arg2);
assert (errorcode == 0, ...
'bitxor', 'vector dimensions do not match');
[m, n] = size (byte_vector1);
result = zeros... |
function [ mz,sp,pmz ] = rawH5mean(file,mzRange)
%rawH5mean - determine mean spectrum
% Define mz values if not provided
if nargin == 1
mzRange = [100 1000];
end
% Determine number of pixels
totInt = h5read(file,'/totPts');
numS = numel(totInt);
% Paolo's code
pmz = cell(numS,1);
wb = waitbar(0,'Hello');
%... |
function [spikeTimes,synch_chan] = get_spikes_old(data_root,start_time,end_time,plot_name)
plot_on = false;
fs = 30000; %In Hz
spikeThreshold = 3; %In standard deviations
%For average plotting
first_ch = 20;
last_ch = 120;
step_ch = 10;
chans = [first_ch:last_ch];
%For individual plotting
chan_list = [first_ch:step_ch:... |
% Load in the Annexin data set and the TP0 treated data set
% p-value analysis
close all; clear all; clc;
[growth_data, T]= xlsread('../data/Annexin_data.xlsx');
%% Adjust the data
tdata = growth_data(:,1); % this is in hours
% cell numbers should be in millions
N_cells = growth_data(:,2:end);
nsubpops = 3;
%% Make a... |
function result = ifwt(signal)
result = common.fwtInner(signal);
end
|
function [inc,roll,flag] = cameraAnglesFromHorizon(images,cameraParams,horizonOptions)
% undistort images
[nr,nc,n] = size(images);
imageUndistort = zeros(nr,nc,n,'uint8');
for i = 1:n
imageUndistort(:,:,i) = undistortImage(images(:,:,i),cameraParams);
end
% set horizon search ROI
if isempty(horizonOptions.Rows)
... |
function parameters(sgn)
global uc rho_w rho_u rho_v M_d T_m tau N K K_dth Vc dt Ts
% ------------------- Control Design ------------------- %
dt = 0.01; % Initial Increment [sec]
Ts = 0.01; % Step size time [sec]
T_m = 120; % Acceleration [m/sec2]
tau = 0.05;... |
function [ x, res ] = polyfilter( A, b, order)
%POLYFILTER Fit polynomial basis function to data.
% Inputs:
% Observations: n x m
% b: Labels (n x 1)
% order: Order of the polynomial. Must be less than n.
% Outputs:
% x - Solution (m x 1) evaluated along the polynomial
m = size(A, 2... |
function p = fhm_params(q,s2_type,s2_fSizes,s1_fVals,c1sp)
% if nargin < 6, is_s1frag = false; end
if nargin < 7, is_colfrag = false; end
p.groups = {};
%***************************************************************************************************************
c = struct;
c.name = 'ri';
... |
% Software: Preprocessing
% Author: Hy Truong Son
% Position: PhD Student
% Institution: Department of Computer Science, The University of Chicago
% Email: sonpascal93@gmail.com, hytruongson@uchicago.edu
% Website: http://people.inf.elte.hu/hytruongson/
% Copyright 2016 (c) Hy Truong Son. All rights reserved.
function... |
function avarfit(sigma, tau)
% Gyro Allan variance fit tool.
%
% Prototype: avarfit(sigma, tau)
% Inputs: sigma - gyro Allan variance array, in deg/hur
% tau - Allan variance correlated time array, in sec
%
% Example:
% y = avarsimu([0.001,0.05,0.01,.01], [1, 1], 0.01, 1000000, 1);
% [sigma,tau] = avar... |
clc;
close all;
clear all;
% Leitura da base de dados
filename_std = 'C:\repos\ann-arrhythmia\dataproc\healthy_samples.csv';
filename_norm = 'C:\repos\ann-arrhythmia\dataproc\healthy_samples_norm.csv';
hidden_layer_size = 1000;
x_norm = csvread(filename_norm); % Entradas Normalizadas
x_std = csvread(filename_std); % ... |
function desiDB
%desiDB - this is the new and rejuvenated functino for launching a DESI
%toolbox database (for the new toolbox!)
% Let's define the default path here
if ismac
%defP = '/Volumes/Data/Data/';
%defP = '/Users/jmckenzi/Dropbox/Imperial/Projects/Multiple Samples/Colo/';%DB/MSA/';
%defP = '/Users... |
function [weights, params, history, infer, grad] = rbm_train(xtrain, params)
% fill in missing values
params = fillin_params(params);
% input-output types
typein = params.typein;
typeout = params.typeout;
% filename to save
if ~isfield(params,'fname'),
params.fname = sprintf('%s_%s_%s_v%d_h%d_step_%d_eps%g_l2re... |
function g = g_wdbc(w,D,mu)
X = D(1:30,:);
y = D(31,:);
P = length(y);
g = zeros(31,1);
for i = 1:P
xi = [X(:,i); 1];
ei = exp(y(i)*(w'*xi));
gi = -y(i)*xi/(1+ei);
g = g + gi;
end
g = g/P + mu*w;
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.