text stringlengths 8 6.12M |
|---|
function [x,A,g] =gauss(A,b)
%Metoda e Eliminimit te Gauss-it
%Perdorim b meqenese A eshte matrice
%dhe mund te mos jete gjithmone katrore
n=length(b);
%vektori x i zgjidhjes, si fillim e caktojme me zero
%kujdesi qendron qe te jete vektor shtylle
g=eye(n);
% do te perdorim indekset: i-rreshta, j-shtylla
... |
%% Task 6 & 7:Time series prediction algorithem to predict future values of target value
%% Load data
load FREDData_Clean.mat
%% Extract variables for NARX network inputs
table_FREDDATA = timetable2table(FREDDATA);
array_FREDDATA = table2array(FREDDATA);
%ip_network - input time series.
ip_network = [array... |
function cart_driver
% Call the precomputed solutions to the time minimization problem for
% different methods (forward and backward euler) and different
% discretizations. Plot the positions and controls.
% Load file
file = 'BkWDn=40';
pit = load(file);
position = pit.position; dt = pit.dt; control = pit.control;
tim... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2012 Analog Devices, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http:/... |
function [emp_cdf, emp_pdf, pt] = Empirical_KernelParetoDist( data, numbins, varargin )
% Original distribution - heavy tails are underestimated here
[bincnt, binpos] = hist(data, numbins);
x = linspace( binpos(1), binpos(end) );
lt = 0.15;
ut = 0.85;
if nargin == 4
lt = varar... |
% Stimulus for vergence tracking with a moving frame and various options
% Set up for Block Design with 6 sec prestimulus and 10 cycles of 24 sec for a total duration of 224 sec
% Designed with 12 sec test and null periods for 3 sec TR
% Frame rate could be divided by 2 to 0.125 (line 13) if the computer is fast enoug... |
function [DT, hullFacets] = mt_plot3(par, H, DT, hullFacets)
nodes = getnodes(par);
atm.g = 9.80616; % Gravitational constant (m/s^2).
switch par.test
case 'galew'
zeta = mt_calc_zeta(par, H);
case 'tc5'
atm.gh0 = atm.g*5960; % Initial condition for the geopotential field (m^2/s^2).
zeta = ... |
%% Compute D1,D2,D3
function [D1,D2,D3] = computeD1D2D3_code(current,target,inputs,q_law_params)
% Declare q_law_params
Wa = q_law_params.weights(1);
Wf = q_law_params.weights(2);
Wg = q_law_params.weights(3);
Wh = q_law_params.weights(4);
Wk = q_law_params.weights(5);
na = q_law_params.scalingFunc_n;... |
clear;
clc;
load cnn_6
tic;
RGB = imread('faces/image_0124.jpg');
RGB = imresize(RGB,0.3);
gray = rgb2gray(RGB);
%gray = histeq(gray);
[I, Area] = colordetect(RGB);
% wid = size(RGB,2);
% len = size(RGB,1);
% Area = [1 1 wid len];
%Area = expandarea(I, Area);
region = [];
dim = 24;
zoom = 0.75;
for i = 1:size(Area,... |
function [f, g] = sgplvmObjectiveGradient(params, model)
% SGPLVMOBJECTIVEGRADIENT Wrapper function for SGPLVM objective and gradient.
% FORMAT
% DESC : returns the negative log likelihood and the gradients of
% the negative log likelihood for the given model and parameters
% ARG params : the parameters of the m... |
%% Step 1: Generate Potential AR Matrix
% The original yearly IVT matrix and the threshold (we use 98th percentile
% of monthly climatology and >50 kgm-1s-1 here) are needed before
% generating the monthly potential vIVT-based ARs.The user can modify
% the detection scheme by using different original data or thre... |
function [wing_ref_area, AR, thrust, MTOW, Cl_takeoff, weight_propulsion] = SizeAircraftNew(span_wing, wing_ref_area, num_wings, dens_lin_wing, weight_fuselage, weight_propulsion, sensorWeight, sensorContainerWeight, thrust_to_weight, RegConst, airfoil_Cl_max, delta_Cl, air_density, Takeoff_velocity, sensor)
%UNTITLED... |
%%
function drawPoseOnly()
refPath = 'E:/ArtShoe2_reconstruction/code/data';
resPath = 'E:/1611_foot_data/1_mobile';
reflists = [dir([refPath '/f*.txt']); dir([refPath '/m*.txt'])];
reslists = [dir([refPath '/f*.txt']); dir([refPath '/m*.txt'])];
num_file = length(reflists);
refParams = zeros(10... |
%% Ducting example
% Created by: Lee A. Harrison
% On: 6/18/2018
%
% Copyright (C) 2019 Artech House (artech@artechhouse.com)
% This file is part of Introduction to Radar Using Python and MATLAB
% and can not be copied and/or distributed without the express permission of Artech House.
clear, clc
% Refractivity gradie... |
function apStructure = aperiodicityRatioSigmoid(x,sourceStruture,sideMargin,exponent,displayOn)
% apStructure = aperiodicityRatioSigmoid(x,sourceStruture,sideMargin,exponent,displayOn)
% Aperiodicity extraction using dual clue
% Designed and coded by Hideki Kawahara
% 17/Oct./2008
% 05/Jan./2010 Logit model
... |
%% classifier using minimum distance, feature reduction by PCA
clear all
clc
% read the sample data
raw = xlsread('/Users/YiZheng/Desktop/Codes/texture_classification_b/texture_classification_b/part_b_new.xlsx');
sample = (reshape(raw,[25,192]))';
sum = zeros(4,2);
for rtime=1:1:20 % run the classifier 20 times to get ... |
function cost = compute_cost_pc(A, C)
cost = 0;
[NC,MC] = size(C);
[NA,MA] = size(A);
for i = 1 : NA
minDistance = norm(A(i,:) - C(1,:));
for j = 2 : NC
distance = norm(A(i,:) - C(j,:));
if(minDistance > distance)
minDistance = distance;
endif
endfor
cost = cost + minD... |
%Section 2.5
%Problem 6
%a b
fprintf('a)b)\n')
A=hilb(8);
invA=invhilb(8);
b=[1 -1 1 -1 1 -1 1 -1]';
k=cond(A);
fprintf('Condition number:\n')
disp(k)
x1=A\b;
x2=invA*b;
fprintf('\n using \\ | using inv\n')
disp([x1,x2])
fprintf('\nRelative error:\n')
disp(norm(x1-x2)/norm(x2))
r=b-A*x1;
fprintf('\nUppe... |
function [dev,kerr]=a_procbc(inputs,dev,torb)
global REF CONST
kerr=0;
if strcmp(torb,'top')
if strcmp(char(inputs.top.ip(3).set{1}),'ideal') || strcmp(char(inputs.top.ip(3).set{1}),'ohmic')
dev.bc.top.eq_bc='neutral';
dev.bc.top.neq_bc='ideal';
if inputs.top.ip(1).set(1) < inf || i... |
load('../../Data/Lab 3/ex3data1.mat');
% m = Number of examples
m = size(X, 1);
% Plot training data
figure;
plot(X, y, 'rx', 'MarkerSize', 10, 'LineWidth', 1.5);
xlabel('Change in water level (x)');
ylabel('Water flowing out of the dam (y)');
theta = [1 ; 1];
J = linearRegCostFunction([ones(m, 1) X], y, theta, 1);
f... |
function [r] = quatmult( q,p )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
r(1:3) = q(4)*p(1:3)+p(4)*q(1:3)+cross(q(1:3),p(1:3));
r(4) = q(4)*p(4)-dot(q(1:3),p(1:3));
end
|
%% loop over data
sampleDir=uigetdir;
cd(sampleDir)
folderDir=dir('*e*');
cellNo=1;
allSpots=[];
for c=1:length(folderDir)
cd(folderDir(c).name)
cellCoord=[];
%try
% look for files containging key words and load them in
trackFile=dir('*TRACKS*');
load(trackFile(1).name);
segFile=dir('*seg... |
function color_rgb = papaya_whip
color_rgb = {'color', [1.0, 0.93725, 0.83529]};
end |
clc
syms s t Y
%%%%%%%%%%%%%%%%%% dSolve Komutu ile Cozumu %%%%%%%%%
dsolve('D2y +3*Dy +2*y=24','Dy(0)=0','y(0)=10')
|
function [T] = rotFromQuat(quat)
%
% rotFromQuat makes a rotation vector out of a quaternion, for ease of use
% with symbolic vectors and not having to deal with matlab's built in quat
% functions which are a little opaque and not helpful if one is still
% learning
lam0 = quat(1);
lam1 = quat(2);
lam2 = quat(3);
lam3 ... |
function y=BFGS()
clc;
clear;
syms x_1 x_2 x_3 x_4 lam;
fun=(x_1-1)^2+(x_3-1)^2+100*(x_2-x_1^2)^2+100*(x_4-x_3^2)^2;
x0=[-1.2;1;-1.2;1];
x1=[0;0;0;0];
epsilon=0.000000001;
count=0;
h=eye(4);
g0=gra(fun,x0(1),x0(2),x0(3),x0(4));
s=-h*g0;
a=x0+lam*s;
f=subs(fun,[x_1,x_2,x_3,x_4],[a(1),a(2),a(3),a(4)]);
Mini=Gold(f,0,1,0... |
sigma = 16;
pic_noisy = im2double(imread('imgA.jpg'));
G = fspecial('gaussian',[3*ceil(sigma),3*ceil(sigma)],sigma);
pic_rec = conv2(pic_noisy,G);
imshow(pic_noisy,[]);
imshow(pic_rec,[]);
|
function TruncateToPeriod( tSignal, fInitialJulianDate, fFinalJulianDate )
%
% DEBUG
if( tSignal.bPrintDebugInformation )
%
fprintf('truncation to period of signal %s:\n', tSignal.strDescription);
fprintf('requested starting time: %s\n', Time.JulianDateToString( fInitialJulianDate ){1});
fprintf('requ... |
function stimulus = stim_creator_BCL(BCL, pulselength, totallength)
%**************************************************************************
% Returns n x 2 -matrix that contains time and stimuluscurrent.
% BCL is basic cycle length (ms), pulselength is length of pulse (ms),
% totallength is the total length of the ... |
% Visualise several figures of the false positives
load('/Users/nihaar/Documents/4yp/data/classification-mistakes/SVM-aligned_without-hnm/false_negatives_svm.mat','fn_mat');
[m,n] = size(fn_mat);
figure(); hold on
pause(10);
for i = 1:m
title('False Negatives')
img = reshape(fn_mat(i,:),[41,41]);
imagesc(im... |
function time = get_timestamp(JD)
% This algorithm is based on Vallado 4e algorithm 22, pp 202.
%
% Inputs
% - JD : a scalar absolute Julian Date
%
% Outputs
% - time : a (6,1) vector of [Y,M,D,h,m,s]
% Constants
JD_1900 = 2415019.5;
Lmonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
% Convert JD... |
function output = B_sm(A,m)
%this function generates the N-m rank matrix of Bsm for unmodeled
%coefficients
% input A=generated toeplitz matrix
% input m is the order of subspace
[p,q]=size(A);
output=A(:,m+1:q);
end
|
function y = filter(this, x)
%FILTER Frame-based processing function of LIQI02 EPD.
%
% SYNTAX
%
% y = obj.filter(x)
%
% DESCRIPTION
%
% Y = OBJ.FILTER(X) returns the end-point decisions of the segmented input
% signal X. The output Y is a row vector of boolean values, 1s for during-
% speech and 0s for off-speec... |
#Audio compression using discrete cosine transforms.
pkg load signal #To use dct, load this library.
[y,fs,nbits]=wavread('funky.wav');
% take the mono waveform
y1=y(:,1);
#sound(y1,fs)
N=512; %FFT size
L=length(y1); % length of sequence
M=100; %Number samples kept will be 2M+1
start = N/2 + 1-M;
end1 = N/2 + 1+M;
... |
function [u] = svdFac(svdInfo,k)
global predInd;
global Npred;
global U;
global S;
global V;
if (exist(svdInfo, 'file'))
if (isempty(U)||isempty(V)||isempty(S))
load(svdInfo);
end
else
msg = 'run svdStartup first!';
error(msg);
end
UTruc = U(:,1:k);
VTruc = V(:,1:k);
STruc = S(1:k,1:k);
UPre ... |
function fscvScan(src, event, c, hGui)
% If fscvScan running first time, initialize persistent vars
% Run cycling waveforms without output stim and plot data
% When capture requested this function is terminated and GUI button
% initializes startCapture function to run fscvCapture
persistent fscvData firstData fscvBuffe... |
% ============================================
% Author: Alex Chen
% email: alextpf@gmail.com
% 2014
% ============================================
function EDif = GetEnergyDifferenceForSwap( oldVertIdx, newVertIdx, verts )
Crep = 0.0001;
K = 0.01;
% Energy = E_dist + E_rep + E_spring
% = |Xi-phi(bi)|^2 + Crep... |
function [target_s] = FanalyseTarget(filename, minf0, nMIPs, t_begin, t_end, pm2command, handles)
if nargin < 7
handles = [];
end
DIR = ['/tmp/' mfilename datestr(now, 'dd-mm-yyyy_HH-MM-SS') '/'];
unix('rm -rf /tmp/FanalyseTarget*');
unix('rm -f log_FputDescInDBstruct*');
unix('rm -f /tmp/orchidee_tmp_sound_file... |
function TA = contract3RtoT(RAx, RAy, RAz)
%* RRAyz((yi,zi),(y,z)) = sum{xi}_(RAy(y,zi,xi)*RAz(z,xi,yi))
RRAyz = contractRy_Rz(RAy, RAz) ;
%* TA(x,y,z) = sum{yi,zi}_(RAx(x,yi,zi)*RRAyz((yi,zi),(y,z)))
TA = contractRx_RyRz(RAx, RRAyz) ;
% TA = reduceTA(TA) ;
% THA = contractRx_RyRz(RHAx, RRAyz) ;
% THA = reduce... |
function [T, ts,tpt_p]=tptest(x)
% [T, ts]=tptest(x,h) Turning Point Test
% T number turning points. ts test statistic, approx N(0,1) under null hypothesis
% Brockwell page 35
n=length(x);
d1=sign(diff(x));
d=d1(1:n-2).*d1(2:n-1);
T=sum(d==-1);
ts=(T-2*(n-2)/3)/sqrt((16*n-29)/90);
tpt_p = 2*min(1 - normcdf(ts, 0, 1), ... |
clear
clc
close all
%%
%This code package implements a potential field based attitude controller
%The controller is described in D. E. Koditschek, "Application of a new
%lyapunov function to gloabl adaptive attitude tracking" in Proceedings of
%the 27th Conference on Decision and Control Austin, Texas December, 1988
gl... |
function smg = loadsgs(dirr)
%% Load files
cwd = pwd;
cd(dirr)
files = dir('*.mat');
c = 1;
for i = 1:length(files)
temp = load(files(i).name);
tgraph = log10(full(temp.graph));% log10
if length(tgraph) < 70
files(i).name
continue;
end
tgraph = tgraph(1:70, 1:70);
tgraph(isinf(t... |
function [output_concentration] = Concentration_Transformation_3D_2(input_image)
distance_image=bwdist(input_image,'euclidean');
surface_image=distance_image==1;
n=0;
for m=1:size(surface_image,3)
for j=1:size(surface_image,2)
for i=1:size(surface_image,1)
if surface_image(i,j,m)==1
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Projective Oblique Structured illumination Microscopy processing
%
% -edge mirroring added
% -Unmixing at native resolution, then upsampling via zero
% ... |
% This file plots the data
clear all; close all
% load the data file
load monteData
montev2 = monte;
numTargets = length(monte(1).tarLength);
load monteData
montev21 = monte;
load monteData
montev22 = monte;
for i = 1:numTargets
for j = 1:42
ttime(j) = min([3500 montev2(j).tarLength(i).targe... |
function y=my_conv(u,v)
%n>>m
%discrete convolution
n=length(u);
m=length(v);
u_padd=[zeros(m-1,1);u;zeros(m-1,1)];
y=zeros(n,1);
for i=1:n
y(i)=sum(u_padd(i+m-1:i+m-1+m-1).*v(1:m));
y(i)=y(i)+sum(u_padd(i-1+m-1:-1:i).*v(2:m));
end
end |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Advanced Digital Signal Processing:
% Imaging and Image Processing
%
% Exercise 5: Problem 1
%
% Gibbs sampling from a multivariate Gaussian distribution
%
% author(s): Harsha, Dinesh, Beenish
% group: 10
Sigma = [1 0; 0 1];
%... |
% should work with windows as well (tested under Win98).
path(path, './demos');
path(path, './examples');
path(path, './routines');
path(path, './usfs');
|
% Plot CCNSim output data that has been loaded into
% the current MATLAB workspace.
% Run "ccnsimloaddata" before this script.
% For convenience, the generated plots are saved in a PDF file.
% set the folder name to be used at
foldername = pwd;
foldername = [foldername, '/'];
% % start data recording
% profile on
% ... |
function [net_input tot_input nclicks] = make_click_inputs35(t, leftbups, rightbups, clicks_L, clicks_R, NL, NR)
if nargin < 6,
NL = ones(size(leftbups));
NR = ones(size(rightbups));
end;
here_L = qfind(t, leftbups);
here_R = qfind(t, rightbups);
if nargout > 2,
nclicks = zeros(length(t),1);
for i = 1... |
function pa_bose_qc2_calibration(dname,fname,varargin)
% PA_BOSE_QC2_CALIBRATION2
%
% Determine calibration parameters of the Bose Quiet Comfort 2 headphones.
%
% See also AUDIOGRAM, PA_PLOT_BOSE_QC2_CALIBRATION
% 2013 Marc van Wanrooij
% Calibration performed by Michiel Dirkx, Maarten van de Kraan
%% Files... |
function [nodePot,edgePot] = producePotentials(X,edgeStruct,Mu,Sigma,probA)
% X: the vectorized image features; nPixels by p
% Mu: estimate for the means; p by nStates;
% Sigma: estimate for the standard deviations; p by nStates;
% probA: the estimated prob(y_i|a_i) vector
% create note and edge potentials
% probA =... |
%@(#) sumfilplot.m 1.1 01/10/09 15:12:52
%
%function sumfilplot(sumfil,starttid,sluttid)
function sumfilplot(sumfil,starttid,sluttid)
s=sum2mlab7(sumfil);
t1=dat2tim(starttid);
t2=dat2tim(sluttid);
man=['Jan';'Feb';'Mar';'Apr';'Maj';'Jun';'Jul';'Aug';'Sep';'Okt';'Nov';'Dec'];
ind=1;x=[];y=[];
for i=1:size(s,2)
... |
%% Reference
% https://en.wikipedia.org/wiki/Fourier_transform
%%
clear;
%% Generate FFT function handler
FFT = @(x) fftshift(fft2(ifftshift(x)));
IFFT = @(y) ifftshift(ifft2(fftshift(y)));
%% 4) 1D Convolution vs. Multiplication
N = 100;
M = 36;
X = randn(N, 1);
Y = randn(M, 1);
if (N > M)
K ... |
%% SYMQ-6: Sensitivity analysis, switches plot and random subject fit plotting
% change the truth id accordingly when analyzing different simulations
% -FTSC
%% loading clustering result
clear;
clc;
yvar = 'symq6';
YVAR_path = 'SYMQ6';
YVAR_plot = 'SYM-Q6';
%% K=1 Spaghetti Plot
k1_path = strcat('Y:\Users\Jial... |
function [Result, Reliability_Rate] = CheckingMatchingImg(lImage_1, lImage_2)
%% ==============================================================================
% Author: Ung Quang Huy
% This function checks correlation of two images using SIFT features
% and VLFeat Library (open source code).
... |
function g = sigmoid_gradient(z)
sig = sigmoid(z);
g = sig .* (1 - sig);
end
|
function ChoiceButton = EDMChoiceButton(controlPv, x, y, varargin)
% Defaults
FontSize = 12; % 8 10 12 14 18 24 72
FontWeight = 'bold'; % 'medium', 'bold'
FontName = 'helvetica'; % 'utopia', 'courier', 'new century schoolbook', 'times'
Orientation = 'horizontal'; % 'vertical'
indicatorPv = '';
... |
% close all;
% clear all;
% clc;
% Parameters
R1 = 1;
R2 = 2;
R3 = 10;
R4 = 0.1;
RO = 1000;
C1 = 0.25;
L1 = 0.2;
alpha = 100;
% V = [ V1; V2; V3; V4; V5; IL]
Vin=1;
G=zeros(6);
C=zeros(6);
%% V1
G(1,:)=[1 0 0 0 0 0]; % V1
C(1,:)=[0 0 0 0 0 0]; % V1
%% V2
G(2,:)=[(-1/R1) (1/R2+1/R1) 0 0 0 1];
C(2,:)=[-C1 +C1 0 0 0 ... |
function fn = Group_Action_by_Gamma_Coord_q(f,gamma)
[n,T] = size(f);
gam_dev = gradient(gamma, 1/T);
for j=1:n
fn(j,:) = interp1(linspace(0,1,T) , f(j,:),gamma,'linear').*sqrt(gam_dev);
end |
function K=autoK(I)
% 自动估计梯度阈值K函数
% 用robust_statistic自动估计梯度阈值
%Rerf.
%M. J. Black, G. Sapiro, D. H. Marimont and D. Hegger,“Robust Anisotropic Diffusion,” IEEE Trans. Image
%Processing, vol. 7, no. 3, pp. 421–432, Mar. 1998.
% I:input gray or color image
[row,col,nchannel]=size(I);
K=0;
if nchannel==1%g... |
includeColors;
% Prepare the figure
hfig = figure(1);
clf
axis equal
hold on
pointBuffer1 = [];
segmentBuffer1 = [];
% Prepare measured points
for i=1:8
pointBuffer1 = plotPoint(pointBuffer1, points(:, i), BLACK, 10);
text(points(1,i)+1, points(2,i)+1, sprintf("%d", i));
end
% Prepare line segmets of arena edge... |
% note that in the data files, the IT and V4 labels are swapped.
% so label accordingly
% load the files
% filename = 'C:/Users/Felicity/macaqueERP/data/epochedtemp.mat';
% errorfilename = 'C:/Users/Felicity/macaqueERP/data/errordata.mat';
filename = '/u/cliffk/drive/usyd/macaqueERP/data/epochedtemp.mat';
errorfilen... |
function rgb = ghost_white
rgb = [0.97254, 0.97254, 1.0];
end |
function points = getPoly(points)
% 返回多边形的标准形式
% 即points(1,:)需要与points(end,:)相同
% Author A.Star
% e-mail : chenxiaolong12315@163.com
% 2017-5-30
if sum(points(1,:) == points(end,:)) ~= 2%如果两点相等,返回(1,1)
points = [points;points(1,:)];
end
end |
function [test_data,test_labels] = read_uvad_test_data(path)
fid_test_real_canon = fopen(strcat(path,'positive/real-canon.txt'));
fid_test_real_panasonic = fopen(strcat(path,'positive/real-panasonic.txt'));
fid_test_real_nikon = fopen(strcat(path,'positive/real-nikon.txt'));
path_test_real_c... |
% AAE 561: Convex Optimization
% Main runner file
% Dietshce, Lee, Sudarsanan
clear all; close all;
N = 3; % Number of quadrotors
T = 100; % Sim duration
% Set Figure parameters
figure('Name','Conflict free trajectories for quadrotors')
hold on
grid on
xlabel('X [m]')
ylabel('Y [m]');
% Set start and end points ... |
function [ N, N_total, E_Thresh ] = loudness( E, fc, version, model )
%[ N, N_total ] = loudness( E, fc, version, model )
% Implemented as per ITU-R BS.1387-1 Section 3.3
global debug_var
if debug_var
disp(' Loudness')
end
if (strcmp(model, 'fft') || strcmp(model, 'FFT'))
const = 1.07664;
if(strcmp(version,... |
clearvars; close all; clc;
%% 1
lena = imread('lenaRGB.bmp');
figure(1);
imshow(lena);
lenaR = lena(:,:,1);
lenaG = lena(:,:,2);
lenaB = lena(:,:,3);
figure(2);
subplot(3,2,1);
imshow(lenaR);
title('Lena red');
subplot(3,2,2);
imhist(lenaR);
subplot(3,2,3);
imshow(lenaG);
title('Lena green');
subplot(3,2,4);
imhist... |
% 适用于附件1,,2分类
clear;load NET3;global s s_index S Img
Img = [];num = 209; % 碎片数目
for m = 0:num-1
Img(:,:,m+1) = imread(['附件3\',num2str(m,'%03d'),'.bmp']);% 导入所有图片
end
s_index = zeros(11,19);
s = int32(zeros(11*size(Img,1),19*size(Img,2)));
fist = zeros(4,num);
for m = 1:num
fist(1,m) = sum(sum(Img(1:25,:,m)));... |
function subMat = indToSubMat(size, ind)
dimCount = numel(size);
% convert indices to subscripts
subMat = cell(dimCount, 1);
[subMat{:}] = ind2sub(size, ind);
% build matrix
subMat = horzcat(subMat{:});
end
|
clear all
figure
hold on
%set parameter
simParam.pathLengthStep = 100;
simParam.initialCondition = [0;0;0;0];
simParam.finalCondition = [10;-6;0;0];
simParam.splineOrder = 3; %spline order
simParam.purturbH = 1e-5*ones( simParam.splineOrder + 1, 1) %k1,k2, ...,kn,sf
simParam.maxConvergenceCount = 200;
simParam.conve... |
seal = rms(seal_rms(:,2:4), 2);
seal_fs = rms(seal_fs_rms(:,2:4), 2);
base = rms(base_rms(:,2:4), 2);
base_fs = rms(base_fs_rms(:,2:4), 2);
troc = rms(troc_rms(:,2:4), 2);
x = [2,4,6,8,10,12,14,16,18];
figure
plot(x, troc, 'k-*')
hold on
%plot(x, base_fs, 'r-*')
%plot(x, seal_fs, 'b-*')
plot(x, base, 'r-*')
plot(x, se... |
testdiff = @(x,y)assert(abs(x - y)<10e-4);
approx = @(x,y)assert(abs((x - y)/y)<1e-3);
demand = {NestedLogitDemand, MixedLogitDemand};
for tc = 1:2
m = SimMarket(demand{tc});
m.model.ces = true;
% m.estDemand.settings.robust = 'false';
m.model.endog = false;
m.model.beta = [-4; 1; ... |
clear all; close all; clc
global pars; pars=struct;
pars.cini = 0;
pars.ckonec = 1;
pars.Deff = 5*10^(-2);
pars.u = 0;
r = linspace(0,1); [rr,rs] = size(r);
t = linspace(0,10); [tr,ts] = size(t);
m = 0;
sol = pdepe(m,@Fickfun,@icfun,@bcfun,r,t);
c = sol(:,:,1);
[nt,nr,nc] = size(sol);
figure(1)
for i=1... |
% Figure 3.27 Feedback Control of Dynamic Systems, 6e
% Franklin, Powell, Emami
% script to generate Fig. 3.27
clf;
% zeta = 0.3;
a1 = [1 2 4 10];
Mp1=[1.9 .9 .55 .35];
% zeta = 0.5;
a2 = [.5 1 2 4 10];
Mp2=[1.71 .7 .3 .19 .16];
% zeta = 0.7;
Mp3=[.76 .22 .07 .05 .04];
ax... |
function [Sp] = InceS(p, m, q, z)
% Odd Ince Polynomial S^m_p(q; z)
B=InceB(p, m, q);
n=size(B,1); s=2-mod(p,2); k=2*(0:n-1)+s;
if isreal(z)
B=padarray(B, max(0,5-length(B)), 'post');
BB=[zeros(1+s,1); B(end:-1:2)/2; zeros(s,1); -B(1); -B(2:end)/2];
plan=nfft(1,length(BB),numel(z));
plan.x=z(:)/pi;
... |
function [hVel,hAtt,hBias] = dopplerSensitivity(vel,svVel,clockDrift,A,gyroMeas,R_b_e,IMU_ARM,Omega_ie)
%
dx = 1e-8;
% velocity sensitivity
hVel = nan(3,1);
for idx = 1:3
veli = vel;
veli(idx) = vel(idx)+0.5*dx;
doppP = dopplerModel(veli,svVel,clockDrift,A,gyroMeas,R_b_e,IMU_ARM,Omega_ie);
... |
function Merkmale = harris_detektor(input_image, varargin)
%% Input parser
P = inputParser;
% die Groesse des Bildsegments
P.addOptional('segment_length', 15, @isnumeric);
% gewichtet zwischen Ecken- und Kantenprioritaet
P.addOptional('k', 0.05, @isnumeric);
% der Schwellenwert zur Detektion ein... |
syms x;
format long;
% Current example
f = cos(x);
nodes = [-pi/8, -pi/10, pi/10, pi/9];
interval = [-pi/8, pi/8];
obj = lagrange(f, interval, nodes); |
function [dataset] = extract_features(PSD, selected_freq_chan_index)
% [dataset] = extract_features(PSD, selected_freq_chan_index)
% The function returns the data extracted from the PSD with respect to the
% features given in input
%
% Input arguments:
% - PSD PSD matix [windows x frequences... |
%Metodo de Numerov.
clear all
clc
tol=0.0001; % Tolerancia.
dx=0.01; % Diferencial de x.
k=64; % Constante k=2ma^2Vo/h(barra)^2.
alfai=0; % Primer alfa=0.
L=0.5; % Anchura del pozo/2.
nx=L/dx; % Numero de puntos,discretizacion de x.
u=linspace(0,L,nx); % Vector discretizacion.
nE=2; % Numero de niveles de energi... |
clear; ca; clc;
%% Load images
p_range = [-25,25];
load(['..\..\MATLAB_largefiles\CNN_test_apply_peaks_3var_data_'...
num2str(p_range(1)) '_' num2str(p_range(2))]);
tr_pct = 0.7;
va_pct = 0.15;
te_pct = 0.15;
X = I;
Y = normalize([b_arr,r_arr,p_arr]);
n_fr = size(I,4);
n_fr_te = round(n_fr*te_pct);
n_fr_tr = r... |
function plot_gps_track_from_filenames(main_figure,Filename,disp,f_save)
%% open all files (GPS only)
if isempty(Filename)
return;
end
% status bar
show_status_bar(main_figure);
try
[new_layers,idx_empty] = create_gps_layers_from_db(Filename);
if ~isempty(Filename(idx_empty))
[new_layers_tmp... |
classdef (Sealed) MClust0 < handle
% Internal class for MClust
%
% There can only be one element of this class
properties
Settings = [];
Data = [];
MainWindow = [];
end
methods
function self = MClust0()
end
function de... |
function [inputCell, FrqLst] = FixTsSineStream(SmplTime, varargin)
% generate fixed sample time input sine stream
if ischar(SmplTime)
Ts = str2double(SmplTime);
if isnan(Ts)
Ts = evalin('base', SmplTime);
end
else
Ts = SmplTime;
end
p = inputParser;
defaultFrequency = [];
defaultAmplitude = 1e... |
function [b,d]=prob2berk(p)
%PROB2BERK convert probability to Berksons
%
% Inputs: P(M,N) matrix containing probability values
%
% Outputs: P(M,N) Corresponding Berkson values
% D(M,N) Corresponding derivatives dP/dB
%
% Berksons, or log-odds, are a nonlinear scale for measuring
... |
% Stabilité exponentielle du système thermoelastique
%--------------------------------------------------------------------------
%Created by: Salem Nafiri (FSSM - Faculty of Sciences Semlalia Marrakesh)
%Problem: 1d Thermoelastic Problem, Spectral method
%Method: Modal method
%Version date:05/04/2013
% \partial_t... |
function Solver = createSolverFactory(Options, Model)
% CREATESOLVERFACTORY Create a solver to optimize learnable parameters from
% gradients.
% Copyright 2019 The MathWorks, Inc.
switch class(Model)
case 'rl.representation.model.rlLayerModel'
% rewrite DLT internal solver for Layer API to track learn rat... |
% mu: 2x1 matrix
% Sigma: 2x2 matrix
% phi: a number
%%
mu0 = [0;0];
Sigma0 = [1,0;0,1];
mu1 = [1;1];
Sigma1 = [1,0;0,1];
phi = 0.5;
plot_ex1(mu0, Sigma0, mu1, Sigma1, phi, 'Line', 1);
mu0 = [0;0];
Sigma0 = [1,0;0,1];
mu1 = [1;1];
Sigma1 = [1,0;0,1];
phi = 0.9;
plot_ex1(mu0, Sigma0, mu1, Sigma1, phi, 'Line (one side... |
function [u, cumulength] = bspchordlparam(var1, var2, var3, var4)
% Parametrises a 2/3-D curve using the chord length method.
%
% -------------------------------------------------------------------------
% USE:
%
% O = bspchordlparam(D, S) calculates a set of parametrised coordinates,
% O, for a 2/3-D curve defin... |
clear
close all
clc
%% 4 Ways to initialize
% particle with default parameters
p1 = agent;
% particle with ode specified
mu = 1; k = 1;
dy_dt = @(t,y) [y(2); mu*(1-y(1)^2)*y(2)-k*y(1)];
p2 = agent(dy_dt);
% particle with ode & initial conditions specified
init = [2 3];
p3 = agent(dy_dt, init);
% particle with ode,... |
%% Conceptual PDM style hydrological model for testing
% simplified version of code - used for digital filter project
% runs catchment(s) and saves modelled output and a parameter-file
clc
clear all
close all
% load catchment(s)
stationname_vec = ["Barden_Lane","BELLEVER","BROAD_GREEN",...
"Whitebridge"... |
function [ outputImage, time_taken] = threshold_lab( inputImage)
%THRESHOLD_LAB Image thresholding.
%The function performs the multiband thresholding of an input image.
%The user can select either Loop-based method or Vectorization method to
%perform the threshold operation. Vectorization method involves vectorized... |
classdef Estimador < handle
%UNTITLED3 Summary of this class goes here
% Detailed explanation goes here
properties
a_world_t;
a_world_x;
a_world_y;
a_world_z;
a_real_t;
a_real_x;
a_real_y;
a_real_z;
q_t;
... |
% GRANAD Zawiera nast�puj�ce metody gradientowe:
% - najszybszego spadku (par=0)
% - Fletchera - Reevesa (par=1)
% - Polaka - Ribiere'a (par=2)
% - z pe�n� formu�� na wsp�czynnik beta (par=3).
% Oznaczenia: maxit - maksymalna liczba iteracji g�rnego poziomu
% x0 - aktualne... |
%% An example for the tool.
% Author: Xiaochen Qiu from Beihang Univ.
% Description: Show how to use the tool by an example of:
% Evaluate trajectory position RMSE for a monocular VIO
% on sequence V2_03_difficult from EuRoC dataset.
clc;
clear;
close all;
addpath('... |
% All commands that are
% needed are typed in the
% Ì-File. Everything written
% at the right of symbol %
% is a comment and is not
% taken into acount
t=-5:0.1:5;
f=t.*cos(2*pi*t);
plot(t,f);
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Ve... |
function imr = CS4640_register(ref,im,pts)
% CS4640_register - register an image to a reference
% On input:
% ref (M1xN1 array): reference image
% im (M2xN2 array): input image
% pts (nx4 array): corresponding pixels in the two images
% in order x_ref y_ref v_im w_im
% On output:
% imr (MxN array): ... |
function [xs,ys] = BorderRevised(RectPosition,im,EdgeWidth)
ys = RectPosition(2)-EdgeWidth:RectPosition(2)+RectPosition(4)+EdgeWidth;
xs = RectPosition(1)-EdgeWidth:RectPosition(1)+RectPosition(3)+EdgeWidth;
xs(xs < 1) = 1;
ys(ys < 1) = 1;
xs(xs > size(im,2)) = size(im,2);
ys(ys > size(im,1)) = size(im,1); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.