text stringlengths 8 6.12M |
|---|
function struct = getConnComp(ConnMatTot, DiscardIsolated)
%GETCONNCOMP returns connected components of a graph
N = length(ConnMatTot);
DG = digraph(ConnMatTot);
bins = conncomp(DG,'OutputForm','cell');%returns a cell vector. bins{i} are the id of the nodes of the connected component i of the graph
for i=1: length(bin... |
% [A,b,B,N,condB] = bplinsys(P,x,I,j,i,k)
% see gbulinsys.m for P,x,I,i,k arguments; k must be a (nonbasic) column
% index in the first output argument A of gbulinsys() (hence an
% element of [1:K], where x is K times n); i is the BP level, i.e.
% the vertex index whose position we're trying to find.
... |
function [htg, dwdt_g, gtg]= hessian_g_Rd6(mu,w,x,t)
%HESSIAN_G returns gradient of projection function g.
% t in R
% w in T_{\mu}M
% mu in M. Mean on M
% x in M. Original proint
% See Also:
% $ Hyunwoo J. Kim $ $ 2016/04/24 17:59:07 (CDT) $
h = 1e-10;
gg0 = grad_g(mu, w, x, t);
gg1 = gr... |
clear all;
clc;
G=6.67384e-11;
ms=2e+30;
mp=6e+24;
r0=1.5e+11;
%(a)
%ddx/dtt = -(Gm1m2/r0^2)*cos(), where cos() = x(t)/r0
%ddy/dtt = -(Gm1m2/r0^2)*sin(), where sin() = y(t)/r0
%(b)
h = 864;
a = G.*ms./(r0.*r0);
vc = sqrt(a.*r0);
fprintf(1,'vc = %.6f (m/s)\n',vc);
%(c)
%assume the planet is right from the sun
x(1) = r... |
function score = check_similarity(train, test, show_contours)
% ----------------------- Description ----------------------- %
% %
% Compute similarity of two matrces by calculating %
% their Normalized Cross-Correlation (NCC) measure
% ... |
%% 20180421_002556
file = [20180422, 222209]; % 4 mW, 698.63 after spectra
data = DataScanSeq(file);
save('20180422_222209_local.mat','data', 'file');
%% Load local data
load('20180422_222209_local.mat');
%% Redo logicals
%data = data.modifyScan('SurvivalLoadingLogicals', {[1, 2], [1, 2], [1, -2], [-1, 2]}, ...
%... |
function F = evolut(ti, x, r, tau)
syms t real;
sigmx = [ 0 1 ;
1 0];
sigmz = [ 1 0 ;
0 -1];
sigmy = [0 -1i;
1i 0];
q = [ 1 0 ;
0 1];
cnot = [1 0 0 0;
0 1 0 0;
0 0 0 1;
0 0 1 0];
H_s = [1i*r 1;
1 -1i*r] ;
% look at the sec. "Simulating the non-Her... |
file_name = 'MYD04_3K.A2017118.2210.006.NRT.hdf';
lat = hdfread(file_name, 'Latitude');
lng = hdfread(file_name, 'Longitude');
wind = hdfread(file_name, 'Wind_Speed_Ncep_Ocean');
aerosol_type = hdfread(file_name, 'Aerosol_Type_Land');
aerosol_size = hdfread(file_name, 'Angstrom_Exponent_1_Ocean');
dlmwrite('lat.txt'... |
%% load_data.m
%- Load data from FRF and NCEP servers into Matlab arrays
%-
%% Function: get_NCEP
function [wtime hs tp dp] = get_WIS(year,month,field)
%Field is the type of variable you want : geopotential_height,temperature,u,v,w
%Dimension of output value is (time,pressure_level,latitude,longitude) ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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#... |
function [D,C,Objfun,Sparsity,NSRE,Dchange,Cchange,taxis] = SOUP_DILLO_s_CUp(Y,J,lambda,K,L)
global DiffCZs;
global x;
global Z_start;
global method;
global DL;
DiffCZs = zeros(1,K);
% Useful definitions:
[n,N] = size(Y);
In = eye(n); v1 = gpuArray(In(:,1));
H_lambda = @(b) b.*(abs(b) >= (lambda));
% Dt=... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2013 Analog Devices, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http:/... |
function MI = MI_Gauss(Cov_X,Cov_XY,Cov_Y,Z, normalization)
% Calculate Multi (Mutual) Information given covariance of/between data at past and
% present
%
% (Ay, 2001; Ay, 2015, Entropy; Barrett & Seth, 2011, PLoS Comp Biol)
%
% INPUTS:
% Cov_X: covariance of data X (past, t-tau)
% Cov_XY: cr... |
%%%%%%%%%%%%%%%% PLOT BLOBS %%%%%%%%%%%%%%%%
% Plot the convex hulls of the tracked blobs on images and saves the images
% in a directory in 'savePath'. Plots all blobs, even those that have been
% removed.
% Inputs:
% N - the number of images
% inDirectory - directory the original... |
function q3c()
% This script requires the following functions to be implemented:
% q2_error
% q3_predict
% q3_leave_one_out_error
assert(checking('q3c')==0);
S = load('parkinsons.mat');
X = S.trainsetX;
Y = S.trainsetY;
clear S;
k = 1:2:13;
err = q3_leave_one_out_error(X, Y, k);
close all;
plot(k, err, 'bo-');
... |
function [imgout] = imscatter(img,ij,w,h,s)
%--------------------------------------------------------------------------
%
% Copyright (c) 2011 Jeffrey Byrne
%
%--------------------------------------------------------------------------
%% Figure setup
if ~exist('h','var')
h=figure(sum(char(mfilename)));
set(h,'Numb... |
function xo = normalize( xi )
%NORMALIZE Summary of this function goes here
% Detailed explanation goes here
xo = (xi-ones(size(xi,1),1)*mean(xi,1))./(ones(size(xi,1),1)*std(xi,0,1));
end
|
opts = optimoptions(@lsqnonlin,'Jacobian', 'on', 'Algorithm', 'levenberg-marquardt', 'InitDamping', 1);
x0 = [1; 1];
[x,resnorm,res,eflag,output2] = lsqnonlin(@myfun,x0,[],[],opts);
%% my LM
version = 1;
disp('my implementation')
x = x0;
delta = [1; 1];
iter = 1;
nu = 2;
[F, J] = myfun(x);
if version == 1
ta... |
function [paraL,paraR]=postProsessing(ciL,ciR,fc,cc)
phiL=ciL(5)*180/pi;
phiR=ciR(5)*180/pi;
taoL=acos(ciL(4)/ciL(3))*180/pi;
taoR=acos(ciR(4)/ciR(3))*180/pi;
dL=5.5*(fc(1)+fc(2))/2/ciL(3);
dR=5.5*(fc(1)+fc(2))/2/ciR(3);
xL=dL*(ciL(2)-cc(1))/fc(1);
xR=dR*(ciR(2)-cc(1))/fc(1);
yL=dL*(ciL(1)-cc(2))/fc(2);
yR=dR*(ciR(1)-c... |
function SV = stacktimes(S,V)
% STACKTIMES Multiply each matrix in a vertical stack of matrices, S, times
% each vector in a list of row-vectors, V. Equivalent to the following:
% s = size(V,1);
% n = size(V,2);
% m = size(S,1)/s;
% SV = zeros(s,m);
% for ii = 0:(s-1)
% SV(ii+1,... |
%potencia em regime permanente
Prp=0.45;
%Potencia eletrica maxima fornecida durante defeito
PEdd= 0.3;
%Potencia Eletrica Maxima fornecida apos o defeito
Pepd=0.7;
%Potencia eletrica Maxima em regime permanente
Pemrr= 1;
d0=asin(Prp);
df=asin(Prp/Pepd);
dmax=acos((Prp*(df-d0)-0.3*cos(d0)+0.7*cos(df))/0.4);
|
function [key,keyCount,keyMoveDetermination,keyAllModels,modelIndex,nonZeroPriorModel,AllPossibleMoves,AllPossibleNumPaths,AllPossibleNumOfModelsForEachMove,AllPossibleMovesTReactions,AllPossibleMovesNumTReactions,count] = determineAllPossibleMoves(typeSampling,initialIncludedSpeciesPool,targetNode,nReactions,reactionT... |
clc;
im = imread('abc.jpg');
red = zeros(size(im));
green = zeros(size(im));
blue = zeros(size(im));
red(:,:,1) = im(:,:,1);
green(:,:,2) = im(:,:,2);
blue(:,:,3) = im(:,:,3);
subplot(2,2,1);imshow(im);title('original');
subplot(2,2,2);imshow(red);title('red');
subplot(2,2,3);imshow(green);title('green');
subplot(2,2... |
function [legacy_fields, visuals, fields] = get_visuals(subj_id, run, conn, do_cache, plays_post_collection)
%clear all;
%conn = mongo('holy7c22108.rc.fas.harvard.edu', 27017, 'heroku_7lzprs54', 'UserName', 'reader', 'Password', 'parolatamadafaqa')
%subj_id = 1;
%run_id = 6;
%query = sprintf('{"subj_id": "%d", "run_id... |
function res = normsolu(solu, N, d, grid)
res = sqrt(spsolu(solu, solu, N, d, grid));
end
|
function s = recording(wav, recObj, T)
record(recObj, T);
soundsc(wav.wave, wav.Fs);
pause(T*1.1);
s = getaudiodata(recObj)';
end |
% [P,K,c,cinv] = readAMPLdatpedm(filename)
%
% read a partial distance matrix stored into an AMPL file _gph.dat
% return the partial EDM P and the dimension K. Also return a mapping
% c:index->vertexlabel and cinv:vertexlabel->index
function [P,K,c,cinv] = readAMPLdatpedm(fn)
fid = fopen(fn);
if fid == -1
... |
%% Purdue AGU plots
% Scripts in different sections to generate various plots used in the AGU
% presentation
%
%
% INPUTS - Previously generated intermediate data files
%
% OUTPUTS - plots!
%
% EXAMPLES - go to a section and press ctr-enter
%
%
% Dependencies
% .m files, .mat files, and MATLAB products required:(upda... |
% QMG1C.m
% DOING PHYSICS WITH MATLAB
% https://d-arora.github.io/Doing-Physics-With-Matlab/
% Documentation
% https://d-arora.github.io/Doing-Physics-With-Matlab/mpDocs/QMG102.htm
% IAN COOPER
% matlabvisualphysics@gmail.com
% 230508 Matlab R2021b
clear; close all; clc
% SETUP: Gaussian function - p... |
% Connectomics
n = 100;
p = 0.21;
A = rand(n)<p;
%sum(A(:))/n^2;
% Likelihood
% In general we wan't to compute log likelihoods because likelihoods are
% small numbers and when multiply very many very small numbers we get tiny
% numbers and get numerical rounding errors or even run out of...
% So in practice - compu... |
% Learn substitutions with regression
W = Ws{2};
W = W.filter_vocabulary(2,Inf,Inf);
ref = W.m.X(W.Vi(W.Vi~=0,:),:);
[nns, dist] = knnsearch(ref, ref, 'K', size(ref,1), 'distance', 'cosine');
V = W.V(W.Vi~=0);
F = W.termFrequencies();
F = F.Frequency(W.Vi ~= 0);
rng default
c = cvpartition(W.Y, 'holdout', 0.5);
WC... |
function [ x,y ] = Adams4x( F, x0, xn, y0, h )
%四阶Adams显式公式
%输入 fun=函数f(x,y),
% x0=左端点,
% xn=右端点,x0 <= x <= xn
% y0=初值y0=y(x0),
% h=步长,
%输出 向量x的元素是自变量x的取值,
% 向量y的元素是利用四阶Adams显式公式求出初值问题在向量x的元素处的数值解
n=fix((xn-x0)/h);
if n<5, return, end; % 四阶Adams显式公式需要用到前面4个点的值,n不能小于5
% 先用常用四阶RungeKutta法算出... |
clear; close all; clc;
addpath('C:\Users\akehi\Documents\GitHub\GNSSLIB\')
lam=plotpos('gpsdata\gps2_20150630_lambda.pos');
clam=plotpos('gpsdata\gps2_20150630.pos','Color',1);
figure
lam.ugraph('xy')
hold on
clam.ugraph('xy')
grid on
legend off
hgexport(1,'aa2.eps')
% figure
% lam.graph('xy',1)
% lam.re... |
classdef (Sealed) UTestAffinityMatrixMex < amg.AmgFixture
%UTestAffinityMatrixMex Unit test of the affinitymatrix MEX
%implementation.
% This class tests the affinitymatrix.c MEX function correctness vs.
% the MATLAB equivalent affinityMatrix().
%
% See also: LOWDEGREENODES.
%====... |
function make_sqw_all
% make all the iron sqw files
make_sqw_ei787
make_sqw_ei196
make_sqw_ei87
make_sqw_ei401
make_sqw_ei200
make_sqw_ei1371
|
function s = sparse(varargin)
%SPARSE Create a sparse distributed matrix.
% S = SPARSE(I,J,S,M,N,NZMAX,P) generates an M-by-N sparse distributed
% matrix distributed according map P with space allocated for NZMAX
% nonzeros (note that NZMAX applies to the overall distributed matrix,
% not to individual... |
function [beta] = update_beta(X, Z)
V = length(X);
nu = zeros(V,1);
for v=1:V
nu(v) = sum(sum((X{v}-X{v}*Z).^2));
end
tmp = sum(1./nu)^2;
beta = (1./nu).^2./tmp;
end
|
function [ x_hat ] = Estimation_Loop( w, G, z_ft, hash, offset, tau, I_l )
%UNTITLED11 この関数の概要をここに記述
% 詳細説明をここに記述
for i = 1:I_l
x_hat = z_ft(hash(i))*w^(tau*i)/G(offset(i));
end
end
|
%% THIS SCRIPT DEMOSTRATES TRAINING AND DEPLOYING A LINEAR CLASSIFIER
%% 1 - REDUCE NUMBER OF CLASSES IF REQUIRED
% change no_classes
no_classes_dataset = 3;
%%%%%%%%%%%%%%%%%%
training_dataset = cell(no_classes_dataset,1);
for n1 = 1:1:no_classes_dataset
training_dataset{n1,1} = training_all{n1,1};
en... |
function jac = getJacobian(evalFcn,POIs)
% Takes a set of parameters for the function bHandle
% as well as any arguments you'd like to pass to bHandle
%
% POIs - baseline parameters, p
% evalFcn - q(params)
%
% Returns the normalized jacobian evaluated at p:
% (pj / qi) (partial qi/ partial pj) = S
%%
nPOIs=length(... |
function [X_norm, mu, sigma] = feature_normalize(X, mu, sigma)
%FEATURE_NORMALIZE Normalizes the features in X
if ~exist('mu', 'var') || isempty(mu)
mu = mean(X);
end
X = double(X);
X_norm = bsxfun(@minus, X, mu);
if ~exist('sigma', 'var') || isempty(sigma)
sigma = std(X_norm);
end
X_norm = bsxfun(@rdivide, X_n... |
% Filename : rectres_tm.m
% Author : Lnyan
% Email : i@llonely.com
% =============================================================================
% Description :
% 矩形空腔谐振器 TM 模
function [ex,ey,ez,hx,hy,hz] = rectres_tm(x,y,z,m,n,p,a,b,l,omega,A,epsilon_r,mu_r)
epsilon=8.854187817*1e-12*epsilon_r;
mu=4*... |
% A_w.m
%
% Takes "scrambled Hadamard" measurements.
%
% Usage: b = A_w(x, OMEGA, P)
%
% x - N vector
%
% b - K vector
%
% OMEGA - K vector denoting which WH coefficients to use
%
% P - Permutation to apply to the input vector. Fourier coeffs of
% x(P) are calculated.
% Default = 1:N (no scrambling).
%... |
% test for constrainted path planing using an heuristic.
%
save_image = 0;
name = 'room_big'; % warning : this is a *big* map, expect large computation time.
name = 'room'; % warning : this is a *big* map, expect large computation time.
name = 'room1'; % a small map
map_name = ['data/' ... |
function [gamma__rr,gamma__rl,gamma__fr,gamma__fl] = camberModel(phi)
% ----------------------------------------------------------------
%% Function purpose: compute wheel camber values, depending on static camber
%% and vehicle roll angle
% -------------------------------------------... |
function [aj,ind] = choose_max_aj_similar(r,A)
[~,ind] = max(r' * A);
aj = A(:,ind);
end
|
function [ROC, PR] = analyseMatches(match)
T = [0; sort(match.distRatio,'ascend')];
True = match.CorrectMatch == 1;
False = match.CorrectMatch == -1;
ROC = zeros(numel(T),2);
PR = ROC;
FPR = zeros(numel(T),1);
TPR = FPR;
OMP = FPR;
for i = 1:numel(T)
% t = T(i);
% Pos = match.distRatio <= t;
% Neg = match.... |
function stName = SortName(ogName)
% given unsorted image file name, sort is according to the postfix number
imageNames = {ogName.name}';
imageStrings = regexp([imageNames{:}],'(\d*)','match');
imageNumbers = str2double(imageStrings);
[~,sortedIndices] = sort(imageNumbers);
stName = imageNames(sortedIndices); |
%%
% y(t)=y(t-1)*(1-h)+h*u(t-1)
h=0.01;
t=0:h:20;
u=sin(t);
y0=zeros(1,length(t));
y0(1)=0;
for i=2:length(t)
y0(i)=y0(i-1)*(1-h)+h*u((i-1));
end
plot(t,y0);
%%
%y=u/(1+s)
G=tf(1,[1,1]);
y1=lsim(G,u,t);
hold on
plot(t,y1,'r')
legend('Euler framåt','Lsim')
shg
%%
|
clear all;
close all;
clc;
% 1. initializeScope
% 2. run set up scope section
% 3. run the scope section
% 4. run the image/plot section
% 5. deinitialize scope before closing!!!
%% Manual Initialization
% initializeScope;
% deinitializeScope;
%% ---set up scope---
global scopeStatus;
scopeStatus.resolution = 1... |
function compare_CF_pRF(session_dir,srcROI,trgROI,map_type,ROIs)
% Creates scatter plots of CF data.
%
% Usage:
% compare_CF_pRF(session_dir,srcROI,trgROI,map_type,ROIs)
%
% Examples:
% compare_CF_pRF(session_dir,'volume','prf_V1','movie')
%
% Written by Andrew S Bock Jul 2015
%%
if ~exist('ROIs','var')
... |
%% Testing new function
Params1 = [linspace(18.04, 18.26, 18), linspace(18.98, 19.24, 14), ...
linspace(19.48, 19.74, 14)] * 1e6;
Params2 = [linspace(18.04, 18.26, 18), linspace(18.98, 19.24, 14), ...
linspace(19.48, 19.74, 14)] * 1e6;
Params3 = linspace(18.46, 18.80, 69) * 1e6;
clear o;
o(1).Par... |
% File: Example2_18.m for Example 2-18
clear;
% First, plot the Transfer Function as given by Eq. (2-145).
% Select values for R and C.
R = 10e3;
C = 0.5e-6;
tau = R*C;
fo = 1/(2*pi*R*C);
j = sqrt(-1);
% Evaluate the Transfer Function
for (k = 1:10)
f(k) = 1000*2^(-10)*2^k;
H(k) = 1/(1 + 2*pi*f(k)*tau*j)... |
d1 = load("x_out_1.txt");
d2 = load("x_out_2.txt");
close all
d1_true = [-0.55, 0.0, 0.064];
d2_true = [0.0, -0.45, 0.064];
figure
hold on
for i=1:3
plot (d1(:,i) - d1_true(i))
plot (d2(:,i) - d2_true(i))
end
legend('x1','x2','y1','y2','z1','z2')
|
function phi = phi_dis(type_of_phi, Z, probs)
N_st = probs.number_of_states;
q_probs = est_q(Z,N_st,probs);
phi = phi_dis_pq(type_of_phi, probs, q_probs);
end |
x = [-3:.1:3];
y1 = normpdf(x,0,1);
y2 = normpdf(x,-0.5,1);
plot(x,y1)
figure
hold on
plot(x,y1)
plot(x,y2)
plot(x,y2+y1) |
%visualisation script
addpath('export_fig');
load votes_Results.txt;
load normC_Results.txt;
load normC_ResultsBinned.txt
load normCMax_Results.txt;
load normCMaxBinned_Results.txt;
load recErr_Results.txt;
load recErrAccBinned_Results.txt;
load recErrMin_Results.txt;
load recErrMinBinned_Results.txt;
%remove zero ent... |
function [res] = pressure_average_velocity_basis_jump_local_minus_local_plus...
(llcoord, grid,params,paramsP,tria_index,local_vertex_index)
%function evaluating L^2 norm
%(\psi^-, n^+ \cdot \phi^+ )_{\partial \Omega \cup \partial \Omega_D}
tria_index_neighbour = grid.NBI(tria_index,local_vertex_index);
face_index_... |
Mw=picks(i).Mw;
pf_pick;
Tpulse = 1/f0;
for j=1:5
% for j=1:length(picks)
clear temp1 temp2 temp3 ttP ttnf ttS
temp1 = mij*picks(j).syn_uh1;
temp2 = mij*picks(j).syn_uh2;
temp3 = mij*picks(j).syn_uz;
ttP = find(picks(j).syn_t==picks(j).t_P);
ttnf = find(picks(j).syn_t==picks(j).t_nf);
... |
rgb=imread('test4.png');
alpha = 8;
theta = pi;
Lab = RGB2Lab(rgb);
[h, w, ~] = size(Lab);
n = h * w;
L = reshape(Lab(:,:,1), 1, n);
A = reshape(Lab(:,:,2), 1, n);
B = reshape(Lab(:,:,3), 1, n);
tmp = zeros(h, w, 3);
tmp(:, :, 1) = reshape(L, h, w);
figure(1);
tmp = Lab2RGB(uint8(tmp));
imshow(tmp);
% figure(2);
% gra... |
function [ W, e, r, X, Y ] = lms( v, s, m, alpha, W)
%LMS Implementation of LMS algorythim for 2 input ADALINE
% v - raw input noise near noise source
% s - pure input signal
% m - percieved noise near input signal
% alpha - learning rate
% e_limit - epoc limit for acceptable error
i = size... |
function [a,l] = Gauss(n,a,l )
%Guass solves a matrix using forward elimination using scaled partial
%pivoting
% Detailed explanation goes here
s = zeros(n);
for i=1:n,
l(i) = i;
smax = 0;
for j=1:n,
smax = max (smax, abs(a(i,j)));
end
s(i)=smax;
end
for k = 1:n-1,
rmax = 0;
for i ... |
function e = sibling_core_genotype(f_geno, m_geno, freq, emission_option)
a2g = emission_option.allele2genotype;
g2p = emission_option.genotype2pair;
a2i = emission_option.sibling_ibd_states;
nf = emission_option.nuclear_emission;
n_col = max(max(g2p));
n_row = max(max(max(max(a2i))));
p = freq(1:2);
e(1:n_row... |
function [lam] = Lmembrane(N, k)
% Dirichlet eigenmodes of the laplacian on the L-shaped membrane
vertex=[1; 1+1i; -1+1i; -1-1i; -1i; 0];
corners=[2; 4; 5; 1];
lam=rectlap(vertex, corners, N, k);
end |
classdef eslabon < handle
%La clase eslabon resume las principales propiedades
%de un eslabon en un robot manipulador
properties
tipo = '';
ang = 0;
posicion = [0 0];
end
methods
% gettipo(obj);
% setang(obj, angulo);
% getang(obj);
% ... |
classdef RangeDensity_sim < SENSOR_CLASS
% RangeDensityのsimulation用クラス:登録されたエージェントのうち半径内のエージェントの位置を返す
% rdensity = RangeDensity_sim(param)
% (optional) param.r : 半径
% param.id : このセンサーを積んでいる機体のidと一致させる.
properties
name = "";
result
interface = @(x) x;
t... |
%% Instructions
% All the parameters listed below can be tweaked for finding the required component values.
% Please be careful to check the impedence values Z1, Z2, C1, C etc are legible.
% Change the Quality factor to as per need if a bottleneck is reached in the capacitor and inductor values.
% The cable propert... |
% Function to be optimized:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [J]=trait(x,theta,popcount)
a=0.5-(0.1*sin(theta(1))^2);
b=0.9+0.1*sin(theta(2));
t1=1+0.1*(sin(theta(3)));
t2=100+(1.5*sin(theta(4)))^2;
beta=4+0.5*(sin(theta(5)));
if popcount==1;
end
y=x;
[del_sort2,col]= fun1();
u1=zeros(1,col);
u2=zeros(1,c... |
#include "com_codename1_ui_Calendar.h"
const struct clazz *base_interfaces_for_com_codename1_ui_Calendar[] = {};
struct clazz class__com_codename1_ui_Calendar = {
DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_com_codename1_ui_Calendar ,0 , &__GC_MARK_com_codename1_ui_Calendar, 0, cn1_class_... |
% LIF MATLAB model - based on code
% and lecture slides of Prof. Kevin Gurney
%% CLEANUP
clear all
clc
clf
%% PARAMETER SETUP
% membrane constants
tau = 0.020;
R = 3e7;
% resting potential
E = -0.070;
% threshold for a spike
theta = -0.030;
% change in time - window
dt = 0.0001; %should be less than tau
% total milli... |
clear all
clc
%% outline
% gen the all atom int name and index
%% load data
load Mat_016_cluster_3_20Dia_int.mat
ind_int = load('../sh_file/work_draw_int_noh_ind/ind_int.txt');
ind_at = load('../sh_file/work_draw_int_noh_ind/ind_at.txt');
na_at = {'C','C','O','H','H','H','N','C','C','O','H','H','C',...
... |
clc; clear all; close all;
t = -3:.001:3;
x = 2*cos(3000*pi.*t);
c = cos(3e6*pi.*t);
kp = .001;
kf = 2e5*pi;
%Phase Modulation
pmtheta = kp.*x;
pm = cos(3e6*pi.*t + pmtheta);
subplot(2,3,1)
plot(t,pm)
title('PM Time Domain');
PM = fft(pm);
subplot(2,3,2)
plot(t,abs(PM))
title('PM Frequency Domain... |
% power Sweep using timer
% In development
%
function [t1, t2] = VNAPowerSweepWithTimer(vna, varargin)
% scan VNA power
% Parameters:
% Required: the vna object
% Optional: see the inputParser
%
% Returns two timer object t1 and t2.
%
% Use expandStructure(t1.UserData) to get freqs, pows & SParams, etc.
%
% Wentao... |
function results = reg_glm(y,mdl,opts,varargin)
% Fit regularized linear binning models
%
% Uses glmfitpq function by Patrick Mineault
% https://www.mathworks.com/matlabcentral/fileexchange/31661-fit-glm-with-quadratic-penalty
%
%{
% make X and regularizer (Q) matrices
opts=[];
opts.family = 'normid';
opts.algo='lbfg... |
function yd=ord11(t,y)
global kp tp a omega;
yd=(-y+kp*a*sin(omega*t))/tp; |
function k = gray2int(g)
% k = gray2int(g) solves g = int2gray(k) for k ,
% but ONLY if nonnegative integer array g <= bitmax .
% The time taken is proportional to the number of bits
% needed to hold g . NOTE: gray2int works only for
% MATLAB 5 and later versions.
% See also grays, int2gray... |
function trace_viewer_look(handles,viewlook)
% sets the look of the trace viewer depending on the value of viewlook
% viewlook = 1 verything of off
% viewlook = 2 things look correct
switch viewlook
case 1
set(handles.pushbutton2,'visible','off')
set(handles.pushbutton1,'visible'... |
function plane = fitPlane(points)
%FITPLANE Fit a 3D plane to a set of points.
%
% PLANE = fitPlane(POINTS)
%
% Example
% pts = randn(300, 3);
% pts = transformPoint3d(pts, createScaling3d([6 4 2]));
% pts = transformPoint3d(pts, createRotationOx(pi/6));
% pts = transformPoint3d(pts, creat... |
function rootdir = atroot
%ATROOT returns Accelerator Toolbox root directory
[pdir, pname, pext] = fileparts(which(mfilename));
rootdir = fullfile(pdir,'');
|
clear;
N=64;
T=5;
t=linspace(0,T,N);
h=exp(-t);
dt=h(2)-h(1);
f=1/dt;
H=fft(h);
F=H(1:N/2+1);
f=f*(0:N/2)/N;
plot(f,abs(F),'-*');
xlabel('Frequency');
ylabel('|F(k)|');
|
% function from deep irf to DC:
function [U]=get_dc_conv(U,FT,fc)
N=FT.nwin;
omega=FT.omega;
tau = 1/4*1/(2*fc);% pulse width prop to corner frequency
Shat=zeros(N,1);
Shat(2:N/2) = 4.*exp(-1i*omega(2:N/2)*2*tau).*(sin(omega(2:N/2)*tau/2).^2)...
.*sin(omega(2:N/2)*tau)./((omega(2:N/2)*tau).^3);
a=size(U);
for k=1... |
dataloc=strcat(Filepath,'\CTEAS_Output');
cd(dataloc);
delete('Data_Temperatures.lvm');
delete('PhaseNames.lvm');
delete('jade_data.mat');
delete('xtal_data.mat');
clc;
clear all;
close all; |
function [ Kdw ] = dispersion( XMAX,YMAX,SIGMA,D )
%DISPERSION RELATION Find the wave number using iterations of the
%disperision equation for a plan view grid of bathymetry
% Detailed explanation goes here
%
%
%The MIT License (MIT)
%Copyright (c) 2016 Evan B. Goldstein
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
p=input('Masukan panjang : ')
l=input('Masukan lebar : ')
luas=p*l
keliling=2*(p+l)
disp("Luasnya: " + luas)
disp("Keliling: " + keliling)
|
%% PAYLOAD STUDY MAIN FUNCTION
% Inputs:
% mult: [lower, upper] bounds on the Aspect Ratio
% mult2: [lower, upper] bounds on the Wing Area
%
% Outputs:
% output: a struct that contains the useful information.
%
% Author: jjenkins
function PayloadStudy(m1,m2,m3,mult,mult2)
global R... |
function F=float_Z_theat_180(A,B,H,theta,c)
d=tan(theta)^2+4*A*c;
xmin=-sqrt(H/A);%左极限点x
xL=(H-c)/tan(theta);%左交点x
xR=(tan(theta)+sqrt(d))/(2*A);%右交点x
xmax=sqrt(H/A);%右极限点x
cof=4/(3*sqrt(B));Cof=1/sqrt(B);
fun1=@(x) (tan(theta)*x+c-A*x.^2).^1.5;%右边
v1=quadv(fun1,xL,xR);v1=v1*cof;
fun... |
function u = g3b(y, xref, ctrlpar)
% Control function
%
% Compute the control signal, in this case it is a P-controller which gives
% a control signal proportional to the vector between the current position
% and the reference position.
%
% Input arguments:
% y - measurement y,
% xref - the reference vect... |
function newActivityReading = LRCgapFillActivityReading(activityReading, startTime)
%LRCGAPFILL Resample data to evenly spaced increments filling gaps with 0s.
% expectedInc must be in the same units as timeUTC
% timeUTC and cs must be vertical vectors with at least 2 entries
if ~isdatetime(activityReading.timeUT... |
function varargout = prova_image(varargin)
% PROVA_IMAGE MATLAB code for prova_image.fig
% PROVA_IMAGE, by itself, creates a new PROVA_IMAGE or raises the existing
% singleton*.
%
% H = PROVA_IMAGE returns the handle to a new PROVA_IMAGE or the handle to
% the existing singleton*.
%
% PROVA_IMA... |
function [ out_img ] = threshold_student(in_img, red_threshold, ...
green_threshold, blue_threshold)
% This function creates an output image which is thresholded by the three
% values in red_threshold, green_threshold, and blue_threshold.
|
function [Zr, t] = romp2d_v2_5(Y, A, A_t, C, N, k, ad)
%% 2D ROMP
% composed by Rinabell
% version 1.0 @18-04-28E
% version 2.0 @18-04-30
% version 2.5 @18-05-01
% Zr = omp2(Y, A, A_t, C, N, k)
% z: vectorized recovered spikes
% Y: (m x m) sample matrix
% A: (m x n) sampling matrix, A = Phi * Psi
% A_t: A'
... |
function dist = GetLaserScans(N, derp)
% GetLaserScans()
%
% Author: Xavier Perrin - xavier.perrin@mavt.ethz.ch
% Based on the work of Davide Scaramuzza - davide.scaramuzza@ieee.org
% ETH Zurich - Mai, 4, 2007
% -------------------------------------------------------------------------
% MOST IMPORTANT PARAME... |
classdef EucTriFact
%
% @author: Jeffrey Chan, 2013
%
properties
m_fComputeCoordDesc = ComputeCoordDescObjective;
% Other extra terms
m_fComputeExtraTerms = NaN;
end
methods
function obj = EucTriFact(varargin)
inParser = inputPars... |
function [LocoMeasData, BPMData, CMData, RINGData, FitParameters, LocoFlags] = buildlocoinput(OutputFileName)
%BUILDLOCOINPUT - Combines response matrix, BPM standard deviation, and
% dispersion files (or measurements) into a LOCO input file
%
% [LocoMeasData, BPMData, CMData, RINGData, FitParameters,... |
function [ points3d_v2 ] = create_cellArr2( points3d , n_images )
%OUTPUT: a cell array of size (18,2). Where the first entries of the cell
%array are consecutive "pairs of frames". Eg. In
points3d_v2 = cell(size(points3d,1)-1,2);
for i = 1:size(points3d,1)-1
arr1 = points3d{i,1};
arr2 = points3d{i + 1,1};
... |
function h=mygplot(A,xy,lc)
%GPLOT Plot graph, as in "graph theory".
% GPLOT(A,xy) plots the graph specified by A and xy. A graph, G, is a set
% of nodes numbered from 1 to n, and a set of connections, or edges,
% between them.
%
% In order to plot G, two matrices are needed. The adjacency matrix, A,
% has a(... |
%Skrypt wyliczajacy wzmocnienie K dla regulatora LQ
%najpierw wywolanie skryptu do linearyzacji wokol punktu pracy
function [K,S,e]= wagiLQ(Q,R,N)
linearyzacja;
%Dobieranie macierzy wag Q karze stany a R wejscia
[K_par,S_par,e_par] = lqr(A,B,Q,R,N);
K=K_par;
S=S_par;
e=e_par;
|
% sweep f_p
%% parameters
f_start = 3.e9;
f_stop = 4.e9;
f_ps = linspace(f_start, f_stop, 3000);
P_ps = [-20,0,6];
%%
%sg1.power(P_p);
%sg3.power(P_s);
sg1.on;
sg3.off;
data_sweep_all = {};
data_wide_all = {};
% fname = apddstr('sweep_f_SG1_test');
% fname = apddstr('sweep_f_SG1');
%fname = a... |
function [P,L,U,e] = factlupivotes(A)
[n, m] = size(A);
if n ~= m
error('matriz no cuadrada');
end
U = A;
L = eye(n);
P = eye(n);
for k = 1:n-1
[~,j] = max(abs(U(k:n,k)));
if j ~= 1
r = j + k - 1; % ESTO ES EL i estrella
v = P(k,:); P(k,:) = P(r,:); P(r,:) = v;
v = U(k,k:n); U(... |
function hFig = findGui(name)
%FINDGUI find a gui by its name bring it ot front if found
% return empty if not found
hFig = findall(groot, 'Type', 'figure', 'name', name');
if ~isempty(hFig)
figure(hFig);
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.