text stringlengths 8 6.12M |
|---|
function scalePlot(xData,yData1,yData2)
if nargin == 3
temp1 = max(abs(yData1));
temp2 = max(abs(yData2));
ratio = temp1/temp2;
plot(xData,yData1);
hold on;
plot(xData,yData2 * ratio);
elseif nargin == 2
temp1 = max(abs(xData));
temp2 = max(abs(yData1));
ratio = temp1/temp2;
plot... |
% this model was before I integrated all of the experimental measurments
% (except for the current) and changed it to not be units/area
clear;clc;%close all
warning off all;
totaltime=1000;
dt=0.05;
t=0:dt:totaltime;
%all units for conductance in mS/cm2
gNamax=7;
gKmax=3;
gAmax=4; %5
gBmax=5;
gleak=.1;
ENa=50;
EK=-90;
... |
function [Psd,Psr,Prd] = signallevelratios(k1,k2) % k1 : numer of leds at source k2: number of leds at destination
% Under the assumption that each LED in a matrix in source and relay
% given same amount of power (ie emit same luminous intensity ).. And
% all of them have same half power angle ... Number of... |
function vggEll = ellToVgg(ell,eigVal,eigVec)
% Transforms the ellipse into format suitable for passing into
% kristian's ellipse overlap function.
% This function does what the helper function elltovgg
% in the file computeEllipseOverlap_slow does, but in a faster
% way, without for loops.
vggEll = zeros(5+4,size(ell... |
function [body, args] = solveFail(this, nPath, ixNanDeriv, sing2, bk)
% solveFail Create error/warning message when function solve fails.
%
% Backend IRIS function.
% No help provided.
% -IRIS Macroeconomic Modeling Toolbox.
% -Copyright (c) 2007-2017 IRIS Solutions Team.
%#ok<*AGROW>
BRX = sprintf('\n ... |
function [eul_cntr,fval,out,xflag] = sk_nonlinearopt_triad(eul_cntr,data2d,camParaCalib,model,check)
eul = eul_cntr(1:3);
cntr = eul_cntr(4:6);
if check
TolX = 1e-3;
TolFun = 1e-3;
MaxFunEvals = 250;
nonlin = tic;
% options = optimset('TolX',TolX,'TolF... |
clear trajtotx trajtoty trajtotz trajtotx2 trajtoty2 trajtotz2 trajmx trajmy trajmz trajbx trajby trajbz
T=1.0;
nSamples=60+1;
r=0.35*T/4;
A_move=[15,0.0,20.0];
A_bal=[5.0,7.0,10.0];
w_bal=2*pi/T;
w_move=2*pi/T;
cA=cos(w_move*r);
cC=sin(w_move*r);
del_move=[0.0, 0.0, pi/2];
del_move_n=round(del_move*nSampl... |
function photo = krCheckPhoto(ai)
thresh = 2;
data = [];
tic
while isempty(data)
data = peekdata(ai,1);
timelapse = toc;
if(timelapse > 0.002)
data(end,4) = 0;
break;
end
end
flushdata(ai);
if data(end,4) > thresh
photo = 1;
else
photo = 0;
end
|
wvLn = 3000;
tData = [zeros(1,1),-1e4*ones(1,wvLn),zeros(1,1)];
af_fft = fftshift(fft(tData));
fs_ideal = 2;
ieal_f = fftshift(qes.util.fftFreq(length(tData),fs_ideal));
% af_fft = exp(2j*pi)
figure();plot(tData);
figure();plot(ieal_f,abs(af_fft));
%%
load('D:\data\20170721\impulseResponse_noFilter_1.mat');
xfrFunc_... |
%Kiran Rao
%ME 2016 - Section B
%Computer Project 1
function RaoKiranCP1()
format long
xVals = linspace(0.32,1,100); %generate x values for plot
figure(1)
plot(xVals, (((xVals)-0.32).^(0.32)+(xVals)-1)) %evaluate and plot y values
xlabel('Velocity of Shockwave')
ylabel('Various System... |
for i=1:251
APLO2.d1.default.train_classifier('name','c1420','classes',{{14};{20}},'blocks_in',1:4,'time',1:64,'channels',1:64,'trials',i:i+49)
W=APLO2.d1.default.c1420.W;
[U S V]=svd(W);
pc(i,:)=V(:,1)';
if (abs(max(pc(i,20:25)))>abs(min(pc(i,15:25))) & max(pc(i,15:25))>0)
pc(i,:)=-pc(i,:);... |
function [qt,Wt,rt,rtEdges,reps,rtbinsize,rec,nbins] = getFreeFiringRate2(cellstruct,varargin)
%getFreeFiringRate2 Get free firing rate for a neuron
% [QT,WT,RT,RTEDGES,REPS,RTBINSIZE,REC,QTFRAMEBINS] = getFreeFiringRate2(CELLSTRUCT,
% VARARGIN) computes the free firing rate using CELLSTRUCT, a
% structure conta... |
clear
load OD1_Scores3.mat
respZone = [];
for trial = 1:16
for subj = 1:20
if ~isempty(OD1.respZone{trial,subj})
respZone(trial,subj) = OD1.respZone{trial,subj}(1);
else
respZone(trial,subj) = NaN;
end
end
end
%
[A,B]=find(respZone==1);
Click1PriorHi = zeros(1... |
function fig = ghala(varargin);
% ghala(...)
% Attitude
ffig = ne_group(varargin,'Attitude','phalaa','phalap','phalar','phalass','phalad','phalasz','phalaaz','phala_az','phalat');
if nargout > 0 fig = ffig; end
|
function [R_s, R ,M, NumOfCorner] = HarrisCornerDetectior( I,k,threshold)
figure;
imshow(I);
Ix = ComputeDerivatives(I,[-1 0 1;-1 0 1;-1 0 1;]);
Iy = ComputeDerivatives(I,[-1 -1 -1;0 0 0;1 1 1;]);
figure;
imshow(Ix);
figure;
imshow(Iy);
Ixx = Ix.*Ix;
Iyy = Iy.*Iy;
Ixy = Ix.*Iy;
figure;
imshow(Ixx);
figure;
imshow(Iyy);... |
%Oppgave 2
%Sortering til stigende matrise
function output = matSort(mat)
[r,c]=size(mat);
nmat=reshape(mat,[],1);
nnmat=sort(nmat);
output=reshape(nnmat,[r,c]);
end
|
%% Detecting Malaria with CNN
% How simple can it be?
% Dataset: https://ceb.nlm.nih.gov/repositories/malaria-datasets/
clr
filepath = strcat(pwd, "\data_edited");
imds = imageDatastore(filepath, 'IncludeSubfolders',true,'LabelSource','foldernames');
trainingSize = 0.75;
rng(1)
[trainData, testData] = splitEachLabel... |
function plot_scatter(plot_patterns, plot_targets, fig, color)
% Make a scatter plot of the data
% Inputs:
% plot_patterns - Data patterns
% plot_targets - Data targets
% fig - Optional figure handle
% color - Optional color tag (if 1, will color all points red)
switch nargin,
case 2
color = 0;
ca... |
% function Label=jiance(W,M,V,I,IB,row,col);
clc
clear all
%d_name=strcat('E:\测试图片\railway','\*.bmp');
d_name=strcat('F:\extraction','\*.bmp');
D_name=dir(d_name);
row=240;col=320;
afa=0.005;
T1=0.4;%%%%%%%背景的阈值
load W_b.mat
load M_b.mat
load V_b.mat
for U=1:500
tic
U
num = num2str(D_name(U).name);
fna... |
function [ value ] = getQexpNValue(Q, n, i, j)
%getQexpNValue Returns the value at indexes (i,j) of matrix Q^n
Qn = Q^n;
value = Qn(i,j);
end
|
clc;clear all;close all
markers = ["lef","lbd","lelb","lelb1","lie","ref","rbd","relb","relb1","rie"];
subjectID = ["1330","1390","1490","1430","1950","1660","1160","1970","1580","1440","1110","1770","1250","1240","1610","1840","1130","1490","1940","1390","1410","1710","1380","1630"];
SID = 3380;
% addpath('F:\github\w... |
function [e, J_e_rob] = error_pose(rob, y)
% in
% ROB:ROBOT POSE
% y:MEASURED POSE
% OUT
% E:ESTIMATION ERROR
% J_e_rob : JACOBIAN OF E WRT. ROBOT POSE
e = rob-y
while e(3) > pi
e(3) = e -2*pi;
end
while e(3) < -pi
e(3) = e +2*pi;
end
J_e_rob = eye(3);
end |
clear;clc;if ~exist('scripts') | ~endsWith(scripts,'ComplementaryScripts'); run('../../init_rhtoGEM.m'); end
%% Theoretical simulations
% Take rhtoGEM model as it is
cd([scripts '/experimental/']);
model = importModel([root '\ModelFiles\xml\rhto.xml']);
model.rev(getIndexes(model,{'r_1634','r_1718','r_1808'},'rxns')) =... |
function result = runAllMyTests
% Import the Matlab test suite components
import matlab.unittest.TestSuite;
import matlab.unittest.TestRunner;
% import matlab.unittest.plugins.TAPPlugin;
% import matlab.unittest.plugins.ToFile;
try
% Create the suite and runner for the package of tests to run
% suite = TestS... |
function [ FFstruct ] = run_firefly_dynamics( firefly_id, itime, FFstruct )
coupling = FFstruct.coupling;
somebody_fired_before = 0;
for i = 1:FFstruct.firefly_nr
if FFstruct.fire(i,itime-1) && i ~= firefly_id %if someone fired at previous time step but not me
somebody_fir... |
function [sig, A, U_star] = OOS_PBCV(w_mv, mu, cov)
n = length(mu);
mu4i = ones(n,n);
sig = mu4i;
for i = 1:n
for j = 1:n
sig(i,j) = sum((mu-mu(i)).*(mu-mu(j)))/n;
mu4i(i,j) = sum((mu-mu(i)).^2.*(mu-mu(j)).^2)/n;
end
end
Q2 = (mu4i-sig.^2)/n+(sig.^2+diag(s... |
function [u, l] = wilsonBinomialConfidenceInterval(p, z, n)
% [upper, lower] = wilsonBinomialConfidenceInterval(p, z, n)
%
% Implementation of the Wilson Binomial Proportion Confidence Interval.
% p is the proportion of successes.
% z is the z_(1-alpha/2), i.e., the 1 alpha / 2 percentile of a standard
% normal... |
classdef QDAClassifier < AClassifier
% QDA Classifier class
properties(SetAccess=protected)
training = [];
group = [];
end
methods
function init(obj,varargin)
% Initialization function for QDA Classifier
end
function error = t... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 本函数用于计算alpha系数
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function alphaC = alphaCoefficient( R,Rm,Rf,betaC)
loc = isnan(R) | isnan(Rf)| isnan(Rm);
R (loc) = [];
Rf(loc) = [];
Rm(loc) = [];
% 数据不够输出nan
if siz... |
function [N,comp_PMF,mu,Sigma] = get_GMM_parameters()
% original component probabilities used to generate the GMM
comp_PMF = [0.3,0.6,0.1];
% number of random vectors to sample from GMM
N = 500;
% original mean vectors used to generate GMM
mu(1,:) = [1,1];
mu(2,:) = [10,1];
mu(3,:) = [1,10];
% original covarianc... |
function ScrnSz = ScreenSize()
ScrnSz = get(0,'ScreenSize');
end |
% rrtree extend
function pathfind = rrtextend(rand_node)
global tree1_num tree2_num;
%pathfind = 1 -->tree1-tree2
%pathfind = 2 -->tree1/2-thickenline
if (tree1_num <= tree2_num)
% extend tree1
newnode = extendtree1(rand_node);
% tree stop condition
[nearest_node2,nearest_row2,pa... |
% ---------------------------------------
% İTÜ, Elektronik ve Haberleşme Müh. |
% Sayısal İşaret İşleme Tasarım ve Uyg. |
% Çağatay Eren, Yusuf Öndeş, Betül Kırlı|
% ---------------------------------------
%% BAŞLA
clearvars; close all; clc;
%% Veritabanındaki tüm görüntüleri al
piclim = 3132; % veritabanındaki top... |
% calobjvalue.m函数的功能是实现目标函数的计算,其公式采用本文示例仿真,可根据不同优化问题予以修改。
%遗传算法子程序
%Name: calobjvalue.m
%实现目标函数的计算,将 二值域 中的数转化为 变量域的数
function [objvalue]=calobjvalue(pop)
temp1=decodechrom(pop,1,10); %将pop每行转化成十进制数
x=temp1*50/1023; %在精度不大于0.1时,最小整数为1023,设为10位二进制
objvalue=(-x.*x)+50*x+12; %计算目标函数值 |
clear;
N = 2^21;
F=@(x,y)(exp(sqrt(x.*y)+sqrt(y-x.*y))+exp(sqrt(x.*y)-sqrt(y-x.*y))+exp(-sqrt(x.*y)+sqrt(y-x.*y))+exp(-sqrt(x.*y)-sqrt(y-x.*y))).*exp((-(N.^2).*2^(-35)-y)./(N*2^(-17)))./(N*2^(-15).*pi.*sqrt(x.*(1-x)));
P=1-(integral2(F,0,1,0,2^(-28.6)));
Q=1-(integral2(F,0,1,0,64));
O=1-(integral2(F,0,1,0,128));
R=1-(i... |
function [scan_pts,idx] = Detect_Obstacle(P,OBS_Vert,Para_Plane,NUM_OBS,OBS_Height,Search_range,range_theta,range_psi,d_angle)
% Euler Transformtion and Acquire the Scanned Range for Each Scanning Point
D2R = pi/180;
idx = 0;
idx_pt = 0;
scan_pts = zeros(1,3);
euler = Calculate_Euler(P(4:6));
for theta =... |
%% Initialization section
delete(instrfind({'Port'},{'COM15'}))
clear all; close all;clc;
flg = 1;
if flg
Offsets = [0.8589,0.0411,-0.0170,-0.5101; 1.0000,0,0,0; -0.8954,0.0070,0.0010,0.4452; -0.9749,0.0070,-0.0250,0.2210; 0.9791,-0.0371,-0.0170,-0.1994];
end
SUBJECTID = 1234;font = 12;
cd('F:\github\wearable-jack... |
% One vs All training using LIBSVM
function classifier = trainsvm(feature_matrix, obj_labels, class_labels)
classifier = {};
for i=1:length(class_labels)
label_vector = polarizeLabels(obj_labels,class_labels{i});
classifier{i} = svmtrain( ...
double(label_vector)', ...
double(feature_matrix), ...
'-b 1 ... |
%%%% 1d FEL simulation code %%%%
% Check for version compatibility
if verLessThan('matlab','9.1')
warning('Including functions in scripts requires MATLAB R2016b or later')
warning('Functions defined inside perave_postprocessor script need to be defined as separate functions')
end
%% Load physical constants
physi... |
function [ceq, ceq_x, ceq_dx, ceq_ddx, ceq_dyn] = calc_direct_const(c_const, feature_use, param)
if isfield(param, 'const_x') && ~isempty(param.const_x)
ceq_x = calcConstraint(feature_use.q, param.const_x, param.const_y, c_const(1));
end
if isfield(param, 'const_dx') && ~isempty(param.const_dx)
... |
% short training sequence length
global sts_len;
sts_len = 16;
% short training sequence cycles
global sts_cyc;
sts_cyc = 10;
% total short training field length
global stf_len;
stf_len = sts_len*sts_cyc;
% long training sequence length
global lts_len;
lts_len = 64;
% long training sequence cycles
global ... |
css = [0 cumsum(B_len)];
B_all(:, sum(isnan(B_all),1)==length(miceNames)) = [];
%%
B_term = cell(1, length(B_len));
for ib = 1:length(B_len)
B_term{ib} = B_all(:, css(ib)+1:css(ib+1));
end
%%
sea = [stats_all.se]';
% sea0 = sea;
a = find(arrayfun(@(x)isempty(x.se), stats_all));
if ~isempty(a)
... |
function wykresy_MW(t,rav,Rav)
clc
rpt=[10 20 40]*1e-9;
figure(1)
clf
hold all
plot(t*1e9,Rav(:),'r-')
% plot(t*1e9,Rav(:,2),'b-')
% plot(t*1e9,Rav(:,3),'g-')
grid on
grid minor
box on
xlabel('Czas t [ns]','interpreter','latex')
ylabel('\''Srednia szybko\''s\''c $R_{CO,avg}(t) \left[\frac{mol}{m^{2}\cd... |
cd('/home/raleman/Dropbox/Figures/Figure4/26')
fh1 = open('Stat_HPC_Parietal_NP_Widepass_1sec.fig');
cd('/home/raleman/Dropbox/Figures/Figure4/27')
fh2 = open('Stat_HPC_Parietal_NP_Widepass_1sec.fig');
%%
ax1 = get(fh1, 'Children');
ax2 = get(fh2, 'Children');
ax2p = get(ax2,'Children');
copyobj(ax2p, ax1);
%%
c... |
function pool = create_hyena_worker_pool(hyena_machines,jobs_per_host)
% host_slots_used host_slots_total
pool = kv_fractal(hyena_machines);
for i = 1:kv_size(pool)
hyena_machine = hyena_machines{i};
pool = kv_set_recurse({hyena_machine,'host_slots_used'},0,pool);
pool = kv_set_recurse({hyena_machine,'... |
% using sir+mine logic for same
clear all;clc;close all;
data_set = 'D:\50_set\pfh\asc\';
addpath(data_set);
data_1 = (dir(fullfile(data_set,'*.asc')));
data_1 = {data_1(~[data_1.isdir]).name};
data_set2 = 'D:\50_set\asc\point\';
addpath(data_set2);
data_2 = (dir(fullfile(data_set2,'*.asc')));
data_2 = {da... |
filename = 'cvx_stats_new_constraints.csv';
% Number of outcomes and distribution
nout = 4;
P_ABC = get_dist('EJM');
% Iteration range
solvers = {'Mosek' 'SDPT3' 'SeDuMi', 'Gurobi'};
bases = {'full', 'CG', 'corr', 'CG_e', 'corr_e'};
% Output data file
headers = {'solver', 'basis', 'slack', 'cvx_cputime',...
'cvx_... |
t = 0:0.01:1;
theta1 = 0.5*((initQ(1) - finalQ(1))*cos(pi*t) + initQ(1) + finalQ(1))
theta2 = 0.5*((initQ(2) - finalQ(2))*cos(pi*t) + initQ(2) + finalQ(2))
theta3 = 0.5*((initQ(3) - finalQ(3))*cos(pi*t) + initQ(3) + finalQ(3))
g = 9.81
t1_v = 1 : 101;
t1_a = 1 : 101;
t2_v = 1 : 101;
t2_a = 1 : 101;
t3_v = 1 ... |
function resultFactor = inference( factorList, queryVariables, orderedListOfHiddenVariables, evidenceList )
% A function that computes Pr{queryVariable | evidenceList} by variable
% elimination.
factorListSize = numel(factorList);
queryVariableSize = numel(queryVariables);
hiddenSize = numel(orderedListOfHiddenVariabl... |
train_data = load('train_data_2017.txt');
val_data = load('valid_data_2017.txt');
for i = 1:2
train_data(:,i) = (train_data(:,i)-mean(train_data(:,i)))/std(train_data(:,i));
val_data(:,i) = (val_data(:,i)-mean(val_data(:,i)))/std(val_data(:,i));
end
train_pat = train_data(:,1:2);
train_ans = train_data(:,3);
v... |
function err_fro = get_frob_diff_compact(M,N,sps_plc)%(M,U0,V0,N,U,V,sps_plc)
% Calculates the Frobenius distance ||M-N||_F
% between two matrices M and N that are given as in the Appendix of
% [1] C. Kuemmerle, C. M. Verdun, "Escaping Saddle Points in
% Ill-Conditioned Matrix Completion with a Scalable Second Order... |
function autosetthresh
% Interactive way of setting the thresholds for
% spike detection spike-detection filter
answer = inputdlg({'Enter multiplier for threshold'},'',1,{'4'});
threshfact=str2num(answer{1});
[threshfile,threshpath] = uiputfile('.thresh','Append thresholds to file');
fid = fopen([threshpath,threshfile]... |
function RandomGeoCreate(figflag, dims, mindiam, maxdiam, numspheres)
% Code to create an image stack of overlapping spheres with a random 3-D
% positions and diameters. It is intended to be used to evaluate
% performance of segmentation related code.
%
% INPUTS:
% figflag: Flag determining whether to produce figur... |
function [theta, J_history] = gradientDescent(X, y, theta, alpha, num_iters)
%GRADIENTDESCENT Performs gradient descent to learn theta
% theta = GRADIENTDESENT(X, y, theta, alpha, num_iters) updates theta by
% taking num_iters gradient steps with learning rate alpha
% Initialize some useful values
m = length(y); ... |
function showspm(data,slice_number)
%
% showspm(data, slice_number)
% this function displays the SPM on top of whatever figure is
% being currently displayed.
%
global MAPMAX
global hdr
sz = size(data);
whos data
MAPMAX;
spm_scale = MAPMAX /max(data(:,4))
hold on ;
% Draw each one of the activa... |
%% loading data
rng('default')
% before stress files:
bs={'spin_f_spinv6-3b','spin_f_spinv6-2b','spin_f_spinV6 -b','spin_f_spinN5-B',...
'spin_f_spinn4-b3','spin_f_spinn4-b2','spin_f_spinN4 -B'...
,'spin_f_spinn3-B','spin_f_spinN3-2b','spin_f_spinN2-2','spin_f_spinN1',...
'spin_f_spinN1-3b','spin_f_spinN1-1... |
% ----------------------- BEGIN CODE -----------------------
% Close all figures, clear variables in memory and MATLAB command screen
close all ; clear all ; clc ;
% Set the output format to the short format with compact line spacing
format short g; format compact ;
% Specify values and necessary parameters
ln(1) = ... |
function next_index = find_next(hist_bank, LBP_bank, edge_bank, ...
t_hist, t_LBP,t_edge, mark)
t_edge = double(t_edge);
dim = size(hist_bank);
norm1 = zeros(dim(1),1);
m = mean(mean(hist_bank));
s = std(std(hist_bank));
hist_bank = (hist_bank - m)/s;
t_hist = (t_hist - m)/... |
fprintf('Loading Data ...\n')
data = load('filename.txt');
x = data(:, 1);
y = data(:, 2);
m = length(y); % number of examples
fprintf('Plotting Data ...\n')
plotData(x, y);
fprintf('Press enter to continue.\n');
pause;
% Compute Cost & Gradient Descent
x = [ones(m, 1), data(:,1)]; % Add a column of ones to x
theta... |
function feature_v = featureARparameters(enf)
enf = enf - mean(enf);
order = 2;
[a,g] = lpc(enf,order);
g = log(g);
feature_v = [a(:,order:end) g];
end |
function IOCAnalysis()
setPaths();
% perturbAmount = [1e-1 1e-2 1e-3 1e-4];
% perturbAmount = [1e-1 1e-2 1e-3 1e-4]*1e4;
% residualThreshold = [1e1 1e0 1e-1 1e-2 1e-3 1e-4 1e-5]; % 0.1
% residualThreshold = [1e1 1e0 1e-1 1e-2 1e-3 1e-4 1e-5]/1e7;
% perturbAmount = 10.^[-5:4];
% resid... |
clear
clc
close all
addpath('./SU_func');
addpath('../function2use');
SNR=-10:1:30;%·ÂÕæÐÅÔë±È
EPOCH=10000;
N_Len=3;
C_MISO=MISOSU_plot(EPOCH,SNR);
[C_MIMO_csit,C_MIMO_csir]=MIMOSU_plot(EPOCH,SNR);
figure;
for ii=1:N_Len
plot(SNR,C_MIMO_csit(:,ii),'linewidth',2);
hold on
end
for ii=1:N_Len
plot(SNR,ab... |
function showCurveAndPhi(phi,Img,cl)
imshow(Img,[],'InitialMagnification',100);
hold on;
[c,h] = contour(phi,[0 0],cl,'Linewidth',3); hold off;
test = isequal(size(c,2),0);
while (test==false)
s = c(2,1);
if ( s == (size(c,2)-1) )
t = c;
hold on; plot(t(1,2:end)',t(2,2:e... |
%%
%A1ModJulian dv1.Element1 dv2.Element ElapsedDays Altitude RadPer RMAG
tmp =dlmread('E:\Lunar_Label.csv');
tmp = tmp(2:746167,:);
delta_V_1 = tmp(:,2); delta_V_2 = tmp(:,3);
%ElapsedDay = tmp(:,4);
Impulse_Unit = 0.381; % mN*s
Satellite_Mass = 4; % kg
Total_Impulse = delta_V_1 * Satellite_Mass ;
Thrust... |
%POPULATEPLOTSLISTBOX adds a new measure and plot type combination to the
% current simulation to the list of available measure and plot type
% combinations.
%
% Syntax
% ------
% ui.PopulatePlotsListbox();
%
% Details
% -------
% Responsible specifically for populating the plots listbox.
%
% Examples
... |
clc
clearvars
DIR=('rm/');
IMAGEN=uint8(dicomread('rm/000036.dcm'));
BITS=3;
K=2^BITS;
centroides=[];
while size(centroides,2)<K
for i=1:K
centroides(i)=randi(256);
end
centroides=unique(centroides);
end
for i=1:256
for j=1:K;
distancia(i,j) = round(sum((centroides(j)-i).^2).^0.5)... |
clf
N = 512
x = linspace(-N/2,N/2)
y= sinc(x)
plot(x,abs(fft(y)))
|
image = imread('Water.jpg');
threshold = optimal_threshold(image);
% segmented_image
segmented_image = segment(image, threshold);
imwrite(segmented_image, 'Water_seg.jpg')
fileID = fopen('threshold.txt','wt');
fprintf(fileID,'threashold = %8.3f', threshold);
fclose(fileID); |
%% Significance of GPe Organisation on Stop Signal Propagation
keepvars = {'ii','RTs','peak','selection','flag','iii','failedstopplot','edges','arkysd','repl'};
clearvars('-except', keepvars{:});
tic
% 1 = Replication of original stimluation experiments in Blenkinsop et al.,
% (2017)
% 2 = Fast Go
% 3 = Corre... |
function linear_classifier_of_replay_all(label,savelab,type,figlab,igroup,savefolder,ignoresessions)
cd('F:\XY_matdata\AllDays')
d2 = dir('*.mat');
p = []; dist = []; shuff = []; mdist = []; mshuff = [];
for id = 1:size(d2,1)
if ignoresessions == 1 && ismember(id,[1,7,10]) %reviewer comment, 10/12/2020,... |
clear;
%Enter these variables according to desired falling trajectory
t=0:.01:10;
q0init=pi()/2;
% q2=5*t;
% q1=2*ones(1,length(t));
q1=-cos(t)-pi/2;
q2=-sin(t)+pi/2-1;
%%%%%%%%%%%%% Use q0 script to calc appropriate q0 angles
q0=q0(t,q0init,q1,q2);
%%%%%%%%%%%put variables in workspace in appropriate variables
q1_sig... |
function writegmv( fname_gmv, xs, elems, type, var_nodes, varlist_nodes, var_faces, varlist_faces)
% WRITEGMV Write out mesh in GMV format.
%
% Example use:
% writegmv( 'fname.gmv', xs, elems)
% writegmv( 'fname.gmv', xs, elems, 'writegmv', var_nodes, 'varname_v')
% writegmv( 'fname.gmv', xs, elems, 'writegmv', var_n... |
% Problem 3_3 Deng Yang
format long e
func = @(x,y) exp(-0.5.*(x.^2)).*exp(-0.5.*(y.^2)).*sin(2*pi.*x).*cos(pi.*y);
dx = 0.01;
x = -5:dx:5;
y = -5:dx:5;
m = 0;
n = 0;
f = func(m,n);
f_now = f;
f_exact = func(0.24,0);
num = 1;
error_list(num) = abs(f(num)-f_exact);
while error_list(num) > 1e-3
ii = 1;
f(ii) =... |
function [coefs,dims,dirs,sites] = mars_params_init(Nx,MaxBasis)
%MARS_PARAMS_INIT Summary of this function goes here
% Detailed explanation goes here
coefs = zeros(1,MaxBasis+1);
dims = zeros(1,MaxBasis);
dirs = zeros(1,MaxBasis);
sites = zeros(1,MaxBasis);
for i=1:2*Nx
if(mod(i,2) == 0)%even
coefs(i+1) = 1;... |
% This function performs the update process (sequential update).
% You need to make sure that the output sigma_bar is symmetric.
% The last line makes sure that ouput sigma_bar is always symmetric.
% Inputs:
% mu_bar(t) 3X1
% sigma_bar(t) 3X3
% H_bar(t) 2nX3
% Q_b... |
function [r, v, c3, v_inf_arrival, tof] = Trajectory(porkchop, launch_day, arrival_day, dark)
%% Generate Pork Chop Plots
% Generates porkchop plot if user requests
if porkchop == 'y'
Porkchop(launch_day, arrival_day)
else
fprintf('\n No porkchop plots will be displayed.\n')
fpri... |
function CODE_VERSION = version_number();
%% function CODE_VERSION = version_number();
%%
%% Setup a global variable CODE_VERSION with a release version number
%% string of the form (sample):
%%
%% Rv1.1-17-g64dc9bf-Mv1.0-59-gc41a047
%%
%% meaning:
%%
%% rtp_prod TAG: v1.1
%% number of commits past this tag: 17
%% com... |
function vars = ab_data(validate_data)
%
%
% Figures:
% Figure 1
if ~exist('validate_data', 'var'), validate_data = true; end;
if ~exist('visualize_data', 'var'), visualize_data = false; end;
AB_dirpath = fileparts(which(mfilename));
AB_dirname = guru_fileparts(AB_dirpath, 'name');
AB_img_dirpat... |
close all
%clear
clc
addpath('metrics')
addpath(genpath(cd))
%%
%load vgg19.mat;
path=uigetdir('*');
I=load_images(path);
n=size(I,4);
subplotrows=ceil(n/3);
figure('Name','Input sequence');
for ii=1:n
subplot(subplotrows,3,ii); imshow(I(:,:,:,ii));
end
%%
W_CNN=double(cnnFeatures_newnew(I,vgg19));
... |
% initiate variables
clearvars;
load('QMDA_HW_07.mat');
% A.
figure(1);
plot(ti,hi, 'LineWidth',2);
xlabel('Time (Day)');
ylabel('Sea surface elevation (m)');
set(gca,'LineWidth',1,'FontSize',14);
% B.
% To calculte the delta_t of sampling, we calculate the differenciate of ti
dtilist = diff(ti);
% to check if ... |
%%%This function is mainly to map the normal to the CCD to get the dominant orientation
function [ u,v,orentition] = generate_uv( normal,interestpoint,x,y,height,width)
normal_world=normal'+interestpoint;
focal=575;
u=normal_world(1,1)*focal/normal_world(1,3)+width/2;
v=normal_world(1,2)*focal/normal_world(1,3)+... |
% MATLAB script: nonlinear_advect_diffuse.m
% Numerical solution for 1-d nonlinear advection-diffusion equation.
% Initial wind has sinusoidal distribution.
% Change Nxl to examine dependence of amplitude and phase errors on
% number of grid intervals per wavelength.
clear all
close all
Nxl = 40;
Lx = 3.e6; ... |
% Model structure 2: 2-species with interactions model
% This model assumes microbe-microbe interactions between Gv and a LB sp.
function dy = Original_2sp_wi_ode(t, y, params)
neq = size(y,1);
dy = zeros(neq,1);
LB = y(1);
GV = y(2);
MNZext = y(3);
MNZint_lb = y(4);
MNZint_gv = y(5);
MET = y(6);
b1 = params(1);
a... |
function [params,paramsmap] = getFROC2map(mainDir,patientname,x,y,z,A,normdecay,onormdecay,b,DDC_init,alpha)
% A---the size of orginal 3D images
% x,y,z---the remembered coordinates of original 3D images
% b--- b values;
% mainDir and patientname are the dictionary to save IVIM
% normdecay&onormdecay---onormdecay ... |
clear
clf
clc
csv = csvread("result_sulfide240_sulfite240_run1.csv");
csv([1],:) = [];
x = csv(:,1);
y = csv(:,4);
plot(x,y); |
%Full Body LG EKF and EUL EKF for the boxing CMU data
%Load up the generated model
clear vis; close all;
% EKFCodePath = 'C:\Users\kgwester\Documents\ResearchWork\CloudSLAM\lg_persontracking\';
EKFCodePath = 'C:\Users\kgwester\Documents\ResearchWork\MatlabWrapper\';
addpath(genpath(pwd));
addpath(EKFCodePath);
visua... |
%FINDSURGICALTIP determines the location and orientation of the surgical
%instrument.
%
% [surgicalTip_3D, eul, normal] = FINDSURGICALTIP(green_3D, blue_3D, red_3D, pivotOffset)
% returns the position of the surgical tip, the orientation of the
% surgical instrument, and the normal unit vector to the plane forme... |
function a = subd(b,ndx)
% see sub() and subc()
a = b.(ndx);
end |
function [CorrelationCoef] = Correlation(SameMovieMatrix,Mean1,Mean2)
[b,a]= size(SameMovieMatrix);
if(b==2)
%[Mean1] = Mean(SameMovieMatrix(1,:));
%[Mean2] = Mean(SameMovieMatrix(2,:));
count=0;
count2=0;
count3=0;
for i=1:a
count= count + (SameMovieMatrix(1,i)-Mean1)*(SameMovieMatrix(2,i)-Mean2);
count2 = cou... |
clear all;
global WIN opts Fs
opts.doVariableWindow = 1; % 1 for variable window, 0 for fixed window
opts.doSilenceRemoval = 0;
opts.ReleaseTimeStretchingRatio = 0;
root = 'D:\BoxSync\Box Sync\GMUDATA\';
root = 'C:\Users\iheo\Box Sync\GMUDATA\';
dat(1).description = 'Reference Signal';
dat(1).file.folder = [root,... |
function [STRUCT] = thickness(STRUCT, grade)
global N
ydown = ones(1, N)*5;
for q = 1:length(STRUCT(5).case_vec)
caseNum = STRUCT(5).case_vec(q);
if (isfield(STRUCT(caseNum),'top_vel') && isfield(STRUCT(caseNum),'bottom_vel'))
upper_speed = STRUCT(caseNum).top_vel;
lower_speed = STRUCT(caseNum).... |
function res = binary2num(data, divider)
len = length(data);
res = 0;
for i = 1 : len
res = res + data(i)*2^(i - 1);
end
res = res + 1;
res = res / divider;
end |
function V = interp_field(I,varargin)
%
% INTERP_FIELD: Interpolates 2D or 3D variable from Donor to Receiver Grid
%
% V = interp_field(I,Hmethod,Vmethod,RemoveNaN)
%
% This function interpolates a generic 2D or 3D field variable from a Donor
% to Receiver Grid.
%
% The horizontal interpolation is done with 'TriSca... |
function [pxx,pxxci] = getlombperiods(samples,stimes, samplerate,fvec)
% Usage [pxx,pxxci] = getlombperiods(samples,stimes, samplerate,fvec)
% Runs plomb to derive the Spectral Density Estimate of The Signal
% Can contain NaN values in samples and stimes
% samples: containing measurement values
% stimes; times o... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Description: The s-function to control robots (Kobuki) in real time (by EOG command).
% It also provides a visual output in the "display" block, and a file output of Data.txt.
%--------------------------------------------------------------------------... |
files = dir('datasets/2/tmp/cells/002/*.jpg');
n = size(files, 1);
t = load_templates();
figure(1);
for i = 1:numel(t)
subplot(ceil(numel(t)/4), 4, i);
imagesc(t{i}.image); axis image; colorbar; title(t{i}.name);
end
for i = 1:n
im = imread([files(i).folder '/' files(i).name]);
out = match... |
function [structInfoMODIS] = infoFicheroMODIS(ficheroMODIS)
% Extrae la fecha del nombre del fichero MODIS
% MCD43B3.A2012225.h17v04.005.2012242130041.hdf
% Output: estructura con la informacion del nombre del fichero
structInfoMODIS = struct('tipoFichero', {''}, 'fecha', {0}, ...
'cuadricu... |
%energy_limits
%Finds the energy limits and saves the values
clear all
% clearvars -except E200_vector ii
close all
%Get user to specify the dataset
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%BEGIN USER INPUT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
camera='CMOS_FAR';
save_data=1;
initial_... |
% Building the LSTM model
numClasses = 4;
numHiddenUnits = 0;
inputSize = 0;
layers = [...
sequenceInputLayer(inputSize)
bilstmLayer(numHiddenUnits,'OutputMode','last')
fullyConnectedLayer(numClasses)
softmaxLayer
classificationLayer];
|
function pennymelt(delta)
% PENNYMELT Heat a penny.
% Initial value of the height is obtained from measurements
% made at the National Institute of Science and Technology
% of the depth of a mold for a U. S. one cent coin.
% What is the limiting value of the height as t -> inf ?
% pennymelt(delta) takes time steps of ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.