text stringlengths 8 6.12M |
|---|
function sortedPoints = sortingPoints(centerLinePoints)
[q,w] = sort(centerLinePoints(:,3));
sortedPoints = fliplr(centerLinePoints(w,:)')';
|
function [H,err,ts] = ANLS(A, k, params, max_E)
normA = norm(A,'fro');
timelimit = params.timelimit;
[n,r] = size(params.Hinit);
for i = 1:max_E
[Ht,~,~,ts] = symnmf_anls(A, k, params);
params.Hinit = rand(n,r);
if i == 1
H0 = Ht;
err0 = norm(A-H0*H0','fro')/normA;
t0 = ts;
... |
number_of_sub = input('Number of subjects = ');
constraint = zeros(number_of_sub, number_of_sub);
color = -ones(1,number_of_sub);
for i=1:number_of_sub
for j=1:number_of_sub
str = input('Enter condition = ','s');
if str(1) == 'y'
constraint(i,j) = 0;
constraint(j,i) ... |
k = 5;
ktype = 'l';
kparam = 2;
C = 2;
lambda = 0.002;
traindata = csvread('ABMD_pmood_3yr.csv')-csvread('ABMD_nmood_3yr.csv');
trainprice = csvread('ABMD_price_3yr.csv');
% siz = size(traindata);
preX = [traindata(1:end,2)';trainprice(1:end,2)'];
pX=zeros(2*k,size(preX,2)-k);
for i = 1:size(pX,2)
pX(:,i) = [preX(1... |
function C = nuft_back_gridding(V0, px, py, Mr, E2x, E2y, E3x , E3y)
% Backward fast Gaussian gridding.
% Consider using the MEX version which is much faster.
%
% Copyright, Matthieu Guerquin-Kern, 2012
Nb = numel(V0);
Msp = numel(E3x)-1;
C = zeros(Mr);
px = double(px);
py = double(py);
%% First dummy version (W... |
clear all
clc
choice=input ("first=1, second=2 or third=3");
if choice == 1
A=[1,2,1;2,5,3; 1,3,3];
b=[4;10;7];
elseif choice == 2
A=[2,7,-2;1, -2,2; 3,-2,1];
b=[7,19,-5];
elseif choice == 3
A=[1,2,3,4;2,5,1,10; 3,1,35,5;4,10,5,45];
b=[9;35;-45;189];
endif
[lines,columns]=size(A);
R=chol(A);
if (lines~... |
function LIKV = vraissemblance_Pvar(x_v)
%fonction de vraisemblance d'un modèle MS-AR à probabilités de
%transition variables
%Calcule également, puisque nécessaire au calcul de la vraisemblance,
%les probabilités filtrées du modèle
global endog;
global exog_trans;
% definition des parametres
c=x_v(3... |
function MLE=GEGA2EGA(GMLE,allowed)
% verificato, algoritmo corretto
%
%
%
%
[m,n,slots]=size(GMLE);
if (m~=n)
error('tabella non valida')
else
T=m-1;
end
clear m;
clear n;
p=1./(2.^[1:slots]);
MLE=zeros(T,T,slots);
% giusto per scrupolo
allowed=unique(allowed);
for l=1:slots
for c=0:T
for s=0:... |
function Lecture (~,~)
FlagLecture=~getappdata(gcbf,'flag_lecture');
setappdata(gcbf,'flag_lecture',FlagLecture);
if FlagLecture~=true
Lecture1;
else
Lecture2;
end
end
|
function [ angle, funcVal ] = findBestFit(target, A, B, s_angle, interval, s_end, method)
angle = zeros(1, floor((s_end - s_angle)/interval) + 1);
funcVal = zeros(1, floor((s_end - s_angle)/interval) + 1);
count = 1;
for theta = s_angle:interval:s_end
source = getMovingImage(A, B, theta);
... |
function variable=read_dyna_result(filename,nelem)
fid=fopen(filename);
variable=zeros(nelem,1);
get_nextline(fid);
get_nextline(fid);
while 1
s = get_nextline(fid);
if(strcmp(s,'*END'));
break
end
tmp = sscanf(s, '%d %f');
variable(tmp(1))=tmp(2);
end
fclose(fid);
%END FUNCTION
end
% Get ... |
%% 用V系统特征提取
close all
clear all
example=13;
switch example
case 1
% 实验1
x=0:0.005:1-0.005;
f=90./(1+exp(-100*(x-0.5)));
% M=length(x);%采样点个数
% N=32;%基函数个数
xmax=1;
case 2
% 实验2
x=0:0.002:1-0.002;
f=100./exp(abs(10*x-5))+(10*x... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Experiment: Effect of orientation-tuned surround suppression
%
% - Generate new fits for *one* voxel, on *several* new contrast images
% - Compare with old fits, from existing contrast images
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function [Ps,Pt,S,lambda1,lambda2] = CCA(Xs,Xt)
[ds,ns] = size(Xs);
[dt,nt] = size(Xt);
[lambda1,lambda2]=tuneRe(Xs,Xt);
Css = 1/ns*(Xs*Xs') + lambda1*eye(ds);
Ctt = 1/nt*(Xt*Xt') + lambda2*eye(dt);
W = ones(ns,nt);
Cst =Xs*W*Xt';
% eigvalue decomposition
[Ps,Pt,S] = eigDecomposition(Css,Ctt,Cst); |
function [ J ] = HistogramSpecificate( I,t )
%HistogramSpecificate 设一幅大小为M×N的灰度图像I中,灰度为g的像素数为h(g),另给定一个直方图t(g)。
%请写出对图像I进行变换的方法,使得变换后的新图像的直方图与t相同(近似相等)。
[M, N ] = size(I);
J = zeros(M, N);
h = zeros(1,256);
%求直方图h
for x = 1:M
for y = 1:N
h(I(x,y)+ 1) = h(I(x,y)+ 1)+1;
end
end
%求累积分布rh和rt
rh = zeros(1,... |
%
% Plot an estimated color ellipsoid from some study
%
cd /home/brian/book/09col/fig/subOpponentB
%
% Use the old data to illustrate and ellipsoid
% These are the data in 650nm and 540 nm coordinates
%
load ellJOSA
plot(ell(:,1),ell(:,2),'+')
%
% Convert the physical representation to LMS cones
% Take the ell intensit... |
function [bb, aa] = Constant_Q_Filter(Q, f0, fs, fig_num, limiter, N)
% [bb, aa] = Constant_Q_Filter(Q, f0, fs, fig_num, limiter, N)
% Inputs:
% Q = Quality factor of Q = f0/HPBW
% f0 = Center Frequency
% fs = Sampling rate
% fig_num = figure num for tested filter if needed
% Output
% bb = zeros, numerator coe... |
function mYy = mask_Yy(Yy) %#codegen
[~, ncol] = size(Yy);
mYy = Yy;
for icol = 1:ncol
if any(mYy(:,icol)==1)
mYy(1:find(Yy(:,icol)==1,1),icol)=1;
else
mYy(:,icol)=1;
end
end
|
function stego=lsb_embed_steg(cover,secret_text,x,y,block_width)
stego=cover;
block=cover(x:x-1+block_width,y:y-1+block_width);
block_byte=reshape(block,1,[]);
protext=dec2bin(length(secret_text),24)-'0';
x_pos=dec2bin(x,10)-'0';
y_pos=dec2bin(y,10)-'0';
stego(1,1:24)=bitand(stego(1,1:24),254)+uint8(protext);
stego(1,2... |
x1a=-3:0.01:+3;
x2a=+sqrt(9.-x1a.*x1a);
x2b=-sqrt(9.-x1a.*x1a);
x1c=-4:0.1:+4;
x2c=1./x1c;
sx=[ 2.981 0.3355 -0.3355 -2.981]; sy=[0.3355 2.981 -2.981 -0.3355];
plot(sx,sy,'*k','markersize',20,'linewidth',2,x1a,x2a,'-k','linewidth',3,x1a,x2b,'-k','linewidth',3,x1c,x2c,'--k','linewidth',3)
axis([-4 +4 -4 +4])
%xl... |
load network.mat
% Extract the first convolutional layer weights
w = cifar10Net.Layers(2).Weights;
% rescale the weights to the range [0, 1] for better visualization
w = rescale(w);
%%
% Load the ground truth data
data = load('stopSignsAndCars.mat', 'stopSignsAndCars');
%%
stopSignsAndCars =... |
function [fl, mask] = ismv(f, mask, vsz, r, tol, maxit, verbose)
%ISMV Iterative spherical mean value method.
%
% [fl, mask] = ISMV(f, mask, vsz, [r], [tol], [maxit], [verbose]);
%
% Inputs
% ------
% f unwrapped field/phase (3d/4d array).
% mask binary mask of region of interest (3d ... |
clear
clc
% CSA Qn2
% Buffers 0.25*Qn2
% SCF 0.5 *Qn2
% ADC Qn2
% Previous Cf = 0.9 pF DCal mode, Cf = 45 pF SDT mode.
%CD = 20pF;
%tpulse = 308ns;
%36.9pC STD mode.
%36.9pC/100 DCal mode. tal vez /100
FSR = 1;
NB = 10;
LSB = FSR/(2^NB-1);
Qn2 = LSB^2/12;
gamma... |
%Oppgave 3
fid=fopen('dat.dat','r');
nyf=[];
while ~feof(fid)
tline = fgetl(fid);
a=textscan(tline,'%s %d %d %d %d','Delimiter',',');
b1=a{1};
b2=char(b1(1));
f=regexp((b2),'[1-9]');
b3=b2(f(1):f(2));
b4=str2num(b3);
b5=int32(b4);
a{1}=b5;
nyf=[nyf;cell2mat(a)];
nyf1 = ... |
function [Sout,PS] = pulseShaper(Sin,nSpS,PS)
% Last Update: 31/03/2019
%% Input Parser
[nPol,nSamples] = size(Sin);
%% Select Pulse Shaping Filter
switch PS.type
case {'Rect','rect','rectangular','none'}
for n = 1:nPol
Sout(n,:) = rectpulse(Sin(n,:),nSpS);
end
case {'RC','raised... |
function pass = uq_LRA_test_LRA2PCE( level )
% UQ_LRA_TEST_LRA2PCE( LEVEL )
%
% Summary:
% Test for the transformation of PCE coefficients to LRA coefficients.
%
% Settings:
% LEVEL = { 'normal', 'detailed' }
%
% Details:
% Asserts that it is possible to cast a PCE model as an LRA model.
% First a PCE me... |
%19_11
w = input("Enter the weight in lb: ");
TA = input("Enter TA in lb: ");
TB = input("Enter TB in lb: ");
t = input("Enter the time: ");
R = input("Enter the radius in ft: ");
Io = .5*(w/32.2)*R^2;
AngV = (0 + TB*t*R - TA*t*R)/Io;
sprintf("The angular velocity is %.2f rad/s", AngV)
|
function [bool] = isSingle(x)
s = size(x);
dim1 = s(1);
dim2 = s(2);
bool = (dim1 == 1 && dim2 == 1);
end %end isSingle(x) |
function [ Re, virtauksen_tyyppi ] = reynolds( U ,d)
%Tämä funktio laskee Reynoldsin luvun ja palauttaan virtauksen tyypin.
%Parametrit
%U - virtauksen nopeus (m/s)
%d - putken halkaisija (m)
p0 = 1.192; %Ilman tiheys (kg/m3)
myy = 1.833*10^-5; %Ilman viskositeetti Pa*s
%Reynoldsin luku.
Re = p0*U*d/myy;
% Jos Re <... |
diff=0;
vektor = -2:0.003:2;
faktor1 = 0.5;
faktor2 = 2;
schrittweite = 0.001;
anzahlIterationen = 300;
momentumsFaktor = 0.1;
tanhParameter = {3,0.6,0}; % {a,b} -> a*tanh(b*in)
gewichtsInitialBelegung = -1;
in1 = 0.3;
strc = [1,50,2];
comp = [faktor1*in1 faktor2*in1]';
net = generate_ta... |
function load_search_heuristic_rules
%% load_search_heuristic_rules.m
global params
r = global_jess_engine();
% if strcmp(params.MODE,'SELECTION')
% r.eval(['(bind ?search_heuristic_rules_clp "' params.search_heuristic_rules_selection_clp '")']);
% elseif strcmp(params.MODE,'PACKAGING')
% r.eval(['(bind ?sea... |
function [ hash ] = meshHash( points,normals )
%[ hash ] = meshHash( points,normals )
% returns integer hash code to identify mesh
ph = round(sum(points)*10);
if exist('normals','var')
nh = round(sum(normals)*10);
ph = ph+nh;
end
ph = abs(ph);
hstring = [num2str(ph(1)), num2str(ph(2)), num2str(ph(3... |
function price = AmCallLattice(S0,K,r,T,sigma,N)
deltaT = T/N;
u=exp(sigma * sqrt(deltaT));
d=1/u;
p=(exp(r*deltaT) - d)/(u-d);
discount = exp(-r*deltaT);
p_u = discount*p;
p_d = discount*(1-p);
SVals = zeros(2*N+1,1);
SVals(N+1) = S0;
for i=1:N
SVals(N+1+i) = u*SVals(N+i);
SVals(N+1-i) = d*SVals(N+2-i);
end
PVals = z... |
function tb = getMktCap(tb, lag, ispanel)
if nargin < 2, lag = []; end
if nargin < 3 || isempty(ispanel), ispanel = false; end
try
cap = loadresults('mktcap');
catch
cap = loadresults('mktcap','..\results');
end
try
cap = lagpanel(cap,'Permno',lag);
catch
cap = sortrow... |
close all; clear all; clc;
nu1 = 2625;
nu2 = 7280;
nu3 = 10000;
nue = 20000;
nu1_r = nu1/nue;
nu2_r = nu2/nue;
nu3_r = nu3/nue;
z1 = exp(2*i*pi*nu1_r);
z1c = exp(-2*i*pi*nu1_r);
z2 = exp(2*i*pi*nu2_r);
z2c = exp(-2*i*pi*nu2_r);
z3 = exp(2*i*pi*nu3_r);
z3c = exp(-2*i*pi*nu3_r); # on calcule les zero
... |
function eulerCauchy(a,b,yt0,n)
%input
%a=valor inicial (Intervalo)
%b=valor final (Intervalo)
%yt0= valor inicial
%n= cantidad de intervalos
x=zeros();
y=zeros();
h=(b-a)/n;
x(1)=a; %el primer valor para x
y(1)=yt0;
for i=1:n
x(i+1)=a+h*i;
k1=feval(fun,x(i),y(i));
k2=feval(fun,x(i+1),y(i)... |
function data = recorStimulusWord (Words,nRep, trialDur,genderSubject)
initializeAudapter (genderSubject)
%%
close all;
% monitorSize = get(0,'Monitor');
% if size(monitorSize,1) == 1
% figPosition = [1 200 monitorSize(3) monitorSize(4)-200];
% elseif size(monitorSize,1) == 2
% figPosition = [monitorSize(2,1) m... |
%% set ca mean
blWinMs = [-97 -1];
blWin = eventFrameNum + (floor(blWinMs(1)/frameLength) : floor(blWinMs(2)/frameLength)); % eventFrameNum-3:eventFrameNum % 3 frames preced event.
% ca mean on the avage-trial trace
blPrecedEvent = nanmean(aveTrsPerNeuron(blWin,:)); % 1 x units, ca mean within blWin for each neur... |
clc;
clear;
load('Data/c.mat');
idx = 1:1:50;
[trainX, trainY, testX, testY] = myPrepare(n,c);
A = trainX;
b = trainY;
[Q,R] = mgsqr(A);
beta = linsolve(R(1:n,1:n),Q(:,1:n)'*b);
Merr = mean(abs(testX*beta - testY)./testY);
base = Merr * ones(50,1);
res = zeros(50,1);
for i = 1:50
[trainX, trainY, testX, tes... |
function this = defineSystemFunc(this, m)
% defineSystemFunc Define all valid system prior functions.
%
% Backend IRIS function.
% No help provided.
% -IRIS Macroeconomic Modeling Toolbox.
% -Copyright (c) 2007-2017 IRIS Solutions Team.
%----------------------------------------------------------------------... |
function [imu_sub, cam_sub, laser_sub] = initial_sub()
laser_sub = rossubscriber('/scan');
imu_sub = rossubscriber('/imu');
cam_sub = rossubscriber('/telemetry');
end |
function [output, direction] = DrawChildrenNodes(rank_node, t, lambda_mat, rank_left_child, rank_right_child, keep_all)
% draw t-step children nodes of rank_node (scalar)
% 'lambda_mat', 'rank_left_child', 'rank_right_child' are global variables
if nargin < 6
keep_all = 1; % keep all levels or just the very last c... |
function V=errperf(T,P,M)
%ERRPERF Determine various error related performance metrics.
%
% ERRPERF(T,P,M) uses T and P, which are target and prediction vectors
% respectively, and returns the value for M, which is one of several error
% related performance metrics.
%
% T and P can be row or column vectors of the same... |
function [ I_data, T_data ] = datagen_rank3e( num_points, len_sub, start )
IN = annealing(1/num_points,1,num_points)';
OUT = ((6*IN-2).^3-2*(6*IN-2).^2-4*(6*IN-2)+12)/30;
mat = [IN OUT];
[n m] = size(mat);
A = mat(randperm(n), :);
INP = A(:,1);
OUTP = A(:,2);
if (start+len_sub-1<=num_points)
I_data =... |
function x_opti = optimizationTools(fun,strategy,AA,b,Aeq,beq,lb,ub,nonlcon)
% Details: Utility function that connects to different matlab optimization schemes
%
% inputs:
% fun - Function handler for optimizable function
% strategy - Optimization strategy
% AA - Linear inequality matrix
% b - Right hand side ve... |
classdef WeekDays
enumeration
Monday, Tuesday, Wednesday, Thursday, Friday
end
methods
function tf = isMeetingDay(obj)
tf = ~(WeekDays.Tuesday == obj);
end
end
end |
% Part 3
t = [0:.01:2]
y = .1-(.1*exp(-6*t).*cos(8*t))-(.075*exp(-6*t).*sin(8*t));
plot(t,y);
title('Mechanical Vibration System');
xlabel('t');
ylabel('x(t)');
|
function cs = structcat(dim, s, varargin)
% STRUCTCAT - Concatenates fields of multiple separate data structures along the specified dimensions.
%
% STRUCTCAT takes multiple structures with identical field names and layouts and concatenates the data associated with
% each field together. This function is most useful wh... |
%% usual cleaning
close all;
clear;
clc;
%% paramater GA
% Mengatur Parameter Algoritma Genetika
% Jumlah individu dalam populasi
NIndividu = 100;
% Jumlah variabel dalam fungsi objektif
NVariant = 2;
% Maksimal Iterasi
NIteration = 300;
% Nilai Batas ,
% format Batas:
% { [Batas_Variabel_1;Batas_Variabel_2; Batas_... |
function R = quat2rotmat(q)
threshold = 1e-6;
if norm(q)-1 > threshold
error('Input must be a unit quaternion. norm(q): %f\n', norm(q))
end
eta = q(1);
e = q(2:4);
S = crossProdMat(e);
% Equation 10.37
R = eye(3) + 2*eta*S + 2*S*S;
end |
function answer = containsEventFcn(hFigs, PropertyName, funHandle)
% Author: Vladimir Golkov
for i = 1:numel(hFigs)
hFig = hFigs(i);
oldFun = get(hFig, PropertyName);
answer(i) = propertyContainsEventFcn(oldFun, funHandle);
end
function answer = propertyContainsEventFcn(property, funHandle)
if isa(proper... |
function D()
%D Summary of this function goes here
% Detailed explanation goes here
v1 = 1*10^7; %m3
v2 = 8x10^6;
v3 = 5*10^6;
vdot = 4*10^6;
cin = 0;
c1 = [0,15,11,7,6,8,12,16,20];
c2 = [0,3,5,7,7,6,4,2];
c3 = [100,48,26,16,10,4,3,2];
time = [0,2,4,6,8,12,16,20];
function objective(@int,
function int(d1... |
% Code: Written by Matt Shapiro
% Date: November 9, 2012
% Macro 8185 - Prof. Fatih Guvenen
% Problem Set 1
clear, clc
format long
%% Q1 First Method
% Quadratic Formula
quad1 = @(a,b,c) (-b+sqrt(b^2-4*a*c))/(2*a);
quad2 = @(a,b,c) (-b-sqrt(b^2-4*a*c))/(2*a);
% Parameters
n= -1:-1:-8;
a = 1;
b = 100000;
c = ones(... |
%this function should be run before running the listen functions
% "Copyright (c) 2000 and The Regents of the University of California. All rights reserved.
%
% Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without written agreement
% ... |
function result=safebitand(num,num_2)
%num可能是非负数
if num<0
result=bitand(-num,num_2);
else
result=bitand(num,num_2);
end |
img_name = "test3.jpeg";
clean_img_name = "clean_image.png";
I = imread(img_name);
% I_M = imread("edge.png");
% I_M_I = ~I_M;
% figure;
% imshow(I_M_I);
clean_img = imread(clean_img_name);
I_G = rgb2gray(I);
clean_img_n = rgb2gray(clean_img);
% Call Sticks Line to get the enhanced Image
new_I_G = sticks_line(I_G)... |
function h = shang(x, n)
error(nargchk(1, 2, nargin)); % Check input arguments
if nargin < 2
n = 256; % Default for n
end
x = double(x); % Make input double
xh = hist(x(:), n); % Compute N-bin histogram
xh = xh / sum(xh(:)); % Compute probabilities
% Make mask to eliminate 0's since log2(0) = -inf.
i = find(xh);... |
%Operacione aritmeticas en MATLAB
+ a+b %Suma de a y b
- a-b %Resta de a y b
* a*b %Multiplicacion de a y b
/ a/b %Division de a entre b
\ a\b %Division inversa entre a y b, es ddecir b/a
^ a^b %Potenciacion de a elevado a la b
%Valores de la constante pi en varios formatos que acepta MATLAB
format short %Forma... |
function [labels,centroids,relError,iter,U_binarized] = emonmf(M,initClusts,MaxIters,initMethod)
% EM-onmf.
%
% <Input>
% M: (nonnegative) items-by-features matrix
% initClusts:
% (if scalar) number of desired clusters;
% (if vector, of length "numItems") cluster of i-th item,1<=i<=numItems;
% (if... |
% compute the bounding box of images rendered from 3ds max
function computerBB_all()
inputDir='C:\Users\305\Desktop\workspace\photorealistic\results_12_16_posesplit_four';
%inputDir='C:\Users\305\Desktop\test';
filelist = dir(inputDir);
% create flipped images
%for i=1:length(filelist)
% if(~strcmp(filelist(i).na... |
function [outWelllog] = stpCalcIterate(welllog, mGeo, mPhys, F, matrixB, Cgeo, invCd, Cphysgeo, G, d, lsCoff, ldCoff, iterNum)
% 本函数用于迭代mPhys和mGeo
initGeo = mGeo;
initPhys = mPhys;
mGeoProir = mGeo;
[~, sampNum] = size(G);
B1 = ( Cphysgeo + F*Cgeo*F' ) * G' * invCd;
A = eye(sampNum) +... |
%% Lloyd-Max Algorithm
close all;
for q=1:6 %%no. of bits
n_bits = q;
q_levels = 2^n_bits;%% no of levels
minv = -10;%% dynamic range
maxv = 10;
len=(-1*minv+maxv)/q_levels;%%length of interval
m=zeros(1,q_levels+1);
for i=1:q_levels+1
m(i)=minv+(i-1)*len;%%initialize
end
... |
% Author: Dorence DENG
% a demo for uipanner
% pannerAxis <- panner <- dragLine
% inspired by chen xinfeng's 'drag Line with callback'
fg = figure();
pa = uipanner.pannerAxis('mode', 'x', 'figure', fg);
pa.step = 100;
x = 1:10000;
pa.plotdata(x, sin(x ./ 500 .* pi) ./ x .^ 0.2);
|
function aslsub2(root, navg, first, last, skip)
%function aslsub2(root,navg,first, last, skip)
%
% Do all subtractions for a series of AST images
% works for 4D data files only.
%
% root - rootname of the files
% navg - number of averages per point
% first - first image to be used in the averages
% last - last image ... |
% split and save one cycle to load and unload curve
function save_uniaxial_cycle_to_load_unload(epsilonX,epsilonY,sigma,cycle,outputPath)
% find peak force
[temp idx] = max(sigma);
epsXL = epsilonX(1:idx);
epsXU = epsilonX(idx:end);
epsYL = epsilonY(1:idx);
epsYU = epsilonY(idx:end);
sigL = sigma(1:id... |
%WPREC2 2 次元ウェーブレットパケットの再構成
%
% X = WPREC2(T) は、ウェーブレットパケットツリー T に対応する再構成された
% ベクトルを返します。
%
% 注意: T がインデックス付きイメージの解析から得られた場合、X は m×n の
% 行列になります (トゥルーカラーイメージの解析の場合 m×n×3 の配列になります)。
% イメージ形式の詳細は、IMAGE と IMFINFO 関数のリファレンスページを参照してください。
%
% 参考 WPDEC, WPDEC2, WPJOIN, WPREC, WPSPLT.
% Copyright 1995-2008 The... |
classdef Function2 < handle
properties(SetAccess = protected, GetAccess = public)
f;
end
methods (Access = public)
function fcn = Function2(f_handle)
if is_function_handle(f_handle) && nargin(f_handle) == 2
... |
close all;clear all;clc;
msgfid = fopen('msg.txt','r');
msg = fread(msgfid,inf,'ubit1=>logical')';
fclose(msgfid);
load hall hall_gray;
load jpegCoeff
img = imghide0(hall_gray,msg);
msglength = length(msg);
imshow(img);
[dcbin,acbin] = jpegencode(img,DCTAB,ACTAB,QTAB);
[m,n] = size(hall_gray);
jpeg = jpegdecode(dcbin... |
% -------------------- Description --------------------- %
% %
% Calculate shape center points evolution %
% %
% ---------------------- Content ----------------------- %
psi_ss(i_step) = psi(evo... |
function [ svms ] = one_v_rest_svm( training_data, labels, svmtrainpref)
% MULTI_CLASS_SVM: Data + Labels = 1vR SVMs
% training_data is training instance per row.
% Corresponding value in labels is class, labels is row vector.
% Arguments is svmtrain arguments.
% Figure out how many classes there are in the data
... |
function varargout = resizeallvars(dim,good, varargin)
% function varargout = resizeallvars(dim,good, varargin)
opt.verbose = false;
opt.struct = struct([]);
[opt,vars] = parsevarargin(opt,varargin, 2, 'leaveunknown',true);
if (isempty(vars))
if (~isempty(opt.struct))
where = 'struct';
S = opt.str... |
function [buttonLocs,buttonLocsSamps,tactorLocsVec,tactorLocsVecSamps,tEpoch,epochedButton,epochedTactor,buttonTactDiffSamps] = get_response_timing_segs_newTactor(tactorData,uniqueCond,stim,buttonData,stimFromFile,fsStim,fsTact,trainTimesTotal,plotIt)
tButton = (0:length(buttonData)-1)/fsTact;
buttonDataClip = buttonD... |
%% This program calculates the transmission coefficient through a 1D RTD diode using contact block reduction (CBR) method
% code by: Amirhossein Davoody
% 26/6/2013
clc;
clear all;
fig=0;
%% Set physical parameters
hbar=1.05457e-34; %Joules
eV=1.602e-19; %Joules
m0=9.109e-31; %kg
%% Set simulation parameters
me=0.... |
%Fourier Series Reconstruction
function y=partialfouriersum(A,T,t)
y=zeros(size(t));
N=(length(A)-1)/2;
w=(2*pi)/T; %define fundamental freq
for k=-N:N
y=y+A(k+1+N)*(exp(j*w*k*t)); %f.series reconstruction formula
end
end |
function archs = SCHED_generate_random_archs2(NRANDOM,N,vbeg,vend)
all = 1:N;
vmed = all(~ismember(all,union(vbeg,vend)));
archs = zeros(NRANDOM,N);
for i = 1:NRANDOM
archs(i,:) = [vbeg(randperm(length(vbeg))) vmed(randperm(length(vmed))) vend(randperm(length(vend)))];
end
end |
function [out1, out2] = indPoints(x, N, method, covfunc, loghyper, varargin)
% indPoints - choose a subset of the data in x. Several methods
% are available: random choice, entropy maximization and farthest
% points clustering.
%
% usage: sod = indPoints(x, n, method, covfunc, loghyper)
% or: [ci cc] = indPoin... |
%(b) Write a second function where the fraction of pixels to display as
% black or white are equal and can be specified as a second input to this
% function.
function new_image = changeimage_b(image, pixel_frac)
% reads in an image, converts it to grayscale, and changes it so that
% the specified fraction of pixels is... |
function s7ex1dimplicit(dt)
%Applying implicit Euler to the sailing boat problem,
%converges only for dt < 1 (according to banach's fixed point theorem)
u(1)=0;
v(1)=0;
n=15/dt;
for t = 2:(n+1)
c=2;
u(t)=0;
%fixed point iteration for u
while (abs(u(t)-c) > 10e-8)
c = u(t);
u(t) ... |
function [nLabels, labels, stats] = connectedComponents(textScoreComb,connectivity)
% This function computes the connected components labeled image and
% statistics output for each label.
% Copyright 2021 The MathWorks, Inc.
% compute connected components
CC = bwconncomp(textScoreComb,connect... |
function [parent1,parent2]=crossSimples(parent1,parent2,crossProb)
if(crossProb>rand)
chromoSize = length(parent1); % Tamanho do cromossomo
cut = round((1 + (chromoSize-1)*rand)); % Ponto de corte é definido aleatoriamente
% O crossover é realizado
temp = parent1(cut); % Eleme... |
function [mean_itn,numAll]=intensityValue(I,boundary,k)
b_r=boundary(:,1);
b_c=boundary(:,2);
% Caculate the number of pixels in each cell
num = 1;
itn_sum =0;
% If the pixels inside the cell's boundary is higher than
for r = min(b_r):max(b_r)
for c = min(b_c):max(b_c)
if(I(r,c) > 0.085)
... |
%circular conv of two length n seq
%computed by forming product of their dfts
%and then applying n-pt idft
x = input('enter x\n');
h = input('enter h\n');
X = fft(x)
subplot(2,2,1)
stem(x)
title('sequence x')
H = fft(h)
subplot(2,2,2)
stem(h)
title('sequence h')
Y = X.*H
y = ifft(Y)
subplot(2,2,[... |
function [qA,qB,qC,qD,qE] = DataReceive(ser,qa,qb,qc,qd,qe)
qI = [0,1,0,0];
qJ = [0,0,1,0];
qK = [0,0,0,1];
G = [0,0,-1];
qA = qa;
qB = qb;
qC = qc;
qD = qd;
qE = qe;
flg = 0;
i = 1;
datamodified = ["0","0","0","0","0";
"0","0","0","0","0";
"0","0","0","0","0";
"0","0",... |
function [hEst_t, hEst_f, delay, PDP, ang, fs] = chanEstVNA_cal(fname, pkCfg, Nup, mode, ang_val)
if nargin == 3
mode = 'csv';
ang_val = 0;
end
relThresh = pkCfg.relThresh;
Npk = pkCfg.Npk;
% read the frequency domain channel estimate in
if strcmpi(mode, 'csv')
M = csvread(fname, 1, 0);
angle_candidate = M... |
classdef Track
properties
checkpoints
x,y
bx,by
yx,yy
end
methods
function self = Track(checkpoints)
self.checkpoints = checkpoints;
[self.x,self.y,self.bx,self.by,self.yx,self.yy] = ...
points2xy(checkpoints);
end
... |
function varargout = iqStability(varargin)
% scan resonator s21 vs frequency and raadout amplitude(iq), no qubit drive
%
% <_o_> = iqStability('qubit',_c&o_,)
% _f_: float
% _i_: integer
% _c_: char or char string
% _b_: boolean
% _o_: object
% a&b: default type is a, but type b is also acceptable
% []: can be an arra... |
function [gradientVal] = getQuadraticGradient(x, up, down, left, right)
% The gradient when the cost function is quadratic
gradientVal = 2*(4*x - up- down - left - right);
gradientVal = gradientVal(:);
end |
function segmenter_func(myfolder, new_folder, segtrans_path)
%{
Take folder of images, segment using: http://calvin.inf.ed.ac.uk/software/figure-ground-segmentation-by-transferring-window-masks/
Must be on same path as figureground.m
MYFOLDER -- Absolute filepath to folder of images to segment
NEWFOLDER -- Name of ne... |
function [strSPL, strSpec1, strSpec2] = stimdispILD(Stim)
% stimdispILD - strings describing specific parameters of ILD stimulus
% [strSPL, strSpec1, strSpec2] = stimdispILD(Stim) returns strings
% strSPL, strSpec1, strSpec2 describing the stimulus parameters of the
% ILD stimulus. Stim is the struct containin... |
function csv_to_workspace()
% CSV_TO_WORKSPACE() converts measured data from csv files into mat files.
% csv_folder_name = 'Movement_No5_Acc_slow_no_disturbance/csv_files/';
% mat_folder_name = 'Movement_No5_Acc_slow_no_disturbance/mat_files/';
% csv_folder_name = 'Movement_No6_Acc_slow_Verify_Model/csv_files/'... |
%% Nejčokoládovější cesta
function [ choco ] = Cokolada(M,r,s)
[max_r,max_s] = size(M);
if r == max_r
choco = M(r,s);
else
choco_count = M(r,s);
choco_r = Cokolada(M,r+1,s);
choco_s = Cokolada(M,r+1,s+1);
choco = max(choco_r, choco_s)+choco_count;
end
end |
function [C_mf,C_zf,C_mmse,C_k_mu_mf,C_k_mu_zf,C_k_mu_mmse]=MISOMU_plot(EPOCH,SNR,N_user,N_trans)
%%%%仿真参数%%%%%%%%%%%%%%%%%%%%%%%%%%%
N_rece = 1;%接收天线数目,每个用户为单天线
% N_trans = [4,8,16];%发射天线数目
% N_user = 3;
% SNR=-10:2:30;%仿真信噪比
SNR_linear=10.^(SNR/10);%线性信噪比
SNR_Len=length(SNR);%仿真信噪比的数量
N_Len=length(N_trans);
% EPOCH=1... |
function [B1,phi]=Mag_sensor(N,B0,HW,pos_NV,int,n_spin,lamda,num_pks,start)
x=(1:N);
x=x/1000;%change into um
X0=ceil(N/num_pks/2);
% for ii=1:N
% % B(ii)=B0/(1+((ii-ceil(2*N/3))*int/HW)^2)+B0/(1+((ii-ceil(N/3))*int/HW)^2);%two lorentzian function distribution
% B(ii)=B0/(1+... |
% Then this means that IF x at time t (call it the state variable "xprevious") was zero
%then assign x at time t to be 1 (call it the state variable "xnext") with probability 3/4 and assign it to be 0 with probability 1/4.
%That is easy to do. Draw a z to be uniform [0,1] using the Matlab command rand. If z is bet... |
function writeOutputResultAtTimePointToVtk( obj, timepoint )
%WRITEOUTPUTRESULTTOVTK Summary of this function goes here
% Detailed explanation goes here
time = ncread(obj.filename{1},'time');
[~,Index] = sort(abs(timepoint-time));
fprintf('===============================\n');
fprintf('Time of the current output ... |
nx=4320;
pn='~dmenemen/llc_4320/MITgcm/run/';
%%%%%%%%%%%%
nx=4320;
pn='~dmenemen/llc_4320/MITgcm/run/';
nm='U';
ts=468432;
fn=[pn nm '.' myint2str(ts,10) '.data'];
fld=read_llc_fkij(fn,nx,3);
clf
quikpcolor(rot90(fld)');
caxis([-1 1]/4)
thincolorbar
%%%%%%%%%%%%%%
% SST of San Pedro basin
ts=279360;
fn=[pn 'Theta.' ... |
function show3d(varargin)
varargin{6} = '3d';
show4d(varargin{:})
|
function [success] = example_downloadTestData(varargin)
% Downloads CIAtah example test data from online into data folder.
% Biafra Ahanonu
% started: September 2018
% inputs
%
% outputs
%
% changelog
% 2019.09.16 [13:03:33] - Added three new imaging sessions to use for cross-day alignment and made downloa... |
% pkin [%NKP%x1]
% kinematic parameters (e.g. lengths of the links)
% %KPDEF%
|
addpath('../helperFunctions/');
% load data
clear;
close all;
fn ='decoding_vonmises_ideal/vonmises_ideal';
% create parameters
N = 236;
params = [ (1/N:1/N:1)'*360, ones(N,1), 15+30*rand(N,1),30*rand(N,1)];
% generate data
theta = (0:2*(pi/180):2*pi)'; % motion direction (radians) (usually 0:pi/180:2*pi, every deg... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.