text stringlengths 8 6.12M |
|---|
#
# Winverse.m -- Wavelet synthesis from coefficients
#
# (c) 2019 Prof Dr Andreas Müller, Hochschule Rapperswil
#
function retval = Winverse(a, b, h, J)
l = size(h)(2);
g = zeros(1,l);
for i = (1:l)
g(1,i) = h(1,l+1-i) * (-1)^i;
end
N = l * 2^J;
for j = (1:J)
delta = 2^(-j);
for i = (0:2:N-1)
# berechn... |
[w1, cost1, e1] = SGD_LR_miniBatch(y, X, w0, batch_size, interval_between_errorbar);
nonpriv = cost1;
e_nonpriv = e1;
[w2, cost2, e2] = SGD_LR_miniBatch_private(y, X, w0, batch_size, interval_between_errorbar);
priv = cost2;
e_priv = e2;
plot(nonpriv, '--')
axis([... |
function [traces_al_sm, time_aligned_stimOn, eventI_stimOn] = alignTraces_prePost_filt...
(traces, traceTimeVec, alignedEvent, frameLength, dofilter, timeInitTone, timeStimOnset, ...
timeCommitCL_CR_Gotone, time1stSideTry, timeReward, timeCommitIncorrResp, nPreFrames, nPostFrames, timeStimOffset)
% calls fun... |
function [obs_cov_mat obs_conf_mat] = AMIGO_obs_conf_mat(g_var_cov_mat,sens,ssquare)
% Compute the covariance matrix and the confidence interval (alpha=0.05) of the observations
% functions in the same timepoints, in which the experiments are given..
% See Bates & Watts (1988) Nonlinear Regression Analysis and its App... |
function J = Jac_Agilus(q,robot,tool)
if (nargin ==2 )
tool = eye(4);
end
Htx = [0 0 0 1;
0 0 0 0;
0 0 0 0;
0 0 0 0];
Hty = [0 0 0 0;
0 0 0 1;
0 0 0 0;
0 0 0 0];
Htz = [0 0 0 0;
0 0 0 0;
0 0 0 1;
0 0 0 0];
Hrx = [0 0 0 0;
0 0 -1 0;
0 1 0 0;
0 0 0 0];
Hry = [0 0 1 ... |
clear all
close all
clc
addpath(genpath('./libs'))
load experiment1_results
numtrain = size(firstgraph_auc,1);
medfirst = median(firstgraph_auc,1);
medfull = median(fullgraph_auc,1);
firstmaxind = 11; %rho = 20
fullmaxind = 12; %rho = 30;
secondmaxind = 12; %rho = 30
Rho(firstmaxind)
Rho(fullmaxind)
x = firstgra... |
function str = get_date_dir(form)
% GET_DATE_DIR -- Get a date directory string.
%
% IN:
% - `form` (char) |OPTIONAL|
if ( nargin < 1 ), form = 'mmddyy'; end
dsp2.util.assertions.assert__isa( form, 'char', 'the datestr format' );
str = datestr( now, form );
end |
% Synapse Sphere tutorial (brief version, just essential info)
%
% History:
% 17Jul2019 - SSP
% 24Apr2020 - SSP - Increased synapse sizes, changed colors
% -------------------------------------------------------------------------
% First import the neuron with synapses
c121 = Neuron(121, 't', true);
% and render... |
%PREPROCESSFRAMES performs pre-processing on frame inputs from cameras.
%
% [frame_left_out,frame_right_out] = preprocessFrames(frame_left_in,frame_right_in)
% performs pre-processing on frame inputs from both the left and right
% cameras. This includes converting to grayscale, smoothing, sharpening,
% and spat... |
clear all
close all
res =[256 256 256];
spacing = 320/256; %inputs to mimics
frames = 15;
rho = 1060;
mask_name = 'LV_grayvalues_Jacob.txt';
%Read Magnitude Image
name = sprintf('MAG.dat');
fid = fopen(name,'r');
raw =fread(fid,'short');
image = reshape(raw,res);
fclose(fid);
for frame = 1:frames
... |
function [ index_ineq ] = define_inequation_node_control(nodes, index_node, set_ineq, branch_index, controls)
%UNTITLED5 Summary of this function goes here
% Detailed explanation goes here
%Find inequations that define the regions but were not used
set_new_index_ineq = [];
for i = 1:size(nodes{inde... |
% If there is a backed up workspace, load it?
options.load_workspace = true;
% What file to use for loading/saving the workspace?
options.workspace = 'workspaces/backup';
% Run the plots or not?
options.run_plots = false;
% Open figure windows for plots?
options.figure_windows = 'off'; |
% tc_project_analysis.m
% Takes output from historic_timeseries_stats.m in addition to summary data
% for each plate and the surrounding bedrock. Summary data includes
% average % cover, average number of mobile species, tidal heights,
% rock types, cumulative degree minutes, and average
% maximum seasonal temperatu... |
function res = factorres(A,B)
[U,P] = btf2factor(B);
A1=U;
for i=1:length(P)
A1 = A1*P{end-i+1};
end
res = norm(A-A1)/norm(A); |
function [] = chi_generate_dTdz_i(basedir, rfid, varargin)
%% [] = chi_generate_dTdz_i(basedir, rfid, [dt, do_P, min_dz])
%
% This function calculates vertical stratification
% based the internal data of the chipod/gusT
%
% INPUT
% basedir : unit directory
% rfid : raw-file name
% d... |
function dTau_heel_dfx = dTau_heel_dfx(in1,in2,Fx,H,k,cmax,dmax,sampT)
%DTAU_HEEL_DFX
% DTAU_HEEL_DFX = DTAU_HEEL_DFX(IN1,IN2,FX,H,K,CMAX,DMAX,SAMPT)
% This function was generated by the Symbolic Math Toolbox version 8.5.
% 30-Oct-2020 12:39:35
q_t1 = in1(:,1);
q_t2 = in1(:,2);
q_t3 = in1(:,3);
q_t... |
function [lfv,xitt,xit1t]=lfv_MS_2(thtr,ind)
% parametros transformados
global r1 r2
T=length(r1);
Z=[ones(length(r1),1) r2];
thtr=real(thtr);
N=4;
%
beta00=thtr(1);
beta01=thtr(2);
beta10=thtr(3);
beta11=thtr(4);
if ind==1
sigma1=exp(thtr(5));
sigma2=exp(thtr(6));
p11_1=exp(thtr(7))/(1+exp(t... |
% initialize random no. generator
rand('state',0);
% make coefs
Fs=30000; cF=6000; species='owl';
[coefs]=makeGammaFIR(Fs,cF,species);
dur=Fs; % 1 sec buffers
rand('state',0); s=rand('state');
t=1;
nTAPS=length(coefs);
x=zeros(1,dur+nTAPS); % input buffer
y=zeros(1,dur); % out
tmp=zeros(1,dur+nTAPS);
tm=[];
for i=1:1... |
clear all;
Ns=[100, 300, 1000];
phis=[0.430, 0.434, 0.438, 0.443, 0.449, 0.456, 0.464, 0.474, 0.485, 0.497, 0.512, 0.529, 0.549, 0.573, 0.600];
ColMap=[
255,0,255;
128,0,128;
255,165,0]/255;
figure
for i= 1:length(Ns)
N=Ns(i);
data= load(['/home/xiaoling/SpiralWave/data/Spi7_MClu_Ph... |
% clear all
%% ------
Lpreamble = 6;
M1 = 128;
N1 = 20 + Lpreamble;
M2 = 1;
P = 2; % Number of P-parallel streams according to paper
Ip = eye(P); % Parallel stream Identity matrix
%% ------
Ncp1 = 0;
Nzp1 = 0;
Ncs1 = 0;
Nzs1 = 0;
Ncp2 = 0;
Nzp2 = 0;
Ncs2 = 0;
Nzs2 = 0;
Ncp3 = 0;
Nzp3 = 0;
Ncs3 = 0;
Nzs3 = 0;
%%... |
%Remove engine path
if exist('MWS','var')
if isfield('MWS','top_level')
rmpath(MWS.top_level);
else
rmpath(pwd)
end
else
rmpath(pwd);
end
|
function r = testPlane()
A = [0;0;1];
B = [0;1;0];
C = [1;0;0];
for i = 1 : 100
P = [0.01;0.01;0.01]*i
d(i) = getPlaneDistance(P,A,B,C)^2;
%P2 = 0.57/sqrt(3)*ones(3,1);
end
% for i=1:20
% getJ([-i;-i;-i*0.5;0;0;0],mean([A B C],2),A,B,C)
% P = mean([A B C],2)
P = zeros(3,1)
getJPlane(0,0,0,0,0,0,P(1),P(2),P(3),A(... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Project: 对称振子仿真(1)
% Author: EdenHU, 胡云博 SC21023107
% Description: 探究对于对称振子天线,当l/λ变化时,立体方向图的变化
% 在Matlab R2019a 运行可行
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc;
%设置变量
thet... |
function test_add_node()
G = graph;
nodes = [1 2 1 3 9 1];
eff = rand(1,6);
[G,ind] = add_node(G,nodes,eff,true);
|
classdef MatrixCompletion
properties(Static = true)
end
methods(Static = true)
function [X, Y] = sparseSVP(X0, numFactors, density, MaxIter, KnownItems, cutoff)
XObserved = X0(KnownItems);
X = X0;
for iteration = 1:MaxIter
%- X-->Y
[U S V] = svds(sparse(X), numFactors);
Y = U*S*V';... |
function [Z U D] = SPCA(X, Y, d, param)
%Copyright Barshan, Ghodsi 2009
%Paper: Supervised principal component analysis: Visualization, classification and
%regression on subspaces and submanifolds.
% [Z U] = SPCA(X,Y,d,param)
% Input:
% X: explanatory variable (pxn)
% Y: response variables (lxn)
% ... |
function argout=distanciaop(poly,poly2)
snapshot = getsnapshot(vid);
snapshot = gris(snapshot,2);
centropx = centopx(snapshot,255,poly2);
argout=(poly(1)*centropx(1)^3+poly(2)*centropx(1)^2+poly(3)*centropx(1)+poly(4)); |
function pheromoneLevel = UpdatePheromoneLevels(pheromoneLevel,deltaPheromoneLevel,rho)
pheromoneLevel = (1-rho)*pheromoneLevel+deltaPheromoneLevel;
end
|
clc
syms x ;
syms k ;
syms y ;
M=4; %(M=2,3,4,10)
A = zeros(M);%matrix a with zero values
f=zeros(1,M);%vector f of 1*M-1 size
for i=1:M
for j=1:M
f1 = @(x) x.^(j).*(1-x);%defining function f1
f2 = @(x) (x.^i).*(1-x);%defining function f2
f3 = @(x) -(x.^12.*(x.^i).*(1-x)) + (3... |
function [ r, tx ] = generateOFDM80211a(numFrames,payloadMessage)
% generateOFDMSignal: Generate OFDM signal based on the 802.11a standard.
% This function returns the time domain signal and a structure containing
% details about the signal itself. This information is required by the
% receiver to operate correctly.
... |
function [hn, n]= unit_sample_response(Bk, Ak, num_samples, figure_num)
%
% Inputs:
% Bk: Denomenator coefficients of z tranform function
% AK: Numerator coefficients of z transform function
% Outputs:
% hn: unit sample response
% n: samples discrete world
% Info:
% By: Matthew Luu
% Last Edit: 3/19/2019
% This funct... |
% dice.m -----------------------------------------------------------
% Simulation of the Sam Loyd's Carnival Dice game:
% - You bet 1 dollar to play. You then roll 3 dice
% - If one six appears you get 2 dollars
% - If two sixes appear, you get 3 dollars
% - If three sixes appear, you get 4 dollars
% - Otherwise, ... |
function data = load_raw_data(m)
if isfield(m,'phenotype')
filename_data = ['data_' m.modelname '_' m.phenotype '.mat'];
if exist(filename_data,'file')
load(filename_data)
else
data = feval(['load_data_' m.modelname],m.phenotype);
end
else
filenam... |
function points3D_cameraFrame = obtain3Dpoints_from_knownPlane(Camera_intrinsics,Camera_extrinsics, ...
PlaneRotation_CameraFrame, PlaneTranslation_cameraFrame, points2D_CameraFrame)
% coordinate sistem of the screen plane
ScreenPlane_Normal_vect = Plane... |
function mi = ModulTorzijeOpruge (k, l, r0, r)
% r0 je polumjer opruge, r je polumjer zice
a = k.*(2*l*(r0^2));
b = pi*(r^4);
mi = a./b;
endfunction |
%% 3D Plotting Test in Matlab
% Author: Mark Yost
% Email: yost772@gmail.com
% Last Edited 1/7/2018
%% 3D Plotting with cftool
clear all
close all;
X=[5;11;-3;14];
Y=[1;-2;3;-5];
Z=[-6;-0.25;11;3];
%cftool(X,Y,Z)
%% 3D Plotting with the surf command
%Plotting an array
set=[3,4,-2,-5,11,12;4,-10,40,... |
% Function that integrates the ODE model governing the robots' dynamics
function dz = flockingODE(t,z)
L = [2 -1 -1;
-1 2 -1;
-1 -1 2];
x = z(1:3,1); % x coordinates of robots
y = z(4:6,1); % y coordinates of robots
vx = z(7:9,1); % vx velocity components of robots
vy = z(10:12,1); % vy velocity ... |
pCOM = zeros(3,size(q,2));
vCOM = zeros(3,size(q,2));
DCM = zeros(3,size(q,2));
O_p_iVEC = zeros(3*(RobotParam.NB+1),size(q,2));
O_p_PcVEC = zeros(3*RobotParam.c,size(q,2));
for ii = 1:round(1/(fps*Simulation_dt)):length(t_vec)-1
RobotFrame = DynFun_Frame_calc(RobotLinks,RobotParam,q(:,ii));
O_p_iVEC(:,ii) = ... |
function [XDEN] = func_denoise_dw2d(X)
% FUNC_DENOISE_DW2D Saved Denoising Process.
% X: matrix of data
% -----------------
% XDEN: matrix of denoised data
% cfsDEN: decomposition vector (see WAVEDEC2)
% dimCFS: corresponding bookkeeping matrix
% Auto-generated by Wavelet Toolbox on 16-Dec-2015 17:45:45
% ... |
function P = chirpStim(P, Prefix);
% chirpStim - compute chirp stimulus
% P = chirpStim(P) computes the waveforms of tonal stimulus
% The carrier frequencies are given by P.Fcar [Hz], which is a column
% vector (mono) or Nx2 vector (stereo). The remaining parameters are
% taken from the parameter struct P ret... |
%% 双合约都用对价
% 应该是最劣势的策略了
%%
% DH;
% arrDt = DH_D_TR_MarketTradingday(3,'2014-07-18','2014-07-24');
savepath= 'D:\work\1.chenggang\跨期套利\IFticks\';
resultpath = 'D:\work\1.chenggang\跨期套利\result\';
% savepath= 'V:\1.chenggang\跨期套利\IFticks\';
% resultpath = 'V:\1.chenggang\跨期套利\result\';
%% 向硬盘上存ticks ( dh拿数据) 只用一次,以后隐... |
function [VEH,PAX,LPK,LPKK]=FlexibleRoute(Pax,numNewPax,rtlength,tmst,triptime,distcnv,dwellt,warmupt,T,numOpVeh,numVeh,vehcap,vehhdwy,vehVmph,vehVmps,ChkPnts,expttc,walkspeed,walklimit,VRange,alpha,beta,maxback,maxwait)
% Basic factors
% 1 unit in coordination = 1 mi
% rtlength=8.2; % length of route (one-way)
... |
function [ amag ] = accelerate( F1,F2,m )
F=F1+F2;
F3=sqrt(mpower(F(1,1),2)+mpower(F(2,1),2)+mpower(F(3,1),2));
amag=F3/m;
%ACCELERATE Summary of this function goes here
% Detailed explanation goes here
end |
function eeg_raw2fiff( elpfile, datafile,fiducialFile, flags )
% eeg_raw2fiff converts raw datafiles to the Neuromag FIFF format.
%
% Use as
% eeg_raw2fiff( elpfile, datafile, [options], [fiducialFile] )
%
% - datafile is an ascii file with Nchannels rows and Nsamples columns
% - elpfile is electrode positions file ... |
function [F,J] = ZTECONTACTFORCEJAC(contactfunc,U,MESH,p0,pars,QuadMats,prev, varargin)
%ZTE_QP_CONTACTFORCEJAC Returns the force and Jacobian after
%applying the traction-based contact model.
% USAGE:
% [F,J] = ZTE_QP_CONTACTFORCEJAC(contactfunc,U,MESH,p0,pars,QuadMats,prev);
% INPUTS:
% contactfunc : Function handl... |
function [gps, fv1] = optmtHyp(gps, x, y)
% Evidence optimization routine for hyperparamter selection.
% Try previous hyper-parameter as well as a grid of hyper-parameters
% Input
% gps: GP structure from previous step (used as initial state for the update)
% gps.hyp: hyper parameter structure
% gps.meanfunc: mean fu... |
%% 2013/07/02 MG Following script realize the rotor construction:
% determination of arc and line position
% determinazione of central label position
%% rotore and matrix BLKLABELS
switch geo.RotType
% case 'ISeg_HS'
% [geo,temp] = nodes_rotor_ISeg_HS(geo);
% build_matrix_ISeg;
case 'ISeg'
... |
function [resp] = gen_normal_tuning_skew(mu,s,p,k,range)
% evaluate generalized normal distribution with mean u, sigma s, power p, and skewness k over supplied range
alpha = s*sqrt(2); %alpha variable is equal to variance/2
pdf = p / (2*alpha*gamma(1/p)) * exp( -(abs(range-mu)/alpha).^p );
cdf = 1/2 + sign(k*(range... |
function [laplacianImage, sharpenedImage, magnitudeImage] = myPowerLawTransformation(I,c,gamma)
%
%
% ---- Oscar Castro, 11 05 2021
%
% ---------- Example ----------
%
% clear all; close all; clc;
%
% image = "img\test_pattern.tif";
% I = imread(image);
%
% format long g;
% format compact;
%
% image = "img\x_ray.t... |
clear;
load 3Dinv_result
load seiscmap
load tomo
load 3Dinitmod.mat
[xi yi] = ndgrid(xnode,ynode);
lalim = [min(xnode) max(xnode)];
lolim = [min(ynode) max(ynode)];
%[grdy grdx grdtopo] = grdread2('etopo1.grd');
%[grdxi grdyi] = meshgrid(grdx,grdy);
%grdtopo=double(grdtopo');
%save png_topo.mat grdtopo grdxi grdyi
%... |
function deltaIntensity = deltaIntensityFunction(img,refColor,label,baselineIntensity,threshold)
numRow = size(img,1);
numColumn = size(img,2);
imgR = img(:,:,1);
imgG = img(:,:,2);
imgB = img(:,:,3);
deltaIntensity = zeros(numRow,numColumn);
%For 1-2 channel clipped pixels:
for m = 1:numRow
for n = 1:numColumn
... |
function writeBasicParaHDF5(FID, dt, step_tot, N, modify)
% write basic parameters
% FID: file id for writing data
% dt: time step size in ms
% step_tot: total number of simulation steps
% N: vector for number of neurons in each population
if nargin == 4
modify = 0;
end
if modify == 0
h5cre... |
case_path = 'E:\AsthmaInhaler\annnotated-data\82214\';
dcfl = csvread([case_path 'depthCloserFlag.csv']);
dffl = csvread([case_path 'depthFartherFlag.csv']);
efl = csvread([case_path 'flagExhale.csv']);
ifl = csvread([case_path 'flagInhale.csv']);
sfl = csvread([case_path 'flagShake.csv']);
ann = loadjson([case_path ... |
% LiDAR data processing
% load input data
load lidar.txt;
% data stored in array 'lidar' same as lidar = dlmread('lidar.txt', ',');
% set window for processing
xmin = 548040;
ymin = 5129010;
xmax = 548300;
ymax = 5129270;
dx = 10; % GRID step
dy = 10;
% generate x & y grid
[x, y] = meshgrid(xmin:dx:xmax, ... |
n = [0:1:24];
a = 3*cos((pi*n/2)+(pi/6))+10*sin((2*pi*n/3));
subplot(2,1,1)
stem(n,a)
title('Oppgave 2b');
ylabel('x[n]');
xlabel('n');
grid on;
hold on %Del opp i to plot
b = cos((pi*n/2)-(pi/3));
subplot(2,1,2)
stem(n,b)
title('Oppgave 2b');
ylabel('y[n]');
xlabel('n');
grid on;
hold on |
%------------------------------------------------------------------
% Chesi example 2 with VS Iteration Initialized with Vlin
% Compute an estimate of the region of attraction for Chesi
% example 2 using the V-S iteration. The iteration is initialized
% with the Lyapunov function from linearized analysis.
%
% R... |
function debugWs(KinematicControlParameters)
clc; close;
indices = KinematicControlParameters.XYZIndices;
XYZ = KinematicControlParameters.XYZPoints;
point = KinematicControlParameters.centerOfWs;
a = checkIfPointIsInsideMesh(indices, XYZ, point);
disp(a)
end
%----------------------------... |
function re=outmatr(Xma,X,ind,field,ncat)
re=[];
nind=size(ind,1);
for j=1:nind
pal=['X.cond(ind(' num2str(j) ',1)).subj(ind(' num2str(j) ',2)).block(ind(' num2str(j) ',3)).' field];
if ncat~=4
re=cat(ncat,re,eval(pal));
else
aux=eval(pal);
... |
function SMOO_dSIG = smoo(dSIG,C_SMOO)
% Smoothing a digitalized signal.
% filling first and last values with original values
for i = 1 : C_SMOO
SMOO_dSIG(i) = dSIG(i);
SMOO_dSIG(length(dSIG) + 1 - i) = dSIG(length(dSIG) + 1 - i);
end
% smoothing
for i = 1 + C_SMOO : length(dSIG) - C_SMOO
SMOO_dSIG (i) = ... |
function [Model]=train()
%Model is the whole feature dataset in K-nearest-neighbor
load('Model.mat');
%feature= ExtractFeature(X); % feature is nData*nFeature matrix
nData= size(TrainFeatures,1);
nFeature= size(TrainFeatures,2);
Model= zeros(nData,nFeature+1);
for i= 1:nData
Model(i,1:nFeature)= TrainFeatures(i,... |
total_gain=0;
total_loss=0;
if ~linearize
for i=1:615
total_gain=total_gain+sum(this_image(i,:))*(energy_calib_vector(i)-20.35);
end
for i=617:2201
total_loss=total_loss+sum(this_image(i,:))*(20.35-energy_calib_vector(i));
end
else
for i=1:1595
total_gain=total_gain+sum(this... |
function elem=atrfcavity(fname,varargin)
%ATRFCAVITY(FAMNAME,LENGTH,VOLTAGE,FREQUENCY,HARMONICNUMBER,ENERGY,PASSMETHOD)
% creates an rfcavity element with Class 'RFCavity'
%
%FAMNAME family name
%LENGTH length [m]
%VOLTAGE peak voltage [V]
%FREQUENCY RF frequency [Hz]
%HARMNUMBER Harmonic Number
%ENERGY ... |
classdef (Abstract) FunctionND < handle
properties (SetAccess = private, Hidden = true)
N % arity of the function
end
methods (Abstract)
y = eval( self, x )
end
methods
function self = FunctionND( N )
% Constructor of base (abstract) class
if ~isinteger(N)
error('Functio... |
function [real_pose_cum, estim_pose_cum, estim_pose_d_cum] = mcl_simulation(lakename, motion, known_init, M, randomp, T, sigma_depth, sigma_dtb, sigma_u)
% mcl_simulation runs a mcl simulation in a given lake.
% define lake name here
L = LoadLake([lakename '.tif'], 127);
%depending on lake and m... |
%infected=dlmread('out5.txt');
%gefx=importdata('final10k1.gexf');
cities=length(infected(:,1)); %number of cities in the array
timesteps=length(infected(1,:)); %number of timesteps -> use all timesteps. Minimization done in the storing part
%to be deleted
h=1
q=1;
while q<=timesteps
infected2(:,h)=infected(:,q)... |
function varargout = dicomwrite(X, varargin)
%DICOMWRITE Write images as DICOM files.
% DICOMWRITE(X, FILENAME) writes the binary, grayscale, or truecolor
% image X to the file named in FILENAME.
%
% DICOMWRITE(X, MAP, FILENAME) writes the indexed image X with colormap
% MAP.
%
% DICOMWRITE(..., PAR... |
function E = minCPepReg(model, m, d)
r = model.result;
ISRi = trapz(r.time, r.vcurr(:, m.v.ISR));
IDRi = trapz(r.time, r.vcurr(:, m.v.IDR));
HE = 1 - IDRi / ISRi;
E = (HE - .4) * 100; |
%{
learningClassSQL.m
%}
conn = connectSQL(dbName,userName,password,dbUrl);
tableName = 'tableName';
key = {'password = "529f7e4923b35483585f81f1b126d4b0"';'sex = 1'};
users = selectTableMessage(conn,tableName,key{1},key{2});
sql = users.Data; |
% Bąk Maciej 400666 - zadanie 2
% aproksymacja za pomocą paraboli f(x) = ax^2 + bx + c
x = [-2, -1, 0, 1, 2];
y = [4, 1, 0, 1, 4];
G = zeros(5, 3);
Gt = zeros(3, 5);
factors = zeros(3, 1);
d = zeros(5, 1);
% stworzenie macuierzy d z wartościami z wektora y
for i=1:5
d(i, 1) = y(i);
end
% macierz G... |
function Param = load_parameters
%functions origins
%modifications made
%author
%Pass the mesured height above segt and mean oxygen sampling frequency
%to Deployment_parameters
%Parameters copied from main5.m at April 29th by Guilherme for AquaREA
%project
% switches (1 to perf... |
%function [c_hat_RS,failure] = BerlekampMasseyRS(gf_matrix, rec_word)
%This function implements the Berlekamp-Massey Algorithm for determining
%the Error Locator Polynomial for a given code word.
%inputs: GF2m matrix with binary coefficients
%received word polynomial in power notation (powers of alpha)
%output: th... |
function [ out] = bar(x)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
out=x;
end
|
centroidS = mean(trainfeat(1:10,:));
centroidT = mean(trainfeat(11:20,:));
centroidV = mean(trainfeat(21:30,:));
%figure;
figure;
xrange = [-2 2.2]; yrange = [-2 2];
%specify step for image's resolution
step = 0.01;
[x,y] = meshgrid(-2:step:2.2, -2:step:2);
image_size = size(x);
xy = [x(:) y(:)];
%getting a label ... |
function runMulti
multiModelAns(10);
multiModel(); |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (C) 2013 by Jerome Maye %
% jerome.maye@gmail.com %
% ... |
% Figure for peak pricing, Charles Rouge, 2017
% Reading excel files
x4 = xlsread('Peak_pricing.xlsx','benefits_ref');
x3 = xlsread('Peak_pricing.xlsx','benefits_E=-0.3');
x5 = xlsread('Peak_pricing.xlsx','benefits_E=-0.5');
% PLotting results
figure
subplot(1,2,1)
hold on
plot(x3(:,1),x3(:,2),'r','LineWid... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%README:
%%This script is used to plot the reactive power capability of the WF as
%%a function of the wind speed. It also includes various considered
%%setpoints.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clea... |
function [newcenters, movecenters ] = miseAjourKMeans(points, centers, nc)
%MISEAJOURKMEANS Summary of this function goes here
% Detailed explanation goes here
[dRow, dCol] = size(nc);
m = repmat([arrayfun(@(idx) sum(nc(idx,:)), 1:size(nc,1))]',1,dCol);
idx = m == 0;
m(idx) =1;
nc = nc ./m;
newcenters = nc*... |
function checkDir ( dirname, allEventTypes, allTypeNames, colorMap, errorfid )
%checkDir check to see if we have missing intermediate files
% Detailed explanation goes here
close all;
timeInterval = 200000;
procWidth = 1;
files = dir(fullfile(dirname, '*.csv'));
for i = 1:length(files)
[~, n, ~] = fileparts(fi... |
clc
clear all
MEXPATH = '../MATRIX_EXTRACTION/RUNS/';
SETDIRS = {'1_AROUNDSET', '2_ABOVESET', '3_SINGELEMABOVESET', '4_INTSET', '5_INTSETNPS'};
setid = 5; % To call SETDIRS
%% Mesh Extract
% MESH.Nds = dlmread('../MATRIX_EXTRACTION/RUNS/MESHPROCESS/Nodes.dat');
% MESH.Quad = dlmread('../MATRIX_EXTRACTION/RUNS... |
% electron movement
close all
clear all
dt=0.005;
dtdiv2=dt/2;
a1=10;
tau=4*2.67;
N=30000;
q=-1; % charge
Z=0;
x(1)=0.0;
y(1)=0;
z(1)=0;
px(1)=0;
py(1)=0;
pz(1)=0;
recgamma(1)=1;
tstart1=60;
dens=400;
ls=1/sqrt(dens);
kappa=sqrt(dens);%/sqrt(sqrt(1+4*a1^2/401));
alpha=atan(kappa);
frcoef=0... |
%% Engine Dynamics Approximation First Order
syms y(t)
T = 0.2;
Pe_star = 330000;
eqn = diff(y,t) == (-y + Pe_star)/T;
cond = y(0) == 0;
ysol(t) = dsolve(eqn,cond);
figure;
fplot(ysol/1000,[0 10])
xlabel('Time [s]');
ylabel('P_{eng} [kW]')
grid on;
%% Engine Dynamics Approximation Second Order
syms y(t)
wn = 2*pi*1... |
function [groupedTime, groupedData] = matrixGroup( time, data, inPoints, outPoints )
%MATRIXGROUP Summary of this function goes here
% Detailed explanation goes here
pointRatio = inPoints / outPoints;
groupedData = mean(reshape(data, pointRatio, numel(data)/pointRatio));
groupedTime = mean(reshape(time, poin... |
function [Wi_tr,Wo_tr] = nr_train(Wi, Wo, alpha_i, alpha_o, Inputs, ...
Targets, gr, psgn, neps)
%NR_TRAIN Train network
% [Wi_tr,Wo_tr] = nr_train(Wi, Wo, alpha_i, alpha_o, Inputs, ...
% Targets, gr, psgn, neps) trains a network with gradient descent
% followed by pseudo Gauss-Newton
%
% Input:
% ... |
function [ p, skew ] = probcause(x, y, value)
[ m, n ] = size(x);
if ( n != 1)
error('x is not a column vector');
endif
[ m, n ] = size(y);
if ( n != 1)
error('y is not a column vector');
endif
if (length(x) != length(y))
error('inputs column vectors x and y should have the same length');
endif
numData = len... |
function emissions_ = baseline_CO2_emis(t, epsilon_max, s, data)
% Computes baseline CO2 emissions in absence of mitigation
%{
Variables:
Parameters:
data = Data from CDIAC on global CO2 emissions up to 2014
This is an array
%}
if t<=2014
ftimes = data(:,1);
... |
%% Copyright 2014 by David G. Taylor. All rights reserved.
clc, clear, close all
%% plant simulation model parameters
N = 2;
Lm = 34.47e-3;
Ls = 37.24e-3;
Lr = 37.24e-3;
Rs = 1.00;
Rr = 2.24;
J = 3.2e-4;
F = 7.2e-4;
sLs = (1-Lm^2/(Ls*Lr))*Ls;
%% controller parameters
V_dc = 24;
Flux = 50e-3;
lambda_r... |
% Copyright (C) Daphne Koller, Stanford University, 2012
function [MEU OptimalDecisionRule] = OptimizeLinearExpectations( I )
% Inputs: An influence diagram I with a single decision node and one or more utility nodes.
% I.RandomFactors = list of factors for each random variable. These are CPDs, with
% ... |
function obj = setRotationMatrix(obj,r)
% set the rotation matrix (R) of the frame w.r.t to the
% reference frame
%
% Parameters:
% r: the rotation matrix or Euler angles (in radian) @type
% rowvec|matrix
if isvector(r) && length(r) == 3
% rpy = rad2deg(r);
obj.R... |
wname = 'sym5';
n_test = 50;
sz = [16 16 16];
s = 1;
C0 = 0;
tper = 0;
S = 0.5; % Max nnz/numel in histogram (sparsity of histograms)
% rand('state',0);
r_emd = zeros(n_test,1);
w_emd = zeros(n_test,1);
tr = 0;
tw = 0;
H = cell(n_test, 1);
fprintf(['Generate %d random histogram pairs of size [%d %d %d] and compu... |
mu(:,:,1) = [1 3];
sigma(:,:,1) = [1.5 0; 0 1];
% p1 = 1/2;
%
% mu(:,:,2) = [3 1];
% sigma(:,:,2) = [1 0.5; 0.5 2];
% p2 = 1/2;
% MixGaussian(200, 2, 2, mu, sigma);
mvnpdf([1,2], [1 3], [1.5 ,1])
ans1=normpdf(1, 1, sqrt(1.5))*normpdf(2, 3, sqrt(1))
A=[1,2;3,4];
mu=[1,3];
sigma=[0.5,1];
%sigma=[0.5,0;0,1];
mvnpdf(A... |
a = imread('mountain.png');
meanMountainColumn = mean(a);
m = min(meanMountainColumn);
darkestCol = int16(find(meanMountainColumn == m));
flipimage = a(end:-1:1,:);
imshow(flipimage);
halfimage = a(1:2:end,1:2:end);
imshow(halfimage);
h = zeros(256, 1);
for i=1:numel(a)
Z=a(i);
h(Z+1)=h(Z+1)+1;
end
myHist = int16(h)... |
function [x y]=bresenham(x1,y1,x2,y2)
x1=round(x1);
x2=round(x2);
y1=round(y1);
y2=round(y2);
dx=abs(x2-x1);
dy=abs(y2-y1);
sp=abs(dy)>abs(dx);
if sp t=dx;dx=dy;dy=t; end
if dy==0
temp=zeros(dx+1,1);
else
temp=[0;diff(mod([floor(dx/2):-dy:-dy*dx+floor(dx/2)]',dx))>=0];
end
if sp
if... |
%------------------------------------------------------------------------------------------
% ensmn_ncout.m
%
% write output to a netcdf file
%
% levi silvers may 2017
%------------------------------------------------------------------------------------------
%%-----------------... |
function varargout = EE30333(varargin)
% EE30333 MATLAB code for EE30333.fig
% EE30333, by itself, creates a new EE30333 or raises the existing
% singleton*.
%
% H = EE30333 returns the handle to a new EE30333 or the handle to
% the existing singleton*.
%
% EE30333('CALLBACK',hObject,eventData,... |
clear; clc;
unitNames = {
'Infantry'
'Archers'
'Uruk-hai'
};
armyNames = {
'Rohirrim'
'Mordor'
};
numTypes = length(unitNames);
numZones = 3;
numArmies = length(armyNames);
% armies: an array of # of troops for:
% dimension 1: zone (1, 2, ...)
% dimension 2: soldier type (rifleman, artillery, ...)
... |
function predictedNumber = identifyNumber(Mdl,audioData,Fs)
sampleFeatures = computeFeatures(audioData,Fs);
% Predict the class for that sample
predictedClass = predict(Mdl,sampleFeatures);
% Return as double
predictedNumber = str2double(predictedClass);
end
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% reference paper: [kong14lr] Lattice reduction aided transceiver design for MU MIMO downlink transmissions
% precoding using Block diagonalization (BD) with joint ELR-aided transceiver design. See details in paper [kong14lr]
%
% Written by: Yiming Kong
% Date: 3/10/201... |
function I4=infz(A,B,C,D,tol);
%INFZ Infinite Zero Structure of Proper Systems
%
% infzs = infz(A,B,C,D)
%
% returns the infinite zero structure of a system characterized
% by (A,B,C,D).
%
% infzs = I_4 List of Morse Indices
%
% See also INVZ, L_INVT, R_INVT and MORSEIDX.
if nargin==4,
... |
function CC_detect_interictal2
% In contrast to CC_detect_interictal, this function applies channel quality and senario vectors
% to reduce computational time.
rng('default')
rng('shuffle')
CC_root = '/home/bqrosen/projects/CC/';
subjs = dir(sprintf('%s/bipolar',CC_root));
subjs = cellfun(@(x) regexp(x,'_','split'),{su... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.