text stringlengths 8 6.12M |
|---|
function [matA_g, matB_g, matC_g, matB, matE] = calcSysMatrixKleinStoer(sys)
% berechne die Systemmatrizen der Laufkatze ohne Winkeldynamik inklusive
% Störmodell des Spannungsoffset
% wird für die Berechnung des reduzierten BEO, des kleinen Kalman Flter und die
% Störgrößenaufschaltung benötigt
matA = [0 1;
... |
function [x1,x2] = vad(x)
%幅度归一化
x = double(x);
x = x / max(abs(x));
%常数设置
FrameLen = 240;
FrameInc = 80;
amp1 = 10;
amp2 = 2;
zrc1 = 10;
zrc2 = 5;
maxsilence = 8; % 3*10ms = 30ms
minlen = 15; % 15*10ms = 150ms
status = 0;
count = 0;
silence = 0;
%过零率计算
tmp1 = enframe(x(1 : length(x) - 1), FrameLen, FrameInc);
tmp... |
%%Create a live streaming video input directly from the camera
vid = videoinput('winvideo', 1, 'MJPG_1280x720');
src = getselectedsource(vid);
vid.FramesPerTrigger = 220;
% vid.LoggingMode = 'disk';
vidWriter = VideoWriter('C:\Users\Surafel Nigussie\Documents\MATLAB\Live Stream\stream2.avi');
open(vidWriter);
% previe... |
%% Main
% real u = sin (pi*x)
% real p = Gu
% p = 2/(delta^2)*1/pi*(cos(pi*(x-delta))-cos(pi*x))-2/(delta)*sin(pi*x)
% RHS f = -G^*G u
% G^*G u = 4*sin(pi*x)/(delta^2)+16*(sin((pi/2)*delta))^2*sin(pi*x)/(delta^4*pi^2)-8*sin(pi*delta)*sin(pi*x)/(delta^3*pi)
%
%
%% ------------------------------------------... |
function [U_Labels ] = myNewEstimate_Image_Labels( X_labels,Y,Beta,Means,Sigma_2,mask)
O=myObjective_Function_Calculator(Y, X_labels,Means,Sigma_2,Beta,mask);
U_Labels=X_labels.*mask;
Labels=zeros([size(X_labels) 3]);
Labels(:,:,1)=myEstimator(Y,Means,Sigma_2,X_labels,1,mask,Beta);
Labels(:,:,2)=myEstimator(Y,Mean... |
function [ratings resp_t interval hasconfirmed] = ratingsSlider(window,vars,rs,trials,t,agent)
%% initialize variables
resp = 0;
buttons=[];
haschanged=false;
hasconfirmed=false;
int=0;
Sc = window;
if (agent == 1)
rs.bar.positiony = .4;
% rs.instr.... |
%% No saveDat
clear all
T=readtable('../Summary_Data_800_Gals/PatientInfo07192021.csv');
ct=0;
ct1=0;
ct2=0;
ct3=0;
ctfile=0;
%'HPV592_20150825_optimized.mat','HPV592_20151211_optimized.mat','HPV593_20160419_optimized.mat'
%pt = 654,655,656
%have no saveDat, suggesting major workspace issue/ spreadsheet
for pt=3:872... |
% Main Code - simulate data & fit with all models
% 1/14/2016 Marisa Eisenberg (marisae@umich.edu)
clear
%% Notes
% Files this needs: all the ode functions listed in models, as well as:
% cost_ML.m, fisher.m (if you want FIMs), AngolaData.m (if using data from
% Angola epidemic).
% How to use this code:
% - All... |
function avgHue = avgHueFunction(label,Hue)
numRow = size(Hue,1);
numColumn = size(Hue,2);
avgHue = zeros(numRow,numColumn);
for m = 1:numRow
for i = 1:max(label(m,:))
avgHue(m,i) = mean(Hue(m,label(m,:)==i));
end
end |
% Wrapper Feature Selection Toolbox
% There are more than 40 wrapper FS methods are offered
% You may open < List_Method.m file > to check all available methods
%---Usage-------------------------------------------------------------
% If you wish to use 'PSO' (see example 1) then you write
% FS = jfs('pso',f... |
% -------------------------------------------------------------------------
%
% PLOTTING ARRAY OF RESPONSE FUNCTIONS USING VISUALLY WEIGHTED REGRESSION
%
% Fig. 2 in Hsiang, Burke and Miguel 2013
%
% -------------------------------------------------------------------------
clear
close all
%---------------------... |
% p = formaNewton(ptx, fi)
% Calcolo dell'espressione del polinomio interpolante una funzione in
% forma di Newton.
%
% Input:
% -ptx: vettore contenente le ascisse di interpolazione;
% -fi: i valori assunti dalla funzione da interpolare in
% corrispondenza delle ascisse di interpolazione in ptx.
% Output:
% -p... |
function [funstr,funstrwords,funstrwords_b,funstrwords_e,funstrnumbers,funstrnumbers_b,funstrnumbers_e,s]=updatefunstr_full(funstr,funstrwords,funstrwords_b,funstrwords_e,funstrnumbers,funstrnumbers_b,funstrnumbers_e,oneline)
s=length(funstr);
to0out={'.*','./','.''','.^'};
if nargin==1
lo=1;hi=s;
funstrwords=cell(s,... |
%定延迟和阶数函数rels3
function J=rels3(z,na,nb,nc)
%nz=size(z(:,1)); %z的行数数据行数 1499
nn=na+nb+nc+1;
thitak=ones(nn,1)*0.001;
thita=zeros(nn,501);
K=zeros(nn,1);
I=eye(nn,nn);
p1=eye(nn,nn)*(1.0e6);
p2=zeros(nn,nn);
e=zeros(501,1);
J=zeros(1,5);
for d=0:4
for i=na+1+d:501;
Q=[... |
function varargout = rowind(varargin)
% function ind = rowind(sz,r)
% or A = rowind(A,r)
% or [A,ind] = rowind(A,r)
%
% Returns an index that references a matrix of size sz at row r(i) and
% column i, for all columns i (or higher order dimensions). Alternatively,
% you can pass a matrix A and it will retur... |
function result = segment_body(current_depth, face_info, parameters)
% result = segment_body(current_depth, face_info, parameters)
if (nargin < 3)
extra_depth = 100;
% depth_edge_low = 10;
depth_edge_high = 200;
else
extra_depth = parameters.extra_depth;
% depth_edge_low = parameters.depth_e... |
%------------------------------------------------------------------------------------
% fun_w_windows.m
%
% computes a few statistics with over the specified windows
%
% calls: window_wmean_fun
%
% levi silvers june 2017
%----------------------------------... |
function [sensorNamesCellArray, signalNamesCellArray, formatNamesCellArray, signalUnitsCellArray, sensorDataArray] = loadshimd(filePath)
%LOADSHIMD - Reads Shimmer data from a file which uses SHIMDv1 or
% SHIMDv2 formats.
%
% LOADSHIMD(FILEPATH) loads the header and numeric data from the file
% defined... |
addpath( genpath('/home/kdawg/Desktop/PEITS/dune-peits/matlab'))
mname='GSK_16_1';
load('Mesh_16.mat');
load pos.mat;
load('for_image_EIT3_P_6025Hz_10uA_20s_Prt1_200ms_..mat','Prt_0');
pos = [pos zeros(length(pos),1)];
electrodepositions = [pos; [0,0,1]] ;
z_gnd=min(Mesh.Nodes(:,3));
x_gnd=0;
y_gnd=0;
gnd_pos = [x_... |
function [fig]=ASET_PlotXS(cof,Method)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This function plot the Cross section contour map. The variables possible
% are Velocity, Ms2, Gss and Gw.
% by Dominguez Ruben, L. FICH-UNL
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
unio __attribute((< |
function [] = joc()
% Prompt user with options
fprintf('Welcome to Tic-Tac-Toe!\n')
nrPlayers = str2double(input('Enter the number of human players: ', 's'));
if isnan(nrPlayers) || ceil(nrPlayers) ~= nrPlayers || nrPlayers < 1 || nrPlayers > 2
nrPlayers = 0;
pPlayer = false(2, ... |
function color = last_color(n)
if nargin==0
n = 1;
end
% returns last color used in current axes
colors = get(gca,'ColorOrder');
index = get(gca,'ColorOrderIndex');
if index<=n
%disp([num2str(index) ', checking 1']);
index = 1;
else
%disp([num2st... |
function [solution, sol] = sudoku2(S)
%This function used to solve sudoku by constraint planning method
%This function was inspired by https://yalmip.github.io/example/
%input: S 9x9 sudoku matrix
%output: solution 9x9 sudoku result matrix
% sol binary result, 1 for yes this sudo... |
function hvar_new = f_AnalisisBif(eps_new,hvar_new,e_DatSet,e_VG)
ntens = e_VG.ntens;
nElem = e_DatSet.nElem;
e_DatElemSet = e_DatSet.e_DatElem;
e_DatMatSet = e_DatSet.e_DatMat;
nPG = e_DatElemSet.npg;
m_Ce = e_DatMatSet.ce;
poiss = e_DatMatSet.poiss;
E = e_DatMatSet.young;
gfv ... |
% Thompson sampling probability densities based on multivariate normals.
% see Speekenbrink & Konstantinidis 2015
function [mo] = mvnorm_Thompson(mo,idx_hor,idx_g,t)
%% settings
% x = [.05:.1:30.05]'; % resolution of density
%% load parameters
A = mo.mat.A;
%% load in current values
Q = mo.mat.Q{idx_h... |
% 1. load frames from video file.
% 2. downscale frames by scale 2.
function [frms, frms_scaled] = load_frames(file, width, height, noof)
frms = zeros(height, width, noof);
frms_scaled = zeros(height/2, width/2, noof);
ffid = fopen(file, 'r');
for j = 1:noof
fseek(ffid, 1.5 * width * height * (j-1), 'bof')... |
%% Applies the parameters in a .dmb to a user defined s+election of videos
restoredefaultpath; clear all; close all; clc; %#ok<*CLSCR>
if ~isempty(strfind(version, '2014a')) % TODO, check for other versions than 2014a
error('Please use Matlab 2014b or later');
end
%% Get fx's
addpath(fullf... |
function [data] = channel(data, pr)
size = length(data);
for i = 1:size
err = rand(1,1);
if err < pr
data(i)=not(data(i));
end
end
end |
function guiMessageHandler(varargin)
feval(varargin{:});
function ident(text)
global TESTBED;
TESTBED.identReported(TESTBED.nodeIDs==text.routing_origin)=1;
function service(text)
global TESTBED;
if text.RunningService==50
TESTBED.serviceReported(TESTBED.nodeIDs==text.routing_origin)=1;
end
function chirpSent(te... |
function integrate(Wq,Mq,Aq,DATAq,trap,simp)
%%%%%%%%%%%%integrate values%%%%%%%%%%%%%
%trap rule
if(trap==1)
int=0;
wsum=0;
for i=1:numel(Mq(:,1,1))
if(i==1 || i==numel(Mq(:,1,1)));
wi=1/2;
else
wi=1;
end
for j=1:numel(Wq(1... |
% Load the data from our text file
data = load('./data.txt');
% Define x and y
x = data(:,2);
y = data(:,1);
% Create a function to plot the data
function plotData(x,y)
plot(x,y,'rx','MarkerSize',8); % Plot the data
end
% Plot the data
plotData(x,y);
xlabel('Rate of Cricket Chirping'); % Set the x-axis label
ylabe... |
function [pdot] = riccasim(t,p)
% Hadi Saadat, 1998
% This function obtains the numerical solution of the time-domain Riccati
% equation with the boundary condition specified at final time.
global A B Q R t0 tf x0
[A,B,Q,R,t0,tf,x0]=system(A,B,Q,R,t0,tf,x0);
n=length(A); nsq=n*n;
s=reshape(p,n,n)';
r=inv(R)... |
allclasses = '/home/rajiv/ACADS/Sem7/PR/Assignment1/Dataset-2_real_world/b_Speaker Identification and Verification dataset/Folders_team_wise/Team2/' ;
trFile1 = strcat(allclasses,'fgcs0/trSet1') ;
vaFile1 = strcat(allclasses,'fgcs0/vaSet1') ;
teFile1 = strcat(allclasses,'fgcs0/teSet1') ;
trFile2 = strcat(allclas... |
function generate_plu_eqs_maple(projs, lprojs, vis_p, vis_l, at, bt, ct, dt, et)
A = model.eq_generator_plu_real(projs(1:2,:,:), lprojs, vis_p, vis_l);
R2Q = zeros(9, 10);
R2Q(1, [7 8 9 10]) = [1 1 -1 -1];
R2Q(2, [4 3]) = 2;
R2Q(3, [5, 2]) = [2, -2];
R2Q(4, [4 3]) = [2, -2];
R2Q(5, [7 8 9 10... |
function ocr_multiLambda(dataPath, resultPath, lambda_grid, gap_threshold, ...
num_passes, time_budget, sample, useCache, cacheNu, cacheFactor, ...
maxCacheSize, stepType, gap_check, warm_start_type, rand_seed, datasetName )
lambda_grid
gap_threshold
num_passes
time_budget
sample
useCache
cacheNu
cacheFactor
m... |
% Function to print a pdf, eps and tiff file of the current figure
function my_print(print_file_name)
figure_dimensions = get(gcf, 'Position');
figure_height = figure_dimensions(4);
figure_width = figure_dimensions(3);
aux = get(gca,'TightInset');
% set(gca,'Position',[aux(1),aux(2),1-aux(1)-aux(3),1-aux(2)-a... |
function CRRlsTEST(f0,f1,p0,p1,d0,d1,t)
arg0 = 2*(2*pi*f0.*t + p0);
arg1 = 2*(2*pi*f1.*t + p1);
Cp0 = cos(arg0);
C2p0 = cos(2*arg0);
Sp0 = sin(arg0);
S2p0 = sin(2*arg0);
Cp1 = cos(arg1);
C2p1 = cos(2*arg1);
Sp1 = sin(arg1);
S2p1 = sin(2*arg1);
Cd0 = cos(d0);
Sd0 = sin(d0);
Cd1 = cos(d1);
Sd1 = sin(d1);
a = sin(d0);
b =... |
% Load data from
% path1/folder_name/file_name
% And combine multiple files into one big file
% V1.0 September 20, 2016
% V1.1 October 30, 2016. Corrects error where some fields were not combined
%
% Inputs
% path1 - path to the subject folder, with all dates inside it
% folder_index - list with every folder name insi... |
close all
clear all
N = 4;
iters = 600;
Ts = 0.01;
A = zeros(N,N,iters);
A(:,:,1:200) = repmat([0 1 0 0; 1 0 1 0; 0 1 0 1 ; 0 0 1 0 ],1,1,200);
A(:,:,201:300) = repmat([0 1 0 1; 1 0 1 0; 0 1 0 1 ; 1 0 1 0 ],1,1,100);
A(:,:,301:400) = repmat([0 1 0 1; 1 0 1 0; 0 1 0 0 ; 1 0 0 0],1,1,100);
A(:,:,401:end) = repmat([0 1 ... |
function predicted=idpredict(model,z,horizon)
y=z(:,1);
u=z(:,2);
yLength=size(z,1);
predictions=zeros(yLength,horizon);
uTmp=zeros(yLength,model.n(2));
yTmp=zeros(yLength,model.n(1));
for i = 1:m.n(2)
uTmp(i+1+model.n(3):end, i) = u(1:end-i-model.n(3));
end
for i = 1:m.n(1)
yTmp(i+1:... |
% Algorithme de *Ford-Fulkerson* pour les tensions
%ANT : matrice des connexions
%som : numero du sommet en cours
%maxi : le chemin le plus long pour arriver au sommet som
%ind : numero du sommet antecedant ou aller pour trouver le chemin critique
function [maxi, ind] = maxchemin(ANT,som)
ante = []; %vecteur des ant... |
classdef OperationContext < azure.object
% OPERATIONCONTEXT class used for client settings such as proxy servers
% This context will set the default proxy values based on the MATLAB preferences
% where set and on Windows the system preferences. To override this behavior call
% setDefaultProxy() subseque... |
function [] = plotPhase_distributions_function_hilb(phase,desiredF,sid,subjectNum,chan,type,OUTPUT_DIR,saveIt)
% plot phase distribution
figure
histogram(rad2deg(phase))
title({['Subject ' num2str(subjectNum) ' distribution of phases '],[' on the hilbert analytic signal for Phase ' num2str(desiredF) char(176)],['Cha... |
function fdata = doFourier(data)
N_data = size(data,1);
%T = 1/Fs; % Sample time
L = size(data,2); % Length of signal
%t = (0:L-1)*T; % Time vector
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
for i=1:N_data
%
Y = fft(data(i,:),NFFT)/L;
fdata(i,:) = abs(Y(1:NFFT/2+... |
function title_plots(head,x_lab,y_lab,FontSize)
% title_plots(head,x_lab,y_lab,FontSize)
% head = header of plot
% x_lab = x label for plot
% y_lab = y label for plot
% FontSize = font size of the plot labels
% Info:
% By: Matthew Luu
% Last edit: 10/18/20
% titling plots
% Begin Code:
title(head,'Font... |
function [C] = chancap1d1d(Hx,jeff,V,var,par1_span)
% Function [C]=chancao1d1d(Hx,jeff,V,var,par1_span)
% calculates exact Channel Capacity for 1 input and 1 output of a given
% biological system, simulated by StochSens package.
%
% C - exact value of Channel Capacity
% Hx - entropy of output
% jeff - Jeffrey's prior... |
%% LOLA-Voronoi (LOLA)
% Crombecq, Karel, et al. "A novel hybrid sequential design strategy for global surrogate modeling of computer experiments."
% SIAM Journal on Scientific Computing 33.4 (2011): 1948-1974.
function x_new = LOLA_function(obj,A)
%%
% Details: Obtain new sample point via LOLA sampling algorithm
%
% i... |
clc
clear all
addpath('../ROUTINES/')
set(0,'defaultAxesTickLabelInterpreter', 'default');
set(0,'defaultTextInterpreter','latex');
set(0, 'DefaultLegendInterpreter', 'latex');
set(0,'defaultAxesFontSize',13)
%% Load Reference Data
exx = load('../FULLJOINT_REF/DATS/RUN2.mat', 'QS', 'WS', 'ZS', 'DS','ZSM','BBS');
%... |
%demo final
N = 100000;
L = 2;
opt.window = 'kaiser_poly';
opt.box = [L,L,L];
[x, f] = SE_charged_system(N,opt.box,'vector');
F = norm(f.^2)
opt.xi = 15;
tolerance = 10^(-10);
opt.N = N;
opt.x =x;
opt.f = f;
t = tic();
opt = param_select_stokes(tolerance, opt);
t_par = toc(t);
t = tic();
u = SE3P_Stokes(1:N, x, f, op... |
clc; clear all;
%% REAL JACOBIAN
% Assuming to have direct T - X_world_robot
syms adx bdx gdx tdx tdy tdz px py pz real;
Rx = [1 0 0; 0 cos(adx) -sin(adx); 0 sin(adx) cos(adx)];
Ry = [cos(bdx) 0 sin(bdx); 0 1 0; -sin(bdx) 0 cos(bdx)];
Rz = [cos(gdx) -sin(gdx) 0; sin(gdx) cos(gdx) 0; 0 0 1];
pw = [px py pz]';
t = [td... |
%Distance de l'image
z = 0.3;
f_number = 1;
lambda = 500E-9;
%Nombre de point dans la pupille
np = 501;
%Nombre de fois la taille de pupille autour de la TF
pad_size = 2;
pad_vect = pad_size.*[np np];
n_tot = (2*pad_size+1)*np;
%Pupille de rayon 1
pupille = circle_array(np);
%Échelle de la pupille
x_pupille = linspace... |
%% VNF流示意图
function Flow_Illustration(LogicPara)
FlowSequency = LogicPara.FlowSequency;
FlowName = LogicPara.FlowName;
vPosition = strfind(FlowName,'v');
vPosition = [vPosition,length(FlowName)+1];
Ns = max(FlowSequency);
% Check the number of labels
if length(vPosition)-1 ~= Ns
error('Label Number Incorrect');
en... |
%% --------
% QC_01_04_InLineVsDepth(MeasCat)
% Displays cross section of the fault
% Input: MeasCat - Measured catalogue, coordinates of a rotation point and
% the fault azimuth in degrees measured clockwise from north
% Rotation = [ZeroLat, ZeroLon, FaultAzimuth]
function QC_01_04_XLineVsDepth(MeasCat, Rotation,... |
%% recording list for juxtasomal vpl recordings
cfa ={'Z:\Sailaja\Manuscript\Data\Juxtasomal\CFA\M107_C2\M107_C2_Mech+5mW_UMS_analysis.mat'
'Z:\Sailaja\Manuscript\Data\Juxtasomal\CFA\M110_C4\M110_C4_Mech+6mW_UMS_analysis.mat'
'Z:\Sailaja\Manuscript\Data\Juxtasomal\CFA\M110_C5\M110_C5_Mech+6mW_UMS_analysis.mat... |
% test_2d_kriging : Goovaerts Example Chapter 5 Simple Kriging
[data,header]=read_eas('prediction.dat');
x_obs=data(:,1);
y_obs=data(:,2);
pos_obs=[x_obs y_obs];
val_obs=data(:,6);
nobs=length(x_obs);
x=[min(x_obs):.1:max(x_obs)];
y=[min(y_obs):.1:max(y_obs)];
%y=3;
%x=3;
nx=length(x);
ny=length(y);
V='0.3 Nug(0) ... |
clc
clear all
z=[-1 -5 -5 -7 -7 -15];
p=[-0.1+0.05i -0.1-0.05i -2 -3 -10 -20 -50];
k=1000;
Gs=zpk(z,p,k);
sys=tf(Gs);
[N,D]=tfdata(sys,'v');
n=max(size(D));
% rth order reduced model
r=3;
num=N(n-r+1:1:n);
den=D(n-r:1:n);
Rs=tf(num,den); |
clear;
clc;
close all;
%% ______________________________task_4.1__________________________________
m = 0;
S = 1;
P = 1/2;
N = [32 256 5000];
for i=1:3
X{i} = rand(1,N(i))*2;
end
x = -1:0.1:3;
pdfx = (1/2)*(x>0 & x<2);
%% ------------------------------task-4.1.a-------------------------------... |
function [v1 v2] = get_points(poly_coeff)
% Returns two points for a line from the given poly_coeff
x = [0 1];
y_fit = polyval(poly_coeff, x);
v1 = [0 y_fit(1) 0];
v2 = [1 y_fit(2) 0];
end |
function dominance()
maxTime = 10;
T = [.5 -.866;.866 .5];
x_0 = [10;-10];
%% DO NOT EDIT ANYTHING BELOW THIS LINE
clc;
close all; figure; hold on; grid on
xx = linspace(-1e9,1e9,2);
[V,D] = eig(T)
if isreal(V) == 1
plot(xx*V(1,1),xx*V(2,1),'k','LineWidth',2);
plot(xx*V(1,2),xx*V... |
hold all;
grid on;
x=0.001:0.00015:20
tau=4;
for m= 1:25
plot(x,6*(exp(-(2*pi*0.14)./(tau.*x))), 'linewidth', 1);
end |
function [ df ] = ngrad( f, x, dx )
%NGRAD numerical gradient approximation
% RMSTODO: check if this actually works, let dx be a vector
n = size(x,1);
val = f(x);
for i = 1:n
xi = x;
xi(i) = xi(i) + dx;
df(i) = val - f(xi);
end
|
length=size(labelT,1);
labelN=zeros(length,1);
for i=1:length
if(labelT(i)~='')
labelN(i)=find(ismember(beepList,labelT(i)));
else
labelN(i)=-1;
end
end
%%
fileNamesNew2=fileNamesNew;
for i=1:size(fileNamesNew,1)
fileNamesNew2(i)=strjoin(strsplit(fileNamesNew(i),'Clips/straightcam/... |
clear all
close all
clc
%%
DH = @(theta1,theta2,theta3,theta4,theta5,theta6)[pi/2 25 theta1 400;
0 315 theta2 0;
pi/2 35 theta3 0;
-pi/2 0 theta4 365;
pi/2 0 theta5 0;
0 156 theta6 161.44];
DH_forces = @(theta1,theta2,theta3,theta4,theta5,theta6)[pi/2 25 theta1 400;
0 315 theta2 0... |
function [stop_flag,state_new_out]=updateFrame(command,state_old)
% state contains the position of the previous point (:,1) and
% the current point (:,2).
stop_flag=false;
state_new_out.num_of_run=state_old.num_of_run;
state_new_out.user1_min=state_old.user1_min;
state_new_out.user1_max=state_old.user1_max;
stat... |
%% MPCC_path
% Update Income path
cond = 2*tol*1e2;
Y_ss = steady.Y_ss;
y1_out = paths.mu_w_t(1,:)*eta_l+Y_ss*(1-eta_l)+RT_t;
y2_out = paths.mu_w_t(2,:)*eta_l+Y_ss*(1-eta_l)+RT_t;
y_out = [y1_out; y2_out];
while cond>tol*1e2
spreadea = rsp_t;
% Update Income
y=y_out;
% solves HJB backward... |
function matExplicitRK222( obj )
[EXa, IMa, EXb, IMb, c] = GetRKParamter();
time = obj.startTime;
ftime = obj.finalTime;
fphys2d = obj.fphys2d;
fphys = obj.fphys;
%> allocate space for the rhs to be stored
ExplicitRHS2d = zeros(obj.mesh2d(1).cell.Np, obj.mesh2d(1).K,3);
ExplicitRHS3d = zeros(obj.meshUnion(1).cell.Np, ... |
function [alpha,exp_r,xp] = spm_BMS(lme, Nsamp, do_plot, sampling, ecp, alpha0)
% Bayesian model selection for group studies
% FORMAT [alpha, exp_r, xp] = spm_BMS (lme, Nsamp, do_plot, sampling, ecp, alpha0)
%
% INPUT:
% lme - array of log model evidences
% rows: subjects
% columns: mod... |
%Blurring and Deblurring an image
%Write down code for blurring and de-blurring of a gray scale images;
%compare in terms of PSNR between blurring and de-blurring images
clc;
clear;
close all;
%matlab program for debluring a motion blurred image using wiener filter
I = im2double(imread('cameraman.tif'));
%Simul... |
function color_transfer_lalphabeta(S,T);
figure;
subplot(1,3,1)
imshow(S)
title('Source');
subplot(1,3,2)
imshow(T)
title('Target');
imwrite(S,'source.jpeg');
imwrite(T,'target.jpeg');
S = double(S)/255;
T = double(T)/255;
S = rgbtolalphabeta(S);
... |
% Este programa retorna a resposta do exercício 15 da lista 1.
disp('15) Calcule os diâmetros primitivo, interno e externo, a altura do dente e o passo de uma engrenagem cilíndrica de dentes retos com 45 dentes e módulo 4.')
Z=45 % números de dentes.
m=4 %módulo.
disp('15)As respostas do exercício 15 da lista 1 são... |
function imgout = psort(imgin, thresholds, sortOptions, sortDir, sortWave, sortLambda)
%PSORT funky pixel-sorting algorithm with arbitrary angle and path waviness
%
% PSORT(image) initiates a series of user prompts to sort specified
% regions of pixels in an image. The user is given as many chances to
% sor... |
function B = repmatC(varargin)
%#PMTKmex
B = repmat(varargin{:});
end |
function [p1, p2] = calc_probaprio2(X, cl1, cl2)
N = length(X);
nbp1 = sum((X==cl1));
p1 = nbp1 / N;
p2 = 1 - p1;
end |
function ShowImage(Img_Matrix)
[row , column] = size(Img_Matrix);
figure_Matrix = uint8(zeros(100 * row, 100 * column));
for i = 1:1:row
for j = 1:1:column
temp = uint8((Img_Matrix(i,j) + 1) * 127.5 );
figure_Matrix(((i-1) * 100 + 1) : (i * 100) ,(j-1) * 100 + 1 : j * 100 )... |
classdef krogstad < spinscheme
%KROGSTAD Implements the KROGSTAD scheme.
%
% See also SPINSCHEME, EGLM433, ETDRK4, EXPRK5S8, PECEC433.
% Author: Hadrien Montanelli.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% CLASS CONSTRUCTOR:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
%Skeleton Script for implementing exercise 1 with Reaction Band.
%This script needs to be kept in the same folder as the other scripts e.g.
%'Client.m' etc. which comes as part of the Vicon Datastream SDK for it to function properly.
%SUPER DUPER IMPORTANT: There two dependencies which need to initialised before t... |
file_path = 'C:\Users\Ali\Documents\ISML\MEA Data\20170622_400_0\';
stim_frq = [0,1, 0.5, 0.33, 1, 1, 1, 0.33, 0.33, 0.33, 0, 0];
file_num = [33,34,37,40, 60,62,65,72,74,76, 73,75, 35,74];
electrodes = [46, 64];
decimator = 100;
f_sampling = 25000/decimator;
%% Annotate and Extract States
for f = 1
file_name = ['... |
% Author: Rainer Storn, Ken Price, Arnold Neumaier, Jim Van Zandt
% Modified by FLC \GECAD 04/winter/2017
deParameters.I_NP= 10; % population
deParameters.I_itermax=100;
%% DE parameters
deParameters.F1= 0.7; %Scalar number
%% BEE parameters
deParameters.L=10; %limit (bees scout)
deParameters.I_bnd_co... |
function result = read_training(dataset_name, vocabulary)
% function result = read_training(dataset_name, vocabulary)
dirname = dataset_directory(dataset_name);
filename = labels_filename(dataset_name);
number = numel(vocabulary);
class_ids = zeros(number, 1);
filenames = cell(number, 1);
fid = fopen(fil... |
function string = append(cells)
%beta. works with cells array of strings or double but not with double
%vectors
try
check = strcmp(class(cells(1,1)), {'double'});
catch
check = 0;
end
string = {''};
if check == 1
for k = 1:numel(cells)
if k==1
string = strcat(string,n... |
% Copyright 2017 Abhinav Agarwalla. All Rights Reserved.
% Contact: agarwallaabhinav@gmail.com, abhinavagarwalla@iitkgp.ac.in
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Finite Difference Method solution to %
% Characteristic Impedance of a Microstrip Line %
% %
% Author: Ata Niyazov %
% Student ID: 1... |
%%多种群遗传算法
%每一次运行都得到相同的结果,收敛性强
clear;
clc
close all
NIND =40; %个体数目
NVAR = 2; %变量的维数
PRECI = 20; %变量的二进制位数
GGAP = 0.9; %代沟
MP=10; %种群数目
% 译码矩阵
FieldD = [rep(PRECI,[1,NVAR]);[-3,4.1;12.1,5.8];rep([1;0;1;1],[1,NVAR])];
%对于每一个种群
for i = 1:MP
%创建初始种群
Chrom{i} = crtbp(NIND,NVAR*PRECI);
end
%在[0.7,0.9]区间内随机产生交叉... |
function W_fuelSystem = W_fuelSystem(numTanks, volumeTankTotal, volumeSelfSealingTank, volumeIntegralTank)
% this function calculates the weight of the fuel system in lb
% INPUT
% volumeTankTotal = total volume of fuel tanks (gal)
% volumeSelfSealingTank = self sealing fuel tank volume (gal)
% volumeIntegralTank... |
%SingleTrial_MWP.m - 2018 - Kyle Mathewson and Sayeed Devraj-Kizuk
%set of code to analyze the Moral word ERP project (https://osf.io/5jmze/)
%load in behavioural datasets and put everything in a big spreadsheet
%save csv file with data for analysis
addpath('subfunctions')
ccc
eeglab
%% load in settings and ... |
clc
clear all;
close all;
% im = double(rgb2gray(imread('/Users/INNOCENTBOY/Downloads/videos/Imageprocessing/week6/original_cameraman.jpg')));
% im = imresize(im,[256,256]);
i = 1:4;
mat = reshape(i,2,2)';
Mu=3.999; % Parameter of map
xlog= 20;
ylog= 22;
zlog= 19;
k_5 = 34;
k_6 = 40;
k_7 = 36;
for k=2:numel(mat)+2
... |
close all;
clear all;
clc;
%dataset = '/home/pang/maplab_linux/calibrate_result/2018-10-19_07-33-26/';
dataset = '/home/pang/maplab_linux/calibrate_result/2018-10-26_10-59-27//';
vio_odom = load([dataset '/vio_odom.txt']);
original_integrate_odom = load([dataset '/original_integrate_odom.txt']);
re_integrate_odom = l... |
% ti_gaussian_truncated: Gaussian based trainig image
%
% Call=
% TI=ti_gaussian_truncated(n,r,lev,cov_typ);
%
% TI=ti_gaussian_truncated; % 30x30x30 TI, 2 cat
% TI=ti_gaussian_truncated([20 20]); % 20x20 TI , 2 cat
% TI=ti_gaussian_truncated([20 30 20],7,[-.1 .1]); % 20x30x20 TI, 3 cat,range 7
% ... |
function checkVariables(obj, x, tol, output_file, permission)
% Check the violation of the constraints
if nargin < 3
tol = 1e-3;
end
if nargin > 3
% print to the file
if nargin < 5
permission = 'w';
else
validatestring(permission, {'... |
function [smap] = saliency_sim(input_image,image_path)
if size(input_image,3) < 3
input_image(:,:,2)=input_image(:,:,1);
input_image(:,:,3)=input_image(:,:,1);
end
[m n p] = size(input_image);
window_sizes = [13 26]; % window sizes for computing center-surround contrast
wlev ... |
function [sig,msg]=dsss_modulation(primdf,init_states,sample_fs,carry_fs,chip_bps,src_bps,src)
% Direct-sequence spread spectrum test with matlab
% input:
% primdf -- primitive polynomials for a Galois field
% ini_states -- the initial states for commsrc.pn
% sample_fs -- sample frequence for the... |
function [start_ind,end_ind]= getSessionForClass(sizes,class)
start_ind=0;
end_ind=sum(sizes(1:class,:));
if class==1
start_ind=1;
else
start_ind=sum(sizes(1:(class-1),:))+1;
end
end
|
%Get user inputs for folder
%[filename pathname] = uigetfile('*.avi', 'select first movie');
%[tagfile tagpathname] = uigetfile('*.csv', 'select taglist file');
masDir = uigetdir(pwd, 'Choose parent directory');
subDirs = dir(masDir);
subDirs = subDirs(3:end); %Ignore first two elements in directory
%%
%Loop over fol... |
function genVocab(allTweets, vocabFile)
% GENVOCAB Generate a vocabolary list from tweets
% allTweets: cell of tweets, each tweet is one element
% No output, the vocab list will be written in a local file, and later
% be called by getVocabList().
disp('Number of tweets have been processed: ');
FREQ_... |
function isField = isFieldClass( obj, fieldName )
isField = false;
names = fieldnames(obj);
for i = 1:length(names)
if strcmp(fieldName, names{i})
isField = true;
return;
end
end
end |
function repair_res(entries)
global pets
WD = cdCur;
estim_options('default'); estim_options('method', 'no'); estim_options('results_output', 3); estim_options('pars_init_method', 2);
cur2ew = '../../deblab/add_my_pet/entries_web/'; % path from AmPtool/curation to entries_web
cur2e = '../../deblab/add_my_pet/entries/'... |
function R = Algebraic(nume, d)
% Functia care calculeaza vectorul PageRank folosind varianta algebrica de calcul.
% Intrari:
% -> nume: numele fisierului in care se scrie;
% -> d: probabilitatea ca un anumit utilizator sa continue navigarea la o pagina urmatoare.
% Iesiri:
% -> R: vectorul de PageRank-uri... |
function[sdata] = scaling(data, ScaleBetween)
% SCALING(data, ScaleBetween) scales features between a range given by ScaleBetween
miny = ScaleBetween(1);
maxy = ScaleBetween(2);
j=0;
for i=1:size(data, 2)
minx=min(data(:,i));
maxx=max(data(:,i));
if(minx ~= maxx) %Don't take into account features... |
function typical_distance = find_typical_distance( parts,selection )
temp=zeros(size(selection),2);
r=1;
for i=selection
temp(r) = find_typical_distance(parts);
r=r+1;
end
typical_distance=mean(temp);
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.