text stringlengths 8 6.12M |
|---|
function [outputMovie, movieDims, nPixels, nFrames] = loadMovieList(movieList, varargin)
% Load movies, automatically detects type (avi, tif, or hdf5) and concatenates if multiple movies in a list.
% NOTE:
% The function assumes input is 2D time series movies with [x y frames] as dimensions
% If movies are dif... |
function out=Softmax()
out.fun=@fun;
out.dfun=@dfun;
%out=bsxfun(@rdivide,h,sum(h));
end
function out=fun(x)
[n,m]=size(x);
h=exp(x);
s=sum(h,1);
out=h./repmat(s,n,1);
end
function out=dfun(x)
out=1;
end
|
%% Digital transmission of rectangular pulses
% This file simulates the digital transmission of rectangular pulses
% Note: Noiseless transmission
%% Parameters declaration
clear all; close all; clc;
M = 16; % Modulation order
symbols = 16; ... |
% loading example for exerciseLoader
if exist('specStruct', 'var')
clear specStruct options
end
% set up specStruct, which determines the specifics of the data you want to
% load
specStruct.datasetName = 'healthy1'; % the dataset name: ie 'healthy1', 'healthy2'
specStruct.patient = [1]; % type in px numbers here: ... |
function o=ftr_in1ch(datafiles,predt,postdt,chidx,target,train_fnc)
%mui=ftr_in1ch(datafiles,predt,postdt,chs,target,train_fnc)
% Calculate channel ordering based on add-one-in ranking for a BCI target.
% 'datafiles' is a cell array of file names pointing to the eeg data to
% be processed. The eeg data in all data-fil... |
function Proj1B
% Conor Luppnow
% This program:
% - Calculates gE_exp vs x1 using VLE data.
% - Determines the Wilson equation paramaters: lambda_12 and lambda_21
% - Calculates gE_calc using the Wilson equation.
% - plots gE_exp and gE_calc vs x1.
% - Calculates error (gE_exp - gE_calc)
% - Allows... |
f='';
timeoutA=logintimeout(5) ;
% Set maximum time allowed for establishing a connection.
connA = database('test','root', '123456','com.mysql.jdbc.Driver','jdbc:mysql://localhost:3306/test');
ping(connA); % Check the database status.
cursorA=exec(connA,'select time,type,caozuo from history where type = ''... |
clear all; close all; clc
%Set up the Problem Parameters
P.NV = 4; % 4 Equations in 2D
Index = 2; % Which parameter to check smoothness
Order = 3; % ENO Interpolation Order
%Set up the x-grid parameters
P.x0 = -10;
P.x1 = 10;
N_grid_x = 20;
dx = (P.x1-P.x0)/(N_g... |
function W_flightControls = W_flightControls(W_maxTO, numControlFunctions, numMechanicalFunctions, StotalCS, lHoriz)
%this function calculates the weight of the flight controls in lb
% INPUTS
% W_maxTO = design gross weight aka maximum takeoff weight (lb)
% numControlFunctions = number of functions performed by c... |
function obj = modelPreprocessMovie(obj)
% Controller for pre-processing movies, mainly aimed at calcium imaging data. Wrapper for modelPreprocessMovieFunction.
% Biafra Ahanonu
% started 2013.11.09 [10:46:23]
% changelog
% 2021.08.10 [09:57:36] - Updated to handle CIAtah v4.0 switch to all functions inside ciap... |
function [] = comparsion_HDnoHD( )
clear all
close all
clc
load 20190319_HD_p.mat;
biomass1 = yfin1;
cl1 = yfin2;
cg1 = yfin3_2;
hl1 = yfin4;
hg1 = yfin5_2;
c2l1 = yfin6_2;
c2g1 = yfin7_2;
acetate1 = yfin8;
ethanol1 = yfin9;
p1 = yfin10;
jg1 = yfin11;
db1 = yfin12;
ub1 = yfin13;
eg1 = yfin14;
kla... |
function bwToLever(image, db_path_name)
%BWTOLEVER Converts a 2D logical black and white image to a 3D Lever
%version
% bwToLever(IMAGE, DB_PATH_NAME) converts a black and white image to its
% lever 3D complement. It takes as input IMAGE which is a black and white
% image. DB_PATH_NAME is the path name of the loc... |
%flycappropertytypes
classdef (Sealed) fcProp
properties (Constant)
FC2_BRIGHTNESS=0
FC2_AUTO_EXPOSURE=1,
FC2_SHARPNESS=2,
FC2_WHITE_BALANCE=3,
FC2_HUE=4,
FC2_SATURATION=5,
FC2_GAMMA=6,
FC2_IRIS=7,
FC2_FOCUS=8,
FC2_ZOOM=9,... |
%Define carrier frequency in Hz
Fc = 10000;
%Given 16 times over-sampled Fs = Fc * 16
Fs = Fc * 16;
%Data rate 1kpbs
dataRate = 1000;
%Signal length
numOfBits = 1024;
%Define amp
amplitude = 1;
%low pass butter filter, 6th order with cut of freq of 0.2
[b, a] = butter(6, 0.2);
%sampling time
time ... |
function flyTracks=kinematicsNEW2012(nFlies, aliComm)
%For testing odor preference
clf
NIobject=connectToUSB6501;
runningLength = 500; %grabbed frames for tails
dispRate = 50; %rate (in frames) at which to update tracking display - tradeoff with max attainable frame rate
%%%%%%%%%%%%%%%%%%%% edit here %%%%%%%%%%%%%%... |
% Takes a curve p and preprocesses it by:
% -shifting to begin at the origin
% -scaling so that it has total length 1.
function pnew=preprocess_curve(p)
[d,n]=size(p);
% Shift to begin at the origin.
for i=1:d
pnew2(i,:)=p(i,:)-p(i,1);
end
pnew2d = gradient(pnew2,1/n);
curveLength = trapz(linspace(0,1,n),sqrt... |
function eps = MachEps()
% Purpose: Computes the machine epsilon
% Output: the smallest number e so that (1+e)>1 is true
%-------------------------------------------------------------------
eps=1;
while (1+eps)>1
eps=eps/2;
end
eps=2*eps;
end
|
%% ------------------------------------------------------------------------------
% Configuration File for Visual Odometry Algorithm
%% -------------------------------------------------------------------------------
% Path to the directories containing images
data_params.path1 = '../data/kitti/00/image_0/';
data_param... |
function [ripple2,RipFreq2,rip_duration,Mx,timeasleep,sig,Ex,Sx,ripple_multiplets,RipFreq_multiplets,rip_duration_multiplets,sig_multiplets,M_multiplets]=gui_findspindles(CORTEX,states,xx,multiplets,fn)
%Band pass filter design:
%Wn1=[100/(fn/2) 300/(fn/2)]; % Cutoff=100-300 Hz
Wn1=[5/(fn/2) 20/(fn/2)];
... |
path=strcat(img,'o.bmp');
area(path);
path=strcat(img,'g.bmp');
area(path);
path=strcat(img,'.bmp');
area(path);
|
function PDS = getPds(sessionInfo, overwrite, forceAll)
% GET PDS loads PLDAPS files and synchronizes with the OE clock
% Inputs:
% SessionInfo@struct - session info struct from io.loadSession(oepath)
% overwrite@logical - flag
% includeBadSyncs@logical - keep sessions that aren't matched with ephys
% Outp... |
function [velocidad]=fV(m)
velocidad=(9.81*m/10)*(1-exp(-10*17/m))-25;
end
|
%% Imports
addpath('lib');
%% Get file and load
[filename_img, pathname]=uigetfile('*.png');
% Read the image
Img = imread([pathname, filename_img]);
pos = strfind(filename_img, '.'); %create the name for the output file
filename_OCT = filename_img(1:pos-1);
% Calculate the size of the image in pixels
[n,Img_w,alfa]... |
function like = calculate_like( state,possi_list,NDD_possi_list )
% load mytable_matrix_possi.mat;
% load final_table.mat;
global mytable_matrix_possi;
global final_table;
%Parameter;
global range_label;
global range_rate_label;
global v_label;
like = 1;
range_num = find_num(state(1),range_label);
range_rate_num = find... |
function data = updateFits(fname, data, llstr, objML, objASD, scoreObj)
% data is a struct containing, at minimum, the fields X, Y, Xxy, and nt
% verify erasing of previous results
if ~checkContinue()
return;
end
if nargin < 4
objML = struct();
end
if nargin < 5
objASD =... |
function [E_max,STD_max]=EVofMaxIIDGaussians(mu,sigma,n,c)
%[E_max,STD_max]=EVofMaxIIDGaussians(mu,sigma,n,c) computes
%E[max {c,max {X_1,...,X_n}}] and STD[max {c,max {X_1,...,X_n}}].
%c is optional and its default value is -infinity.
if not(exist('c','var'))
E_max=mu+sigma*integral( @(x) x.*n.*normpdf(x).*normc... |
Function Aaa()
Too = 25;
h = 50;
k = 1.5;
rho = 2500;
cp = 850;
Tx0 = 0;
Tguess = 100;
L = 0.1;
A = 6e5;
h = 50;
%y(1) =T, y(2) = f
out = fzero(@objFunc,Tguess);
plot(x,yNew(:,1));
function result = objFunc(Tguess)
func =@(x,y) [y(2);-A*x/k]; %y(1) =T... |
clear all, close all, clc;
%% スカラーデータ
a = 3;
%% 行列作成(3x3)
a = [1 2 3; 4 5 6; 7 8 9];
%% 行列作成(5x5 : 関数利用)
a = randi(255, 5);
imshow(a,[])
%% テスト用画像を生成
createImage
%% 画像読み込み
I = imread('frame10.png');
%% 可視化
imshow(I)
%% ヒストグラム確認
imhist(I)
%% 2値化(手動)
bw = I > 80;
imshow(bw)
%% 2値化
bw... |
tic;
vidObj = VideoReader('store1.mp4');
nFrames = 100; % vidObj.NumberOfFrames;
% vidH = vidObj.Height;
% vidW = vidObj.Width;
% mov(1:nFrames) = struct('cdata', zeros(vidHeight, vidWidth, 3,...
% 'uint8', 'colormap', []));
for k = 2 : (nFrames - 1)
% mov(k).cdata = read(vidObj, k);
if (k == 2)
thisFra... |
%% DEFINING THE VALUES OF KEY PARAMETERS
clc
global Q Bn P cns xns yns zns;
kkimport = xlsread('PERF2.xlsx','Sheet3');
kkfulllist = kkimport(:,1);
factor = 1;
QPs = zeros(61,6);
%% GENERATE AN ENSEMBLE OF NETWORKS
for i=1
Stroke =1;
for s = 15
kk = kkfulllist(... |
% createiristemplate - generates a biometric template from an iris in
% an eye image.
%
% Usage:
% [template, mask] = createiristemplate(eyeimage_filename, normalized_dir, encoded_dir)
%
% Arguments:
% eyeimage_filename - the file name of the eye image
% eyeimage_dir - the directory where image file... |
function varargout = Video_annotate(varargin)
% VIDEO_ANNOTATE M-file for Video_annotate.fig
% VIDEO_ANNOTATE, by itself, creates a new VIDEO_ANNOTATE or raises the existing
% singleton*.
%
% H = VIDEO_ANNOTATE returns the handle to a new VIDEO_ANNOTATE or the handle to
% the existing singleto... |
function [channel_index] = get_channel_index(file_channel,data_type)
%
% [channel_index] = get_channel_index(file_channel,data_type)
%
%=================================================
% input:
% file_channel - the file containing information of channels
% data_type - 'MEG','GRAD','MAG','E... |
function imgAttPoly = impactImageToPolychromaticAttenuation(imgAttE0, E0, deManMu, deManPhi, deManTheta, deManKappa, deManPi, modelEdge, EKappa, epsilonKappa, modelPairProduction, spectrumEnergies, spectrumPortions)
% imgAtt = impactImageToPolychromaticAttenuation(imgAttE0, ...
% E0, deManMu, deManPhi, deManTheta, d... |
classdef DataArray < steno3d.core.UserContent
%DATAARRAY Steno3D object to hold resource data
% Data is stored as an array. It is bound to a %%%ref[composite resource](steno3d.core.CompositeResource) using a
% data %%%ref[binder](steno3d.core.binders) cell array. The length of the Array must correspond to the
% s... |
%make_Patterns_YEF
%% Vertical Gratting Pattern 4 pixels wide
% Note that the actual position depends on the initial position. See below.
clear all;
numOfPanelsAcross = 7;% 7 panels across
numOfPanelsVertically = 2;%
LEDdotsPerPanel = 8; % this shouldn't change! LEDs are always 8 dots in x and y.
LEDdotsAcross =... |
function IM = posterize(IM_orig, parts)
if (size(parts, 2) == 1)
cvals = repelem(256 / parts, parts);
cvals = cvals .* (1:parts);
cvals = uint8(cvals);
else
cvals = parts .* 256;
parts = numel(parts);
end
if mod(256, parts) ~= 0
... |
%%% *Pressure vs. Degree of Embolization Analysis*
%%
% *Initialize*
clear; close all; clc
%%
% *Setup (only run once)*
% Read in data from excel sheet
data1 = xlsread('Data\4217-1.xls');
data2 = xlsread('Data\4217-2.xls');
data3 = xlsread('Data\4217-3.xls');
data4 = xlsread('Data\4217-4.xls');
data5 = xlsread('Dat... |
function [out] = block_convolution(x, h, block_length)
Nx = length(x);
Nh = length(h);
L = block_length;
x_new = [x zeros(1,L-mod(Nx,L))];
num = length(x_new)/L;
h_new = [h zeros(1,L-1)];
for k = 1:num
x_matrix(k,:) = x_new(((k-1)*L+1):k*L);
if k == 1
xm_new(k,:) = [zeros(1,Nh-1) x_mat... |
function Value = CmdWinKeyCallback(ObjectH, EventData)
persistent KeyPressed
switch nargin
case 0
Value = ~isempty(KeyPressed);
case 1
KeyPressed = [];
case 2
if get(EventData,'keyCode')==27 % 27 = 'Esc'
KeyPressed = true;
else
KeyPressed = [];
end
otherwise
error('Progra... |
clear;clc;
tic
%%
fold_path='C:\Users\Nyx\Desktop\attachments\';
%set Thresh for bw
in_bw_thresh=0.5;
in_thresh.Area=100;
% in_thresh.MajorAxisLength=5;
% in_thresh.MinorAxisLength=5;
% in_thresh.MeanIntensity=0.1;
% in_thresh.Perimeter=15;
% in_thresh.EquivDiameter=3.5;
% in_thresh.Eccentricity=0.45;
% in_thresh.So... |
%The first line of this file takes a long time to run so I would recommend
%not clearing your variables and commenting it out after you run it once
climate_table=readtable('aq3.csv','ReadVariableNames',1); %read in data table with the climate data
infection_filename = 'saopaulo_infection.csv'; %the data table with i... |
function empirical_T10_correction_struct = generate_empirical_T10_correction_struct(source_T10_mean, target_T10_mean, ...
source_T10_stddev, target_T10_stddev, varargin)
empirical_T10_correction_struct = [];
if nargin < 2 || nargin == 3
disp(sprintf('%s(source_T10_mean, ta... |
% Evaluation code of the PRW dataset.
% This code will evaluate the DPM detector (pre-trained on INRIA dataset, denoted as DPM_Inria in our paper) plus the BoW+XQDA recognizer.
% If you find our code helpful in your research, please kindly cite our
% paper as
% Liang Zheng, Hengheng Zhang, Shaoyan Sun, Manmohan Chandra... |
%**************************************************************************
%
% rec_std_multi.m (c) Spectrum GmbH , 10/2015
%
%**************************************************************************
%
% Example for all SpcMDrv based (M2i) acquisition cards with the option
% Multiple Reco... |
function [ airDrag, density ] = AirDrag( speed, rocketDiameter, mass, height, parachuteDeployed )
area = Area(rocketDiameter, parachuteDeployed);
cw = DragCoefficient(speed, parachuteDeployed);
%height = 0;
density = Density(height);
airDrag = (0.5 * cw * area * density * speed * spe... |
function runBeamMomentLoadCaseOnIceBerg(sideLength, spacingNumber, momentLoad)
groundStructure = GeoGroundStructure;
x = sideLength; y = sideLength;
xSpacing = x/spacingNumber; ySpacing = y/spacingNumber;
groundStructure.createCustomizedNodeGrid(0, 0, x, y, xSpacing, ySpacing);
... |
%{
# Experimental Session
-> pni.Mouse
session : smallint # session number
---
session_date : date # date
person : varchar(100) # researcher name
scan_path : varchar(255) ... |
function [ boundary ] = getBoundary( binaryImage )
%UNTITLED5 Summary of this function goes here
% Detailed explanation goes here
if size(binaryImage,3) > 1
binaryImage = sum(binaryImage,3)/3;
end
boundingBox = regionprops(binaryImage,'BoundingBox');
boundingBox = ceil(boundingBox.BoundingBo... |
function [nodes, cells] = LineMesh(l, h)
%% LineMesh
% Use: Creates a 1D line mesh
%
% Syntax: [nodes, cells] = LineMesh(l, h)
%
% Input:
% l - The edge size, format: [1 x 1]
% h - The mesh spacing, format: [1 x 1]
%
% Output:
% nodes - Node coordinates, format: [n x 1] where n the number of nodes
% cells - Cel... |
function [theta, sterr, u_hat, non_par_u_hat, u_hat_conditional_w1w2] = nested_AppLoglikelihood_Vine_APS3A(y, x1, x2, z1, z2, us, theta0, random_seed)
Options = optimset('TolX', 1e-8, 'TolFun', 1e-8, 'MaxIter', 20000, 'MaxFunEvals', 6 * 20000, 'Display', 'Off');
[theta, logMLE, grad, hessian] = fminunc(@AppLog... |
f = imread('E:\3-2 term\DIP\DIP Images\DIP3E_CH03_Original_Images\DIP3E_Original_Images_CH03\Fig0304(a)(breast_digital_Xray).tif');
f = im2double(f);
f1 = f;
b = max(f(:));
a = min(f(:));
[row, col, channel] = size(a);
for i=1:row
for j=1:col
f1(i,j)=(f(i,j) - a) * ((255 - 0) / (b - a)) + a;
... |
clear; clc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% This script will run analysis pipeline used in Poudel et al.,2019,Human Brain Mapping %%%
%%% We used MRI data from IMAGE-HD cohort %%%
%%% If you have any queries please contact me at govinda.poudel@a... |
function subarr = sa2subarray(subcont,array)
subarr = cell(length(array),1);
for i = 1:length(array)
% subarr{i} = zeros(length(subcont.set),length(array{1}),'logical');
idx = subcont.sa_map(:,i)==1;
subarr{i} = sparse([],[],[],length(subcont.set),length(array{1}),nnz(array{i}(subcont.se... |
%Preprocessing the input accordingly
info = dir('/Users/vigneshk/Desktop/NN Assignment/Homework2/group_3/train');
info(1) = [];
info(1) = [];
for j = 1:length(info)
filename = strcat('/Users/vigneshk/Desktop/NN Assignment/Homework2/group_3/train/',info(j).name);
I = double(imread(filename));
V(:,j) = I(:);
... |
function [value , isterminal , direction] = threshold_fun(t , y)
global net
%---setting parameters
if ischar(net.Neurons.SpikeDet.SpikeDetFunParam)
switch lower(net.Neurons.SpikeDet.SpikeDetFunParam)
case 'def'
threshold = 2*ones(net.Architecture.NeuronNum , 1);
otherwise
... |
function raw_corr = mrir_artifact_ghost_correct_CorrelationMethod_v3(raw_roft, linear_fit_coeff,OS_factor,ShiftFracForLine1)
% Kawin Setsompop
% 8/2/2012
% linear_fit_coeff here will be constant phase (row1) and secondlineshift
% (row2)
% input data needs to be in fourier space
% 8/16/2011
% much faster than versio... |
function comparef
%フォルダ内のmp3ファイルの読み込み
mp3Files = dir('*.mp3');
numfiles = length(mp3Files);
mp3data = cell(1,numfiles);
fss = cell(1,numfiles);
for k = 1:numfiles
[mp3data{k},fss{k}] = audioread(mp3Files(k).name);
end
%モノラル処理
%miraudioオブジェクトの生成
mp3mir = cell(1,numfiles);
for k = 1:numfiles
mp3mir{1,k} = mi... |
%atoms = [6 8 8 6 6 1 1 1 1 8];
% atoms = [6 8 8 8];
% atoms = [8 1 1];
atoms = [6 8];
% xyz = [0 0 0];
xyz = testdata(2).xyz_a0;
% xyz = [0 0 0; 0 0 2.2827892];
% xyz = [0 0 0];
settings.tolDensity = 1e-8;
settings.tolEnergy = 1e-8;
settings.basisset = '6-31G';
settings.method = 'RHF';
settings.multiplicity = 1;
% se... |
function [ result ] = fi_r( k_min, k_max, M, w )
%FI_R Summary of this function goes here
% Detailed explanation goes here
r = @(x)max([(M-abs(x))/M,0]);
k_array = linspace(k_min, k_max, k_max-k_min+1);
rk = arrayfun(r, k_array);
my_exp = @(k) exp(-1i*w*k);
e = arrayfun(my_exp, k_array);
result = sum(rk .* e);
end
|
function [locs1, locs2] = matchPics( I1, I2 )
%MATCHPICS Extract features, obtain their descriptors, and match them!
%% Convert images to grayscale, if necessary
[i1_rows, i1_cols, i1_channels] = size(I1);
[i2_rows, i2_cols, i2_channels] = size(I2);
if i1_channels == 3
im1_gray = rgb2gray(I1);
else
im1_gray = ... |
function z = hinge(y)
% z = hinge(y)
%
% hinge function)
z = max(-y,0);
|
function iseries_list = getallSeries(obj)
infoAll = getDataInfo(obj.animal);
date_list = [];
for n = 1:length(infoAll)
date_list = [date_list, {infoAll(n).date}];
end
if ismac
date_list{1} = 'bloddy mac';
end
iseries_list = zeros(1,numel(date_list));
for n = 1:n... |
function [] = halt_AFG31000()
%% MATLAB script to halt Tektronix AFG31000 - Ravinder Singh 19 Dec 2019
% William Matthews Jan 2020
% % Clear MATLAB workspace of any previous instrument connections
% instrreset;
%% Instrument Connection
% Find a VISA-USB object.
awg = instrfind('Type', 'visa-usb', 'RsrcName', 'USB0::0... |
function result = read_vocabulary(dataset_name)
% function result = read_vocabulary(dataset_name)
name = vocabulary_filename(dataset_name);
lines = number_of_lines(name);
result = cell(lines, 1);
fid = fopen(name, 'r');
for counter = 1:lines
result{counter} = fgetl(fid);
end
fclose(fid);
|
function [G]=normaliseFD(F)
T=F;
T(1)=0;%Translation Invariance
si=abs(T(2));
T=T ./ si;%Scale Invariance
T=abs(T);%Rotation and changes in starting point
G=T;%Output the result
end |
syms x
y1 = normpdf(x, 5, 0.5);
y2 = normpdf(x, 7, 1);
S = solve(2 * y1 == y2, x)
vpa(S)
|
%% Import/Export Simulink Data from/to Excel
%Export to Excel
fprintf('Export Started!')
FileName = fullfile('D:\Dropbox\EE500\CURRENT Model for editing\Excel_Sim_Data\',sprintf('RD_w_TCS2_AYC_RHLHRSI_SApm3_45sec_%s.xlsx',datestr(now,'HHMMSS_mmddyy')))
A = [VMC];
xlswrite(FileName,A)
fprintf('Export Finished!')
%Imp... |
function Display_Mesh(Mesh)
%Displays surface elements from Mesh.triangles structure
P=unique(Mesh.triangles(:,4));
figure;
hold on;
for i=1:length(P)
t=find(Mesh.triangles(:,4)==P(i));
TR=TriRep(Mesh.triangles(t,1:3), Mesh.nodes(:,1),Mesh.nodes(:,2),Mesh.nodes(:,3));
h= trimesh(TR);
if (P(... |
function autoDPL(obsname,tp,el,nsd,nrw,nhzg,nrwhg,pic)
it=000000;
ft=240000;
itime=it;
ftime=ft;
irecc=[0;0;0];
fltname='none';
direx='';
prename1='get';
prename2='get';
clkname1='get';
clkname2='get';
sdp=0;
tp=str2double(tp);
sdt=str2double(nsd);
rwt=str2double(nrw);
p1c1m=0;
cprt=1;
prrt=10;
... |
function defl = defl_angle(line1, line2)
connpt_1 = line1.connpt(line1.conn == line2.nr);
connpt_2 = line2.connpt(line2.conn == line1.nr);
if(isempty(connpt_1) || isempty(connpt_2))
error('no connection between line%d to line%d\n', line1.nr, line2.nr);
end
if(connpt_1 == connpt_2)
... |
clc;
clear;
% read image and add the mask
X = imread('London_256.jpg');
X = rgb2gray(X);
X = im2double(X);
% X = imresize(X,0.4);
img = X;
% img_corrupted = imnoise(img,'salt & pepper',0.02);
% img_corrupted = imnoise(img,'speckle',0.03);
img_corrupted = imnoise(img,'gaussian',0,0.03);
fprintf(1, '%d corrupted ent... |
%RUNGE KUTTA 4TH ORDER TESTING
GC = 6.67408e-11;%value of gravitational constant
MS = 1.988500e30;%mass of the sun
%initial co-ordinates of spaceship when it is launched
xi = [-1.4718861838613153E11; -2.8615219147677864E10 ;8174296.311571818];% NASA HORIZONS DEV
yi = [27978.003182957942; -62341.39349461967 ;-6... |
% Analyze magneto popData
%% magneto
%{
fDat1=femalesPopulationMagnetsInitial;
fDat2N=femalesNorthRetest;
fDat2S=femalesSouthRetest;
fDat3N=femalesNorthReretest;
fDat3S=femalesSouthReretest;
disp('Northies')
Totals1=sum(fDat1(:,1:2))
Totals1/sum(sum(fDat1(:,1:2)))
Totals2N=sum(fDat2N(:,1:2))
Totals2N/sum(sum(fDat2N(:... |
% Kristina Johansson
%Ref. 25 degrees Celsius
function f=ent_O2(T)
%T=T-273.15;
Tref=25;
h_O2=29.10*(T-Tref)+(1.158E-2)/2*(T-Tref)^2-(6.076E-6)/3*(T-Tref)^3+(1.311E-9)/4*(T-Tref)^4;
clear f
f=h_O2; |
classdef Curve < handle
properties (GetAccess = public, SetAccess = protected)
c1;
c2;
c3;
du;
end
methods (Access = public)
function crv = Curve(new_c1, new_c2, new_c3, new_du)
... |
%Name: Matlab/CUDA: Signals and Systems Lab 4th
%Auther: Changgang Zheng
%Student Number UESTC:2016200302027
%Student Number UoG:2289258z
%Institution: Glasgow College UESCT
%Question: Perform convolution. 2.2(a)(b)(c)(d)(e)(f)(g)
function problem_1st
%% problem a
a1=[1];
b1=[0.5 1 2];
%%
%%... |
function [t] = selec_nodo(prob_ciudades)
suma = 0;
n_ciudades = size(prob_ciudades,2);
for i = 1:n_ciudades
suma = suma + prob_ciudades(i);
endfor
# promediamos el vectro de probabilidades
if suma != 0
prob_ciudades = prob_ciudades./suma;
endif
# ordenamos el vector de probabili... |
clear all
close all
%% Input Impedance
f = 0:0.001:10;
parameters = load('question01parameters.mat');
[ZinCReal,ZinCImag] = ZvsF(f,parameters);
figure
subplot(2,1,1)
plot(f,ZinCReal)
ylim([0 100])
title('Modulus vs. Frequency')
xlabel('Frequency (Hz)')
ylabel('Modulus')
subplot(2,1,2)
hold on
plot(f,ZinCImag)
plo... |
%% Clean all up
close all % close all figures
clc % clean Command Window
clear % clear Workspace
%% Read Image
I = imread('matlab_teste1.jpg');
imshow(I);
%% RGB Color Space
l_red = I(:,:,1);
l_green = I(:,:,2);
l_blue = I(:,:,3);
figure;
subplot(2,2,1)
imshow(I), title('Original');
subplot(2,2,2)
imshow(l_red),... |
function data = sbxAlignAffineApplyAffineDFT(path, startframe, nframes, tform, dft, pmt, removeedges)
%SBXALIGNAFFINEAPPLYAFFINEDFT Applies a transform, tform, and a dft
% translation, dft, to a set of frames begining with startframe. NOTE:
% startframe is 1-index unlike sbxReadPMT.
% Input:
% path - path t... |
%Aula4.m
%Parte1: Incializacao
clear all; close all; clc;
dados = load('aula04_dados.txt');
X = dados(: , 1:4);
y = dados(:, 5);
y1 = double( y == 1 ); %setosa
y2 = double( y == 2 ); %versicolor
y3 = double( y == 3 ); %virginica
m = length(y);
X = [ones(m,1), X];
%Parte2: descida do gradiente
alpha = 0.01; %taxa... |
% This demo loads two color images and efficiently computes the emd_hat
% between them. The ground distance is a thresholded linear combination of
% the spatial and color distance between pixels. This is similar to the
% distance I used for color images in my ICCV paper. Image sizes do not
% need to be the same. As a c... |
%> @file logL.m
%> @brief Logic used to filter and print log information to a file or the screen
%> @detail Logic used to filter and print log information to a file or the screen
%> @author Ben Nordin
%> @date 2011-09-01
% ======================================================================
%> @brief Logic used to fi... |
function res = watersphere( volume )
r = 6.1; % meters
height_at_bottom = 65 - 2*r; % meters
height = fzero(@error_func, [0, 2*r]);
res = height_at_bottom + height;
%ezplot(@error_func, [0, 2*r])
function res = error_func(h)
res = pi * h^2 * (3*... |
function D = delsq3D(G, varargin)
%DELSQ3D Construct 7-point finite difference Laplacian.
% delsq3D(G) or delsq3D(G,[hx,hy,hz]);
% is the sparse form of the three-dimensional,
% 7-point discrete negative Laplacian on the grid G.
% The grid G can be generated by NUMGRID or NESTED.
% [hx,hy,hz] is the op... |
function Z = sparseCoding(U, X, M_orig, sigma, rc_min)
%
% Perform sparse coding using a modified matching pursuit tailored to the
% inpainting problem with residual stopping criterion.
%
% INPUT
% U: (d x l) unit norm atoms
% X: (d x n) observations
% M: (d x n) mask denoting which observations are unknown
% ... |
function [scene, mappings] = mexximpRemodeller(scene, mappings, names, conditionValues, conditionNumber)
% This is an example of how to modify the incoming mexximp scene directly,
% with a "remodeler" hook funtion. It modifies the scene struct that will
% be used during subsequent processing and rendering.
%
% The fu... |
clc
clear
fprintf('Una primera forma\n');
tablero=[0,1;1,0];
disp(repmat(tablero,4))
fprintf('Segunda forma\n');
tablero=zeros(8,8);
tablero(2:2:end,1:2:end)=1; % Colocamos 1's en las filas impares y columnas pares
tablero(1:2:end,2:2:end)=1;
disp(tablero)
|
function R = CalcReliability_new(Rs,Rc,Ri)
% GNC = CalcReliability_new(Rs,Rc,Ri)
% Calculates the reliability of an arbitrary architecture by generating all
% the possible failure cases, computing their individual probabilities and
% a boolean indicating whether this particular case leads to system failure
% or if... |
% pac() - compute phase-amplitude coupling (power of first input
% correlation with phase of second). There is no graphical output
% to this function.
%
% Usage:
% >> pac(x,y,srate);
% >> [coh,timesout,freqsout1,freqsout2,cohboot] ...
% = pac(x,y,srate,'key1', 'val1', 'key2', val... |
function makeConfMat(prc,qty,cols,order,txt)
% Make a uniform looking confusion matrix
% Calculate percentages if not provided
if isempty(prc)
prc = 100 * bsxfun(@rdivide,qty,sum(qty,2));
end
% Size of the matrices
sz = size(prc,1);
if isempty(order)
order = 1:sz;
end
% Text labels...
if isempty(txt)
tx... |
function [ CompDuct ] = CompSDuct( CompDuctIn, DesignInputs, DesignCriteria, HX )
% Set output equal to input, overwrite and add to throughout
CompDuct = CompDuctIn;
% Extract relevant information from DesignCriteria
NDLMax = DesignCriteria.CompDuct.NDLMax;
NDLMin = DesignCriteria.CompDuct.NDLMin;
DeltaRMax = DesignC... |
fileId = fopen('D:\Documents\DIP Lab\crossroad.dat','r');
a = fread(fileId,[580 435],'*uchar');
b = imrotate(a, 270);
figure, subplot(2,3,1), imshow(b), title('Original image');
i1 = imfilter(b, ones(2,2)/4);
i2 = imfilter(b, ones(4,4)/16);
i3 = imfilter(b, ones(8,8)/64);
i4 = imfilter(b, ones(16,16)/256);
subplot(2,3... |
%-------------------------------------------------------------------------------------------------------
%
% M-file: tank_compressfactor.m
% Compressibility factor of hydrogen
%
% Revision history:
% Created: 1999 by Thomas Vernersson
% Modified: 03/21/02 by Kristina Haraldsson, NREL
%---------------------------------... |
function [result] = util_remove_colrow_based_on_mean(matrix, threshold, varargin)
%UTIL_REMOVE_COLROW_BASED_ON_MEAN Remove the column / row of the matrix by
%a threshold.
% Averaging along each column / row, removing the one which mean < threshold
% Input:
% matrix, threshold.
% method: 'c... |
%penyelesaian kasus menggunakan metode WP
n1 = xlsread('Data_WP.xlsx','Sheet1','C:E'); %mengambil data dari xlsx tabel C, D, dan E
n2 = xlsread('Data_WP.xlsx','Sheet1','H:H'); %mengambil data dari xlsx tabel H
x = cat(2,n1,n2); %berfungsi untuk menggabungkan tabel C,D,E dengan tabel H
x(51:414,:) = [] %berfungsi untuk ... |
thefile='/Volumes/ice2/ben/scf/plateau_03/ATL03_2018_10_02_00100110_944_01.h5';
fields={'h_ph','ph_id_pulse','pce_mframe_cnt','ph_id_channel'};
beam='/gt1l';
clear D3;
for kf=1:length(fields);
D3.(fields{kf})=double(h5read(thefile,[beam,'/heights/', fields{kf}]));
end
%[H,D3]=read_ATL03_photon_data('ATL03_2018_1... |
function [LL_Carv, RL_Carv] = Seg_Cal_Carv(num_seg, ...
p_ll_all,p_rl_all, left_lane_x, right_lane_x, seqment_idx)
%Only calculated left lane carvature
% LL_Carv = zeros(num_seg, length_seg);
% RL_Carv = zeros(num_seg, length_seg);
%NL_seg_num = 20;
row=length(left_lane_x);
LL_Carv = struct;
RL_Carv = st... |
%This code lowpass filters the time dimension of the data according to user specifications
%load data (SAM and SIE seasonal time series for a GCM (e.g. ccsm))
Cut_off_time1 = i;
F1 = 1/Cut_off_time1;
Cut_off_time2 = i;
F2 = 1/Cut_off_time2;
[SAM_lowpass_ccsm,coef,window,Cx,Ff] = lanczos_filter(SAM_mam_ccsm,[],F1,[]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.