text stringlengths 8 6.12M |
|---|
function [spec, seed] = get_phone(seed)
% Get the spectrogram of a given phone.
% The first time, pass in the phone label as the seed. The
% returned seed should be passed as argument for all the
% successive calls of the same group.
%
% e.g.
% [ao1, ao_seed] = get_phone('ao');
% [ao2, ao_seed] = get_phone(ao_seed);
... |
%% This script runs a function which determines the Lift-Curve Slope for all lifting surfaces (main wing, horizontal tail and vetrical tail)
%% Inputs
%AR= Wing aspect ratio----> this will change to AR_effective if we add
%winglets
%S_exposed=Exposed planform area of wing
%S_ref=Reference planform area of wing
... |
%% Differences between Cell and String %%
s='hello'
whos 's'
str_ascii=uint8(s);
str_back_to_ascii=char(str_ascii);
%%
student_profile_bracket= ['Max Power ';...
'3rd Semester';...
'EP ']
student_profile_char=char('Max Power', '3rd Semester','EP')
whos stud*... |
%dirresults = '/results';
Iteration = 1000;
Tollerance = 0.05;
delimeter = '\t';
mkdir([diroutput]);
data = dlmread(dirinput);
input = data(1,:);
output = data(2:size(data,1), :);
response = output;
directory = diroutput;
[Cbias, Clinear] = ArimotoBlahutDiscretise( output, binsnumb... |
%% Figure Generator with Format
% =========================================================================
function[] = generate_figure(x,y,x1,y2,x3,y3,x4,y4)
% =========================================================================
% Specify Dimensions and Position on Screen
% ===================================... |
function [probability_obj_set,pairs] = ...
bestProb(s,d,Xf,dX,dXID,c,inq,const,alg,queryID,pairs,w,target,nq)
nx = size(Xf,1);
% calculate A
[A,W] = appObjDistribution(s,d,w,Xf,dX,dXID,c,const,alg,pairs,[]);
probability_obj = A/sum(A);
fprintf('|%d, %.2f|',nq,JSdivergence(proba... |
%HW4 Homework 4
function [num_questions] = hw4()
format compact;
close all;
%Part-A
% 'Clicked' coordinate system
imdata = imread('tent.jpg');
figure('Name','Part A - "Clicking" Coordinate System','NumberTitle','off');
imdata(56,40,:)=[255 0 0];
imshow(imdata);
num_questions=1;
%Part-B
% Calculate C... |
function [q,k] = Newton(a,b,h)
k=1;
d= (b-a)/2 ;
x=zeros(1,30);
imax=10^4;
while k < imax
x(1) = d;
x(k+1) = x(k)-(x(k)^2-h)/2*x(k);
if(abs(x(k+1)-x(k))<=10^-4)
break;
end
q = x(k+1);
k=k+1;
end
|
%% Stelling 6
%
% De onderstaande code wordt zonder foutmeldingen uitgevoerd:
%
% ======= Code =======
% clc
% clear variables ... |
% mirdwt_cycle2D.m
%
% Inverts mrdwt_cycle2D().
% Usuage : x = mirdwt_cycle2D(yw, ys, h, L)
% yw - wavelet coefficients NxNxLx3
% ys - scaling coefficients NxN
% x - output signal NxN
%
% Written by : Justin Romberg
% Created : 3/21/99
function x = mirdwt_cycle2D(yw, ys, h, L);
N = size(yw,1);
yh = zeros(N,L*N*3);
f... |
close all;
% figure;
% geoshow(10, 10);
% geoshow(40, 0);
% geoshow(-40, 0);
% geoshow(0,70);
% geoshow(0,-70);
subplot(2,2,[3 4])
geoshow(X.signals.values(:,2), X.signals.values(:,1));
hold on;
[l,c] = size(X.signals.values);
% plot(0,0);
% plot([0 0], [X.signals.values(1,2) X.signals.values(l,2)],'r');
[... |
function bound = compute_shape_boundary(M)
% compute_shape_boundary - extract boundary points of a shape
%
% bound = compute_boundary(M);
%
% bound is the boundary of the largest connected component of the shape
% represented by M>mean(M(:))
%
% Copyright (c) 2009 Gabriel Peyre
M = double(M>mean(M(:)));
c = co... |
function [output] = get_EVSI_1_exp_2sp(all_mods, managed_mods, mod_prob_all, ...
B, c1, c2, q, Start_m1, sp_monit)
% DESCRIPTION: Calculates the first term for EVSI for monitoring TWO
% SPECIES uneder EXPERIMENTAL MANAGEMENT
% INPUTS:
% all_mods = 64 x 6 matrix of 64 possible model combination for 3 species,
% ... |
function [IsGoingToInf]=CheckInf(z,n)
for i=1:n
z = (z-0.5).^2;
end
if abs(z)>1
IsGoingToInf = 1;
else
IsGoingToInf = 0;
end
end |
function [velL, velR] = TwoD_motion_velocities(objectZ, objectX, objectDirection, objectSpeed, iopd)%,fixationZ,fixationX
% function [velL, velR] = TwoD_motion_velocities(objectZ, objectX, objectDirection, objectSpeed, iopd)%,fixationZ,fixationX
%
% Converts xz object direction/location to corresponding left/right eye... |
X = rand(1000,1)-0.5;
I = (abs(X).^4)./(abs(1-X).^4);
[Idata Ibin] = hist(I,1000);
hold on
bar(Ibin,Idata)
Icoef = polyfit(Ibin,Idata,8);
line(Ibin,polyval(Icoef,Ibin)); |
function beep2(w,t)
%plays a short tone as an audible cue
%
%USAGE:
% beep2
% beep2(w) specify frequency (200-1,000 Hz)
% beep2(w,t) " " and duration in seconds
fs=8192; %sample freq in Hz
if (nargin == 0)
w=1000; %default
t = [0:1/fs:.2]; %default
elseif (nargin == 1)
... |
%function [W]=M1d5singular(delta)
delta=0.5;
h=delta;
d=delta;
%M=1 h=delta/M delta=0.5
%% ~~~~~~~~~computation of \|p\|_delta^2~~~~~~~~~~~~~~~~~~~~~
H11=(2*h/3+40*h/(3*d^2)-8/d+2/h-8*h^2/(d^3)+(8*h^3)/(5*d^4))*ones(2,1);
M=diag(H11);
M(2,1)=h/3+8/d-2/h+(8*h^2)/(d^3)-(8*h^3)/(5*d^4)-(40*h)/(3*d^2);
M(1,2)=M(2,1);
... |
function [flag] = checkvoice(dist,number)
thresh0 =6.8;
thresh1 =6.4;
thresh2 =6.9;
thresh3 =6.9;
thresh4 =6.6;
thresh5 =7.3;
thresh6 =7.3;
thresh7 =7.85;
thresh8 =6.9;
thresh9 =7.82;
distmin = dist(1);
switch number(1)
case 0
if distmin > thresh0
disp ('Reject this person at 0');
... |
function [xtraj, htraj, ts] = Quad_planWalkingStateTraj(robot, walking_plan_data, xstar,comtraj)
% Given the results of the ZMP tracker, find a state trajectory for the robot to execute
% its walking plan.
% @param walking_plan_data a WalkingPlanData, such as that returned by Quad_planWalkingZMP()
% @param xstar the no... |
%% Partikel
function [X_p_neu] = Num_1_Wirbelstroemung_GUI_Partikel(X_p_0,u,v,h,dt)
x = X_p_0(1,1);
y = X_p_0(2,1);
[ny,nx] = size(u);
if x > (nx-1)*h
x_neu = x;
y_neu = y;
elseif y > (ny-1)*h
x_neu = x;
y_neu = y;
elseif x < h
x_neu = x;
y_neu = y;
elseif y < h
x_neu = x;
y_neu = y;
el... |
function [ R ] = getResistance(type,args)%if type=="cy" args:[ri,ro,k,l] if type=="ca" args:[dx,k,r]
if strcmp(type,'cy')
R=log(args(2)/args(1))/(2*pi*args(3)*args(4));
R;
elseif strcmp(type,'ca')
R=args(1)/(args(2)*pi*args(3).^2);
end
end
|
function [V, E, param] = rotX(Nsides, angle, radius, height)
%% Check validity of input parameters
% high level parameters
if ~exist('Nsides','var')
Nsides = NaN;
elseif ischar(Nsides)
Nsides = str2double(Nsides);
end
if ~exist('angle','var')
angle = NaN;
elseif ischar(angle)
angle = str2num(angle);
e... |
function Score = Spacing(PopObj,PF)
% <metric> <min>
% Spacing
%--------------------------------------------------------------------------
% The copyright of the PlatEMO belongs to the BIMK Group. You are free to
% use the PlatEMO for research purposes. All publications which use this
% platform or any code in the pla... |
function [S, C] = HA(A, B)
S= xor(A,B) ;
C=and(A,B);
end |
% retailer variables
Demand(1) = 4
RetInv(1) = 4
RetBack(1) = 0
Mail(1) = 4
RetCost(1) = 4
% factory variables
Production(1) = 4
FacInv(1) = 4
FacBack(1) = 0
Shipping(1) = 4
FacCost(1) = 4
for week = 2:52
% what's the demand for the week?
if week <= 4
demand = 4
else
demand = 7
end
... |
classdef Star < vicos.keypoint_detector.OpenCvKeypointDetector
% Star - OpenCV Star/CenSurE keypoint detector
%
% (C) 2015-2016, Rok Mandeljc <rok.mandeljc@fri.uni-lj.si>
properties
implementation
end
methods
function self = Star (varargin)
% self = Star (va... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (C) 2013 by Jerome Maye %
% jerome.maye@gmail.com %
% ... |
function movingbarana_SU
animalid = '150127';
block = 5;
basepath = ['C:\Users\Julia\work\data\' animalid '\'];
% supath = [basepath 'multiunits\'];
supath = [basepath 'singleunits\'];
basename = [animalid '_block' int2str(block) '_tet'];
files = dir([supath, basename, '*.mat']);
prestim = 300;
poststim = 300;
stim... |
function result = find_face1(frame, scales)
% function result = find_face1(frame)
%
% it takes as argument a depth frame. It uses chamfer matching with a face
% template.
% it searches at quarter resolution.
[rows, cols] = size(frame);
|
function id = sub2index( pid, lid, fid, ppl, ppf )
%SUB2INDEX sub to index kai's version
% pid = pixel index
% lid = line index
% fid = frame index
% ppl = pixel per line
% ppf = pixel per frame
% return id = linear index
id=((lid-1)*ppl+pid)+(fid-1)*ppf;
end
|
function [s] = syslog_prefix(varargin)
%
% NAME
%
% function [s] = syslog_prefix()
%
% ARGUMENTS
% INPUT
%
% OPTIONAL
%
% OUTPUT
% s string syslog-style prefix string
%
% DESCRIPTION
%
% This function generates a syslog-style prefix string,
% suitable for time stamping log-type messages
%
% PRECONDITIONS
%
% o un*x ... |
k = zeros(3,6);
for i = 0:2
tic
k(:,i+1) = fichera(i);
time(i+1) = toc
end
sum(time) |
function build(tgt_model_name)
tgt_model_name = 'mpc_tgt_calc';
home = pwd;
build_home = which(tgt_model_name);
cd(fileparts(build_home));
tgt_dir_name = 'gen_code';
mkdir('build');
mkdir(tgt_dir_name);
cd(tgt_dir_name);
gen_code_dir = pwd;
cd ..;
tgtdir = ... |
X=[1 1 2 3 5 8 13 21];
Y=diff(X);%%derivatives
A=[1 1 1; 5 5 5;25 25 25]
Y=diff(A);
%%
diff(A,1,2)%%look up some example
%%%
%%calculating with time
t1=datetime('now');
t2=t1+minutes(5);
t=t1:minutes(1.5):t2;
dt=diff(t);
%%
%variables
step_size=0.01;
x=0:step_size:2*pi;
my_fct=sin(x)
my_fct_d1=diff(my_fct)/(step_size);... |
close all;clear;clc;
disp('************* Welcome To General Signal Generator *************');
fprintf('----------------------------------\n');
Fs=input('Enter the Sampling Frequency ( Fs ) : ');
fprintf('----------------------------------\n');
startTime=input('Enter the Start of Time Scale : ');
fprintf('--------------... |
function ce_tf_subsys_params = define_ce_tf_model_parameters(initial_soc_percentage)
params_temp = Parameters_init_suppliedSOC_pct(initial_soc_percentage); % just to obtain the model parameters, use any arbitrary soc% as argument
% Remove any parameters which are not required in the PP2D model
params_to_remove = {'Ope... |
function skeletonInformation = normalize_skeleton_new(filename)
bodyinfo = read_skeleton_file(filename);
noFrame = size(bodyinfo,2);
noJoints =25;
list_id_BodyID = filter_skeleton(bodyinfo(1));
id_BodyID = find(list_id_BodyID);
jointXinFrame=zeros(noFrame,25);
jointYinFrame=zeros(noFrame,25... |
function [station_loc,station_name] = station_import(filename)
%station_import Imports stations.dat file to stations.mat
%
% Written By: Michael Hutchins
fid=fopen(filename);
fend=feof(fid);
s=fgets(fid);
index=1;
while fend==0
[A,a1,a2,next_index]=sscanf(s,'%g %g');
%Prevents Nanj... |
function yy = nl_lorenz(t,u)
sigma = 10;
beta = 8/3;
rho = 28;
yy = zeros(3,1);
yy(1) = -sigma*u(1) + sigma*u(2);
yy(2) = rho*u(1) - u(2) - u(1)*u(3);
yy(3) = -beta*u(3) + u(1)*u(2);
return |
function lgraph = createUnet3d(inputSize)
% Create a 3-D U-Net
%
% Copyright 2018 The MathWorks, Inc.
inputL = image3dInputLayer(inputSize,'Normalization','none','Name','input');
% Create the contracting path of the 3-D U-Net
encoder_d1 = createUnet3dEncoderModule(1,[32 64 ]);
encoder_d2 = createUnet3dEncoderModule(2... |
function ca = ArrayList2CellArray(al)
n = al.size;
ca = cell(1,n);
for i = 1:n
ca{i} = al.get(i-1);
end
end |
%em
% emDirecao8493(emDirecao8493==90) = 0;
emDirecao8493(mudaClassMagnitude8493==0) = 255;
i = mat2gray(emDirecao8493);
imwrite(i,'emDirecao8493.tif', 'tif');
% emDirecao9398(emDirecao9398==90) = NaN;
emDirecao9398(mudaClassMagnitude9398==0) = 255;
i = mat2gray(emDirecao9398);
imwrite(i,'emDirecao9398.tif', 'tif');
... |
function [avgError, percentErrors, absoluteErrors] =calibrateAndPlot(rangingData, calibrationCoeffs)
%
%this function takes data in the same format:
%data = [receiverId transmitterId estimatedDistance trueDistance]
%
%and changed the estimated distance using the calibrationCoeffs, which must
%be in a format that ... |
clc
clear all
close all
m = 60; % Define number of obdervations
load('signal.mat')
n = length(x0); % length of signal
ng_perm = floor(n/10); % number of groups
ng = n + ng_perm; % size of B (all sets) cell matrix
% Create random dictionary
A = randn( m, n );
for i = 1:n
A(:,i) = A(:,i... |
function data=puppreprocess(data,regThreshold,slopeThreshold,extremeThreshold,numSamples,weightingWidth,outofrange,outofwiderange,widerange)
% useage: data=pupblinkcorrect(data,regThreshold,slopeThreshold,extremeThreshold,numSamples,weightingWidth)
% smooths and corrects pupil data for blinks. Stores result in the ... |
classdef convLayer
%CONVLAYER Summary of this class goes here
% Detailed explanation goes here
properties
% Four dimensions of W
h; % height
w; % width
m; % input feature number
n; % output feature number
W; % Weight
b; % bi... |
%clc;close all;load E:\matlab运行结果\lya\晴_上午1355.mat
function[err,MAPE,RMSE,MBE]=wucha(data2,y,aa);
add=0;err=0;err1=0;err2=0;true=0;mre=0;
l=length(y);
for i=l-aa+1:l;
err(i)=y(i)-data2(i);
err1=err1+abs(err(i));
err2=err2+err(i)*err(i);
true=true+data2(i);
ad... |
function varargout = bootstrap_gravivac(data,nReps,active)
%% initialize parameters
data = data(:,active);
data(data<0) = 0; % shift from index to probability
nf = sum(active); % num flies
nc = sum(~isnan(data)); % num choices each individual
p =... |
%Script to make distribution plots of selected cells
%different traces
%Load Data
%Experimental Session
[expFile, basedir] = uigetfile('.mat', 'Select processed traces file for Experimental Session');
load(fullfile(basedir, expFile));
r_outexp = r_out;
clear r_out
%Control Session
[ctlFile, basedir] = uigetfile('.mat'... |
function [u,varargout]=mass_cons_int(u0,h,w,check)
% mass consistent approximation
% given
% u0 3 wind vectors on staggered grids
% h step, vector length 3
% w weights, vector length 3
% solve
% min_u 1/2 <D(u-u0),u-u0> s.t. div u = 0, D=diag[w(1)I,w(2)I,w(3)I]
% <=> min_u max_lambda 1/2 sum_i <D(u-u0),u... |
function [ out ] = gmdistFilter( rangePatch,normalPatch, filterstatus )
rangePatch=double(rangePatch);
normalPatch=double(normalPatch);
Nx=normalPatch(:,:,1); Ny=normalPatch(:,:,2); Nz=normalPatch(:,:,3);
normalPatchVector= [Nx(:),Ny(:),Nz(:)];
out = zeros(size(rangePatch));
classNum = 2;
guassian_obj = g... |
%-------------------------------------------------------------
% plik wczytujący macierz ocen wariantów
%-------------------------------------------------------------
% Hubert Gawryś 2014-03-16
% Instytut Zarządzania w Budownictwie i Transporcie (L-3)
% Wydział Inżynierii Lądowej
% Politechnika Krakowska im. Ta... |
function [Qpwr_df, Tissue_types,SigmabyRhox,Mass_cell,Mass_corr] = gen_Q_custom(dirname,SAR_type,anatomy)
%% Read input df files and generate Q matrices based on them
disp('Reading E-field files...');
t0_df = cputime;
% Air_seg = df_read(fullfile(dirname,'airSeg.df')); %Tissue density
% Tissue_types= df_read(ful... |
%{
reso.ConditionMap (imported) # site averages conditioned on reso.Indicator
-> reso.Indicator
-> reso.VolumeSlice
---
mean_map : longblob # pixelwise average for frames where reso.Indicator=1
std_map : longblob # pixelwise std for frames where reso.Indicator=1
%}
classdef ConditionMap < dj.Rel... |
function interactivemouse(figureHandle, var)
%INTERACTIVEMOUSE Interactive exploration of figures using a mouse.
% INTERACTIVEMOUSE toggles the interactive mode of the current figure.
% INTERACTIVEMOUSE ON turns on the interactive mode.
% INTERACTIVEMOUSE OFF turns off the interactive mode.
% INTERACTIVEMOUS... |
function [ euler, quat ] = tiax( G, H )
% Use: [ euler, quat ] = tiax( G,H )
% Inputs: Two matrices, G accelerometer data and H magentometer data.
% Output: Euler angles and quaternions for rotations.
% Euler output is: [ phi, theta, psi ];
% Quaternion output is: [ q0, w ] where w = { q1, q2, q3 } a vector describing
... |
function sep_kernel = get_many_kh(animal,pen,method,plot_dexp,plot_com,plot_res,store)
%% Get the seperable kernel using all the data
dir_name = ['/home/alex/Desktop/Kernels/',animal,'/'];
data_dir = ['/mnt/40086D4C086D41D0/Reverb_data/',animal,'/'];
meta_dir = ['/mnt/40086D4C086D41D0/Reverb_data/',animal,'/metadata/'... |
function sweeps = importSweeps(cellName)
root = pwd;
try
cd('c:\Data\Export\');
copyfile([cellName '*.ibw'],pwd);
cd('c:\Data\Default\');
copyfile([cellName '.ibt'],pwd);
cd(root);
catch
cd(root);
end
% First search the current directory
sweeps.commands = IBWread([cellName '_commands.ibw']);... |
function removereject_Callback(hObject, eventdata, handles)
handles.data.calls = handles.data.calls(handles.data.calls.Accept == 1, :);
handles.data.currentcall = 1;
update_fig(hObject, eventdata, handles);
guidata(hObject, handles); |
% made by Jungmin Yoon
%%%%%%%%%%%%%%%%%%% 21.02.03 : RFID(DFSA vs. FSA) %%%%%%%%%%%%%%%%%%%%%%%%%%
clc; clear all;
min_tag=100;
max_tag=1000;
interval_tag=100; % 실험할 tag 수의 간격
tag_num=(min_tag:interval_tag:max_tag); %tag 숫자
L=500; %초기 프레임 크기, 슬롯 수
num=length(tag_num); %실험할 tag 숫자의 종류
FSA_succ_num=zeros(1,num);... |
% extract giant component from a network
% INPUTS: adjacency matrix
% OUTPUTS: giant comp matrix and node indeces
% Other routines used: find_conn_comp.m, subgraph.m
% GB, Last Updated: October 2, 2009
function [GC,gc_nodes]=giant_component(adj)
comps=find_conn_comp(adj);
L=[];
for k=1:length(comps); L=[L, length(c... |
[l1, l2, l3, l4] = deal(0.4, 0.4, 0.4, 0.4);
L1 = Revolute('d', l1, 'a',0,'alpha',pi/2);
L2 = Revolute('d', 0, 'a',l2,'alpha',0);
L3 = Revolute('d', 0, 'a',l3,'alpha',0);
L4 = Revolute('d', 0, 'a',l4,'alpha',0);
vactube = SerialLink([L1, L2, L3, L4], 'name', 'vacuum tube')
%vactube.plot([30*pi/180,0,0,0])
... |
function [recPPDU, recPSDU, rxEVM, rxEst] = Receiver(rxWaveform, rxPara)
% /*!
% * @brief This function is used to simulate the receiver.
% * @details
% * @param[out] recPPDU, Lx1, rx PPDU bits.
% * @param[out] recPSDU, Mx1, rx PSDU bits.
% * @param[out] rxEVM, Kx1, rx evm in percentage.
% * @param[o... |
% [quadraturePhase, Imax] = findQuadrature( rootPath, frequency )
% rootPath - path to SysgenCryo/Base
% frequency - baseband frequency offset -250MHz - 250Mhz
%
%
% Finds quadrature etaPhase also returns max in phase response Imax
% 1. set etaMag = 1
% 2. scan etaPhase -180 to 180 degree
% 3. find min/max respons... |
function varargout = ProtoC(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @ProtoC_OpeningFcn, ...
'gui_OutputFcn', @ProtoC_OutputFcn, ...
'gui_LayoutFcn'... |
clear all
close all
clc
addpath(genpath('SparseCode'));
addpath(genpath('Util'));
load('dictionary/Dc_8_8_32.mat')
load('dictionary/Dt_8_8_32.mat')
img1=imread('sourceimages/source1.tif');
img2=imread('sourceimages/source2.tif');
figure,imshow(img1);
figure,imshow(img2);
imgf=CSMCA_Fusion(img1,img2,Dc,Dt);
figure;... |
function [W, initial_selec, p, initial_selec_gauss] = present_stimulus(stim, W, p, trial)
% present_stimulus -- present entire network (rat) with a single stimulus,
% and update weights accordingly
% called by: model
% calls: findWinningNode, calc_selectivity, calc_neigh
% input
% stim: stimulus to be trained upon
... |
function [noiseBars, aperture] = createNoiseBarStimulus(noiseStimuli, lineStimuli, blursize, compareVar)
% CREATE NOISE BAR STIMULUS
% Stimulus using sparse gratings apertures onto filtered noise
%
% noiseStimuli - a stack of filtered noise stimuli, e.g. from
% createFilteredNoiseStimulus
% lineStimuli - a st... |
function exp_info = parameter_setup()
prompt_exp_number = 'Enter the exp number for this experiment: ';
exp_number = input(prompt_exp_number);
prompt_brx_number = 'Enter the brx number for this experiment: ';
brx_number = input(prompt_brx_number);
% Experiment parameter set up
prompt_nimgtavg = 'Enter the number of i... |
function [ H ] = est_homography(video_pts, logo_pts)
% est_homography estimates the homography to transform each of the
% video_pts into the logo_pts
% Inputs:
% video_pts: a 4x2 matrix of corner points in the video
% logo_pts: a 4x2 matrix of logo points that correspond to video_pts
% Outputs:
% H: a 3x3 h... |
function [x, Cost] = LogBarrierMethod(A, b, c, t0, x0, mu, epsilon)
m = size(A, 1);
%check to see that the intial point is strictly feasible
if ( sum(A*x0 < b) < m )
error('Initial point is infeasible')
end
t = t0;
x = x0;
maxIter = 1000;
tol = 1e-6;
OldCost = inf;
for k = 1:100000,
if (m/t < epsilon)
... |
%The panel for combat type mission.
%Combat may already be a keyword in matlab, thus name was set to combatt.
classdef combatt < handle
properties ( Access = 'private' )
panel
thrustEdit
timeEdit
sfcEdit
%GUI components.
end
properties ( Access = 'privat... |
clc
clear all
close all
x = -10:0.1:10;
mf1 = trapmf(x,[-10 -8 -2 2]);
mf2 = trapmf(x,[-5 -3 2 4]);
mf3 = trapmf(x,[2 3 8 9]);
mf1 = max(0.5*mf2,max(0.9*mf1,0.1*mf3));
figure('Tag','defuzz');
plot(x,mf1,'LineWidth',3);
h_gca = gca;
h_gca.YTick = [0 .5 1] ;
ylim([-1 1]);
% Centroid
% Centroid defuzzi... |
function [Y,Cb,Cr] = color2Y(rgb)
%from Wikipedia
rgb=double(rgb);
R=rgb(:,:,1); G=rgb(:,:,2); B=rgb(:,:,3);
%[max(max(R)) max(max(G)) max(max(B))]
Y = 16 + (65.738*R +129.057*G +25.064*B)/256;
Cb = 128 + (-37.945*R -74.494*G +112.439*B)/256;
Cr = 128 + (112.439*R -94.154*G -18.285*B)/256;
|
function [savedFilePaths, parameters] = SaveFigure(figHandle, varargin)
% ------------------------------------------------------------------------
% savedFilePaths = SaveFigure(figHandle, varargin)
% This function saves the figure specified by the provided handle to the
% path set by SetFigureSavePath().
%-----------... |
%This code computes the constrained performance of the remote-state estimation
%system with one transmitter and one remote estimator connected by a
%Bernoulli packet drop channel
%Written by Jhelum Chakravorty
%Please see for theoretical reference the paper Jhelum Chakravorty and Aditya Mahajan, "Remote-state
%es... |
%% Assignment 3
%% Part1
% In this part of the assignment the code from assignmnet 1 that uses the
% Monte Carlo method to simulate random motion of electrons was modified to
% include the effects of having an electric feild exist within the
% material. In this case the simulation models a scenario where 0.1 V is
% ap... |
% -------------------------------------------------------------------------
% mpc_period_with_abitary_reference.m
% Explore MPC performance with period.
% Author: Xiaotian Dai
% https://uk.mathworks.com/help/mpc/examples/control-of-a-single-input-single-output-plant.html
% ----------------------------------------------... |
%% Stelling 15
%
% De volgende code geeft een foutmelding:
%
% --------Code-----------
% Matrix=[ 78 127 28; 291 29 12; 92 19 0];
% Matrix(1,1:3) = [32 21 32]
% ------------------------
%
Antwoord = NaN; % vul hier het juiste antwo... |
function angles = performRANSAC(points, sliceRange, repeats)
global showFigures;
displayPoints = reshape(points, [], 3);
displayPoints2 = displayPoints(displayPoints(:,3) > sliceRange(1) & displayPoints(:,3) < sliceRange(2), :);
displayPoints2 = round(displayPoints2 * 100);
thetaZ = deg2rad(90);
rotat... |
function out = Pooling(in,num,stride)
arguments
in (:,:,:,:) double
num (1,1) double
stride (1,1) double = 1
end
[col,row,~,n] = size(in);
j = length(1 :stride: col - num+1);
i = length(1 :stride: row - num+1);
out = zeros(j,i,1,n);
j_out = 0;i_out = 0;
for j = 1 :stride: col - num+1
j_out = j_out+1;
... |
function [PI, PS] = ZSpecWater(obj, freq_offsets, w1, sat_time, pH, pK_donor, concentration)
% w1 = [w1x, w1y] in rad/s
concentration_ = obj.HendersonHasselbach(pK_donor, pH, concentration);
% exchange rate
krate = obj.rateReactionInWater(pK_donor, pH);
[PI, PS] = obj.NumericalSolution(freq_offsets, w1, sat_time, kr... |
function fig = ghcltsense(varargin);
% ghcltsense(...)
% T Sense
ffig = ne_group(varargin,'T Sense','phcltsenset','phcltsensec');
if nargout > 0 fig = ffig; end
|
%% Importing data
clear all
clc
% fitresult(x,y) = b0 + b1*x + b2*y + b12*x*y + b11*x^2 + b22*y^2
%data = importdata('20170518-1300rpm-load100.xlsx');
%% Design of Experiments (DoE)
range_x1 = [0.1,0.9];
range_x2 = [1100,1400];
range_x3 = [-4,13];
% noise = rand;
%[matrix,c1,c2,c3] = matrixDesign_3var(ran... |
function [end_x, end_y] = cal_des(start_x, start_y, T, L)
dis_x = randi([1,T-1]);
dis_y = T-1 - dis_x;
candi = [ start_x + dis_x, start_y + dis_y;
start_x + dis_x, start_y - dis_y;
start_x - dis_x, start_y + dis_y;
start_x - dis_x, start_y - dis_y; ];
for temp = 1:4
if isra... |
clc;
clear all;
close all;
%% Read the image
img = imread('lena512.dib.bmp');
img = img(:,:,1);
%% Add different noise to the image
gauss_img = imnoise(img,'gaussian',0,0.01);
poisson_img = imnoise(img,'poisson');
snp_img = imnoise(img,'salt & pepper',0.05);
speckle_img = imnoise(img,'speckle',0.04);
%% Display origina... |
classdef TrialShowSingle < WBTrial
properties
condition = 0;
end
methods
function start(this)
% new trial; update trial number
trial = this.flow.variable(['Block1-TrialNum']);
trial = trial+1;
this.flow.variable(['Block1-TrialNum'], trial);
... |
% main
clear
clc
%% Controlling Parameters
Problem.obj = @Sphere;
Problem.nVar = 50;
M = 100; % Number of Chromosomes (Candidate Solutions)
N = Problem.nVar; % Number of Genes (Variables or features)
MaxGen = 10; % Maximum number of generations
Pc = 0.85; % Probability of Cross Over or Crossover F... |
function set = setAnd(set1, set2)
set = {};
for i = 1:size(set2,2)
found = false;
for j = 1:size(set1,2)
if strcmp(set1{j},set2{i})
found = true;
break;
end
end
if (true == found)
set{size(set,2)+1} = set2{i};
end
end
|
function xs_hat = WavSynthesis1D(xs_hat, h_hat, d, decimation)
% x_hat = WavSynthesis1D(xs_hat, h_hat, d, decimation)
%
% Frequency-domain implementation of the synthesis side of a single
% channel within a (dyadically decimated or undecimated) filter bank,
% along the d-th dimension of a signal.
%
% xs_hat,
% xw_hat: ... |
dj.createSchema()
session2.Mouse
session2.Session
% Insert the following data into the table
mouse_data = {
0 '2018-03-01' 'M'
1 '2017-11-19' 'M'
2 '2017-11-20' 'unknown'
5 '2017-12-25' 'F'
10 '2018-01-01' 'F'
11 '2018-01-03' 'F'
100 '2018-05-12' 'F'
};
session_data = {
0 '2... |
function [F feat_out wflag meanconf] = constructGenCrossMatrix(dataS,datinds,fsamp,N,R)
if isempty(N)
N = floor(fsamp/R.obs.csd.df);
end
if ~isfield(R.obs,'logscale')
R.obs.logscale = 1;
end
wflag = 0;
N = fix(N); %Ensure integer
if ~isfield(R.obs.trans,'polydetrend')
R.obs.trans.polydetrend = 0;
end
% Co... |
% Author: Eseoghene Okonofua
% Created: 2017-09-11
% Distance-of-Line-and-Point
% Input:
% ([linePoint1x, linePoint1y, linePoint1z], [linePoint2x, linePoint2y, linePoint2z],
% [PointX, PointY, PointZ])
% Output:
% Distance
function Distance = Distance_of_Line_and_Point (linePoint1, linePoint2, point)
% Chec... |
function [problemFlag,problemsProteinProtein,problemsLPSLPS,problemsProteinLPS,problemsProtein,problemsLPS] = checkPolygonDistances(model,tooClose)
problemFlag = 0;
problemsProteinProtein = [];
problemsLPSLPS = [];
problemsProteinLPS = [];
problemsProtein = [];
problemsLPS = [];
% first we check for protein-protein i... |
function [acfOverAmdf, acf, amdf]=frame2acfOverAmdf(frame, maxShift, method, showPlot)
% frame2acfOverAmdf: ACF/AMDF of a given frame (primarily for pitch tracking)
%
% Usage:
% out=frame2acfOverAMDF(frame, maxShift, method, showPlot);
% maxShift: no. of shift operations, which is equal to the length of the output v... |
%[2009]-"Cuckoo search via Levy flights"
% (9/12/2020)
function CS = jCuckooSearchAlgorithm(feat,label,opts)
% Parameters
lb = 0;
ub = 1;
thres = 0.5;
Pa = 0.25; % discovery rate
alpha = 1; % constant
beta = 1.5; % levy component
if isfield(opts,'N'), N = opts.N; end
if isfield(o... |
function Merge_and_Congdon2012Algo_autotest()
% MERGE_AND_CONGDON2012ALGO_AUTOTEST: correct SSRTs and data selections
% from an artificially prepared dataset using 12 different methods of SSRT
% calculation, as described in 'Measurement and Reliability of Response
% Inhibition' by Congdon et al. (2012) in Frontiers i... |
% Call Syntax: rPMaxExtrapol = rPMaxExtrapol_s(rPM, rPm, quntL)
%
% Description: This function performs Time-mirrored top extrema (Parabolic Maxs) extrapolation
%
% Input Arguments:
% Name: rPM
% Type:
% Description:
%
% Name: rPm
% Type:
% Description:
%
% Name: quntL
% Type:
% Description:
%
% Outp... |
function [phi_n Lambda_n] = dmd_sorted(phi, Lambda)
[Lambda_n, I] = sort(abs(diag(Lambda)), 'descend');
phi_n = phi(:, I);
Lambda_n = diag(Lambda);
Lambda_n = Lambda_n(I);
Lambda_n = diag(Lambda_n);
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.