text stringlengths 8 6.12M |
|---|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%README:
%%This function is used to update the casefile with a new solution.
%%If mode is 1, then the Q of the strings, the transformer taps and
%%reactors can be updated. If mode is 2, the active power outputs of the
%%strings are update... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% exampleScript.m
%
% Description:
% Example of how to use the HMM alignment algorithm
%
% Automatic Music Performance Analysis and Analysis Toolkit (AMPACT)
% http://www.ampact.org
% (c) copyright 2011 Johanna Devaney (j@devaney.ca), all ri... |
function model = setGAM(model,GAM)
xr_pos = getIndexes(model','r_4041','rxns');
for i = 1:length(model.mets)
S_ix = model.S(i,xr_pos);
isGAM = sum(strcmp({'ATP','ADP','H2O','H+','phosphate'},model.metNames{i})) == 1;
if S_ix ~= 0 && isGAM
model.S(i,xr_pos) = sign(S_ix) * GAM;
end
end
end |
function phaldh2r(varargin);
% phaldh2r( [...] );
% DH2 R
h = timeplot({'DH2R0','DH2R1','DH2R2','DH2R3','DH2R4','DH2R5','DH2R6'}, ...
'DH2 R', ...
'R', ...
{'DH2R0','DH2R1','DH2R2','DH2R3','DH2R4','DH2R5','DH2R6'}, ...
varargin{:} );
|
% flipEnd.m
%
% During tracking using mode 3, flips which centroid blob the algorithm
% tracks. Use this to switch between tracking the head or the tail.
%
% JSB 11/2010
function flipEnd()
global trackingParams;
trackingParams.ringBuffer.flip = true; |
function illustrateContrastTemplate
load config1
mex mexc_ComputeMAX1.cpp
pos = 'catHead';
posSx = 150; pos_thres = 1.2;
load(sprintf('rawmodel_basis_%s_size%d.mat',pos,posSx*posSx));
posT = template;
neg = 'bearHead'; negSx = 120; neg_thres = 0.8;
load(sprintf('rawmodel_basis_%s_size%d.mat',neg,negSx*negSx));
negT = ... |
data = load('provinces.mat');
provinces = data.provinces;
% Compute the mean of each feature
mean_population = mean(provinces(:,1));
mean_area = mean(provinces(:,2));
mean_density = mean(provinces(:,3));
mean_gdp = mean(provinces(:,4));
mean_gdppercap = mean(provinces(:,5));
% Compute the standard deviation of each f... |
clc;clear all;close all;
ntable = [1 3 7 13 21 4 12 19 9 16];
ntable = sort(ntable);
%% Dados iniciais
Densidade = 57.62;
Area_cidade = 344.05;
Habitantes = Densidade*Area_cidade;
if(Habitantes > 100e3)
Rc = 600/1000; %quilometros
n = 5; %fator ambiente
else
Rc = 1000/1000; %quilometros
n = 3; %fator am... |
winsize = 10000;
angle = 0.1;
radius = 0.8;
epsi = 0.0000001;
[x, y] = pol2cart(angle, radius);
lambda = x+y*1i;
[vec, r] = modesynth_single_norand(winsize, lambda);
resid = modal_residuals_nosolve(vec, 1, 1, 1, lambda, winsize);
control = resid_error(resid, r, 1)
resid = modal_residuals_nosolve(vec, 1, 1, 1, lambda+e... |
% Generated through Matlab
% Author: Killian Keller
% E-Mail: killian.keller@ief.ee.ethz.ch
% Organization: ETHZ ITET IEF
function [model] = Physics(model, varargin)
%PHYSICS Summary of this function goes here
% Detailed explanation goes here
options = struct(...
'mat', 'S... |
function unaryUpdate = getLossAugmentedUpdate_hamming( labels, node_weights )
%getLossAugmentedUpdate_hamming computes the update of the unary potentials
% caused by the augmentation of the score function with the Hamming loss
%
% unaryUpdate = getLossAugmentedUpdate_hamming( labels, node_weights )
%
% Input:
% ... |
clear, clc
% max
% find
% min
% sort(columns) and sortrows
% length
% sum
% mean
% prod
% any
% all
format shortG
grades = [3 6.3 7.5 6.2 8.4
6 8.2 5.7 6.5 6.8
8 6 6.1 8.5 8.6
11 7.8 9.4 7.4 7.4
21 8.2 6.4 8 7.2
25 6.1 6.2 6.6 6.5]
... |
% This function is the implementation of the jacobian measurement model
% required for the update of the covariance function after incorporating
% the measurements
% Inputs:
% x(t) 3X1
% j 1X1 which landmark (map column)
% z_j 2X1
% Outputs:
% H ... |
function [ c , delta_r , delta_i ] = complexmap( r_size , i_size , r_range , i_range )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
delta_r = range( r_range ) / r_size ;
delta_i = range( i_range ) / i_size ;
r_min = min( r_range ) ;
r_max = max( r_range ) ;
re = r_min:delta_r:r_ma... |
%%% demonstration of how to use simpsal,
%%% the simple matlab implemenation of visual saliency.
%% 1. simplest possible usage : compute standard Itti-Koch Algorithm:
map1 = simpsal('lena.jpg');
%% 2. more complciated usage:
img = imread('lena.jpg');
p = default_fast_param;
p.blurRadius = 0.02; % e.g. we can c... |
function create_ribbon_singlesub_GrattonLab(sub,freedir,T1image,resolution,funcvol)
% CG: created based on csh script from Petersen Lab
% 6.2020
%#!/bin/csh
disp("START: CreateRibbon");
% #NU needs FSL and Freesufer modules loaded
% #Note that you will also need to edit your .bashrc
% #scripts to include info abo... |
function [ssfactor stats] = getSVMssfactor(data, targetNbrSamplesPerClass)
% function [ssfactor stats] = getSVMssfactor(data,
% targetNbrSamplesPerClass)
%
% getSVMfactor calculates the sub sample factor for each category in order
% to achieve a maximum of INPUT targetNbrSamplesPerClass samples per class.
%
%
% CREDIT... |
%%%% Negar Farzaneh August 2016 %%%%%%
tic
%subj={'num','startS','endS'};
subj{1}={'116','00020001','00020030'};subj{2}={'120','00020001','00020032'};
subj{3}={'121','00070001','00070031'};subj{4}={'147','00430001','00430033'};
subj{5}={'226','03460001','03460029'};subj{6}={'269','04260001','04260029'};
subj{7}={... |
hold on
% plotedit on
arr = [1, 2, 3, 4, 5];
arr2 = [2, 3, 4, 4, 4];
arr3 = [5, 3, 4, 3, 3];
plot(arr)
plot(arr2)
plot(arr3)
%% params
num_datapoints = 30;
% make opto on/opto off data
arr = cat(2, zeros(1,num_datapoints), ones(1,num_datapoints));
perm = randperm(length(arr));
opto_on = arr(perm);
%% make reaction ... |
% Contigency function
% Based on original code by Nguyen Xuan Vinh 2011
% (https://uk.mathworks.com/matlabcentral/fileexchange/33144-the-adjusted-mutual-information?requestedDomain=www.mathworks.com)
% References:
% [1] 'A Novel Approach for Automatic Number of Clusters Detection based on Consensus Clustering',
% ... |
%this function plots all IBIs from the different conditions
%for a particular case (the first one I built) see allIBIplot.m
%****remember to name your q so as to remember pixel. ex.: allIBI2060
%(i couldn't make the varname a workspace variable) xD)
%% pix1 %%
[SF1] = daRead7('/cnd0/home/borek/expt/june24/Dish3/spon... |
%HW5
%%
% Problem 1.
% 1. Write a function to generate an 8-bit image of size 1024x1024 with a random value
% of the intensity in each pixel. Call your image rand8bit.tif.
genImage('rand8bit.tif');
img = imread('rand8bit.tif');
imshow(img,[]);
% 2. Write a function that takes an integer value as input and outputs... |
function out = invweightAge(age)
% Produce a weighting coefficient for each row of data corresponding
% to the input age that is inversely proportional to the
% temporal data concentration
% Check if there is and age data
nodata=isnan(age);
i=1;
k=zeros(length(age),1);
fprintf('\n')
while i<=length(age)
if noda... |
function [buy,sell,in1,time] = Hurst_strategy_new(d1,d2,index,period1,p)
w=windmatlab;
[w_wsi_data,w_wsi_codes,w_wsi_fields,w_wsi_times,w_wsi_errorid,w_wsi_reqid]=w.wsi(index,'close',d1,d2,'BarSize=15');
if exist('w_wsi_codes')==0
msgbox('Wind链接失败','警告','信息对话框图标');
end
in = w_wsi_data;
time=w_wsi_times((period1+1... |
function [ mT ] = V2M( vT, Nx, Ny )
%V2M Converts Vector vT in Matrix mT with zeros on borders
mT = zeros( Nx+2, Ny+2 );
if length(vT) == Nx*Ny
for j = 2:Ny+1
for i = 2:Nx+1
mT(i,j) = vT(Nx*(j-2)+i-1,1);
end
end
else
error('Nx and Ny are not match to size of vT');
end
... |
function TrueFalse = Every(Array)
TrueFalse = all(Array(:));
end |
function [ SNR_final ] = SNR_values( control,total_att )
%This function returns a matrix with the simulated SNR per minute for a
%whole year. It takes a nominal ideal SNR value, adds white noise onto it
%and subtracts the total attenuation of the channel.
% INPUT: 1x1 control.AWGN_noise: value of intensit... |
function [Xfr,Yfr] = trackLine(files,xfr,yfr, varargin)
opt.savecallback = [];
opt = parsevarargin(opt,varargin,4, 'typecheck',false);
if ~isempty(opt.savecallback) && ~isa(opt.savecallback, 'function_handle')
error('savecallback must be a function handle');
end
if (nargin == 1),
xfr = [];
yfr = [];
end;
if... |
function [Caputo_Derivative] = Take_Caputo_Deriv(y,alpha,m)
% This function takes a fractional order derivative using the Caputo
% Derivative method. The inputs are as follows:
% y: the function to be evaluated
% t: the time variable
% alpha: The order of the derivative, i.e. d^(alpha)/dx^(alpha)
% t_j: The lower limit... |
function [v] = piston_kinematics(bore,stroke,con_rod,cr,starting_crank_angle,ending_crank_angle)
%engine kinematics
v_swept = (pi/4)*bore^2*stroke;
v_clearance = v_swept/(cr-1);
%crank angle
theta = linspace(starting_crank_angle,ending_crank_angle,180);
crank_length = stroke/2;
R = con_rod/crank_length;
term1 ... |
% Set_II
filedir=[]; % 设置数据文件的路径
filename='tone4.wav'; % 设置数据文件的名称
fle=[filedir filename]; % 构成路径和文件名的字符串
wlen=180; inc=90; % 分帧的帧长和帧移
overlap=wlen-inc; % 帧之间的重叠部分
T1=0.05; % 设置基音端点检测的参数
|
% addpath('libsvm-mat-2.89-3-box constraint');
% datasetType='UCI';
% labelNum=20;
% kernel='RBF';
%
% if(strcmp(datasetType,'UCI'))
% datasetName={'austra','australian','breastw','clean1','diabetes','german','haberman','heart','house','house-votes','ionosphere','isolet','liverDisorders','optdigits','vehicle','wdbc... |
function [ mask_updated, ind,killed_his, grid_his] = divider2(img,gs,percent,ind_a,killed_his, ind_init, grid_his,uti)
h=uti.imsize_before_pad(1);
w=uti.imsize_before_pad(2);
%pad the matrix with zeros
img(h+1:h+uti.pad_y,:)=0;
img(:,w+1:w+uti.pad_x)=0;
h2=uti.imsize_after_pad(1);
w2=uti.imsize_after_pad(2);
quo.y=flo... |
clear all
clc
close all
%dipole.m
%Dipole Field and Potential
%start
%Figure properties
axis([-4 4 -5 5]); axis equal;
ylabel('Electric Potential','Fontsize',18);
hold on;
%--Negative contours
cont = zeros(9,1);
cont(1) = 0.05;
step = 0.02;
for counter=1:9
cont(counter+... |
classdef CRP
% properties (Constant)
% lambda = 0.001;
% end
methods (Static)
function prob = ProbabilityNew(all, ted)
if(sum(ted,1) == 0)
prob = 1;
else
lambda = 0.05/(sum(ted,1) * all);
prob = log... |
function [x_k_new] = f_x(x_k_old,k)
x_k_new = 0.5*x_k_old+(25*x_k_old)./(1+x_k_old.^2)+8*cos(1.2*k);
end |
clear all
clc
index = 0;
ind1 = 0;
angle = 0;
b = 0;
a = 0;
eee=[];n1=10;
vidIn = VideoReader('C:\Users\lab E211\Desktop\starTexture.mp4');
endOfFrame = vidIn.NumberOfFrame();
for bil=20:30
index=index+1;
mov1 = read(vidIn, bil);
mov2 = read(vidIn, bil+1);
im1 =rgb2gray(mov1);
im1... |
function [arrive_time,speed_seq,fuel,DG] = ShipFuel_ShortestPath(Dis,Time_min,Time_max,Parking_time,Service_time,Speed_constrain,discrete_gap)
%--------------------------------------------------------------------------
% Calculate the optimal speed, arrival time, and fuel consumption by given
% shipping sequence, time... |
function y = groundModel(x)
% y = groundModel(x)
%
% Returns the height y of the ground at a horizontal position x
%
y = sin(0.2*x) + 0.2*cos(0.1*x).*sin(x) +0.4*cos(0.3*x);
end |
function loglike = PSTRateUntangle(pvar)
global gTRange gSpikes gNRpts gNExp gVarLoc gPFix gFixLoc gNParms gRateFunc gIntRateFunc
dims = [gNParms gNExp];
p = untangle(pvar,gVarLoc,dims)+untangle(gPFix,gFixLoc,dims);
loglike = 0;
for i = 1:gNExp
loglike = loglike - PSTRateLL(gSpikes{i},gTRange(:,i),p(:,i),gNRpts(i),gRa... |
#calc transmit probabilities
# PROBLEM: a radio system with nodes A,B transmits
# n number of packets from A to B. What is the probability
# at least on packet to travel successfully from A to B?
# ANSWER: the success rate is the one calculated
# y: probability of at least one packet success
# p: probability of packet ... |
function [frekans]=frek(nota,oktav,oktavdegeri) %frekans olusturduk
notalar={'Do','Dod','Re','Mib','Mi','Fa','Fad','Sol','Sold','La','Sib','Si','Sus'}; %notalardan olusan bir dizi
n=strcmp(notalar,nota);
m=find(n,1);%n deki 1 değerini buluyor.
if (nargin==0)%... |
clc
clear all
fprintf('Simple Fixed-Point Iteration\n\n');
Xi = input('input initial point ');
tol = input('tolerance = ?');
while(1)
if(abs(pfun(Xi)) < 1)
Xu = fun(Xi);
if(abs(Xu-Xi) < tol)
root = Xu
break;
else
Xi = Xu;
end
else
... |
function pref = get_preference_proportion(obj, within, outcome_subsets)
% GET_PREFERENCE_PROPORTION -- Calculate the proportion of outcomes
% within a given specificity.
%
% dsp2.analysis.behavior.get_preference_proportion( obj, 'days' )
% calculates, for each day in 'days', the proportion of self choice... |
function [ tanstruct_1_out, tanstruct_2_out ] = combine_ace_profiles( tanstruct_1_in, tanstruct_2_in, altitude_or_pressure, limits )
%A function to merge data by occultation. The data from tanstruct_2 is
%added to tanstruct_1 where there is are NaNs in tanstruct_1, or according
%to the provided limits. It is assumed th... |
clear;clc;
tic
%GUINEA
beta1 = 1.0e-06;
beta2 = 2.0e-07;
beta3 = 1.0e-08;
gamma2 = 1/30;
psi = 1/2;
IG = [beta1; beta2 ; beta3; gamma2; psi];
options = optimset('MaxFunEvals', 400*length(IG), 'TolFun',1e-6,'TolX',1e-6);
k_val=fminsearch(@seir_parameter_fit,IG,options);
toc
%%
figure
GraphIt(k_val) |
function [I,FocusInfo] = SplitND2Stack(Channels,Res,RawImage,f,FocusInfo)
Slices = (length(RawImage{1,1})/Channels);
for i = 1:Slices
ChannelPlanes(i).Ch1 = 1+(Channels*i-Channels);
I.Ch1(:,:,i) = RawImage{1,1}{ChannelPlanes(i).Ch1,1};
FocusInfo(f).IntDenPerPlane(i,1) = sum(sum(I.Ch1(:,:,i)));
... |
% top level file for clustered symbolic regression
% input:
% unclustered input-output data - u_n , y_n
% the number of subfunctions - K
% output:
% behavior for each mode - f_k (u_n)
% variance for each mode - sigma^2_k, var_k
function [f,var_train] = runEM(obj)
% making sure we don't run the EM algorithm w... |
% Name: Zheng Wen
% USC ID: 7112807212
% USC Email: zwen1423@usc.edu
% Submission Date 3/19/2020
function res = raw22D(raw, m, n)
res = zeros(m,n);
k=1;
for j=1:n
for i=1:m
res(i,j) = raw(k);
k = k+1;
end
end
res = matTranspose(res);
end
|
function track = loadTrack(trackName,N,isClosed)
load(trackName,'x','y','w');
l = length(x);
if iscolumn(x); x = x'; end
if iscolumn(y); y = y'; end
if exist('w') && iscolumn(w); w = w';
elseif ~exist('w')
width = 3
w = linspace(width,width,l);
end
if isCl... |
function outputData = ifftc(inputData, dimensionIndex)
% Perform centered fft along dimension specified by dimensionIndex
if nargin < 2
dimensionIndex = 2;
end
sizeAlongDimension = size(inputData, dimensionIndex);
scaleFactor = sqrt(sizeAlongDimension);
shiftedData = ifftshift(inputData, dimensionIndex);
transforme... |
/*
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "lice... |
syms theta1 theta2 theta3 theta4
l1 = 4; l2 =4; l3 = 4;
T04 = [[ cos(theta1)*cos(theta2)*(cos(theta3)*cos(theta4) - sin(theta3)*sin(theta4)) - cos(theta1)*sin(theta2)*(cos(theta3)*sin(theta4) + cos(theta4)*sin(theta3)), - cos(theta1)*cos(theta2)*(cos(theta3)*sin(theta4) + cos(theta4)*sin(theta3)) - cos(theta1)*sin(th... |
% Signals to be sent to actuator for measurements with accelerometer arrays
% on both sides of the hand
% Protocol listed - https://docs.google.com/spreadsheets/d/1EzjZjUhMcyXwryn78g4z3Mp9YM-0Z_duSRy-Gow-oKY/edit#gid=0
% Written by Bharat Dandu - 10/31/19
%% % Signal Design, link to MOTU
% To correctly set up Motu c... |
function grInit()
global figlist;
% ---------------------------------------------
if (~isempty(figlist) & ~figlist.deleted)
currentList = get(figlist.list, 'String');
set(1,'HandleVisibility','on');
for fig = 1:(1+size(currentList,1))
delete(fig);
end;
end;
% -----------------------------... |
% FigureHandler Demo script
close all;clear all
% create two figure handler objects
% this one will contain figures with default properties/formatting
these_figs=FigureHandler;
% this one will contain figures for a presentation with slighly nicer
% formatting: a white background, out-facing tick marks.
other_figs=Figu... |
function X = TensorProduct(Tensor,U,d)
ndim0 = size(Tensor);
ndim0(d) = size(U,1);
X = shiftdim(Tensor,d-1);
ndim = size(X);
X = reshape(X,size(X,1),prod(size(X))/size(X,1));
X = U*X;
X = reshape(X,[size(X,1) ndim(2:end)]);
X = shiftdim(X,ndims(Tensor)-(d-1));
X = reshape(X,ndim0); |
%error tolerance
epsilon = 0.01;
%stock transition states;
stock_states = 0:2;
%possible weights
weights = -1:1;
%possible actions
actions = -2:2;
%discount rate
lambda=0.95;
%Cost of transaction
Cost = 0.003;
%Vector of expected returns with entries corresponding to 1+stock_states
e_return = [-0.01,0.0001... |
function h = circle(varargin)
% function circle(cx,cy, r, linespec, opts...)
% or h = circle(ax,cx,cy, r,...)
%
% Plots a circle at cx,cy with radius r.
%
% Options:
% 'nsegments' - Number of segments. Default = 32.
%
% Also can take any options that plot takes.
%
% Mercurial revision hash: $Revision$ $Date$
% Cop... |
function t = addPercentGaussianNoise(t, percent)
%
%this function adds gaussian noise to all distance estimates in a test
%Suite. The argument indicates what percent of the range value should be
%noise. This value is used as the sigma^2 for a gaussian noise generator.
for i=1:length(t)
t(i).kd(t(i).conn... |
function returnBehaviorPlot( Z_C1, d)
context = Z_C1(:,9);
dC = diff(context);
SwitchTrial = find(dC~=0); % switch occurs after this trial
if length(SwitchTrial) == 1
RangeC1 = 1:SwitchTrial;
RangeC2 = SwitchTrial+1:size(Z_C1,1);
Z_context1 = Z_C1(RangeC1,:);
Z_context2 = Z_C1(RangeC2,:);
... |
function writer(data, name)
file_name = append(name, '.csv');
writecell(data, file_name); |
% operation_name = {'BoxRange', 'CircleRange', 'KNN', 'Index Creating time', 'DistanceJoin', 'KNNJoin'};
operation_name = {'DistanceJoin'; 'kNNJoin'};
legend_name = {'Simba', 'GeoSpark'};
legend_name2 = {'SpatialSpark', 'SpatialHadoop'};
legend_name3 = {'Hadoop GIS', 'VKJHadoop'};
%executing_time = [3.20360 2.08237 0;... |
function y3=get_Y(x,y,x3)
%用法:y3=get_Y([x1,x2],[y1,y2],x3)
%(x1,y1)为一个点
%(x2,y2)为一个点
%本程序作用,求过上述两点的直线在x3处的值
if nargin<3
disp('输入参数不够,请输入(x,y,x3)')
return
end
p=polyfit([x(1) x(2)],[y(1) y(2)],1);
y3=p(1)*x3+p(2); |
function plot_dervs(xdot, xdot_cap, N, p, T)
if p == 1
profile = 'linear';
else
profile = 'exponential';
end
[~,tt] = fourierdiff(N);
tt = T*tt/(2*pi);
% plot derivatives
subplot(321)
plot(tt, xdot(1:N), 'r')
hold on
plot(tt, xdot_cap(1:N), '--ob')
ylabel('$V$... |
function [k_index,t_max_index] = Mean_k(VehicleList,index)
%UNTITLED3 此处显示有关此函数的摘要
setting;
t_res_index = (RoadLength - VehicleList(1,index))/(VehicleList(3,index)/3.6);
t_max_index = min(t_res_index,VehicleList(7,index));
syms t;
d = sqrt(d_r^2 + (RoadLength/2 - VehicleList(1,index) - VehicleList(3,index)/3.6*t)^2)... |
function NoiseLevels(toffset)
% NoiseLevels(toffset)
% Compute rms noise & power spectra for multichannel records
% toffset is the time offset to move into the file (default 0)
[file,path] = uigetfile('*.bin','Select raw data file');
tmax = 2; % Time in seconds to load
if (nargin == 0)
toffset = 0;
end
[d,h] = load64... |
function tau = studentController(t, s, model, params)
% Modify this code to calculate the joint torques
% t - time
% s - state of the robot
% model - struct containing robot properties
% params - user defined parameters in studentParams.m
% tau - 10x1 vector of joint torques
% State vector components ID
q =... |
function frf = frequencyresponse(matrix,fs,fmax,opt)
%frequencyresponse produce in output le 3 funzioni di risposta in frequenza
% relative alle 6 accelerazioni. timetable è la timetable delle
% accelerazioni, fs è la frequenza di campionamento.
a=matrix;
a1=rmmissing((a(:,1)));
a2=rmmissing((a(:,2)));
a3=rmmissing((a(... |
function Main(input_file_name,output_file_name,WITH_MISMATCH)
if nargin<3
WITH_MISMATCH = 0;
end
NUM_BASES_ADDED = 19;
T = readtable(input_file_name);
all_fasta_seq = T.fasta;
[unique_fasta_seq, i_all_fasta, i_unique_fasta] = unique(all_fasta_seq);
[homologies,mismatch_amount] = find_homologies(uni... |
% Lagrange animation by Scott
%clear all; close all;
mu = 0.012;
x1 = -mu;
x2 = 1-mu;
deltaAlpha = -0.008;
startAlpha = 2;
endAlpha = 1.49;
nElem = 50; % larger values give more accuracy but slow down simulation
cutOffEnergyLevel = 15;
del = 0.05;
% start computation
startX=-1.2; endX=1.2;
totalLengthX = 2*endX;
... |
% Author: Travis Aubrey
% Red ID: 814041534
% Date: 12/18/2017
% Course: CompE470L
% Assignment: Final Project
%Aknowledgement: Image RGB extraction to 8bit hexa from here https://www.instructables.com/id/Image-from-FPGA-to-VGA/
% Coe file creation credit goes to this video: https://www.youtube.c... |
classdef no_grid < neighbourhood.neighbourhood
properties
end
methods
function obj = no_grid(varargin)
obj@neighbourhood.neighbourhood(varargin{:});
obj.label = 'no';
end
function na = neigh_avg(obj, state)
na = 0;
end... |
clearvars
close all
clc
n = input("Podaj liczbe iteracji: "); %wczytanie liczby iteracji od użytkownika
A = (1:1:n);
A = (A.^2)*4; %tablica iloczynu par w liczniku
B = A-1; %tablica iloczynu par w mianowniku (zawsze jest o 1 mniejsza od odpowiadajacej pary w liczniku)
C = A./B;
C = prod(C)*2;
%%działania... |
function [check]=checkerboard2(gray)
mat=[255 255 0 0;255 255 0 0;0 0 255 255;0 0 255 255];
gray_row=ones(16,256)*gray;
check_row=repmat(mat,4,64);
cg_row=[check_row;gray_row];
check=repmat(cg_row,8,1);
check=uint8(check);
end |
function showNdMouseMotion(hFig,evnt,hText,hRect,dims,dist,complexmode,tilemode_or_ncols,mmfun,data)
axlist = findobj(hFig,'Type','axes');
dcm=datacursormode(gcf); % are we in Data Cursor mode?
for ax = axlist'
dims = getappdata(ax,'showNd_slicedims');
if isempty(dims)
continue % probably colorbar axes
en... |
% Function that selects the best threshold level for the image set given.
% The best threshold is said to be the one that minimises bad blobs
% detections.
function thresholdLevel = getThreshold(images)
% Looking at histograms of the images we see that few pixels have values
% less than 100. We try to place the thres... |
function mousemotion(obj, eventdata)
% disp(obj);
%figurePosition = obj.Position;
p = get(gca, 'currentpoint');
cpoint = p(1,1:2);
lines = get(gca,'children');
X = [];
Y = [];
for i = 1:length(lines)
try
Xtemp = get(lines(i), 'XData');
Ytemp = ge... |
PlotWindowSize = [1400,600]; % plot window size in pixels
figure('Position',[10 10 PlotWindowSize(1) PlotWindowSize(2)])
N=[]; X=[]; Y=[]; x=10^-2; % initialize variables
while x < 10^8, % repeat for values of x start : increment : end
s = i*x; % get the j-omega
% ***************** THE EQUATION: ***********************... |
function [hobj,h] = PlotHybridHdcaClassifier(fwdModel, v, chanlocs, vtimes_ms)
% Plot scalp maps and temporal weights from hybrid classifier output.
%
% PlotHybridHdcaClassifier(fwdModels, v, chanlocs, vtimes_ms)
%
% NOTE: This function is made to work with the output of
% RunHybridHdcaClassifier and plot the mean acr... |
function classLabel = naive_bayes_classifier( x,mean1,mean2,mean8,mean15,mean20,var1,var2,var8,var15,var20 )
%NAIVE_BAYES_CLASSIFIER Summary of this function goes here
% Detailed explanation goes here
%cov1 = diagonalize(cov1) ;
%cov2 = diagonalize(cov2) ;
%cov8 = diagonalize(cov8) ;
%cov15 = diagonalize(cov15) ;
... |
function marginal_logliks = compute_marginal_log_likelihood_under_PK_model(DCE_MRI_Struct, voxel_idx, PK_Params_Prior, PK_Params_Proposal_Dstr, ...
AIF_Struct, Voxel_T10_Priors, Noise_Prior, Options)
marginal_logliks = [];
% Compute the MR enhancement log likelihood condition... |
function PlotBundledRast(stim,spike,ylabels,toff)
% PlotBundledRast: raster plots with multiple panels
% PlotBundledRast(stim,spike,ylabels)
% stim & spike are of the format CollectResponses/UnifyResponses
% ylabels (optional) is a cell array of bundle names
% toff (optional) is the time offset (measured in seconds)
%... |
function [Y_kg,W_mm,Y_d, W_d, Net] = yield(ET,Precipitation,corn_price,water_price,policy)
[WCL,Irrigation,ET_simu,S,runoff] = getWaterTable(policy,ET,Precipitation);
Y_kg = myNeuralNetworkFunction(WCL)
W_mm = -sum(Irrigation)
Y_d = myNeuralNetworkFunction(WCL)*corn_price
W_d = -sum(Irrigation)*water_pric... |
function transitionMatrix = computetransitionmatrix(costMatrix, pheromoneMatrix, alpha, beta)
%
% Function:
% - computetransitionmatrix: Calculates the probabilities of transition between
% different cities
%
% Inputs:
% - costMatrix: Cost matrix calculated as 1/distanceMatrix (nCitiesxnCities
% double)
% – pheromoneMa... |
clc
clear
% add liblinear path for dynamic images generation
addpath(genpath('E:\NTU RGBD\test_ntu\liblinear-1.96'));
% the human skeletons data path
path_sk = 'E:\NTU RGBD\nturgb+d_skeletons';
S = dir('E:\NTU RGBD\data_depth_w\n*');
for i = 1:length(S) % 遍历读取所有场景下的数据集(s001-s017)
temp = ['E:\NTU RGBD\data_... |
% EDIT TEST
% ???
function [percent, dollar, kCal] = Food_Waste(mat)
% FLoss, or Food Loss, describes the percentage of food produced in certain
% categories that is lost during the production, harvesting, processing,
% distribution, and consumption of that resource.
FLoss = [[0.0200 0.0200 0.0500 ... |
%% 读取文件
%% 读取交通数据流文件
load(filename);
newdata = zeros(800,288); %每一行存的是某一天的某个检测器的所有数据,共288个;先存的是第一天,第1到第50个,最后存的是第16天,第1到第50个
k = 1;
for i=1:16
for j=1:50
newdata(k,:) = flow_50link(:,i,j)';
k = k+1;
end
end |
clear; clc; close all;
%% try dh = 0.1, n= 1e-3
dh =1e1; % > 0
% d0 = dh/2; %in[0,dh]
d = dh/2;
n = 1e-6; % in [0,1/4)
iter = 10;
x = zeros(1,2);
x(1,:) = [-8,-8];
puregrad = zeros(1,2);
puregrad(1,:)= [-8,-8];
for k = 1:iter
pk = doglegPk(d(k),x(k,:));
pk_eval = (f(x(k,:))-f(x(k,:)+pk'))/(quad_m(x... |
clc;
clear all;
close all;
place = [ ...
'Arvida '; ...
'Bagottville'; ...
'Calgary '; ...
'Charlottown'; ...
'Churchill '; ...
'Dawson '; ...
'Edmonton '; ...
'Fredericton'; ...
'Halifax '; ...
'Inuvik '; ...
'Iqaluit '; ...
'Kamloops '; ...
... |
function [x,y,z,w,h,q,l,p,si_mixed,th]=hfo_specs_hpc(si,timeasleep,print_hist,fn)
if ~isempty(si)
%Instantaneous frequency.
x=cellfun(@(equis) mean(instfreq(equis,fn)) ,si,'UniformOutput',false);
x=cell2mat(x);
if print_hist==1
subplot(3,2,1)
xlim([100 250])... |
subplot(2,1,1)
N = 50;
n = 0:1:N-1;
x = sin(0.1*pi*n);
[X, w] = DTFTsamples(x);
plot(w, abs(X))
title('mag(DTFTsamples(x)), N = 50')
xlabel('w')
ylabel('mag(DTFT(x))')
subplot(2,1,2)
N = 200;
n = 0:1:N-1;
x = sin(0.1*pi*n);
[X, w] = DTFTsamples(x);
plot(w, abs(X))
title('mag(DTFTsamples(x)), N = 200')
xlabel('w')
ylab... |
function model = glucoseProblems(model)
glucose_probsRXNs = {'K00001', 'R03162'};
model = removeRxns(model, glucose_probsRXNs); |
function [err] = Plot_Err(min_k, max_k, X, A)
% Dec 8 2015
% This matlab code implements the figure of reconstruction err and k
%
% Min_k - The point the figure start from (required input)
% Max_k - The point where the figure stop (required input)
%[~, m] = sixe(A);
err = zeros(1,max_k-min_k+1);
for index_k = min_... |
%----------------------------------------------------------------------
% StreamFun.m
%
% computes mass streamfunction (psi_3, psi_crm_3) for 25km and 2km data
%
% psi depends on: w,u,sphum,temp, and pfull
%
% psi is computed as: psi(rho,w,u)=dx*rho(i,j)*w_ztmn(i,j)+u_bc_p;
%
% The density rho is computed with the vir... |
function [A, R, varargout] = AutoRegressiveModel( X, M, varargin )
%CoMpute Autoregressive Model with Order M
%
% [A,R] = AutoRegressiveModel(X,M);
% Output:
% A - AR Model Coefficients
% R - Cross-Covariance Matrix
% Input:
% X - Input Signal with size P x N. P is the number... |
function Molecules = GetOrientation(candidate, lat, numSites, Operation, MtypeLIST, nsym, P, PB)
global ORG_STRUC
Molecules=struct('MOLCOORS',{},'ZMATRIX',{},'ID',{},'MOLCENTER',{},'order',{},'Operation',{},'P',{},'PB',{});
Molecules=[];
STDMOL = ORG_STRUC.STDMOL;
%Molecules(1).MOLCOORS=STDMOL(MtypeLIST(1)).molecule;
... |
function output = my_operator(input_image)
%in this function, you should finish the operator recognition task.
%the input parameter is a matrix of an image which contains an operator.
%the output parameter represents which operator it is.
% = £º0.5714
% + £º0.2504
% - £º0.9962
img = input_image;
img = clear_boundary... |
clear all
close all
clc
%% Ejercicio 12
% Calcular la factorizacion LU de una matriz A
A = floor(100*randn(47));
%% Hacemos una prueba
[L, U, tiempo, Err] = fact_lu2(A);
% Comprobamos el nivel de error
E = A - L*U;
max(max(abs(E))), tiempo, Err
%% Hacemos una prueba con pivotaje
[P, L, U, tiempo, Err] = fact_lu_piv... |
function P = precomputePolyshapes(annot)
param = config();
if ~exist('annot','var') || isempty(annot)
% Load default annotations defined in config
annot = load(param.general.annotations);
annot = annot.ANNOT;
end
id = [annot.annotations.id];
seg = {annot.annotations.segmentation};
clear annot;
numSigns ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.