text stringlengths 8 6.12M |
|---|
function f = meanval(theta2)
global x2 s_jt mvalold oldt2 mvalolds mval_track
if max(abs(theta2-oldt2)) < 0.01;
tol = 1e-9;
flag = 0;
else
tol = 1e-6;
flag = 1;
end
theta2w = zeros(5,5); theta2w(:,1)=theta2;
expmu = exp(mufunc(x2,theta2w));
norm = 1;
avgnorm = 1;
i = 0;
mvalolds=[mvalold];
while norm > tol*1... |
%% Description of the script
%
% We consider the following linear mixed model:
%%%---------------------------------------------------------------------%%%
%%% y = X*beta + Z*b + eps, %%%
%%%---------------------------------------------------------------------%%%
%%% whe... |
function [PX, PY] = Bezier(PX1, PY1)
% cubique de Bezier
t = linspace(0,1,1000);
PX = (1 - t).^3*PX1(1) + 3*t.*(1 - t).^2*PX1(2) + 3*t.^2.*(1 - t)*PX1(3) + t.^3*PX1(4);
PY = (1 - t).^3*PY1(1) + 3*t.*(1 - t).^2*PY1(2) + 3*t.^2.*(1 - t)*PY1(3) + t.^3*PY1(4); |
clear all
close all
clc
%% Simple OQAM
%% initialization
% Modulation Rank
modRank=4;
% Guard subs in each subchannel? guard is total. guard/2 in each ch.side
guard=0;
% Size of Data
sizeOfData=128;
% number of Subchannels
numOfSubchannels=8;
%% Creating Data
X=create_OQAM_Data(numOfSubchannels, siz... |
% ptg_cfbcg
% Colourfull Figure Background
% Copyright is with the following author(s):
%
% (c) 2012 Juraj Oravec, Slovak University of Technology in Bratislava,
% juraj.oravec@stuba.sk
% (c) 2012 Monika Bakosova, Slovak University of Technology in Bratislava,
% monika.bakosova@stuba.sk
% -----------------------------... |
function blob_Cents = get_Centroids(Centroid,num_Blobs)
% Looks at the number of blobs and gets all the center points for that
% amount of blobs
blob_x = Centroid(1:num_Blobs, 1); % first n blobs in column 1 from Centroid
blob_y = Centroid(1:num_Blobs, 2); % first n blobs in column 2 from Centroid
blob_Cent... |
function [u_old, u_new, count] = alternatingDirectionImplicit(initial_guess, epsilon)
% initialize output variables
u_old = initial_guess;
u_temp = initial_guess;
u_new = initial_guess;
count = 0;
% Get mesh size from guess matrix
[M, N] = size(initial_guess);
% error variable ... |
%%
% EP 501
% HW 3
% Julio Guardado
clear, clc, close all
%% Problem 1.a + 1.b
%load test problem
load test_lsq.mat
%get first and second order fit using lsqfit.m
yfitlsq1 = lsqfit(x,ynoisy,1);
yfitlsq2 = lsqfit(x,ynoisy,2);
%get fit using polyfit and polyval
ypolyfit1 = polyval(polyfit(x,ynoisy,1),x);
ypolyfit2 =... |
function [ n, nFission, quotientA] = main( sigmaA,sigmaF,sigmaS,nNeutron,tMax)
% nem analóg szimuláció szórásminimalizálás
warning('off','all')
close all
nu = 2.5; % hasadási sokszorozódás
sigmaT = sigmaA + sigmaS + sigmaF;
pA=sigmaA/sigmaT; %valségek [0,1]
pF=sigmaF/sigmaT;
pS=sigmaS/sigmaT;
for i = 1:200
w... |
% LINFFITTING
% Test script for nonlinear L^\infty data fitting using primal-dual
% extragradient methods. Solves
% min_u 1/2 |u|_L2^2 s.t. |S(u)-yd|\leq \delta a.e. in \Omega,
% where S(u)=:y satisfies
% <\nabla y, \nabla v > + <u y,v> = <f,v> for all v in H^1
% using the approach described in the paper
% "Primal... |
function p = setDataSize(p, size)
%p = setDataSize(size)
%
%%This function sets the size of the 'data' field
%in bytes. It is important for trying to shrink
%or grow the packet size without actually adding fields
%and values. Use in conjunction with getDataSize
% "Copyright (c) 2000 and The Regents of the Univer... |
function [LabelsMap] = FindLabels(Xmap, Nclusters)
% FindLabels estimates the labels of each point in the Xmap dataset,
% assuming there are Nclusters
Y = pdist(Xmap,'euclid');
Z = linkage(Y,'complete');
LabelsMap = cluster(Z,'maxclust',Nclusters); |
%function [powerFC,compTime] = nonLinearMPC(SoC,C_rate,P_load, time)
% DEFINE GLOBAL VARIABLES
global InputsMin InputsMax Hp Ts SlewRate Ref Q R SoC_Min SoC_Max C_rate_Min C_rate_Max capacity normalX normU
import casadi.*
% Normalization of states and inpute for controller
normalX = [30; 1; 1];
normU = 20;
% Curr... |
% Script for generating initial pupil
%
% (C) Copyright 2019 The Huang Lab
%
% All rights reserved Weldon School of Biomedical Engineering
% Purdue University
% West Lafayette, Indiana
% US... |
function filteredIm = filteringScript( IMG )
% This function performs image filtration on some input
% Creating copies of the input image for processing
IMG2 = IMG;
IMG3 = IMG;
% removing uneeded yellow portion of the images
IMG2(IMG2==255) = 0;
% Image Filtration Step
% ######################## Thoughts #########... |
function [ c ] = remove_side_cells( c , v , minX , maxX , minY , maxY )
x = v(:, 1);
y = v(:, 2);
badVerts = find(x <= minX | x >= maxX | y <= minY | y >= maxY);
badCells = zeros(size(c, 1), 1);
bCLen = 0;
for i = 1:size(c, 1)
if any(ismember(badVerts, c{i})) || size(c, 1) < 1 || size(c, 2) < 1
bCLen = bCLe... |
clc
clear all
addpath('../../../ROUTINES/')
addpath('../../../ROUTINES/FEM/')
load('./MATS.mat', 'K', 'M', 'Kc', 'Mc')
%% MESH STRUCTURE
MESH.Nds = [-1 -1; 1 -1; 1 1; -1 1];
MESH.Quad = [1 1 2 3 4];
MESH.Tri = [];
MESH.Nn = size(MESH.Nds, 1);
MESH.Ne_Quad = size(MESH.Quad, 1);
MESH.Ne_Tri = size(MESH.Tri, 1);
M... |
function [colorizedstring] = colorizedstring(color, stringtocolorize)
%%
%
% file: colorizedstring.m
% author: Polcz Péter <ppolcz@gmail.com>
%
% Created on 2017.01.06. Friday, 13:58:22
%
% Colorizestring wraps the given string in html that colors that text.
colorizedstring = ['<font color="', color, '... |
function img = read_nii_slices(strPat)
% EXAMPLE
% strPat = './slice_*.nii';
% img = read_nii_slices(strPat);
% Author - Krisanne Litinas
% $Id: read_nii_slices.m 1516 2014-09-12 20:01:23Z klitinas $
% Get array of filenames
[strPath,~,strExt] = fileparts(strPat);
if isempty(strExt)
strPat = [strPat '.nii'];
els... |
function [sig1_nl,sig2_nl,ripple_nl,carajo_nl,veamos_nl,CHTM2,timeasleep2,RipFreq3]=newest_only_ripple_nl
%{
LOAD DATA, easy and quick.
timeasleep2=sum(cellfun('length',V9_nl))*(1/1000)/60; % In minutes
RipFreq3=sum(s17_nl)/(timeasleep2*(60));
The V signals are the monopolar recordings of the 4 channels.
The S sign... |
function makeTuples( obj, key)
tuple = key;
import vis2p.*
state = strcmp(fetch1(Scans(key),'stim_engine'),'State');
if state
if ~isempty(Scans(key,'exp_date > "2012-09-01"'))
stimPath = '/stor01/stimulation/Mouse';
else
stimPath = '/stor01/stimulation/Mouse2P1';
end
else
stimPath = '... |
strikes=linspace(0.8,1.2,11);
volvols=(0.1:0.1:0.4);
styleV={('-'),('--'),('-.'),(':')};
colourV={('k'),('b'),('r'),('m')};
prices=zeros(4,11);
pricem=zeros(4,11);
volatility=zeros(4,11);
for i=1:4
for j=1:11
pricem(i,j)=hestoncallquad(2,0.04,volvols(i),0.5,0.04,0.01,1,1,strikes(j));
price... |
function [psth,t,err] = psthByCondition(spikes,events,condition,minT,maxT,binT)
% psthByCondition Simple PSTH of neuronal firing by trial condition
% Usage:
% psth = psthByCondition(spikes,events,condition,minT,maxT,binT)
% psth = psthByCondition(spikes,events,[],minT,maxT,binT)
% [psth, t, err] = psthByCo... |
% Demo to extract frames and get frame means from a movie
% and save individual frames to separate image files.
% Then rebuilds a new movie by recalling the saved images from disk.
% Also computes the mean gray value of the color channels.
% And detects the difference between a frame and the previous frame.
% Illustrat... |
function histo_SHAPE(d, name)
if ~exist('name','var'); name = ''; end;
nbins = floor(length(d)/5);
if length(d) > 100;
nbins = nbins*2;
end;
[count,bins] = hist(d,nbins);
figure(); clf;
bar(bins,count/length(d)*100,'r');
legend(name);
ylabel('Count Percentage');
xlabel('SHAPE reactivity');
fprintf('"mean" = %d... |
% test for metric uniformization
n = 150;
% obstacles
x = linspace(0,1,n);
[Y,X] = meshgrid(x,x);
r = 0.2;
c = [0.5 0.5];
R = (X-c(1)).^2 + (Y-c(2)).^2 < r^2;
% constraint map
L = zeros(n) + Inf;
L(R==1) = -Inf;
options.constraint_map = L;
% start / end
clf;
imagesc(R); axis image;
[y,x] = ginput(2);
x0 = round([x(1)... |
# Estimates the basic Nerlove Cobb-Douglas model
1;
function m = nm(theta, data)
y = data(:,1);
x = data(:,2:columns(data));
e = y - x*theta;
m = diag(e)*x;
endfunction
function m = nm2(theta, data)
y = data(:,1);
x = data(:,2:columns(data));
e = y - x*theta;
x = [x st_norm(x(:,2:5).^2)];
m = diag(e)*x;
endfu... |
t = 0:1:5;
x = [1, 1.5, 2, 2, 2.5, 2.5];
y = [1, 0.5, 1, 1.5, 1.5, 1];
[bx, cx, dx] = ncspline(t, x);
[by, cy, dy] = ncspline(t, y);
fprintf('\nX:');
fprintf('\na:'); disp(x(1:length(x)-1))
fprintf('\nb:'); disp(bx)
fprintf('\nc:'); disp(cx)
fprintf('\nd:'); disp(dx)
fprintf('\nY:');
fprintf('\na:'); d... |
% Model-Based RL fit/ In this file I assumed 5 categories
% for my rewards
clc
clear
close all
% ======== design the Environment ======== %
NumOfBlocks = 9;
TestPhaseNum = 8;
PrestestBlock = 7;
NumOfTrials = 20;
MaxNumPerEps = 15;
GridSize = [4, 7];
NumOfState = prod(GridSize);
NumOfAction = 4;
FixedLock = [1, 2, 4, 1... |
% N = number of points to solve at
N = 20;
% range [a,b) to solve on
a = -1.;
b = 1.;
% discretize the x axis with N points [a,b)
x = linspace(a,b-(b-a)/N, N)';
% compute spacing (here dx is constant)
dx = x(2)-x(1);
% parameters
U = 2;
nu = 1;
% operator U*dudx + nu*d2udx2
alpha = U/dx;
beta = nu/(dx*dx);
d ... |
% Vlad Andrei-Alexandru, 311CB
function [R1 R2] = PageRank(nume, d, eps)
% Calculeaza indicii PageRank pentru cele 3 cerinte
% Scrie fgraful de iesire nume.out
fgraf = fopen(nume, 'r');
cardWeb = fscanf(fgraf, '%d', 1);
nume_out = strcat(nume, '.out');
fgraf_out = fopen(nume_out, 'w');
fprintf(fgraf_out, '%d... |
function res = double_pendulum()
syms x1 y1 x2 y2 t real
syms g m1 m2 l1 l2 real
syms V T L real
syms th1 th2 om1 om2 aa1 aa2 real
x1 = l1 * sin(th1);
y1 = -l1 * cos(th1);
x2 = x1 + l2 * sin(th2);
y2 = y1 - l2 * cos(th2);
vx1 = mydiff(x1, 1)
vy1 = mydiff(y1, 1)
vx2 = my... |
clear ; close all; clc
fprintf('Loading data ...\n');
%% Load Data
data = csvread('students.txt');
i = length(transpose(data(1:1, :)));
X = data(:, 1:i-1);
y = data(:, i);
m = length(y);
fprintf('Solving with normal equations...\n');
% Add intercept term to X
%X = [ones(m, 1) X];
b=sum(y)/m;
y=y.-b;
% Calculate the ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2018 Crypto4a Technologies Inc.
%
% Permission is hereby granted, free of charge, to any person obtaining a
% copy of this software and associated documentation files (the "Software"),
% to deal in the Software without restriction,... |
% Delete the non-connected components, remain m maximum connected components
% Author: Dongdong ma
% Date: 2020/03/10
function main_component = New_Improved_Non_main_component_delete(bw_Img,n,m)
[L,num] = bwlabel(bw_Img,n);
pixel_count = zeros(1,num);
for ii = 1:num
temp = L == ii;
pixel_count(ii) =... |
function [sol,errors, costos] = gauss_jacobi(A, b)
%Si A es una matriz de diagonal estrictamente dominante por filas,
%El método converge.
costos = 0;
epsilon = 7.326146437847726e-16;
% sol es vector solución
% error es el error final
% it es el numero de iteraciones final... |
function Hd = ddc_conf2_h1
%DDC_CONF2_H1 Returns a discrete-time filter object.
%
% M-File generated by MATLAB(R) 7.2 and the Signal Processing Toolbox 6.5.
%
% Generated on: 01-Mar-2007 15:28:28
%
% Equiripple Halfband lowpass filter designed using the FIRPM function.
% All frequency values are in MHz.
Fs = 61.44; ... |
function Pos = GetqparPos(obj,qparval)
% This function calculates the position in pixel for a given q parallel
% Parameters are:
% qparval : q parallel value
%
% The function returns:
% ---
%
% Copyright & Questions: Laboratory of membrane and protein dynamics, McMaster University,
% Sebastian Himbert (himbe... |
function [ hashedNumber ] = doubleHash( number )
%hash double number to string
hashedNumber=[];
if(isempty(number))
return;
end
[before,after]=SplitDecimalNumber(number); %split number before and after the dot
after =round( after*1000); % disable the double by multing 10*n... |
%=========Test code=========
% Test controller strategy generation and do simulation for hopping robot
%======================
clear all;clc;close all;
addpath(genpath('./'));
addpath(genpath('../abstr-ref/'));
addpath('../ArrayGener/');
%% Generate abstraction transient system
disp('Start generating transient syste... |
function input_data = dataobject_registration(input_data,regdirection,eoptions_cost_fun,eoptions_sep,eoptions_tol,eoptions_fwhm,roptions_interp,roptions_wrap,roptions_mask,roptions_prefix)
% DATAOBJECT_REGISTRATION
% Registers all relevent images in anatomical space to functional space
%
% data = batchspm_registration(... |
meanWeights = ["01","03","1","3","10"];
stdWeights = ["001","01","1","10"];
UniformMean = zeros(2,length(meanWeights));
LogMuMean = zeros(2,length(meanWeights));
LogSigmaMean = zeros(2,length(stdWeights));
ExperimentRateMean = zeros(2,length(stdWeights));
g_L = [182/18 119/8];
for ii = 1:length(meanWeights)
... |
im = imread('../../praca.jpg');
im_g = rgb2gray(im);
% Vetor que recebe o histograma %
[valor, bin] = imhist(im_g);
subplot(1,3,1);
imshow(im_g);
subplot(1,3,2);
bar(bin, valor);
subplot(1,3,3);
imhist(im_g); |
function [ ok ] = ndf_initialize_raser(config_file)
global runData;
runData = [];
config = IniConfig;
config.ReadFile(['../' config_file]);
runData.parameters = config.ToStruct();
runData.parameters.constants.nameActions = strsplit(runData.parameters.constants.nameActions.value, ',');
... |
function [SRBM] = generateCorrectedSRBM(M, N, S, K)
%GENERATESRBM Generate MxN (1,s)-sparse random binary matrix
if (M==S)
error("Number of ones per column equal to number of columns. Can't generate full-rank matrix.");
elseif (M>N)
warning("Matrix dimensions incorrect for compression.");
end
r = 0;
SRBM = ze... |
function [] = IndexMasks_Yeast(CellDirs, Device, ident)
for di = 1:length(CellDirs)
filePattern4 = fullfile([CellDirs{1,di},'\Segmentation'], 'exp*DIC_001.tif');
Files4 = dir(filePattern4);
% Get number of frames for channel
maxidM=length(Files4);
for i=1:maxidM
... |
function phaliwgp(varargin);
% phaliwgp( [...] );
% IWG1 Pres
h = timeplot({'Dynamic_Press','Static_Press'}, ...
'IWG1 Pres', ...
'Pres', ...
{'Dynamic\_Press','Static\_Press'}, ...
varargin{:} );
|
function [zr,ptr]=de_zone(biny,lenz,ptr)
lastBit=biny(ptr); ptr=ptr+1;
[flg,ptr] = deSFcode(biny,7,ptr);
switch flg
case 1
%fprintf('\n11111111111111111111111\n')
codebook=bin2dec(char(biny(ptr:ptr+4)+48)); ptr=ptr+5;
[r,ptr]=decode_stationary_source_sumr(biny,codebook,lenz,ptr);
zr=Golom... |
function [u1 u2 t] = rungekutta4(A,dt,u0s,limit)
%(classical 4th-order) Runge-Kutta method for a system of n ODEs for timestep dt with RHSides represented by A.
%assumption: the integration begins at t=0 and ends at 'limit'
%assign the starting values (u0s is the vector of starting values)
u(:,1) = u0s;
n = ceil(limi... |
function D = irpDiracFeld(size_y, size_x, delta_x, delta_y)
% D = irpDiracFeld(size_y, size_x, delta_x, delta_y)
% Erstellt ein Diracfeld.
%
% Parameter:
% 'size_x' Größe des Diracfeldes in x-Richtung
% 'size_y' Größe des Diracfeldes in y-Richtung
% 'delta_x' Abtastrate in x-Richtung
% '... |
% DisplayMower.m
distance_travelled = i*resolution; % pixels*(feet/pixel) = feet
time_elapsed_minutes = time_elapsed/60; % minutes
time_elapsed_hours = time_elapsed/(60*60); % hours
cut = sum(sum(G==3));
not_cut = sum(sum(G==2));
pct_complete = (cut/(cut + not_cut));
M=G;
% We keep the dis... |
close all; clear;
epochs = 1000;
sig1 = 2;
sig2 = 3;
v1 = sig1 * randn(epochs,1);
v2 = sig2 * randn(epochs,1);
figure
plot(v1,'k')
hold on
plot(v2+20,'--k')
legend("v1", "v2 + 20")
title("Two noises")
xlabel("Epochs")
z1 = 4+v1;
z2 = 4+v2;
figure
plot(z1,'b')
hold on
plot(z2,'r')
legend("z1", "z2")
title("Two signa... |
%parameter search
L = [5,5]*2;
N = [256,256]*2;
n = prod(N);
n0 = 0.07;
sigma = 0.01;
rng(1);
n0 = n0 + sigma*randn(N);
y0 = fftn(n0);
y0 = y0(:);
% y00 = y0(1);
% y0(1) = [];
% %use image?
% im = imread('cameraman.tif');
% im = imresize(im,N);
% C2 = fft(im);
% C2 = C2(:);
% C2(1) = 0;
% C2 = C2/max(abs(C2))/1.5;
[... |
% Generate US 1976 Standard Atmosphere Tables as matfiles
clear
[Z Z_L Z_U T P rho c g mu nu k n n_sum] = atmo(1000, .01);
save('AtmosTable'); % Add '-v7.3' flag if planning on using n |
function [deltaIMG] = subtractImg(foreground, background)
% not compatible with older versions of MATLAB
%foreground = imgaussfilt(foreground, 2);
%background = imgaussfilt(background, 2);
% for compatibility with 2013b
gauss = fspecial('gaussian', 7, 2);
foreground = imfilter(foreground, gauss);
background = imfilte... |
%% User-provided function returning bounds on the Jacobian matrices
% The user can either provider global bounds, or a function of the input
% arguments (t_init,t_final,x_low,x_up,p_low,p_up) returning local bounds
% Jacobian definitions:
% to states: J_x(t) = d(System_description(t,x,p))/dx
% to inputs: J_p(t) =... |
% k-means segmentation experiments
% Author: Jin Yeom (jinyeom@utexas.edu)
% Seed the random number generator with 1.
rng(1);
% Test images.
I = im2double(imread('images/gumballs.jpg'));
J = im2double(imread('images/twins.jpg'));
K = im2double(imread('images/snake.jpg'));
L = im2double(imread('images/car.jpg'));
% P... |
%% generate a bunch of different stims
load 'C:\Users\Shreejoy\Desktop\shreejoy\neural_diversity\ST_machinelearn\reconKP\decoding\alphaStimCovMat';
slen = 3000; %stim length (tpts)
slenBurn = 50;
corrVec = stimCovMat(1,1:14);
corrVec(end+1:slen+slenBurn) = 0;
stimCovMat = toeplitz(corrVec);
numStims= 1;
cholMat = ch... |
sec_id_from_obsrv = xlsread('C:/Users/uos/Documents/Gaussian_Process/DataFromMatlab/section_id_vs_ID/sec_id_from_obsrv.xlsx','A1:KG1');
sen_id_from_obsrv = xlsread('C:/Users/uos/Documents/Gaussian_Process/DataFromMatlab/section_id_vs_ID/sen_id_from_obsrv.xlsx','A1:KG1');
obsrv_index_id = [];
pos_obsrv_index_id = [];
... |
function [normalized] = normalize_var(array, x, y)
%Function to normalize an array to a given range
% Normalize to [0, 1]:
m = min(array);
range = max(array) - m;
array = (array - m) / range;
% Then scale to [x,y]:
range2 = abs(y - x);
normalized = (array*range2) + min(x,y);
|
function [ error_of_image ] = compute_error(ground_truth_points, detected_points)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%函数功能:计算单个样本误差
%输入:
%ground_truth_points:真实形状
%detected_points:检测到的形状
%输出:
%error_of_image:单个样本误差
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
num_points = size(ground_truth... |
%{
% "A note on the extended rosenbrock function" Evol. Comp. 2006
% claims that for d=4 to 30 dims there are 2 local minima, at [1,1,...1] and
% and near [-1,1,...,1].
% Let us verify this for d=4 and d=5
%xstart = [-0.77565923 0.61309337 0.38206285 0.14597202]';
xstart = [-0.96205109 0.93573953 0.88071386 0... |
clc;clear;clf;
Tc = 304.2;
Pc = 73.8;
omega = 0.224;
R = 83.3144;
T = 250:10:400;
Tr = T ./ Tc;
f0 = 0.13356 - 0.30252./Tr - 0.15668./Tr.^2 - 0.00724./Tr.^3 - 0.00022./Tr.^8;
f1 = 0.17404 - 0.15581./Tr + 0.38183./Tr.^2 - 0.44044./Tr.^3 - 0.00541./Tr.^8;
Br = f0 + omega.*f1;
B = Br.*R.*Tc./Pc;
out = load ('C:\Use... |
function [x, it] = bootstrap_second_derivative_plus_previous(inner_solver, target_alpha, v, R, tol, maxit, relspeed)
% Calls an inner solver iteratively over increasing values of alpha
% Predicts the new x using a 2nd order Taylor expansion plus the old x.
if not(exist('tol','var')) || isempty(eps)
tol = sqrt(eps)... |
clc
clear all
close all
% Simulación de un resonador
% Dependiendo de la función empleada se simula
% - Resonador plano paralelo/confocal con pupila circular [PupilaCircular()]
% - Resonador plano paralelo con pupila rectangular [PupilaRectangular()]
% - Resonador confocal con espejos de s... |
function [eta,pwr,tmp,voltage,current]=build_fc_eff_curve(pwr_map,tmp_map)
init_conds_amb;
if evalin('base','exist(''vinf.run_without_gui'')')&evalin('base','vinf.run_without_gui')==1
gui_flag=0;
else
gui_flag=1;
end
if gui_flag
h = waitbar(0,'Please wait...');
set(h,'Windowstyle','modal');
end
... |
clear all; close all;
clc;
thetamax=pi/50;
%5
%a=input('Enter slit width (in micro meter): ');
a=200*1e-6;
%d=input('Enter slit seperation (in mm): ');
d=0.25*1e-3;
%l=input('Enter wavelength (in nm): ');
l=532*1e-9;
s=1.3;%=input('Enter slit to screen distance (in m): ');
... |
function [ I ] = FormingRestrictOps( N,N0 )
% this function produces lift and restrict operators (ops). all restrict
% ops, i.e. I_h^2h, or more descriptively, flat matrices, are produced.
% the corresponding lift ops is 4I'.
% the algorithm looks very stupid, because it calculates the indices and
% the value vecto... |
function [eigenvalues, eigenvectors, Mean_Vector]=PCA2(X,N)
%Compute the eienvectors of X when the sample number is larger than the feature lenght
[Row Column]=size(X);
Mean_Vector=mean(X,2);
m=repmat(Mean_Vector,1,Column);
X=X-m;
C=X*X'./Column;
[V,D]=eig(C,'nobalance');
eigenvalues=diag(D);
%Ordered ... |
function [ number ] = note_to_number( note )
%NOTE_TO_NUMBER Converts a note character to an integer.
% Notes are 'A', 'C', 'E', and '.'. Numbers are 1, 2, 3, 0 respectively.
number = 0;
if (note == 'A')
number = 1;
elseif (note == 'C')
number = 2;
elseif (note == 'E')
number =... |
% Cryptographie chaotique
% ***********************
%
% Superposition : Bob
% -------------------
disp('Bob');
%% 1 - Verrouillage du système de Bob sur celui de Alice
%% 1.1 - Initialisation
% Paramètres
q = 0.95; % Parfait à eps près pour q >= 0.25
p = 1-q; % MG'(t) = p*f(MG'(t-tau)) ... |
clear all;close all;
parameter=struct('interval_x',[0 1000],... %(m)
'interval_y',[0 1000],... %(m)
'interval_speed',[1 20],... %(m/s)
'velocity', 10,... %(m/s)
'interval_direction',[0, 2*pi],...%(rad)
'ra... |
function restore_prompt(files,sett)
% ask user to replace content of current Ras folder with
% another Ras project
%
% Param : files, a Files_ obj
%
% Param : sett, a Settings_ obj
%
% Written by Ronan Deshays for IMTLD, July 2020
global db_enabled
if db_enabled==1
[project_folder,~,~]... |
% Aufgabe 2
disp('the given matrix is: ')
T = [0 0 1 5; 0 1 0 0; -1 0 0 0; 0 0 0 1]
p = SE3(T); % Konvertiere Matlab Matrix is SE3 Objekt -> Spezieller Euler Raum
disp('nur die durch die SE3 Objekt beschriebene Rotation: ')
p.SO3
disp('roll pitch yaw: ');
p.torpy();
disp('roll pitch yaw in grad: ')
p.torpy('deg')
... |
clear all
close all
clc;
%input data
A = importdata('real.txt');
class1 = A([1:350],[1:2]); %class 1
class2 = A([501:850],[1:2]); %class 2
class3 = A([1001:1350],[1:2]); %class 3
cl1 = A([351:450],[1:2]); %class 1
cl2 = A([851:950],[1:2]); %class 2
cl3 = A([1351:1450],... |
function [alpha,exitflag,lambda,K] = uq_SVC_compute_alphas( X, Y, current_model )
%UQ_SVC_COMPUTE_alpha computes the SVC expansion coefficients (alpha)
% given a training set, a kernel function and a set of hyperparameters :
% This function uses a solver Matlab's quadprog (which requires the
% optimization toolbox lice... |
function wrapDPARSFA(filename, subject_list, working_dir, parallel_workers, scrubbing, timepoints)
if parallel_workers > 0
mypool = parpool(parallel_workers);
pctRunOnAll addpath('/usr/local/MATLAB/R2017b/toolbox/spm/spm12')
%pctRunOnAll addpath( genpath( '/usr/local/MATLAB/Toolboxes/DPABI_V2.0_151201/'))
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 本函数用于期货每天成交量、持有量和资产总值。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [volume,account,tradingCost,accountNoCost,position] = calc_account(bars,signal,configure)
%% resolve input parameter.
multiplier = co... |
clc ; clear;
fprintf('原始数据为:\n');
% 每次修改这里的原始数据, 个数最好是2^n
% x = [9 7 3 5]
% x = [2 5 8 9 7 4 -1 1]
x = [2 5 8 9 7 4 -1 1 2 1 8 3 8 0 3 1]
order_max = log(length(x))/log(2);
fprintf('当前数据最多分解%d阶\n',order_max);
order = double(input('自定义分解阶数order(<order_max):'));
% matlab默认的haar小波基函数:
low = [1/sqrt(2) 1/sq... |
axis([0 800 -800 0])
load pixel.dat
ax = pixel(:,1)
ay = pixel(:,2)
plot(ax, ay, 'r+'); |
function res=PsiStat(x, xt)
xt(xt==0)=1e-2;
x(x==0)=1e-2;
s=0.5*(abs(x)+abs(xt));
res=sum(sum(abs(xt).*abs(log(abs(xt./s)))+abs(x).*abs(log(abs(x./s)))));
if isnan(res)
display("SHEET")
end
res=res/sum(sum(xt));
end |
function bin=en_2n_code_sub(c,n,len)
if n>0.5
bin=dec2bin(c-1,n);
bin=reshape(bin',1,n*len);
bin=uint8(abs(bin)-48);
else
bin=[];
end
|
path = [0 0; 7 7; 7 17; 0 27; -7 17; -7 7; 0 0];
robotInitialLocation = path(1,:);
initialOrientation = 0.78;
robotCurrentPose = [robotInitialLocation initialOrientation]';
sampleTime = 0.001;
vizRate = rateControl(2/sampleTime);
k = 1;
realPoseY = 0; realPoseX = 0;
realPoseY(k) = 0; realPoseX(k) = 0;
realW1... |
function [itd,tl,tr] = computeITD(h,sr)
% COMPUTEITD computes delays in seconds from the HRIRs in h.
%
% SYNOPSIS: [itd,tl,tr] = computeITD(h,sr)
%
% INPUT h: a mxnx2 matrix of HRTFs where m is the number of FFT bins,
% n is the number of HRTFs, the third dimension correspons to
% the the left (1) ... |
% main10c MATLAB main program for Kernel pdf estimation
% Course 02457, November 2012, LKH
% Simple kernel GP applied to the sunspot data
%
clear, close all
%
d=5; % input dimension of sunspot prediction
[train_x,train_t,test_x,test_t] = getsun(d);
var=std([train_t',test_t'])^2;
%
Ntest=length(test_t);
Nsig2=20... |
clear all;
close all;
clc;
%%% read with sensor data
fid = fopen('homeA-motion\2012-May-25.csv', 'rt');
a = textscan(fid, '%s %f %f', ...
'Delimiter',',');
fclose(fid);
%%%
data = [a{2} a{3}];
a = a{1};
index = find(strcmpi(a,'master:corner'));
% b = unique(a);
clear a;
data = data(index,:);
date = datevec(data(:... |
clear, clc, close all,
%% Generate Gaussian data:
R1 = mvnrnd([2;2],0.02*eye(2),50);
R2 = mvnrnd([-2;2],0.05*eye(2),50);
R3 = mvnrnd([0;-3.25],0.07*eye(2),50);
scatter(R1(:,1),R1(:,2),'r');
xlabel('Feature 1');
ylabel('Feature 2');
title('Scatter of 3 Clusters of Dataset');
hold on
scatter(R2(:,1),R2(:,2),'g');
sca... |
function file_move_by_key(varargin)
F1 = gcf;
f_name = varargin{3};
if_fit = varargin{4};
[f_size,~] = size(f_name);
update_file_index(varargin{2}.Key,f_size);
f_num = getappdata(F1,'f_num');
header = show_data(F1,f_name(f_num).name);
if if_fit && header.nADCNumChannels~=1
poi_x ... |
%% Script to demonstrate how to do a nonlinear reconstruction
clear all;close all;clc
%% Create a phantom and sensitivity maps
R=6;
dim=256;
dynamics=10;
coils=4;
img=repmat(phantom(dim),[1 1 dynamics]);
csm=gaussianCSM(coils,[dim dim]);
%% Linear reconstruction
% Multiply true images with sensitivity map... |
%% interpo.m
function newPath = interpo(path,num)
len = length(path);
newPath = zeros((len-1)*num +1 ,2);
N = 1;
newPath(1,:) =path(1,:);
for i = 1:length(path)-1
node1 = path(i,:);
node2 = path(i+1,:);
for t= 1/num: 1/num :1
newnode = [1-t,t] * [node1;node2];
N = N +1;
newPath(N,:) ... |
%% Culling with cell selection during follicular atresia
function s = atresiaCulling(s,k,xi)
s1 = s(2,:)./sum(s);
N = round(numel(s1)/8); %%% sample size
W = max(1-k*s1.^xi,0); %%% fitness
s1 = randsample(1:numel(s1),N,true,W); %%% culling
s = s(:,s1);
end |
function display(p)
% disp([10 'panel: (' num2str(p.fig) ', ' int2str(p.id) ')' 10])
disp([10 '(Panel Object, id ' int2str(p.id) ')'])
if isnumeric(p.fig) && isscalar(p.fig) && ishandle(p.fig) && strcmp(get(p.fig,'type'), 'figure')
if ~isempty(p.id)
[P, panelroot] = getpanel(p);
if isempty(P)
... |
function SCHED_EOS_down_selection_constraints()
assert_down_selection_rule('min-data-continuity',0.95);
assert_down_selection_rule('min-discounted-value',0.95);
assert_down_selection_rule('min-utility',0.6);
assert_down_selection_rule('min-pareto',5);
%assert_down_selection_rule('max-risk',3);% max diff in TRL = 3
%ass... |
Ns=size(fXs,1);Ni=size(fXi,1);
trn=1:round(size(x,3));
rtrn=1:round(size(rx,3));
% trn=1:30;
%tst=(round(size(Xi,2)/2)+1):size(Xi,2);
% KSRDL
optionKSRDL.lambda=0.1;
optionKSRDL.SCMethod='nnqpAS'; % can be nnqpAS, l1qpAS, nnqpIP, l1qpIP, l1qpPX, nnqpSMO, l1qpSMO
optionKSRDL.dicPrior='uniform'; % can be uniform, Gaussia... |
function [E, m, n] = readErr(fname)
% [E, m, n] = readErr(fname) reads the flow erros from a file
%
% E is the error matrix containing angular differences (in rad) for each
% image location. m is the mean angular error and n is the number of
% elements taken into account to calculate n.
% E may contain two distinct val... |
function population = InitializePopulation(populationSize, numberOfHiddenNeurons)
%Assuming 3 input terminals and 2 output neurons.
numberOfFirstLayerParameters = 3*numberOfHiddenNeurons + numberOfHiddenNeurons;
numberOfOutputLayerParameters = numberOfHiddenNeurons*2 + 2;
chromosomeLength = numberOfFirstLayerPa... |
%%
% For a Given Photodiode,
% Given a Fixed Voltage betwen photoresistor, Find the relation of light
% and Ampere.
%%
clear
clc
close all
dirpath='./figures';
if ~exist(dirpath,'dir')
mkdir(dirpath);
end
for i = [2 4 6 8]
AnalyzeData(i)
end
function AnalyzeData(photodiode_volt)
sampling_resistor=1.002... |
data = csvread('aggregate_data.csv', 1, 0);
SCENARIOS = data(:, 1);
ALGORITHMS = data(:, 2);
NFFT = data(:, 3);
COMPONENTS = data(:, 4);
OPS = data(:, 9);
TPS = data(:, 10);
IPS = data(:, 11);
APS = data(:, 12);
TRAINTIME = data(:, 13);
SEPTIME = data(:, 14);
RESPONSE = [OPS TPS IPS APS TRAINTIME SEPTIME];
PARAMS = [SC... |
% Lab 1
% ADC
% observing the effect of samplign freq and sampling period
close all;
clear all;
clc;
F = 2; % continuous signal freq
t = 0:0.0001:1; % cont time scale
xt = sin(2*pi*F*t); % cont signal
% tweak the sampling frequency, Fs, ans observe change in sampling periods
Fs = 8; % sampling freq /rate
nts = 0:1... |
%This sample script shows how to generate pulse stimuli one at a time during an experiment using the generateTrial.m
% function. A frozen noise stimulus is shown every frozenInterval trials throughout. This function sets up the random
% number generator seeds to use. Right now, it will generate the same set of trials e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.