text stringlengths 8 6.12M |
|---|
function [] = FiberPlot(SP)
load(SP)
FL = IMS.FiberLabels;
[m n] = size(FL);
PlotIm = zeros(m,n,3); % It's gonna be an image
Fibers = IMS.Fibers;
f = length(Fibers);
BGColor = [255 255 255];
BG = double(FL==0);
BGR = BG.*BGColor(1); PlotIm(:,:,1) = BGR;
BGG = BG.*BGColor(2); PlotIm(:,:,2) = BGG;
BGB = BG.*... |
function showImgWithRBBs(img,roboxes,c)
if size(img,3)==1
img=cat(3, img, img, img);
end
image(img);
axis image;
axis off;
% set(gcf, 'Gray', 'white');
if ~isempty(roboxes)
X=[];
Y=[];
for i=1:size(roboxes,1)
XY = getPathOfRBBs(... |
%==================================================================================================
% Give folder where you want to want to install the demo
% *** This folder MUST already exist
%==================================================================================================
%demo_dir='c:\temp\horace_... |
function imgout = hiltrans (imgin)
[r, c, d] = size (imgin);
l2n = log2 (length (imgin))
[nr, nc] = hilcurve (l2n);
nr = pow2 (l2n) * nr + pow2 (l2n-1) + .5;
nc = pow2 (l2n) * nc + pow2 (l2n-1) + .5;
imgout = zeros (r, c, d);
imgout = imgin (nr, nc, :);
for k = 1:length(nr)
rr = floor (k / nr) + 1;
cc = mod (k, ... |
function v=call_vega(S,K,r,sigma,t,T,q)
if nargin>6
v=exp(-q.*(T-t)).*call_vega(S,K,r-q,sigma,t,T);
else
v=S.*PhiPrime(d1(S,K,r,sigma,t,T)).*sqrt(T-t);
end
end |
function [pipeline] = fcon_fmri_preprocess(process_list,infos,folder_out,opt)
% Creates an fmri preprocessing pipeline with specified options.
%
% [pipeline] = fcon_fmri_preprocess(process_list,infos,folder_out,opt)
%
% IN:
% process_list:
% Processing list in form of structure, see niak_pipeline_fmri_preproce... |
function s = halfsum(a)
[row col]=size(a);
s=0;
for i=1:row
for j=i:col
s = s+a(i,j);
end
end
end
|
function speedup_fg(sp, host, port)
% SPEEDUP_FG(SP, HOST, PORT)
%
% Speeds up Flightgear's simulation speed by a factor SP over socket
% connection (HOST, PORT).
% Run Flightgear on HOST (e.g. '127.0.0.1' = localhost) with
% parameter "--props = PORT".
%
% SP = 1: Realtime
% SP = 2: Realtime speeded up by fa... |
function plothandle=DrawCity(CityList,Tours)
xd=[];yd=[];
nc=length(Tours);
plothandle=plot(CityList(:,2:3),'.');
set(plothandle,'MarkerSize',16);
for i=1:nc
xd(i)=CityList(Tours(i),2);
yd(i)=CityList(Tours(i),3);
end
set(plothandle,'XData',xd,'YData',yd);
line(xd,yd);
title([num2str(nc-1),'城市游历路径图']... |
% 2017 08 14
% This script serves as a test for the function edfFilePreprocessingForSlepian.m
clc
clear all
close all
dbstop if error;
set(0,'defaultfigurecolor',[1 1 1])
set(0,'defaulttextinterpreter','none')
% parameters setting
% Pipeline parameters initialization
Params = setParam(1); % see the function setPara... |
function [Wavelengths_cropped,image_cropped]=Wavelengths_cropping(reconstructed_image,Wavelengths,lambda_min,lambda_max)
raws=logical((Wavelengths>=lambda_min).*(Wavelengths<=lambda_max));
Wavelengths_cropped=Wavelengths(raws);
image_cropped=reconstructed_image(:,:,raws);
end
|
% This function is used to compute the transformation matrix using the
% method of Hall
function A = computeTrans_H(ps_3D, ps_2D)
Q =[];
B = [];
pn = size(ps_2D,2);
for i = 1 : pn
Q = [Q;ps_3D(1,i), ps_3D(2,i), ps_3D(3,i),1,0,0,0,0,-ps_2D(1,i)*ps_3D(1,i),-ps_2D(1,i)*ps_3D(2,i),-ps_2D(1,i)*ps_3D(3,i);
0,0,0,... |
classdef SVAR < handle
%% SVAR class describes a set-identified SVAR model and offers tools
% to construct point estimates and conduct inteference on the impulse
% response functions (IRF).
%
% This version: 4.6.2017
% Last edited by Bulat Gafarov
%%
... |
classdef ParkingLot < handle
properties
Lot
States
inverseState
FocusCars
ActionSet
Graph
targetCar
cumulativeWeight
debug
solutions
heuristic
end
methods
function obj = ParkingLot(lot, rows, cols, capacity, targetCar... |
% reset_data_analysis_environment;
load('initialG_alphas_vA_all_pre_collapse.mat')
load('ITER_hbm_TAE_radiative_damping.mat')
% load('alphas_vA_all_collapse_Glisa_fc1h2_G110414.mat')
% load('alphas_vA_all_collapse_Glisa_fc2h2_G100214.mat')
frac_fusion=0.007
Nalphas_simulated=length(find(~alphas_ejected))
volume_vess... |
function y = dirac(x)
% the dirac step function, u(x)
if (nargin ~= 1)
disp('The dirac step requires 1 argument!');
return
end
y = cast(x==0, class(x));
|
function [fval, t, u]= myfunc(X, Y, wx, wy, mu_x, mu_y, Xwr, Ywr)
%MYFUNC is the objective function for Riem-CCA.
% X, Y are SPDs
% t,u are sets of projection results.
% mu_x and mu_y are intrinsic means of X and Y on SPD.
% wx, wy are tangent vectors at T_{mu_x}M and T_{mu_y}M.
% Xwr = logmap_spd(mu_x, ... |
% Classify a given email, x, is spam (y=1) or non-spam (y=0).
% Use the body of the email (excluding the email headers)
% Extract Features
file_contents = readFile('emailSample1.txt');
% x(j) = index of jth word in email according to a dict
word_indices = processEmail(file_contents);
% Print Stats
disp(word... |
function Save_SWE_soln1D(q,x,fname_base)
% Globals1D_DG;
% Globals1D_MLP;
fid = fopen(strcat(fname_base,'.dat'),'w');
depth = q(:,:,1);
vel = q(:,:,2)./q(:,:,1);
fprintf(fid, '%.16f %.16f %.16f \n', [x(:) depth(:) vel(:)]');
fclose(fid);
return
|
function [mu_, sigma_] = parametric(X)
%одномерный ММП
%X-выборка
mu_ = mean(X);
sigma_ = std(X);
end
|
function [e, edata, eprior] = gperr(net, x, t)
%GPERR Evaluate error function for Gaussian Process.
errstring = consist(net, 'gp', x, t);
if ~isempty(errstring);
error(errstring);
end
cn = gpcovar(net, x);
edata = 0.5*(sum(log(eig(cn, 'nobalance'))) + t'*inv(cn)*t);
% Evaluate the hyperprior contribution to the e... |
%% Removing the approach values and rescaling the z_voltage values and converting to nanometers
% trimm all the arrays to remove approach z values.
% !!! FIRST REMOVE THE APPROACH Z VALUES !!!
% !!! FIRST REMOVE THE APPROACH Z VALUES !!!
% !!! FIRST REMOVE THE APPROACH Z VALUES !!!
% !!! FIRST REMOVE THE APP... |
%Script to read in the forest cover from Hansen et al. (2013,
%http://earthenginepartners.appspot.com/science-2013-global-forest/download_v1.1.html)
%and calculate the forest cover.
%
%Part 1 reads the forest cover data and makes the calculations.
%Part 2 regrids and writes out a netcdf
%
%T. Pugh
%10.06.17
part1=fal... |
classdef rule
%rule openDrive, road, lane section, lane
% Defines the rule class of openDRIVE parent: road, lane section,
% lane
properties
sOffset
value
end
methods
function obj = rule()
%rule Construct an instance of this class
... |
function [pass,maxerr] = test(opt)
% Check that sensitivan works with strings as factor levels
rng(2)
t = linspace(0,4,200);
r = time2dist(t);
param.regparam = linspace(0.1,1,3);
param.type = {'tikh','tv'};
if opt.Display
f = figure(1); clf;AxisHandle = axes(f);
else
AxisHandle = [];
end
stats = sensitivan... |
function AvgMagneticFieldGraphSingleLayer(capV0, capC, capESR)
%Determine the most effective wire gauge for a solenoid given the other
%conditions
%constants
wireDiameters = [0.00290576581153162,0.00258826517653035,0.00230378460756922,0.00205232410464821,0.00182880365760732,0.00162814325628651,0.00145034290068580... |
function S = bkgsubBayer(H,bkg,m)
%
% Usage: S = bkgsubBayer(H, bkg, bkgmeans);
%
% Subtracts a background, bkg, from an image (hologram), H, by scaling each
% of the color channels. If the optional bkgmeans are provided (the mean
% values of bkg channels, as returned by bayerHist3FR), they can be used to
% spee... |
function phi = argamse(gamma,a,L)
% generates L samples of an ARMA spectral density function phi
% from the ARMA coefficients.
%
% phi = argamse(gamma,a,L);
% gamma -> the spectral density numerator coefficient vector
% [gamma(0),..., gamma(m)]^T
% a -> the AR coefficient vector (incl... |
%% This function applies Canny Operator to an input
%% image and can be used for edge detection.
%%% input arguments
%% image = String representing input file.
%% si = Size of Gaussian Kernel used for antialiasing the input image and calculating
%% gaussian derivatives.
%% sigma = Standard deviation of G... |
function [Q,R,S,Bw,Aw,G] = dsnmv2(A,B,k,C,Bm,Am,Be,Ae)
%
% Usage: [Q,R,S,Bw,Aw,G] = dsnmv2(A,B,k,C,Bm,Am,Be,Ae)
%
% works on w'=frac{Bw}{Aw}w where
%
% Bw/Aw = Ae*Bm/Be/Am
%
% ie on
% Ru=Qw'-Sy
%
% Programmed 2002 by Niels K. Poulsen
% Department of Mathematical Modelling,
% Technical Universi... |
function varargout = guidetemplate0(varargin)
% GUIDETEMPLATE0 M-file for guidetemplate0.fig
% GUIDETEMPLATE0, by itself, creates a new GUIDETEMPLATE0 or raises the existing
% singleton*.
%
% H = GUIDETEMPLATE0 returns the handle to a new GUIDETEMPLATE0 or the handle to
% the existing singleton*.
%
... |
clear all
clc
%% outline %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% use 3-20 ser
% loop train ANN to predict 21-60 ser.
% add err ser into trainning set in each loop.
% till all predicted ser in acceptable range
% use the k-fold to validate the net predicted result
% predict ch
%% ma... |
%% Plot digital waveform
clear, clc, close all
addpath('C:\Users\Joe\Dropbox\research\codes\mpam')
addpath('C:\Users\Joe\Dropbox\research\codes\f')
%% Pulse shape
ros = 11;
pulse_shape = select_pulse_shape('rect', ros);
% pulse_shape = select_pulse_shape('rrc', sim.ros.txDSP, 0.5, 6);
%% M-PAM
% PAM(M, bit rate, lev... |
function hol_fun = ConstrainedDynamics(nlp, rbm)
arguments
nlp (1,1) NLP
rbm (1,1) DynamicalSystem
end
import casadi.*
% number of DOF
NB = rbm.Model.nd;
% states
q = rbm.States.q.sym;
qd = rbm.States.dq.sym;
qdd = rbm.States.ddq.sym;
nContact = size(rbm.Contacts, 2);
mustBePositive(nContact)
holon... |
websave('nhk_news_covid19_prefectures_daily_data.csv','https://www3.nhk.or.jp/n-data/opendata/coronavirus/nhk_news_covid19_prefectures_daily_data.csv');
A=importdata('nhk_news_covid19_prefectures_daily_data.csv');
l=length(A.data(:,2));
B=str2double(A.textdata(2:l+1,2));
websave('nhk_news_covid19_domestic_daily_data.c... |
% This function generates and plots a random 1 x nBits logical array
%
% 'randi' is used to uniformly distribute the random integers between 0 and 1
% via [0 1]
function y = generateBits(nBits)
y = logical(randi([0 1],1,nBits)); % make nBit-long array of random logical values
end
|
function singleSubject(inimg,outdir,modality,manual_lbl)
% Resamples input image to cropped coronal oblique (left and right
% separately), and then runs them through AutoTops_TransformAndRollOut.
%
% Inputs:
% inimg: input single .nii.gz file. Must be in space-MNI152.
% outdir: output directory.
% modality: ['HCP1200-... |
% separates beds and couches into different groups
% when performing label transfer, it can be more effective to consider couches and beds as
% a single category.
% the label transfer will output the components that it thinks are either beds or couches, and then we separate them properly with this script
% input: ... |
function [y]=grid(cdata);
im=imcrop(cdata);
im=imresize(im,[240 240]);
bw=colorcrop(im);
arena=(1-bw);
arena=bwmorph(arena,'erode',6);
arena_labeled=bwlabel(arena);
stats=regionprops(arena_labeled,'basic');
z=find(max([stats(:,1).Area]) == [stats(:,1).Area])
cs_bb=stats(z,1).BoundingBox;
stats(z,1).Area=0;
z... |
function test(plot)
if (plot == 'y')
disp('yes plot')
end
end |
% new simulation
% g number of of glo
% m number of mt cells per glo
% t time steps for the analysis. it include inh + exh
% wMat is the matrix of the inhibitory connection between every two
% neurons. it is g x g x m matirx. two mt cells from the same glo can have
% different inhibition maps
% nStat is ... |
function [accuracy, iou_all, iou_weighted_ave] = part_seg_eva(gt_label_path, pred_label_path)
categories = dir(fullfile(pred_label_path,'0*'));
ncategory = size(categories,1);
accuracy = zeros(ncategory,1);
iou_all = zeros(ncategory,1);
nmodels = zeros(ncategory,1);
for i=1:ncategory
pred_models = dir(fullfile(pred... |
function testPriorityQueueAsc
p = PriorityQueue();
for i=1:10
p.push(i,i);
end
for i=1:10
v = p.pop();
assertEqual(v, i);
end
|
ZOOM_FACTOR=1
DX=DX/ZOOM_FACTOR
% NZ=NX;
Z_axis_shift=round(Z_axis/DX);
% rx_precise=rx_evol(end);
% rx_rank=round(rx_precise/DX)+1;
minX=max(mid_X-round(4.6*pTAE_sup),3);
maxX=min(mid_X+round(4.6*pTAE_sup),NZ-2);
minZ=max(mid_Z+Z_axis_shift-round(4.6*elongation*pTAE_sup),3);
maxZ=min(mid... |
function psnr = calc_psnr(mse)
%PSNR Summary of this function goes here
% Detailed explanation goes here
max_val = 256;
psnr = 20 * log10(max_val / sqrt(mse));
end |
%% Final Assignment SC42025 Filtering and Identification
% Written by Simon Stouten (4195981) and Liam Bosland(4216377)
%
% The contents to this assignment are:
% AOloop_nocontrol.m
% AOloopAR.m
% AOloopRW.m
% AOloopRWSlopes.m
% AOloopSID.m
% computeKalmanAR.m
% Cphi.m
% Hankel.m
% matstable.m
% Rank.m
% SubId.m
% vaf.... |
agentProperties = { 14 50 'blah' }; environmentProperties = [ 100 1 300 ];
initSeedDensity = 0.05;
seedGrowthRate = 0;
nutrientRewardValue = 40;
metabolicRewardValue = -2;
nutrientProperties = [ initSeedDensity seedGrowthRate nutrientRewardValue metabolicRewardValue ];
% Create OG Agent Locations
... |
mov = struct('cdata', [],...
'colormap', []);
%What is the Name of your AVI File?
Title='William_Levi_Peaks_View';
vidObj = VideoWriter(Title);
%What is the Frame Rate?
vidObj.FrameRate=14.1727;
open(vidObj)
for j=1:count
%Plot, set the axis limits you want to... |
%KingCheck Checks if the king is in check, checkmate or stalemate
%Colour in this case must be the current colour
%King Colour must be contrary to CAPT_INDEX & POTENTIAL MOVES
function [value]=KingCheck(chessboard,piece_colour,ownkingcolour, oppcolourcapt_index,oppcolourpotentialmoves)
%-------------------- King In Ch... |
function plotPanels(model)
global baseParameters exp1 exp3 exp10 exp32 exp100 exp3ca exp10ca exp32ca exp100ca exp320ca
%this matches the experimental conditions of fig 1
% from Anmar's JGP paper
m_cal=17.953218701151055;%1;
L3=baseParameters('L3');
baseParameters('C')=2*10^-3;
subplot(2,5,1);
plotNaiveResponseP... |
%%%
%%%
%%%
function [model, species, params] = DefineModel(init_species, init_params, stop_time);
if nargin==2;
stop_time = 100;
end
model = sbiomodel('Test enz');
compartment = addcompartment(model,'Cell body');
configObj = getconfigset(model);
set(configObj, 'StopTime', stop_time);
params = Se... |
function [ z ] = hl( l,x )
%UNTITLED Summary of this function goes here
% spherical Hankel function
z = sqrt(pi./(2.*x)).*besselh(l+0.5, x);
end
|
%% Exercise 1 - Load Function
%% 1.1-2 Write the file (see loanPayments.m)
%% 1.3 Calculate and plot the total interest paid for a loan:
% A) Principal of $50,000
% B) Interest rate of 0.05/12
% C) Monthly payment amounts of $500-$5000
A = 50000;
r = 0.05/12;
P = 500:100:5000;
[N,T] = loanPayments(r,A,P);
plot(P,T) |
% cd('E:\Backup\PET\Snijders\2008-10-30\PET\PET4');
% [N,T,R] = xlsread('CIfoneem.xlsx');
% xlswrite('matlabCI',R)
%%
d = dir('*.IMA');
n = numel(d);
for ii = 1:n
fname = d(ii).name;
info = dicominfo(fname);
if ~exist(info.SeriesDate,'dir')
mkdir(info.SeriesDate)
end
destination = info.Series... |
function frags=classifySubHpFrags2D(subhp,tree,frags)
% Classify sub-hp into .in, .out, .onp, .onap segments within frags.
if nargin<3
frags.in=[];
frags.out=[];
end
if isTreeCell(tree)
% Sub-hp is boundary of cell.
if strcmp(tree,'in')
frags.in=[frags.in; subhp];
elseif strcmp(tree,'out')
... |
%%
NB_PROCESS=16
% post simulation results
SAVENAME='./NBI60kev_fc0p8h2_all.mat'
n=1;
INPUTNAME=strcat('NBI60kev_fc0p8h2_',num2str(n),'.mat')
load(INPUTNAME)
for n=2:NB_PROCESS
alphas_Ekin_tot=alphas_Ekin;
alphas_mm_tot=alphas_mm;
alphas_pphi0_tot=alphas_pphi0;
alphas_pos_x_tot=alphas_pos_x;
alp... |
function plotclasssep()
title('Error Rate vs # Features for Class Sep.');
ylabel('Error Rate');
xlabel('# Features');
knnX = [1,2,3,4,5,6,7,8,9];
knnY = [.088, .038, .034, .029, .031, .025, .025, .028, .028];
line(knnX,knnY,'Color','b'); hold on;
svmX = [1,2,3,4,5,6,7,8,9];
svmY = [.091, .042, .037, .037, .029, .026, .... |
function PropagationDiscreteWaves
pathfile = which('PropagationDiscreteWaves');
path = replace(pathfile,'PropagationDiscreteWaves.m','');
addpath(genpath(path))
h = fighandle;
h.fig = figure('unit','norm','pos',[0.1 0.1 0.8 0.8],'MenuBar','none','Toolbar','none');
%%
uig = uitabgroup(h.fig);
uitab1 = uitab('Title','1... |
function logratio = naivebayes(x, y, x1)
% function logratio = naivebayes(x,y,x1);
%
% Computation of log P(Y|X=x1) using Bayes Rule
% Input:
% x : n input vectors of d dimensions (dxn)
% y : n labels (-1 or +1)
% x1: input vector of d dimensions (dx1)
%
% Output:
% poscond: log conditional probability log P(Y = 1|X=x1... |
function CP = calculate_cp(WP_current, psi_current, WP_next, psi_next, i, delta_min, my, CP_prev)
% Calculate the control points for current segment.
%
% Input:
% - WP_current: current WP
% - psi_prev: previous heading
% - WP_next: next WP
% - psi_next: next heading
% - i: Segment number.
% - CP_prev: Control points fr... |
% An NGP is a nonstationary Gaussian process model that models the
% nonstationary observed real dynamics by employing a local
% parameterizarion across an input space.
%
% NGP term is defined as part of publication of an
% algorithm LISAL that learns NGPs efficiently. NGP is also called iNGP-
% intuitive Nonstat... |
function status = ipipeRunExamplesAll
%% Run all the examples in the ISETImagePipeline tree
%
% Syntax:
% ipipeRunExamplesAll
%
% Description:
% Run all the examples in the ISETImagePipeline tree,
% excepthose that contain a line of the form
% "% ETTBSkip"
%
% Inputs:
% None.
%
% Outputs:
% statu... |
function CostFunk = EQUALRIPPLE_LP(X, n)
%
% Cost function for equalization with an allpass function.
%
% Toolbox for ANALOG FILTERS USING MATLAB, Springer, 2009
% Author: Lars Wanhammar, 2008-07-23
% Modified by:
% Copyright: Divison of Electronics Systems
% Dept. Electrical Engineering, ... |
% Write a function to find the direction and intensity of the light source in an
% image of a sphere given the sphere's parameters under the assumption that
% there is a single point light source in the scene.
% function [lv] = findLight(img, cx, cy, r)
% The function will input a greyscale imageimg along with the cent... |
function [xb, x0, x1] = var_classify (x)
%
% function [xb, x0, x1] = var_classify (x)
%
% Partitionning dataset 'x' into 2 classes by minimizing variances. If
% partitioning is not revelant, one subclasse is the dataset, and the other is
% empty.
%
% TODO: any theorical justification?
% TODO: alternative method, partit... |
function [SSP1, SSP2]= TrustMaster(s,s2);
%script input
%strs = {'1. Trust strategy versus Trust strategy', '2. Trust strategy vs Tit for Tat strategy', '3. Trust vs Win-stay Lose-shift strategy', '4. Trust vs Always Deflect strategy', '5. Trust vs Always Cooperate strategy', '6. Trust vs Random strategy','7. Win-... |
# Date created: May 26, 2020
# References:
% https://www.gnu.org/software/octave/
% https://pages.mtu.edu/~suits/notefreqs.html
# Bawal lumabas. Mag-comply ka, para ay, pwede na pala ikaw lumabas!
# Bawal Lumabas (The Classroom Song) by Kim Chiu
% Note Assignment
PAUSE = 0;
G5 = 783.99;
C6 = 1046.50;
... |
function [typen,anccodon,codonpos,mutcodon]=mutationtype(nuc,exons,strand,pos,ancnuc,mutnuc)
%warning('Please do not revcom allele');
%{
exons=[869937 870043;
870300 870389;
870761 870896;
871416 871529;
871645 871788;
873374 873475;
873733 873846... |
%% Parameter setting %%
% Sinogram domain
param.nR = 256; % radial bin
param.nA = 288; % azimuthal bin
param.dr = 1.218750; % mm
param.da = 3.141592/param.nA; % radian
% Image domain
param.nx = 256; % number of pixels
param.ny = 256;
param.nz = 207;
param.dx = param.dr; % mm
param.dy = param.dr;
... |
%% MATLAB FFT Analysis
close all
clear
clc
A_1 = 6.75E-04;
w_1 = 265.06;
% A_2 = 0.000043365;
% w_2 = 1036.7;
% A_3 = 8.1147E-06;
% w_3 = 1061.2;
% A_4 = 6.3053E-06;
% w_4 = 2126.7;
% A_5 = 5.6582E-06;
% w_5 = 1959.8;
Fs = 1014; % Sampling frequency
T = 1/Fs; ... |
% pull Pull calibration files
function pull(object)
% manage multiple digitizers
if numel(object) > 1
for n=1:numel(object)
pull(object(n));
end
return
end
% verify digitizer class
switch object.System.Class
case 'Infiniium'
% OK
otherwise
error('ERROR: %s class digitizers ... |
lena = imread('lena_color_512.tif');
mandril = imread('mandril_color.tif');
warning off
%imshow(lena);
lena = rgb2gray(lena);
mandril = rgb2gray(mandril);
% show picture after pre-processing
imshow(lena)
imshow(mandril)
% show frequency domain
%imshow(fftshift(log(abs(fft2(lena)))),[])
imshow(fftshift(... |
function varargout = manually_warp_images(varargin)
% MANUALLY_WARP_IMAGES, is a GUI which shows the controlpoint grid used
% during registration of two images, allowing the user to drag control
% points to get a better initial alignement before pressing the start
% registration button.
%
% Example,
% Istatic=im2do... |
A = 25;
f = @(x) (1)./(A*x.^2+1);
for N = 1:50
X = 1:N;
X = cos((X*2 + 1)/2/N * pi)
Y = f(X);
p = polyfit(X, Y, N - 1);
N2 = 500;
X2 = linspace(-1, 1, N2);
Y2 = f(X2);
plot(X2, f(X2), 'r-'); hold on;
plot(X, f(X), 'ro');
plot(X2, polyval(p, X2));
title('Interpolacja');
legend('f(x)', 'Punkty... |
%CUDACONV Fast 2-D convolution.
% C = CUDACONV(A, B) performs the 2-D convolution of matrices
% A and B, assuming that A is the 'data' and B is the 'kernel.'
%
% C will contain the central part of the convolution that is the
% same size as A (similar to CONV2 with 'same').
%
% NOTE:
% CUDACONV assumes... |
function template=fingerTemplateRead
%dialog for opening fingerprint files
%Honors Project 2001~2002
%wuzhili 99050056
%comp sci HKBU
%last update 19/April/2002
[templatefile , pathname]= uigetfile('*.dat','Open An Fingerprint template file');
if templatefile ~= 0
%%Pure Code
%%cd(pathname);
%%template=load(char(te... |
clear
[notwhisper,Fs] = audioread('notawhisper.wav');
[whisper,~] = audioread('whisper.wav');
[E,P] = stft_analysis(notwhisper', Fs, 512, 256);
P = 2*pi*rand(size(P));
x = stft_synthesis(E,P,512,256);
disp('Reconstructed whisper');
soundsc(x, Fs);
pause
disp('Filtered whisper');
cheby = cheby1(1, .01, .05, 'high');
... |
%%
% Auther : Gaul Swapnil Narhari,
% Developed @ IIT Kharagpur, India.
% In collaborationwith TaraNG, India.
%%
% for optimization see 'pso.m' file for fitness function defination see 'simple_fitness.m'
%%
clc;
clear all;
ObjectiveFunction = @simple_fitness;
nvars = 3; % Number of variables
LB = [0 0 0... |
function compileCTest()
num_lin = 25;
num_ang = 25;
margin = 2;
mirror_BRDF = @(angle_diff, margin) (1*(abs(angle_diff) <= margin/2));
sigma = 1;
blurred_mirror_BRDF = @(angle_diff, sigma) (normpdf(-angle_diff, -15, sigma)/normpdf(0, 0, sigma) + normpdf(-angle_diff, 15, sigma)/normpdf(0, 0, s... |
function Gd = gaussianDer(G, sigma)
% Discretize the interval [-3 sigma...3 sigma] and compute the Gaussian
% derivative for each value x from the discretized interval
x = linspace(-3*sigma, 3*sigma, 6*floor(sigma) + 1);
Gd = -x/(sigma^2).*G;
end |
% TIMEDERIVATIVE Compute symbolic time derivative of a matrix
%
% Syntax:
% [dAdt, dxdt] = timeDerivative(A, x)
% |
function [temp] = RGP (n, c)
M=zeros(n);
Ecomp = nchoosek(1:n, 2);
time=0;
while (((c==1&&(sum(any(M+transpose(M)))~=(n-1))) || (c==2&&(graphconncomp(sparse(transpose(M)),'Directed',false)~=1))) && ~isempty(Ecomp))
line=randi(size(Ecomp,1));
cell=Ecomp(line,:);
Ecomp(line,... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Unwrap the raw data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function UGcim = BlockUnwrapping(Gcim,mask,UnwrapFlag,TwoDFlag,OneDFlag);
function UGcim = BlockUnwrapping(Gcim,mask,UnwrapFlag)
% The fu... |
function core=stampDiode(core, i)
n1=core.Element(i).Node1;
n2=core.Element(i).Node2;
if(n1~=0)
v1 = core.vNodeset(n1);
else
v1 = 0;
end
if(n2~=0)
v2 = core.vNodeset(n2);
else
v2 = 0;
end
%diode equations:
Is = 10^(-15); % saturatio... |
function [ Xv, Yv ] = getData( dataSrcName )
% function: [ Xv, Yv ] = getData( dataSrcName )
%
%getData() retrieves data for a given source name.
%
%Inputs:
%
%data source names list: { 'ozone', 'wind', 'image', 'rain', 'sp500', 'juraCu' }
%
%Outputs:
%
%Xv: is a vector of coordinates for locations with s... |
clear
clc
% load given data
load('C:\Users\nit_n\Documents\MATLAB\h_alpha\n4321\matlab_data\ellipse_fit.mat');
r_terp=[r_ring(1,1):1:r_ring(length(r_ring),2)]';
va0_terp=interp1(mean(r_ring')',va0,r_terp,'pchip');
w=va0_terp./r_terp;
diff_wsqr=-va0_terp.^2./r_terp.^3;
K=sqrt(r_terp.*diff_wsqr+4.*(w).^2);
[r_terpw, r... |
function [theta] = angleP(A,B,C,i)
% Calculates angle at B between A and C
%
%
% Copyright Julian Lopez-Uricoechea & Kenny Breuer, Brown University 2019
%
global xData
global yData
global zData
AB = [xData(i,B)-xData(i,A);yData(i,B)-yData(i,A);zData(i,B)-zData(i,A)];
BC = [xData(i,C)-xData(i... |
function [WN1,WN2,WN3,WN4]=Suspension(W1,W2,W3,W4)
global TLLTD AYG WT TF1 TF2 TF3 TR1 TR2 TR3
%{
FTrack=1.2;
RTrack=1.2;
Wt=WF+WR;
WDist=WR/Wt;
WuR=WR*0.3;%unsprung is 20% of total rear weight
WuF=WF*0.2;
Ws=Wt-Wt*0.255;%unsprung mass is 25% of total mass
TrackSpr=0.850;%Spring track on beam. Try to get high... |
% ReDySim plot_mtum module. This module plots linear and angular momentum
% Contibutors: Dr. Suril Shah and Prof S. K. Saha @IIT Delhi
function[]=plot_mtum()
disp('------------------------------------------------------------------');
disp('Plotting total linear and angular momentum');
load mtvar.dat;
load timevar.dat... |
clc; clear all;% close all;
%% General Description and Use
%accepts state vectors
%% Simulation Setup
% These are the only variables that you need to change for the simulation.
%% Initial and Final Orbit information
% section defines initial and final orbit parameters.
% Body(1) is the body the satellite is ... |
tic
addpath(genpath('.\btk'))
folder = {'.\CP',...
'.\FD',...
'.\ITW'};
group = {'CP','FD','ITW'};
diff_global_FO = struct();
diff_global_FS = struct();
%algorithm's settings, for foot contact
set_str=7; %Set choice: 1=all marker, 2=minimal, 3=lower body, 4=legs, 5=shanks, 6=feet, 7=foot and ankle
side_str=1... |
data_source= fullfile(pwd,'Data','Fe_ei200.sqw');
proj.u = [1,0,0];
proj.v = [0,1,0];
pos = [1,1,0];
mff = MagneticIons('Fe0');
fixer = @(ws)(mff.fix_magnetic_ff(ws));
erange = [0,2,200];
outfile = fullfile(pwd,'Data','Fe_ei200shift110test_s_s1.sqw');
zonelist = {[1,1,0],[1,-1,0]}; %,[-1,1,0],[0,1,1],[0,1,-1],[0,-1,1... |
%Molecular Dynamics Simulation of Hard Spheres
%Considering the influence of gravity
%--------------------------------------------------------------------------
%0.Parameter
clear;
geometry_one;
genertor_one;
parameter;
%--------------------------------------------------------------------------
%1.Estab... |
userInput = input('Enter the number of rows desired: ');
number = 1;
for b = userInput + 1 :-1:1
fprintf(' ') ;
end
fprintf('%d ', number);
fprintf('\n') ;
while length(number) < userInput
for n = userInput : -1:1
for m = n :-1:1
fprintf(' ') ;
end
number = [0 number] + [... |
%% Homogeneous Random Effects, single simulations
clear;clc;
% Specify data I/O
Path_InputData = 'Y:\Users\Jialin Yi\output\paper simulation\FixNClusters\data\';
Path_OutputSpaghetti = 'Y:\Users\Jialin Yi\output\paper simulation\FixNClusters\Spaghetti Plot\';
Path_OutputSubject = 'Y:\Users\Jialin Yi\output\paper simul... |
%%%%%%%%%%%%%%%%%%%% System Identification %%%%%%%%%%
%%%% 4-April-2021
clc
clear
close all
global mu W mc G ma RB
mc = 150; % spacecraft's mass(kg)
ma = 6.687e15; % 433 Eros mass (kg)
RB = 16; % reference radius of Eros(km)
i = 10.28*pi/180; % inclination
hs = 218e6; % height ... |
function poles = ARmodel(data,model_order)
% AR Model Fitting (Yule-Walker (aka autocorrelation method))
% Reference: R. Takalo, H. Hytti, and H. Ihalainen, ?Tutorial on Univariate
% Autoregressive Spectral Analysis,? J Clin Monit Comput,
% vol. 19, no. 6, pp. 401?410, Dec. 2005.
corr_func = xco... |
clear all; close all; clc;
gd = imread('IF69D_Atividade_05_arquivos/flowervaseg.png');
h = -1*fspecial('laplacian', 0);
gdL = imfilter(gd,h,'replicate');
gdLs = gd + gdL;
gdlsU = im2uint8(gdLs);
gdlsD = im2double(gdLs);
figure, imshow(gd)
title('Original')
figure, imshow(gdlsU)
title('uint8')
figure, imshow(gdlsD)
titl... |
% itercluster analysis
clc
clear all
close all
warning off
addpath(genpath('C:\My Doc\Projects\comp bio\Matlab-Network framework\to send\network modules-lassoMCMC\glmnet_matlab'))
addpath(genpath('C:\My Doc\Projects\comp bio\Matlab-Network framework\to send\network modules-lassoMCMC\data'))
addpath(genpath('... |
fil='*.mat';
fs=500;
n_bands=5;
dt=fs*8;
n_epochs=6;
tstart=6*fs+1; % I primi 6s e gli ultimi 6s non considerati
inDir='D:\Ricerca\Ricerca3_Comparison\Sources_mat\';
outDir='D:\Ricerca\Ricerca3_Comparison\PSD\PSD_Sources\';
cases=dir(fullfile(inDir,fil));
for i=1:length(cases)
i
load(str... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.