text stringlengths 8 6.12M |
|---|
function bcdof = BoundaryCondition(typeBC,coordinates)
%--------------------------------------------------------------------------
% Purpose:
% To determine the boundary conditions degree of freedom
% Synopsis:
% bcdof = BoundaryCondition(typeBC,coordinates)
%
% Variable Description:
... |
clear all
clc
x = (-pi):0.1:(pi);
size(x)
data = sin(x);
p = 9;
train_X = zeros(numel(x), p);
for j=1:p
train_X(:, j) = x.^j;
end
[n,m]= size(train_X);
lambda =[10^-3, 10^-2,10^-1,1,10,100,1000];
a=[0.1,0.5,1,2,10];
v = zeros(5,7) ;
for k=1:5
for s=1:7
S ='Lambda=';
disp(S);
disp(lambda... |
function y = Example2_06function(x);
global f1 T
y = 1;
j = sqrt(-1);
temp = exp(-2j*pi*x*f1);
y = y .* temp(:);
|
%Compute the Convolution data from input and convolution filter group
%input:
%p_x: the input data set, it should be like:
% say a input is 3 picture with 20 * 20 resolution (only one
% channel)
% the input should be 3 * 400 matrix
%p_f: the input filter group, it should be like:
% say w... |
function varargout = smoothie(varargin)
% smoothie applies moving average to GTX scans
% expects a structure as input. if no input, user can load from file or
% from base
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mf... |
function [bw] = kernelbw(xi)
%% Silverman bandwidth
N = length(xi);
prop = 1.0;
sig = std(xi);
iqrSig = 0.7413 * iqr(xi);
if (max(iqrSig) == 0)
iqrSig = sig;
end
bw = prop * min(sig, iqrSig) * N^(-1 / (4 + 1));
end |
function y = addRandNoise(x, a, varargin)
%ADDRANDNOISE Add a uniformly distributed noise to a quantity.
% ADDRANDNOISE(X,A) adds random noise with relative error A to X. More
% precisely, Y = X .* RANDINRANGE(1,1+2*A,SIZE(X)).
%
% See also: RAND, RANDINRANGE.
%============================================... |
function [id id2 nn]=invers_distancies(r,n)
% all pairwise:
% id inversed distancies
% id2 inversed distancies squared
% nn - normals
% nn(:,:,1) -x components
% nn(:,:,2) -y components
% drx=bsxfun(@minus,r(1,:)',r(1,:));
% dry=bsxfun(@minus,r(2,:)',r(2,:));
% permute(r,[2 1 3]) - transposed
dr=bsxfun(... |
function [ C, PhiM, wa, wb ] = Regu_calc_2D( G, wu, integ, MF )
s = tf('s');
ti = integ/wu;
Tf = 1/(integ*wu);
I = (1+ti*s)/(ti*s);
F = 1/(1+Tf*s);
[~, PHASE_IFU] = bode(G*I*F, wu);
PhiM = (MF - 180 - PHASE_IFU)/2;
a = (1+sin(PhiM*pi()/180))/(1-sin(PhiM*pi()/180));
wa = 1/(sqrt(... |
function [p_t, c_t, p, p_r, e] = spline_5_targets_random(A, W, T, num_target, R, num_robot, num_data, dt)
p_t = cell(1, num_target);
c_t = cell(1, num_target);
p_r = cell(1, num_robot);
p = cell(1, num_robot);
e = [];
future_frame = 5;
for i = 1:num_robot
p{i} = cell(1, num_... |
function [ x1, y ] = degilleme( x1, y1)
y = [];
for k=1:length(x1)
y(k)= 1 - y1(k);
end
end
|
sample_size =
tic
x1 = wavread('../songs/headhunterz.wav');
maxfreq = 4096;
bandlimits = [0 200 400 800 1600 3200];
short_length = length(x1);
maxfreq = sample_size/4.4;
start = floor(short_length/2 - sample_size/2)
stop = floor(short_length/2 + sample_size/2)
short_sample = x1(start:stop);
a = filterbank(short... |
function feaHeat3D(filename,varargin)
% feaHeat3D.m
% This is the main file that implement a tetrahedra
% element for solving transient heat transfer problems
%
% Author: Dr. Mario J. Juha
% Date: 11/09/2017
% Mechanical Engineering
% Universidad de La Sabana
% Chia - Colombia
%
% Clear variables from works... |
function [im] = readFaceImages(imdir)
imagesize = 256;
function [imo] = crop(im)
[x, y, ~, fig] = size(im);
if x~= imagesize
im = imresize(im, ceil(imagesize/x*100)/100);
end
[x, y, ~, fig] = size(im);
if y < imagesize
im = imresize(im, ... |
function [Out Headers]=loadCoregedNiftis(FNs,Xs,Ys,Zs)
[Out(:,:,:,1) Headers{1}]=loadniidata(FNs{1});
S=size(Out);
Partial=nargin>1;
n=length(FNs);
if(n>1)
Headers{n}=[];
end
if(Partial)
if(~exist('Xs','var'))
Xs=1:S(1);
else
if(isempty(Xs))
Xs=1:S(1);
end
end
if(... |
function output = acronym( input )
words_cell = textscan(input,'%s','delimiter',' ');
words = words_cell{ : };
letters = cellfun(@(x) textscan(x,'%c%*s'), words);
if(length(letters) > 3)
output = upper(letters(1:3)');
else
output = upper(letters');
end |
function varargout = conic_options(varargin)
%CONIC_OPTIONS Get all options for a plugin.
%
% {char} = CONIC_OPTIONS(char name)
%
%
%
%
[varargout{1:nargout}] = casadiMEX(794, varargin{:});
end
|
function [g, g1, g2, g3, g4] = alignment_cal_grad(B, S, D, M, A, C, lamda1, lamda2, lamda3)
J1 = C*A * ( -2*(M'-(atan(C*B'*A - C*0.5)/pi + 0.5)) ./ ( pi*(1+(C*B'*A - C*0.5).^2)) )' /numel(M) ;
g1 = -B'*S/(sum(B)^2)*sign(B) + S/(sum(B));
g2 = lamda1*J1;
g3 = lamda2*sign(B);
g4 = lamda3... |
function y=lab1wkole(n)
w_kole = 0;
for k=0:n
x = 2* rand() -1;
y = 2* rand() -1;
if (x^2 + y^2 <=1)
w_kole = w_kole +1;
end
end
y=w_kole/n;
end |
function out_label2=deblend_Wa(imlocal,imlocal_BW)
% This function is for deblending the touching or overlapping objects
% directly using the watershed method
%
% Input: imlocal = the local smoothed image (it is a local area including
% a object which needs to be checked and applied the deblending pro... |
function varargout = seqReaderPlugin( cmd, h, varargin )
% Plugin for seqIo and videoIO to allow reading of seq files.
%
% Do not call directly, use as plugin for seqIo or videoIO instead.
% The following is a list of commands available (srp=seqReaderPlugin):
% h = srp('open',h,fName) % Open a seq file for reading ... |
function fall_cyc=prov_fall(if_def_fall)
% PROV_FALL is a function of producing the duration of falling.
% If IF_DEF_FALL equals to 1, this function will directly produce the falling duration;
% otherwise, the function will firstly determine whether to provoke falling;
% if true, it then produces a random falling durat... |
clear all, close all
I = imread('moon.tif');
y = uint8(0:255);
plot(y); xlim([0 255]); ylim([0 255]);
Ia = y(255-I);
figure, subplot(1,2,1), imshow(I), title('Original');
subplot(1,2,2), imshow(Ia), title('Transformação'); |
uasKir_48A08AD_laneSpeed;
shiTS_48A08AD_laneSpeed;
DL_laneSpeed;
close all
f1 = figure('Color', 'w', 'units', 'normalized', 'position', [.2 .2 .8 .8])
fill_1 = fill([20.5 24.5 24.5 20.5], [0 0 100 100], [.9 .9 .9]);
hold on
fill_2 = fill([34.5 38.5 38.5 34.5], [0 0 100 100], [.9 .9 .9]);
noiseTerms = .2*randn(3);
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A Spatially Extended Model for Macroscopic Spike-Wave Discharges %
% Peter N. Taylor & Gerold Baier %
% peter.taylor@postgrad.manchester.ac.uk %
% J. Comp. Neurosci. 2011 ... |
%% Licking traces per condition
% Author: Unknown (adapted and commented by Nisheet)
% Dependencies: This script is sequentially placed after initializing the
% thresholds and running import_lick_detector.m, fetch_vars4cue.m
% It needs the variables masterMat.mat, produced by fetch_vars4cue, and
% top_thresh an... |
function I = convert_to_I(I)
%Get pixel representation of image because the input I can actually
%be one of: real image, string, function.
%Output will be a [M x N x 3] image matrix
%NOTE: convert_to_I should always load image
% if iscell(I)
% %if we are given a cell array
% return;
% end
%if we have a string,... |
function [obstacle,obstacleNumber] = DefineObstacle;
obstacleSize=100;%22;
dx = 12;%6;
%dx = 10;
%dx = 15;
dy=14;
dy=6;
%dy=10;
dy=12;
num = 1;
obstacle(num).corner = [0;2];
obstacle(num).size = [-obstacleSize;obstacleSize];
num = 2;
obstacle(num).corner = [0+dx;2];
obstacle(num).size = [obstacleSize;obstacleSiz... |
for i = 1:500000
if length(unique(factor(i))) == 4 && length(unique(factor(i+1))) == 4 ...
&& length(unique(factor(i+2))) == 4 && length(unique(factor(i+3))) == 4
disp(i)
break
end
end
|
function [h,alldata] = edfread_fast(fn, channels)
tic
h = edfread(fn);
if nargout > 1
fid = fopen(fn, 'r');
fseek(fid, h.bytes, -1);
total_bytes = h.records * sum(h.samples) * 2;
alldata = fread(fid, [total_bytes 1], 'int16=>int16');
fclose(fid);
alldata = double(alldata... |
function [F,V]=polyExtrude(Vc,cPar)
%% COMPUTER CURVE LENGTH
D=max(pathLength(Vc)); %Computer curve length for point sampling
numPoints=size(Vc,1);
%% PARSE cPar
%Check what mode
if isfield(cPar,'pointSpacing') && isfield(cPar,'numSteps')
error('Either specify pointSpacing or numSteps, not both.');
... |
function object=replace(object,index,region)
% handle input
assert(nargin==3,'ERROR: no index specified');
verifyIndex(object,index);
% replace bound
test=strcmp(...
class(object.BoundArray{index}),class(region));
assert(test,'ERROR: incompatible region type');
object.BoundArray{index}=region;
end |
clear;
d = 3;
noise_ratio_list = 0.01:0.03:0.15;
sample_size_list = [200000];
num_sample = sample_size_list(1);
num_trail = 50;
%num_phi = 3;
num_sample_test = 5000;
cohe_list = [2];
run_DICA = 1;
run_DHsu = 1;
run_FICA = 1;
run_FPCA = 1;
error_DICA = zeros(length(cohe_list),length(noise_ratio_list),num_trail,4);
err... |
values = [0.7];
q1s = [0.1]
colors = ['c','b','m'];
ilosc = 1;
for z=1:length(q1s)
figure
for i=1:length(values)
H = values(i);
B=[];
T=10;
n=1000; % grid points
r=nan(n+1,1);
t=linspace(0,T,n+1);
r(1) = 1;
for k=1:n
r(k... |
%% Soliton amplitude relation
%% m is mean of conduit, a is m-total soliton amplitude
csoli = @(a,m) m./a.^2 .* ( (a+m).^2 .* (2*log(1+a./m)-1) + m.^2);
trans_coeff = @(c,m) c .* (c + 2*m) / m;
m_minus = 1;
m_plus = 1.75;
a = 0.05:0.05:7;
aDSW = [6.2 7.0];
qi = [];
for ii = 1:length(aDSW)
qi(ii) = find(abs(a-a... |
function Opathto=Popularity(path,file,noOfColor)
filem=[path,file];
Image = imread(filem);
Image=rgb2gray(Image);
[height width]=size(Image);
[count,x] = imhist(Image); %histogram cıkarmak için
%figure(1);
%imshow(Image);
[count1,Indx]=sort(count,1,'descend');
x1=cat(1,x(Indx(:,1),1));
N=noOfColor;
quantize=zeros(N,1... |
function [optimustheta, M] = thetaestimator(x, cantDec)
%Con cantDec = 2 pasa a tardar +40 segundos, pero es mucho más preciso.
cantElem = 10^cantDec - 1; %Cantidad de elementos por cada lado
sizeOfArr = size(x);
errorTable = zeros(1,sizeOfArr(2)); % Creo un arreglo del tamaño del vector X. Con... |
function c = speedOfLight(f, wavelengths)
%weeklyAverage
% this function takes as input the frequency and a vector of
% measured wavelengths. The function must compute the speed of light
% for each wavelength according to the formula above,
% and return the average of the computed values..
%
% USAGE:
% ... |
%DJ Hinton
%File created September 12, 2017
%IE1070 T, Th 9:30-10:50
%Dr. K
%Project Assignment 1
%The purpose of this file is to display knowledge of
%the relative frequency definition by simulating coin tosses
clear
clc
%variable initation
x = [0,1,2,3,4,5,6,7,8,9,10];
y = [];
for (i = 1:1:11)
y[i] = exp(-.... |
% D2 = D4_mat(obj, obj2, trian_par)
% D2 = <w_m,f_n> scalar producs of testing RWG (original mesh) with basis RWG (refined mesh)
% Integration on testing functions: 3 Gauss points (on the smaller triangle -> refined mesh)
%
% w_m = RWG, f_n = RWG_refined
%
% Input:
% obj = original testing mesh
% obj2 ... |
function [] = panorama( )
img1 = imread('E:\1_computer_vesion\New folder\FB_IMG_1555320961694.jpg');
img2 = imread('E:\1_computer_vesion\New folder\FB_IMG_1555320968941.jpg');
subplot(2,2,1)
imshow(img1)
subplot(2,2,2)
imshow(img2)
gimg1 = rgb2gray(img1);
gimg2 = rgb2gray(img2);
p1 = detectSURFFeatures(gim... |
I=load('D:/University/SOC2017/LuaCode/lena.txt');
% I=load('lena.txt');
[m,n]=size(I);
o_I=zeros(m,n);
for i=1:m
o_I(i,:)=I(m+1-i,:);
end
g=uint8(o_I);
figure
imshow(I,[])
% imwrite(g,'harris.jpg','jpg')
% c=detectHarrisFeatures(o_I); |
N=10;
s = rand(1,N)
L = fliplr(s);
s=[L(1:end-1),s];
s=s/sum(s);
n=10;
T=s;
for i=1:10
T=conv(s,T);
a = floor(size(T,2)/2);
plot(-a:a,T,'DisplayName',num2str(i));
hold on;
end
legend show |
function egeth5dset(fnm, varnm, varargin)
%%
%% @author M.Moriche %
%% @brief Function to get dataset $varnm from a file saved with HDF5 lib %
%% @date 13-03-2019 by M.Moriche \n %
%% Created from geth5dset ... |
%FIleName: WidebandNarrowbandARMA.m
%
%试用经典谱估计及其改进方法,由数据出发估计信号
%的功率谱,通过仿真评估其性能
clear;
%% Experiment Parameters Settings
SampleNum=20000; %设定信号采样点数
WidebandCoeffA=[1,-1.3817,1.5632,-0.8843,0.4096];
WidebandCoeffB=[1,0.3544,0.3508,0.1736,0.2401];
NarrowbandCoeffA=[1,-1.6408,2.2044,-1.4808,0.8145];
NarrowbandCoef... |
function UFlickerObj_xxF(varargin)
% if you want to change a parameter from its default value you have to
% type 'paramToChange', newValue, ...
% List of possible params is:
% objContrast, objJitterPeriod, objSeed, stimSize, objSizeH, objSizeV,
% objCenterXY, backContrast, backReverseFreq, presentat... |
% 学习进行数学运算,并输出运算结果
% [初等数学](https://ww2.mathworks.cn/help/matlab/elementary-math.html)
%% [算术运算](https://ww2.mathworks.cn/help/matlab/arithmetic.html)
disp("加法:1 + 1 = ")
% 直接打变量名和直接赋值也可直接打印变量,而无需disp()
a = 1 + 1
% 想同时打印多个变量的话,要把它们丢进一个矩阵里
% 比如
X = ["加法:1 + 1 = ", 1 + 1]
X
% 亦或
["另一个加法:2 + 3 = ", 2 + 3]
% 当然,不赋给变量的习... |
function [dd, ons]=fix_mmn_triggers(fname)
% Function to fix the MMN trigger bug introduced with the Elekta Triux
% scanner upgrade. It reads the triggers from the channel, removes inserted
% triggers, corrects the value of the incorrect triggers.
% dd : corrected time series of the trigger values
% ons : onset of ea... |
%% load and analyse CAMELS data
file1 = strcat("C:\Users\sg16200\Local Documents\Camels\camels_attributes_v2.0\camels_attributes_v2.0\camels_hydro_NaN.txt");
%gauge_id;q_mean;runoff_ratio;slope_fdc;baseflow_index;stream_elas;q5;q95;high_q_freq;high_q_dur;low_q_freq;low_q_dur;zero_q_freq;hfd_mean
fileID1 = fopen(fi... |
function key = regexpescape(key) %<<<1
% Translate all special characters (e.g., '$', '.', '?', '[') in
% key so that they are treated as literal characters when used
% in the regexp and regexprep functions. The translation inserts
% an escape character ('\') before each special characte... |
clc
clear all
warning off all
[ result,svmmodel ] = FirstTrunk( );
[m,n] = size(result);
result_total = zeros(m,n,99);
result_total(:,:,1) = result;
svmmodelold = cell(10,1);
svmmodelold{1}.model = svmmodel;
threshold = 10;
numcurr = 1;
%op = qvt ; op = over; op = aver
op = 'over';
... |
function [lat, lon] = groundTrack(sa, ecc, inc, raan, argp, ta, t)
%computes the ground track of a satellite in an orbit around the
%Earth while accounting for nodal precession. Semi-major axis and
%incliantion are fixed.
%INPUT (vector of values for each parameter)
% sa: semi-major axis[m]
% ecc: eccentricity
% ... |
function [Matches,UnmatchedDetections,UnmatchedTrackers,IOUMatrix]=AssociateDetectionToTrackers(Detections,Trackers,IouThreshold)
if (isempty(Trackers))
Matches= int8.empty(0,2);
UnmatchedDetections= 1:length(Detections);
UnmatchedTrackers=int8.empty(0,4);
IOUMatrix=NaN;
return;
end
... |
function [J, grad] = lrCostFunction(theta, X, y, lambda)
m = length(y); % number of training examples
J = 0;
grad = zeros(size(theta));
J = (1/m) .* sum( -y .* log(sigmoid(X * theta)) - (1 .- y) .* log(1 .- sigmoid(X * theta))) .+ (lambda/(2 * m)) .* sum( theta(2: size(theta,1),1).^ 2)
grad = (1/m) * transpose(... |
function output_struct=dropouts_detection(trans_obj,varargin)
p = inputParser;
addRequired(p,'trans_obj',@(obj) isa(obj,'transceiver_cl'));
addParameter(p,'thr_sv',-70,@isnumeric);
addParameter(p,'thr_sv_max',-35,@isnumeric);
addParameter(p,'gate_dB',3,@isnumeric);
addParameter(p,'r_max',Inf,@isnumeric);
addParamete... |
function [E] = vnlset1(m)
% Variational Nonlinear Schrodinger Equation
% Tensor-preconditioner Krylov-Newton
%% Spectral element setup
L=10;
lam=0.5;
bess=@(r) -0*(besselj(1,1*r)).^2;
R=L/(2);
mm=m;
[Dz,z]=legD(mm);
[zq,wq]=gauleg(-1,1,2*mm);
J=legC(z,zq);
D=J*Dz;
z=z+1;
zq=zq+1;
rq=abs(R*zq);
H0=(1/R)*(D'*diag(wq.*... |
function [y0, ind4interp] = interpfast(x, y, x0)
% [y0, ind4interp] = INTERPFAST(x, y, x0)
%
% inputs
% - x: independent variable associated with the rows of y.
% - y: variable to interpolate.
% - x0: 1 value in the x-dimension.
%
% outputs
% - yinterp: vector of y interpolated on x0.
% ... |
function varargout = getleafpaths(s)
if ~isstruct(s)
varargout{1} = [];
return
end
treepaths = {};
fs = fieldnames(s);
for i = 1 : length(fs)
% Parse fields in their original order
child = s.( fs{i} );
if isstruct(child)
% It has children - not... |
% FILE: Ex3.m
% NAME: LUKE JIANG
% DESCRIPTION: Amplitude Demodulation
clear all; close all;
load Ex3.mat;
% Fs, t, y
% construct output z
z = y .* cos(500 * t);
% fourier transformation
N = 8192;
z_abs = abs(fftshift(fft(z, N)));
% compute w vector
w_period = 2 * pi * Fs / N;
w = (-N / 2:(N / 2)-1) * w_p... |
%%%%%%%%%% ELEMENT STIFFNESS MATRIX %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DLSIMP local stiffness matrix
function [KG]=Gen_GK_func_r3(nelx,nely,nelz,x,penal,E,E_min,DLTOP_ratio,I_mat,elem_type)
%E = 210*10^9; % Elastic modulus, Pa, (210 GPa)
%E_min= 10^(-3); % elastic modulus minimum, Pa,
% nelx_d=nelx*D... |
%PLL Example 1
%complex exponential PLL
clear;
%PLL parameters
f0 = 50; %exponential signal frequency (Hz): e^(j*2*pi*f0*t)
fs = 500; T=1/fs; %sampling frequency
Bn = 25; %noise Bandwidth(Hz)
kp = 1; %phase gain
k0 = 1; %VCO gain
dseta = 1; %damping factor
%signal p... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Lab 2 Task 1.3 %
% DCT - based Image Compression %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Step 3.5
... |
% clc;
% D = 3;
%
% c2 = 0.5 * rand(D ,1);
% p = rand(D, 1);
% alpha = rand;
% beta = 1 - alpha;
% c1a = 0.5 * rand(D ,1);
% c1b = 0.5 * rand(D, 1);
function [f, gradients] = jacobian_arap_segment_attachment(p, c1, c2, gradients)
D = length(p);
dp = zeros(D, D);
for var = 1:length(gradients)
dc1 = gradient... |
%This is the main script for the generation of a new duplex.
%It requires as INPUT, Z,T01, T10, T11, D01b, D10a, D11a, D11b, matrices
%that are the results of "code_entropy_duplex.m"
% P00, P01, P10, P11 are matrices that encode the multilink probabilities,
% for each link
%they are transformed in vectors e joined... |
function [ h_1 ] = determinationOfTransmittingAntennaHeight_h1( h_eff, h_a, d )
%% Determine h1 based on § 3 of Annex 5 of ITU-R P. 1546-4
if h_eff == 0
h_1 = h_a;
else
if d <= 3
h_1 = h_a;
elseif d > 3 && d < 15
h_1 = h_a + (h_eff - h_a)*(d-3)/12;
else
h_1 = h_eff;
... |
% Import the Layers
clc,clear;
netfile = 'huv27.h5';
classNames = {'0','1'};
% network = importKerasNetwork(netfile,'OutputLayerType','pixelclassification','ImageInputSize',[256,256]);
network = importKerasNetwork(netfile);
% figure
% plot(network);
% title(unet_pp)
data=importdata('defectnetinput.csv'); %... |
function [pred, TestTime, TestEVA] = rank_elm_predict(model, Xt, Yt, qids)
% load rank_elm_model.mat;
InputWeight = model.InputWeight;
BiasofHiddenNeurons = model.BiasofHiddenNeurons;
OutputWeight = model.OutputWeight;
ActivationFunction = model.ActivationFunction;
%%%%%%%%%%% Calculat... |
function [] = coherentMotionAnalysis_2P_CC(data,Stimdat,plot_flag)
%% For analysis of coherent motion data from 2P
% Changelog Updated 09Jul2019 KS, cleaned up pretty significantly
% Updated 11Jul2019 KS, added code to use a single lag correction
% Updated 15Jul2019 KS, pref_dir calculated via CC i... |
%
%ll1 = dir('/Users/Lidija/Documents/MATLAB/SoilMoisture/abi/*.csv');
%ll2 = dir('/Users/Lidija/Documents/MATLAB/SoilMoisture/cpc/*.csv');
cc = csvread('/Users/Lidija/Documents/MATLAB/SoilMoisture/cpc/20180401_cpc.csv');
aair16z = csvread('/Users/Lidija/Documents/MATLAB/SoilMoisture/abi/20180401_ir_16z_abi.csv');
... |
function [] = PlotInfos(dataset,Ningreds,saveflag,titleflag,culture)
% Plots statistics related to entropies and informations over Ningreds for
% dataset
%
% Written by: DJ Strouse
% Last updated: Nov 18, 2013 by DJ Strouse
%
% INPUTS
% dataset [=] string in {'standard','meats','spices','cultures'}
% Ningreds [=] vecto... |
function dx = rhs(t,x,Theta_0_ht,m,u)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
g=x(1:3);
p_wh=x(4:6);
p_ww=x(7:9);
PIK=x(10:13);
Q=x(14);
% angular velocity
wh=Theta_0_ht^-1*(p_wh-p_ww);
% control
% Cubli dynamis:
dot_g=-cross(wh,g);
dot_pwh=-cross(wh,p_wh)+cross(m,g);
dot_pww... |
clc
clear all
close all
tic
javaaddpath('/Users/hroarty/Documents/MATLAB/HJR_Scripts/radial_database/mysql-connector-java-5.1.6-bin.jar');
%% Declare time for multi year plots
% year.num=2012:2014;
% year.str=num2str(year.num);
% t1 = [year.str(1:4) '-1-1 00:00:00'];
% t2 = [year.str(end-4:end) '-12-31 00:00:00'];... |
%% Clear everything
clear all;
close all;
clc;
start = 11;
runmean_length = 10;
%% Read data from files
temp_fid = fopen('TEMP.txt');
temp = fscanf(temp_fid,'%d\t%d',[2 inf])';
fclose(temp_fid);
for i=1:length(temp)
temp(i,2) = temp(i,2)/1000;
end
temp2_fid = fopen('TEMP2.txt');
temp2 = fscanf(tem... |
clc; clear;
data = [[1 0];
[0 0];
[0 1];
[1 1]];
output = [0; 1; 0; 1];
nlevel = 2;
nneuron = [2, 1];
study_rate = 0.9;
threshold = 0.05;
max_iter = 5000;
W = neural_network_train(data, output, nlevel, nneuron, study_rate, ...
threshold, max_iter);
accuracy = neural_network_test(data, outp... |
function str = Vec2Str(x)
% 2018-06-12
% ベクトルをタブ区切り文字列に
str = sprintf('%f',x(1));
for i = 2:length(x)
str = strcat(str, sprintf('\t%f',x(i)));
end
end |
function y=lincols(d1,d2,n)
%LINCOLS Linearly spaced column vectors.
% LINCOLS(x1, x2, N) generates a matrix with
% equally spaced points between starting vector x1
% and ending vector x2.
%
% E.g:
% LINCOLS(([0 10 20],[6 20 50],3))
%
% generates:
%
% 0 10 20
% 3 15 35
% 6 20 40
%
... |
%%%%%%%%%%%%%%%% ACCUMULATE MOTION DM %%%%%%%%%%%%%%%%
% append relevant motion measures to the motionA measure
% Inputs:
% motionA - accumulated motion data
% parameters - this movie's parameters
% accumParems - parameters for accumulation of data across movies
% shape - this movie's data
functi... |
function Out=GetParameterFromSiemensMrProt(Prot,str)
% Prot=char(Infos.A1_3_12_2_1107_5_2_19_45773_2014112512282752183025365_0_0_0.Private_0029_1020');
Out=-778;
I=strfind(Prot,str);
if(isempty(I)) return; end
tmp=regexp(Prot(I(1):I(1)+200),'=\W*(\d*)\W*','tokens');
Out=str2num(tmp{1}{1}); |
function [xm,fv] = SAPSO(fitness,N,c1,c2,wmax,wmin,M,D)
format long;
%------初始化种群的个体------------
for i=1:N
for j=1:D
x(i,j)=randn; %随机初始化位置
v(i,j)=randn; %随机初始化速度
end
end
%------先计算各个粒子的适应度----------------------
for i=1:N
p(i)=fitness(x(i,:));
y(i,:)=x(i,:);
end
pg=x(N,:); ... |
function varargout = integrator_out(varargin)
%INTEGRATOR_OUT Get output scheme name by index.
%
% {char} = INTEGRATOR_OUT()
% char = INTEGRATOR_OUT(int ind)
%
%
%
%
%.......
%
%::
%
% INTEGRATOR_OUT()
%
%
%
%Get integrator output scheme of integrat... |
% this scripts solves the qp at pixel level...meaning the constraints
% defined on superpixel has number of pixels instead of 0/1 superpixel
% vector
% List of variables needed for this script, which are computed
% somewhere else:
% 1. im_supPix_var_cell calculated in computematrixforConvQuadOptim.m
% it gives for ... |
%% -- ALGORITHM 5 -- %%
% This function determines the number of fingers that appear on an image from a binary image %
function [ Num_fingers ] = algo5( Bin_Mask)
% - DECLARATION OF VARIABLES - %
[Z,T] = size(Bin_Mask);
Thresh1_Limiter = 0.69;
Thresh2_Limiter = 0.89;
Thresh1_dist = 0.24;
Thr... |
clear all;
P = [-3 -2 -2 0 0 0 0 2 2 3; 0 1 -1 2 1 -1 -2 1 -1 0]; %样本数据
Tc = [1 1 1 2 2 2 2 1 1 1]; %目标数据
T = ind2vec(Tc);
targets = full(T) %用满矩阵表示
net = newlvq(P,4,[.6 .4]); ... |
function [I,X1,X2,Y1,Y2]=mygeod2(X1,X2)
%input: two curves X1 and X2 as 2xn or 3xn (2D vs. 3D curve)
%output: dist=distance, also will display when you run the program; X2n:
%optimally registered curve X2; q2n: same as X2n except in q-fun form; X1n:
%normalized curve X1;
% Find optimal reparameterization?
rep... |
function fh = figureExpMultNatureFrequencyBar(dataCombineStructCells,natureFre,varargin)
%绘制实验数据的压力波倍频对比棒图
pp = varargin;
errorType = 'ci';%绘制误差带的模式,std:mean+-sd,ci为95%置信区间,minmax为最大最小
rang = 1:13;
legendLabels = {};
baseField = 'rawData';
figureHeight = 6;
%natureFre = 1;%0.5绘制半倍频
%允许特殊的把地一个varargin作为legend
if 0 ~= mo... |
function result = AVG_calc(data, window_size)
if window_size > 0
col_count = size(data, 2);
result = zeros(size(data));
padded_data = [zeros(window_size - 1, col_count) ; data];
data_window = zeros(window_size, col_count);
for i = window_size : length(padded_data)
data_window(:, :) = pa... |
function [mag, theta] = gradientMagnitude(im, sigma)
%This function should take an RGB image as input,
% smooth the image with Gaussian std=sigma,
% compute the x and y gradient values of the smoothed image,
% and output image maps of the gradient magnitude and orientation at each pixel.
fsize = ceil(8*sigma);
g_fi... |
%% Quantifica??o da oportunidade de transmiss?o dispon?vel considerando a utiliza??o do canal por parte de 2 utilizadores licenciados, PU1 e PU2
clear all;
close all;
%% SU 1
T_PU_ON_1 = 1e3; % # tramas PU 1
T_PU_1 = T_PU_ON_1*2;
mu_on_1 = 5; % tempo medio ON PU... |
function [ meanVal,stdVal,maxVal,minVal,muci,sigmaci ] = constExpVesselPressrePlus(rpm)
%获取缓冲罐的脉动压力均值
dataPat = getPureVesselCombineDataPath(rpm);
st = loadExpCombineDataStrcut(dataPat);
[ meanVal,stdVal,maxVal,minVal,muci,sigmaci ] = getExpCombineReadedPlusData(st);
end
|
function O=suavizado_spline(G,N,p0,lambda)
x=1:N;
pv(1)=p0;
w(1)=1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for k=1:N
for i=2:N
pv(i)=lambda(k,i)/(1-p0);
w(i)=1;
end
y=G(k,1:N);
pp = csaps(x,y,pv,[],w);
v_fila(k,:) = fnval(pp,x);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for k=1:N
for i... |
function [ubd]=gcl(x,y)
% Condition limite sur le bord du domaine
ubd=ones(size(x)); %matrice nb_noeud_bord*1
end
|
% This function randomly generates trees in rows. The presence of trees
% would change the occupancy value of the bitmap to True. The rows are
% aligned North-South.
%
% The trunk diameter and the number of trees are varied randomly.
%
% Apart from trees, specks of grass are introduced within the nursery (or
% arena). ... |
function h = violins(X, varargin)
% plot distributions in violin plot
%
% Arguments:
% X - NxD matrix or a D-lengthed cell array with data in each entry.
%
% name/value arguments:
% x - D positions along x axis for violin centers.
% clrs - Dx3 colors.
% maxbins - number of bins per violin. optional
% vwidth - vio... |
%SCRIPT to compute the statistical relation between continuous forcing of
%rough seas and the discrete disturbance used in partial control
global H chi
phiRes = 5;
pPhiRes = 5;
[phiMesh, pPhiMesh] = meshgrid(linspace(-0.88,0.88,phiRes)', ...
linspace(-0.52,0.52,pPhiRes)');
% phiMesh = -0.26;
% pPhiMesh = -0.44;
... |
vid = videoinput('winvideo', 2, 'MJPG_1024x576');
%src.Brightness = -64;
%preview(vid);
src = getselectedsource(vid);
vid.ROIPosition = [287 3 563 555];
%vid.ROIPosition = [259 7 569 564];
src.Brightness = 54;
src.Contrast = 42;
src.Exposure = -5;
src.Gain = 107;
src.Saturation = 82:
tv = vision.VideoPlaye... |
function [] = PlotWelch( welch3D )
%PLOTWELCH plots welch frequency power density
% well well well
for i = 1:size(welch3D,3)
figure;
plot(10*log(welch3D(:,:,i)));
end
end
|
dat_dry=importdata('datos/Inf_dry_2006.txt','\t',1);
dat_rain=importdata('datos/Inf_rain_2006.txt','\t',1);
dat_strm=importdata('datos/Inf_strm_2006.txt','\t',1);
%Append data
aaa=dat_dry.data;
aaa_=dat_strm.data;
aaa_(:,1)=aaa_(:,1)+aaa(end,1);
Qi=[aaa;aaa_];
figure, plot(Qi(:,1),Qi(:,15))
ylabel('flow rate [m^3d^... |
% Plot a 4d cube of randomly scattered points, then unfold using tsne
s = RandStream('mt19937ar', 'Seed', 2410152);
RandStream.setGlobalStream(s);
X = rand(s,200,4) * 8;
Y = floor(X(:,1));
YP = Y;
YP(Y ~= 3) = -1;
YP(Y == 3) = 1;
C = [166 206 227
31 120 180
178 223 138
51 160 44
251 154 153
227 2... |
% estimate perpendicular laplacian of A
RgA_X=zeros(sizeX,sizeZ);
gA_Z=zeros(sizeX,sizeZ);
for (x=3:sizeX-2)
RgA_X(x,3:sizeZ-2)=(1/12)*(-A_XZ_map(x+2,(3:sizeZ-2))+A_XZ_map(x-2,(3:sizeZ-2)))+(2/3)*(A_XZ_map(x+1,(3:sizeZ-2))-A_XZ_map(x-1,(3:sizeZ-2)));
gA_Z(x,3:sizeZ-2)=(1/12)*(-A_XZ_map(x,(3:sizeZ-2)+2)+A_XZ_... |
function result = slidingWindowCorr(signal,time,L,R)
% Plots the max autocorrelation value calculated for a window of specified
% length accross time
% signal = spike train data or other stuff
% time = lfp.timestamp*7.75
% L = window length, ex 2000
% R = decimation rate (how many samples to skip between windows), ex 2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.