text stringlengths 8 6.12M |
|---|
% Solving Inverse Kinematics Problem with ANFIS
% By Samuel Ayankoso
% The American Univerisity in Cairo
% Animation code
clc;clear;close all;
l_1= 5;l_2=3;
hold on
axis(gca,'equal') % Aspect ratio
axis([-15 15 -4 16]) % limits of the x and y axes
% Training points of the revolute angle 1 and 2
qt1= 0:1*p... |
function [bincenters, circularhists,meanhist]= avg_thetahist(resdata,window,binwidth)
%resdata=preparedata(resdata,window,0.3,0);%make sure data is filtered
%turning off here to use in find same flies 2 conds
numflies=length(resdata);
%bins will always be the same
%circular hists
circularhists=[];
binnum=360/binwid... |
function [f,g]=JM97Aoptim(x)
% 97年中国大学生数学建模竞赛A题目标函数
% 用法: [f,g]=jm97aoptim(x)
% x--7个零件参数
% f--目标函数
% g--虚拟参数,优化工具箱实用
% 全程变量:COST(成本矩阵),VARI(容差等级)
% 相关M文件:jm97a, jm97afun
global COST VARI;
y=jm97afun(x);
sig=0;h=0.0001;
for i=1:7
xh=x;xh(i)=x(i)+h;
dy=(jm97afun(xh)-jm97afun(... |
%
% Usage: [V [val_regularizer]]=mexProximalPathCoding(U,DAG,param);
%
% Name: mexProximalPathCoding
%
% Description: mexProximalPathCoding computes a proximal operator for
% the path coding penalties of http://arxiv.org/abs/1204.4539
%
% Given an input matrix U=[u^1,\ldots,u^n],
%
%
% In... |
function y = network_1A_model(theta, t)
%t = t(1:37)';
% given parameters theta, find experimental value y at time t
[tt yy] = ode45(@(t,y) network_1A(t,y,theta), [0 t(end)], [1 1 1 1 1 1 1]);
%y = [interp1(tt, yy(:,5), t) interp1(tt, yy(:,6), t) interp1(tt, yy(:,7), t)]';
y = interp1(tt, yy(:,5), t);
... |
function [x, y, Ass_cost] = lap(cc, NONLINK_MARKER, extendedTesting, augmentCC, noLinkCost)
%LAP solves the linear assignment problem for a given cost matrix
%
% A linear assignment tries to establish links between points in two sets.
% One point in set A can only link to one point in set B and vice versa.
% The c... |
function [emgNeurCondensedTable,emgCondensedNeurEval] = kinVsEMG(muscAvgNeurEval,muscNeurEval,columnNames,params)
%default params
muscleArray = {'bicep_lh','bicep_sh','brachialis',...
'brachioradialis','deltoid_ant','deltoid_med','deltoid_pos',...
'ext_carp_rad_brevis','ext_carpi_ulnaris',...
... |
function dx = F_freefall(t,x,d,k1,k2,L_sp0,L_mB,mB,IB,m1,m2,lLeg_flag,postApex_flag,t_prev_stance,target_pos,k_f,max_dx_des)
% Derivative function for the model.
n = max(size(x,1), size(x,2));
dx = zeros(n,1);
% system parameters:
g = 9.81; % gravitational constant (m/s^2)
% Controller
F_ctrl = Controller_flight(x,... |
classdef tmovemex < matlab.unittest.TestCase
properties
numLabs
end
properties (TestParameter)
device = {'cpu', 'gpu'}
end
methods (TestClassSetup)
function openParpool(test)
test.numLabs = 4 ;
if ~isempty(gcp('nocreate'))
delete(gcp) ;
end
cl = parcluster('local... |
function iccv = icc(mat,singlemeas)
% given a matrix, computes the interclass correlation
% among the COLUMNS of the matrix
% e.g., where matrix is subjects going down and time across
% so EACH SUBJECT gets their OWN COLUMN
if nargin<2, singlemeas=1; end
if singlemeas
k=size(mat,2); % # things across which... |
%% Initial declarations
%Table for the final results
tab = table();
%% Calculation of T0
%Start of t0's timer
startT0 = tic;
x = 0.55;
for j = 1:1000000
x = x + x;
x = x / 2;
x = x * x;
x = sqrt(x);
x = log(x);
x = exp(x);
x = x / (x + 2);
end
%End of t0's timer, store the result
t0 = t... |
%%
imagen=rgb2gray(imread('irm.png')); %pasamos directamente la imagen a grises
%%
figure,
subplot(1,2,1),imagesc(imagen),axis image off,colormap(gray)
subplot(1,2,2),bar(imhist(imagen)),xlim([0 250]),grid
%primero es facil notar que el histograma esta disperso,con mayor
%concentracion de intensidad en los medios |
function [ux2,uy2,uz2,omegax2,omegay2,omegaz2] = getMotion(Obj,Motion)
%% GetMotion
% Finds the motion of the object after a collision
% The underlying theory is presented in the corresponding rigid body analysis
% We begin by assuming that the point of contact does not slip
% A linear system of equations mu... |
%% Name - Sheel Nidhan
% Date - 12 Dec 2019
% Code for plotting the bar plots
clear;
addpath('./aux_plots/');
dirout = './';
%% Reading the filename
filename = './aux_plots/files/eigvalue_barplot_diff_loc.mat';
load(filename);
%% Setting up the figure environment
close all;
x0=0;
y0=0;
width=1... |
function BoreholeBrowser()
global data gps sMelt ambientTemp gridList metadata panels fHandles displayStatus const
const=loadConfiguration();
% defining path to rutines
path(path,const.routinesFolder);
%path(path,'/home/camilo/5_UBC/GPS_processing/02_Solution data manipulation (Lucas, SCOUT, PPP, R... |
% single weighted: weighted least square and sparse coding framework
function X = WLSSC_DCWk(Y, Sigma, Wls, par)
% initialize D
YW = bsxfun(@times, Y, Wls);
[U, S, V] = svd(YW * YW', 'econ');
D = V * U';
% update S
S = sqrt(max( diag(S) - size(Y, 2) / Wls(1)^2, 0 ));
% update W for weighted sparse coding
Wsc = bsxfun... |
function dag=DBmcmc_inter2dag(inter)
% DBmcmc_inter2dag: Transformation: dag --> inter
%
% Invocation
% inter= DBmcmc_dag2inter(dag)
N_inter= size(inter,1);
if N_inter~= size(inter,2)
error('inter must be a quadratic matrix')
end
N_dag=2*N_inter;
dag=zeros(N_dag);
dag(1:N_inter,N_inter+1:2*N_inter)=inter;
|
function [symbols,ns] = ParseChemicalFormula(formula)
% function [symbols,ns] = ParseChemicalFormula(formula)
% Returns the elements and number of atoms for a chemical formula
% inputs:
% formula: a case sensitive string e.g. Na2SO4
% outputs:
% symbols: a cell array containing the element symbols e.g. {'Na'}... |
function fMixedAudio = LoopInterferenceWithWuW(fWuWAudio, fInterAudio)
%--------------------------------------------------------------------------
% Currently, only consider situation when Interference Length < WuW length
%--------------------------------------------------------------------------
iWuWLen = length(fWu... |
function [mu_x,mu_y,eta] = set_spatial_freq_range(p)
% Computes a set of spatial frequencies at which to calculate OTF
% Compute a list of lateral indices
nyquistLateral = 1/(2*p.pixelSize);
fullLateralIndex = linspace(-nyquistLateral,nyquistLateral,p.arrayLength+1);
fullLongitudinalIndex = linspace(-nyquistLateral,ny... |
function [y] = ReLU(x)
% y=max(x,0)
% x: column vector
y=max(x,0);
end
|
function [rs,thetas,zs] = EDB2coordtrans1(xsou,xwedge,nvec1)
% EDB2coordtrans1 - Transforms one set of cartesian coordinates to edge-related cylindrical coordinates.
% The cyl. coord. system is defined so that:
% A z-axis is placed along the edge, from the given endpoint 1 to the given
% endpoint 2.
% The o... |
clc;clear;
%读入图像,并转换为double型
I=imread('a.png');
I_D=im2double(I);[MM,NN]=size(I_D);
figure();
subplot(1,2,1);
imshow(I);
title('原图像');
m=5;n=5;
%确定要扩展的行列数
len_m=floor(m/2);len_n=floor(n/2);
%将原始图像进行扩展,这里采用了镜像扩展,以进行图像边缘计算
I_D_pad=padarray(I_D,[len_m,len_n],'symmetric');
%获得扩展后的图像尺寸
[M,N]=size(I_D_pad);d=5;J_Alpha=zeros... |
addMyPath;
clear all;
fprintf('Compiling wave2pfMatMex.cpp...\n');
%mex -Id:/users/jang/c/lib -Id:/users/jang/c/lib/audio -Id:/users/jang/c/lib/utility -Id:/users/jang/c/lib/wave wave2pfMatMex.cpp d:/users/jang/c/lib/audio/audio.cpp d:/users/jang/c/lib/utility/utility.cpp d:/users/jang/c/lib/wave/waveRead4pda.cpp -out... |
function [dis1,dis2,agl] = StarPair(Data,i,j,k)
dis1 = angular_distance(Data(i,8:9),Data(j,8:9));
dis2 = angular_distance(Data(i,8:9),Data(k,8:9));
%angle = atan2d(norm(cross(vector1,vector2)), dot(vector1,vector2))
%agl = acosd(dot(vector1,vector2)/(sqrt(vector1(1)^2+vector1(2)^2)*(sqrt(vector2(1)^2+vector... |
%3.naloga
%narišimo Bernsteinove bazne polinome stopnje 5
%x os
x = 0:0.01:1;
%bernsteinovi bazni polinomi zloženi v diagonalno matriko
b = diag([1 1 1 1 1 1]);
%graf
for i=1:6
b(i,:)=bernstein2power(b(i,:));
plot(x,polyval(b(i,:),x))
hold on
end |
function X = get_feature(data)
[~, N] = size(data);
X = zeros(324, N);
for i = 1:N
fprintf('processing image %d\n', i);
im = reshape(data(:, i), [32, 32, 3]);
% X(:, i) = color_histgram_hsv(im);
X(:, i) = extractHOGFeatures(im);
end
end |
close all; clear; clc;
% one dimensional FCT algorithm with a Boris-Book limiter
% (1) Initialized uitd etc. to multidimension.
% (2) Donor cell test is successful.
% (3) Conservative test is successful.
order = input('Enter the order (2, 4 or 6) of the high order algorithm: '); % order of high order solution
... |
function job_list = get_matador_session_job_list(session_object, retrieve_job_tags, partial_tag_set_matching, include_or_exclude )
job_list = get_condor_session_job_list(session_object, retrieve_job_tags, partial_tag_set_matching, include_or_exclude ); |
% [PYR, INDICES] = buildWpyr(IM, HEIGHT, FILT, EDGES)
%
% Construct a separable orthonormal QMF/wavelet pyramid on matrix (or vector) IM.
%
% HEIGHT (optional) specifies the number of pyramid levels to build. Default
% is maxPyrHt(IM,FILT). You can also specify 'auto' to use this value.
%
% FILT (optional) can be a st... |
function annotateOP2(mz,sp,grp,ass,db,txtP,qThresh)
%annotateOP2 - revised function, hopefully simpler...
% Here is where we would have all of the pre-amble and file creation. This
% can come once we have the full function working...
[fid,wb] = preamble(txtP,grp,ass);
% Convert qThresh to a number
if ~isnumeric(qThre... |
classdef servoCmd < handle
%SERVOCMD Provides a convenient interface for writing to and reading
%from commands internal to the servo controllers
properties(Access = public)
addr %Hex string indicating the address for serial parsing
dataType %Type of data to send to FPGA
... |
%Ribiere
p = [-1 -1 2 2;0 5 0 5];
t = [-1 -1 1 1];
net=newff(minmax(p),[3,1],{'tansig','purelin'},'traincgp');
net.trainParam.show = 5;
net.trainParam.epochs = 300;
net.trainParam.goal = 1e-5;
a = sim(net,p)
|
% This script generates a user interface to allow manual measurement of
% bone width with CT and US images. Using these data points, the script
% generates a Bland-Altman plot to compare the two modalities
% close all
if ~exist('V', 'var')
source_table = dicomCollection('Coronal_volume');
V = dicomreadVolume(so... |
function testWACE(f)
%close all
if nargin<1, f=900;
end
fs=16000;
t=1/fs:1/fs:1;
in=sin(2*pi*f*t')*.99;
rampdur=0.2;
% in = 2*(rand(fs/2,1)-.5);
in=ramp(in,fs,rampdur);
tempname = [pwd '\temp_testWAVE'];
wavwrite(in,fs,tempname)
p.pre_emphasis=1;
p.ScaleByOutLevel=0;
p.equalise=1;
p.reference_SPL_dB ... |
run ~/startup.m
% % manually scale waterbath signal (0, 25, 50, 75, 100%);
% % run conventional k-space hybrid and spatially-segmented k-space hybrid method
% select the undersampling pattern to use
sampPattern = '4x,1D'; % '1x,1D', '2x,1D', '3x,1D', '4x,1D'
load('phantomdata.mat');
libInd = 2; % brain h... |
classdef PAW < handle
% PAW class implements accruate optical phase measurement
% reconstruction. Refer to:
% https://www.osapublishing.org/ol/abstract.cfm?uri=ol-37-19-4062
% for the PAW theory and experiment.
%
% The phase reconstruction is carried out in four steps as follows.
%
% s... |
function [threshold] = optimal_threshold(image)
image = double(image);
% 4 corner pixels are considered background
background_sum = (image(1,1) + image( size(image,1),1) + image(1,size(image,2)) + image(size(image,1),size(image,2)));
background_count = 4;
background_mean = background_sum / background_count;
% intial ... |
function u = nonlinear_analysis(in,xx,m_SetElem,f,funbc,e_DatSet,e_VG)
%***************************************,***************************************************
%* RUTINA PARA RESOLVER EL PROBLEMA NO LINEAL MATERIAL MEDIANTE M.E.F. *
%* ... |
t0=0;tf=100;n=550000;m=1000;
%w=zeros(m,n+1);
%z=zeros(m,1);
for i=1:m
w(i,:)=bm1(t0,tf,n);
z(i)=w(i,n+1);
end
|
% Bioinformatics Toolbox -- Graph Theory functions.
|
finalFeature = [zerocrossingcount1' polyCoeff featureMatrix pos_one neg_one];
normalizedFeature = normalize(finalFeature);
normalizedFeature(isnan(normalizedFeature))=0;
[coeff, score, latent] = pca(normalizedFeature);
top5Eigen = coeff(:,1:5);
newFeature = normalizedFeature*top5Eigen;
scatter(1:33, newFeature(... |
%% brief of this program
% This program is for calibration simulation of robot arm QKM HL6 with
% RoboDK. This program can calibrate the robot automatically, with randomly
% generated joint angles, this program can reduce the composition to less
% than 1e-10.
% How to use it: open RoboDK file(calibration_QKM_uframe.rd... |
function roots=errloc(lamda,t,Y)
[m,n]=size(Y);
sum=0;
deg_lamda=length(lamda)-1;
k=1;
loc=-Inf*ones(1,t);
for i=1:m-1
for j=2:deg_lamda+1
val=mult(lamda(j),(i-1)*(j-1),Y);
sum=add(sum,val,Y);
end
if sum==-Inf
loc(k)=i-1;
k=k+1;
end
sum=0;
end
roots=loc;
end
|
function result = util_sub_jaccard_index(a, b) %#codegen
% JACCARD_INDEX Calculating the Jaccard Coefficient Index between a and b.
%
% This is the extented jaccard index, a.k.a. Tanimoto coefficient
%
% Created on Aug/28/2010 By Pu Jiangbo
% Britton Chance Center for Biomedical Photonics
% PJB#2012... |
function waypoints_t=tack_points(p0, p1, d_t, theta_t, alpha_tw)
global gnc_par
global mdl_par
gnc_par.isBordejando = true;
alpha_aw = mdl_par.alpha_aw;
x0 = p0(1);
y0 = p0(2);
x1 = p1(1);
y1 = p1(2);
%finding line A
if (x1 - x0) == 0
a_A = 1000000000000... |
function [r_ij,numPointsTx,numPointsBS] = Gen_R_ij(lambdaTx,lambdaBs,axisXY)
numPointsTx=poissrnd(lambdaTx*axisXY.^2);
numPointsBS=poissrnd(lambdaBs*axisXY.^2);
transPoints = rand(numPointsTx, 2).*axisXY;
bsPoints = rand(numPointsBS, 2).*axisXY;
bsPoints=bsPoints(:,1)+j.*bsPoints(:,2);
transPoints=transPoints(:,1)+j... |
%% Q20
Q17
Q18
figure;
subplot(1, 2, 1);
surf(z);
colormap gray
shading interp;
axis('tight');
view(110,45);
axis('off');
camlight
title('|\nablaz|=F(x,y)')
subplot(1, 2, 2);
surf(Z);
colormap gray
shading interp;
axis('tight');
view(110,45);
axis('off');
camlight
title('|\nabla^2z|=p_x + q_y')
|
%--------------------------------------------------------------------------
% save the negative data to ./data/negative/
% save name format dataset_featureName[_scale].mat
% this function is util for getNegative.m
% 2014-05-12
% Aborn Jiang (aborn.jiang@foxmail.com)
%----------------------------------------------------... |
function oldNodeList = deleteOverlappingMembers(groundStructure, mesh, meshSpacing)
if (nargin <= 2)
meshSpacing = 1;
end
elementNum = size(mesh.Elements, 2);
if (elementNum == 0)
oldNodeList = [];
return;
end
meshFacetNodes = zeros(elementNum, 8);
meshNode... |
function val_array = point_eval_fun(x1,x2,param)
% this function is for numerical integration
% x1 : array / x2 : array
As=param.As;
bs=param.bs;
mu = param.mu;
Sigma = param.Sigma;
% if the point is in shade, returns 0
is_in_shading = zeros(size(x1(:)'));
for n = 1:leng... |
classdef paramiterator
% Paramiterator
%
% Flattens arbitrarily nested loops into a single loop, iterating
% over all combinations of loop parameters.
%
% Makes it very easy to change the iteration parameters without rewriting
% loops, reindenting code, updating indices, etc.
%
% Very convenient for simulation proble... |
clc;
clear all ;
close all ;
%Original image
Img = double(imread('D:\STUDY\DIP\img_lib\lena512.bmp'));
[Row Column] = size(Img);
Input_Image_Fourier = fft2(Img);
[a,b] = meshgrid(1:Row,1:Column);
%Blur Function.
Blur_Funct_1 = exp(-0.0025*(a.^2+b.^2).^(5/6));
Blur_Funct_2 = exp(-0.001*(a.^2+b.^2).^(5/6... |
function [ExcessData cmosData AnaIn1 AnaIn2 StmTrg fpath] = readCMOS7
% purpose: Import CMOS files from the MiCAM Ultima-L system
% input:
%
% outputs:
% cmosData = three-dimensional matrix containing the optical mapping
% image data
% AnaIn1 = vector of the signal recorded from "Analog Input #1"
% AnaIn... |
function f=sensfig2(wfstruct,cats,cases)
% function f=sensfig2(wfstructs,cats,cases)
%
% Draws a sensitivity figure.
%
% wfstructs is a cell array of 2- or 3-element wfstruct arrays, containing base and
% sensitivity (optionally sensitivity low and high or somesuch). Each item
% results in a bar on a sensitivity su... |
function number = getInfoTableColumn(guiMode, descriptor)
% GETINFOTABLECOLUMN: Returns the column number in the octsegMain
% Info table of the descriptor, and within a certain guiMode
global TABLE_HEADERS
number = 0;
for i = 1:numel(TABLE_HEADERS{guiMode})
if strcmp(TABLE_HEADERS{guiMode}{i}, descriptor)
... |
close all
clear all
% p = optimvar('p',10);
% y = optimvar('y',10);
% %objec = transpose(p)*p;
% objec = (p(1))+(p(2))+(p(3))+(p(4))+(p(5))+(p(6))+(p(7))+(p(8))+(p(9))+(p(10));
% prob = optimproblem('Objective',objec);
% prob.Constraints.cons1 = sum(y) == 1;
% prob.Constraints.cons2 = p*y == 0;
%
% problem = prob2str... |
function [ processed_points ] = cluster( func, ad_list )
%A function to perform the non-parametric clustering using a depth-first
%search or seed filling approach.
%initialising the cluster count to 1
cluster_cnt = 1;
%getting the number of points to create the hash table to store cluster
%values of processed points... |
% bernoulli
p = 0.5;
X = rand() < p;
% binomial
p = 0.5;
n = 10;
U = rand(n, 1);
X = sum(U < p);
% geometric(return X + 1 at the end for shifted)
p = 0.5;
X = 0;
while rand() >= p
X = X + 1;
end
% negative binomial
p = 0.5;
n = 10;
X = zeros(1,n);
for i = 1:n
while rand() >= p
X(i) = X(i) + 1;
end
e... |
%MDV Praktikum 8 Vorbereitungsaufgabe 1
%Funktion haardec
function [u, v] = haardec(x)
% führt einen Zerlegungsschritt der schnellen Haartransformation durch
% input : x ? zu zerlegendes Signal
% output : u ? Approximationen
% v ? Details
% Bemerkung : u,v sind halb so lang wie x
... |
function set_linewidth(h,lw)
% set_linewidth - set the linewidth
%
% Equivalent to:
% set(h,'LineWidth', lw);
%
% Copyright (c) 2010 Gabriel Peyre
set(h,'LineWidth', lw); |
function elem=atmultipole(fname,varargin)
%ATMULTIPOLE(FAMNAME,LENGTH,POLYNOMA,POLYNOMB,PASSMETHOD)
% creates a multipole element
%
% FAMNAME family name
% LENGTH length[m]
% POLYNOMA skew [dipole quad sext oct];
% POLYNOMB normal [dipole quad sext oct];
% PASSMETHOD tracking function.... |
function out=MVSICmodelParam(X,opt,PHI)
if nargin==0
% This vector of parameter values corresponds to the severe inflammation
% case (Section 2). Other parameter values in Table 2 are commented next to
% their respective parameter values.
X=[3 3 8 3 3 .1 .1 8 .5 .1 1 .05 .1 .2 0.05];
% eFAST output cho... |
function [success,heid] = obtain_1ring_surf_he_manifold(vid, second_vid, elems, sibhes, v2he) %#codegen
success = false;
type_struct = false;
if isstruct(sibhes)
type_struct = true;
end
if type_struct
heid.fid = int32(0); heid.lid = int32(0);
else
heid=int32(0);
end
if type_struct
fid = v2he.fid(vid); ... |
function ColorRasters(selspikes,color)
% ColorRasters(selspikes,color)
% Add (or overwrite) colored spikes in the raster portion
% of the current figure
% selspikes is a cell array listing the times of the new/overwritten spikes
% color is the character or RGB defining the color
axes(findobj(gcf,'Tag','Rasters'));
hold... |
% function cost_i = objective(d, g, I_i, I_j)
% M = size(d,1);
% I_nc_tilde = M * I_i ./ sum(exp(d*g'));
% cost_i = sum((I_nc_tilde - I_j).^2);
% end
function cost_i = objective(d, g, I_i, I_j)
cost_i = sum((I_i - d*I_j).^2);
end |
function H=entropy_gaussian(Cm);
n=size(Cm,1);
H=(n/2)*(1+log(2*pi))+0.5*logdet(Cm);
%H=(n/2)*log(2*pi*exp(1))+0.5*logdet(Cm);
%H=0.5*logdet(2*pi*exp(1)*Cm); |
%Andrew Logue - 9/12/19
%test code to run each function
clc
%addFunc
fprintf("Add functin sum: %.2f\n", addFunc(2,4));
%subFunc
fprintf("Subtraction functin sum: %.2f\n", subtractFunc(21,7));
%multFunc
fprintf("Multiplication functin sum: %.2f\n", multFunc(5,5.5));
%divFunc
fprintf("Division functin sum: %.2f\n", divb... |
% Demo for Deep Countour Detector (please see readme.txt first).
function edgesDLDemo(dlPara)
%% set opts for training (see edgesTrain.m)
opts=edgesTrainDL(); % default options (good settings)
opts.modelDir='models/'; % model will be in models/forest
opts.modelFnm='random_scg'; % model n... |
function [ Particle_next ] = sample_KP( Particle,F,Q)
%SAMPLE_RB Summary of this function goes here
% 直接带入KP
Particle_next = zeros(1,6);
temp = [Particle(1:2) Particle(4:5)];
Particle_temp = reshape(temp,4,1);
processNoise = sample_gaussian(zeros(length(Q),1),Q,1)'; %each time calculate one frame
Particle_temp(1:4)=... |
# week 8
#
# Standardize your Iris data by subtracting the feature means and dividing by feature ranges.
# Write or take a code for k-means and apply it to the standardized data.
# The number of clusters k is three and the initial centers are 1st, 51st and 101st objects (under the assumption that index counting starts ... |
%LAB 1: Simulation of the chemical reaction (continuous system)
k1 = 5;
k2 = 3;
c1(1) = 1;
c2(1) = 2;
c3(1) = 0;
dt= 0.001;
i = 0;
for t = 1:200
c1(t+1) = c1(t) + (k2*c3(t)-k1*c1(t)*c2(t))*dt;
c2(t+1) = c2(t) + (k2*c3(t)-k1*c1(t)*c2(t))*dt;
c3(t+1) = c3(t) + (2*k1*c1(t)*c2(t)-2*k2*c3(t))*dt
i(t+1) = ... |
# Assume there are 100 entities occurring in three locations on a Cartesian plane, A=(1,0), B=(1, 20), C=(1, 21).
# Consider two different distributions of entities among the locations:
# (I) 1 falls in A, 49 in B and 50 in C;
# (II) 34 fall in A, 33 in B and 33 in C.
# Consider the task of partitioning of the ent... |
clc;clear;
load('ind_MNF_20');
img = ind_MNF_20;
load('indian_pines_gt.mat')
gt_map = indian_pines_gt;
% load('pavia_MNF_20')
% img = pavia_MNF_20;
% load('paviaU_gt.mat')
% gt_map = paviaU_gt;
% load('salinas_MNF_20');
% load('Salinas_gt.mat')
% img = salinas_MNF_20;
% gt_map = salinas_gt;
% d = 20;% Can be adjusted;... |
function initSlideBar(handles, vidPlayerAxesPos, videoInfo)
timeStep = 300; % 60 second
vidSliderPos = get(handles.videoSlider, 'Position');
vidSliderPos = [vidPlayerAxesPos(1, 1), ...
vidPlayerAxesPos(1, 2) - vidSliderPos(1, 4), ...
vidPlayerAxesPos(1, 3), ...
... |
function PrepNormalize(boldData)
% PREPNORMALIZE - Normalizes BOLD functional images to MNI space.
%
% SYNTAX:
% PrepNormalize(boldData)
% PrepNormalize(boldData, 'PropertyName', PropertyValue...)
%
% INPUT:
% boldData: BOLDOBJ
% A single BOLD data object undergoing pre... |
if show_results_plots==1
% tic
disp(['Plotting results...']);
Time = 0:period;
% %% Battery Current Limiter
% figure();
if use_drive_cycle == 0
subplot(2,2,1);
plot(cyc_acc(:,1),cyc_acc(:,2), ...
cyc_brk(:,1),cyc_brk(:,2),'LineWidth',2)
title('Pedal Cycle')
ylabel('%')
... |
function pairs_batch=create_pairs(pairs_number_all,pairs_type,seq_list,pos_ratio,delta_frame,varargin)
% To create pairs in the sequence according to the pairs_type
% inputs:
% pairs_number_iter:
% the number of pairs to be created
% pairs_type:
% the variable pair_type has the following values:
% 1) box to box
%... |
function indexCH = indexCalinskiHarabasz( data, Dmatrix, nCatFeature, clu, varargin)
%%%Input:
%data: row wise, normalized data for clustering, nCatFeature first
%Dmatrix: a precomputed pairwise distance, just to save computation
%nCatFeature: number of Categoric feature in the dataset
%clu: clustering , partition... |
load daycie
wave = 370:730;
plot(wave,daycie)
grid on
set(gca,'fontsize',20)
set(gca,'xtick',[350:100:750]);
print -deps linearMod.eps
|
function [ret] = Function_arguments_1(x,y,z,t,a,b,s)
%%
% File: probafuggveny.m
% Directory: /home/ppolcz/_
% Author: Peter Polcz (ppolcz@gmail.com)
%
% Created on 2021. April 29. (2020b)
%
arguments
% Hiaba opcionalis, a Repeating miatt ezeket is meg kell adnom
% fuggvenyhivaskor, kiveve ha nincs Repea... |
function [imgdata ROI_imgdata] = ReadDataImages(fn, wavelength,ref,nSteps)
%fn = extractAfter(filepath,"\New_Diffuser\");
wv = wavelength;
for ii = 1:nSteps
group_name = strcat('/images/wave',num2str(wv),'/meas',num2str(ii));
images = h5read(fn,strcat(group_name,'/imagedata'))/mean(ref);
ROI_imgd... |
function g = sigmoid(z)
%SIGMOID Compute sigmoid function
% g = SIGMOID(z) computes the sigmoid of z.
% You need to return the following variables correctly
g = zeros(size(z));
% ====================== YOUR CODE HERE ======================
% Instructions: Compute the sigmoid of each value of z (z can be a matrix,
... |
function[XVec] = calMX(MX) %hesaplama fonk.
XVec=mean(MX); % Kolonlarin ortalamasini alir.
end |
function plotOneResult_Iterations(ds, numTrainItr, numSepItr, attribute, filename)
f = figure;
X = ds(ds.Training_Iterations == numTrainItr & ds.Separation_Iterations == numSepItr, :);
Y = zeros(4, 4);
Z = zeros(4, 4);
t_attribute = sprintf('%s_Target', attribute);
i_attribute = sprintf('%s_Interferenc... |
function [shiftValues, shift_rec] = JAShiftValues(JA)
% gets shift values from hip flex, knee extend, and ankle dorsiflex
% signals (6 total), then take average of these shift values
targCurr = JA.targAlign;
if(numel(JA.jointNames) == 35) % using shldrPrism model
alignJoints = [22,29,25,32,27,34]; %hip flex, knee ... |
words = input('previous words: ', 's');
words_s = strsplit(words, ' ');
N = length(words_s);
data = [dict.(char(words_s(N))), dict.(char(words_s(N))), dict.(char(words_s(N))), dict.(char(words_s(N)))];
y = ff_nn_fw(w, hyp.siz, data);
[B IX] = sort(y, 'descend');
for i = 1 : 10
fprintf('%s:\t%f\n', char(vocab... |
function WarnAndReturn(message, varargin)
% WARNANDRETURN - Displays a warning message in the console and forces the calling function to return.
%
% SYNTAX:
% WarnAndReturn(message)
% WarnAndReturn(message, var1, var2,..., varN)
%
% INPUT:
% message: STRING
% The message string that will be d... |
function array = getArrayType(filename)
%
% FUNCTION array = getArrayType(filename)
%
% Return the type of the array from which data in the given HDF5 recording
% file was recorded.
%
% INPUT:
% filename - HDF5 recording file name. (string)
%
% OUTPUT:
% array - Array type (string)
%
% (C) 2016 Benjamin Na... |
function [settings] = LoadSettings(settingsFile, handles)
% LoadSettings Loads Settings from a file
% The file is a valid JSON file.
% This file is saved everytime the user presses "Save and Apply" in the
% settings window.
settings = jsondecode(fileread(settingsFile));
WindowFunctions = ["Rectangle Wi... |
% open return.mat
load('returns.mat')
% compute sharp ratio
weight = [1.853652057369482e-09;0.019117192886523;0.980882805259825]
w_naive = [1/3;1/3;1/3]
return_mv = A' * weight;
return_naive = A' * w_naive;
risk_free = 0.02;
rf_1 = (mean(return_mv) - risk_free)/std(return_mv);
rf_2 = (mean(return_naive) - risk_free)/st... |
% A script to build filters
%LoadSpikeSnippets;
%disp('Spikes are in variable "spikes." Edit them now; type "return" to resume');
%keyboard
%figure(gcf)
%LoadRandSnippetsDlg;
% Construct the filters by a 2-pass procedure:
% build preliminary filters from crudely aligned spikes,
% then realign them using the crude spike... |
close all;clear;clc;
pause(5);
linkgame();
|
function centroids = kMeansInitCentroids(X, K)
centroids = zeros(K, size(X,2));
idx = randperm(size(X,1));
centroids = X(idx(1:K),:);
end
|
function act_out = activateNN(act_in, W, bias, act_func, pa_layer)
% funciton to feed forward one layer of neural network
% act_in and act_out are column vectors
% act_func needs to handle vectors
if ~exist('pa_layer','var')
pa_layer.type = 'none';
end
if isfield(pa_layer, 'gpu')
W = gsingle(W);
bi... |
for p=1:Psensor
figure(p); clf;
for n=1:Nspkr
plot(k_birth(n):k_death(n),true_tdoa(k_birth(n):k_death(n),p,n),'k','linewidth',2);
hold on;
end;
for el=1:L
plot(el,tdoa_peaks{el,p},'or');
plot(el,tdoa_peaks{el,p}(1),'*r');
end;
end; |
function str = create_cpf_str(desc,mpcc,mpcb,mpc)
% Create string containing information about node conversion from cpf.
define_constants;
str = sprintf('-------------------------------\n');
if isfield(mpcc,'cpf')
str = [str sprintf([desc '\n' mpcc.cpf.done_msg '\nBase transfer: %0.0f MW\nMa... |
% Going to recognize the note that is being played in this audio
% https://www.mathworks.com/matlabcentral/answers/19970-how-to-see-freq-response-of-a-wave-file
% https://pages.mtu.edu/~suits/notefreqs.html
% in this section I am identifying major chords
% if I want to identify minor chords, I would just need to add... |
function [h]=pltmask(Gname, ptype, C);
%
% PLTMASK: Plots ROMS Land/Sea masks
%
% [h]=pltmask(Gname, ptype, C)
%
% This function plots the land/sea mask. If appropriate, It also
% ovelays the given coastline data.
%
% On Input:
%
% Gname NetCDF file name (character string).
% ptype plot type flag:
%... |
% Name:Tommy Lee Truong
% Last Edit:Feb 2 2021
% Program Name: HW 1
clc; clear all; close all;
% for pen and paper problems see pdf scan
%% Q2
A=[diag([2;4;7]),ones(3,2);ones(2,3),zeros(2,2)]
%% Q3
A =randn(5,5)
B =randn(5,5)
% 3a
C =trace(A*B)-trace(B*A)
% 3b
C =(A*B)'-B'*A'
%% Q4
N=10000;
M=20;
x=ran... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.