text stringlengths 8 6.12M |
|---|
clear
%% This script shows how to extract the connectivity values for different contrasts and seeds in the ADNET analysis.
% this will write a csv for seeds of interest
clear all
%% Parameters
path_data = '/home/atam/database/adnet/results/main_results/';
list_seed = [2; 9; 12; 22]; % select seed of interest
scale ... |
function [len, return_code] = RECEIVE_BUFFER(buffer_id, time_out, message_addr)
buffer = get_buffer_by_id(buffer_id);
if buffer == []
return_code = INVALID_PARAM;
return;
end
if time_out > MAX_TIME_OUT
return_code = INVALID_PARAM;
return;
end
msg = null_msg(... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2010 - 2015 Moon Express, Inc.
% All Rights Reserved.
%
% PROPRIETARY DATA NOTICE:
% The data herein include Proprietary Data and are restricted under the
% Data Rights provisions of Lunar CATALYST Space Act Agreement
% No. SAAM ID#... |
clear all; close all
%%
directory = 'Q:\Personal\Mattia\PyrProject\analysis\results\spikes_for_sorter';
folders = dir(directory);
experiments = get_experiment_list;
animals = extractfield(experiments, 'animal_ID');
animals = animals(~cellfun('isempty', animals));
animals = unique(cellfun(@num2str, animals, 'un', 0))... |
f=((x.^2)/16)+((y.^2)/4);
count=0;
for i=1:1000000
x=(8*rand)-4;
y=(4*rand)-2;
if (((x.^2)/16)+((y.^2)/4)<=1)
count=count+1;
end
end
fprintf('%8e',8*4*(count/1000000)); |
global CURRENT_PROJECT
projpath = 0;
while 1
menulist = {'Keyboard input'
'Quit'
'Open help'
'Choose/create project folder\n'};
if any(projpath) && ~isempty(CURRENT_PROJECT)
menulist(5) = {'Load specifications from Requirements.xls\n'};
try %#ok<TRYNC>
... |
N=35999;
error=zeros(N,1);
for i=2:N
error(i)=(abs(A(i))-abs(A(i-1)))-(0.1*10^6);
end
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% script_q3.m
%%% by Antonio Padilha L. Bo (antonio.plb@lara.unb.br)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% before everything
close all; clear all; clc;
%% loading data
load emg_practi... |
% This mfile plots the generated paths by RRT* algorithm.
% It reads the .TXT files that C++ code generates
clear
clc
%% Some parameters to set (Filename, output PNG name)
% YOU NEED TO MODIFY!
version = '28'
WORLD_WIDTH = 500;
ENV_TYPE = 3
RRTstar = 1
GIF = 1
GIF_SPACE = 5; % .gif get_frame() period.
% The widt... |
% Stabilizing the inverted pendulum. Equations of the linearized model are
%
% x_t = A x + B u + w
% y = H x + v
%
% u : state
% w : noise in the model
% v : noise in the observation
%--------------------------------------------------------------------------
% INPUT : m : mass of the pendulum (kg)
% ... |
clear A
TempFlood = Data;
for i = 1:size(TempFlood,3)
i
clear ColLeft ColRight Left Right
[~, FiltImg, ~, ~] = CorData(TempFlood(:,:,i), 'n', DarkImg, 'n', FloodImg, 'n');
Prof = diff(mean(FiltImg,1));
ProfAll(:,i)=Prof;
Right = sort(find(Prof>200));
Left = sort(find(Pro... |
% Simulate a single case of carriers reconstruction
% out of 1500 individuals.
% We use 200 pools, and assume that the carrier rate is 1%
%=============================
clear
% simulation parameters:
n_samples = 1500; %number of individual to be screened.
k_pools = 200; % number of pools we use.
s = 0... |
function XOSV = X_osv(Q,MFLUX,HFG)
% X_osv Onset of Significant Void
% X_osv(Q,MFLUX,HFG) Returns the Onset of Significant Void
% the local void where in the subcooled region wall voiding
% is initiated
% Called function: NONE
% Required Inputs are:
% Q is the heat flux in W/m^2,
% MFLUX is the axiall... |
function pc=driftlist_time_interp(cumdriftlist,vid)
% function driftlist_time_interp(cumdriftlist,vid)
%
% This function constructs a driftlist=[(frm #) dx dy (glimpse time) ]
% using the **.cumdriftlist member of the strucure output by
% the function 'construct_driftlist_time.m' by interpolating all drift
% offsets... |
function [f,g] = fun_alm(U,tA,N,R,normA,Lambda,C,dims)
% Compute the augmented Lagrangian function value and the gradient
% at point x
% tA is a tensor
%% compute function value f
ktnew = ktensor(U);
U_mttkrp = mttkrp(tA,U,N);
iprod = sum(sum(U{N}.* U_mttkrp));
Left = normA^2 + norm(ktnew)^2 - 2 * iprod;
Left = Left/2... |
%-----------------------------------------------------------------------
% Job saved on 26-Mar-2018 18:27:53 by cfg_util (rev $Rev: 6460 $)
% spm SPM - SPM12 (6685)
% cfg_basicio BasicIO - Unknown
%-----------------------------------------------------------------------
%Subs completed: 301:307, 311:313
contrasts = {... |
function varargout = polygonlength(X)
n_dim = size(X,2);
delta_X = 0;
for dim = 1 : n_dim
delta_X = delta_X + ...
diff(X(:,dim)).^2 ;
end
branch_lengths = sqrt( delta_X );
pl = sum( branch_lengths );
varargout{1} = pl;... |
function [ f ] = calcForce( p1, p2 )
% planet2's effect on planet1
G = 6.674 * 10^-11;
fX = p2.position(1) - p1.position(1);
fY = p2.position(2) - p1.position(2);
fZ = p2.position(3) - p1.position(3);
d = sqrt( fX*fX + fY*fY + fZ*fZ );
epsi = 2.22e-1;
if(d<epsi)
d = epsi;
end
nfX = fX / d;
nfY = fY / d;
nfZ = fZ... |
%% list the database names and their collections
% This software is distributed under the MIT License (MIT): see copyright.txt
mm_java_driver % ensure that MongoDB routines can be found
import com.mongodb.*
%% make a connection with a local MongoDB client
m = MongoClient('... |
function y = poly_value_fun(param, x)
y = 0;
for j = 1:length(param)
y = y + param(j) * x ^ (length(param)-j);
end
end |
fid = fopen('competition.txt', 'w+');
R = randi([81,83],13,2);
% R= 80,
for i=1:13
if R(i,1) == 81
R(i,1) = 80;
end
if R(i,2) == 81
R(i,2) = 80;
end
end
R = char(R);
% disp(R);
format = '%c %c\n';
fprintf(fid, format, R);
fclose(fid);
type('competition.txt');
rid = fopen('competi... |
function lim_cell = ctsqaxes(axes_han, desired_xlim, desired_ylim)
% CTSQAXES Create equal axes proportions.
% Author: Craig Borghesani <cborg@terasoft.com>
% Date: 7/29/96 9:56AM
% Revision:
% Copyright (c) 1996, V.C.T., Inc.
axes_pos = get(axes_han,'position');
fig_pos = get(get(axes_han,'parent'),'positio... |
function [phaseArray, phaseResidualArray, phaseData,phaseResidualData] = closeZernike(bench, zernike, varargin)
config = bench.config;
P = naomi.parseParameters(varargin, {'amplitude', 'gain', 'nZernike', 'nStep', 'dateOb', 'tplNAme'}, 'measure.closeZernike');
P.gain = naomi.getParameter(bench... |
function [lock_level, return_code] = lock_preemption()
part = current.part;
if part.status.operating_mode ~= NORMAL
return_code = NO_ACTION;
return;
end
if part.status.lock_level > MAX_LOCK_LEVEL
return_code = INVALID_CONFIG;
return;
end
part.status.lock_lev... |
function permutations = generate_permutations(ranges)
% This function takes as an input an array containing the maximum value of
% each participating in the permutation element. It returns an array,
% containing the permutations of these elements. Each element changes its
% value from 1 to the maximum value of th... |
function [ sig_d, delay ] = fract_sync_fft( ref, sig, params )
%sig_sync Synchronises a given signal to the reference signal within subsample precision.
% ref - is reference signal to be synchronised to
% sig - is given signal to be synchronised, it has to be presynchronised
% with precision of the whol... |
function [res]=GetDataGUINZ(DestinationAfterUser1, DestinationAfterUser2, DestinationAfterUser3)
% User name set into predefined path where data exists
% DestimationAfterUser is a string with foldernames after user is specified
Inputs= nargin;
UserName=getenv('username');
if ~isempty(DestinationAfterUser1)
FileRo... |
function [J grad] = nnCostFunction(nn_params, ...
input_layer_size, ...
hidden_layer_size, ...
num_labels, ...
X, y, lambda)
%NNCOSTFUNCTION Implements the neural network cost func... |
%% Setup training and test dataset
projectName = 'ISETImagePipeline';
thisImageSet = 'CIFAR_all';
dataBaseDir = getpref(projectName, 'dataDir');
dataInDir = fullfile(dataBaseDir, thisImageSet, 'all_1_true_dataset');
coneVecTr = 'coneVector20k.mat';
coneVecTe = 'coneVector20k.mat';
idxTrain = 1:1:1.8e4;
idxTest = (... |
clear
clc
details = input('Enter the information: ');
disp(min(findway(details,1,1,1))); |
function angle = q2angle(q)
R = qGetR(q);
angle_s = asin(R(1,1))*180/pi;
angle_c = acos(R(2,1))*180/pi;
if angle_s >= 0 && angle_c <= 90
angle = 90 - angle_s;
elseif angle_s < 0 && angle_c <= 90
angle = 90 + angle_c;
elseif angle_s < 0 && angle_c > 90
angle = angle_s - 90;
elseif angle_s >= 0 && angle_c ... |
%% Rounded nose cone example
% Created by: Lee A. Harrison
% On: 1/18/2019
%
% Copyright (C) 2019 Artech House (artech@artechhouse.com)
% This file is part of Introduction to Radar Using Python and MATLAB
% and can not be copied and/or distributed without the express permission of Artech House.
clear, clc
% Set the p... |
%% Markov process model of Fault-Tolerant Switching Mechanism
%%
n = 6;
fsw{1} = [1 1 2 2 3 3];
% fsw{1} = [1 1 1 1 1 1];
fsw{2} = [3 3 3 3 3 3];
LOOPS = sim_loops; % iterations variable
Ps = Ps_sim;
ps_granularity = Ps_granularity_sim; % granularity of Ps
PLOTS = Plots_on_off; % options for data and visualization... |
% MAC0420 - EP2
%
% Arthur Coser Marinho NUSP: 7210629
% Ludmila Ferreira Vicente e Silva NUSP: 7557136
%
%! /bin/octave -qf
% dados os parâmetros para v e a malha f definimos v com os coeficientes de cada índice i,j
function retval = constroiv (tipo, nx, ny, ax, bx, ay, by, f, dx, dy, dxy)
if (tipo ... |
% function SetInitialConditions( tController )
%
function SetInitialConditions( tController )
% get the initial condition for the optimization problem from the server.
% In thiss simple version these are set to see if the optimization
% problem is solved correctly.
%
try %
%
fCurrentJulianDate = Time.Get... |
function interval=getinterval(len,interval_num,overlapping_size)
new_length=len+(interval_num-1)*overlapping_size;
remainder=mod(new_length,interval_num);
normal_length=floor(new_length/interval_num);
set_length=ones(1,interval_num)*normal_length;
temp=floor((interval_num-remainder)/2);
set_length(temp+1:temp+remai... |
clear all;
clc;
addpath(genpath('C:\Users\MYlll\Desktop\Tools\rastamat'));
F1 = 'C:\Users\MYlll\Desktop\Features\dev-clean\1673\143396\1673-143396-0004.flac'
F2 = 'C:\Users\MYlll\Desktop\Features\dev-clean\2035\147960\2035-147960-0010.flac'
[x, fs] = audioread(F2);
mfcc = getMFCC(x, fs);
s.('F2') = mfcc;
save('F2.mat... |
step1_result;
%step2_result;
%step3_result;
PEAK_PERF=28.32;
% ---------------------------------------------------------
% Plotting
% ---------------------------------------------------------
figure;
% hFig = figure(1);
%set(hFig, 'Position', [0 0 160 240])
set( gcf, 'PaperSize', [3 3]);
set( gcf, 'PaperPosition', ... |
% Clear Matlab command window.
clc;
% Example #1: Basic usage.
% Note: Filters are computed for each run.
disp('Example #1: Basic Usage');
theta = [0:15:360];
for i = [1:length(theta)]
[J,H] = steerGauss([],theta(i),3,true);
filters{i} = H;
pause(0.1);
end
disp(' Press any key to continue.'); ... |
%实验一 特征提取 1.4 短时 平均 过零率
clear all;
%将当前目录以及当前目录下的子文件夹添加到MATLAB搜索路径
addpath(genpath(pwd))
%读入语音文件
try
[x1,sr]=wavread('卡农.wav');
catch ErrorInfo
[x1,sr]=audioread('卡农.wav');
end
x=awgn(x1,15,'measured');%加入15dB的噪声
s=fra(220,110,x);%分帧,帧移110
zcr=zcro(s);%求过零率
figure(1);
subplot(2,1,1)
plot(x);
title('原始信号');
x... |
function [M, S, W] = SEM2(X, k, M, S, W, delta)
m = size(X, 1);
g = zeros(m, k);
y = zeros(m, k);
count = 0;
while 1
count = count+1;
%E
g0 = g;
for i = 1:m
for j = 1:k
g(i,j) = (W(j)*mvnpdf(X(i),M(j,:),S(j)))/sum(W.*mvnpdf(X(i), M, S));
... |
% FPMat Interface
% Example of Surface, Contour plot data
% Read Surface, Contour plot data.
% The data has been generated in FlexPDE
% by running Example01.PDE
fpreadsc('TempC.flx');
fpreadsc('TempS.flx');
fpreadsc('VS.flx');
|
close all
clear all
%% Figure 2.4a
T = 2*pi;
alpha = .7;
beta = .7;
figure(1)
hold on
m = 20;
t = linspace(0, T, m+2);
theta(:) = (.7*cos(t) +.5*sin(t));
theta(1) = alpha;
theta(m+2) = beta;
for i = 1:5
plot( t, theta)
J = makeJ(theta, T);
G = makeG_nonlinPendulum(theta, T);
delta = J\-G';
delta = ... |
function [dri, dro] = drr1(r,v0, L, a, ka, na, b, kt, vl, kL, B)
v = 4 / 3 * pi * r .^3;
dri = (a /(4*pi) * 1./(1 + (r/ka).^na) * L/(kL+L));
dro = (B + b * r.^2)./(4*pi * r.^2) .* (v - v0)./(v - v0 + kt*vl);
|
function sonsal=l(veri,olabilirlik,oran0,oran1,kriter)
carpim0 = oran0;
carpim1 = oran1;
for( i = 1 : kriter)
if(veri(1,i) == 0)
carpim0 = carpim0 * olabilirlik(1,i);
carpim1 = carpim1 * olabilirlik(2,i);
else
carpim0 = carpim0 * olabilirlik(3,i);
carpim1 = carpim1 * ola... |
%extract the edges from the intensity values (could be a colormap one day)
function edges = GetEdges(imdata)
imdata = double(rgb2gray(imdata));
edges = edge(imdata, 'sobel');
%dilate the image with a small structuring element
dilator = strel('square', 3);
edges = imdilate(edges, dilator);
end
|
%%%compute the multi-rank
function rank=Adap_multi_Rank(X,ratio)
Nway = size(X);
rank=zeros(1,Nway(3));
FX = fft(X,[],3);
for i = 1:Nway(3)
[~,s,~] = svd(FX(:,:,i),'econ');
big=s(1);
rank(i)=size(find(s>=ratio*big),1);
end
|
function [x]=yuanyuanqiexian(A,r1,B,r2)
[b k]=solve(['(k*' num2str(A(1)) '-' num2str(A(2)) '+b)^2=' num2str(r1) '^2*(1+k^2)'],...
['(k*' num2str(B(1)) '-' num2str(B(2)) '+b)^2=' num2str(r2) '^2*(1+k^2)']);
k=double(real(k));
b=double(real(b));
for i=1:length(k)
temp5=solve(['x*(' num2str(k(i)) ')-y+(' num... |
function Resoviour = getResoviour(data2)
%generate resoviour by generateing a histogram distrubution for each
%combination of thresholds
data = rearrange2to1(data2);
maxTreah = max(max(data));
minTreah = min(min(data));
step = 0.5;
thresholds = minTreah:step:maxTreah;
Resoviour = {};
for thresh1 = 1:1:... |
function [A_transformed,J] = JacobiRotation(A,j,k)
% JACOBIROTATION Performs the Jacobi rotation algorithm on the (j,k)th entry
% of a real symmetric matrix A.
% Computes the Jacobi rotation matrix J for the j,kth and k,jth entry of A.
% Args:
% A (ndarray): Real n x n symetric matrix
% j (int): Index of row... |
function type = getDatabaseType(db)
% Returns the type of database this is.
%
% type = getDatabaseType(db)
%
% Possible return values are:
% - 'light'
% - 'image'
% - 'scene'
% - 'model'
%
% ----------
% Jean-Francois Lalonde
fNames = fieldnames(db);
for i_struct = 1:length(fNames)
switch fNames{i_str... |
% This script apply NBS
% Set the number of latent factors
option.K = 4;
option.iter = 500;
% Defaule clustering settings
option.zoptions.iter = 1000;
% Relate the clustering performance
option.zoptions.gamma = 200;
option.zoptions.tof = 1e-4;
option.zoptions.dis = false;
option.zoptions.distance = 'nnls';
tic
[W,H... |
function [board, orientation] = solver(tiles, boardSize)
% SOLVER Sample solver for the MATLAB Tiles Contest
% The MATLAB Contest Team
% Copyright 2012 The MathWorks, Inc.
board = zeros(boardSize);
board(1:2) = 1:2;
orientation = ones(size(tiles,1), 1);
orientation(1:2) = 1:2;
end |
function extendedModelMilitia()
figure
global beta sigma betap sigmap kappa kappap rho delta;
% Base interaction rate
%%% PARAM BEGIN %%%
r = 0.01/91; % per hr
q = 0.8;
f = 10; %
beta = r/(2+q);
sigma = r/(2+q);
kappa = q*beta;
lambda = 0;
nu = 0;
tau = 20/441; %/hr % One trained unit every month
betap = beta/f;
sig... |
%Code to plot the data of problem 1.
%After running the code once, comment out line 5 for faster compiling.
clc;
% load nmos.mat; load pmos.mat;
%---------------------------------------------Data#1-------------------------------------------
%NMOS
cgd_cgg_nch_1 = squeeze(abs(str2double(nch.cgd(1,:,37,1))./str2double(n... |
% LFSynthVersion - returns a string describing the current toolbox version
%
% This is part of LFSynth, a bare-bones light field renderer implemented in MATLAB.
%
% Please see DemoLFSynth.m for further information.
function VersionStr = LFSynthVersion
VersionStr = 'v0.0.0 released 30-Mar-2017';
|
% MRLREMAP.M
% Remapping onto shorter dwell script
% Called by mrlrm.m / mrlcalcc
% Initial and final steps unique
% mrlk counts gradient steps on old pulse (1:km)
% mrll counts new steps (at new mrldweln)
% Declare globals ***********
global mrldweln mrldwelr mrlphi mrlphis mrlrf mrlrfm mrlslew ...
mrlbckf mrlgn mr... |
%zihang zhou
%861090400
%may 28, 2016
%CS 171
%PS 5
function [ score ] = giniscore( frac )
score = 0;
%frac a row or col do till the end
l = max(size(frac));
for i = 1:l
score = score + (frac(i) .* (1 - frac(i)));
end
end
|
NullModel=zeros(size(Mean_allNodes_perFish));
for i=1:size(NullModel,1);
NullModel(i,:,:)=AAFT(squeeze(nanmean(Mean_allNodes_perFish(i,:,:),2)),13)';
end
CorrelationMatrices_NullModel=nan(size(NullModel,1),size(NullModel,1),size(NullModel,2));
for fish_nb=1:size(NullModel,2)
CorrelationMatrices_NullModel(:,:,f... |
function Y = compress( X, V, mu, k )
[N,D] = size(X);
Xc = X - ones(N,1)*mu; %Centralizing X
if k < size(V,2)
Y = Xc* V(:,1:k);
else
Y = Xc* V;
end
end
|
function nodeIdx = getNodesWithCoords( skel, coords, treeIndices )
%GETNODESWITHCOORDS Return the linear indices of the nodes with the
%specified coordinates.
% INPUT coords: [Nx3] int
% Node coordinates to search for.
% treeIndices: (Optional) [Nx1] int or logical
% Linear or logical indices ... |
% File: P7_12.m for Problem 7-12
clear;
clf
EbNodB = 0:0.1:15;
for (i = 1:1:length(EbNodB))
EbNo(i) = 10^(EbNodB(i)/10);
Pea(i) = Q(sqrt(0.25*EbNo(i)));
Peb(i) = Q(sqrt(EbNo(i)));
end;
subplot(211)
semilogy(EbNodB,Pea);
xlabel('EbNodB -->');
ylabel('Pe(EbNodB)');
title('(a) BER for Unipolar Signaling wit... |
function [ REAL_POS ] = FindStartPos( eNB )
%FINDSTARTPOS 此处显示有关此函数的摘要
% 此处显示详细说明
%% 基本参数
PCI = eNB.NCellID;
RBs = eNB.NDLRB;
NSF = 0; %子帧号
RS_0 = GEN_RS(PCI,RBs,NSF * 2 + 0,0);
RS_4 = GEN_RS(PCI,RBs,NSF * 2 + 0,4);
RS_7 = GEN_RS(PCI,RBs,NSF * 2 + 1,0);
RS_b = GEN_RS(PCI,RBs,NSF * 2 + 1,4);
RS_POS_0 = GEN_RS_POS(P... |
clear
addpath functions
%% Select experiment
[expe] = listdlg('PromptString','Select an experiment',...
'SelectionMode','single',...
'ListString',{'Experiment 1 (N=20)','Experiment 2 (N=40)'}) ;
[fit_test] = listdlg('PromptString','Select a fitting method',...
'SelectionMode','single',...
'ListString... |
%% OPENMAS ANALYSIS/POST SIMULATION PROCESSING (OMAS_analyis.m) %%%%%%%%%%%
% This function is designed to prepare the collected simulation data,
% conduct some preliminary analysis and object statistics before being
% output for further analysis.
% Author: James A. Douthwaite 19/12/2017
function [DATA] = OMAS_ana... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%% Extract general parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% lattice parameter
for i=1:length(DB.textdata(:,1))
idx=strcmp(DB.t... |
% Function to create the grand friction matrix (diagonal elements of the
% grand mobility matrix).
%
% Version 0.100
function gf = grand_friction(filament_param,delta)
%global n eps
n = filament_param.n;
%% Isotropic bead friction 4*pi*eps
%aa =eps;
%aa = 1;
zeta = 4*pi*delta;
... |
function beta_sdd_sid_offcenterdis_deltatheta = Xu2DPmatrixGetSDDSIDetcFromPmatrixInOne(pmatrix,det_elt_counts)
[paras, delta_u] = Xu2DPmatrixGetParasFromPmatrix(pmatrix);
theta = paras(1);
x_do = paras(2);
x_s = paras(3);
y_do = paras(4);
y_s = paras(5);
beta = angle(x_s+1i*y_s);
delta_theta = theta-beta+pi/2;
de... |
function [Pxx, Pyy, Pyyo, Y, Yo, FS, dPyy]=SIN_matchspectra(X, Y, varargin)
%% DESCRIPTION:
%
% This function is designed to create a frequency domain filter to match
% the long-term power spectra between two time series. This is done using
% a spectral estimator (pwelch, currently). Consequently, it's important
... |
function rsum=SumErrors(r1,r2,magindex,indBPM)
% rsum=SumErrors(r1,r2,magindex)
%
% gets errors from r1 and r2 and sum them into rsum
%
if length(r1)~=length(r2)
error('r1 and r2 must be the same lattice with different errors!')
end
if nargin<3
magindex=1:length(r1);
end
[X1,Y1,S1,T1,R1,P1,bpm1]=GetExistin... |
%% Plot color-concept association strengths for chosen fruits and colors
%Experiment 1: Cantaloupe and Strawberry
figure (1)
FruitAssocBars(FruitAssoc, UW58.Lab, color_CS, fruit_CS, 'Cantaloupe', 'Strawberry')
%Experiment 2: Mango and Watermelon
figure(2)
FruitAssocBars(FruitAssoc, UW58.Lab, color_MW, fruit_MW, 'Man... |
function measure = dsp__n_minus_n(obj, n, restrictions)
if ( nargin < 3 || isempty(restrictions) )
restrictions = [];
else
msg = 'Restrictions must be a cell array of cell arrays of strings';
assert( iscell(restrictions), msg );
assert( iscellstr(restrictions{1}), msg );
end
assert( ndims(obj.data) == 2, ...... |
function [] = graficar_reglas(rules, n)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
tiempo = 1:length(rules(1,:));
figure(n)
ax = subplot(3,1,1);
title("Importancia de cada regla",'Fontsize',13)
hold on
for i=1:6
plot(tiempo,rules(i,:),'o');
end
set(gca,'Fontsize',10)
yticks(0:25:1... |
% Genera una matriz con rutas vecinas a la ruta original
% sB: Ruta Actual
% costoRutaB: Costo Ruta Actual
% listaTabu: Lista Tabu
function [ruta, listaTabu] = GenerarListaCandidatos(sB, numCandidatos, listaTabu)
ruta = [];
numCiudades = size(unique(sB), 2);
do
x1 = 0;
x2 = 0;
do
x1 = GenerarNumeroAleatorio... |
% Runs of Hybrid Learning
for k = 1:20
classificationError = 0;
for f = 1:20
classificationError = classificationError + GetClassificationError(k);
end
avgCE = classificationError/20;
ID = fopen('/home/jph/Dropbox/MATLAB Codes/ANN Examples Sheets/Second Sheet/kvsCE2','a');
fprintf(ID,'%d\t\t %.4f\n'... |
% Homework:2
% Author: Christian Kolset
clear
%% Part 1
% Function parameters
q0 = 10;
R = 60;
L = 9;
C = 0.00005;
% Use linspace to create an array of 100 points between 0 and 0.8
t = linspace(0,0.8);
% Calculate the values of q
q = q0.*2.718.^(-R.*t/(2*L)).*cos(sqrt((1/(L*C))-(R/(2*L))^2).*t);
% Plot q vs t
hol... |
%% build_contrasts
% Builds contrasts for 1st level analysis for one subject
% CHANGELOG
% 11/15/17 Initialized file (hybrid_isss)
% 02/13/20 Forked for YA_FST, made universal
% 03/02/20 Dropping first TR from each event
% 04/07/20 Cloned for hybrid_isss
function build_contrasts(varargin)
%% Check input
subj = v... |
%{
#
-> reference.ProbeModel
-> reference.ProbeModel
electrode : int # electrode
---
x_coord=null : float # (um) x coordinate of the electrode within the probe
y_coord=null : float # (um) y coordin... |
function [R, ss, mS] = maskRegSplitNext(wsReg, wsReg0, s0s, mS0)
% Split mask to disjoint regions.
%
% Input
% s0s - label in last frame, 1 x mR0
% mS0 - #label up to the last frame
% idxR2L0 - region id -> label id, 1 x mR0
% IdxL2R0 - label id -> region id, mL0 x coRMa0
% idxR2T0 - region ... |
function boundUpdate_Kepecs_curve
% Permission is hereby granted, free of charge, to any person obtaining a
% copy of this software and associated documentation files (the "Software"),
% to deal in the Software without restriction, including without limitation
% the rights to use, copy, modify, merge, publish, distribu... |
% Post-Processing of Code Generation with Simulink Data Object
% Recover the variables and signal resolutions to pre-code generation.
% clear signal objects
cmd = 'clear';
for n = 1:num_sig
cmd = [cmd, ' ', sig.name{n}];
end
eval(cmd)
% reset signal resolution
for n = 1:length(sig.handle.Signals)
set_pa... |
function beta = leastSquaresGD(y,tX,alpha)
% Least squares using gradient descent
% alpha is step size
maxIters = 1000; % number of iterations
converged = 1e-5; %number for convergence check
N = length(y); % compute number of data points
beta = zeros(size(tX,2),1); % initiate beta
for k = 1:maxIters
% compute... |
%% Dump SUNRGBD data to our format
% for each sample, we have RGB image, 2d boxes, point cloud (in camera
% coordinate), calibration and 3d boxes
%
% Author: Charles R. Qi
% Date: 09/27/2017
%
clear; close all; clc;
addpath(genpath('.'))
home_folder = "/home/yewsiang/Transferable3D/";
dataset_folder = strcat(home_fold... |
% open loop optimal control
close all
clear all
clc
nx = 4;
nu = 2;
dt = 0.03;
Nmpc = 100;
Tmpc = Nmpc*dt;
tmpc = 0:dt:Tmpc;
% initial conditions
x0 = [-5+2*pi; 0; -4+2*pi; 0];
% weights
Q = 100*diag([1,1,1,1]);
R = diag([1,1]);
% open loop control with correct parameters
[PAR, CON, SC, SCu] = par_robot;
% constra... |
% Copyright [2021] [Adam Berrington]
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable la... |
% Compute cell's current [A] from voltage [V], suns [suns] and temp [°C]
% May 2011, tested on MATLAB R2010A
% Translated and improved by Thibaut Leroy (thibaut.leroy@gmail.com),
% French solar car team Hélios (http://www.helioscar.com)
% HEI (Hautes Etudes d'Ingénieur) engineering school Lille, France
% Sunpow... |
function main(cr,f,t1,t2,pobladores)
%Metodo main
for i=1:15
disp(['------------------EJECUCION No. ', num2str(i), '------------------']);
mejoresResultados = zeros(1,30);
finf = 0.1;
fsup = 0.9;
% cr = .5;
% f = .5;
%... |
function [ output_args ] = plotMesh( mesh )
%Plot 2D triangular mesh
% Detailed explanation goes here
hold on
for i=1:mesh.elementNumber
nodes = mesh.elements(i,:);
if sum(nodes==0) < 1
vert = zeros(4,2);
for j=1:length(nodes)
vert(j,:) = mesh.nodes(nodes(j),1:2);
end
... |
function sec = Sector(no) % Output: sector which number no belongs to.
if(no==1|no==2|no==3) % First quadrant.
sec = [1,2,3];
elseif(no==4|no==5|no==6)
sec = [4,5,6];
else
sec = [7,8,9];
end
%Alejandro Soulier as4094 |
function addEdge(obj, id, varargin)
% ADDEDGE Adds edge to the posegraph.
%
% Other m-files required: Posegraph.m
% Subfunctions: none
% MAT-files required: none
%
% Author: Gabriel Moreira
% email: gmoreira (at) isr.tecnico.ulisboa.pt
% Website: https://www.github.com/gabmoreira/maks
% Last revisi... |
clc
% clear
input_sita = 50 ;
sita = input_sita/180*pi; % 设定旋转的角度,正为顺时针旋转
load my_psi_xyz.mat; % 载入波函数的mat文件
fai = psi_xyz; % 被旋转的分子波函数
%%%%% 空间坐标的设定 %%%%%
xmin = -5/0.53 ;
ymin = -5/0.53 ;
zmin = -5/0.53 ;
xmax = 5/0.53 ;
ymax = 5/0.53 ;
zmax = 5/0.53 ; ... |
function pass = test_mult_op
% Check if multiplication with a pointwise multiplication operator
% is identical to a pointwise multiplication of two chebfuns.
% TAD, 3 Feb 2014
tol = 1e-14;
d = [0,2];
x = chebfun('x',d);
f = sin(exp(2*x));
g = x.^3-cos(x);
% no breaks
F = operatorBlock.mult(f);
err(1)... |
function makeFitsFigure(results, dataFolder)
% Date 5/14/14: written by Eugenio Marco
% Display fits
nBins = 20;
[nFinal xout] = hist([results.scoreFinalCluster1; results.scoreFinalCluster2], nBins);
nFinal1 = hist(results.scoreFinalCluster1,xout);
nFinal2 = hist(results.scoreFinalCluster2,xout);
nParent = hist(resul... |
clear ; close all; clc
x=-10:0.1:10;
lengthx=length(x);
y=zeros(lengthx,1);
%for i=1:lengthx
% y(i)=1/(1+e^(-1*x(i)));
%endfor
y=1./(1+exp(-x));
plot(x,y);
set(gca,'YAxisLocation','origin');
|
function x=lincon(a,b,n)
%System of linear congruences
% X = LINCON(A,B,N) solves the system of linear congruences
%
% A(1) * X == B(1) (mod N(1))
% A(2) * X == B(2) (mod N(2))
% ...
% A(m) * X == B(m) (mod N(m))
%
% The solution, X, will be given as a vector [x1 x2]
% repres... |
function Tsquare( A, B, C, D, N )
%TSQUARE: Construct the Nth step of the T-square
% Function takes in A, B, C, and D as the vertices used to form
% the T-square: a variation of the Sierpinski carpet fractal where it
% sequentially forms squares with half the original length in the
% center of the box defined b... |
% UEqn.m
% Solve the Momentum equation
% *************************************
% No viscous term is taken into account
% *************************************
% Assembling (implicit terms)
if (fullVerbose==1)
disp('Assembling UEqn')
end
[ddtM, ddtRHS] = fvm_ddt(rho, rho0, U0, V, dt, 1);
[convM, convRHS] = f... |
% A basic test script demonstrating how to run the unifoil model.
% All units are in radians except when otherwise stated (eg some basis
% parameters)
%% Setup
clear;close all
%% Simulation Options
T = 100; % Simulation duration
%% Kite properties
% Physical properties
baseMass = 6184;
addedMass ... |
%% DESORPTION
%
%% Cleanup
clearvars -except fluid
close all
clc
%% Parameters
c = conversion_factors();
if ~exist('fluid','var')
load nh3_v4.mat;
fluid = nh3_v4;
clearvars nh3_v4
end
if ~exist('valveLib','var')
load valveLib.mat;
end
%% Reactor
% Heat transfer with ambient:
Tamb_... |
%% Prepare ECCO data for mGlobe
% Use this script to download and convert ECCO1/2 (net)cdf files (no monthly
% data conversion). Make sure the connection is not blocked by firewall.
clear
clc
%% Settings
% Set time interval. Set carefully, this may overwrite existing files
time_start = [2016,12,31];
time_stop = [2017... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.