text stringlengths 8 6.12M |
|---|
function [in] = isConstellationInImage(imgPath,X)
I = imread(imgPath);
dimX = size(I,2);
dimY = size(I,1);
in = ones(size(X,1),1);
for i=1:size(X,1)
if (X(i,1)<1)||(X(i,1)>dimX)||(X(i,2)<1)||(X(i,2)>dimY)
in(i) = 0;
end
end
end |
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% %%%
%%% SIMULATION VARIABLES GRAPHS %%%
%%% %%%
%%%%%%%%%%%... |
function r = load_rules_from_excel(r,filename,sheet)
% load_rules_from_excel('C:\Documents and Settings\Dani\My Documents\PhD\research\projects\Rule-based System Architecting\Decadal Objective Rule Definition.xlsx','Weather');
[num,txt]= xlsread(filename,sheet);
pref = '(defrule subobjective-';
space = ' ';
arrow = ' ... |
function l2 = findL2(u, u0,eps)
ui1j= circshift(u,[0 1]); % i+1, j
uij1= circshift(u,[1 0]); % i, j+1
ui1j1=circshift(u,[1 1]); % i+1, j+1
ui_j_ = circshift(u,[-1 -1]);% i-1, j-1
ui_j = circshift(u,[0 -1]);% i-1, j
uij_ = circshift(u,[-1 0]); % i , j-1
dxx = ui1j+... |
Jannuar22_BL_sim= [([0:1:68646]*5)' BLfixed];
find(isnan(BLSOLLC)) % Es befinden sich NaN in der Messung
BLSOLLCfixed=fillmissing(BLSOLLC,'pchip'); % NaN interpolieren
sum(isnan(BLSOLLCfixed))
disp("NaN bereinigt")
Jannuar22Abweichung=BLSOLLCfixed-BLISTCfixed;
sum(isnan(Jannuar22Abweichung))
Jannuar22_Abw... |
% Reads TAO/TRITON data and returns structure tao.
function [tao] = ReadTaoTriton(lonrange, latrange)
ticstart = tic;
disp('Reading TAO/TRITON data');
datadir = '../data/';
tao.name = 'tao';
tao.lat = [8 5 2 0 -2 -5 -8];
% modes.lon = [95 110 125 140 137 147 155 156 165 170 180]; % W
% ed... |
function [Aout] = demodQAM_4thPower_DD(Srx,C)
% Last Update: 02/02/2019
%% Input Parameters
M = numel(C);
%% Demodulate Signal
txSignal = symbol2signal(signal2symbol(Srx,C),C);
%% Class Partition
if M == 16
I = real(txSignal);
Q = imag(txSignal);
I_set = unique(real(txSignal));
Q_set = unique(imag(... |
% Script for calculating image shift
% (C) Copyright 2019 The Huang Lab
%
% All rights reserved Weldon School of Biomedical Engineering
% Purdue University
% West Lafayette, Indiana
% USA
%... |
function [E_bar,M_bar,Em,Sm,e,s,vis,vis0,ind,idx] = MT_frictional_viscous_StressBC(Sigma,a,q,eta,eta0,Nc,Nm,n,phi,ys)
% MORI_TANAKA_FRICTION_VISCOUS_STRESSBC
% 08/July/2021
% description: To get bulk rehology for composite material with a connected
% matrix using Mori-Tanaka homogenization appraoch. This model c... |
Step=15;
Pos=400;
PvCorrCa3=zeros(Pos,Step);
PvCorrCa3Man=zeros(Pos,Step);
PvCorrCa1Bef=zeros(Pos,Step);
PvCorrCa1BefMan=zeros(Pos,Step);
PvCorrCa1Aft=zeros(Pos,Step);
PvCorrCa1AftMan=zeros(Pos,Step);
for i=1:Step
Map1=PhiTTT;
Map2=squeeze(PhiD(1,:,i,:));
PvCorrCa3Man(:,i)=squeeze(min(1-corr(Map1',Map2'),[],1));
PvC... |
% Implement a modified multivariable Newton method (based on Newton.m), which corrects the
% non positive definite Hessian by computing its LDLT decomposition and changing negative
% and very small diagonal entries to some fixed positive value.
function [x] = Modified_Newton(f,df,ddf,x0,iter)
% f: vector->scalar obje... |
function averageGCM()
%cd ('/Users/xcitech/Documents/Runs/MIS11/test');
%cd ('/Users/xcitech/Documents/Runs/wavelet/files');
Files = dir('*LSX.nc');
Temp= zeros(180,90,365); %Store all the averaged TS2
Temp_summer = zeros(180,90,1); % Store the averaged summer temperature
Sum_TS= zeros(180,90,length(Files)); %Stor... |
function v = VectorizeStruct(S)
%function v = VectorizeStruct(S)
%
% if S is a struct where each element is a number, then v is
% a vector of those numbers, drawn from the fields of s alphabetically
%
% a.a = 1
% a.b = 2
% VectorizeStruct(a)
names = fieldnames(S);
for i = 1:length(names)
thisName = names{i};
v(i)... |
%Algoritmo Interpolador Polinomial Geral (via sistema de eqs. Lineares):
%Cálculo do erro exato de interpolação = |Pn(x)-f(x)|
clear
clc
format long
a = 1;
b = 8;
n = 2;
h = (b-a)/n;
x = a : h : b;
y = log(x);
C=fcoefinterPn(n,x,y)
%Plotagem e calculo do erro exato:
np = 100; %numero de intervalos para p... |
function transf_mask2block()
%
% Applies LTA transform to the binary masks
%
mask_dir = '/Users/erichfonoff/Desktop/Eduardo_Alho/Atlas2/Orig_masks/AC/preprocessed_masks_AC/';
lta_dir = '/Users/erichfonoff/Desktop/Eduardo_Alho/Rereg/reg1/';
reg2D_dir = '/Users/erichfonoff/Desktop/Eduardo_Alho/Atlas2/Orig_masks/AC/Reg2... |
% Linear constraints for inverse dynamics
%
% Author : Darwin LAU
% Created : 2016
% Description : The linear function for ID is of the form A*x <= b,
% where x is the variable, A is the LHS linear matrix and b is the RHS vector
classdef IDConstraintLinear < IDConstraint
properties
A
... |
%--------------------------------------------------------------------------
%Program: Splitting2D
%Description: Fluid flow solver based on splitting method, in 2D.
%Version: 2.0
%Author: Ilyas Ramdzan
%Last Updated: 29/11/16
%Uses external modules for derivatives of functions
%-----------------------------------... |
function press_ver
load('../lookup_files/data_sam.mat');
l = 100;
p = logspace(0.008,2,l);
k_B = 1.39e-23;
e = 1.6e-19;
Tg = 2000;
m = l-30;
data_sam_in = zeros(8,l);
T = zeros(12,m);
Ti_f =@(p) (e/(2*k_B)-Tg)./p + Tg;
Ti = Ti_f(p(1:m));
for i = 1:... |
h = 1 : 1000; % inventa h(n) x = 1 : 500000; % inventa x(n)
tic; % registra instante inicial [y] = conv(x, h); % convuelve s = toc; % tiempo de cálculo [seg]
N = 2 * length(h) * length(x); % num. OPF
MFps = 1E-6 * N / s; % mega flops
fprintf('M... |
function y = contc2(x)
y = 0;
if x == 2 || x == 3 || x == 6 || x == 7
y = 1;
else
y = 0;
end
return |
function q = qfun( F0 )
%calculate the q value for boundary condition
kBT=0.026*1.6e-19;
F_e=-F0*17e-12;%4.7e-12 is the force value for 0.1e0/0.34nm*0.1V;
cvector = cfun( 0,F0,14*0.5,2.97e-10/4.25);
q=cvector*F_e/kBT*1e-9;
end
|
function ext = fileext(filename)
% Look for EXTENSION part
ind = find(filename == '.', 1, 'last');
if isempty(ind)
ext = [];
else
ext = filename(ind:end);
end
|
%% Import data from spreadsheet
% Script for importing data from the following spreadsheet:
%
% Workbook: F:\Google Drive\P3 Data Analysis\NIH Beacons\Matlab Analysis Code\Functions\User_data.xlsx
% Worksheet: Unique_sample_list
%
% Auto-generated by MATLAB on 12-Nov-2019 09:48:31
%% Setup the Import Opt... |
function bits=RandomBinaryString(d)
bits=zeros(1,d);
for i=1:d
if rand>0.5
bits(i)=1;
end
end
end |
x = xy(:,1);
y = xy(:,2);
% scatter3(xy(:,1), xy(:, 2), z)
[fitresult, gof] = createFit(x,y,z);
[xData, yData, zData] = prepareSurfaceData( x, y, z );
figure()
plot(fitresult,[xData, yData], zData,'Style','Residuals')
xlabel x
ylabel y
zlabel z
grid on
view( 14.5, 3.6 );
|
Fs = 44100;
beep1 = MakeBeep(1046, 0.05, Fs);
%beep1 = ones(1, Fs*0.01);
% this is correct (blue on the spectrogram, set the period to 0.5
% for easy spotting)
space1 = zeros(1, (0.5 * Fs) - length(beep1));
% space to result clicks *spaced by* a period of 0.5s
space2 = zeros(1, 0.5 * Fs);
click1 = [beep1, space1, b... |
function cfg = preprocess_data(cfg)
% Preprocess the data
global dynanets_default;
for i = 1 : length(cfg.data.patients)
pat = cfg.data.patients{i};
for j = 1 : length(cfg.data.seizures{i})
sz = cfg.data.seizures{i}{j};
fprintf(['2-preprocess: ' pat '_' sz '\n']);
dat... |
% Call Syntax: rPMinExtrapol = rPMinExtrapol_s(rPM, rPm, quntL)
%
% Description: This function performs Time-mirrored bottom extrema (Parabolic Mins) extrapolation
%
% Input Arguments:
% Name: rPM
% Type:
% Description:
%
% Name: rPm
% Type:
% Description:
%
% Name: quntL
% Type:
% Description:
%
% O... |
function [ Hout ] = H(Gamma,cosdt,cavity_length,cavity_loss,var,q,m,n)
% % cavity transfer function approximation in eq.11
c=physconst('LightSpeed')*100;
RTT = 2*cavity_length/c; % round trip time
const = -2/(log(1-cavity_loss)*(2-cavity_loss));
Hout = const*Gamma^2*((1-(1-cavity_loss)*exp(1i*(var-(pi*c)/cavity_... |
function[inverse] = invers(A)
Asize = size(A);
n = Asize(1);
b = eye(n);
inverse = gauss(A, b);
end |
function varargout = mswcmp(option,varargin)
%MSWCMP Multisignal 1-D compression using wavelets.
% MSWCMP computes thresholds and, depending on the selected
% option, performs compression of 1-D signals using wavelets.
% OUTPUTS = MSWCMP(OPTION,INPUTS) is the general syntax and
% valid values for OPTION are:
... |
function varargout = bid(varargin)
% BID MATLAB code for bid.fig
% BID, by itself, creates a new BID or raises the existing
% singleton*.
%
% H = BID returns the handle to a new BID or the handle to
% the existing singleton*.
%
% BID('CALLBACK',hObject,eventData,handles,...) calls the local
% ... |
function prob = sigmoid(z)
# Probability = sigmoid(z) computes a value in the interval (0,1)
# for a given z. z is a Real number -infinity < z < +infinity
# Used in logistic regression
# Treated as a probability value
prob = 1.0 ./ (1.0 + exp(-z));
end
|
function [xhat, error, A, MU] = gassLMS(x, in, mu, order, rho, type)
alpha = 0.8;
N = length(x);
A = zeros(order,N);
error = zeros(1,N);
xhat = zeros(1,N);
psi = zeros(order,N);
MU = mu*ones(1,N);
for i=order+1:N
inpast = in(i:-1:i-order+1);
xhat(i) = A(:,i)'*... |
$set 6 #Screen
$ #AnotherWMRunning
# BScreen::BScreen : X sunucusunu sorgularken hata oldu.\n \
%s ekranında başka bir pencere yöneticisi çalışıyor gibi.\n
$ #ManagingScreen
# BScreen::BScreen : %d ekranı, 0x%lx görünümüyle , %d derinliğiyle\n
$ #FontLoadFail
# BScreen::LoadStyle() : '%s' yazı tipi yüklenemedi.\n
$ #... |
% #########################################################################
% TUHH :: Institute for Control Systems :: Control Lab
% #########################################################################
% Experiment CSTD2: Magnetic Levitation Plant
%
% Copyright Herbert Werner and Hamburg University of Technol... |
function Neuron = make_neuronstruct2(Site,...
bird_number,...
ILD_matrix,...
HRTFinfo,...
threshhold,...
test_numbers,...
plotflag);
%Function to create a neuron "structure" for use in further analysis
%Requires that the HRTF information already be in the workspace
%Design... |
syms x
n = (1:10)';%1e3;
alpha = 2*(-1).^(n+1)./(n.^3*pi^3);
y = alpha'*sin(n*pi*x);
u = matlabFunction(y);
d = linspace(0,1,1e3);
plot(d,u(d))
|
function [LR_features, HR_features] = extract_HR_grad_feature_from_position(...
img_HR, parameter, position)
img_LR = GenerateLRImage(img_HR, parameter.scaling_factor, parameter.sigma);
if( size(img_HR, 3) == 3 )
img_HR = RGB2Y(img_HR);
end
... |
function f_val = muller (f, x0, x1, x2)
% Function implements Muller's method
iter_max = 100; % max number of steps in Muller method
f_tol = 1e-6; % numerical parameters
x_tol = 1e-6;
y0 = f(x0);
y1 = f(x1);
y2 = f(x2);
iter = 0;
while(iter <= iter_max)
iter = iter + 1;
a =( (x1 - x2)*(y0 - y2) - (x0 - x2)*(y1 ... |
function vis3d(x)
% visualize 3d array
figure;
slice(x, round(size(x,1)/2), round(size(x,2)/2), round(size(x,3)/2));
xlabel('x'); ylabel('y'); zlabel('z');
grid on, shading interp, colormap gray |
function [ring_output,cavitiesIndex,energy]=atcavityon(ring_input,varargin)
%ATRADON switches RF cavities on
%
% [RING2,CAVINDEX,ENERGY]=ATCAVITYON(RING,CAVIPASS)
% Changes passmethods to get RF cavity acceleration and radiation
% damping. ATRADON also sets the "Energy" field on the modified elements,
% looki... |
% calculate rate of CH3CH2COO2 + NO2 -> C2H5O2NO2
% Updated 7/18/06 AEP
% Based on JPL Data Evaluation #15
% rate=kNO2CH3CH2COO2(T,M)
function j=kNO2CH3CH2COO2(T,M)
k10o=9.0e-28.*(T./300).^(-8.9).*M;
k10oo=7.7e-12.*(T./300).^(-0.2);
k10=(k10o./(1+(k10o./k10oo))).*0.6.^((1+(log10(k10o./k10oo)).^2).^(-1.0));
j=k10; |
%% -- OVERLAPPING BLOCK -- %%
function [ pred_frame ] = OBMC(frame,x,y,H0,H1,H2,N)
%% -- INITIALIZATION OF VARIABLES -- %%
[Height,Width] = size(frame);
pred_frame = double(zeros(Height,Width));
pad_frame = double(padarray(frame,[N N],'replicate'));
x1 = int16(padarray(x,[1 1]));
y1 = int16(padarray(y,[1 1]));
... |
function ans = equation_19( p, e_l, phi_c, alpha, psi_c )
v1=p*e_l*phi_c;
v2=(alpha/(alpha-1)) * (psi_c + p*e_l*phi_c);
ans=v1-v2;
end |
function [ sig_out ] = sigLast( sig_in, nBar )
% 该函数让信号持续 n 根K线(包括发出信号的第一根bar)
% 如果在n根K线内出现新的信号,则自动以新的信号开始,前期信号消失
% @daniel 20130604 version 1
[nPeriod, nAsset] = size(sig_in);
sig_out = zeros(nPeriod, nAsset);
for jAsset = 1: nAsset
count = nBar;
lastSig = sig_in(1, jAsset);
for iPeriod = 1: nPeriod
... |
%% This script was mostly stolen from:
%% http://www.zipcores.com/datasheets/app_note_zc003.pdf
%%
%% This script is supposed to generate the coefficients needed
%% for the polyphase video filter as sorgelig uses it in the
%% miSTer project as of 10/29/2018.
%%
%% The filter is a 16 phase 4-tap filter with T0,T1,T2,T3 ... |
ImageSize=[375,1242];
IntrinsicMatrix0 = [7.215377e+02 0.000000e+00 6.095593e+02; 0.000000e+00 7.215377e+02 1.728540e+02; 0.000000e+00 0.000000e+00 1.000000e+00];
IntrinsicMatrix1 = [7.215377e+02 0.000000e+00 6.095593e+02; 0.000000e+00 7.215377e+02 1.728540e+02; 0.000000e+00 0.000000e+00 1.000000e+00];
rotationMat01=... |
function [ L, S ] = wrapper_nctrpca( X, r, t )
%WRAPPER_NCTRPCA Wrapper for non-convex tensor robust PCA
%
% Mehdi Bahri - Imperial College London
% July, 2016
% if nargin < 2
% r = min(size(X(:,:,1)));
% end
params.thresh_const = t;
[L, S] = ncrpca_ten_new(X, r, params);
end |
function index = closest(image, list, X, Y)
distance = zeros(size(list, 1), 1);
Y = Y * size(image,1);
X = X * size(image,2);
%fprintf('Picking closest to: %d %d \n', int64(Y), int64(X));
for n = 1:size(list,1)
objectY = list(n).BoundingBox(2) + (0.5 * list(n).BoundingBox(4));
objectX = list(n).BoundingBox(1) ... |
function [track] = regression(Xs,Ys)
%% ================================================
m = length(Xs);
x = [Xs;ones(1,m)]';
y = Ys';
%% ================================================ using normal eq
w = (x'*x)\(x'*y);
track = [Xs',[Xs',ones(1,m)']*w];
%{
display(x);display(y);
display(w)
figure(1)
... |
function [ im_mask ] = get_masks( test_fea, C_st, C_nd)
%TEST_SDAHIP Summary of this function goes here
% Detailed explanation goes here
% load C_1.mat;
% load C_2.mat;
im_mask = cell(2,1);
% w = dim(1);
% h = dim(2);
im_mask1 = zeros(length(test_fea), 1);
im_mask2 = zeros(length(test... |
clear;
format longg;
activation_function = @(tot) (1 ./ (1 + exp(-1.*tot)));
NODES = [136, 300, 4]; % total number of nodes (without bias in layer)
LAYERS = length(NODES);
HIDDEN_LAYERS = LAYERS - 2;
E_max = 5; % max % error to minimize to
eta = 1e-3; % Learning Rate
E = Inf; % initalize to... |
% remove_noise - removes small groups of connected components of a binary
% image
%
% Usage:
% [image] = remove_noise(image_bw, min_contected_pixels)
%
% Arguments:
% image_bw - a binary image
% min_contected_pixels - the minimum value for connected components
%
% Output:
% image ... |
function [B] = pinv1(A, tol)
%UNTITLED15 Summary of this function goes here
% Detailed explanation goes here
[U,S,V] = svd(A);
S = arrayfun(@(v) recip(v), S);
B = V*(S')*(U');
function [v] = recip(v)
if v>tol
v = 1/v;
else
v = 0;
end
end
end
|
function [root, iteration] = falsePositionMethod(myFunction, xl, xu, error, maxItr)
% Applying False Position Method to find root of angleFunction
rError = 100;
iteration = 0;
% Starting the procedure
for iterationCount = 1: 1: maxItr
xr = xu - (myFunction(xu)*(xl-xu))/(myFunction(xl)-myFunction(xu));... |
%% MetPath Tutorial Start
% Not necessary to run clear all but can help clarity to begin
% with an empty Workspace
clear all
%% Set up paths
% MetPath uses functions from COBRA Toolbox package
% (https://opencobra.github.io/cobratoolbox/stable/).
% Its installation is mandatory.
% If you have not yet run initCobraT... |
function existList = plotBeamStructure(structure, areaAndForceList, figNum, xLimit, yLimit, plotLimit, scaleFactor, filename, plotMoment)
if nargin < 9
plotMoment = false;
end
fig = figure(figNum);
hold on
axis equal
xlim([0 xLimit])
ylim([0 yLimit])
existList = zeros(size(struct... |
function rotateMotorAll(degrees, washers, tg)
while(1)
%Menu is displayed
fprintf('\nEnter: 1) For All Washers | 2) For Specific Washer | 3) To Exit | \n');
command = input('Enter: ');
% Motor will rotate to the all washers of desired color selected
if (command == 1)
... |
clear;
% Load our data set
load('proj_fit_22');
x1=id.X{1, 1};
x2=id.X{2, 1};
y=id.Y;
m=2; % degree for the polynomial approximator
fii = fi_part1(m,x1,x2,y); % regressors matrix
yhi= yhat_part1(fii,y); % the approximated matrix
MSEi = mse_part1(y,yhi); % mean square error
figure;
plot(MSEi);
title('MSE for identifi... |
function [ R ] = Matern32_matrix( x1,x2,theta )
% Details: Create autocorrelation matrix with Matern32 kernel
%
% inputs:
% x1 - First input vector
% x2 - Second input vector
% theta - Hyperparameter vector
%
% outputs:
% R - Autocorrelation matrix
n = size(x1,2);
m1 = size(x1,1);
m2 = size(x2,1);
R =... |
tot_length = 300;
tot_point = 10;
radius = 2;
dis = 0.1;
temp = zeros(3,1);
point_coordinate = zeros(tot_length*tot_point,3);
dis1 = zeros(tot_length*tot_point,3);
dis2 = zeros(tot_length*tot_point,3);
w1 = zeros(tot_length*tot_point);
w2 = zeros(tot_length*tot_point);
t1 = zeros(8,1);
t2 = zeros(8,1);
q1 =... |
% training process
function train
% basic values
global numlines datalines currentimage
% see if using live data
% TEEDATA1/goodT - 3 errors on rotation into std orientation - 31 good
imagestem = input('Test image file stem (filestem)\n?','s');
% training phase
datacount = 0;
maximages = 31;
for ... |
%================================ Adjoint ================================
%
% function g = adjoint(g1, g2)
%
%
% Computes and returns the adjoint of g. The adjoint is defined to
% operate as:
%
% Ad_g1 (g2) = g1 * g2 * inverse g1
%
%================================ Adjoint ================================
funct... |
function [AUC_diff] = NP_AUC(x_param,y_param)
% AUCootstrap the mean values from all participants in each group and
% calculate the AUC
w = ones(size(y_param));
ii = 1:size(y_param,1);
% figure(7),
AUC1 = NP_areaUnderCurve(ii,x_param(:,1),y_param(:,1),w(:,1));
AUC2 = NP_areaUnderCurve(ii,x_param(:,2),y_param(:,2),w(... |
function [proj_ssd,angles] = OPT_proj_angle_downsample(full_filename,angle_index_step)
omedata = bfopen(full_filename);
r = loci.formats.ChannelFiller();
r = loci.formats.ChannelSeparator(r);
OMEXMLService = loci.formats.services.OMEXMLServiceImpl();
r.setMe... |
%{
This function finds the centroid of a region that is colored yellow. this
region shoould be the largest contigous region
Input:
Image A where the pixels of interest are colored yellow: [255 255
0]
D: Connected region matrix
darkPixels: coordinates of pixels that are par... |
function calCorr
close all;
clear all;
load('featureEntropy.mat');
load('featureNSS.mat');
load('MOSqoe.mat');
MOS=MOSqoe;
%% qoe
X=[featDS', Hvalue];
K=5;
N=length(X);
indices = crossvalind('Kfold',N,K);
g=-8;
c=12;
lower=0;
upper=1;
for i = 1:1000
indices=randperm(N);
traindata=X(i... |
function [annErrorImage,meanRMS] = GetErrorMeanAndImage(ann,hB,wB,hA,wA,br_boundary_to_ignore,A,B,width, ...
descriptor_mode, patch_mode,A_patch,B_patch,patch_params)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
rowMap = ann(:,:,2); rowMap... |
%image
picture = imread('test_data/boy.png');
pictureGrayScale = rgb2gray(picture);
binRep = dec2bin(pictureGrayScale(:));
txPSDU = str2num(binRep(:));
mcs = 1;
snr = 5;
numPSDU = ceil(length(txPSDU)/32816);
rxData = [];
switch(mcs)
case 0
PSDUlength = 32784;
case 1
PSDUlength = 32784; ... |
function data = loadWithMeanFilter(filename)
%
%this function reads the "data" structure from the file specified.
%
%it should be a structure with fields:
%data.positions =[nodeID xPos yPos zPos] in centimeters
%data.RSSI = [receiverId transmitterId packetNumber packetIndex rssi-1 rssi-2 ... rssi-10]
%
%this f... |
function[Io,Ix,Iy,Im]=myEdgeFilter(img,sigma)
clc;
Io=img;
original=img;
original=imread(img);
b=im2double(original);
[m,n]=size(original);
h=fspecial('gaussian',3,sigma);
P(1:m,1:n)=0;
for i=1:m-2;
for j=1:m-2;
P(i,j)=h(1,1)*b(i,j)+h(1,2)*b(i,j+1)+h(1,3)*b(i,j+2)+h(2,1)*b(i+1,j)+h(2,2)*b(i+1,j+1)+h(2,3)*b(i+1,j+2)+h(3... |
clear all
load('C:\Users\llinc\OneDrive\Documents\GitHub\retina_personal\0406\Analyzed_data\30Hz_27_RF_15min\unsort\RF_properties.mat')
load('C:\Users\llinc\OneDrive\Documents\GitHub\retina_personal\0406\merge\merge_0224_HMM_RL_G20_5min_Q100_6.5mW.mat')
newXpos = Monitor2DCoor2BarCoor(RF_properties(:,2),RF_properties(:... |
x = xlsread('IRASresults.xlsx','Results');
yo = xlsread('Scarcity.xlsx','Env_P');
zo = xlsread('Scarcity.xlsx','Env_Cons');
deb = 1201;
fin = 1308;
% days
da=x(deb+2:fin+2,1)-8400;
% Residential price
y = yo(deb:fin,4:6);
% Environmental flow
z = zo(deb:fin,4:6);
zb = x(deb:fin,10);
figure
subplo... |
banana_tiff = imread('./data/banana_slug.tiff');
[M,N] = size(banana_tiff);
im = double(banana_tiff);
% Linerization: Map (2047, 15000) to (0,1)
zero_map = 2047;
one_map = 15000;
for i=1:M
for j=1:N
tem = (im(i,j) - zero_map) / (one_map - zero_map);
im(i,j) = min(max(0, tem), 1);
end
end
%figu... |
% =================================================================
% Code for Example 3-5 in our paper
% Y. Zheng, G. Fantuzzi, Sum-of-squares chordal decomposition of
% polynomial matrix inequalities
%
% Assume the option sos.csp in Yalmip has been modified
% ================================... |
%Load camera config
function camera_struc=load_camera_config(camera_name)
%NOTE: NOISE on every camera needs to be checked.
%Note: Verifying the zero GeV_pixel is up to the user
camera_struc.name=camera_name;
switch camera_name
case 'CMOS_FAR'
% camera_struc.zero_Gev_px=890; %For Apr 6
% camera_str... |
close all;
clear all;
P = 1; % nastawa regulatora PD (D = P/10)
for P = [20 200 2000 20000];
sim('PD_EDDA.slx',20);
figure();
subplot(2,1,1);
plot(t,e1);
title('Błąd położenia pierwszego przegubu (e1)');
xlabel('czas [s]');
ylabel('błąd');
hold on;
grid on;
subplot... |
function NIQ_full(behavioral_var,conn_type,Network_1,Network_2)
toolboxRoot=['/space/raid6/data/rissman/Nicco/MATLAB_PATH/'];
addpath(genpath(toolboxRoot))
toolboxRoot=['/space/raid6/data/rissman/Nicco/NIQ/Scripts'];
addpath(genpath(toolboxRoot))
% Set variables of interest
switch nargin
case 3
fprintf('T... |
function [bin,len]=en_z0_r0(z,runs,lastBit,p)
%This code is essentially the same as en_z0.m
%The only difference is that 'inv' ==> inversion is not performed!!!
f0 = 1/2 -1/16 -1/64;
f1 = 1/2 -1/8;
f2 = 1/4 +1/16;% +1/64;
len=length(z); wuns=sum(z);
%inv=0;
%if 2*wuns>len
%z=1-z;
%wuns=len-wuns;
%inv=1;
%en... |
% circuit.LTspice.data.rawfile.valuesline
filename=circuit.LTspice.raw.file;
%
fileID = fopen(filename,'rb'); % Opens file
[buf, count] = fread(fileID, 1, 'uint16');
dec2hex(buf)
char(buf)
[buf, count] = fread(fileID, 1, 'double');
fseek(fileID, circuit.LTspice.data.rawfile.valuesposition+1, 'bof'); % data posit... |
% MARGIN_FEATS Compute BI-RADS margin features.
% [X,FEAT] = MARGIN_FEATS(BW) computes margin BI-RADS features according
% to the BI-RADS lexicon defined for breast ultrasound, where BW is the
% binary shape of the lesion:
%
% BI-RADS feature Quantitative feature
% --------------- -------... |
function annotatedImage = annotateComponents(im, components)
% Function to annotate tne components and see various features. The
% features include:
% 1. Bounding boxes of components
% 2. Centers of bounding boxes of components
% 3. Mean L,a,b of each component.
maxId = max(components(:));
... |
%% Header
%
% Citation:
% Johnson, J. E. and J. A. Berry. 2021. The role of Cytochrome b6f in the
% control of steady-state photosynthesis: a conceptual and quantitative
% model. Photosynthesis Research, DOI: 10.1007/s11120-021-00840-4
%
% Description:
% Example simulation with forward model and dynamic cross-s... |
clc
clear
close all
labeltsize=35;
fw = 'normal'; %%是否加粗斜体之类
fn='Times New Roman';
linewide1=3;
mkft = 15;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load Mis_1K35dB.mat
figure(1);
hold on
plot(1-cos2,Pd_PGLRT_mc,'k-o','linewidth',linewide1,'MarkerSize',mkft)
plot(1-cos2,Pd_PRAO_mc,'r-x','line... |
function [assembly]=Main_assemblies_detection(spM,MaxLags,BinSizes,...
Exp_Thres, ref_lag,alph,Dc,p_shift,No_th,O_th,bytelimit)
% this function returns cell assemblies detected in spM spike matrix binned
% at a temporal resolution specified in 'BinSizes' vector and testing for all
% lags between '-MaxLags(i)' and 'Ma... |
%{
EULER YONTEMI
y(x) = y(x0) + y'(x0)*h/1!
y(n+1)=y(n)+h*df(n)
%}
%{
Ex: y'=e^(3x)-y, x0=1,y0=2
%}
close all ; clear all ; clc ;
x = [0];
y = [1];
h = 0.1;
for i=2:11
x(i)=x(i-1)+h;
df = exp(3*x(i-1))+3*y(i-1);
y(i) = y(i-1) + df*h;
end
plot(x,y,'r--'); |
clear
clc
Mat=xlsread('validation data.xlsx','Sheet1','F2:U315');
figuretitle={'GRA','SHR','CRP','DBF','ENF','EBF'};
markertype={'^','diamond','o','v','square','+'};
colorlist={[221/255 99/255 150/255];[157/255 200/255 56/255];[175/255 159/255 119/255];...
[112/255 108/255 170/255];[119/255 177/255 161... |
% Cahn-Hilliard integrator. Solves the CH equation
% with natural and no-flux boundary conditions.
% Nonlinear term: f(u) = u - u^3
%
% Numerical scheme;
% Eyre's linearly stabilized CH integration scheme
%
% Notes;
% 1. Uses a fixed time step.
% 2. Uses discrete cosine transform to invert
% the lin... |
clear all;
signal = [ +1 +1 +1 +1 +1 -1 -1 +1 +1 -1 +1 -1 +1];
tau = 200e-6;
fs = 5e6;
N = tau*fs;
% this is the "time" sequence, just a sequence of samples.
n = 0:N-1;
ssignal = kron(signal,ones(1,N/length(signal)));
bsignal = [ssignal zeros(1,N-length(ssignal))]
|
function output = EC_reShape(OMS, ECData, info)
%Find fieldnames
fields = fieldnames(ECData);
flag = cell2mat(cellfun(@(x) ~isempty(strfind(x, 'Time')), fields, 'UniformOutput', 0));
if any(flag)
%Get index that matches Scintillometer data start Index
[~, ECStartInd] = min(abs(OMS.MWSC(1,1)-ECData.(fi... |
function [est,meas] = run_filter(model,truth,varargin)
tic;
%% --- Instantiate inputParser
p = inputParser;
addParameter(p, 'ActionStrategy', 1, @isnumeric);
parse(p, varargin{:});
model.current_strategy = model.Strategy{p.Results.ActionStrategy};
%% make code look nicer
current_url = model... |
% FIREpdef.m
% load .xlsx file associated with param.FIREdef
clear;clc;
xlsfile = 'FIREdefparam.xlsx';
[~,~,FIREpxls]=xlsread(xlsfile,1,'A1:D27'); % the xlsfile has 27 rows and 4 column:
% C1: number of the parameter; C2: parameter name; C3: parameter value; C4: brief description of the paremeter
% create a structur... |
% simulation for pseudoCASL experiment based on blochsim
% this section is skipped to allow for iterations when the doBatch flag is
% turned on. YOu do this when you are calling the script from a batch
% file, e.g. - see pCASL_batch01.m
doBatch = 0;
if ~doBatch
flip_ang = 25;
isTag = 1;
vel =... |
function [mpfn,flag] = basicidentify(q,pect,thro)
%% SETTINGS
% throshold
%pect = 0.03;
%thro = 10^-8;
% maximum iteration
MAX_ITER_BASIC = 100;
%% import data
M0 = length(q);
[n,~] = size(q(1).bus);
[m,~] = size(q(1).branch);
% correct topology and parameter
correct_topo = full(makeYbus(q(1))~=0);
tic;
... |
% generate link .dat file from webbot log
% before running:
% remove all \tab and \# from input file
% take care of index.htm defaults
function link2dat(fname,ofname)
murl = 10000;
m404 = 1000;
mlink = 10*murl;
U = cell(murl,1);
hash = zeros(murl,1);
U404 = cell(m404,1);
hash404 = zeros(m404,1);
... |
AnnualIncome = input('enter your annual income:');
if 0 <= AnnualIncome && AnnualIncome<= 6000;
tax_2002 = 0;
elseif 6000 < AnnualIncome && AnnualIncome <= 20000
tax_2002 = (AnnualIncome - 6000) * 0.17;
elseif 20000 < AnnualIncome && AnnualIncome <= 50000
tax_2002 = 2380 + (AnnualIncome - 20000) * 0.... |
tspan = [0, 700*pi];
%loop
init_cond = [1, 0, 0, 1;
1, 0, 0, 0.9;
1, 0, 0, 1.1;
1.1, 0, 0.2, 1];
cols = ['c-', 'k.', 'm--', 'r-'];
ninit = size(init_cond, 1);
for init = 1:ninit
sol0 = init_cond(init,:);
[t,sol] = ode113(@gravity, tspan, sol0);
plot(sol(:,1),sol(:,2)... |
%------------- BEGIN CODE --------------
% ekran ve bellek on temizleme
close all ; clear all ; clc ;
format short; format compact;
x = [50 100 100 100 100 100 100 100 100 100 50];
t = 0;
fprintf('x = ');
for n = 0:0.1:1
fprintf('%6.1f ', n);
end
fprintf('\n');
fprintf('t = %.3f : ', t);
fprintf('%6.... |
clc;
clear all;
close all;
x = [1 2 3 4];
h = [1 2 3 4];
N = max(length(x),length(h));
%N = length(x)+length(h)-1;
x = [x zeros(1,N-length(x))];
h = [h zeros(1,N-length(h))];
disp(x); disp(h);
for n=1:N
y(n)=0;
for k=1:N
i=n-k+1;
if(i<=0)
i=i+N;
end
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.