text stringlengths 8 6.12M |
|---|
%in barnamei baraye COLOR SEGMENTATION ast,BARAYE
%EJRAYE BARNAME HAME BARNAME RA ENTEKHAB KARDE(Ctrl+A & Ctrl+C)VA DAR Command
%Window MATLAB PASTE KONID.
clc;
clear all;
close all;
Img_in =imread('2.tif');
figure(1), imshow(Img_in), title('tasvire vorudi');
%tedad rang baraye nahie bandi
N = 6;
S = false([size(Img_i... |
cd C:\shared\epireg\rsns
corrimgs = load_untouch_nii('corrimgs.nii.gz') ;
for i=1:100 ;
figure,
imgi = squeeze(corrimgs.img(:,:,:,i));
subplot(2,2,1);
imagesc(rot90(squeeze(max(imgi,[],1))));
subplot(2,2,2);
imagesc(rot90(squeeze(max(imgi,[],2))));
subplot(2,2,3);
ima... |
load('C:\Users\Nick\Desktop\Matlab Sims\Iceland\point');
summary_point=summary; treat_scaleup_point=treat_scaleup; margins_point=margins; R0_scens_point = R0_scens; year_elim_test_point = year_elim_test; inc_year_point = inc_year;
% load('C:\Users\Nick\Desktop\Matlab Sims\Iceland\2yeartest');
% summary_2yeartest=summar... |
function code2 = digitizg(n,fs,offset,svnum)
% this function generates the local Code replica at a given carrier
% frequency for a given length.
% Input
% n: length of signal to be generated, in sampling clock
% fs: to be removed as it exists in ConstantDefinition
% offset: offset in seconds to shift the re... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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#... |
function IV(model)
ramp=struct();
ramp.conditions={10,20,20};
ramp.globals.A=100e-6;
ramp.globals.J=0;
% cf(3);[e0,ef]=plotIVCurve(ramp,model);
% subplot(1,2,1);
%
% xlim([-60e-3,-20e-3]);
% ylims=ylim();
% line(xlim(),[0,0],'LineStyle',':')
%
%
% xrev=x_to_norm(e0,ef);
% ynot=y_to_norm(0,0);
%
% annotation('arro... |
function result = ssim(img1, img2)
if (ndims(img1) == 3)
img1 = rgb2ycbcr(img1);
img2 = rgb2ycbcr(img2);
img1 = img1(:,:,1);
img2 = img2(:,:,1);
end
[M,N] = size(img1);
img1 = double(img1);
img2 = double(img2);
f = max(1,round(min(M,N)/256));
if(f>1)
temp1 = img1;
temp2 = img2;
lpf = ones(f,... |
% TSSHM for UIUC dataset
% Create date: 26/1/2018
% Author: Dongdong Ma
clc;
clear;
R = 4; % radius of the tree
r = 2; % raiuds of the circles on the branches
P1 = 8;
if P1 == 8
astype1 = 'uint8';
elseif P1 == 16
astype1 = 'uint16';
elseif P1 == 32
astype1 = 'uint32';
else
astype1 = 'ui... |
% Question No: 4
% Detect the line segments in a binary image using Hough transform
function houghtr(x)
im=imread(x);
f=edge(im,'canny');
figure,imshow(f),title('Image after applying Canny Filter');
[h,theta,rho]=hough1(f,0.5);
imshow(theta,rho,h,[],'notruesize'),axis on,axis normal;
xlabel('\theta'),ylabel... |
%%***************************************************************%%
% This function searches for 1x1 psd variables and converts them
% to non negative variables
% Author: Tillmann Weisser
%%***************************************************************%%
function [bblk,AAt,CC,b] = elimPSDvars( blk,At,C,b )
%this ... |
clc;clear all;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Reading data from the file
%Note: - time is in miliseconds and framesize is in Bytes
% - file is sorted in transmit sequence
% Column 1: index of frame (in display sequence)
% Column 2: time of frame in ms (in display s... |
function str = char(rc)
% CHAR Convert a roicircle object in a char for display
h = rc.Handle;
roiobj = getappdata(h,'RoiObject');
pos = roiobj.Position;
Xc = pos(1);
Yc = pos(2);
str = {'Circle:',...
[' Center = (',num2str(Xc,4),' , ',num2str(Yc,4),')'],...
[' Radius = ... |
%COMPGX04: Robot Vision and Navigation
%Keshav Iyengar
%Workshop 2: Multi-epoch Positioning
%bugs: height is incorrect
%This function computes the least-square position solution in NED given:
%time: current time interval
%M matrix containing th pseudo_range information
%inital_guess_pos, inital_guess_vel
%d_rho_c: cl... |
function [ q ] = p_of_z_given_x( measurement, landmark_pose, current_pose, meas_params)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
x = current_pose(1); y = current_pose(2); theta = current_pose(3);
r = measurement(1); phi = measurement(2);
%the values the sensors are SUPPOSED to ... |
function H1 = intersect(H1, H2)
%INTERSECT Intersection of two hyper-rectangles.
%
% H = intersect(H1, H2)
%
% Returns the intersection of two hyper-rectangles H1 and H2. Either or
% both of them can be hyper-rectangle arrays (considered as unions of
% hyper-rectangles).
%
% (C) 2011 by Truong X. Nghiem (nghie... |
function trialDetail = getTrialDetail(Analyzer)
trialDetail.trials = getcondtrial(Analyzer);
[trialDetail.domains,trialDetail.domval,trialDetail.blankid] = getdomainvalue(Analyzer);
trialDetail.nTrial = length(trialDetail.trials); % getnotrials(Analyzer);
trialDetail.nRepeat = getnorepeats(1,Analyzer);... |
function obj = dsp__post_process(obj)
% add days
obj = dsp__fix_day_labels( obj );
% fix session numbers
obj = fix_session_labels( obj );
% namespace day labels: day__
obj = fix_day_labels( obj );
% add pre / post index
obj = dsp__add_pre_post_index( obj );
end
function obj = fix_session_labels( obj )... |
clc;clear
%First root finding
a = 4.5; %initial guess
iter1 = 0; %iteration counter
error = 1; %initial error
while error > 10^-8 %stopping criterion
a_prev = a; %previous root updated for next iteration
a = a - (-2+(6*a)-(4*(a^2))+(.5*(a^3)))/(6-(8*a)+(1.5*(a^2))); %using Newton-Raphson method to determ... |
function fftedData = windowedFFT(cfg,data,sampwin,idx)
%WINDOWEDFFT helper function for SWRfreak and amSWR
% Elyot Grant, Jan 2015
fs = cfg.fs;
hiPassCutoff = cfg.hiPassCutoff;
%hiPassCutoff = 100; %We want to delete all frequencies below 100 Hz %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
numSmoothingSamples = roun... |
clear
clc
tic
%% Setup folders and parameters
dataFolder = '/Users/kendranoneman/Projects/mayo/data/mt-motion_pulse/raw';
figFolder = '/Users/kendranoneman/Projects/mayo/figs/mt-motion_pulse';
tableFolder = '/Users/kendranoneman/Projects/mayo/data/mt-motion_pulse/processed';
addpath(genpath('/Users/kendranonem... |
function Pxz = UKF_lin_cross_variance(x,uz,weights,sigmaPoints_F,sigmaPoints_H)
Pxz = zeros(length(x),length(uz));
for i = 1:length(sigmaPoints_F)
Pxz = Pxz + (weights.covariance(i) * (sigmaPoints_F(i,:)-x)'.*(sigmaPoints_H(i,:)-uz));
end
end
|
function [ MI_beg, MI_end, MU_beg, MU_end, DS ] = My_model_selector( MI_beg, MI_end, MU_beg, MU_end, US, DS )
% revision: 21.12.2018
tic;
fprintf('Input signal setup\t->');
%выбор рассматриваемого режима:
% обработка sig_beg:
if ((US.use_i && US.use_u) || US.use_i)
... |
function Copy_of_show_idiom_practice(wptr,idiom)
% show_idiom_practice
global practice5 lengthof147 time_interval;
[ws,hs]=Screen('WindowSize',wptr);
heightof147=hs-100-40;
Screen('Flip',wptr);
HideCursor;
fix=fixation(wptr,'+');
wrect=Screen('Rect',wptr);
for i=1:length(idiom)
showFix(wptr,wrect,fix,1+rand);
... |
%This script is a simple demonstration of the network aspects of the simulator
% clear all;
noWarnings();%comente se quiser warnings
%MANTENHA ISSO ATUALIZADO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
NRX = 2; %n�mero de dispositivos transmissores
TOTAL_TIME = 600;%segundos de simula��o (em tempo virtual... |
close all
clear all
%% Read data
cd('/Users/marcw/DATA/Student/Guus/BB_LP_2015_04_10_results')
calfile = 'coil1test_Cal_10_4_2015';
load(calfile);
% actual speaker numbers
% separate for azimuth and elevation
% not random calibration
% DataCal, DataBB, DataLP perhaps not good for structure name -> use ... |
%read files
clear all; close all; clc;
caminho = 'C:\Program Files\MATLAB\R2017a\toolbox\images\icons';
f = dir(caminho);
fname = {f.name};
findfile = strfind(fname,'.png');
index = find(~cellfun(@isempty, findfile));
findfile(index);
arquivos = f(index);
%f_png = f(name
|
function [xo, varxo] = mk_priorManifoldOutputs(xi, Xin, Xout, ~, invKx, kern)
% Xin, Xout, hyperpara_Kx, invKx
% xi 后面Q个维度全部是0
Q = size(Xout,2);
input = [xi(:,1:Q)]; % [X_pred(n-1,:) zeros(1,Q)], input = X_pred(n-1,:) 当n=2的时候,也就是X(200),往后就是X
N = size(Xout, 1); % Xin的维度
M = size(input, 1); % 输入只有一个,也就是x(t)
% alpha ... |
clc, clear all
R = [6 11 15];
fig('unit','inches','width',4,'height',4,'fontsize',8)
axis([-15.2 15.2 -15.2 15.2])
hold on
drawCircle(zeros(size(R)), zeros(size(R)),R)
for theta = pi/4:pi/4:2*pi
plot([R(1)*sin(theta) R(end)*sin(theta)],[R(1)*cos(theta) R(end)*cos(theta)],'k-')
end
axis equal off
saveTightFigure(... |
%-------------------------------------------------------------------------
% This is a simulation demo to show multiple trackpaths for tracking the
% blood cell motion. In this demo, the diameter of the blood cell is 16
% pixels, so we use 9 trackpaths(in row 23) and the distance between each
% trackpath is 8 pixe... |
function [ rho ] = problem_G_Jacobianspectralradius(q,quadpoint,appdata)
rho = abs(q);
end
|
% Input: q the size of A
% (q-r) the rank of E matrix
% Output: a random stable system
% Generating a random stable system
function os=random_sys(q,r)
AE=sprand(q,q,0.03);
[V,D]=eig(full(AE));
% D=complex(-abs(real(D)),imag(D));
tmp=diag(D);
if(tmp(end-(r-1))==tmp(end-r))
tmp(end-r:e... |
% xhollyo
% 21.3.2020
classdef HsvFrame < handle
%Data
properties (Constant)
hueIndex = 1;
saturationIndex = 2;
valueIndex = 3;
end
properties (Access = private)
m_frame;
end
%Functions
methods (Access = public)
function obj = HsvFr... |
function [fun,s]=fmin_fit_damped_sine(data, estA, estF)
t = data(:,2);
y = data(:,5);
yu = max(y);
yl = min(y);
yr = (yu-yl); % Range of ‘y’
yz = y-yu+(yr/2);
zx = t(yz .* circshift(yz,[1 0]) <= 0); ... |
function [gim2,mi1,mi2] = FindPositionfunc(Pic_obtain)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
sor=50
per=0.16
gim1=mean(Pic_obtain,3);
% % imagesc(gim1,[0,1]),colormap gray
gim2=gim1;
[Y,X]=size(gim1); %Y=482,X=644
a_num=round(Y*per,0); %to nearest ... |
function thirdmoment = thirdmoment( inputImg, m )
%thirdmoment 三阶矩
% 此处显示详细说明
% 求图象大小
[rows, columns] = size(inputImg);
% 初始化
thirdmoment = 0;
% 循环处理
for r = 1 : rows
for c = 1 : columns
thirdmoment = thirdmoment + (inputImg(r,c) - m) ^ 3;
end
end
end
|
function y = AssembleStiffness3(K, ke, EC, j)
dof1 = (2 * EC(j,1))-1;
dof2 = (2 * EC(j,1));
dof3 = (2 * EC(j,2))-1;
dof4 = (2 * EC(j,2));
K(dof1,dof1) = K(dof1,dof1) + ke(1,1);
K(dof1,dof2) = K(dof1,dof2) + ke(1,2);
K(dof1,dof3) = K(dof1,dof3) + ke(1,3);
K(dof1,dof4) = K(dof1,dof4) + ke(... |
function varargout=watch_klystron_output(varargin)
% function varargout=watch_klystron_output(varargin)
%
% Temporary watchdog to protect RF overpower conditions
disp('Monitoring cavity power levels, klystron output and beam current to watch for overpower condition ...');
while 1
Rfoutput = getpvonline('SR03S___RF... |
function itemsByGroup = getcmplxgroups(self, ndim)
coords = {'x','y','z'};
imagre = {'im','re'};
% BUFFERS
buffers = {};
for j = 1:length(imagre)
ff = imagre{j};
myvar = ['p_' ff];
buffers = [buffers myvar];
for i = 1:3
myvar = ['u' coords{i} '_' ff];
buffers = [buffers myvar];
end
end
... |
function umfpackTiming()
%umfpackTiming Compare UMFPack linear solution time.
% This test function compares the backslash operator speed for two graph
% Laplacian matrices of comparable number of edges. Both seem to arise
% from a geometric discretization. However, the solution times per edge
% are very di... |
clear all ; close all
subs = {'alex','dina','genevieve','jeremie','karl','russell','tegan','sukhman','valerie'} ;
comps = {[14,21,20,27,19,26,16,12,4,10],[6,14,17,16,25,11,9,10],[6,10,16,28,27,11,13,15],[6,23,9,8,24,18],[12,18,15,17,36],[15,20,8,11,14,9],[6,21,15,10,22,14,12],[7,31,21,13,19,11,25],[8,14,18,28,19]} ;... |
%d_h=0.3;
clear
clc
ts_t2=1.1;
As_bt_target=1.6;
c=3.85839;%box width
count=0;
for ts=1:1:10
t2=ts/ts_t2;
for h=30:10:100
d=0.3*h;
As=h*ts+2*d*ts;
for n=20:1:40;
b=(c/n)*1000;
As_bt=As/(b*t2);
b1=c/(n+1);
panelA=b1*t2*1000;
totalW=panelA*(n+1)+As*n;
if abs(As_bt-As_bt_target... |
cd c:/shared/retino_test/ ; ls
nii = load_untouch_nii('Test_Russell_2015_10_22-2_WIP_EEG-fMRI_S1.5_MB3_SH4__SENSE_12_1.nii') ; nimg = nii.img ;
cd stimtrigs ; ls
trigs = load('scanChecker_2.mat') ;
logfile = cell2mat(trigs.logfile) ;
trigtimes = logfile(1:2:end) ; trigtypes = logfile(2:2:end) ;
TR = nii... |
%文件名:wavemarksvd.m
%程序员:郭迟
%编写时间:2003.10.7
%函数功能:本函数将完成W-svd模型下数字水印的嵌入
%输入格式举例:[watermarkimagergb,watermarkimage,waterCA,watermark2,correlationU,correlationV]=wavemarksvd('girl.jpg','girlwsvd.png',1983,'db6',2,0.1,0.99)
%参数说明:
%input为输入原始图像
%seed为随机数种子
%wavelet为使用的小波函数
%level为小波分解的尺度
%alpha为水印强度
%ratio为算法中d/n的比例
%water... |
function [ Syg_po_filtracji] = filtracja(Syg,Fp,meski)
%filtracja sygnału
n= length(Syg);
if meski
F=[0,2*140/Fp, 2*150/Fp,1];
else
F=[0,2*240/Fp, 2*250/Fp,1];
end
M=[1,1,0,0];
FIR=fir2(n,F,M);
Syg_po_filtracji = filter(FIR,1,Syg);
end
|
classdef PValueField < ScalarField
methods(Static)
function str = getPValueString(p)
if p < 0.00001
str = 'p << 0.001 *****';
elseif p < 0.0001
str = 'p < 0.0001 ****';
elseif p < 0.001
str = 'p < 0.001 ***';
e... |
function rho = measure_level_alignment(mu,reg_s)
J = length(mu);
T = size(mu,3);
N = length(reg_s);
for i = 1:N
V{i} = get_se3_shooting_features_per_action(mu,reg_s{i});
end
for t = 1:T
K = zeros(6,6);
for n = 1:N
v = V{n}(:,t);
K = K + 1/(N-1)*v*v';
end
rho(t) ... |
function [pop,fmax,poz,individ] = exemplu_generare(m,n,x,y)
%exemplu de apel: [pop,fmax,poz,individ] = exemplu_generare(12,4,-1,2);
%generarea unei matrice mxn cu numere aleatoare din distributia uniforma pe
%[x,y]
a=unifrnd(x,y,m,n);
%presupunem ca o linie din a este un individ, iar meritul sau este suma ... |
%% OM
%%
function test = montage(course_name,task_full_file)
%%
[temp_dir,task_name,ext] = fileparts(task_full_file);
img_dir = fullfile(temp_dir,sprintf('cells_%s',course_name));
temp_list = dir(img_dir);
raw_list=[];
imgs={};
for i=1:length(temp_list)
[doll, baby, ext] = fileparts([temp_list(i).name]);
... |
function [ ] = ej22( )
close all;
imoriginal1 = imread('./images/cruis.jpg');
imoriginal2 = imread('./images/halloween.jpg');
im1 = rgb2gray(imoriginal1);
im2 = rgb2gray(imoriginal2);
h2 = [[1 1 1 1 1]; [1 1 1 1 1]; [1 1 1 1 1]; [1 1 1 1 1]; [1 1 1 1 1]];
h2 = h2/sum(h2);
imf1 = imfilter(im1, h2);
immed1 = medfil... |
classdef jysequence < jyhandle
methods
function obj = jysequence(jobj)
obj@jyhandle(jobj);
end
% This is like pymex's old intseq class. Python's sequence classes
% throw a hissy fit if you try to index them with floats. In pymex we
% get around this by us... |
function [datamat,sc] = get_subdatamat(data,idx_r,idx_ping,varargin)
p = inputParser;
addRequired(p,'data',@(x) isa(data,'ac_data_cl'));
addRequired(p,'idx_r',@isnumeric);
addRequired(p,'idx_ping',@isnumeric);
addParameter(p,'field','sv',@ischar);
parse(p,data,idx_r,idx_ping,varargin{:});
field=p.Results.field;
i... |
cd c:/shared/resmerged ;
subs = dir('*') ; subs(1:2) = [] ;
for s=26
cd c:/shared/resmerged ;
cd(subs(s).name) ;
EEG = pop_loadset('merged.set') ;
EEG.data = eegfiltfft(EEG.data,EEG.srate,1,128) ;
EEG.data = EEG.data - eegfiltfft(EEG.data,EEG.srate,59,61) ;
%temp = EEG.data(1:... |
function NCM = cal_subNCM(A,B,M)
NCM=0;
for i=1:M
for j=1:M
for k=1:M
if A(i,k)~=0&&B(k,j)~=0
NCM=NCM+1;
end
end
end
end |
% 3. Effect of Pulse Shaping on the Error Probability Curve - Part1
% Author: Seyed Mohammad Mehdi Hosseini (Smmehdihosseini@gmail.com)
clear;%close all;clc;
num_bits=1000;
M=2;
k=log2(M);
N=4;
db_snr=-30:30;
num_symbols = 8;
sam_per_sym = N;
beta_gauss = 0.3;
h_filter_guss = gaussdesign(beta_gauss,num_... |
function [value,isterminal,direction] = touchdown5_steps_red(t,qu,alpha,theta_minus,theta_plus,d)
x = fcn_qu_to_q(qu,alpha,theta_minus,theta_plus);
Psfoot=fcn_position_swingfoot(x(1:5));
value = Psfoot(2) - d;
isterminal = 1; % Stop the integration
direction = -1; % Negative direction only
end |
clc
clear all
image = double( imread( 'data/images/lena.tif' ) );
[ height width dimension ] = size( image );
representatives = LloydMax3( image, 0.001) ;
for i = 1:height
for j = 1:width
for k = 1:dimension
[ error(i,j,k), index(i,j,k) ] = min( abs( image(i,j,k) - representatives ) );
... |
function f = absolute_error(y_s,y_interpolated_s)
%funkcja liczy błąd bezwględny każdego elementu
l = length(y_s);
abs_err_s = ones(1,l);
for i=1:l
abs_err_s(i) = abs((y_s(i)- y_interpolated_s(i))/y_s(i));
if isnan(abs_err_s(i))
abs_err_s(i) = 0;
end
end
f = abs_err_s; |
function p = polyRegression(x, y, n)
% Returns the polynomial that best fits the data.
A=ones(length(x), n+1);
for j=1:n
A(:,j+1)=A(:,j).*x(:);
end
p=(A'*A)\(A'*y(:));
end |
function PressureReliefValvePerformanceCurve_GPU_MPGOS
MPGOS_REG.x = [256 768 1536 3072 3840 5120 7680 15360 30720 46080 61440 76800 92160 122880 184320 307200 768000 4147200];
% MPGOS_REG.z = [3.2 3.1 3.2 3.2 3.2 3.2 3.3 4.1 6.6 9.2 11.9 14.6 17.4 23.2 35.1 59.0 147.2 796.8];
MPGOS_REG.y = [3.3 3.3 3.4 3.4 3.5 3.6 3.... |
%MIT License
%Copyright (c) 2019 Sherman Lo
%PLOT SCANS
%Plot for each dataset, for each angle:
%x-ray scan
%x-ray simulation
%calibration scans
%calibration simulations
%calibration images only go up to the maximum power used in the x-ray acquisition
close all;
clearvars;
plotAndSaveScan([AbsNoFilterDeg30()... |
function [t, b, f] = rsgm(Xtilde,mu_min,maxiter)
% Riemannian subgradient method.
t_start = tic;
if nargin < 2
mu_min = 1e-10; maxiter = 200;
end
if nargin <3
maxiter = 200;
end
mu_0 = 1e-1; alpha = 1e-3; beta = 0.5;
% initialization
[U,~,~] = svd(Xtilde, 'econ');
b = U(:,end);
mu = mu_0;
grad = Xtilde*s... |
% Autores: Jorgeluis Guerra
% Luis Braga
% Saulo Alves
% Script para teste e depuracao do algoritmo A estrela
%% Struct do No
% node.x = x
% node.y = y
% node.g = INF (valor default = infinito)
% node.f = INF (valor default = infinito)
% node.camefrom = NULL
clear
% Valor 'infinito'
INF = 100000;
... |
%%
% This is an example of how to create a horizontal bar chart in MATLAB®.
%
% Read about the <http://www.mathworks.com/help/matlab/ref/barh.html |barh|> function in the MATLAB documentation.
%
% For more examples, go to <http://www.mathworks.com/discovery/gallery.html MATLAB Plot Gallery>
%
% Copyright 2012-201... |
%% Created by Xuan Anh Nguyen 03/10/2018
%%%%% Configuration file %%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% DIRECTORIES - please change if copying the code to a new location
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Choose one skill
... |
clear all;
close all;
% clc;
load data2
delta=0.001;
v=0.00000001;
L=5;
sss=data;
s=data(1:1500,:);
ss=data(1501:2000,:);
[m,n]=size(s);
s1=s(1:end-1,:)';
s2=s(2:end,:);
A=s2'*s1'*pinv(s1*s1');
m=length(s);
K=1/(m-1)*((s2'-A*s1)*(s2'-A*s1)');
G1=cov(s);
count=0;
G2=G1;
G2=A*G2*A'+K;
[R,p] = chol(G2);
while(p>0)
count=... |
function [u1,u2]=Rusanov(u1_0,u2_0,flux1,flux2,cflux1,cflux2,a_j_minus_half,a_j_plus_half,S1,S2,rhom0,rhom,dx,dt)
% Applies the Rusanov scheme given actual state and cell fluxes
%
% [u1,u2]=Rusanov(u1_0,u2_0,flux1,flux2,cflux1,cflux2,a_j_minus_half,a_j_plus_half,S1,S2,rhom0,rhom,dx,dt)
%
% u1,u2: ne... |
clear all;
%read image with imread
image = imread('jokerimage.png');
%convert image to double
imageD=double(image);
%size of the image
[m,n,l] = size(imageD);
%define a new array for padding
imagePadding = zeros(m+2, n+2, l);
imagePadding(2:m+1, 2:n+1, :) = imageD;
%declare the kernel
kernel = [0, -1, 0; -1, 5, -1; 0, ... |
function LaminarflowBingham(h,t,gamma,theta)
%LaminarflowBingham: plots u vs. y
%
%input argument:
% U Velocity of top plate
% h Distance between top plate and bottom plate
% t Time when u and y are evaluated
% theta angle of inclination
%
c=1... |
function [FFTData, FFTNames, FFTPars] = feature_FFT(V, ttChannelValidity, Param)
% MClust
% [Data, Names] = feature_FFT(V, ttChannelValidity)
% Calculate FFT feature value for each channel
%
%
% INPUTS
% V = TT tsd
% ttChannelValidity = nCh x 1 of booleans
%
% OUTPUTS
% Data - nSpikes x nCh of we... |
%@(#) lillbyte.m 1.2 94/08/12 12:15:17
%
%function [burnup,buntyp,ranking]=lillbyte(eocfile,antal1,bunt1,...
%antal2,bunt2,antal3,bunt3)
function [burnup,buntyp,ranking]=lillbyte(eocfile,antal1,bunt1,...
antal2,bunt2,antal3,bunt3)
if nargin<5, antal2=0;bunt2='';end
if nargin<7, antal3=0;bunt3='';end
kinf=kinf2ml... |
%build matrix to find c
for i=1:11
h1=(x(i+1)-x(i));
h2=(x(i+2)-x(i+1));
matrix(i,i)=(2*(h1+h2));
if i<11
matrix(i,i+1)=h2;
end
if i>1
matrix(i,i-1)=h1;
end
end
%build vector on right side
for j=1:11
f1=(y(j+1)-y(j))/(x(j+1)-x(j));
f2=(y(j+2)-y(j+1))/(x(j+2)-x(j+1));
c(j... |
function [ userIndex ] = findusr( userid )
%FINDUSR 此处显示有关此函数的摘要
% 此处显示详细说明
for i=1: numel(userData)
if userData(i,1) ==userid
userIndex = i;
break
end
end
userIndex = 0;
|
% doubleJaa2goodKOs = [];
% for i = 1:size(fdoubleJaa2,1)
% for j = 1:size(fdoubleJaa2,2)
% if fdoubleJaa2(i,j) < mean(fdoubleJaa2(i,:)) - std(fdoubleJaa2(i,:))
% if fdoubleJaa2(i,j) < mean(fdoubleJaa2(:,j)) - std(fdoubleJaa2(:,j))
% doubleJaa2goodKOs = [doubleJaa2goodKOs;i ... |
function checkArrayParam(c_array, t_array, glass_name_array)
type_check = isnumeric(c_array) && isnumeric(t_array) && ...
iscell(glass_name_array);
if ~type_check
error(['c_array and t_array should be numeric; '
'glass_name_array should be cell array']);
end
OpticalSystem.check1D(c_array);
OpticalSyste... |
function tch = TCPlot(cfg_in,TC)
% function TCPlot(cfg,TC)
%
% plot tuning curves, ordered by peak location
%
% INPUTS
%
% TC: tuning curves object (as returned by MakeTC())
%
% OUTPUTS
%
% tch: vector of handles to plotted tuning curves (so can do things like,
% set(tch,'FaceColor',[1 0 0])
%
% CONFIGS
%
% cfg_def.ax... |
function [L,NUM] = gp_bwlabel(BW,N)
% GP_BWLABEL Label connected components in the true regions of a logical
% BWage. Assuming [0 1 0;1 1 1;0 1 0] connectivity.
%
% L = gp_bwlabel(BW)
%
% Inputs:
% BW h by w logical BWage
% Outputs:
% L h by w BWage of ids of regions (0 for "unlabeled")
%
% ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Travelling Salesman Problem
% [1] Generate TSP map ( parse the file ) :: parse_to_map
% [2] generte all possible trips between two pairings of cities
% [3] calculate distances amongst all of those cities, using hypotheneuse
% [4] generate equali... |
% to use this just change the indexes
%% The first part is to segment particles that were missed in the first round
for i = 1:length(actualIndex_ATPgammaS)
if i ==1
counter = 1;
uniqueindexes(counter)= i;
counter = counter+1;
elseif length(FINAL_DATA(actualIndex_ATPgammaS(i-1)).full_leng... |
function alphas = update_alpha(weights, lambda, X, img1_projected_indicators, img2_projected_indicators)
%% Given X, the weights, and the indicator-correspondences, will update the scaling factor "alphas"
img1_projected_indicators_weighted = img1_projected_indicators * weights;
img2_projected_indicators_weighted = im... |
function [ horizontalSeam ] = find_optimal_horizontal_seam( cumulativeEnergyMap )
[rows, columns] = size(cumulativeEnergyMap);
horizontalSeam = [];
[val, index] = min(cumulativeEnergyMap(:, columns));
horizontalSeam = [index horizontalSeam];
r = index;
for c = columns-1 : -1 : 1
... |
% Script to batch run the Nikolic model to obtain high numbers of QBs
% Creates the required QBs which must then be time offset based on
% Gillespie simulation of photon times to get the overall summed stream
clearvars
clc
close all
% Assumptions and modifications
% - code will aim to get a max (as stochastic) of totr... |
# Section-1-
clc;
clear all;
close all;
M=4;
k=log2(M); %Number of bits per symbol
N=k*10^1; % Number of Bits to be processed
nSymbols=N/k; % Total number of symbols
generatedata= randi([0 1],N,1); % Generate bits as 0 & 1
ModulatorPSK = comm.PSKModulator('ModulationOrder',M,'PhaseOffset',0,'BitInput',true); % Define m... |
function CS4640_A4_driver
% CS4640_A4_driver - driver for A4 functions
% On input:
% N/A
% On output:
% N/A
% Call:
% CS4640_A4_driver
% Author:
% Kyle Heaton
% UU
% Spring 2018
%
warning('Function not yet implemented');
end |
function Plot_Map( h, XY )
% Plot_Map( h, XY )
% h is the plot handle
% XY are the corners
% set current figure
figure(h);
% hold on graph
hold on
% draw points
for i=1:size(XY,1)
plot(XY(i,1),XY(i,2),'.');
end
% draw lines
for i=1+1:size(XY,1)
plot([XY(i-1,1) XY(i,1)],[XY(i-1,2), XY(i,2)],'b-');
end
plot([... |
function renderTesselationMap(figNo, axesHandle, coneRFpositions, coneRFspacings, coneTypes, rgcRFpositions, rgcRFspacings, coneConnectivityMatrix, domain)
% xRange
[m, idx] = min(rgcRFpositions(:,1));
xRange(1) = m - rgcRFspacings(idx);
[m, idx] = max(rgcRFpositions(:,1));
xRange(2) = m + rgcRFspa... |
% modified version of fEmd.m
% designed to operate on unknown arrhythmia types - no averaging
function fEmd2
WD = cd; % saves the directory you are currently in, so we can navigate back later
sOriginalDir = WD; % extra step because of an idiosyncracy with saving the working directory in matlab
format long e; % increas... |
function SaveResultsAsImages( ...
tSVMTrainer, ...
fSamplingTimeInMilliseconds, ...
fTimeWindowInMilliseconds, ...
strResultsFile )
%
for iEvent = 1:numel( tSVMTrainer.atEvents )
%
% save the information on the measured class
atImages(iEvent).iMeasuredClass = tSVMTrainer.atEvent... |
function y = year(d)
% Return the year, given a string date
c = datevec(datenum(d(:)));
y = c(:,1);
|
% Figure 10.36 Feedback Control of Dynamic Systems, 5e
% Franklin, Powell, Emami
%
% Fig. 10.36 Script for computation of the yaw damper Bode plot
% for feedback through a washout circuit.
% the equations of the aircraft:
f =[-0.0558 -0.9968 0.0802 0.0415;
0.598... |
function p = solverCM2dSubspace(F, x_k, Delta)
% SOLVERCM2DSUBSPACE Solves quadratic constraint trust region problem via 2d subspace
% p = solverCM2dSubspace(F, x_k, Delta)
% INPUTS
% F: structure with fields
% - f: function handler
% - df: gradient handler
% - d2f: Hessian handler
% x_k: current iterate
% Delta:... |
%% LaplaceBeltrami
% Compute the discrete Laplace-Beltrami operator.
% Please refer to [1] for more details.
% [1] M.-H. Yueh, W.-W. Lin, C.-T. Wu, and S.-T. Yau,
% An efficient energy minimization for conformal parameterizations,
% J Sci Comput (2017). doi:10.1007/s10915-017-0414-y
%
%% Syntax
%... |
function [ kij ] = RBF_kernel(xi,xj,sigma)
kij = exp(-norm(xi-xj)^2 / 2/sigma);
|
classdef ApplyWeightsSyncAndClassic < Gridjob
%GRIDJOBEXAMPLE Summary of this class goes here
% Detailed explanation goes here
properties
stats = struct()
end
methods
%% Subclass Constructor: initialize standard parameters:
function this = ApplyWeightsSyncAndClassic(varargin)
... |
function Xnew = reconstructMesh(X, L, k, trigs)
%----------------------------------------------------------------
% reconstruct the 3d model base on first k smallest eigenvectors
% [D order] = sort(diag(D),'ascend'); %# sort eigenvalues in descending order
% V = V(:,order)
%--------------------------------------------... |
clear all; close all; clc;
h0 = fspecial('gaussian', [5 5], 0.5)
h1 = fspecial('gaussian', [5 5], 1)
h2 = fspecial('gaussian', [5 5], 2)
h3 = fspecial('gaussian', [5 5], 3)
h4 = fspecial('gaussian', [5 5], 4)
h5 = fspecial('gaussian', [5 5], 5) |
% MAIN_psth.m
% This script computes the PSTH files from the PeakDetection MAT files
% by Michela Chiappalone (18 Gennaio 2006, 16 Marzo 2006)
clr
[start_folder]= selectfolder('Select the PeakDetectionMAT_files folder');
if strcmp(num2str(start_folder),'0')
errordlg('Selection Failed - End of Session', 'Error');
... |
%==========================================================================
% Name : Dynamic Path Loss Localization Script
% Company : MAG
% Author : Connor McCann
% Date : 29 Jun 2016
%==========================================================================
%=========================... |
function [nfail, npass] = run_copse_tests(run_IDs)
% Run tests for current code against archived COPSE model output
%
% run_IDs - [optional] array of test IDs to run (default is [] ie run all tests)
%
% Tests list of configurations and error tolerance as specified in copse_tests.xlsx
% NB: th... |
clc; clear all; close all;
%**************************************************************************
%NAME:Nathanael Macias DATE: Oct. 15, 2012
%--------------------------------------------------------------------------
%PURPOSE: Program solves HW 3 Problems 1
%
%------------------------... |
testValues=zeros(322,3);
testValues(1,1)=535;testValues(1,2)=425;testValues(1,3)=197;
testValues(2,1)=522;testValues(2,2)=280;testValues(2,3)=69;
testValues(5,1)=477;testValues(5,2)=280;testValues(5,3)=69;
testValues(5,1)=477;testValues(5,2)=133;testValues(5,3)=30;
testValues(10,1)=525;testValues(10,2)=425;testVal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.