text stringlengths 8 6.12M |
|---|
function [I] = Simpson(x,y)
%The Simpson function takes inputs x and y and evaluates the numerical integral of y with
%respect to x from the first x value to the last x value using the Simpsons 1/3 rule and the trapezoidal rule
%if the number of intervals is odd.
%Inputs
% x: an array containing the x values of ... |
function tc=calcSpeedContrastTuning(dpxd,cellNr,varargin)
if nargin==1 && strcmp(dpxd,'info')
tc.per='cell';
return;
end
% This function calculates a direction tuning curve from a
% lkDpxExpGrating-DPXD struct, its output can be plot with the
% complementary plotSpeedContrastTun... |
function x1=gs_step(x0,b,a)
%Implementa un passo di gs
n=length(b);
x1=zeros(n,1);
q(1)=b(1);
q(2:n)=b(2:n)-b(1:n-1);
%y=G*x0
y=zeros(n,1);
y(1)=-a*x0(2);
for i=2:n-1
y(i)=a*(x0(i)-x0(i+1));
end
y(n)=a*x0(n);
x(1)=y+q;
end |
function Xnew = reconstructMesh(X, vk, 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)
%------------------------... |
clc;
clear all;
close all;
img=imread('test.jpg');
[len,wid]=size(img);
imshow(img);
title("Orginal Image");
figure;
title("Orginal Image");
x=mydct2(img);
imshow(x);
title("DCT of Orignal Image");
figure;
noise=randi([1 1000],256,256);
noise=dct2(noise);
for i=128:len
for j=128:len
... |
function endgamescreen(gamestate, gamemode, playerwinner, player1, player2)
% endgamescreen
%
%
% Dominick Anatala 2017 Version 1.0
% Checks which human player won, and changes winner name to their name.
if playerwinner == 1
playerwin = player1;
elseif playerwinner == 2
playerwin = player2;
end
fprintf('... |
%Explore convergence of snow data
E = 4;
tau = 1;
alttempdata %load pair0001
Tfinals = [10:10:340];
for Tfstep = 1:1:length(Tfinals);
tspan = Tfinals(Tfstep);
library_length = tspan;
fprintf('--> L = %i <--\n',Tfinals(Tfstep));
fprintf('Creating C input data files...');
tic;
Coutputfilena... |
function [NucF, ROIf] = extract_features(hematoxylin,eosin,Nuclei,pixelsize,nucnhoodsize,R_lbp,P_lbp,mapping,showfig)
% Pad images to allow analysis of nuclei neighborhoods even at image edge.
padamount = ceil(0.5*nucnhoodsize/pixelsize) + 1;
Nuclei = padarray(Nuclei,[padamount,padamount],false);
hematoxylin = padarra... |
function practice_Ifs()
% case 1
x = 8;
if x < 5
A = 10;
else
A = 57.5;
end
% case 2
y = 37;
if y < 5
B = 2*y-1;
elseif y < 10
B = 3*y^2 + 2;
end
% case 3
x = 3;
if x < 2
C = 1;
elseif x < 5
C = 2;
elseif x < 10
C = 3;
elseif x < 100
C = 4;
else
C = 5;
end
% case 4
x = 3;
... |
function b = inCircle(point, circle)
%INCIRCLE test if a point is located inside a given circle.
%
% B = inCircle(POINT, CIRCLE)
% return true if point is located inside the circle
%
% Example:
% inCircle([1 0], [0 0 1])
% inCircle([0 0], [0 0 1])
% returns true, whereas
% inCircle([1 1], [0 0 ... |
function []=fixedbeddae2016
%1D fized bed reactor with surface reacion
% non-isothermal
%input data
%--------------------------------------------------------------------
u=1; % superficial velocity m/s
a=10; % specific area m2 external cat surface / m3 reactor
km=1; % mass transfer coefficient m/s
kr=0.1; % reactio... |
%configuration
DELTA_ALPHA_A = 210;
DELTA_ALPHA_B = 330;
DELTA_ALPHA_C = 90;
ROD_RADIUS_A = 92;
ROD_RADIUS_B = 92;
ROD_RADIUS_C = 92;
ROD_LENGTH_A = 217;
ROD_LENGTH_B = 217;
ROD_LENGTH_C = 217;
DELTA_ALPHA = [DELTA_ALPHA_A;DELTA_ALPHA_B;DELTA_ALPHA_C];
ROD_RADIUS = [ROD_RADIUS_A;ROD_RADIUS_B;ROD_RADIUS_C];
ROD_L... |
function c = ko_call(model, option, N)
% KO_CALL prices a knock-out call option using the analytical formula.
%
% Required are:
% model : struct with fields
% sigma : Volatility
% r : Risk-free interest
% S0 : Initial value
% option : struct with fields
% T ... |
function [mMembership] = updateSoftMembershipMult(mAdj, mImage, mMembership)
%
% Updates the soft membership, using multiplicatinve update rule. (Bo Long)
%
%
mXS = mMembership * mImage;
mXSt = mMembership * mImage';
mMembership = mMembership * ( (mAdj' * mXS + mAdj * mXSt) ./ (mXS * (mMembership') * mXSt ... |
function [res,meanData] = fun_delete_DC( data )
%ΠΕΊΕΘ₯Φ±Αχ
% Detailed explanation goes here
meanData = mean(data);
res = data - meanData;
end
|
function distance = NSobjP(Params, SR, BondsCF, ObsDirtyPrices, MD, Model, Optimization)
% =========================================================================
% distance = NSobjP(Params, SR, BondsCF, ObsDirtyPrices, MD, LongYTM, Model, Optimization)
% Objective function of Nelson Siegel Model estimation routin... |
function video2pic( videoFile, outputPath, picFormat )
%% Initialization
if nargin < 1
videoFile = 'H:\Downloads\west_lake.avi'; %input('Input full video path:', 's');
%outputPath = input('Input video output path[Default is under the video path]:', 's');
%if isempty(outputPath)
outputPath ... |
function B = GramSchmidt(A)
%define Q and R
[m n] = size(A);
Q = zeros(m,n);
R = zeros(n);
%modified Gram Schmidt algorithm
for i = 1:n
R(i,i) = norm(A(:,i));
Q(:,i) = A(:,i)/R(i,i);
for j = i+1:n
R(i,j) = Q(:,i)' * A(:,j);
A(:,j) = A(:,j) - Q(:,i)*R(i,j);
end
end
B = inv(R) * Q';
endfunction
|
clear all;
global Tfinal input output times;
%% launch daq session
% for some reason, this removes the offset problem of sensors during a
% simulink session:
s = daq.createSession('ni')
s.addAnalogInputChannel('dev1',7,'voltage')
s.DurationInSeconds = 1
[data,time] = s.startForeground; plot(time,data);
delete(... |
RC = 250 * 3.5e-6;
LC = 3.5e-6 * 600e-3;
sys = tf([RC 0], [LC RC 1]);
figure
impulse(sys)
figure
step(sys)
figure
bode(sys)
grid
|
function prefs = getPreferences(cx,cy,randrotate,flip,fullcolormatrix)
prefs.cx = cx;
prefs.cy = cy;
% Colorwheel details.
prefs.colorWheelRadius = 289.1029; %equivalent to the 16.4 degree diameter from original paper
prefs.colorwheel = load('colorwheel360.mat', 'fullcolormatrix');
if flip == 1
prefs.co... |
%learn to use if, elseif, else statements in MATLAB
function guess_my_number(x)
if x==2||x==3
fprintf('you guessed the correct number!\n');
else
fprintf('wrong number bro\n');
end
|
function output=capacity_plot(SNR,output)
SNR=10^(0.1*SNR);
Mr =16;
Mt= 4;
%10000 Monte-Carlo runs
for K=1:10000
T=randn(Mr,Mt)+j*randn(Mr,Mt);
T=0.707*T;
I=eye(Mr);
a=(I+(SNR/Mt)*T*T');
a=det(a);
y(K)=log2(a);
end
[n1 x1]=hist(y,40);
n1_N=n1/max(K);
a=cumsum(n1_N);
b=abs(x1);
if output == 'erg... |
function sOut = xReinterpret(sIn, forceArithType, arithType, forceBinPt, binPt, name)
if(forceArithType == 1)
forceArithType = 'on';
signalTypeGood = (strcmpi(arithType, 'signed') || ...
strcmpi(arithType, 'unsigned'));
if(~signalTypeGood)
throwError('The arith mode must be eithe... |
% Copyright (c) 2017 Zi Wang
function f = robot_pushing_4(rpos, angle, simu_steps, gpos)
% Returns the distance to goal of an object pushed by a pusher.
% The goal is to minimize f.
% You can define the function to be maximized as following
% gpos = 10 .* rand(1, 2) - 5;
% f = @(x) 5 - robot_pushing_4(x(1:2), x(4), x(3... |
function [ nodeIdx, treeIdx ] = getClosestNode( skel, xyz, treeInds, ignoreSelf )
%Get the nodeIdx of the skeleton node closest to a point xyz the surrounding space
% INPUT xyz: Point in space for which the closest node should be found
% treeInds: treeIdx oder treeIndices for which the search should
% ... |
function [dist] = Find_distance(x1,y1,z1,x2,y2,z2)
dist = sqrt((x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2);
end |
function [A, C] = votedPerceptron(Y, label, a, numEpoc) % Y is the matrix of augmented feature vectors, label defines label of each feature vector,
% a is the initial weight vector, numEpoc - number of times algo will run on the training data
c = 1; % c saves the number of feature vectors this weight ... |
clear all; close all; clc
%% Load Video 2
v2 = VideoReader("ski_drop_low.mp4");
vid2_dt = 1/v2.Framerate;
vid2_t = 0:1:v2.Duration;
vid2Frames = read(v2);
[height2, width2, RGB2, numFrames2] = size(vid2Frames);
for i = 1:numFrames2
X = vid2Frames(:,:,:,i);
% imshow(X);drawnow;
end
%% Set the size of the frame
n... |
% Figure 7.19 Feedback Control of Dynamic Systems, 6e
% Franklin, Powell, Emami
%
% script to plot the step tension responses of the tape
% drive servo with dominant second order, and LQR designs
clf;
f =[0 2.0000 0 0 0;
-0.1000 -0.3500 0.1000 ... |
%Demonstrate the Datetime and Duration Types in MATLAB
function open_webpage
url = input('Enter the url: ','s');
if isempty(url)
fprintf("No url entered, so quitting.\n");
return;
end
search_time = datetime; %same as datetime("now")
status = web(url);
if status == 0 % A started w... |
function exerciseCanonVarDigits57
import brml.*
p = 500; % Computando o número de exemplos
%Algoritmo CanonVar
%Primeiros 500 exemplos
load digit5; D{1} = x(1:p,:)';
load digit7; D{2} = x(1:p,:)';
D2{1}=x(p+1:end,:)'; T1=size(D2{1},2);
D2{2}=x(p+1:end,:)'; T2=size(D2{2},2);
%CANONVAR Canonical Variates (no post ... |
%训练参数设置
saveDir = 'G:\无源感知研究\实验结果\2019_11_07_实验室(3t3r)(1)_200unit_SingleBiLSTM_resample\';%结果保存路径
inputSize = 270;%输入维度
numHiddenUnits = 128;%隐层数量
numClasses = 6;%输入标签种类数量
networkType = 'SingleBiLSTM';%使用的网络类型
maxEpochs = 30;%最大迭代次数
Kfold = 10;%设置交叉检验折数
indices = crossvalind('Kfold',csi_label,Kfold);%划分训练集和测试集
%[x_tra... |
function U = heat_cvx(x, y, t, bc, ic)
m = length(x);
n = length(y);
k = length(t);
dx = (x(end)-x(1))/(m-1);
dy = (y(end)-y(1))/(n-1);
dt = (t(end)-t(1))/(k-1);
e = ones(m*n, 1);
A = spdiags([e/dy^2 e/dx^2 -2*e*(dx^-2+dy^-2) e/dx^2 e/dy^2], ...
[-m -1 0 1 m], m*n, m*n... |
%Tyler Matthews
%System Simulation Final
%P3
clc; clear all; close all;
% Model Parameters
numDays = 1000;
T = 0.5;
t = linspace(1,numDays,numDays);
alpha = 0.005;
beta = 0.0055;
zeta = 0.5;
delta = 0.001;
rho = 0.5;
c = 0.002;
p = 0.001;
Towns = ["Middletown", "Akron", "Canal Fulton", "Cleveland", "Columbus"];
Pop... |
function Meffskewquad_CTCO = getrespCTCO(varargin)
% getrespdisp - Measure efficency of skew quad towards dispersion function in vertical (IN PROGRESS)
%
% INPUT
% Optional
% 'Archive', 'Display'
% Optional override of the mode:
% 'Online' - Set/Get data online
% 'Model' - Get the model chromaticity ... |
function [output1] = p_LeftToeBottomFront(var1)
if coder.target('MATLAB')
[output1] = p_LeftToeBottomFront_mex(var1);
else
coder.cinclude('p_LeftToeBottomFront_src.h');
output1 = zeros(3, 1);
coder.ceval('p_LeftToeBottomFront_src' ...
,coder.wref(ou... |
function [out,Wc,Wo] = hankelsv(SYS)
%HANKELSV Compute Hankel singular values and grammians.
%
% [OUT,Wc,Wo] = HANKELSV(SYS) computes controllability and observability
% grammians Wc, Wo, and the Hankel singular values OUT of an LTI
% model SYS (created with either TF, ZPK, SS, or FRD). The model
% SYS ... |
global region; %region que va creciendo. Es una matriz del tama�o la imagen, con todo a cero salo la region, a uno.
global media; %media (dinamica) de la region que va creciendo
global points_in_region; %numero de puntos en la region que crece
global im1; %imagen
im1 = imread('rice.tif');
region = zeros(size(im1));
i... |
% %% combine gamma S results
% mydata= mydata_gammaS;
%
% %%
%
% x = length(mydata) +1;
% for i = 1:length(mydata_gammaS)
% mydata(x) = mydata_gammaS(i)
% x = x+1;
% end
%% processing lengths of traces
% I will consider anything shorter than 0.75 seconds to be short
for i = 1:length(mydata)
holdingp... |
clear
close all
Re_L = 1;
x = linspace(0,1,101); % dimentionless x/L
ue = ones(1,101); % dimentionless ue/U
Int = 0;
theta = zeros(1,101); % theta/L
theta_b = zeros(1,101); %blasius theta/L
for i = (2:length(x))
Int = Int + ueintbit(x(i-1),ue(i-1),x(i),ue(i));
theta(i) = sqrt( 0.45/Re_L*(ue(i))^-6 * Int );
... |
function t_sub_coef = SubbandThresholding(sub_coef)
% Threshold the noisy subband according to NeighShrink SURE rule
%
% sub_coef: inputted noisy subband
% t_sub_coef: outputted thresholded subband
%
% Author: Zhou Dengwen
% zdw@ncepu.edu.cn
% Department of Computer Science & Technology
% North China Electric ... |
function []=slicer(nume,extensie,ndata)
%
% Functia citeste un fisier de tip ASCII cu numele in variabila
% nume de felul 'c:folder\file.extensie'.
% Afiseza info despre datele din fisier si face ca ndata inregistrari
%sa fie in fiecare felie pe care o va scrie ca un fisier separat.
% Insereaza dupa nume ... |
function fh = plotCombineData(dataCombineStruct,dataField,varargin)
%绘制CombineStruct的图
% dataCombineStruct 传入一个dataCombineStruct
% dataField 要绘制的filed
% varargin可选属性:
% errortype:'std':上下误差带是标准差,'ci'上下误差带是95%置信区间,'minmax'上下误差带是min和max置信区间,‘none’不绘制误差带
% rang:‘测点范围’默认为1:13,除非改变测点顺序,否则不需要变更
% showpurevessel:‘是否显示单一缓冲罐’
... |
function obj = SignalObject__window(obj,step,w_size)
binned = windowed_data( obj, step, w_size );
formatted = cell(size(binned{1},1),size(binned,2));
for i = 1:size(binned{1},1);
for k = 1:size(binned,2)
formatted(i,k) = {binned{k}(i,:)};
end
end
obj.data = formatted;
obj = SignalObject(obj,obj.fs,ob... |
% this will crate the target matrics
y = zeros(850,34);
j = 1;
for i = 1 : 850
y(i , j ) = 1;
if ~(mod(i, 25) > 0)
j = j + 1;
end;
end |
function [ boolean ] = AlternansChecker(windowedACM)
end
|
function varargout = load_dple(varargin)
%LOAD_DPLE Explicitly load a plugin dynamically.
%
% LOAD_DPLE(char name)
%
%
%
%
[varargout{1:nargout}] = casadiMEX(847, varargin{:});
end
|
classdef TwoPulsePulseTrainBEDCS118 < FormatBEDCS118 & PulseTrain
% TwoPulsePulseTrainBEDCS118 < FormatBEDCS118 & PulseTrain
%
% Pulse train with two pulses following each other for BEDCS 1.18 (AB):
%
% anodic-cathodic--gap--cathodic-anodic (or opposite polarity)
%
% or
%
%... |
function out = mapFeature(phi1, phi2, degree)
% MAPFEATURE Feature mapping function to polynomial features
%
% MAPFEATURE(phi1, phi2, degree) maps the two input features
% to polynomial features of degree "degree"
%
% Returns a new feature array with more features, comprising of
% phi1, phi2, phi1.^2, phi2.^2,... |
% -- function for manipulate spectra
%
% spec Spectrum of a polynomium or transfer function
% sfak Spectral factorization
%
% spec2sd spectrum to spectral density
% sd2spec Spectral density to spectrum
%
% specplt Plot a spectrum
% specsum Add up two spectra.
%
% -- Function for determining auto covariance func... |
%------------- level set for constant flow --------- %
profile on
%------------ initlization ------------------------ %
clear ;
close all;
deltat = 0.1;
dt = 0.1;
iter = 100;
[x,y] = meshgrid(-3:deltat:3);
%------------ construct signed distance function ------------- %
phi = sqrt(x.^2/9 + y.^2/4 .* exp(x/5)) - 1 ;... |
close all
params.tapers = [10,19]; % Tapers [n, 2n - 1]
params.pad = 1;
params.Fs = 20;
params.fpass = [0.01,10]; % Pass band [0, nyquist]
params.trialave = 1;
params.err = [2,0.05];
% you want to make sure 'LH_restData' and 'RH_restData' have a mean of 0. You can use multiple trials just make sure the matri... |
function [confPts, confLine] = updtconf(s_number,index,eta,confPts,confLine)
for i2=1:s_number
set(confPts(i2),'xdata',index,'ydata',eta(i2,index));
hold on
set(confLine(i2),'xdata',1:index,'ydata',eta(i2,1:index));
end
end |
% Particle Demo at URSCAD
clear all
ACCESS_TOKEN = '';
echo on;
P = Particle(ACCESS_TOKEN);
L = P.Logan;
% L.reg.status0_color = Register(P.Logan, 6);
% c24b = L.reg.status0_color.get();
% c = [ ...
% bi2de(bitget(c24b, 24:-1:17)), ...
% bi2de(bitget(c24b, 16:-1:9)), ...
% bi2de(bitget(c24b, 8:-1:1)) ...
... |
% Function to perform iris localization by using
% Iris Localization via Pulling and Pushing (18th ICPR'06, Vol. 1, pp. 366íV369)
%
% Author:
% Zhaofeng He, Tieniu Tan, and Zhenan Sun
% Center for Biometrics and Security Research & National Laboratory of Pattern Recognition,
% Institute of Automation
% Chinese Academy... |
classdef SetGetCommand < handle
properties (GetAccess ='public', SetAccess ='public')
ioWiFly;
turnLeft;
turnRight;
XY;
Center_Ramp;
Entrance_Ramp;
Exit_Ramp;
Target;
FrontSensor;
BackSensor;
LeftSensor;
RightSensor1;
R... |
clear
clc
close all
%%
% CHIRP params
% ===================================
% ===== User-defined paramaters =====
% ===================================
Pchirp = 300e-06; % CHIRP Pulse Length (s)
sliceheight = 0.050; %mm
PreCPMGdelay = 40e-6; %s
nPts = 128; % # of acqu points
nEchoes = 16; % Echoes
tD = 3e-6; % dwe... |
function slcopy_mdl2subsys(model, subsysBlk)
% SLCOPY_MDL2SUBSYS Copy contents of a model to a Subsystem
% SLCOPY_MDL2SUBSYS(model, subsysBlk) deletes the Subsystem block
% contents, and copies the input model contents to the Subsystem block.
%
% Inputs:
% model: Model name or handle
% subsysBlk: Sub... |
%% V-n Diagram at 10,000ft
%Known Quantities
%air densities
rho = 0.001756; %slug/ft^3 %at 10,000ft
rho_sl = 0.002378; %slug/ft^3 %at sea-level
%velocities (ft/s)
V_cruise = 792; %ft/s %cruise speed
Ve_cruise = sqrt(rho/rho_sl)*V_cruise; %ft/s %equi... |
function [ graph, segmentMeta, borderMeta] = loadGraph( p, getNeighbors, ...
corrMode )
%LOADGRAPH Load the supervoxel graph from the segmentation main folder.
% INPUT p: struct
% Segmentation parameter struct. The graph files are loaded from
% the paths specified in p.svg.
% getNeighbors:... |
global baseParameters fparam parami nbin Acell calP2X7 iparam parami baseModel pMax pMin globalStruct;
pMax=containers.Map();
pMin=containers.Map();
%Create a cell array of strings with the names of the parameters.
paramNames={'k1','k2','k3','k4','k5','k6','k7','k8','k9','k10','k11','k12','k13','k14','k15','k16','k1... |
clear all ; close all ;
%subs = {'alex','dina','genevieve','jeremie','karl','russell','sukhman','tegan','valerie'} ;
subs = {'MONG_01_RB','MONG_02_DP','MONG_03_CG','MONG_04_AB','MONG_05_SG','MONG_06_TS'} ;
for subby=1%:length(subs)
cd(['c:/shared/mong_eeg/',subs{subby}]) ; ls
name = dir(['*vhdr']) ;
for nm=1... |
% n = 50
% M_cobo = nchoosek(1:(n-i),numberofPick);
ener = zeros(1,K)
for i = 1 : K
ener(i) = obj2(T,Div,adjG, M_cobo(r(i),:), ep);
if i == 1
lowEnergy = ener(i);
end
if ener(i) < lowEnergy
lowEnergy = ener(i);
lowEnergyInd = i;
end
end
lowEnergyDegree = sum(s... |
close all;
clc;
clear all;
vid=imaq.VideoDevice('winvideo',1,'RGB24_640x480');
%set(vid,'ReturnedColorSpace','grayscale');
%preview(vid);
while 1
dntshw=false;
pause(.001);
%acquireimage from webcam
%capture frame
frame = step(vid);
%Read the image, and capture the dimensions
img=uint8(255*frame);
out=skinDetect2Func(i... |
%Demonstrate the use of a Hopfield network for associative memory.
%Demo written by Matthew Dunham using the Neural Network Toolbox.
load binaryImages; % 7 binary images, each 150x150
newsize = 30; % new size 30x30
nimages = 7;
occlusion = 0.5;
target = zeros(newsize*newsize,length(images));... |
function jsd = calc_jsd(P, Q)
%desc:
%calculates the Jensen-Shannon divergence between two discrete probability
%distributions
%input:
%P: n x 1 vector containing pmf of first distribution
%Q: n x 1 vector containing pmf of second distribution
%normalize P and Q
... |
function progress100(k,N,x)
if nargin<3
x=100;
end
if rem(k,x) == 0
fprintf('%5d ...... %d\n', k, N);
end |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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#... |
% kryterium kombinowane
function [J,OrderBest,u,sigma3]= kryt_kombOgolne(Markovski)
u=mean(Markovski ,1);
sigma = std(Markovski,0,1);
sigma3=sigma*3;
J=u+3*sigma
[~,OrderBest]=min(J);
end
|
%
% Copyright (C) 2011 Alex Bikfalvi
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 3 of the License, or (at
% your option) any later version.
% This program is distr... |
function q = SWE1D(q,Problem,Mesh,Limit,Net,Output)
% Purpose : Integrate 1D Shallow water equations until FinalTime
% Globals1D_DG;
% Globals1D_MLP;
time = 0;
xmin = min(abs(Mesh.x(1,:)-Mesh.x(2,:)));
iter = 0;
xcen = mean(Mesh.x,1);
% Limit initial solution
if(Output.save_ind)
fid = fopen(strcat(Output.fnam... |
%% Automate Attributes of Labeled Objects
%% detect vehicles from a monocular camera
vidObj = VideoReader('05_highway_lanechange_25s.mp4');
vidObj.CurrentTime = 0.1;
I = readFrame(vidObj);
data = load('FCWDemoMonoCameraSensor.mat', 'sensor');
sensor = data.sensor;
detector = vehicleDetectorACF();
vehicleWidth = [1.5... |
clear all
close all
clc
%% Initialise variables
m1 = 1; % mass 1
m2 = 0.1; % mass 2
M = m1 + m2; % total mass
T = 2*pi * sqrt(1 / M); % period of orbit
omega = 2*pi/T; % angular velocity based on orbit
[X,Y] = meshgrid(-1.5:0.01:1.5); % meshgrid sets out entire plane
U =... |
% written by professor Jay McClelland
function [] = initParams(epoch)
% This program initialize and preallocate the parameters needed for the
% model. This should be executed before the simulations.
global p a
%% modeling parameters
p.wf = .15; % noise magnitude
p.lrate = .01; % learning rate
... |
function AnoMat = Generate_Deviation;
clc
hemi = 'lh';
InputDir = '/media/Data/ibas/Compatibilidad_Proyecto_PEPs/Procesamiento_FreeSurfer/Qdec';
CFilest = sel_files(InputDir,['Y_' hemi '*']);
if hemi == 'lh'
[cvar,ctab] = read_cfiles('/media/Data/ibas/Compatibilidad_Proyecto_PEPs/Procesamiento_FreeSurfer/COMP_avesu... |
%Aufgabe 9
clear;
Vin = 10;
R = 10E+3;
toleranz = 0.1;
R_t = random('Normal',R,R*toleranz,1,10);
Rd = 0.1;
U_res = 0;
for i = 1:10
R4 = R_t(i);
sim('Aufgabe9');
U_res(i) = mean(U4);
end
print(simlog) |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Lab 2 Task 1 %
% DCT - based Image Compression %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Step 1.1
... |
function cleanTxtFile(fileName)
f = fopen(fileName,'wt'); % it will create one if not exists
fclose(f);
|
function [output_p_clique output_m_clique vote_both vote_neither] = vote_partition(p_clique, m_clique, neighbor12, ibd12)
% will be equivalent to eigenvalue method, given first iteration
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% p_clique and m_clique will never shrink
% all predi... |
% [x,ret] = Ibarvinok(K,PL,PU,itn,epsilon,xsdp,rsdp)
%
% Barvinok's "naive algorithm" based on concentration of measure for iDGP
% (optional) xsdp and rsdp: solution of the SDP (found by sdpnlp)
function [xstar,ret] = Ibarvinok(K,PL,PU,xsdp,rsdp,itn,epsilon)
% use linesearch local NLP solver
if (nargin < 7)
ep... |
classdef packbed_class
properties
type %
L
D
A
dp
eps
Sv
AR
V % Tank volume
Sname % Solid name
sld % Table that contains solid data
rhoS
kS
cS
rhoF
... |
function Lp = pa_pressure2level(P)
% LP = PA_PRESSURE2LEVEL(P)
%
% Convert sound pressure P (Pa) to sound level LP (dB SPL).
%
%
% See also PA_OCT2BW, PA_LEVEl2PRESSURE
% (c) 24 May 2011 Marc van Wanrooij
Pref = 20*10e-6; % 20 muPa RMS, usually considered human threshold of hearing at 1 kHz
Lp = 20*log10(... |
function display_cal(~,~,main_figure)
layer=get_current_layer();
fig=new_echo_figure(main_figure,'Tag','calibration');
dx=1/8;
dy=1/10;
y=(1-2*dy)/3;
x=1-2*dx;
ax_1=axes(fig,'Box','on','Nextplot','add','position',[dx 2*y+dy x y]);
grid(ax_1,'on');
ylabel(ax_1,'G(dB)')
ax_1.XTickLabels={''};
ax_2=axes(fig,'Box','o... |
function varargout = ac_sampling(acontour, o_properties)
%ac_sampling: sampling of an active contour
% s = ac_sampling(a, o_p) samples an active contour, a, returning the
% requested properties, o_p. o_p is a string of up to 6 characters among B, b,
% s, t, n, and c, without repetition, corresponding to the b... |
%%
run('my_prefs')
%%
files = dir(cd)
%%
images = cell(5,1);
for i=3:7
images{i-2} = imread(files(i).name);
end
%%
img = zeros(1024,1024,5);
for i=1:5
img(:,:,i) = images{i}(1:1024, 1:1024);
end
%%
img = uint16(img);
%%
cor11 = normxcorr2(img(:,:,1), img(:,:,1));
cor12 = normxcorr2(img(:,:,1), img(... |
clear all;
%输入向量及期望输出向量
P=[1 1.5 3 -1.2];
T=[0.5 1.1 3 -1];
%给出权值和阈值的范围并绘制误差曲线及误差曲面等高线
w_range=-2:0.4:2;
b_rang=-2:0.4:2;
ES=errsurf(P,T,w_range,b_rang,'purelin');
plotes(w_range,b_rang,ES); %效果如图3-31所示
%寻找训练用最快速稳定的学习率,创建生成一个线性神经元,并设置训练次数
maxlr=maxlinlr(P,'bias');
net=newlin([-2 2],1,[0],maxlr);
net... |
function [ flow_switch ] = checkFlow( U, d )
% check to see if interpolation function exists already for potential flow
% configuration
list = dir;
file = ['flow_interp_U',num2str(U),'_d',num2str(100*d),'.mat'];
flow_switch = 0;
for i = 1:length(list)
if strcmp(file,list(i).name)
flow_switch... |
function[resultado] = c(x)
var = x + 18;
resultado = 6 * exp(var); |
% Processing data from InMotion and EEG
% By Nikunj Bhagat, 8/14/13
clear;
%close all;
%% Global variables
myColors = ['g','r','b','k','y','c','m','g','r','b','k','b','r','m','g','r','b','k','y','c','m'];
Subject_name = 'FJ2';
%folder_path = ['F:\Nikunj_Data\InMotion_Experiment_Data\Subject_' Subject_name '_ses1_train... |
% pop_icID_pvaf() - Collect variables for ...
%
% Usage:
% >> EEG = pop_icID_pvaf( EEG, ChanIndex, EventType);
%
% ChanIndex - EEG channels to display in eegplot figure window while editing events and identifying bad channels.
% EventType - Event types to display in eegplot figure window while editing event... |
function [x]=runge(A,B,U,X0,dt)
%*********************************************************************
% Runge-Kutta yöntemi ile dif. denklem çözümü.
% Copyrright - Ismail H. Altas, 2002
% A : (n,n) durum matrisi
% B : (n,n) giris katsayi vektörü
% U : (n,1) giris vektörü
% X0 : baslangiç degerleri
% dt : zamana verile... |
function L = likelihoodfn(c)
L = 1;
cardata = readtable("C:\Users\Leo\OneDrive\School Stuff\IO\HW3\IO-Homework-3\cardata.txt");
for year = 71:90
%Separate out data by year for calculations and create a matrix of the
%variables, and separate out x, s, p;
cardatathisyear = cardata... |
% quantify_masked_lung_regions_20180208
%
% quantifies regions of the lung, heart and muscle that are selected by segmentation
%
% code is based on manual_mask_selection_csi_20170702 made on 7/2/2017 by
% MP
%% Quantification Mask Selection and Loading
% define folder path to save quantification data
temp = strfind(... |
function accum=isiAnalysis
%intrinsic analysis
%Navigate the current folder to a directory containing your image files
%(.tiff), and no additional image files
clear all
list=dir('*tiff');
[~, reorder] = sort_nat({list.name});
list = list(reorder);
nFrames=length(list);
x=zeros(length(list),1);
f=waitbar(0... |
function results = waves_2d(Nx,Ny,x0,y0,xi0,eta0,T1,T2,ht,ind)
%%
% Solution the the 2d wave equation
%
% rho(x)u_tt - div(sigma(x)grad u) = 0, (x,t) in [(-1,1)^2]x(0,T)
% u(-L,t) = u(L,t) = 0, t in (0,T)
% u(x,0) = u0(x), u_t(x,0) = u1(x) x in (-1,1)^2
%
% with a highly concentrated and ... |
function [ image3DQC ] = qCBinary( image3D )
%qCBinary QC the image after any mathematical operation that it is binary.
%
% Input Arguments
% - image3D : a (nx*ny*nz) uint8 matrix, 3-D binary image of
% pore space to be checked (0 = pore, 1 = grain)
%
% Output Arguments
% - image3DQC ... |
function plotTOFspectra
clear;
%plotPositions();
filenameList='fileListPlotTOF.dat';
fid=fopen(filenameList);
d=1;
tline=fgetl(fid);
mcaRange=sscanf(tline,'%f %f');
tline=fgetl(fid);
directory=sscanf(tline,'%s');
tline=fgetl(fid);
plotIndividual=sscanf(tline,'%d');;
tline=fgetl(fid);
parameter=sscanf(tline,... |
L_1 = 0.3;
L_2 = 0.25;
L_3 = 0.05;
% Part (a) %
theta_1 = pi/4;
theta_2 = 3*pi/4;
theta_3 = pi/2;
Js = [
-L_1*sin(theta_1), -L_2*sin(theta_2), -L_3*sin(theta_3);
L_1*cos(theta_1), L_2*cos(theta_2), L_3*cos(theta_3);
];
% Part (b) %
T = [1,0,0;1,1,0;1,1,1];
% Part (c) %
Jr = Js * T;
% Part (d) %
% dp = Jr \ [1;1... |
function scan_data = rdprfile(ufilename,plotmode,verbose)
%RDPRFILE Reads data from a profilometer data file
%
% DATA = RDPRFILE(UFILENAME,VERBOSE)
%
% RDPRFILE examines the header in a profilometer data file and attempts to
% determine the type of data file. If a supported type is found, it then
% uses the appropria... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.