text stringlengths 8 6.12M |
|---|
%
% Day 13, Advent of code 2017 (Jonas Nockert / @lemonad)
%
content = fileread('day13.in');
[severity, delay] = solve(content);
fprintf("Severity: %d\n", severity);
fprintf("Delay: %d\n", delay);
assert(severity == 648 && delay == 3933124)
%
% Test sample given in problem description.
%
content = ["0: 3", "1: 2", ... |
orgIm = im.Data(:,:,64);
for i = 1:256
for j = 1:256
if orgIm(i,j,1) > 135
orgIm(i,j,1) = 256;
else
orgIm(i,j,1) = 0;
end
end
end
corrIm = corr_im(:,:,1);
for i = 1:256
for j = 1:256
if corrIm(i,j,1) > 135
corrIm(i,j,1) = 256;... |
% Keep trying to get the optimization license
n = 1;
options = optimset('Display','off');
fail = 1;
while fail
fail = 0;
try b = lsqcurvefit(@(a,x) a*sin(x),1,[1,2,3],[1,2,3],0,2,options);
catch exc
fail = 1;
getReport(exc)
disp(['Opt. Toolbox license checkout failed. Attempt ' num... |
% ---------------------------------------------------------
% dynLeafCheck
% ---------------------------------------------------------
% Dynalog Analysis Package
% Michael Hughes 2010-2011
% ---------------------------------------------------------
% Checks each leaf against a tolerance. Returns positive
% if 'fraction... |
function [c1] = C1NoMax_From_S1(stim, filters, fSiz, c1SpaceSS, c1ScaleSS, c1OL,INCLUDEBORDERS,ONLYS1,s1)
%function [c1] = BileschiRespC1(stim, filters, fSiz, c1SpaceSS, c1ScaleSS, c1OL,INCLUDEBORDERS,ONLYS1,s1)
%
% maximum over scales within band, but no spatial maximum.
USE_NORMXCORR_INSTEAD = 0;
if(nargin < 7)
IN... |
% Generate numerical bead geomerty module of the CAT phantom
%
% Meng Wu at Stanford University
% 2014
ellipsesParams = zeros(1, 6 );
ellipsesParams(1,:) = [0 0 90 90 0 1];
ellipsesParamsDensity = [0 0 90 90 0 0.95; ...
0 0 75 75 0 1];
I = zeros( [1024 1024], 'single' );
meta.DimSize = ... |
global saveProcess
varExist = exist('onePlotOnly','var');
if varExist == 0
onePlotOnly = false;
end
%% Performing Classification
timeBeforeEvent = 5;
timeAfterEvent = 5;
% Feature Extraction
% timeInfo.training{1} = struct('noverlap',params.params_featExtraction.wshift,'timeInterval',[-3 -1],'meanOverWindow',... |
clear all
%2a(ii)
A=[1/3 1/3 2/3;2/3 2/3 4/3;1/3 2/3 3/3;2/5 2/5 4/5;3/5 1/5 4/5]
s = svd(A);
tol = max(size(A))*eps(max(s));
r = sum(s > tol);
r
%2a(iii)
elem=zeros(2000,1)
for i=1:2000
x=vpa((0.9)^i)
elem(i)=x
end
A2000=diag(elem)
s = svd(A2000);
tol = max(size(A2000))*eps(max(s));
r2k = sum... |
clc,clear all,close all;
% K-Means Clustering
% Rasit EVDUZEN
% 22-Feb-2020
%% Create Random Data
DimensionOfData = 2;
clu = ceil(rand*10);
centers = 100*rand(DimensionOfData,clu);
T = [];
for k=1:clu
temp = 15+ceil(15*rand);
T = [T,centers(:,k)*ones(1,temp)+10*[rand(DimensionOfData,temp)-0.5]];
e... |
function [U] = burgers_LF(L,Ncells,Nsteps)
% This function solves 1D Burgers' equation using the Lax-Friedrich scheme
% under inviscid condtions.
% Input arguments
% L The length of interest
% Ncells Number of cells
% Nsteps Number of time steps
%
% Output arguments
% U Velocit... |
function S = MBWREOS_S_TP(T,P)
%calculates the entropy from the Temperature and pressure
%In the two phase region should display a warning and return the liquid
%value
% %USE:
% [S] = MBWREOS_S_TP(T,P)
% [S,state] = MBWREOS_S_TP(T,P)
% where:
% P = Pressure (kPa)
% T = Temperature (K)
% S = specific entropy (kJ/kg/K)
%... |
% Histogram Equalisation Without using Direct Function
clc
clear all
close all
a=imread('pout.tif')
subplot(2,2,1)
imshow(a)
title('Original Image')
[r,c] = size(a);
x= 1:1:255
y= (zeros(1,255));
in = 1;
count = 0;
output=zeros(256,1);
NIm=uint8(zeros(size(a,1),size(a,2)));
% Finding Histogram ... |
%% Shows the extrinsic parameters:
dX=15;
dY=15;
for i=ind_active
% seting the number of squares for each pattern. Both X and Y
eval(['n_sq_x_' num2str(i) '= ' num2str(n_sq_x) '; n_sq_y_' num2str(i) '=' num2str(n_sq_y) ';']);
end
%-- Projector parameters:
%%
fc_proj = fc;
cc_proj = cc;
kc_proj = kc;
alpha_c_pr... |
function [u,W,iter] = wls_alloc1(B,v,umin,umax,Wv,Wu,ud,gam1,u,W,imax)
% WLS_ALLOC - Control allocation using weighted least squares.
%
% [u,W,iter] = wls_alloc(B,v,umin,umax,[Wv,Wu,ud,gamma,u0,W0,imax])
%
% Solves the weighted, bounded least-squares problem
%
% min ||Wu(u-ud)||^2 + gamma1||Wv(Bu-v)||^2
%
% subj.... |
function [k] = R257_270_cor(Te)
load('../lookup_files/sigma_in_257_270.mat'); % created using the m file R257_270_cor_sigma. Do
m_e = 9.1e-31; % not change the m or range of E without changing
m = 1000; % it in that file.
... |
function hash_code = hash_pose_sequence( y )
if size(y.mix_id{2},1)==3
hash_code = [num2str((cat(1,y.mix_id{:}))') num2str(floor(y.joints(:))') ];
else
hash_code = [num2str((cat(2,y.mix_id{:}))) num2str(floor(y.joints(:))') ];
end
end
|
function d = euclidean(h1, h2)
% EUCLIDEAN computes the Euclidean Distance for the two histograms h1 and h2
d = sqrt(sum((h1-h2).^2));
end |
% Author: Morgan Talbot, morgan_talbot@alumni.brown.edu
% To run an experiment session, enter "Main_SSRT" into the MATLAB console,
% or press the "Run" betton in the menu above under the "EDITOR" tab.
% Giant try-catch block enables PsychToolbox to exit gracefully in the
% event of an error (rather than freezing an... |
function [Value, ReviewInfo]=IntensityDirect_Feature_GlobalEntropy(ParentInfo, Param)
%%%Doc Starts%%%
%-Description:
%The intensity entropy among all the voxels.
%-Parameters:
%1. NBins: The number of bins.
%2. RangeMin: Lower bound of bin location.
%3. RangeMax: Upper bound of bin location.
%... |
function x = ddr_dynamics_sim(xo,u_new,Horizon,dt,sigma, params)
l = params.length;
w = params.width;
wb = params.wb;
l_rad = params.l_radius;
r_rad = params.r_radius;
d_theta_nom = params.d_theta_nom;
d_theta_max_dev = params.d_theta_max_dev;
d_theta_reverse = params.d_theta_reverse;
x = xo;
max_u = 1;
min_u = -1;
... |
function a = variation(z) %Gives a "measure" of how fast is the solution changing
l = length(z(1,:));
a = zeros(1,l-1);
for i = 1:l-1
a(i) = norm((z(:,i+1)-z(:,i)),inf);
end
end |
% Copyright (c) 2008-2010 Joris Mooij [joris.mooij@tuebingen.mpg.de]
% All rights reserved. See the file COPYING for license terms.
%
% Compares models duration->interval and interval->duration using geyser data
fprintf('----------\n');
fprintf('Doing Old Faithful experiment...\n\n');
clear
A = load('-ascii','../d... |
%[WL-Waveform Length] feature
function feature = WL_feature(data_TimeWindow)
feature = sum(abs(diff(data_TimeWindow)))/length(data_TimeWindow);
|
function varargout = BEL1DSNMR(varargin)
% BEL1DSNMR is a graphical interface that helps the user to perform
% prediction-focused approach imaging of the subsurface using SNMR data.
% This code relies heavily on MRSmatlab codes (Mueller-Petke et al., 2016),
% and therefore REQUIRES the presence of all MRSmatlab functio... |
% orthogonal q-disatnce from X to the affine subspace
function [d] = AffSub_dist(A, C, X, q)
M = eye(size(A))-A;
d = norm (M*(X-C), q);
end |
function [min, opt_point, f_calls, iter] = gradient_descent(f, step_size, initial_point, threshold, mode, varargin)
plot_graph = false;
iter = 1;
if isempty(varargin) == false
ax = varargin{1};
plot_graph = true;
end
if strcmp(mode, 'analytic')
jac.function =... |
function y = lowPassFilt(x)
% Andrew Mullen & Yichu Jin 3/18/2018
% Make FIR1 filter and then lowpass below 500 Hz
% 60th order filter (don't care about phase)
Fs= 8000;
filt = fir1(60,500/Fs,'low');
y = filter(filt,1,x);
end |
Ninput = 4; % alphabet size
Nhidden = 2;
Ncontrol = 10; % really, 1 should be sufficient
Noutput = 4;
Ntimes = 1;
init_scale = 0.1;
num_iterations = 1500;
batch_size = 5;
num_examples = 5;
learning_rate = 0.3;
RNNnet = RNNmodel(Ninput, Nhidden, Noutput, Ncontrol, learning_rate, init_scale);
RNNnet.weights.w_HC = zer... |
%GLOBALKGEOM global geometric stiffness matrix.
% globablKgeom (rho, Kg, EA, N, L_e) places the element stiffness matrix
% into the appropriate position in the global stiffness matrix. Runs for
% every element iteratively. Once all elements have been iterated over,
% the global stiffness matrix is complete.
% ... |
function [ pctmat ] = Untitled( vmat )
% 从价值矩阵横向归一化成占比矩阵
% -------------
% 程刚,初版本,20150521
%% 预处理
% 判断类型
if ~isa(vmat, 'TsMatrix')
error('本函数只接受TsMatrix类型的vmat');
end
% 判断数值类型
dtype = vmat.datatype;
warning('vmat.datatype = %s,请确认为金额', dtype)
% 找数据里有nan
if isnan( vmat.data )
warning(' vmat.data 中含有nan,可能会造成... |
function [c] = quaternionAdd(a, b)
c = a + b;
end |
% GABORCONVOLVE - function for convolving image with log-Gabor filters
%
% Usage: EO = gaborconvolve(im, nscale, norient, minWaveLength, mult, ...
% sigmaOnf, dThetaOnSigma)
%
% Arguments:
% The convolutions are done via the FFT. Many of the parameters relate
% to the specification of the filters in the freque... |
%This code will be for the first part of the comodulation binding
%experiment collecting only behavioral data on 12 conditions
clear all; close all hidden; clc; %#ok<CLALL>
path = '../CommonExperiment';
p = genpath(path);
addpath(p); %add path to commonly used functions
addpath('Stim_Dev')
subj = input('Please subject ... |
%% Problem 1
clc; clear all; close all;
%wdot = @(w, v)((0.7 + v - 0.8*w) / 12.5);
%vdot = @(v, w, t)(v - ((v^3)/3) - w + I(t));
I = @(t)((5 + sin((pi*t)/10)) / 10);
f = @(t, v)([v(1) - ((v(1)^3)/3) - v(2) + I(t);
(0.7 + v(1) - 0.8.*v(2))/ 12.5]);
v0 = [1; 0];
dt = 0.5;
T = 100;
v_05 = rk2(v0, f, dt, T);
a... |
openinout;
[time, reference, input, output] = rmController();
anaout(0,0);
closeinout;
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Plots
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure %Open a new window for plot.
plot(time, reference, time, output(5,... |
function [sw,res,range] = compute_SAR_swath(h,off,scan,f,D,B)
%%
% Usage: sw = compute_conical_swath(h,off,fov)
% sw in same units as h, off and fov in deg
dtheta = 3e8/f/D;
sw = h*(tan(off*pi/180+scan/2)-tan(off*pi/180-scan/2));
res = h*(tan(off*pi/180+dtheta/2)-tan(off*pi/180-dtheta/2));
range = 3e8/2/B/sin(off*pi/... |
%% Import data from spreadsheet
% Script for importing data from the following spreadsheet:
%
% Workbook: C:\Documents\MATLAB\FuelEconomy\dataXLS\2004dat.xlsx
% Worksheet: Sheet1
%
% To extend the code for use with different selected data or a different
% spreadsheet, generate a function instead of a scrip... |
function [u,time] = Heat1D(u,FinalTime)
% function [u] = Heat1D(u,FinalTime)
% Purpose : Integrate 1D heat equation until
% FinalTime starting with initial condition, u.
Globals1D;
time = 0;
% Runge-Kutta residual storage
resu = zeros(Np, K);
% compute time step size
xmin = min(abs(x(1,... |
function L = preproc2(L, params2)
% Loop through each image and pad
for i = 1:size(L, 1)
L{i} = padarray(L{i}, [(params2.rfSize(1) - 1) / 2 (params2.rfSize(2) - 1) / 2], 'replicate');
end
end
|
clc
clear all
close all
x=input('sequence');
N=input('length of DFT');
l=length(x);
if N>l
x=[x zeros(1,N-1)];
else
x=x(1:N);
end
i=sqrt(-1)
w=exp(-i*2*pi/N);
n=0:N-1;
k=0:N-1;
k=n'*k;
W=w.*xk;
X=x*W;
disp(x);
subplot(211);
stem(k,abs(x));
xlabel('time');
ylabel('amplitude');
title('first sequence');
subplot(21... |
% based in scripts from http://people.cs.uchicago.edu/~dinoj/manifold/swissroll.html
ppm = [4000 4000 4000 4000]; % points per mixture
const=1.0;
centers = const * [7.5 7.5; 7.5 12.5; 12.5 7.5; 12.5 12.5];
stdev = 3;
[data2,labels]=makegaussmixnd(centers,stdev,ppm);
%plotcol (data2, ppm, 'rgbk');
X = data2(:,... |
% extract the ST-GMSD features for a given video.
function feat = extract_stgmsd(vid)
[dx, dy, dt] = funcGetKernel();
gx = convn(vid, dx, 'valid');
gy = convn(vid, dy, 'valid');
gt = convn(vid, dt, 'valid');
feat = sqrt(gx.^2+gy.^2+gt.^2);
end
function [dx, dy, dt] = funcGetKernel()
basis_1 = [1 1 1; 1 1 1... |
function [Xrect,Yrect] = rect()
load values
% BUILD XRECT AND YRECT
Xrect = zeros(nr,nc);
Yrect = zeros(nr,nc);
bad_pix = 0;
for i = 0:nc-1
for j = 0:nr-1
xsearch = i+buf;
ysearch = j+buf;
[x_temp,y_temp] = undst_point(xsearch,ysearch,px,py,pxd,pyd,buf);
... |
function edges = Large_Edges(presents)
edges = max(presents(:, [2,3,4]), [], 2);
end |
clear all; close all; clc
% verif
% load 2d quadrature
nquadx=10; nquady=10;
[xq,yq,wq] = GL_2D(nquadx,nquady);
% load basis function
b = shape_functions(xq,yq);
% for i=1:4
% figure(i)
% surf(reshape(xq,nquadx,nquady),reshape(yq,nquadx,nquady),reshape(b(:,i),nquadx,nquady))
% end
Jxw = compute_jacobian(xq,... |
path = 'C:\Users\60069978\Documents\MATLAB\scan\';
filename = [path 'LUT_frame_x_390_y_570.png'];
X0 = 1500;
f = @(x)ajuste_punta_1_param_2(x, filename, 0);
[x, fval] = fminsearch(f, X0);
ajuste_punta_1_param_2(x, filename, 1); |
% EASY3 Read RINEX navigation file reformat into Matlab Eph matrix.
% Open a RINEX observation file analyse the header and identify
% observation types. The function fepoch_0 finds epoch time
% and observed PRNs in an OK epoch (digit 0, RTK observations
% will have a 2 in this place)... |
% MLE of the Mixed Matern model
% In this script, we consider the case where covariates are included in the
% model.
% The covariates we included are sin(longitude) and cos(latitude).
% grid=20*40
clear
savefile = 'MLE_covariate.mat';
% run on server
parpool(16)
addpath(genpath('/home/minjay/div_curl'))
addpath(genp... |
function smh_dg = loss_smh_diag(x,data)
% This function returns a diagonal component matrix D such that the hessian
% matrix of the 'logistic loss' function H = A'*D*A, where A = data.A
% Note: the output smh_dg is of MATLAB 'sparse matrix' type.
A = data.A;
n = size(A,1);
Ax = A*x;
eAx = exp(Ax);
... |
function [ y ] = Steven_Macenski_HW6_Problem3( x,handle )
%Inputs the vector x an the handle
y = handle(x);
fprintf('y is:\t');
fprintf('%.1f\t',y);
fprintf('\n');
plot(x,y);
figure(1)
title(func2str(handle));
end
|
clc
clear variables
%Inercia referidas al eje de ref marco teorico
Isat= [0.0421379 0.0000186 -0.0000310;0.0000186 0.0421882 0.0000684; -0.0000310 0.0000684 0.0055279];
r1=[-34.7530 0.8246 0.1663]';
r2=[0.5598 -34.4882 0.1663]';
r3=[0.5598 0.8246 -35.4791]';
r4=[17.8839 18.1487 17.1578]';
G=[r1/norm(r1) r2/no... |
%% MASCRET Quentin - Copyright 2017 %%
%% 20/02/2017 %%%
function [X_im] = short_time_fourier_transform(Signal, window_ms, step_ms, fs, varargin )
% variables
alpha=0.97;
% preemphasis filtering
speech = filter( [1 -alpha], 1, Signal );
% ms to sample
... |
% WVDTOOL ウェーブレットディスプレーツール
% VARARGOUT = WVDTOOL(OPTION,VARARGIN)
% Copyright 1995-2004 The MathWorks, Inc.
|
function FrameProcessor(obj,event,hImage)
%%
In = event.Data;
Ib = getappdata(hImage,'HandleToBackgroundImage');
%%
INgray=rgb2gray(In);
IBgray=rgb2gray(Ib);
% figure, imshow(INgray);
%%
Isubt=imsubtract(IBgray,INgray);
% figure, imshow(Isubt);
%%
[r,c] = size(Isubt);
Ivalues = zeros(r,c);
for i = 1:r
for j = 1:... |
function data_target = get_matching_segments(data_segments, data_event)
is_data_cell = iscell(data_segments);
if is_data_cell
num_segments = length(data_segments);
num_events = size(data_event, 1);
if num_segments ~= num_events
error('Invalid input. The number of segments should be the same as th... |
function [y] = userConv(x,h)
N = length(x);
M = length(h);
y = zeros(N+M-1,1);
% zero-pad x and h arrays
x = [x;zeros(M-1,1)];
h = [h;zeros(N-1,1)];
for n = 1:N+M-1 % for the length of the output, y
for m = 1:M
if (n > N) && (N-m+1 > 0)
% if n position is past its length, N
% and... |
function [x,y,score] = detect(I,template,ndet)
%
% return top ndet detections found by applying template to the given image.
% x,y should contain the coordinates of the detections in the image
% score should contain the scores of the detections
%
% compute the feature map for the image
f = hog(I);
nori = size(f... |
function [n0] = fun_n0(T,S,lumbda)
%average refractive-index
a0 = 1.31405;
a1=1.779e-4; a2=-1.05e-6;
a3=1.6e-8; a4=-2.02e-6;
a5 = 15.868;
a6=0.01155; a7=-0.00423;
a8 = -4382; a9 = 1.1455e6;
n0 = a0 + (a1 + a2*T + a3*T^2)*S + a4*T^2 + (a5 + a6*S + a7*T)/lumbda + a8/lumbda^2 + a9/lumbda^3;
end
|
function orms=odd_rms(nn)
orms = sqrt(sum((1:2:nn*2).^2) ./ nn); |
% Function for testing paths in 4D and 2D problems
% By Geoff Gordon and Geoff Hollinger, 2007
%Displays a path on the 2D map given by the path input vector.
%Path is a vector of (x,y) coordinates with format:
%path(1,:) = [x1 y1]
%path(2,:) = [x2 y2]
%etc...
function plot_path(map, XY,title_name,fig,sIm)
if nargin ... |
function [upList, downList, revList] = getReversals(x)
nReversals = 0;
downList = [];
upList = [];
revList = [];
for k = 3:numel(x)
if((x(k-1) > x(k)) && (x(k-1) > x(k-2)))
nReversals = nReversals + 1; revList = [revList, (k-1)];
downList = [downList, (k-1)];
end
if((x(k-1) < x(k)... |
% DATA PREPROCESSING AND FILTERING
% Run after |dataImport.m|
clearvars
load folderPaths.mat
load labelMap.mat
%% Load Imported Data
load accTimetables.mat
load forcesTimetables.mat
load accDataset.mat
load forcesDataset.mat
load accTimetableNames.mat
load forceTimetableNames.mat
%% Data Pre-processing
% Filterin... |
clc
clear all
close all
t= -5:0.01:5;
%heaviside function
%(i)
y1= heaviside(t);
subplot(1,2,1)
plot(t,y1)
title('u(t)')
%(ii)
y2= t.*heaviside(t);
subplot(1,2,2)
plot(t,y2)
grid on
title('tu(t)')
%(iii)
y3= sin(2*pi*t).*heaviside(t);
figure
plot(t,y3)
title('sin(ω0t)u(t)')
grid on
%extra
y4= heaviside(-t);
figu... |
%Lendo os dados das views
%Dados das planilhas foram colocados em ordem de acordo com a classes
shape_view_order_train = 'D:\\UFPE\\Mestrado\\2017.1\\Aprendizagem de Máquina\\Francisco\\Projeto\\Dados\\shape_view_order_train.csv';
shape_view_order_val = 'D:\\UFPE\\Mestrado\\2017.1\\Aprendizagem de Máquina\\Francisco\\P... |
close all
clear
% #1
theta=[0,pi/4,pi/2,(3*pi)/4,(5*pi)/4];
r=2;
x=r*cos(theta);
y=r*sin(theta);
radius=(x.^2+y.^2).^(1/2)
% #2
t=linspace(1,10,91);
y=(exp(t./10).*sin(t))./(t.^2+1);
figure
plot(t,y,'b+:')
hold on
title('Plot for y=(e^(t/10)*sin(t))/(t.^2+1)')
plot(t,y,'o-')
hold off
% #3
t=linspace(0,20,20);
x=sin(... |
function [X] = getCentroid(elem)
X = zeros(1,3);
X(1,1) = (1.0 / 3.0) * ( elem(1,1) + elem(2,1) + elem(3,1) );
X(1,2) = (1.0 / 3.0) * ( elem(1,2) + elem(2,2) + elem(3,2) );
X(1,3) = (1.0 / 3.0) * ( elem(1,3) + elem(2,3) + elem(3,3) );
end |
%*********************************************************************
% Theory of the Hilbert Spectrum: Code Examples for Reproducible Research
%*********************************************************************
%
% Description: This Demo file shows various visualizations for an
% AM--FM Component wit... |
%% ausvard - Utvärdera vvx för att se vilka flöden, k och volymer
par(1) = 1000; %rho
par(2) = 4200; %cp J/kg,K
par(3) = 0.03/1000; %kall m3/s
par(4) = 0.01/1000; %varm m3/s
par(5) = 2000; %k W/m2K
par(6) = 20; %Tkin
par(7) = 60; %Tvin
par(8) = 0.03*2/2; %m2
par(9) = 0.05/1000*2; %m3
n = 20;
tmax = 100;
[t,T]=od... |
% Name:Tommy Lee Truong
% Last Edit:Feb 23 2021
% Program Name: HW 4
clc; clear all; close all;
% for pen and paper problems see pdf scan
%% Q2 test
A=[ones(1,3);ones(1,2),0;1,zeros(1,2)];
%inverse should be [001;01-1;1-1-1]
x=my_inv(A)
|
% FEATURE EXTRACTION (backup)
% Run after |dataPreprocessing.m|
tic
clearvars
load folderPaths.mat
%% Load Preprocessed Filtered and Filtered Data
load accUnfilteredDataset.mat
load accFilteredDataset.mat
load accTimetableNames.mat
%% Dataset Selection
accelerations = [accUnfilteredDataset accFilteredDataset accTi... |
clc;
clear variables;
n=imread('rect_17.jpg');
%n=imread('BW.png');
[row,col,channel]=size(n);
I=double(n);
dim=[5 50 100 260];
%dim=[260];
isRandom=0;
rearrange=0;
%dim=round(linspace(1,256,10));
%dim=[50 100 260];
% Initializing variables %
eigval=zeros(row,col,channel);
eigvec=zeros(row,col,channel);
... |
%
% Frame
% Import alpha_i, beta_i . row vector
% Output (d alphi/dx,d beta/dx)
function [InnerGP]=innerDPproductlocal(alpha,beta,n)
%% Parameter
h=1/n;
D=zeros(2*n,2*n);
for i = 1:n
D(2*i-1,2*i-1) = 1/h;
D(2*i-1,2*i) = -1/h;
D(2*i,2*i-1) = -1/h;
D(2*i,2*i) = 1/h;
end
... |
function [gMatrix, rInit, dTheory, lsCoff, ldCoff] = stp9CalcInitModel(angleTrNum, superTrNum, welllog, minOffset, maxOffset, dt)
% 这是一个计算初始模型的函数
% 得到采样点数
[sampNum, ~] = size(welllog);
% 读取基本测井数据
tDepth = welllog(:, 1);
tVs = welllog(:, 3);
tVp = welllog(:, 2);
tRho = welllog(:, 4);
%t... |
close all;
clear all;
[sig,fsd]=audioread('queen.wav'); % Reading music file with a noise
sig2=sig(:,1);
out = zeros(length(sig2),1);
B =ones(length(sig2),1);
A = ones(length(sig2),1);
order = 20;
for i = 21 : length(sig2)
for k =1:order
out(i) = out(i) + B(k)*sig2(i-k)-A(k)*out(i-k);
end
end
plot... |
clc; clear;
% a=zeros(1,10);
% a(3)=789;
% fprintf('%8d \n',a(3));
% disp(a); %muestra todo el contenido de la variable
% for i=1:10
% a(i)=i;
% end
% disp(a);
% for i=1:10
% fprintf('a(%d)= %2d \n',i,i);
% end
n=input('Digite el número: ');
divisor=1000;
dividendo=n;
a=zeros(1,4);
i=4;
whil... |
classdef Process < handle & matlab.mixin.Copyable & matlab.mixin.Heterogeneous
%UNTITLED11 Summary of this class goes here
% Detailed explanation goes here
properties
parent
graph % visualisation
end
methods
function impact = generateLCIA(obj,a... |
function [t] = TriggerHeat(temp,dur)
global THERMODE_PORT
code = 80 + (3*(dur-1)) + temp;
% calculate byte code
bytecode=fliplr(sprintf('%08.0f',str2double(dec2bin(code))))-'0';
% send trigger
putvalue(THERMODE_PORT.Line, bytecode);
t=GetSecs;
% flush buffer
WaitSecs(0.5);
putvalue (THERMODE_PORT.Line... |
x = linspace(0,1,5);
y = 1./(1+x);
p = polyfit(x,y,4);
x1 = linspace(0,2);
y1 = 1./(1+x1);
f1 = polyval(p,x1);
figure
plot(x,y,'o')
hold on
plot(x1,y1)
plot(x1,f1,'r--')
legend('y','y1','f1'); |
function [] = psmedian(r)
%PSMEDIAN Run the Median filter.
% PSMEDIAN runs the filter with the default arguments.
%
% PSMEDIAN(R) R for radius is in pixels ranging from 1 -> 100, default is
% 1.
%
% Example:
% psmedian
% psmedian(2)
%
% See also PSADDNOISE, PSAVERAGE, PSBLUR, PSBLURMORE, PSBOXBLUR,
% ... |
% Twoja uwaga jest wymagana przy komentarzach zaczynających się na "USER"
T1 = 1.66; %USER Stała czasowa wyznaczona z wykresów - ta mniejsza
T2 = 6.33; %USER Stała czasowa wyznaczona z wykresów - ta większa
skokQ = 3000; %USER różnica amplitudy skoku na wyjściu AQ0002
skokI = 4500; ... |
function draw_sph_grid(imgin,center,Ntheta,Nrad)
N=size(imgin);
% center=[151 151];
cutoff=0.003;
% Nbin=20;
% Nsector=20;
dist=sort([center(1) N(2)-center(1) center(2) N(1)-center(2)],'descend');
Rmax=dist(ceil(N(1)*cutoff));
flag1=max(cumprod(size(Nrad)));
if flag1==1
Rbins=map2colvec(0:Rmax/(Nrad-1):... |
%% fn_saveimg
%% Syntax
% fn_saveimg(a,fname,clip[,zoom[,cmap]])
%% Description
% a should be y-x-t
% clip can be a 2-values vector, or 'fit' [default], or '?SD', or 'none'
%% Source
% Thomas Deneux
%
% Copyright 2004-2012
%
|
% Add current folder and all subfolders to search path
addpath(genpath(fileparts(mfilename('fullpath')))); |
%
% File: prediction.m
% Author: awl8049
% Revision:$Revision: 1.4 $
%
% Prompt for the name of the CSV file containing the condensed data
% and then do a linear regression of the data.
%
benchmarks={'bzip2.csv' 'b'; ...
'cactusadm.csv' 'g'; ...
'gromac.csv' 'c'; ...
'h264ref.csv... |
%1. IMPORT DATA - ASSUME ITs CALLED 'plotIt' (CSV of X Y Z points)
%2. DEPENDS ON PLOTCUBE - http://www.mathworks.com/matlabcentral/fileexchange/15161-plotcube
% 0.10 M version
% fig = figure('Position', [100, 100, 1049, 895]);
% for n = 1:length(plotIt)
% plotcube([1 1 1], plotIt(n,:), .6, [0 0.5 plotIt(n,3)/16]... |
clc;
clear all;
close all;
maxepoch = 2000;
numhid = 500;
load usps;
batchdata = zeros(100, 256, 100);
batchtarget = zeros(100, 10, 100);
for i = 1 : 100
temp1 = permute(data(:,(i-1)*10+1:i*10,:),[2 1 3]);
temp2 = zeros(100, 256);
for j = 1 : 10
temp2((j-1)*10+1:j*10, :) = temp1(:,:,j)>127.5;
... |
function [phix,phiz] = phi_eval(theta,xi,z,Llx,eta1,K,s,cg,Om,om,k0,sig,ep)
Kvec = pi/Llx*[0:K -K+1:-1]';
Dx = 1i*Kvec;
KT = 2*K;
% Assume eta is in frequency space.
eta1p = ifft(eta1);
eta1sq = eta1p.^2;
eta1xp = ifft(Dx.*eta1);
meta1p = (abs(eta1p)).^2;
theta2 = theta... |
filename1 = 'face1.jpg';
color_face = imread(filename1);
Viola_Jones_img( color_face )
gray_face = rgb2gray(color_face); |
% Calculates an example cycle and performs most of the sizing calculation
% as in the sizing example hand out.
%
% Set up the workspace
tf_ex5 % Define engine cycle
tfan % Calculate cycle parameters
%tfsummary
% Define design parameters
size_init % Put design choices in here
% Note a few are embedded... |
clc;
clear all;
close all;
Input_Img = imread('D:\STUDY\DIP\img_lib\girl512.bmp');
[m,n] = size(Input_Img);
figure(1);
imshow(Input_Img);
title('Original Image');
Image_Double = im2double(Input_Img);
Img_DFT = fft2(Image_Double);
figure(2);
subplot(1,2,1);
imshow(Img_DFT);
title('Fourier Transform ... |
% $Id$
function Chunk = readriffchunk(fid)
% Chunk id and size
Chunk.id = deblank(fread(fid, [1 4], '*char'));
Chunk.size = fread(fid, 1, 'uint32');
Chunk.offset = ftell(fid);
% Appropriate reading function
switch Chunk.id
case {'RIFF' 'LIST'}
readfunc = str2func('readrifflist');
case {'chan' 'data' ... |
tic;
load('data');
x=reshape(A,size(A,1)*size(A,2),3);
[m,n]=size(x);
k=16;
while true
%随机u使u的每一行均不重复
u=x(randperm(m,k),:);
if size(unique(u,'row'),1)==size(u,1)
break;
end
end
loss1=0;
iteration=zeros(200,1);
it=0;
while true
c=zeros(m,1);
it=it+1;
disp(['Iteration:',num2str(it)]... |
%% Solves qs 3.10 for assignment 2
% Solve and compare the least square problem
function GramSchmidt()
end |
clear;
clc;
day1=input("Enter start day e.g 15: "); %%starting day
if day1>=1 && day1<=31
month1=input("Enter start month e.g 02: ");%%starting month
if month1>=1 && month1<=12
year1=input("Enter start year e.g. 2001:" );%%starting year
day2=input("Enter end day e.g 15: ");%%ending day
if da... |
% XXXXXXXXXXXXXXXXXXXXXXXXXXX htet_test_lateral_longitudinal_data_reconstruction_denfis XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
%
% Author : Htet
% Date : Sep 11, 2019
% Function : performs missing data reconstruction using lateral and longitudinal predictions
%
% Reconstruction process is done separately for ... |
function parentCloudBlobDirectory = getParent(obj)
% GETPARENT returns the parent directory of a CloudAppendBlob
% The parent is returned as a azure.storage.blob.CloudBlobDirectory.
% Copyright 2016 The MathWorks, Inc.
% Create a logger object
% logObj = Logger.getLogger();
parentCloudBlobDirectory = azure.storage.b... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Homework 6 MATLAB Script
% Author: Robert Loiacono
% Date: 02/21/20
% UID: 305106844
% Code for Problems 1 and 2
% Problem 1 models a Monte Carlo simulation to find when people in a group have
% birthdays in the same we... |
function [x findex_out] = mel_filterbank(input_spectrum, f_index, nfilter)
% this is the triangular function in a _clever_ way to do piecewise functions
% in matlab
% the triangular function middle and right and left boundaries
% the boundaries are relative to the middle
% e.g. f(x) will be 0 for (x-mid)<left
f_tr... |
n = 100000;
len = 10;
% usar max e min para fazer os ex a) b) e c)
min = 1;
max = 6;
% calcular rands
a = len*rand(1, n);
% calcular area
res = sum(a>min & a<max)/n |
[X,Y] = meshgrid(0:0.01:1,0:0.01:1);
a=[1/3,1/3,1/3]*0.001;
Z=zeros(length(X(1,:)),length(X(1,:)));
for i=1:length(X(1,:))
for j=1:length(X(1,:))
if X(i,j)+Y(i,j)<=1
Z(i,j)=drchpdf([X(i,j), Y(i,j)],a);
end
end
end
%v = [-3 -3];
surf(X,Y,Z) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.