text stringlengths 8 6.12M |
|---|
clear all
clc
function roots(z,n,k)
r = abs(z);
theta = arg(z);
w_k = r**(1/n)*(cos((theta + 2*k*pi)/n) + i*sin((theta + 2*k*pi)/n))
end
roots(1+i,4,0)
roots(1+i,4,1)
roots(1+i,4,2)
roots(1+i,4,3) |
function [herm] = hermiteExpansion(k)
% Return the Hermite expansion
syms z;
tempH{1} = sym('1');
for n=2:k
tempH{n}=simplify(z*tempH{n-1}-diff(tempH{n-1},z));
end
herm=tempH{k};
end
|
function [AUC, collection] = ROC_curve(score, Y, step, status)
% Input:
% score: Prediction score from predictive models
% Y: ground truth, have to be binary (0 or 1)
% step: to control the precision
% status: True: draw the ROC plot, False: don't draw the plot
% Return:
% AUC: AUC value
% collection: the first row are... |
% XXXXXXXXXXXXXXXXXXXXXXXXXXXX htet_test_bank_classification_safin_frie_with_feature_select XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
%
% Author : Htet
% Date : Sep 11, 2019
% File : used to test bank failure prediction/classification using SaFIN_FRIE with HFS
% Running Data Set 1A, 9 features, will t... |
function [V,exRegion, M, exV, Vcheck] = HMdynamicFD(X,s0,gamma,kappa,c,F,R,G,b)%,T,n,m)
% Price an american option via crank nicolson finite differences
%
% Inputs:
%
% X initial belief hat{theta}_0 (starting point of brownian motion)
% s0 Initial variance
% gamma risk aversion
% kappa we... |
function d = GetOnOff(obj)
% query instrument output status
% Copyright 2015 Yulin Wu, Institute of Physics, Chinese Academy of Sciences
% mail4ywu@gmail.com/mail4ywu@icloud.com
TYP = lower(obj.drivertype);
switch TYP
case {'agle82xx','agle8200','agl e82xx','agl e8200',...
'rohde&s... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Speech prject I
%% Start/End Voiced/Unvoiced Speech Detection on test wave form H.1.wav
%% Pitch detection on test waveform H.1.wav
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Intialization and setting of training d... |
clc;clear all;close all;
path = '/home/yaoshw/CLionProjects/xunyu/wltof-EPC-V0.9.0-R1-Linux-20191015/data';
c = newline;
for i = 135
pointcloud = importdata([path '/' num2str(i) '_pointcloud.txt' c]);
pointlength = sqrt(sum(pointcloud.*pointcloud,2));
pointlength(pointlength>8)=8;
pointplain = reshape... |
%#eml
function [uv] = JojoUnitVector(v)
uv = v/JojoVectabs(v); |
% code (release version) of the Label Propagation Saliency published
% in the IEEE Transactions on Image Processing, 2015.
% Any bugs are welcome!
clc;
close all; clear;
addpath('./utility');
addpath('./feature_affmat');
addpath('./lps');
addpath('./objectness_release_v2.3');
global para row col dim superpixels spnum ... |
% check Kuhn length.
clear
clc
tic;
BeadNumber=1000;
BeadSize=0.01;
%KA=5.5;
KA=5.5;
Nt=1e3;%10^4;
X=zeros(Nt,BeadNumber); %every row represent one chain
Y=zeros(Nt,BeadNumber);
Z=zeros(Nt,BeadNumber);
i=0;
gyration=0;
for nt=1:Nt
% randx=2*rand(1,15*BeadNumber)-1;
% randy=rand(1,15*BeadNumber);
% ... |
server = tcpip('0.0.0.0', 3000, 'NetWorkRole', 'server')
fopen(server)
i = 1
while 1
if server.BytesAvailable > 0
data = fread(server, 1, 'double');
signal(i) = data;
end
i = i + 1;
if (i > 441)
break
end
end
server = tcpip('0.0.0.0', 3000, 'NetWorkRole', 'server')
fopen(se... |
%%%%%%%%%%%%%%%%%%%%%
% Naoki Tominaga & Daniel Webber
% u0876779 u0838328
% ME EN 1010 Lab Section #5
% HW#7 and find_all_target_centroids.m
% 3/27/15
% find_all_target_centroids finds the centroids of a certain color in a
% image array
% inputs - picture (image array)
% - targets (target color)
% outputs - ro... |
function [ encoding ] = one_of_n_encoding(boards)
% From an two dimensional array of flattened boards (using twos to
% represent opponent blocks) this function creates a one-of-N encoding
encoding = [];
for i = 1:size(boards,1)
line = [];
for j = 1:size(boards,2)
if (boards... |
classdef XmeasController < AttackController
%XMEASCONTROLLER Summary of this class goes here
% Detailed explanation goes here
methods
function this = XmeasController(block)
this = this@AttackController('xmeas', block);
end
% conversion method
funct... |
do_gauss = 1;
load([ncfloc, 'Coverage/Stationary_LKCs/meanLKCs_DG_',num2str(do_gauss)], ...
'LKCs_forman_mean', 'LKCs_forman_std', 'LKCs_kiebel_mean', 'LKCs_kiebel_std', ...
'LKCs_nonstat_mean', 'LKCs_nonstat_std')
nsubj_vec = [10,20,50];
FWHM_vec = 2:5;
for I... |
function [vec, pInt] = simulateDomsetBees(N,varargin)
%% initialize
global casu_pos
numvarargs = length(varargin);
if numvarargs > 3
error('simulateDomset requires at most 2 optional inputs');
end
optargs = {200 1};
optargs(1:numvarargs) = varargin;
[n, rho] = optargs{:};
k = 50;
T = 28 * ones(size(N));
pBuff =... |
function ARDL = ARDLmodel(ENDO,nlag,const,EXOG,nlag_ex)
% =======================================================================
% Estimate ARDL models with OLS
% =======================================================================
% ARDL = ARDLmodel(ENDO,nlag,const,EXOG,nlag_ex)
% ---------------------------... |
clear
%function H=buildHes(lpar, dpar, dper, gpar, gper, Dpar, Dper, lambdapar, lambdaper, B, E, del, MUb)
lpar=0.1;
dpar=0;%0.000006;
dper=0;%0.000006;
gpar=2.01;
gper=2.01;
Dpar=1.42;
Dper=1.52;%1.52/2;
lambdapar=5.3;
lambdaper=0.2;%0.2/sqrt(2);
MUb=13.996;
Bdir=[1;1;1];
E=[0;0;0];
del=[0;0;0];
%these should be norma... |
v=0.001286;
vy=0.1569;
h=0.001426;
hy=0.6225;
d=0.001616;
dy=0.4257;
Ev=1798.2
Eh=6190.8
Ed=2740.6
data1=load (['C:\Users\probook\Desktop\Datos_papel\papel_vertical_2.txt']);
data2=load (['C:\Users\probook\Desktop\Datos_papel\papel_horizontal_1.txt']);
data3=load (['C:\Users\probook\Desktop\Datos_papel\papel_diagonal_... |
%% Classify SVM
SubjectID = 1;
avgFeaturesPerSubject = dimensionReductionAverage(featureData);
features = squeeze(avgFeaturesPerSubject(SubjectID,:,:));
labels = getLabels(deapData);
labels = squeeze(labels(SubjectID,:,:));
%% Normalize
temp = bsxfun(@minus,features,mean(features));
norm_features = bsxfun(@rdivide,t... |
function [ind, matched_list, missing, missingInd] = match(list1, list2, verbose)
% useful if you have 2 list that you want to compare but they are not in the same
% order. ind return the position of elements in list1 in list2.
% list2(ind) = list1
if ~exist('verbose', 'var')
verbose = 0;
end
ind = [];
for i... |
function predicted = trueDistance710S2(data)
% Distances from AP to RP's in July 10th S1 walk
values = [ 9.433981132
8.544003745
8.062257748
8.062257748
8.544003745
9.433981132
10.63014581
12.04... |
function generate_coil_axi()
wire_dia_m = 0.0641 * 0.0254;
coil_inner_r_m = 1.5 / 2 * 0.0254;
n = 400;
A = n * 1/0.9 * pi * (wire_dia_m / 2)^2;
bundle_r_m = sqrt(A / pi);
coil_center_r_m = coil_inner_r_m + bundle_r_m;
I_A = 22.28;
model_file = 'helmholtz_coil_axi.fem';
openfemm;
newdocument(0);
freq = 0;
units =... |
function [ ] = AnalyzeAll( input )
%ANALYZEALL processes all folders containing images. This has to be
%set in here.
% Folder: ../Samples/
%
%
% Changelog:
% - [28.02.11] changed 'header = cell(1,maxlen);' maxlen to '1'
% - [14.02.11] added amount, as an indicator for image num... |
function [w] = hanningz(N)
% This function calculates a modified hanning windowing function
% such that hanningz(N) = [k_0 = 0, k_1, k_2, ..., k_n-1 = k1]
%
% The first sample must be zero, and must end with a non-zero value
% that matches the second sample.
%
% See Bernardini Paper: "Traditional Implementations of a ... |
function [bb, aa] = Exponential_Avg_Filter(Tc, fs, fig_num, limiter, N)
% [bb, aa] = Exponential_Avg_Filter(Tc, fs, fig_num, limiter, N)
% Inputs:
% Tc = Time constant
% fs = Sampling rate
% fig_num = figure num for tested filter if needed
% limiter = xlim for plotting
% N = number of points for the system
% Ou... |
function BetaMat = BetaEvalFD(svec, tvec, bHat, M, tn, lambda, eleNodes, Si, Ti, ...
B, lag, DomainType)
%BetaCalFD.m evaluates a regression function at all pairs of the values
% in SVEC and TVEC.
% Pairs not within the domain of definition are set to NaN.
%
% Inputs :
%
% SVEC : ... |
%% Air-Fuel Ratio Control System with Stateflow Charts
% Generate code for an air-fuel ratio
% control system designed with Simulink(R) and Stateflow(R).
% Copyright 1994-2016 The MathWorks, Inc.
%%
% Figures 1, 2, and 3 show relevant portions of the sldemo_fuelsys model, a
% closed-loop system containing a plant a... |
clear;clc;
load('/brain/iCAN/home/zhuangliping/RR/RR_NETdata/RR_NETdata.mat');%load NETdata
num_sub=50;num_rois=15;num_runs=8;
feature_run=num_rois*num_rois;
score_behav=(score_RR(:,5)-score_RR(:,6))-(score_RR(:,2)-score_RR(:,3));%1isD1NR;2isD1R;3isD1B;4isD2NR;5isD2R;6isD2B;
w_feature=cell(1);
thr=[0.01:0.01:0.... |
% FuseSingleFirstDiffFilter.m
% This filter searches an ROI for the largest first difference and then
% uses that point to allign the data across all scans. This works well
% when there is a single rising edge that appears through the entire
% dataset and the path of the UAV is nearly linear. Curbs on the edges of
... |
function [coefs,varargout] = cwtext(SIG,scales,WAV,varargin)
%CWTEXT Real or Complex Continuous 1-D wavelet coefficients using
% extension parameters.
% COEFS = CWTEXT(S,SCALES,'wname') computes the continuous
% wavelet coefficients of the vector S at real, positive
% SCALES, using wavelet whose name is 'wn... |
%% function TakeDerivativeOfReference
Numframes = size(val_ref,1);
fnum = 5;
val_diff2 = zeros(Numframes-1,4);
for i = 1:Numframes-1
if i == 1
val_diff2(i,:) = (val_ref(i+1,:) -[0,0,1,0]) .* (2 *vidObj.FrameRate);
else
val_diff2(i,:) = (val_ref(i+1,:) - val_ref(i-1,:)... |
classdef candlesResCommRx
%CANDLESRESCOMMRX Maintain & display communs results for a set of rxs.
% A candlesResComm object stores communication results for a CandLES
% environment and provides function calls to display the results.
%% Class Properties
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
clear;clc;close all;
start_strike;
start_football;
start_livejournal;
fprintf('\n\n所有实验运行结束。\n'); |
% Computational Economics
% PS1 - Q2 Determine the output gap
clear, clc
%import data
[data,txt] = xlsread('data/OECD-Germany_Greece_GDP_Linux.xls');
%% 2.1
logGDP_Germany = log(data(1,:))';
logGDP_Greece = log(data(2,:))';
%% 2.2
trend_Germany = hpfilter(logGDP_Germany,1600);
trend_Greece = hpfilter(logGDP_Greece... |
function powerAC = modelInverterSL( powerDC, voltageDC, modelCoeff )
%MODEL_INVERTER_SL Santos-Lemon simplified inverter model
powerAC = modelCoeff.a.*powerDC.^2 + modelCoeff.b.*powerDC + modelCoeff.c.*voltageDC;
end
|
function QP = updateMatrices1Step(QP,Forecast,scaleCost,marginal,StorPower,dt,IC,FirstProfile,limit,t,T)
% update the equalities with the correct demand, and scale fuel and electric costs
% EC is the expected end condition at this time stamp (can be empty)
% StorPower is the expected output/input of any energy storage ... |
%% BME790.01F13:Worksheet 4 Kanishk Asthana ka112@duke.edu
function [tnew] = flipshift(x,t,scale,shift)
%flipshift: A function to arbitarily flip and shift a mathematical function
%x(t)
% Suppose we already have a function of time x(t) as a vector and the
% original time vector t; and we need a shifted and scaled func... |
function [row, colNum] = findMostSignificantColunm(matrix)
%search for the column has the most 1's and
%return the column number and the rows.
[M, N] = size(matrix);
y = zeros(M, 1);
x = 0;
for i = 1 : N
temp1 = find(matrix(:, i) == true);
if length(temp1) >= x
x = length(t... |
function m_FFe = f_FF_tria_t1(e_DatElemSet,e_VG)
ndn = e_VG.ndn;
struhyp = e_VG.struhyp;
dofpe = e_DatElemSet.dofpe;
nPG = e_DatElemSet.npg;
xg = e_DatElemSet.xg;
% Funciones de forma
E = xg(:,1);
n = xg(:,2);
N1 = 1-n-E;
N2 = E;
N3 = n;
m_FFe = zeros(ndn,d... |
function [thickness, theta_perp, is_cross] = find_branch_thickness(pixel_indices, image_intensity, varargin)
% Function to find the branch radius and perpendicular angle at given
% positions in an image.
% Input
% pixel_indices = pixel indices where the thickness will be computed.
% Each row correspond... |
% GLUECK: Growth pattern Learning for Unsupervised Extraction of Cancer Kinetics
% function to visualize network data at a given iteration in runtime
function [sensory_data, datax_extrapolated] = visualize_results(sensory_data, populations, learning_params, d)
figure;
set(gcf, 'color', 'w');
% sensory data
subplot(4, 1... |
%--------------------------------------------------------------
% Global Lyapunov Stability Example
% Use SOS methods to compute a Lyapunov function that proves
% global asymptotic stability of the equilibrium point x=0.
%
% References:
% 1) P. Parrilo. Structured Semidefinite Programs and
% Semialgebraic Geo... |
close all;
clear all;
clc;
a=imread('morph2.bmp');
b=[0 1 0;1 1 1;0 1 0];
a1=imdilate(a,b);
a2=imerode(a,b);
a3=a-a2;
a4=a1-a;
a5=a1-a2;
imshow(a),title('Original image')
figure,imshow(a1),title('Dilated image')
figure,imshow(a2),title('Eroded image')
figure,imshow(a3),title('First property ')
figure,imsh... |
% Demo of adaBoost (adaptive boosting)
clear
% training data (1000 samples, 2 dimensions, can be seen as 1000 people, each people have 2 variables: weight and age)
data = randn(1000,2); % randn: generates normally distributed random numbers
label = double(data(:,1)>data(:,2)); % a linear separation example
label = do... |
%-----------------------------------------------------------
%
% Program: classifier
%
% Purpose: Classify samples into one or more classes
%
% Programmer: Rod Pickens
%
% Date: March 13, 2015
%
%-----------------------------------------------------------
close all; clear all; clc; fclose('all');
%-... |
n=6; m=2 ; N=50; INI=0.1/N;
len = 60;echo=1;
[W1,b1] = myintialize(N,m,INI);
[W2,b2] = myintialize(n,N,INI);
r = 0.001;
K = 2;B=5;
echo = 1;
for k = 1: K
WR{k} =0.01*randn(m,m);
end
WR{1} = WR{1} + eye(m);
%ADAM
beta1=0.9;
beta2=0.999;
epsilon=1e-08;
[DW1_m1,Db1_m1] = myintialize(N,m,0);
[DW2_m1,Db2_m1] = myin... |
function elStr = elementStress(X,mat,D)
% elStr = elementStress(X,mat,D)
% need to be a q9 element
% elStr 3x9
% X 2x9
% D 2x9
elStr = zeros(3,9);
e = mat(1); % mod of elasticity
v = mat(2); % poisson ratio
dp = 3;
Loc = [-1 -1;
1 -1;
1 1;
-1 1;
... |
function x = GaussPivot_SH(A,b)
% GaussPivot: Gauss elimination pivoting
% x = GaussPivot(A,b): Gauss elimination with pivoting.
% input:
% A = coefficient matrix
% b = right hand side vector
% output:
% x = solution vector
[m,n]=size(A); % obtain size of matrix A
if m~=n, error('Matrix A must be square'); en... |
%% SIR homogeneous mixing model
function dy = sir_dynamics_linear(t,y,delta)
beta = 0.5;
dy = [- beta* y(1) *y(2)* (1-y(2)); (-delta)* y(2) + beta* y(1) *y(2) * (1-y(2)) ];
|
% Cryptographie chaotique
% ***********************
%
% Calcul d'erreurs pour la superposition (Eve)
% --------------------------------------------
%% 1 - Erreur de décryptage
T_tot = (length(Crypt) - 1)*h; T_out = 0:h:T_tot; T = length(T_out);
% if Q ~= 1
% interpMessage = interp1(T_out,Message,interpT_out);
% ... |
% test_ber_consts
clc;
clear;
change_precision;
load precision.mat;
% size of the step
SIZE_STEP=1;
% SNR interval limits. In dB
INTERVAL_LIMITS=[0 30];
% quantity of points used
N_POINTS=floor(abs(INTERVAL_LIMITS(2)-INTERVAL_LIMITS(1))/SIZE_STEP);
% interval
INTERVAL=linspace(INTERVAL_LIMITS(1),INTERVAL_LIMITS(2... |
function [csiMaxVar,csiMaxMean] = Antenna_Select(inCSI,subCarrierNum)
%% Determine the links with max average amplitude and max amplitude variance
% Input:
% inCSI - Complex 2-d matrix with size of [packetNum, subcarrierNum*links]
% subcarrierNum - The number of subcarriers between a certain T-R pair
... |
function obj = objfunc(p, tspan, x_true, x0)
x0(5:7) = p(7:9)';
ODE_Sol = ode45(@(t,x) dynamics_step(t,x,p), tspan, x0);
result = deval(ODE_Sol, tspan);
obj = sum( ( (result(1:3,:) - x_true(1:3,:))'*(result(1:3,:) - x_true(1:3,:)) ));
end
|
function make_dconn_wrapper_MSC(input_data,template_path,variant_fname,CortexOnly,save_dconn,dconn_fname)
%% This function is a wrapper for the function that creates variant maps, used to provide the necessary data and filepaths for computing the spatial correlation
%
% This function requires a CIFTI timeseries (num... |
% We use standard conventions described in Nielsen and Chuang.
%
% It should be noted, that qubit indexing starts at zero i.e.
% the 0-th qubit is the most significant bit. This is counter to the
% 1-based indexing in MATLAB but it was decided that keeping the indexing
% standards of the QC community would make the qc ... |
%==========================================================================
% test_recruitment_threshold.m
% Author: Akira Nagamori
% Last update: 9/20/19
% Descriptions:
% - Find the recruitment threshold of individual MNs
% - Save the values (current_th)
%==========================================================... |
%this script plots the monitored values grouped by server and category (cpu, response time, power)
monitoring = load('monitoring.txt');
global SList;
global VList;
global VMAllocation;
nv = length(VList);
n = length(SList) + nv;
for i = 1:length(SList)
figure;
vm_server = find(cell2mat(cellfun(@(x) [x.vmLis... |
function [] = Engage_space_RIR()
global H
global XStimParams
global TDT
global FN
global C_
global M_
global GUI
%Engage_space_RIR
%*******************************************************************************
% The space_RIR Test operation
% use RIRs without earphone equalization - usually called *.st... |
function pval=wolfestest(X)
% FUNCTION pval=wolfestest(X)
%
% X(:,1) is the reference signal
%
% see D. A. Wolfe, Testing Equality of Related Correlation-Coefficients, Biometrika, vol. 63, no. 1, pp. 214215, 1976.
[n,~]=size(X);
X(:,2:3)=zscore(X(:,2:3)); % Standardize since std(X(:,2) must be equal to std(... |
function [ A,R ] = Matrix_AR( M,N,lambda,lambda0 )
%MATRIX_A Summary of this function goes here
% Detailed explanation goes here
% A: matrix A
% M: number of messages
% N: number of nodes
% lambda: symmatric matrix N*N of transition rates
% lambda0: vector of transition rate from nodes to the destination
index_ar... |
function imdb = create_imdb(params)
% The function takes params as an argument and creates a mnist imdb file,
% which it saves
%% Extracting some variables
channels = params.architecture.channels;
code_to_data = ['../', params.paths.code_to_data, 'pixelations/cifar/'];
data_to_code = ['../../', params.paths.data_to_co... |
function test_nnCostFunction_costNoReg()
epsilon = 1e-4;
% input descriptions
input_layer_size = 400; % 20x20 Input Images of Digits
hidden_layer_size = 25; % 25 hidden units
num_labels = 10; % 10 labels, from 1 to 10
m = 5000; % number of examples in training set
... |
function do_OLS(X, Y, interpolation_order, plotting)
% DO_OLS Performs an ordinary least squares estimation on a given dataset.
%
% Inputs:
% - X: Data-points to estimate with
% - Y: Data-points to estimate
% - interpolation_order: order of the estimating polynomial
% - plotting: Boolean to determine whether to pl... |
%{
psy.Trial (manual) # my newest table
-> psy.Session
trial_idx : int # trial index within sessions
---
-> psy.Condition
flip_times : mediumblob # (s) row array of flip times
last_flip_count : int unsigned # the last flip number in this trial
trial_ts = CURRENT_TIMESTAMP : timestamp # automat... |
function monxyz=mooncrd(mjd,sdt)
%
% Function mooncrd
% ================
%
% Computes the xyz coordinates of the Moon for given modified julian
% date and sideral time.
%
% Sintax
% ======
%
% monxyz=mooncrd(mjd,sdt)
%
% Input
% =====
%
% mjd -> modified julian date (decimal/inte... |
function out = isdataset(in)
%ISDATASET Test for dataset, returns true if 'in' is a dataset.
%
%I/O: out = isdataset(in);
%Copyright Eigenvector Research 2006-2008
%Licensee shall not re-compile, translate or convert "M-files" contained
% in PLS_Toolbox for use with any software other than MATLABŪ, without
% w... |
function vVol = ImarisGetVolume(nChannel,iDataSet)
%
% A 3D image is moved from Imaris to Matlab.
%
% SYNOPSIS
%
% vVol = ImarisGetVolume(nChannel,iDataSet)
%
% INPUT
%
% nChannel: channel where the image is located in Imaris. Note that
% channels start counting at 0 in Imaris
%
% ... |
%% Stelling 5
%
% Gegeven: de variabele 'signal' in onderstaande code
% bevat een aantal getallen die kleiner zijn dan nul.
%
% De lengte van vector 'signal' verandert tijdens het runnen
% van de onderstaande code niet. ... |
clear;
data = readtable('data.xlsx','ReadVariableNames' ,1,'FileType','spreadsheet');
hso = str2double(data{296:2219,2}); %296
hsc = str2double(data{296:2219,3});
zzo = str2double(data{296:2219,4});
zzc = str2double(data{296:2219,5});
o300 = str2double(data{296:2219,6}); %2
c300 = str2double(data{296:2219,7});
o500 = s... |
function League=UpdateTotalCost(League)
global SCASettings;
nTeam=SCASettings.nTeam;
SSay=SCASettings.SSay;
nMainPlayer=SCASettings.nMainPlayer;
nReservePlayer=SCASettings.nReservePlayer;
for k=1:nTeam
for jj=1:nMainPlayer
x(jj)=League(k,1).MPlayer(jj,1).Cost;
end
... |
%% Initialization
clear; close all; clc;
load('DataC.mat');
% m is the number of samples
% n is the number of features
[m,n] = size(fea);
%% Min-Max Normalization and Seperate the training and test set
max_min = 1 ./ (max(fea) - min(fea));
fea = (fea - ones(m,1) * min(fea)) .* (ones(m,1) * max_min);
rp = randperm(m)... |
clc;
clear all;
n =input('Enter Number of Units:\n');
fprintf('Cost function is taken of the form Ci=ai+bi*Pi+gi*Pi*Pi \n');
for i=1:n
fprintf('for unit no %d,',i);
a(i)=input('Enter the alpha value:');
b(i)=input('Enter the beta value:');
g(i)=input('Enter the gamma value:');
end
l=input('Va... |
function [XR] = dropZeroSamples(varargin)
% Output XR is a logical mask of samples to be dropped to create a
% subsampled replicate.
% inputs: 1) probability of dropping samples
% 2) pointer to mat-file TempMat.mat
probRemove = varargin{1};
infile = varargin{2};
% Import X from matfile
X = infile.X;
% get size of X
[L... |
clear all; close all; clc
% Define the domain of interest
x = linspace(-5, 5, 101);
a = 0;
m = [1, 2, 5, 10];
prm = {'-rs', '-gd', '-bv', '-mp'};
lgd = {'f(x) = e^x'};
% Plot f(x) = exp(x)
plot(x, exp(x), '-ko', 'linewidth', 2.0);
hold on;
% Plot f_m(x)
for i = 1:length(m)
y = exp_taylor(x, m(i), a);
... |
x = -5:5;
x2= -5:0.01:5;
y = 4*x.^2 - 3*x;
y2 = 4*x2.^2 - 3*x2;
figure;
plot(x,y, x2,y2, 'LineWidth', 8);
%figure;
%plot(x2,y2);
|
function runAllStructured()
for i = 1 : 5
demoStructured(i,'','big');
end
%
% demoStructured(1, 'final-fold-1-22-May-2015 11:08:11.mat');
% demoStructured(2, 'final-fold-2-22-May-2015 13:24:34.mat');
% demoStructured(3, 'final-fold-3-22-May-2015 15:22:48.mat');
% demoStructured(4);
% demoStructured(5);
|
function ppdX = diffpp(ppX)
% Differentiate a function defined as a piecewise polynomial (pp).
% Returns a piecewise polynomial of the differentiated input function.
% USAGE = ppdX = diffpp(ppX)
%
% Ajay Seth
% June 25, 2004
[breaks, coefs, np, op, nd] = unmkpp(ppX);
% breaks are points defining the np inte... |
function obj = addInputVariable(obj, bounds)
% Adds input variables as the NLP decision variables to the problem
%
% @note The input variables may includes the control inputs, as well as
% external forces such as disturbance or contact wrenches.
%
% Parameters:
% bounds: a structed data sto... |
function Goal = createPathGoals(varargin)
N_Agents = varargin{1};
x=varargin{2};
y=varargin{3};
if nargin == 1
% if N_Agents == 3
% % Goal and goal size.
% Goal.pos(:,1) = [0.9; 0.9; 0.5];
% Goal.state(:,1) = [Goal.pos(:,1); 0; 0];
% Goal.Radius(1) = 0.0625;
%
% % G... |
function [lp,rp,adjust] = combSubSeqForC(seq,r)
if r>sum(seq)
lp = -1;
rp = -1;
adjust = 0;
return
elseif r==1
lp = 1;
rp = 1;
adjust = 0;
return
end
len = length(seq);
lp = 1;
rp = lp+1;
upperBound = inf;
upperLp = -inf;
upperRp = inf;
lowerBound = -inf;
lowerLp =... |
clc;
clear;
close all;
nSel=20;
MaxIt=1;
[pop,BestSol]=MainFunction(nSel,MaxIt); |
clear;
verbose = false;
% tic
%% Constants & process parameters
k = 1.38064852e-23;
T = 293;
V_thermal = 25.27*10^-3;
minimum_technology_cap = 1.995 * 1e-15;
F_per_M = 0.001025;
area_per_C = 1/ F_per_M; %1/ (F/m^2)
C_mismatch_parameter = 3.4878e-09;
C_logic = 1*1e-15;
noise_multiplier = 1;
Vref = 2;
gmoverid = 20; ... |
load para_true.mat
load updated_para_PCIKF.mat
time_step=10;
total_index=10;
obs=ogs_call(para_true,999,time_step);
prediction_PCIKF=ogs_call(updated_para_PCIKF,999,time_step);
DM_PCIKF=sqrt(mean((obs-prediction_PCIKF).^2))
DM_EnRML_80_mat=zeros(total_index);
for i=1:total_index
load( ['updated_para_EnRML_',num2st... |
function pointsToRemove = findStartEndPoints(segLabel, objLabel)
% produces an array the contains the values for the start and end
searchInd = find(segLabel == objLabel);
diffSearchInd = [1; diff(searchInd)];
gapSearchArrayMid = find(diffSearchInd > 1);
% figure out the points to remove
if l... |
addpath('.');
list1=textread('url_cat.txt','%s');
list2=textread('url_dog.txt','%s');
list3=textread('url_wolf.txt','%s');
OUTDIR='imgs_cat';
mkdir(OUTDIR);
for i=1:size(list1,1)
fname=strcat(OUTDIR,'/',num2str(i,'%04d'),'.jpg');
websave(fname,list1{i});
end
OUTDIR2='imgs_dog';
mkdir(OUTDIR2);
for i=1:size(list2... |
function [K L] = full_rank_dec(X)
% FRD - Full rank factorization of input matrix X.
%
% [K L] = frd(X) will write X as the product of two matrices X = KL where both K and
% L have the same rank as X
%
% EXAMPLE 1 :
%
% A=rand(1000);
% [K L] = frd(A);
% sum(sum(K*L - A))
%
% ans =
%
% -0.0018
%
%
% EXAMPLE 2:
%... |
function [ y ] = perpdot( x )
%PERPDOT Summary of this function goes here
% Detailed explanation goes here
y = [-x(2),x(1)];
|
function [c,zpnts,hpnts,z,h]=RoperAndListerConstantAreaSimilarity(A,deltagamma,mu,nu,eta,Kc,t,n)
% Draw the constant area similarity solutions of Roper and Lister 2007.
% Inputs:
% A - area of crack (total including head)
% deltagamma - (rhor-rhof)g
% mu - shear mod
% nu - Young's mod
% eta - fluid visc
% Kc - fracture... |
function m_TRM_sel_opt=m_optimize_T2(Diff_T2,mask,...
dT2_dswd_TRM_ref,dT2_drld_TRM_ref,dT2_dTa_TRM_ref,dT2_dqa_TRM_ref,dT2_dalpha_TRM_ref,dT2_demis_TRM_ref,dT2_dra_TRM_ref,dT2_drs_TRM_ref,dT2_dGrnd_TRM_ref,dT2_dra_prime_TRM_ref, ...
dT2_dswd_TRM_sel,dT2_drld_TRM_sel,dT2_dTa_T... |
nVars = 3; % optimizing 3 params, N, Nu and Lambda
lb = [1 1 0.1]; %lower bound
ub = [50 50 50]; %upper bound
[x,fval]= ga(@(x)(dmc_zwykly(x(1),x(2),x(3),false)),nVars,[],[],[],[],lb,ub,[],[1 2]); |
function return_dat = reader_off(obj)
[Status, ResultFlag] = invoke(obj, 'CarrierOnOff', 0); % CarrierFlag Off
return_dat = ResultFlag; |
%% Define Red Pitaya as TCP/IP object
clc
clear all
close all
IP= ''; % Input IP of your Red Pitaya...
port = 5000;
tcpipObj=tcpip(IP, port);
%% Open connection with your Red Pitaya
fopen(tcpipObj);
tcpipObj.Terminator = 'CR/LF';
fprintf(tcpipObj,'GEN:RST'); % Reset to default settings
fp... |
%#eml
function [p] = Calc_ZMP_from_xi0_xiend_omega_and_dT(xi_0,xi_end,omega,dT)
b = exp(omega*dT);
p = (b*xi_0 - xi_end)/(b-1); |
% Script file: Prueba_PC1.m
close all
tau = 0.5;
n = 800;
m = 350;
[Q,A,c,b] = Generapc(n,m,tau);
tic;[ x1, lambda ] = PCDirecto( Q,A,c,b ); toc
tic; [ x2, lambda ] = PCRango( Q,A,c,b ); toc
tic; [ x3] = Metodo_Espacio_Nulo_1( Q, A,c,b ); toc
tic; [ x4] = Metodo_Espacio_Nulo_2( Q, A,c,b ); toc
disp(... |
function bagging(XA, num, XT)
trees = []; % Stocke l'arbre de chaque bootstrap
predictions=[]; % Stocke les prédictions de chaque bootstrap
% Génération de num bootstrap
for k=1:num
bootstrap=[];
% Création des bootstrap
for l=1:size(XA, 1)
bootstrap=[bootstr... |
%%统计信号处理大作业
%%2016年3月26日
%%%% work space
close all;clc;
pic_original=imread('破碎未筛分及分拣的建筑垃圾1.jpg');
pic_0=imread('破碎未筛分及分拣的建筑垃圾1.jpg');
pic_0=double(pic_0);
pic_1=imread('背景1.jpg');
pic_1=double(pic_1);
CR= pic_1(:,:,1)+pic_1(:,:,2)+pic_1(:,:,3);
x=1:1:255;
w=find(CR==0);
CR1= 0.439*pic_0(:,:,1) - 0.368*pic_0(:,:,2) - ... |
close all;
clear all;
clc;
%% Data Import
global N
global dt
global angPos
global gyro_angVel
global t
filename = input('File Name?');
M = csvread(filename);
t = M(:,1)*1e-3;
angPos = M(:,2);
gyro_angVel = M(:,3);
t = t-t(1);
dt = 1e-3;
%% Number of samples and time vector
N = length(gyro_angVel);
%%Load optimized ... |
function im_blend = mixedBlend(im_s, mask_s, im_background)
% s=im_s;t=im_background;
% [imbh, imbw, nb] = size(s);
% im2var = zeros(imbh, imbw);
% im2var(1:imbh*imbw) = 1:imbh*imbw;
%
%
% %initialization
% b= zeros(imbh*imbw,3);
% A=sparse(imbh*imbw,imbh*imbw);
% v=zeros(1,imbh*imbw);
% e=1;%which equation
%
% f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.