text stringlengths 8 6.12M |
|---|
function [Masques_Imgs_Projections_Pts_Dioptres, Imgs_2_Dioptres, Dioptres_2_Imgs] = Calculer_Imgs_2_Dioptres(...
Pts_Dioptres, R, t, Matrice_De_Calibrage, Masques_Imgs)
[Nb_Lignes, Nb_Colonnes, Nb_Imgs] = size(Masques_Imgs) ;
Masques_Imgs_Projections_Pts_Dioptres = zeros(size(Masques_Imgs), 'logical') ;
... |
% Copyright (C) 2012 Quan Wang <wangq10@rpi.edu>,
% Signal Analysis and Machine Perception Laboratory,
% Department of Electrical, Computer, and Systems Engineering,
% Rensselaer Polytechnic Institute, Troy, NY 12180, USA
%
% You are free to use this software for academic purposes if you cite our paper:
% Qu... |
function overlap = form_overlap_ml(G, In, Out, delta)
n = length(G);
ndoms = length(Out);
overlap = cell(ndoms, 1);
for i = 1 : ndoms
v = zeros(n, 1);
v( Out{i} ) = 1;
for lev = 1 : delta
ovpnts = find( v == lev );
for j = 1 : length(o... |
%=========================================================================
%
% Program to plot data from Taylor rules
%
%=========================================================================
function linear_plottaylor()
clear;
clc;
%Read data from timeseries obj
load taylor;
% St... |
% compares GLWD to my results. input from arcgis
% TODO: figure out how not to distort plots- combine datasets before
% calling ecdf- magnitude matters whne rescaling log-log plots
%% run previous script to get DCS data
analyzeWaterDistribution
fprintf('Note: Max DCS lake size: %d\n', maxSize)
%% set params
... |
clc, clear
a = load('cancerdata3.txt');
a(:,1) = [];
[tra,sam,gro] = standardlize(a(1:500,:),a(501:569,2:end));
s = svmtrain(tra, gro, 'Kernel_Function', 'quadratic');
check = svmclassify(s, tra);
err_rate = 1 - sum(gro == check) / length(gro)
solution = svmclassify(s, sam);
solution = solution';
sg = find(solution == ... |
clear all; close all; clc;
% make arrays using variables for easy scaling
scale = 2;
incr = 0.05;
x = [-scale*pi:incr:scale*pi];
y = [-scale*pi:incr:scale*pi];
%loop thru y
for i=1:length(y)
%loop thru x
for idx=1:length(x)
z(i,idx)=periodicity(x(i),y(i));
end
end
% plot surface an... |
function abc = hornShmuck(imgs)
opticFlow = opticalFlowLK;
for i = 1 : size(imgs, 1)
frameRGB = imgs{i};
frameGray = rgb2gray(frameRGB);
flow = estimateFlow(opticFlow,frameGray);
figure, imshow(frameRGB);
hold on;
plot(flow,'DecimationFactor',[5 5],'ScaleFa... |
function [f,g] = mlab_grad4proj(x,params,just_target)
global D;
global NX;
global X;
global t;
global c;
global px0;
gradphi = 0;
newmat = vec_to_smat_fast(x,D);
[trans_mat] = real(sqrtm(newmat));
if sum(isnan(trans_mat(:)))
keyboard
end
Xtrans = X*trans_mat;
dd = my_dist(Xtrans,Xtrans');
%tic
gradphi = 0;
for xi=... |
function output = Normalizacion(vector, mode, varargin)
%NORMALIZACION(vector, mode, parámetros)
% Normaliza el vector según el modo:
% 'rango' -> parámetros min, max. Output entre -1 Y 1
% 'normal' -> parámetros media, desviación típica. Resta la media y
% divide por la desviación típica. Output entre -3 y 3 ... |
clearvars;clc;
n=input('');
flag=isPrime(n);
disp(flag);
function flag=isPrime(n)
if((n~=2 && mod(n,2)==0)||n<=1)
flag=false;
return;
elseif (n==2||n==3)
flag=true;
return;
end
flag=true;
for i=3:2:(n-2)
flag=flag&&mod(n,i)~=0;
end
end |
filelist=dir('*_2.tif.tif');
for File=1:length(filelist)
[mixedsig, mixedfilters, CovEvals, covtrace, movm, movtm] = CellsortPCA(filelist(File).name,[],250,1,'C:\Temp\CROP');
[ica_sig, ica_filters, ica_A, numiter] = CellsortICA(mixedsig, mixedfilters, CovEvals, [1:size(mixedsig,1)], 0.8,size(mixedsig,1),randn(... |
%@(#) normal.m 1.2 94/02/08 12:31:40
%
%function FI=normal(x)
function FI=normal(x)
for i=1:length(x),
if x(i)>11,
FI(i)=1;
else
FI(i)=quad('normdens',0,x(i))+0.5;
end
end
|
function [Q,x] = sgecheb(N, dt)
% Sine-Gordon Equation, Chebyshev linear propagator
% u_tt - u_xx = 0
% Domain substitution x=tan(th)
[D,th]=chebD(N); th=pi/2*th; D=diag(2/pi*cos(th).^2)*D;
x=tan(th);
% Linear propagator
[V,L]=eig(D(2:end-1,2:end-1),'vector');
L=[0;0;L];
S=zeros(N);
S(2:end-1,3:end)=V;
ND=null(D);
S(... |
function [ pYgMp, pAgYMp, mpTgY, H_pTgY, pXgX ] = Emergence_IO_Chain( y, scaleme, prior, i, dt )
% EMERGENCE_IO_CHAIN implements a N-order Markov chain that is estimated
% from a binary sequence.
% - "y": a 1xN array specifying the sequence of binary observations (1s
% and 2s).
% - "scaleme": a string ('lin' ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2010 - 2015 Moon Express, Inc.
% All Rights Reserved.
%
% PROPRIETARY DATA NOTICE:
% The data herein include Proprietary Data and are restricted under the
% Data Rights provisions of Lunar CATALYST Space Act Agreement
% No. SAAM ID#... |
% Evaluates the gradient of the objective function
%
% Author: RS
function grad = TV_obj_grad_eval(A, f, alpha, m)
grad = A'*A*f - A'*m + alpha*TV_penalty_grad_eval(f);
end |
function [] = schrodExp( N )
[D,x]=chebD(N);
[~,w]=ClenshawCurtis(-1,1,N);
dt=0.0001;
V0=000;
T=-1/2*D*D;
V=diag(V0*x.^2);
H=T+V;
U=zeros(N,N);
U(:,1:2)=null(H);
[U(2:end-1,3:end),L]=eig(H(2:end-1,2:end-1),'vector');
L=[0;0;L];
Q=U*diag(exp(-1i*dt*L))/U;
sigma=0.1;
k=5;
Psi0=normc(exp(-(x/sigma).^2-1i*k*x), w);
h=p... |
function means = gainStatistic(data, dimId, funcId, nInstances, averageDims, statistics)
% Returns cell array of means accross chosen dimensions for each function
if nargin < 4
nInstances = 15;
if nargin < 5
averageDims = true;
end
end
% cat dimensions if necessary
dims = length(dimId);
fu... |
function [ optimal_x ] = convex_optim_bounded_indxs( f, lb, ub, s_range, tolX )
%
lb_indx=find(s_range<lb, 1, 'last' );
ub_indx=find(s_range<ub, 1, 'last' );
while (s_range(ub_indx)-s_range(lb_indx)) > tolX
middle_indx=round((lb_indx+ub_indx)/2); right_indx=middle_indx+2;
fx_middle=f(s_range(middle_indx)); fx_right=... |
% local ternary paterns implementation
% function [ltp_full]=LTP_speech(x,thresh)
% x(t) is the signal (audio signal) in digitized form
folder = fullfile('Please put the link of folder containing audio samples');
ADS = audioDatastore(folder);
while hasdata(ADS)
x=read(ADS);
sname='Sheet1';
startingColumn='A';
fil... |
function [picGray] = compareStim( imageName )
% compareStim - displays the image alongside the brightness values of the
% different stimuli;
% Note - this is based on columns;
pic = imread(imageName);
figure;
subplot(1,2,1)
picGray = rgb2gray(pic);
imshow(picGray)
res = input('uniform; enter line \n');
u = ... |
% Load the file and
filename = 'C:/Users/Felicity/macaqueERP/data/epocheddata.mat';
errorfilename = 'C:/Users/Felicity/macaqueERP/data/errordata.mat';
norm = load(filename);
error = load(errorfilename);
electrode = round(input('Which electrode? (1-14)\n'));
normdata = norm.data{1,1}.odd;
errordata = error.data{1,1}... |
function [positions, winding] = vortex_detect2d(psi)
% Detect vortices in a field psi, on plaquettes of a 2D grid.
%
% First we localize vortices on the grid plaquettes using the phase winding
% algorithm. After we've found which grid plaquettes contain vortices, we
% estimate the positions more accurately by solving ... |
%% logSerial.m
% Reads serial port data and appends a text log file continuously
% Press CTRL + C twice quickly to stop
% TO DO: Severe delay between logging and live plot.
clear all; close all; clc
s = serialport("COM3",9600);
configureTerminator(s,"CR/LF")
dataline = readline(s); % first line is bad. TO DO f... |
classdef dtu10mw_cpct < handle
properties
controlMethod % The controlMethod that is being used in this turbine
structLUT % Struct() containing all the preloaded LUT info
end
methods
% Initialization of the Cp-Ct mapping (LUTs)
function obj = dtu10mw_cpct(co... |
addpath('/Users/jinstone/Desktop/stmsetup/thesis/sw/sinc_filter/');
addpath('/Users/jinstone/Desktop/stmsetup/thesis/sw/subsample/');
addpath('/Users/jinstone/Desktop/stmsetup/thesis/sw/sinc_interp/');
samp = 3E6;
data0 = csvread('0data.csv');
%remove 1.5V offset
ave = mean(data0);
data0 = data0 - ave;
tot = 16; %7... |
% wrapper for default chanceshade for facedistid.
%
% [h,t] = facedist_chanceshadewrap(x,y,textx)
function [h,t] = facedist_chanceshadewrap(x,y,textx)
xs = size(x);
ys = size(y);
assert(isequal(xs,ys));
x = reshape(x,[xs(1) prod(xs(2:end))]);
y = reshape(y,[xs(1) prod(xs(2:end))]);
[h,t] = chanceshade(x,y,'inftype','... |
%ana2d2c_ll.m
%analyzing 2 component 2D space simulation for varying cell size
%For: nA0B, nApB, nA0B_salt, nA0B_solvent, etc.
%Author: Yi-Xin Liu@Fudan Univ.
%Since 2010.9.17
%
% scft_out_ll4_*
% scft_out_ll4.5_*
% scft_out_ll10_*
% scft_out_ll10.5_*
isScatter=false;
nrepeatx=8;
nrepeaty=8;
flist=dir('s... |
%Ecos test
cvx_begin
cvx_solver 'ecos'
variable x(n)
dual variable y
dual variable s
minimize(c'*x)
subject to
y: A*x == b
s: x(1) >= norm(x(2:n))
cvx_end
|
function A = gauss_j( A )
n = size(A, 1);
for i=1:n
A(i, :) = A(i, :)/A(i, i); %dziel przez aktualny na diag
for j=1:n
if i ~=j
A(j, :) = A(j, :) - A(i, :)*A(j, i); %elementy w danej kolumnie sie zeruja
end
end
end
end
|
function [tsp,p,E,BE,Q,M1] = show_deformation()
% this function shows the grid deformation caused by landmark matching.
% thin plate spline is used.
N=28;
eps=0.3;
alpha2=.3;
% I=importdata('Cal_sch.mat');
% I0=I(:,:,1);
% I1=I(:,:,15);
% N=size(I0,1);
I0 = template2(N);
% I1 = template1(N);
% I1 = temp... |
function bboxOut = BBoxMultiplySize(bboxIn,multiplicand);
%function bboxOut = BBoxMultiplySize(bboxIn,multiplicand);
%
%returns a new bbox with the same center but of a new size
%
cx = bboxIn(1) + bboxIn(3)/2;
cy = bboxIn(2) + bboxIn(4)/2;
bboxOut(3) = floor((bboxIn(3) + 1) * multiplicand - 1);
bboxOut(4) = floor((bbo... |
function [dgE,dgP,la_out,fi_out,la,fi] = mGlobe_Local(lonD,latD,hD,dem,hranice,rozlisenie,tabulka,r,treshold_in,treshold_out)
%MGLOBE_LOCAL calculation of near zone gravity correction
% Function calculates the gravity response (loading and newton) to 1 mm
% of water for given grid using spherical approximation + d... |
%DEMO_MODEL_UPDATE demo model updating problem with two parameters from Cottin
%
% For a given matrices A, B, and C of the same size and values s1 and s2
% we are looking for lambda and mu such that A - lambda*B - mu*C has
% eigenvalues s1 and s2 (we do not care about the remaining eigenvalues)
%
% We can write thi... |
function [V,D,VD] = mk_getrt_sub(subname)
%Enter subject of lateralization ripple test
%Returns structues V,D en VD (rr = Right ear, Right hand, rl = Right ear,
%left hand, ll = Left ear, Left hand, lr = Left ear, Right hand)
%nested structure V.rr etc (x = unique velocity, mu = mean rt, ci = stderror)
%nested s... |
function [lfs, mask_ero, res_term, reg_term] = resharp(tfs,mask,vox,ker_rad,tik_reg,iter_num)
% [LSF,MASK_ERO,RES_TERM,REG_TERM] = RESHARP(TFS,MASK,VOX,KER_RAD,TIK_REG)
%
% LFS : local field shift after background removal
% MASK_ERO : eroded mask after convolution
% RES_TERM : norm of data fidelit... |
clc;
clear all;
h=0.8;
t=1:h:50;
S = zeros(1,length(t));
I = zeros(1,length(t));
R = zeros(1,length(t));
S(1) = 64340;
I(1) = 1;
R(1) = 0;
gamma=0.3;
beta=0.000013;
Sp = @(S, I) -beta*S*I;
Ip = ... |
%% Simulation of Parameter Estimation for Perturbed Linear Systems
odefn = @genlinfunode; % Function for ODE solver (exact)
fn.fn = @genlinfun; % RHS function
fn.dfdx = @genlindfdx; % Derivative wrt inputs (Jacobian)
fn.dfdp = @genlindfdp; % Derviative wrt parameters
fn.d2fdx2 ... |
function res = getProjection(arg, data, dim)
if strcmp(arg, 'sammon')
res = sammon(data', dim, 10^(-5), '3');
% res = compute_mapping(data', 'Sammon', dim);
return;
end
if strcmp(arg, 'pcaproj')
res = pcaproj(data', dim);
return;
end
if strcmp(arg, 'cca')
pca = pcaproj(data', dim);
res = cca... |
function[X2n,q2n,dist] = align2(q1,q1l,X2,q2l)
numPieces = size(q1l,2);
N = 100;
lam = 0;
q2 = curve_to_q(X2);
% Form the q function for representing curves and find best rotation
A = q1*q2';
[U,~,V] = svd(A);
if det(A)> 0
Ot = U*V';
else
Ot = U*([V(:,1... |
function [ rows, cols, x ] = minimizeRowsAndColumnsSDP( area, eta )
addpath('C:\Program Files\Mosek\8\toolbox\r2014a');
%SDP_MINIMIZEROWSANDCOLUMNS Summary of this function goes here
% minimizes rows and columns for a given tile size
% Input values: area: matrix of size s, s. contains area values
% Return v... |
function [S, update, ix_update] = incr_online_sparsification(dnew, thres, N, kernel_pars, S,verb)
%
% Incremental Online Sparsification of training data.
% Used for selecting the most important training samples
% (maximum of N) for incremental GPR.
%
% Based on: Incremental Online Sparsification for Model Learning
% ... |
function [h] = m_2D_surf(long,lat,data)
% - draw a 2D surface on an M_Map map
% M_2D_SURF(LONG,LAT,DATA,...) draws a 2D surface on a map. Behavior
% is the same as for SURF(X,Y,Z) with viewpoint above and interpolated shading
% except that LONG and LAT vectors or matrices must be specified.
%
% [H] = M_2D_... |
function param = getParameter_withload(varargin)
% class化したほうが良い.
mass = 0.2355;
length = 0.075;% モーター間の距離:正方形を仮定している
jx = 0.002237568;
jy = 0.002985236;
jz = 0.00480374;
gravity = 9.81;
km1 = 0.03010685884691849; % ロータ定数
km2 = 0.03010685884691849; % ロータ定数
km3 = 0.03010685884691849; % ロータ定数
km4 = 0.030106858... |
function A00 = synA00Qmin(A11, sizeA00, cmax)
%-----------------------------------------------------------------------------
%
% For each point of colour 00 this function assigns the minimum value at the
% neighbouring gridpoints of colour 11.
%
% Design and implementation by:
% Dr. Paul M. de Zeeuw <Paul.de.Zeeuw@cwi.... |
function [t,xi_1,xi_2,xi_3,x_c, y_c, x_l, y_l, T_lc, T_ll, T_s, r_c, r_f, r_b] = nonlinear_transform_sol_after_BL(cool,n_2,T_max,T_init,Init)
%DIMENSIONLESS_SOL Solve the dimensionless problem from the point at which
%the external temperature reaches the freezing point.
[p] = parameters(cool);
[p_ND] = ND_parameters(... |
function [new_data] = modify_networks(adj_matrices, mni_coordinates, patient_roi, resected_elecs, mod_method)
num_patients = length(adj_matrices);
for pt = 1:num_patients
if strcmp(mod_method, 'no_WM')
%% keep all electrodes except WM
% set up blank indices to remove
... |
function output = convSignals(s, h)
% Function convolves s with h using built in
% conv() function of MATLab.
%
% Parameters:
% s - The input signal.
% h - The impulse response.
%
% Returns:
% output - The result of convolution.
output = conv(s, h);
end |
% ¾÷±ñ¥| ±i¤¸ºÍ E14013344
clear
clc
syms x1 x2 x3 v1 v2 v3
f=(x1-1)^2+(x2+2)^2+(x3-2)^2; % objective function
h=[x1+x2+2*x3-4,2*x1+3*x2-1]; % constrain function
sol = l_solver(f,h,3,2); % l_sover
% Display result in sol
disp('Test P4.47 result:')
var = fieldnames(sol);
for i = 1:size(var)
tmp = getfield(so... |
function varargout = htmlcal(startdate,stopdate,htmlfile,days)
% HTMLCAL Create an HTML calendar for a range of months.
% HTMLCAL(FIRSTMONTH,LASTMONTH) creates an HTML file with one or more
% monthly calendars. Use 'mm/yyyy' or 'mm-yyyy' strings to specify the
% months. You will be prompted for the name of the... |
clearvars
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%generate data for histograms of wave properties in IAGOS data
%Corwin Wright, c.wright@bath.ac.uk, 23/MAY/2020
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function [FP,JA,JB,Ev,VA,VB,class] = basic_model_stability(vr,vt,a,b,k,C,I)
% BASIC_MODEL_STABILITY linear stability analysis of Izhikevich neuron model
% [B,JA,JB,FP,Ev,VA,VB,CL] = BASIC_MODEL_STABILITY(vr,vt,a,b,k,C,I) given standard
% model parameters (vr,vt,b,k,C) and specified injection current I, computes
% the ... |
clear all; clc
[wave1, Fs] = audioread('mysentence.wav');
[wave2, Fs] = audioread('re_task2.wav');
% [wave2, Fs] = audioread('resyn3.wav');
% [wave2, Fs] = audioread('resyn_lowquality_3.wav');
num = 20*0.001*Fs; % sample number in each block
block = length(wave1)/num; %block number
% ave = zeros(1,10);
p = 10... |
% https://www.allaboutcircuits.com/technical-articles/digital-signal-processing-in-scilab-how-to-decode-an-fsk-signal/
% mducng, SoC team, G2touch
% For MPP2.0 digital HF
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc; clear;
close all;
f0 = 196429;
f1 ... |
function output = rect_pulse(min,max,x_array)
%RECT Summary of this function goes here
% Detailed explanation goes here
output = zeros(1,length(x_array));
for x = 1 : length(x_array)
num = x_array(x);
if (num >= min) && (num <= max)
output(x) = 1;
else
output(x)... |
function [ xStar, FStar, nIter, logData, model, opts ] = SolveIALM(...
model, params, opts )
%% Wrapper function for inexact_alm_rpca
%
% Author: Vahan Hovhannisyan, 2017.
[ xStar.L, xStar.S, nIter, logData ] = inexact_alm_rpca( params.D, params.nu, opts );
FStar = nan;
end
|
%% a model that say the count words
% the model can count to N, it has N output units corresponds to the N
% count words and an additional units represents saying nothing. Initially,
% it has a bias towards saying nothing.
clear all;
% initialization
global p nn w a;
%% forward prop.
% start unit sends activatio... |
function out = LaserEmitFun(data, ExLen, Res0, IS_SHOW)
if nargin == 0
clc; close all;
Tao0 = deg2rad(10.0); %%%%%%%%%%% initial tangible angle.
Kapa = 1/650; %%%%%%%%%%% initial curvature. According to highway standard, for moutainous region, R >= 250m; for plain, R >=650m.
c = 4*1e-4; 0.001... |
% Obtiene los principales valores de la cabecera del fichero WAV pasado
% como argumento
function [canales, frecMuestreo, resolucion, numeroBytesMuestras] = getCabeceraWav(fichero)
% Abrimos el fichero pasado como argumento con acceso de lectura binaria
% con ordenacion Little-endian
fileID = fopen(fichero,'r','... |
% Make a figure for the simple flicker motion stimulus
%
% A timeseries of the Deltaf/f (with different ROIs)
%
%==Set Path / Initialize Variables=========================================
% Add the experiment analysis and generation folders to the path
addpath(genpath('/Users/stephenholtz/panels_imaging_experiment_an... |
classdef CubicImageReg < handle
%
% Cubic image regularisation function object.
%
%
% @author: Jeffrey Chan, 2014
%
properties(GetAccess = 'public', SetAccess = 'protected')
% maximum penalty value
m_mMu = 0.5;
% cubic parameters (ax^3 + bx^2 + cx + d)
... |
% read CSV file. Year, month, day, number_new_ticket
clear all; close all;
% filename='zendesk_new_ticket_monthly.csv';
filename2 = 'zendesk_new_ticket_weekly.csv';
% M = importdata(filename)
W = importdata(filename2)
%
% % D =datenum(M.textdata(:,1))
% %
W_Ticket = W.data(:,2)
week = W.data(:,1)
W_User = W.data(:,3... |
function energy = k2engy(kx,ky,kz,iv)
% energy dispersion relation, referred to GAMMA conduction band edge
%k input in m^-1
M0 = 9.1095D-31; % electron mass, kg
Q = 1.6e-19; %
HBAR = 1.054D-34; % reduced Planck constant, J*s
if iv == 1
meff = 0.067*M0;
alpha = 0.64/Q;
else
meff = (1.2*0.2^2)^(1/3... |
function navigationMap(g)
%
% Plot the different direction preferences
% draw preferred directions
N = length(g.cellsX);
quiverX = zeros(N, 1);
quiverY = zeros(N, 1);
quiverU = zeros(N, 1);
quiverV = zeros(N, 1);
for i = 1:N
[~, a] = max(computeQs(g, g.cellsX(i), g.cellsY(i)));
... |
function m = distancexy(cus,indi1,indi2)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
% 求两点之间的距离
if indi2 == 0
m = sqrt((cus.xc(indi1)-35)^2+(cus.yc(indi1)-35)^2);
else
m = sqrt((cus.xc(indi1)-cus.xc(indi2))^2+(cus.yc(indi1)-cus.yc(indi2))^2);
en... |
%h = h_bottom; a = xz_normal(1); b = xz_normal(3); d = -xz_point' * xz_normal;
function [y_handle] = get_cone_plane_intersection_curve(h, r, point, normal)
a = normal(1); b = normal(3); d = -point' * normal;
c = r^2/h^2; num = 60;
[rho, theta] = meshgrid(linspace(0, r, num), linspace(0, 2*pi, num));
x = rho .* cos(t... |
function points = NumBand(P1,P2,npoints,point1)
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
points=zeros(1,npoints);
points(1)=P1;
points(npoints)=P2;
for i=2:npoints-1
points(i)=point1+i-2;
end
end
|
function [a,ua,b,ub,r,aw,bw]=arl(x,y)
% metoda liniowej regersji y=ax+b + eps
farl=fopen('arlOUT.m','wt');
if nargin<1
% U I
pom=[3.28 0.0195;
4.74 0.0282;
6.31 0.0375;
7.83 0.0466;
9.51 0.0567;
12.28 0.0733];
x=pom(:,1); y=pom(:,2);
end
[nx,mx]=size(x);
if nx>1 n=nx; else n=mx;... |
% 对上述4个信号分别作DFT,比较信号幅频特性异同点。(注意DFT计算的点数)
% 读取文件数据
load data1.txt;
load data2.txt
load data3.txt;
load data4.txt;
%对1做DFT
fs1 = 256;
L1 = 1024;
ws1 = 2 * pi * fs1;
w1 = ( - ws1/2 + (0 : L1-1) * ws1 /L1 )/(2 * pi);
n1 = length (data1);
T1 = 1 / fs1;
t1 = (0 : n1 - 1) * T1;
figure(1);
subplot(2,1,1);
... |
clc; close all; clear;
ref = imcrop(double(imread('rc.tif')), [345 300 344 799]);
maskC = imread('maskC.tif');
ref_f = fftshift(fft2(ref));
imshow(log(ref_f),[]);
[h w] = size(ref);
mask_ref = zeros(h, w);
mask = zeros(h, w);
f = 496;
r = 48;
H = fspecial('gaussian', r * 2 + 1, 20);
mask(f - r : f + r, (w / 2) - ... |
% An elaborate example.
% It presents an example of an application of LISQ with respect to image
% fusion. Two similar, though different, images are fused into one image
% meant to unify the information included in both originals.
% Please read the source code for a detailed account of what is happening.
% It is not cl... |
function [coeffs, fun, F] = square_root()
%SQUARE_ROOT Square root of a skew-symmetric matrix.
% [COEFFS,FUN,F] = nlevp('square_root') generates a 20-by-20
% nonlinear matrix function F(lambda) = A -lambda^(1/2)*I. The matrix A
% is skew-symmetric and its eigenvalues lie in [4-40i, 4+40i]. The
% eigenvalues o... |
%
%
%
P = dir('W_*.x');
N = length(P);
load connectivity.mat;
time = zeros(length(P),1);
for k=1:length(P),
fname = P(k).name;
tmp1 = find(fname=='_') + 1;
tmp2 = find(fname=='.') - 1;
time(k) = str2num(fname(tmp1:tmp2));
end
[y, I] = sort(time);
P = P(I);
for i=1:N,
fname = P(i).name
W =... |
clear all, close all, clc
img = imread('cameraman.tif');
t = 0.035;
s = edge(img,'sobel',t);
c = edge(img,'canny');
figure
subplot(1,2,1);
imshow(s);
title('Sobel');
subplot(1,2,2);
imshow(c);
title('Canny'); |
close all;
clear all;
Z_fen_group_CS1_X_saved = load('Z_fen_group_CS1_X_saved.mat');
Z_fen_group_CS1_X_saved = Z_fen_group_CS1_X_saved.Z_fen_group;
Z_fen_group_CS1_X_saved = Z_fen_group_CS1_X_saved*(1e-6);
Z_fen_group_CS1_Y_saved = load('Z_fen_group_CS1_Y_saved.mat');
Z_fen_group_CS1_Y_saved = Z_fen_g... |
function visualizeFullAbsorptionsDensity(obj, figNo)
hFig = figure(figNo); clf;
set(hFig, 'Position', [1000 10 1000 1000]);
colormap(gray(1024));
deltaAngle = 15;
iTheta = (0:deltaAngle:360) / 180 * pi;
coneApertureShape.x = cos(iTheta);
coneApe... |
function rate = compute_ZF_rate(QH,H, P)
num_users = size(H, 1);
zf_F = (QH' * inv(QH * QH'));
for k = 1:num_users
zf_F(:,k) = sqrt(P/num_users) * zf_F(:,k)/norm(zf_F(:,k));
end;
gain_matrix = abs(H * zf_F).^2;
temp = 1+ sum(gain_matrix,2);
temp = diag(temp) * ones(num_users);
int_power = temp - gain... |
classdef IFMSparta < naomi.data.IFM
properties
end
methods
function obj = IFMSparta(varargin)
obj = obj@naomi.data.IFM(varargin{:});
end
function sh = staticHeader(obj)
sh = {{'DPR_TYPE', 'IFM_SPARTA', ''}};
end
end
end |
varst7=[];
for xx=dataPointNum*k+(i-1)*mon_num+1:dataPointNum*k+(i-1)*mon_num+mon_num
varst2=zeros(1,dimVar);
varst2(xx)=1;
%varst2(mon_num+indj)=1; for weight
varst7=[varst7;varst2];
end
|
% 加速度ジャイロの6軸の慣性計測の値から座標変換を用いて、姿勢、速度、位置を求める
% ストラップダウン式の慣性計測ユニット(IMU)の値は機体座標系での計測値なので
% 慣性座標系での値に変換する。
% また、便利のために緯度経度高度に変換し、Google Earthで表示できるようにする。
% - - - -
% 使用する座標系
% 機体座標系(Body Frame):機体に固定された座標系。機体ノーズ方向をx軸としている
% 射点座標系(UEN):射点中心の地表に平行な座標系。X-Y-ZをUp-East-Northに合わせている。
% 地球中心地球固定座標系(ECEF):地球中心を原点にx軸を緯度経度0度、z軸を自転軸に定め... |
function [mMembership] = updateHardMembership(mAdj, mImage, mMembership)
%
% Updates the hard membership, using a greedy, vertex by vertex assignment.
% Ordering of update does not affect final result.
%
% Batch update.
%
% Modified from Lo Bong's algorithm.
%
% To optimise (we can easily derive an update rule when a ... |
function mu = truncgaussmf(z, a, b, s)
%TRUNCGAUSSMF Truncated Gaussian membership function.
% MU = TRUNCGAUSSMF(Z, A, B, S) computes a truncated Gaussian
% fuzzy membership function. Z is the input variable and can be a
% vector of any length. A, B, and S are scalar shape parameters. A
% and B have to be ordered ... |
function SOL=tug_DetRandCoord(sed_val,n)
% TUG verifies game solution/property with the Mathematica Package TuGames.
%
% Usage: SOL=tug_DetRandCoord(sed_val,n)
% Define variables:
% output:
% SOL -- Returns the unanimity coordinates.
% Field variable gives result in Matlab and Mathematica format... |
%% ==================== CSL 603, Machine Learning - K-Means Clusstering and PCA ====================
%% Initialization
clear; close all; clc;
%% Loading Data and Labels
% X - Data Matrix
% Y - Label Matrix
X = load('../data.txt');
% Number of examples
N = size(X,1);
% Dimension of data
D = size(X, 2);
Y_temp = l... |
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
lab08e
{??? Undefined function or variable 'B'.
Error in ==> <a href="matlab: opentoline('/home/user/lab08e.m',5,0)">lab08e at 5</a>
solve(a*x^2+B*x+c,x)
}
% Modify expression to add input arguments.
% Example:
% a = [1 2... |
function [hDfpts,hDfline]=upddfdist(n,t,diff,hDfpts,hDfline)
if t==0
col =1;
else
col = t/0.1+1;
end
col=round(col);
for i=1:n
set (hDfpts(i),'xdata',t,'ydata',diff(i,col));
set(hDfline(i),'xdata',0:.1:t,'ydata',diff(i,1:col));
end
end |
function [Jacobian_classic,Jacobian_geom] = JacobMonachSym()
% Classical Approach for Jacobian
syms d1 theta1 theta2 d3 a2
% O1 = [0;
% 0;
% d1];
%
% d01 = [diff(O1, theta1), diff(O1, theta2), diff(O1, d3)];
%
% O2 = [a2*cos(theta2)*cos(theta1);
% a2*c... |
function [w, b] = LSE(X, y)
A = [ones(length(X), 1) X];
parameters = inv(A'*A) * (A' * y);
b = parameters(1);
w = parameters(2:end);
end
|
clc;clear all;close all;
% -------------------------------Trapezoid_filter--------------------------------------%
% Convert a double exponential pulse into a trapezoid for easy peak reading.
% -------------------------------------------------------------------------------------%
%% System parameters
N = 1024;
Ts = 20 *... |
function sinogram_noisy=XuSimuNoisySino(sinogram,photons)
%sinogram_noisy=XuSimuNoisySino(sinogram,photons)
sinogram_noisy=log(photons./poissrnd(photons.*exp(-sinogram))); |
% Method to align RGC RFs to cones in the central retina.
% Called by obj.wireRFcenterToInputCones()
function alignRGCsWithCones(obj, coneRFpositionsMicrons, coneRFpositionsDegs, visualizeAlignment)
if (visualizeAlignment)
% Plot the mosaic before alignment
hFig = figure(1);
xyLims(1:2) = o... |
function basic_stim_serial()
%% Installation instruction for Psychtoolbox
% bash
% sudo apt-get install octave
% sudo apt-get install liboctave-dev
% sudo apt-get install octave-psychtoolbox-3
% sudo octave --no-gui
%% Installing instrument crontol package
% octave
% pkg install -forge instrument-control
% ... |
%## Copyright (C) 2020 MMRFIC
%## Author: MMRFIC <MMRFIC@MMRFIC-PC>
%## Created: 2020-03-25
% Function to compute the RMS value of a vector input
% function [rms_val,scale] = rms_fp(adcOutput);
function [rms_val,scale] = rms_fp(inpvec)
len = length(inpvec);
len2Bits = ceil(log2(len));
sum_fp = 0;
for ii = 1:len
sum_f... |
clear all
clc
close all
x=[5 10 20];
figure
y_caso1_1cluster_iso=[4.315 7.091 9.342];
y_caso2_1cluster_iso=[4.744 8.073 12.664];
y_caso3_1cluster_iso=[4.315 8.589 15.374];
y_caso4_1cluster_iso=[4.257 9.434 18.711];
y_caso1_2cluster_iso=[1.615066374 3.472719413 4.825152644];
y_caso2_2cluster_iso=[1.669... |
function f=melp_lpc(s)
% LPC анализ
% ВХОДНЫЕ ПЕРЕМЕННЫЕ:
% s - входной сигнал
% ВЫХОДНЫЕ ПЕРЕМЕННЫЕ:
% f - выходной сигнал
v=s.*hamming(200)'; % применение окна Хэмминга
a=lpc(v,10); % расчет коэффициентов линейного предсказания
f=a(2:11); % первый коэффициент равен 1 |
function [Struct] = createPowertrain(Struct,powertrainParametersFile)
% *************************************************************************
% FUNCTION NAME:
% createPowertrain
%
% DESCRIPTION:
% Reads powertrain excel file and assigns values
% Read and store torque curve
%
% INPUTS:
% Struct - s... |
%Computation of Linear Convolution using DFT & IDFT
clc;
clear all;
close all;
a=input('Enter a DT signal (please input type of signal, if required. For e.g., sin(0:20), x(n): '); %to ask for the DT signal a
b=input('Enter another DT signal (please input type of signal, if required. For e.g., cos(0:20), y(n): '); %to a... |
function VADPar = InitVADPar()
% initialize constant parameters
VADPar.M = 10; % LP order
VADPar.NP = 12; % autocorrelation order
VADPar.N0 = 128; % number of frames for long-term min energy calculation
VADPar.Ni = 32; % number of frames for initialization of running averages
VADPar.INIT_COUNT = 20;
% HP... |
%% Zak Phase Calculation
clear
%% set grid size
mx = 11;
my = mx;
%% set up honeycomb lattice
a = 1;
q = 4*pi/(a*sqrt(3));
k1 = q*[1;sqrt(3)]/2;
k2 = q*[1;-sqrt(3)]/2;
k3 = k1+k2;
%% quasimomentum vectors
R = [-1 sqrt(3);-sqrt(3) -1]/2;
K = 1*(k1-k2)/3;
Kprime = -K;
vertex1 = K;
vertex2 = R^2*Kprime;
vertex3 = R*... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.