text stringlengths 8 6.12M |
|---|
function dydt = f(t, y, p)
% Goldbeter mammalian
eval(p);
dydt = [
% mRNA of Per, Cry and Bmal1
% ----------------------------------------------------
% 1 Mp (Per mRNA)
(vsp+amp*force) * y(14)^n / (y(14)^n + kap^n) - vmp * y(1) / (y(1) + kmp) - kdmp * y(1);
% 2 Mc (Cry m... |
function P_rast = rasterize(P,M,N,H,W)
%Pixels Per Inch in x and y direction
l_N = N/W;
l_M = M/H;
%Calculate and approximate pixel values
x_rast = round((P(:,1)+H/2)*l_N+1);
y_rast = round((P(:,2)+W/2)*l_M+1);
P_rast = [x_rast y_rast];
end |
clear all;
close all;
clc;
n=input('Choose: \n1. delta-wye \n2. wye-delta \n');
if n==1
d=input('Enter the value of R1, R2, R3 of Delta connected circuit :\n');
s=sum(d);
w(1,1)=d(1,1)*d(1,3)/s;
w(1,2)=d(1,1)*d(1,2)/s;
w(1,3)=d(1,2)*d(1,3)/s;
disp('The Ra, Rb, Rc of Wye connected circuit are :')... |
close all;
load danePompa.mat;
%%pompa nowa charakterystyka
wielomian_pompa02=polyfit(tpompa02,hpompa02,1);
pompa02=polyval(wielomian_pompa02,tpompa02);
wielomian_pompa03=polyfit(tpompa03,hpompa03,1);
pompa03=polyval(wielomian_pompa03,tpompa03);
wielomian_pompa04=polyfit(tpompa04,hpompa04,1);
pompa04=polyval(wielomia... |
function [PVMatrix, Points] = chaining(Images)
% Store number of frames
framelen = length(Images);
% Initialize PVMatrix:
% `Point-View-Matrix' matrix that contains frames on each row
% and point indices on each column, where each index
% corresponds to a point in the frame of that row, which
% can be se... |
function CarData = CarTracker(CarData, CurrTime, DetectionsList, DetectionsTime, nDetections, ActionList, serialPort)
nCars = 1;
minVel4az = 10;
if isempty(CarData)
CarData(1).state = [0 0 0 0 DetectionsTime];
CarData(1).az = 0;
CarData = repmat(CarData,1,nCars);
end
for ind = 1:nCars
dT = Detect... |
E = csvread('test_energies.csv');
V = csvread('test_variances.csv');
alpha = csvread('test_alpha.csv');
beta = csvread('test_beta.csv');
figure(1)
surf(beta,alpha,log10(V));
xlabel('beta')
ylabel('alpha')
zlabel('log(Variance)')
figure(2)
surf(beta,alpha,E);
xlabel('beta')
ylabel('alpha')
zlabel('Energy') |
function [PETHspike]=PeriEventTimeHistogram_Spike(TrialNumber, thisCLST, Time, RasterInfo)
rowSpike=length(thisCLST.Timestamp);
PETHspike.Choice=zeros(TrialNumber.Trial,1);
for j=1:TrialNumber.Trial
h=1;
for i=1:rowSpike
if(thisCLST.Timestamp(i)>=Time.Choice(j,1)-RasterIn... |
% Authors - Basaran, Baumberger, Dietsch, Wert
function [x, y] = positionEstimator(test_data, modelParameters)
% **********************************************************
%
% You can also use the following function header to keep your state
% from the last iteration
%
% function [x, y, newModelParameters] ... |
close all
labelSize = .05;
noiseSize = .02;
f1 = figure('Color', 'w', 'units', 'normalized', 'position', [.2 .2 .4 .6])
plot([0 1], [0 1], 'k')
hold on
noiseTerm = noiseSize*randn(20);
%% shibire
for aa = 1:size(uas_ShiTS_x_48A08AD_prediction_L,1)
s1 = scatter(uas_ShiTS_x_48A08AD_prediction_L(aa,1... |
figure
plot(transpowerfluxzero)
hold on
plot(transpowerfluxpifourth)
hold on
plot(transpowerfluxpihalf,'--')
hold on
plot(transpowerfluxrandom,':')
hold on
volumeFraction = 0.2134;
lambda = 10.437938144329898;
nRBC = 4.3*10^-6;
%z=4*pi*(volumeFraction*nRBC/lambda)*[1:1:1020];
figure
depth=0.52729*[... |
% Ankur Parikh
% SAILING Lab
% Carnegie Mellon University
% This is a demo file to demonstrate how to use the spectral and EM
% functions
function [] = BasicDEMO()
% model parameters
Ko = 6; % number of observed states
Kh = 2; % number of hidden states
TREE_DEPTH = 4; % depth of tree
... |
%
% classdef CParamMark < handle
%
% Classe utilisé pour travailler avec le GUI du marquage automatisé
%
% METHODS
%
classdef CParamMark < handle
properties (SetAccess =protected)
canSrc =1; % canal source
canDst =1; % canal destination
canExtra =1; ... |
% A helper function for parsing xml. Given an xml tag block in string form,
% parse the tag's attributes and text/children.
%
% Author: Joe Rollo
%
% Input:
% -xml the xml string containing the tag.
% -tagName the name of the tag.
%
% Output: if the tag has children, then the return value is a structure
% containin... |
function bv = dec2binv(varargin)
% Get binary value (as string)
bin_char = dec2bin(varargin{:});
bv = double( bin_char == '1');
bv = fliplr(bv);
end |
function div_Vec = compute_Divisors(N)
x = floor(sqrt(N));
i = 1;
div_Vec = [];
while i <= x
if (mod(N,i) == 0)
div_Vec = [div_Vec i];
if i^2 ~= N
div_Vec = [div_Vec (N/i)];
end
end
i = i+1;
end
end |
N=32;
n=1:1:N;
y1=cos(2*pi*n/N+pi/4);
y2=0.5*cos(4*pi*n/N);
y3=0.25*cos(8*pi*n/N+pi/2);
y4=y1+y2+y3;
y1fft=2*fft(y1)/N;
y2fft=2*fft(y2)/N;
y3fft=2*fft(y3)/N;
y4fft=2*fft(y4)/N;
figure
subplot(2,2,1);
stem(abs(y1fft));
xlabel('Numer pasma czestotliwosciowego');
ylabel('Magnituda');
title('y1[n]=cos(2\pin/N+\pi/4)');
sub... |
function loaddata
global mu mu_PWID mu_former exit_IDU r_relapse delta alpha alpha_old alpha_DAA p_complete omega infect target_late prev0 prev0_MSM age_cohort P Tin Run y0_init y0 t0...
r_AF0 r_F0F1 r_F1F2 r_F2F3 r_F3F4 r_F0F1_PWID r_F1F2_PWID r_F2F3_PWID r_F3F4_PWID r_F4DC r_DCHCC r_F4HCC r_DCLT r_DCdeath r_HCCL... |
function s = CS4640_FTi_sum(im,x,y)
% CS4640_FTi_sum - inverse Fourier Transform sum
% On input:
% im (MxN float array): input image
% x (float): u spatial value
% y (float): v spatial value
% On output:
% s (complex): inverse Fourier Transform sum
% Call:
% s = CS4640_FTi_sum(im,2,3);
% Author:
% ... |
function [rX, rY] = rotate_vectors(X,Y,theta)
%[rX, rY] = rotate_vectors(X,Y,theta)
%
% rotate around the origin the points given by the x and y coordinates
% defined by 1D vectors X and Y. Rotate by THETA degrees around the Z axis.
% Positive theta describes a counterclockwise rotation
% B.Scheifele 2017
%check inp... |
function results=gab_task_fmri_infsl(args)
%compute the mahalanobis distance for contrast as a roving search light
%through a brain
indir=pwd;
load(args.spmmat,'SPM')
cd(SPM.swd);
%create our contrast vector, making sure to apply it to each session
C=zeros(length(args.convec),size(SPM.xX.X,2));
for c=1:length(args.... |
%%%%% calculate the apex frame %%%%%%
clear all;
% search casme2 and replace with "samm" and "smic" for other two datasets
load('..\data\Annotation4casme2.mat');
alpha = 8;
rootDir = ['..\dataset\casme2_alpha' num2str(alpha)];
rootDir = 'D:\Datasets\CASME2\ProcessedData\Cropped';
rows = 10;%128,64
cols = 8;... |
%textscan_notes
%Note when we have an error we get:
%Check line 2
%---------------------------------------------------
% 1/ 1(8): FUNCTION: FUNCTION
% 1/10(10): <NAME>: fatalError
% 1/20(1): <EOL>: <EOL>
% 2/ 1(1): <EOL>: <EOL>
% 3/ 1(4): <NAME>: This
% 3/ 6(2): <Cmd Arg>: is
% 3/ 9(1): <Cmd Arg>: ... |
function [filename]=get_name ()
%asks for file name
filename=input('Enter filename: ','s');
%filename error check
while exist(filename) == 0
disp(' ');
disp('file does not exist, please try again')
filename=input('Enter filename: ','s');
end
end
|
function distancecalculation % not finished, as a backup
%% distance transform of reference and rotated reference within each layer
dbinaryr=zeros(height1,width1,page1);
drbinaryr=zeros(height1,width1,page1);
for k=1:page1 % distance transform of each layer
dbinaryr(:,:,k)=bwdist(binaryr(:,:,k))*scalex;
... |
function [y]=mfc( a, b, c)
t= 0:0.01:15;
y=(c/a)+(b-(c/a))*(exp(-a*t));
plot (t,y);
endfunction
%// a b c
[y]=mfc(2,1,1); |
%% Error estimates for series of interconnected beams
% Main ideas is to estimate an error introduced to the system by choosing coarse discretization
% and reducing the system.
% The system consists of a series of beams mutually interconnected with
% springs and dampers. The first beam in the series is considered c... |
function [ u ] = ridge_regression( X,y,lambda )
%RIDGE_REGRESSION Summary of this function goes here
% Detailed explanation goes here
maxiter = 500;
[nsample,nfeat] = size(X);
u = zeros(nfeat,1);
cost = 0;
costs = [];
% lambda = 0.05;
tau = 0.05;
for t=1:maxiter
[c... |
function this = getTGFromFigure(arg)
% Find how many axes in figure
h_axes = findobj(arg,'Type','Axes');
n_axes = numel(h_axes);
% Prepare output
this = repmat(shapes.textgroup,1,n_axes);
% Go through each axes handle
for i = 1 : n_axes
% Get their title
... |
close all;
num_joints = 21;
num_entries = num_joints * 3;
num_thetas = 29;
tx = 640 / 4;
ty = 480 / 4;
fx = 287.26;
fy = 287.26;
path = 'C:/Users/tkach/Desktop/training/';
%% Read joint locations
fileID = fopen('C:/Users/tkach/Desktop/training/joint_locations.txt','r');
joint_locations = fscanf(fileID, '%f');
num_fr... |
function [beta0, L0] = var_init( x, y )
%Update geometry based on original coordinates (x,y) in global frame and
%generalized displacement vector u:
nel = length(x) - 1;
beta0 = zeros( nel, 1);
L0 = zeros( nel, 1);
for j = 1 : nel
dx = x(j+1) - x(j);
dy = y(j+1) - y(j);
L0(j) = sqrt( dx^2 + dy... |
function [dLdC, dLdA] = ComputePolyGradient(SetCount, SetSizes, SetIndices, SetCenterPoints, DataPoints, Speeds, Coefficients, Aspect, AccelDataPoints)
dLdXY = zeros(size(DataPoints));
for i = 1:SetCount
U = SetIndices(i):(SetIndices(i) + SetSizes(i) - 1);
dldxy = ones(1, SetSizes(i)) * AccelDat... |
% John Chen <chenyi@hitsz.edu.cn>
% Harbin Institute of Technology
% Created: November 2013
% Modified: November 2013
function [param, settings] = check_settings(param, settings)
% function that checks that the settings provided by the user are correct.
if size(param.R,1)==0
err = MException('Initialisation:Mtx... |
%For a COMPLEX CELL
%Generate sequence of white noise images
%Simulate spiking responses for them
%Scale so that average spike count per image is 0.2spikes
%Average over all images with at least 1 count
%Compare to the RF of the model neuron
%Aryaman Majumdar
x0=-5.0;
y0=-5.0;
x=x0;
y=y0;
ds=0.2;
s1=1;
s... |
function [peakDetected, locDetected, ...
pks, loc, ...
THR_Sig_Store, THR_Noise_Store, ...
SIG_LEV_Store, NOISE_LEV_Store] = peakDetector(ecg, Fs, minPeakInterval)
% peakDetector function to detect peak in signal based on [1]
%
%[peakDetected, locDetected, peakRaw, loc... |
% function to visualise the performance of the headingPID controller
time_heading = headingPID_ctrlAllo_Log(:,1);
heading = headingPID_ctrlAllo_Log(:,2);
yawRate = headingPID_ctrlAllo_Log(:,3);
forwardVel = headingPID_ctrlAllo_Log(:,4);
swayVel = headingPID_ctrlAllo_Log(:,5);
heading_demand = headingPID_ctrlAllo_Log(:... |
function print2pdf(handles, pdfname, overwrite)
% PRINT2PDF Print figures to pdf in format displayed on the screen.
% PRINT2PDF(handles) print figures to pdf to current folder named
% figure1.pdf, figure2pdf, ...
%
% PRINT2PDF(handles, pdfname) print figures to pdf to files defined in
% ''pdfname''.
%
% PRINT2... |
function white_chess_medium_mode()
global fig ax grid_size black white turn black_pos
mat = zeros(grid_size+9, grid_size+9); % enlarge current grid
mat(5:grid_size+5,5:grid_size+5) = black;
flag = false; % stop flag to show whether computer has made the move to block user
x_b = black_pos(1); y_b = b... |
%Tyler Matthews P10
%% Part A
clc; close all; %Clear Console, close figures
num = [0 0 0 0 0.0850];
den = [1 0.4174 1.0871 0.2805 0.1512];
poles = roots(den)
%% Part B
figure;
G = tf(num, den)
bode(G)
%% PART C
abDen = [1 -1 0];
abNum = [0 3 -1];
Phi = tf(abDen, abNum) %(sigma / roe) : (row - l*sigma)
newNum = [3... |
classdef CatheterTvd
%% CATHETERTVD
% $Revision$
% was created $Date$
% by $Author$,
% last modified $LastChangedDate$
% and checked into repository $URL$,
% developed on Matlab 8.5.0.197613 (R2015a)
% $Id$
properties
stopTol = 1e-3
maxIter = 1e2
ver... |
%% SC4160 MODELLING AND CONTROL OF HYBRID SYSTEMS
% Step 2.3
% Jessie van Dam (4395832) and Miranda van Duijn (4355776)
clear all; close all; clc;
% Region 1
syms a1 b1 ud1
fun11 = (ud1^2 + 4 - a1 - b1*ud1).^2;
fun12 = (4*ud1 - a1 - b1*ud1).^2;
int11 = int(fun11,ud1,0,2);
int12 = int(fun12,ud1,2,5);
g1 = matlabFunctio... |
T.Properties.VariableNames = {'DEVICE' 'FUNCTION' 'DATA_TYPE'... %%DA aggiungere FILE_CSV, PATH
'DIFFICULTY_LEVEL' 'DISTINCT_OPERANDS'...
'DSTINCT_OPERATORS' 'EFFORT' 'PROGRAM_LENGTH'...
'PROGRAM_LEVEL' 'PROGRAM_VOLUME' 'TOTAL_OPE... |
function samples=read_texbat(duration,start_time,filepath)
% usage: samples=read_texbat(duration,start_time,filepath)
%
% Inputs:
% duration Amount of data to load (seconds)
% start_time Start time at which to load data (seconds)
% filename TEXBAT File name to be loaded
%
% Outputs:
% samples Output... |
function [p,mu,q,E] = FindElasticMean(Data)
Niter= 20;
n=size(Data,3);
figure(1);clf;
for i=1:n
% X = ReSampleCurve(Data(:,:,i),200);
q(:,:,i) = curve_to_q(Data(:,:,i));
% q(:,:,i) = ProjectC(q(:,:,i));
end
del = .5;
mu = q(:,:,3);
E(1)=1;
iter=2;
while (iter<=Niter && E(iter-1)>0.05)
vm = 0;
... |
function [distancemax,I,error,Reallignedsource]=ICPmanu_allign2(target,source)
[IDX1,d]=knnsearch(target,source,'K',3);
[IDX2,D]=knnsearch(source,target);
crossvector=cross((target(IDX1(:,2),:)-target(IDX1(:,1),:)),(target(IDX1(:,3),:)-target(IDX1(:,1),:)));
lengthy=sqrt(crossvector(:,1).^2+crossvector(:,2).^2+... |
% Plot Triaxus
clear;clc
close all
path(path,genpath('/home/amandine/Logiciels/matlab/seawater'));
path(path,genpath('/home/amandine/Logiciels/matlab/GSW_V305_toolbox'));
path(path,genpath('/home/amandine/Logiciels/matlab/altmany-export_fig-7720793'));
% TRIAXUS________________________________________________... |
%Parámetros iniciales
Ksmin=0.15; lam=2.1 ; Ksop=0.25; L=20e-3; XL=L*100*pi; V=1100*sqrt(2);
syms x;
%b0=pi/(2*lam); bloq=pi; no es necesario
C0=1/(100*pi*Ksmin*XL)
L0=1/(lam^2*(100*pi)^2*C0)
XCeq=Ksop*XL;
Ceq=1/(100*pi*XCeq);
Kbpu= C0/Ceq-1
bet= vpasolve(Kbpu== 2*lam^2/(pi*(lam^2-1))*(2*cos(x)^2/(lam^2-1)*(lam*tan(lam... |
% Function created by Dimas Aryo
% https://se.mathworks.com/matlabcentral/fileexchange/36140-dijkstra-algorithm
% Cited As:
% Dimas Aryo (2021). Dijkstra Algorithm (https://www.mathworks.com/matlabcentral/fileexchange/36140-dijkstra-algorithm),
% MATLAB Central File Exchange. Retrieved March 16, 2021.
%-------------... |
function grad=fftGrad(u)
% Calculates the gradient if u is a scalar field, or the Jacobian
% matrix if u is a vector field. Must be scaled by 2pi/L.
grad=[];
for n=1:ndims(u)
grad=cat(ndims(u)+1, grad, fftD(u, n));
end
end |
tic
m=9;
n=12;
k=n-m;
R=(n-m)/n;
frame_num=10;
Npf=k*frame_num;
EbN0db=0:0.5:6;
for nEN=1:length(EbN0db)
Err=0;
sigma_2=1/(2*10^(EbN0db(nEN)/10)*R);
for num=1:frame_num
num;
s=round(rand(1,n-m)); %随机产生长为(n-m)的信息序列
load G
%getG();
c=mod(s... |
function weights = loss_optimize_o_lr_cs(features,labels,rho,alpha,numIterations,minLeaf,imbalance)
[numInstances,numFeatures] = size(features);
numLabels = size(labels,2);
labels2 = double(labels);
imbalance(:,sum(labels2) == 1) = [];
labels2(:,sum(labels2) == 1) = [];
imbalance(:,sum(labels2) == 0) = [];
labels2(:... |
function [cmap,cax] = mcColorMap(values,cmap)
%MCCOLORMAP returns the color mappin for values given cmap.
% MCCOLORMAP uses the color map (CMAP) to define the color mapping for
% the range in VALUES.
%
% find range of data in values and normalize to [0 1]
maxVal = max(values);
minVal = min(values);
normVa... |
%This script reads and plots data from a .CSV file.
clc;
clear;
%Open data file
f_8_1 = fopen('Page_8_1_loop_gain_PM.csv');
f_8_2 = fopen('Page_8_2_closed_loop_gain.csv');
f_9_1 = fopen('Page_9_1_input_swing.csv');
f_9_2 = fopen('Page_9_2_output_swing.csv');
f_10 = fopen('Page_10_settling.csv');
f_11 = fopen('Page_11... |
%% Initialise, create video readers, players and initial frames.
clc; close all; clear variables;
filenames = ['subject4/proefpersoon 4_M.avi'; 'subject4/proefpersoon 4_R.avi';
'subject4/proefpersoon 4_L.avi'];
% Load the pairs of extrinsic parameter matrices.
load("stereoParamsLM.mat"); load("ster... |
function [Fd,Vd,seedIndex]=remeshTriSurfDistMap(varargin)
%% PARSE INPUT
switch nargin
case 3
F=varargin{1};
V=varargin{2};
numSeeds=varargin{3};
startInds=1; %Use first point as only start
case 4
F=varargin{1};
V=varargin{2};
numSeeds=vara... |
% This code requires the installation of Arduino® Support Package:
% http://www.mathworks.com/matlabcentral/fileexchange/32374-matlab-support-package-for-arduino-aka-arduinoio-package
% The "blink_challenge" is described in the last part of the Ladyada Arduino
% tutorial, http://www.ladyada.net/learn/arduino/ and... |
function Br = gray2btr( Gr )
% Br = gray2btr(Gr) converts an m-by-n array Gr of
% ones and zeros whose rows represent Gray codes into
% the array of ones and zeros whose bit-rows represent
% corresponding binary integers least-sig-bit first.
% Gr is treated as if Gr = (Gr ~= 0) . The time
% ... |
function display(bob)
% adabooster_cg.display(bob)
% G. Raetsch 1.6.98
% Copyright (c) 1998 GMD Berlin - All rights reserved
% THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE of GMD FIRST Berlin
% The copyright notice above does not evidence any
% actual or intended publication of this work.
% Please see COPY... |
function tbxStruct = demos
% DEMOS Demo list for the ANN Library.
% Version 1.1
% Giampiero Campa, West Virginia University
% 1-June-2007
if nargout == 0, demo blockset; return; end
tbxStruct.Name='Adaptive Neural Networks';
tbxStruct.Type='Blockset';
tbxStruct.Help={
'The Adaptive Neural Ne... |
function he = rbf_interp_fd(x,ep,fd,h,xe)
% he = rbf_interp_fd(x,ep,fd,h,xe)
% Interpolate using RBF-FD
% This routine could use some improvement in terms of efficiency.
N = length(x);
Ne = length(xe);
% srange = sqrt(6*fd/N); % search range
rbf = @(ep,rd2) exp(-ep^2*rd2);
% [idx_e, dist, root] = kdtree... |
% simétrica
clc; clear;
A = [ 4 2 2 1; 2 -3 1 1; 2 1 3 1; 1 1 1 2]
% gera uma matriz simétrica aleatória:
%N = 5;
%A = randi(10,N,N) - 1;
%A = A - tril(A,-1) + triu(A,1)'
disp('Transformação de Householder: (obtemos uma matrix tridiagonal)')
HH = householder2(A)
%jj = 1
%TMP = A(jj+1:end,jj)
%TMP = A(4:end,1)
%A
%f... |
%% Data Processing Script
% Loop for Tire Pressure Indexing
for Index_P = (1:length(RoundData.P))
S=0;
E=1;
% Loop for Inclination Angle Indexing
for Index_IA = 1:length(RoundData.IA)
% Loop for Vertical Load Indexing
... |
function ab = setfields(a, b, newfield_flag)
%SETFIELDS Set multiple fields of a structure.
% SETFIELDS(A,B), where A and B are structures, returns a copy of A where
% the fields named in B have the values specified in B. If B contains fields
% not in A, signals an error.
% SETFIELDS(A,B,'create') allows B to c... |
function mP = stabilizedKalmanFit(x, y, nLatents, varargin)
% A function to fit an initial stabilizer and Kalman filter to
% calibration data.
%
% Usage: mP = stabilizedKalmanFit(x, y, nLatents, varargin)
%
% Inputs:
%
% x - trainining kinematic data. This should be a cell of length N
% where N is the n... |
function [time,stage,z,control,optimvars,output] = exec_bocop_3B_impulse_hill(bocop_def_pb, init, par, options, solFileName)
workspace = [bocop_def_pb 'def_pb_duree_min_5p/'];
% -----------------------------------
% Bocop options
% -----------------------------------
options_bocop = struct('t0','0','tf','1','freetf','... |
function varargout = add_fluids_as_JSON(varargin)
[varargout{1:max(1,nargout)}] = CoolPropMATLAB_wrap(326,varargin{:});
end
|
function next_u_array = lax_solver(u_array, f_array, c, dt, dx)
N = length(u_array);
next_u_array = u_array;
alpha = c*dt/dx;
% the ordinary way
%for i = 2:N-1
% next_u_array(i) = 0.5*(u_array(i+1)+u_array(i-1)) - ...
% 0.5*alpha*(u_array(i+1)-u_array(i-1)) + ...
% ... |
function [x y] = randr(R,n,v)
if nargin < 3, v = 0.05;end
r = R*(1+rand(1,n)*v); % Taking square root gives uniform distribution
t = 2*pi*rand(1,n); % Theta
x = r.*cos(t); % Change to cartesian coordinates
y = r.*sin(t);
|
%% RecordWaveform.m
% Records one second of audio data coming from the Amazon Dash button.
% It then parses for the audio peaks and decodes the transmitted data.
% The final output is contained in DataTable.
clear all
close all
%for testing, load an example waveform. Saves time.
load('test_data.mat');
% %record 1 sec... |
% Sort the results into vectors
type1 = [];
type2 = [];
% Apply each vector in the training set to obtain a plot of classifications
for j = 1:number_to_train
traincase = j;
trainslice = input_data(traincase,:)';
result = neural_net.forward(trainslice);
known = output_data(traincase);
switch known
... |
clear all
clc
%% outline
% study PCA example
load hald;
[pc, score, latent, tsquare ] = princomp(ingredients);
% load Mat_320_int_input_output.mat
% % dat320_in_noh
% b=dat320_in_noh(:,end-6:end);
% b(b<0)=b(b<0)+2*pi;
% [pc, score, latent, tsquare ] = princomp(b);
pc,latent
cumsum(latent)./sum(latent)
% bi... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Author: Trinh, Khanh V <khanh.v.trinh@nasa.gov>
% Notices:
%
% Copyright @ 2020 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration. All
% Rights Reserved.
%
% Disclaimers
%
% No Warranty: ... |
%@(#) p7_version.m 1.1 07/11/09 16:36:29
%
%function [prg,ver,rdate]=p7_version(distfil)
%
%Retreive POLCA version information & run-date
%
% M. Dahlfors 2007/11/09
function [prg,ver,rdate]=p7_version(distfil)
fid=fopen(distfil,'r','b');
a=fread(fid,50,'int');
if a(1)~=1
fclose(fid);
fid=fopen(distfil,'r','l... |
%read_input_file Matlab function
function [num_nodes, num_Elem,N_coords, EC, BC] = read_input_filePA4(filename)
%===========================================================================
% This function can be used to read input files for PA#4, that is, input
% files for bilinear quadrilateral elements. It should... |
%% function unwrappedField = UnwrapPhaseMacro(wrappedField,matrixSize,voxelSize,varargin)
%
% Usage:
% unwrappedField = UnwrapPhaseMacro(wrappedField,matrixSize,voxelSize,...
% 'method','laplacian');
% unwrappedField = UnwrapPhaseMacro(wrappedField,matrixSize,voxelSize,...
% ... |
function[] = motion(y)
[m,n]=size(y);
for i=1:1:n-1
orange_rgb=colorcrop(cdata);
orange_image=imagecrop(cdata, orange_rgb);
blue_rgb=colorcrop(cdata);
blue_image=imagecrop(cdata, blue_rgb);
[centb,centf,bot_cent]=botcentroids1(orange_image, blue_image);
[bot_cent_node] = findnode(bot... |
function phi = phi_comp(X, Z, params, options)
%-----------------------------------------------------------------------
% FUNCTION: phi_comp.m
% PURPOSE: Compute phi from time series data
%
% INPUTS:
% X: time series data in the form (units X time)
% Z: partition
% - 1 by n matrix. Each elem... |
%% 1 Run matstab on c13-2.inp include Harmonics
matstab ../c13-2.inp Harmonics 2
%%
cmsplot ../c13-2.mat
%% 2 Select shallow control rods (a group of four) to insert and change the rod pattern
matstab ../c13-2-shallow.inp Harmonics 2
%% 3 Split the group in 2 and try with the NW-SE pair and the NE-SW pair
matstab ../c... |
function [share,nopurch] = mksharesim(betatrue,x,xi,rc)
%%%%%%%%%%%%
% MKSHARESIM
% generates market share data.
global prods T datasort pAll pSub phi d nn xindex
delta = x*betatrue+xi;
if nargin==4,
MU = x*rc + kron(x(:,xindex), ones(1,nn)) .* kron(d, ones(prods,1)) * phi ;
numer = exp( repmat(delta,1,si... |
%
% radar_detector models a Markov-Chain representation of
% a patrol car looking for speeding cars to ticket
%
% RADAR moves from state to state when bounce-back pulse is
% received. The state transistion is also dependent on the
% probability that the transition will occur.
%
% The states that are tr... |
clear;
load ORL_group.mat;
numtrn=length(X_trn);
numtst=length(X_tst);
[X_svd,Y_svd]=svddecomposition(X_trn,Y_trn);
for i=1:numtrn
% tmp=imresize(double(X_trn{i}),[32,32]);
% X(i,:)=reshape(tmp,1,32*32);
X(i,:)=reshape(double(X_trn{i})',1,m*n);
end
W=LDA(X,Y_trn);
X=X*W; |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Program Name: create_small_CNV_for_inference
%
% Author: Yasmin Kassim
% Copyright (C) 2020. Yasmin Kassim and K. Palaniappan and Curators of the
% University of Missouri, a public corporation.
% ... |
function spheres(varargin)
%SPHERES Description of functions operating on 3D spheres.
%
% Spheres are represented by their center and their radius:
% S = [xc yc zc r];
%
% An ellipsoid is defined by:
% ELL = [XC YC ZC A B C PHI THETA PSI]
% where [XC YC ZY] is the center, [A B C] are length of semi-... |
close all
fileOrDataCell = 2;
motionEventsLocationsX = [];
motionEventsLocationsY = [];
if fileOrDataCell == 1
dateCell = {'211021','211022','211101','211102','211105','211109','211112','211116','211117','211119','211203','211216','220203','220209','220210','220211','220214','220221','220223','220303','22030... |
function [load_bar_comp,state_axis]=show_status_bar(main_figure,varargin)
load_bar_comp=[];
state_axis=false;
if isempty(main_figure)
return;
end
load_bar_comp=getappdata(main_figure,'Loading_bar');
state_axis=false;
if ~isempty(load_bar_comp)
state_axis=strcmpi(load_bar_comp.progress_bar.progaxes.Visible,'on... |
function ouput = mu_avg(p)
u_sc = 0.6;
ouput = u_sc + 0.00134*log(p);
end
|
function A = catstruct(varargin)
% CATSTRUCT Concatenate or merge structures with different fieldnames
% X = CATSTRUCT(S1,S2,S3,...) merges the structures S1, S2, S3 ...
% into one new structure X. X contains all fields present in the various
% structures. An example:
%
% A.name = 'Me';
% B.income = 999... |
function debugTRG(TA, TB, MH)
MAB = contractTA_TB(TA, TB) ;
MAB = partitionMbyBondBond(MAB) ;
for i = 1 : length(MAB)
sum(MAB(i).yiZjBondBond - MH(i).yiZjBondBond)
sum(MAB(i).yiBond - MH(i).yiBond)
sum(MAB(i).yiDim - MH(i).yiDim)
sum(MAB(i).zjBond - MH(i).zjBond)
sum(MAB(i).zjDim - MH(i)... |
addpath( './utils' );
addpath('../libsvm/libsvm-3.22/matlab/')
clear
close all
% datasets={'plant','psortPos', 'psortNeg', 'nonpl', 'sector', 'segment','vehicle','vowel','wine','dna','glass','iris', 'svmguide2','satimage', 'usps'};
datasets={'iris'};
C_list=2.^(-2:1:12);
train_part = 0.8;
rounds=50;
folds=10;
all_res... |
function result = load_or_compute_frame_scores(dataset, number)
% function result = get_frames(dataset, subset, number)
%
% dataset is a result of calling function make_dataset
% subset is 'tr' or 'te' for training or test set
% number is the index of the video we want to read
filename = dataset.test.filenames{number... |
%Function to cycle through a series of tiff images
function [] = tiffS(varargin)
if nargin==1
im = mat2gray(varargin{1});
imPath = pwd;
end
if nargin==0
[imLoc, pathN] = uigetfile('.TIF', 'Select the image stack to load in.');
imPath = [pathN imLoc];
imL = imfinfo(imPath, 'tif');
im... |
%%
%plot3d(@(x, x_opt, f_opt, R, Q) f_16(x, x_opt,f_opt, R,Q));
subplot(2,2,1);
plot3d(@f_15);
subplot(2,2,2);
plot3d(@f_16);
subplot(2,2,3);
plot3d(@f_17);
%%
plot3d(@f_15);
%%
plot3d(@f_17); |
function [f,g,H] = logit_obj(b,Y,X)
% f: function value
% g: gradient
% H: hessian
n = length(Y);
u = exp(X*b);
P = u./(1+u);
f = Y.*log(P)+(1-Y).*log(1-P);
f = -sum(f);
g = X'*(Y-P);
g = -g;
H = -X'*sparse(1:n,1:n,P.*(1-P))*X;
H = -H; |
function [grad] = calc_gradient(model, input, activations, dv_output)
% Calculate the gradient at each layer, to do this you need dv_output
% determined by your loss function and the activations of each layer.
% The loop of this function will look very similar to the code from
% inference, just going in reverse this ti... |
%%%Procedure 4: calculate the features of specified state-action pairs
%This is the most important function to be defined, the performance of
%logistic regression and actor-critic algorithm depends on the definition
%and normalization of features
%This function embedded the single-state state-action feature calculation... |
function update_algo_panels(main_figure,names)
layer=get_current_layer();
curr_disp=get_esp3_prop('curr_disp');
algo_panels=getappdata(main_figure,'Algo_panels');
if isempty(algo_panels)
return;
end
algo_panels(~isvalid(algo_panels))=[];
[trans_obj,~]=layer.get_trans(curr_disp);
for ui = 1:numel(algo_panels)
... |
function eye_record = initialize_eye_record(eye_record_length)
for t=1:eye_record_length
%Merge
eye_record(t).xy_movement_EMD = 0; % 1-fixation, 2- saccade, 3-pursuit, 4-Noise
eye_record(t).xy_movement_EMD_plot = 0; % 1-fixation, 2- saccade, 3-pursuit
eye_r... |
x = 1 + 1i;
y = x;
disp(abs(y));
|
clc;
clear all;
close all;
%% create a figure, define its axis
figure;
axis square;
set(gca,'XLim',[0,50],'YLim',[0,50]);
%% create a rectangular object
r_1 = rectangle('Position',[20 14 7 6], 'FaceColor', 'black', 'Edgecolor','none');
r_2 = rectangle('Position',[45 15 5 4], 'FaceColor', 'blue', 'Edgecol... |
function Iliad (sample_runno, ei, wbvan_runno, mask_runno, monovan_runno, d_rebin,...
monovan_wbvan_runno, monovan_mask_runno)
% Simplified interface to data reduction on Merlin, MAPS, MARI and LET
%
% >> iliad (sample_run, ei, wb_van_run)
% Sample run can be a single run number or to add se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.