text stringlengths 8 6.12M |
|---|
flag=1;
classes=input('Enter the number of Classes');
display('choose the original image');
if flag==1
[mapsize,fn] = mapwindow();
a=imread(fn);
[m1,n1,o1]=size(a);
m2=m1*mapsize;
n2=n1*mapsize;
mixed_matrix=zeros(m2,n2);
pso_matrix=zeros(m2,n2,class... |
function out1 = hess_grf_ceq_heel316(in1,toe_th,dmax,cmax,k,us,ud)
%HESS_GRF_CEQ_HEEL316
% OUT1 = HESS_GRF_CEQ_HEEL316(IN1,TOE_TH,DMAX,CMAX,K,US,UD)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 23-Jun-2020 10:50:11
out1 = 0.0;
|
function im_r = imrotate_gpu(k,im, out,angle_r)
% k: the cuda kernel object in matlab
% im: input 3D
% out: output 3D
[nx,ny,~] = size(im);
im_r = feval(k,out,im, nx,ny, angle_r);
end |
%% ECE411 Nyquist 4
clc; clear all;
s=tf('s');
pathS=[];
pathS1=[];
pathS2=[];
pathS3=[];
pathS4=[];
theta=linspace(0,pi/2,1000);
for i=1:length(theta)
pathS(end+1)=.2*exp(j*theta(i));
pathS2(end+1)=.2*exp(j*theta(i));
end
for i=.2:.1:500
pathS(end+1)=complex(i*j);
pathS1(end+1)=complex(i*j);
end
% pat... |
x = linspace(-2*pi, 2*pi, 101);
sinx = sin(x);
cosx = cos(x);
expx = exp(x) / 100;
plot(x, sinx, x, cosx, x, expx)
title('Random Plots')
xlabel('\alpha (radians)')
ylabel('Values')
legend('sin(\alpha)', 'cos(\alpha)', 'exp(\alpha)')
grid on
axis tight |
function image_padded = add_padding(image)
% Pads image so that dimensions are powers of 2.
%
% outputs:
% image_padded: padded image.
%
% inputs:
% image: input image.
[height width] = size(image);
% pad image when dimensions are not powers of 2/equal to each other:
nearest_pow = 2^ceil(log2(max(width,height)));... |
% Workshop 1 - Dylan Karunaratna 1079286 and Qian Wu 813560
clear all; close all; clc
%% Section A
% Design and display the initials "Q & W"
ImgA = zeros(50,80);
% Printing letter Q
ImgA(10:40,10:15) = 1;
ImgA(10:15,15:30) = 1;
ImgA(35:40,15:30) = 1;
ImgA(15:35,25:30) = 1;
ImgA(35:40,30:34) = 1;
% Printing letter... |
function [ pos, nav ] = calcPosNav( tick, list )
%CALCPOSNAV Summary of this function goes here
% Detailed explanation goes here
numTick = tick.latest;
numTrade = list.latest;
pos = zeros(numTick,1);
nav = zeros(numTick,1);
tradeNo = 1;
for i = 2:numTick
if i<list.tick(tradeNo)
pos(i) = pos(i-1);
... |
function studyname = getStudyName(pth)
%GETSTUDYNAME Get the study name from the filepath.
%
% Input should be either:
% a) a path containing a DICOM folder, or
% b) a path to a file used in registration
%
% Otherwise a random name will be made up from the path
%
% Trailing file separator can either be present o... |
function sol =fun(X,Re)
f= X;
sol=-0.4*sqrt(f)+sqrt(3*f)*log(Re*sqrt(f))-1;
end
|
function [pc,dpc] = autoGen_contactPoint(x,y,q0,dx,dy,dq0,th,r)
%AUTOGEN_CONTACTPOINT
% [PC,DPC] = AUTOGEN_CONTACTPOINT(X,Y,Q0,DX,DY,DQ0,TH,R)
% This function was generated by the Symbolic Math Toolbox version 6.2.
% 13-Aug-2015 13:14:17
t2 = q0+th;
t3 = cos(t2);
t4 = sin(t2);
pc = [x+r.*t4;y-r.*t3];
if narg... |
classdef quatmult_test < matlab.unittest.TestCase
methods (Test)
function tests(testCase)
testCase.verifyEqual(quatmult([1; 2; 3; 4], [2.1; 4.5; 3.2; 1.3]), ...
[-21.7; -0.2; 24.9; 2.6], ...
'AbsTol', 0.0000001)
end
en... |
% Copyright is with the following author(s):
%
% (c) 2012 Juraj Oravec, Slovak University of Technology in Bratislava,
% juraj.oravec@stuba.sk
% (c) 2012 Monika Bakosova, Slovak University of Technology in Bratislava,
% monika.bakosova@stuba.sk
% ------------------------------------------------------------------------... |
function Q = dg_solar_insolation(yd,lat,h)
% synopsis: Qday = dg_solar_insolation(yd,lat[,h])
%
% DG 2015-03-02, 2015-03-03
% yd is year day, July 15 is yd 196 and Oct 1 is yd 274
% lat is latitude in degrees
% based on http://en.wikipedia.org/wiki/Insolation
dbstop if error
theta = mod((yd-80),365)/365*360; % turnin... |
function [G,GB,GC]=sincRigidTransformGradient(xB,et,etg,F,FH)
%SINCRIGIDTRANSFORMGRADIENT obtains the gradient of the sinc rigid
%transform of the volumes
% G=SINCRIGIDTRANSFORMGRADIENT(XB,ET,ETG,{F},{FH})
% * XB are the volumes before the first, second and third rotations,
% before the translation and origina... |
% 基于迈克耳孙干涉仪的自相关仪
c = 299792458;
l = 4e-6; % 20 nm
L = 25e-3; % 25 mm
t = 2*l/c; t = t*1e15 % fs
% scan range
T = L/l *t; % fs
T = T*1e-3 % ps
f = 1/T; % THz
f = f*1e3 % GHz
|
clear all; close all; clc
% -------------------------------------------------------------------------
% Cargando la DATA
% -------------------------------------------------------------------------
data_load = load('../data/motor_gate.lvm');
T = 1/30; % Tiempo de Muestreo
y1=data_load(:,4);
u1=data_load(:,2);
% -------... |
function [Fs,Ms,Hs] = put_fmo_frame(fr, n, gm)
if nargin < 2
n = 16;
end
if nargin < 3
gm = 1/2.2;
end
st_t = 0;
en_t = 1;
len_t = en_t - st_t;
img = fr.im_c.^(1/gm);
bgr = fr.bgr_c.^(1/gm);
coeff = fr.coeff;
if isempty(coeff)
% [params, cfg] = EVAL.get_params(false);
% hmask = conv2(fr.T, double(diskMask(30)), '... |
function plot_fft_analysis(fftstoplot, savefig, savepath)
if(nargin>1)
if(savefig)
if(isempty(savepath))
mkdir('tmpfig');
savepath = 'tmpfig';
end
end
else
savefig = 0;
end
width = 3.25;
height=2.75;
figure... |
% TEST_smoothControl.m
%
% Tests the smooth controller
kp = 25;
kd = 10;
uMax = 5;
xRef = 0.0;
vRef = 0.0;
x0 = 1.0;
v0 = 0.0;
dt = 0.005;
tSpan = [0, 2];
nGrid = ceil(diff(tSpan)/dt);
t = zeros(1,nGrid);
x = zeros(1,nGrid);
v = zeros(1,nGrid);
u = zeros(1,nGrid);
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... |
function scans_to_process = longDTI_warp_timepoint_to_ICBM_via_long( scans_to_process, templatepath )
%longDTI_warp_timepoint_to_ICBM_via_long - warp from DARTEL space to MNI
%
% Syntax: scans_to_process = longDTI_warp_timepoint_to_ICBM_via_long( scans_to_process, dartelpath)
%
% Inputs: scans_to_process - array ... |
classdef (Sealed = true) DASequence < handle % matlab.mixin.Copyable
% da sequence
% Copyright 2017 Yulin Wu, University of Science and Technology of China
% mail4ywu@gmail.com/mail4ywu@icloud.com
properties
outputDelay = [0,0];
outputDelayByHardware = false;
xfrFunc
padLength
end
pro... |
classdef (Abstract = true) qobject < handle & dynamicprops & matlab.mixin.Copyable
%
% Copyright 2016 Yulin Wu, USTC
% mail4ywu@gmail.com/mail4ywu@icloud.com
properties
name@char = ''
end
properties (SetAccess = private)
id@uint32 % globally unique id
end
properties (SetAcc... |
function result = testEqual(matrix1, matrix2)
for i=1:size(matrix1, 1)
if(~strcmp(matrix1(i), matrix2(i)))
result = 0;
return
end
end
result = 1;
end |
function b = fn_color2bw(a)
% function b = fn_color2bw(a)
% Thomas Deneux
% Copyright 2005-2012
% input
[nx ny ncol] = size(a);
if ncol==1, b=a; return, end
if ncol~=3, error('3rd dimension should have size 3 for RGB image'), end
m = max(a(:));
if m>65535 || min(a(:))<0, error('image should have values between 0 and ... |
% SitzungIa.m
clc;
clear all; % LOESCHEN ALLER VARIABLEN AUS DEM WORKSPACE
close all; % LOESCHE VON BILDER, FALLS NOTWENDIG
disp(' SKALARE UND VEKTORIELLE VARIABLEN')
pause;
%1
disp('>> n = 8 % EINGABE EINES SKALARS (MIT ERGEBNIS-ANZEIGE)');
n = 8
pause;
... |
function numGradSum = calcNumGradSum(depFcts, indepVars, indepVals, h)
for ind_preallocate = 1:length(indepVars{1})
numGradSum(ind_preallocate) = sym(0);
end
for ind_baseFct = 1:length(depFcts) % iterate through all the dependent variables
for ind_indepVar = 1:length(indepVars) % iterat... |
clear all;close all; clc
% main function for Cluster Performance
parameter=struct('interval_x',[0 1500],... %(m)
'interval_y',[0 1500],... %(m)
'interval_speed',[0 15],... %(m/s)
'velocity', 10,... %(m/s)
'interval_... |
function plotLFPs(filepath,daqfiles2plot)
% Quick plotting function for daqout files. akm, 6/21/17
% filepath = path to main data directory
% daqfiles2plot = file info with .name field, e.g. --
% **example**
% clear all; close all; clc
% dataDir='C:\Users\amoore\AKM\Data\121917_001';
% i=1;
% daqfiles2plot(i).name='da... |
function [Ynorm, Ymean] = normalizeRatings(Y, R)
%NORMALIZERATINGS Preprocess data by subtracting mean rating for every
%movie (every row)
% [Ynorm, Ymean] = NORMALIZERATINGS(Y, R) normalized Y so that each movie
% has a rating of 0 on average, and returns the mean rating in Ymean.
%
[m, n] = size(Y);
Ymean = zer... |
classdef SVMSGD < handle
%SVMSGD Stochastic Gradient Descent SVM classifier
%
% SVMSGD provides a fast and easy-to-use implementation of the SVM
% classifier using the Stochastic Gradient Descent approach, as presented
% in [bottou2010large].
%
% The classifier has following parameters:
... |
function [conGUI] = LoadSimAnimator(robot, logger, varargin)
t = [];
q = [];
for j=1:numel(logger)
t = [t,logger(j).flow.t]; %#ok<*AGROW>
q = [q,logger(j).flow.states.x];
end
exo_disp = plot.LoadRobotDisplay(robot, varargin{:});
... |
function IOCAnalysis()
setPaths();
nownowstr = datestr(now, 'yyyymmddHHMMSS');
sourceSuffix = '20200413_FatigueFull_3CF';
targetSuffix = '20200413_FatigueFull_3CF_3';
searchString = 'mat_*_3DOF_3CF*.mat';
basePath = ['D:\results\fatigue_ioc03_weightsPattern\' sourceSuffix '\mat\'];
ou... |
%%testMultispectralStructToLMSStruct Example to run multispectralStructToLMSStruct function
% multispectralStructToLMSStruct(...
% 'multipsectralStructFolder','StimuliRandomTargetShapeFixedIlluminantFixedBkGnd_dY0_01',...
% 'LMSStructFolder','RandomTargetShapeFixedIlluminantFixedBkGnd',...
% 'outputFileNam... |
function results = run_experiment (self, keypoint_detector, descriptor_extractor, sequence, varargin)
% Input:
% - self:
% - keypoint_detector: function handle that creates keypoint
% detector instance, or a keypoint detector instance
% - descriptor_extractor: function handle that creates
... |
function [funv_array, x_array, tt, resi_array, num_iter, cput, ssa] = alg_rpn_tt( x0, data, model, opts)
% This function uses IRPN to solve l1-regularized logistic regression
% problem. The decription of the algorithm can be found in our paper:
% M.-C. Yue, Z. Zhou, A. M.-C. So:
% "A Family of Inexact SQA Met... |
% input parameter style
% DH is a matrix
% DH = [alpha,a,d,theta,0,0]
% rad = 0 if the input angle will be in degree
function Robot = DH2Robot(DH,rad)
[m,n] = size(DH);
for i=1:m
a = DH(i,2);
d = DH(i,3);
rot = DH(i,5);
off = 0;
al = 0;
th = 0;
if(rad == 0)
al = DH(i,1)*pi/18... |
function varargout = ThreeJJQbtES(varargin)
% THREEJJQBTES M-file for ThreeJJQbtES.fig
% THREEJJQBTES, by itself, creates a new THREEJJQBTES or raises the existing
% singleton*.
%
% H = THREEJJQBTES returns the handle to a new THREEJJQBTES or the handle to
% the existing singleton*.
%
% THREEJ... |
function [area,esqueLongi] = sacarProp(imagenBin)
%--------------------------------------------------------------------------
%-- 1. Inicio de la función sacarProp -------------------------------------
%--------------------------------------------------------------------------
%----------------------------------------... |
function [stim, noiseRMS,total_dur] = ITDt_ToneDetect(ToneDur, fs, BPfilt,fm,SNRdes,StaticIAC)
%Da is input as a column
%stim is 3AFC with the 3rd one being correct
%SNR in dB
%StaticIAC should be empty, 1, or 0 for this experiment
fc = 800;
Pre_Post_dur = 0.2;
total_dur = Pre_Post_dur*2 + ToneDur;
t = 0:1/fs:Tone... |
function ObjectiveFunctionValue = FluenceModelObj(VolumeFraction,ssptx,d_pasource,muaFraction, muaReference,d_maskimage,d_materialID,d_PAData,nsource,powerFraction,PowerFnc,d_xloc,d_yloc,d_zloc,spacingX,spacingY,spacingZ,npixelx,npixely,npixelz,PlotSolution)
% get power setting
power = PowerFnc(powerFraction);
%% TOD... |
Init
disp(['Running experiment ' mfilename '.m'])
%%
pb = 2;
params = [1 2 3 4];
snr = 10;
N = 128;
nb_train_signals = 3000;
Parameters = [];
Parameters.K = 150;
Parameters.cstr.Sigma = 'd*';
Parameters.cstr.Gammat = '';
Parameters.cstr.Gammaw = '';
Parameters.Lw = 0;
snr_train = 60;
int = [.01... |
function [] = plot_phase1(S,G,t0,tf,r)
% Plot and check results for simple 2D, min velocity^2 C-CAPT.
% ASSUMPTIONS:
% Velocity constant (for velocity verification)
% Initialization ==========================================================
N = size(S,1);
% Time parameterization
beta = @(t) (-t0 + t)/(tf-t0);
% Ro... |
clc
clear all
close all
Lat_o = convang(-22.8189685, 'deg','rad');
Lon_o = convang(-47.0647617, 'deg','rad');
Alt_o = convang(0, 'deg','rad');
Xp = 65;
Yp = -164;
Zp = 0;
psio = convang(0, 'deg','rad');
href = 0;
%R = 6378137 f = 0.003352813
f = 1/196.877360;
R = 3397000;
dNorth = cos(psio)*Xp - sin(psio)*Yp;
d... |
%This function will find the line of best fit when given points in 3d
% Returns start point (Point). Direction vector(Vector),
% Average distance of Points to generated line(AvgDistance), Standard Deviation of distances (Std)
% and matrix of all distances (D)
function [Point, Vector, AvgDistance, Std, D] = Line_Fit(p... |
function n=day_counter(year)
x=[31 28 31 30 31 30 31 31 30 31 30 31];
day=0;
for i=1776:year
n=0;
for j=1:length(x)
if j==3
if rem(i,400)==0
day=day+1;
end
if rem(i,4)==0 && rem(i,100)~=0
day=day+1;
end
end
... |
addpath Model;
tic
rng = LCG(912915758);
for i = 1:1000000
a = rng.rand();
end
disp(['Time LCG ',num2str(toc)])
tic;
for i = 1:1000000
a = rand;
end
disp(['Time Matlab ',num2str(toc)]) |
function[MDNpre5,MDNcon5,MDNdep5] = sort2005(MDNpre,MDNcon,MDNdep)
% To take only data from 2005 onwards
MDNpre5 = MDNpre(109:end,:);
MDNcon5 = MDNcon(109:end,:);
MDNdep5 = MDNdep(109:end,:);
end |
%% Script for loading in .edf ICA data from Brain Analyzer to validate the artifact labeling using EEGLAB's machine learning process
% Terminology:
% EEG.icawinv is the inverse ICA weight matrix
% EEG.icaweights is the ICA weight matrix
% EEG.icachansind is a vector from 1:number of channels
% EEG.icas... |
function mat = twoD_iDFT(X)
[x, ~] = size(X);
mat = zeros(x);
for j = 1:x
for k = 1:x
[Y, ~, ~] = compex_mat((j-1),(k-1),x);
mat(j, k) = twoD_inner(X, Y);
end
end
end |
addpath(genpath('Functions'));
Baseline = 300;
%% Evoked All
file_prefix = '/dataslow/sheng/Project of Sheng/Results/sheng/Mat_evoked/II_grating';
file_suffix = '_evoked_all.mat';
Result = [];
for subject = 16:16
if subject < 10
load([file_prefix '0' num2str(subject) file_suffix]);
else
lo... |
function lum_table = BuildLumTable(mtable, target_lum, rel_lum)
if ~exist('mtable', 'var') || isempty(mtable)
mtable = LoadMeasurementTable;
end
if ~exist('target_lum', 'var') || isempty(target_lum)
target_lum = TargetLum_Linear;
end
if ~exist('rel_lum', 'var') || isempty(rel_lum)
rel_lum = RelLum_sRGB;
end... |
function [ demod,BER ] = DSBPSK( input_bit_stream ,Eb,No,jammer_flag,jammer_energy)
%% BPSK modulation
a = sqrt(Eb);
Tb = 1/(64*1000);
Tc = Tb/31;
PN_sequence = PN_sequence_gen();
bipolar_PN = (PN_sequence - 0.5)*2;
output = zeros(1,31*length(input_bit_stream));
noise = sqrt(Tc/Tb)*sqrt(No/2)*randn(1,31*length(input_bi... |
function hs = pstimulus(hAxis,onset,length,number,isi,style)
%===============================================================================
% DRAWSTIMULUS Draw line markers to indicate temporal position of
% photostimulus. Draws either single bar or series of ticks for
% stimulus trains.
%
%=======================... |
classdef (Abstract = true) GetP < Measurement
% Abstract class for probability measurement. All probability measurement
% classes are subclasses of this class.
% Purpose of creating this dummy class:
% With GetP, to determine if a object 'obj' is a probability measurement:
% isa(obj,'GetP')
% wi... |
function compute_movie_file(A, filename, options)
% compute_movie_file - create an avi or gif file
%
% compute_movie_file(A, filename, options);
%
% A can be a 3D array or a cell array of 2D matrices.
% Each A{k} or A(:,:,k) is one frame in the animation.
%
% Output avi or gif file depending on the extension o... |
function [ s , err, errmsg] = txt2str( txtfile )
% reads txt file from disk, returns a string
% a carriage return '\n' is maintained at end of each line
%
s = '';
err = 0;
errmsg = '';
if nargin < 1 || ~ischar(txtfile) || ( exist(txtfile, 'file') ~= 2 )
err = 11;
errmsg = 'Error: miss... |
%% Wrapper for functional data
clear;
% Outline
% 1) Get the mask and the func files
% 2) Use niak_brick_tseries to get the tseries from the files
% 3) Use niak_brick_neighbour to build a neighbourhood from a mask
% 4) Store the timeseries in a mat. Store the neighbourhood in a mat
% 5) Run the files through our pipel... |
function [ X, Y ] = get_weak_classifier( size, index )
% function [ X, Y ] = get_weak_classifier( input_args )
% This function returns the weak_classifier identified by its index
function fcontinue = get_feat(cur_X,cur_Y,f,g)
fcontinue = 1;
if(f == index)
X = cur_X;
Y ... |
function g = pointNegGrad(x, y, X, A, theta, invK, m, C) %(x_i, i, A, invK, X, Y, D, theta)
% POINTNEGGRAD Compute gradient of data-point likelihood wrt x.
if nargin < 7
m = [0 0];
C = [1 0; 0 1];
end
presentInd = find(~isnan(y));
Atemp = A(presentInd, :);
D = length(presentInd);
kbold = kernel(x, X, theta)'... |
%% CUSTOM FIGURE
function h = aux_figure(varargin)
% copyright: Keno Jüchems 2015
if isempty(varargin)
h = figure;
else h = varargin{1};
end
% if ishandle(h)
% else
% h = figure;
% end
black = [0 0 0];
white = [1 1 1];
grey = [0.75 0.75 0.75];
% h = figure;
h.Color = white;
ax = gca;
a... |
function J = computeCost(X, y, theta)
%COMPUTECOST Compute cost for linear regression
% J = COMPUTECOST(X, y, theta) computes the cost of using theta as the
% parameter for linear regression to fit the data points in X and y
m = length(y); % number of training examples
hyp = X*theta; ... |
function f_handle = GetGridValidator()
%GETGRIDVALIDATOR Returns logical validator function for a grid.
%
% Validator function accepts Grid object (structure) as an input (e.g., from
% GridConfig.RhythmicGrid OR GridConfi.Grids{1}) and returns a single logical
% value.
% a valid rhythmic grid satisfies fo... |
%% meshREVBone.m
%{
Metadata:
Author: Gustavo Peixoto de Oliveira
Date: August, 2015
e-mail: gustavo.oliveira@ci.ufpb.br
Federal University of Paraiba
Description: mesher with Febio embedded structures intended to simulate
bone structures generated from image sequence reading.
This script is intended to mesh both... |
classdef uiBSD < handle
properties
gui
study
default_eeg
is_saved
ws_filename
end
methods
function obj=uiBSD()
% loaded data
obj.study.data = {};
obj.study.metadata = {};
% generated data... |
clc;
close all;
clear all;
mdl = load('osdAugSVM.mat');
mdl = mdl.mdl;
figure(1);
while true
system('python imgSave.py');
thresIm = imread('threshImg.jpg');
figure(1);
title('Thresholded Image');
imshow(thresIm);
orgIm = imread('origImg.jpg');
figure(2);
imshow(orgIm);
hog = ext... |
function[datos_x_1, datos_x_2, datos_y_1, datos_y_2, recta_1, recta_2, a1, b1, a2, b2, delta_1, delta_2] = receta_hexagono_idea_2(datos_x, datos_y, camara)
if camara == '1'
% [datos_x, datos_y] = filtro_basura_derecha_absoluto(datos_x, datos_y);
cant_sigmas = [3 2 3 3 3 3 3 3 3 3 3];
... |
clear all; close all; clc
% Define the domain of interest
x = linspace(-5, 5, 101);
a = 0;
m = [1, 2, 5, 10];
prm = {'-rs', '-gd', '-bv', '-mp'};
lgd = {'f(x) = e^x'};
% Plot f(x) = exp(x)
plot(x, abs(exp(x)- exp(x)), '-ko', 'linewidth', 2.0);
hold on;
% Plot f_m(x)
for i = 1:length(m)
y = exp_taylor(... |
function A=downsamp(A)
sz=ceil(size(A)/2);
A=A(:,1:sz(2));
for ia=1:sz(1)
A(ia,:) = A(2*ia-1,:);
end
A=A(1:sz(1),:); |
nA = 0; % Initialise all
nD = 0; % . . occurrence counts
nAD = 0; % . . to zero
for m = 1:Mrep
Red = randint(6); % Simulate
Blue = randint(6); % . . dice rolls
if (Red<4 && Blue<4) % If event A occurs
nA = nA + 1; % . . increment event A counter, and
... |
function [normR, p] = blrtest(p1, p2, h, boundaries, bmin, isNested)
% BLRTEST computes the likelihood ratio.
% Source: http://tuvalu.santafe.edu/~aaronc/powerlaws/bins/
%
% -------
% Notes:
% -------
%
% 1. p1, p2: These are the pdfs of the two distributional models
% which you want to compare.
% ... |
function vesselness_demoOofOfa_2D_v2()
%% INPUT
% load(fullfile('..', 'debugMATs', 'importTemp.mat'))
load(fullfile('segmentationDemo', 'testData', 'slices10_16_timepoint3_denoised_NLMeansPoisson.mat')); imageStack{1}{1} = im(:,:,1:3);
slice = 2;
testImage_2D = double(i... |
function out = lat_to_Rc(lat)
% This applies Lifton polynomial to convert geographic lat to Rc.
latr = lat.*pi./180; % convert to radians
% Define polynomial in cos(lat) from LSD2014, Equation 2
pRc = [-448.004 1189.18 -1152.15 522.061 -103.241 6.89901 0];
% Apply polynomial formula
out = polyval(pRc,cos(latr)); |
function [Cloud,Intensity]=SimulatedData(upper_bound_x,lower_bound_x,upper_bound_y,lower_bound_y,upper_noise_x,upper_noise_y,upper_depth,actual_points,noisy_points,start,intensity_actual,intensity_noise)
step_x=(upper_bound_x-lower_bound_x)/actual_points;
step_y=(upper_bound_x-lower_bound_x)/actual_points;
gv_x ... |
% SERIAL_SEND_ARRAY Sends a vector of binary data to the DSP Shield.
%
% SERIAL_SEND_ARRAY(S, X) send data vector X over the serial
% object S assuming INT8 data type.
%
% SERIAL_SEND_ARRAY(S, X, TYPE) send data vector X over the serial
% object S assuming TYPE as data type. Valid data types are '... |
function [ R_system, R_station ] = aloha_L_1_lei(D, N, p_vec, n_frame )
%aloha Simulate the Aloha protocol
% Inputs:
% D: integer scalar, delay (which is also the frame length)
% N: integer scalar, number of stations
% p_vec: a row vector of size(1, length(p_vec), transmit/re-transmit proba... |
function rep=errorsMC(P,est,tgt,v)
%Calculates mean error in positions, and mean fractions of false positive
%and negative spikes from collection of "targets" spike trains and their
%corresponding "estimators".
%REP=errorsMC(P,ESTIMATORS,TARGETS[,V]) computes THE above measures by
%aligning estimated and target... |
function graph_four
% typical experiment setting
mt_good_power = 'hm_test36';
paper_plot('init');
global rsc
rsc.tablename = mt_good_power;
topology('init');
topology('graph'); |
function [img_HR, time] = SR_patch_MSLapSRN(img_LR, net, model_scale, test_scale, gpu)
% -------------------------------------------------------------------------
% Description:
% function to apply patch-based SR with MS-LapSRN
% We split input image into 4 overlapped sub-regions and apply SR
%
% Input:... |
function result=effect_overdrive(x)
global n
N=length(x);
yo=zeros(1,N); % Creamos el vector de salida
lim=1/3; % limites para un soft clipping simetrico
% Aplicamos la formula de Schetzen
for i=1:1:N,
if abs(x(i))< lim, yo(i)=2*x(i);end;
if abs(x(i))>=lim,
if x(i)> 0, yo(i)=(3-(2-x(i)*3).^2)/3; end;
if x(i... |
% MATLAB program for exercise 2 in course 02457
%
% "main2c" visualizes the coordinate transformation of a given data-set
% to obtain a new data-set with zero mean and a covariance');
% matrix equal to the unit matrix');
%
% This program allows you to vary the covariance matrix of a
% 2D Normal distribution and makes ... |
%% clear workspace
clear
clc
close all
%% initialization
Init
%% load model
modelName = 'Model3';
wasModelLoaded = bdIsLoaded(modelName);
if ~wasModelLoaded
load_system(modelName);
end
%% set inputs
slipstreamON = 0;
stressTestSelector = -1;
wear_relError_selector = 2;
%% simulate
t_sim = 1500;
set_param('Model3','... |
import fouriertrans.m.*
load('ex3.mat'); %Change with test data (t,f) assumed
t2 = t;
f2 = x;
figure(1), clf(1)
subplot(2,2,1)
plot(t2, f2)
%axis([0, 2, -1, 1]) % change accordingly to data
title('t, f')
[w,F,ww,FF] = fouriertrans(t2,f2);
subplot(2,2,2)
plot(w, F)
axis([-0.5 ,10, 0, 0.6]) ... |
function G = Lloydgraphrnd(N,sig,c,d)
%Lloydgraphrnd samples a graph from Lloyd et al. network model
% G = Lloydgraphrnd(N,sig,c,d)
%
% -------------------------------------------------------------------------
% INPUTS
% - N: number of nodes
% - sig: nugget noise
% - c: RBF length-scale
% - d: RBF scale param
... |
%% Cabeçalho
%------------------------------------
% Simulação do FFT
%------------------------------------
clear all
close all
% Tamanho da FFT
SizeOfFFT = 16;
NumeroInteracao = 10;
NumberOfLevels = log2(SizeOfFFT);
%Definição da Resolução
Resolution = SizeOfFFT;
%Definição da Frequencia Fundamental
f_0 ... |
function varargout = Result_Specfic(varargin)
% RESULT_SPECFIC MATLAB code for Result_Specfic.fig
% RESULT_SPECFIC, by itself, creates a new RESULT_SPECFIC or raises the existing
% singleton*.
%
% H = RESULT_SPECFIC returns the handle to a new RESULT_SPECFIC or the handle to
% the existing singleton... |
clear all
clc
% Problem Definition
% _-_-_-_-_-_-_-_-_
% Rossler Equation
% -----------------
%
% y1' = - y2 - y3
% y2' = y1 - y2
% y3' = 1 + y3y1 - y3
%
%
% y = [y1 y2 y3]'
%
% y' = F(t,y) Note that y and F are vectors
%
% y_0 = y_T ; T = 1
%
% Initial conditions
% Guesses
k1 = 0.021;
k2 = 0.022;
k3 = 0.02;
M =... |
s := BelyiDBInitialize();
/*
Base Field Data
*/
base_field_data := [* *];
K1<nu1> := RationalsAsNumberField();
place1 := InfinitePlaces(K1)[1];
conj1 := false;
CC<I> := ComplexField(30);
z1 := 1.00000000000000000000000000000p30;
base_field_data_1 := [* K1, place1, conj1, z1 *];
Append(~base_field_data, base_field_dat... |
clc;clear *;close all;
A=[-12,12;3,-3];
index=1;
for t=0:0.01:10
B = expm(A*t);
Values1(index) = B(1,1);
Values2(index) = B(1,2);
Values3(index) = B(2,1);
Values4(index) = B(2,2);
index=index+1;
end
t=0:0.01:10;
Fig1=figure(1);
semilogx(Values1);
grid on,hold on;
semilogx(Values2);
hold on;
sem... |
I = imread('3.jpg');
semantics = ['trees', 'mountains', 'sky', 'people', 'building'];
semantic_feature_vectors = [];
for i = 1 : size(semantics, 2)
sem = semantics(i);
for j = 1 : size(annotation_info, 2)
if find(annotated_info(j).tags == sem)
frame = read(readerobj(annotated_info(j).fram... |
%file morris_lecar.m
%Morris-Lecar model of excitable barnacle muscle fiber
%adapted from Morris and Lecar (1981) Biophysical Journal 35 pp. 193-231
%Figures 8.6 and 8.7
function morris_lecar
close all
%declare model parameters
global C;
global gbarCa;
global ECa;
global gbarK;
global EK;
global gleak;
global Eleak;
g... |
function llk=Exp1_TotalLikelihood(llk_trial)
llk=nansum(llk_trial(:));
|
% Computes the coefficient vector of a linear regression with n examples and m features per example
% @param X the matrix with the feature values of the examples of size n x m
% @param y the vector with the labels of the examples of size n
% @return w the vector with the regression coefficients of size m
function [w] ... |
function overall_income=income(rate,price)
t = (rate .* price)
overall_income = sum(t(1,:))*16*6;
end |
function simulate_fall
alpha = pi/4;
r = 1;
r_s = 5;
m = 1;
x0 = [1 10 0 0]';
h = 0.01;
N = 500;
sys1 = ContactImplicitSystem(@() ball_collision(alpha, r, r_s, m), 'ball');
sys1 = sys1.addVisualizer(@(x) ball_collision_visual(x, alpha, r, r_s));
[t, x] = sys1.simulate(0.01, N, x0, true, 4);
end |
% 基于到期价格计算(算到期日的payoff)
function [ payoff ] = payoff_design_3(ST )
% 基于到期价格计算(算到期日的payoff)
upper = 1;
S0 = 1;
a = 0.95 * S0;
b = 1.05 * S0;
T = 60;
if(ST >= a && ST < S0)
payoff = 1/(S0 - a) * (ST - a);
elseif(ST >= S0 && ST <= b)
payoff = (-1) * 1/(b - S0) * (ST - S0) + upp... |
%{
creats set of frames that zoom into a single point
%}
function animate()
center = [0.350907738170318 0.350907738170319...
0.384318829808752 0.384318829808753];
figure
a=subplot(1,2,1);
b=subplot(1,2,2);
rate = 7; %is inversely proportional to zooming speed, must be >=2
... |
clear,figure(1),clf
% Mesh parameters
Nx = 16; % number of cells
dx = 1/Nx; % mesh step size
xc = dx/2 : dx : 1-dx/2; % cell centers (x_{i+1/2})
xn = 0 : dx : 1; % nodes (x_i)
% Time parameters
tbeg = 0;
tend = 1000000;
dt = 0.25 * dx^2; % time step size... |
%% Stelling 7
%
% Je kunt de volgende code gebruiken om in de vector signal
% alle waarden onder de 3 te vervangen door nullen.
%
% <<< Code >>>
% signal < 3 == 0
% <<... |
function [ res ] = runChecksOnMCAssignment( apStudentSol, apFileName )
% This script has to check and test another script
% It gives a result in the variable ResStudentScript. Perfect grade = 1.
% Totally wrong result = 0.
% Generate the default Answers
[txtClean] = readCleanMFile('-ap',apStudentSol,'-MULCHOICE');
% C... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.