text stringlengths 8 6.12M |
|---|
%{
beh.Licks (manual) #
-> beh.Session
timestamp : bigint #
---
%}
classdef Licks < dj.Relvar
methods
function self = Traces(varargin)
self.restrict(varargin{:})
end
function plot(self,tmst)
time_lim = [-1 5];
fig... |
function [] = savefig(name)
set(gcf, 'PaperPosition', [0 0 7 5]);
set(gcf, 'PaperSize', [7 5]);
print(name, '-dpdf');
end |
%% Plot
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(1);
surf(X,Power_out_dbm_cal_pramp,Power_out_dbm_cal);
xlabel('频率');
% 创建 ylabel
ylabel('输入功率(dBm)');
% 创建 zlabel
zlabel('输出功率(dBm)');
% 创建 title
title('输入功率(dBm) vs 输出功率(dBm)');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(2);
surf(X,Power_out_dbm_c... |
% same as set_stim, but just the function form of it.
% geenrate the stimulus using a a poisson distribution
% script set_stim_iti does the same, but it generates the stimulus using
% ITIs that are generated from a poisson distribution.
% this scrip is faster than set_stim_iti
%{
visdur = 1000; % value(WaitDur... |
%% This function [globally] optimizes the model parameters for WGP for regression.
% It is a generalized WGP which includes group concept.
% #Inputs:
% [x] dxn training data matrix.
% [y] 1xn training target.
% #Outputs:
% [theta] a 1x2 kernel parameter vector, where K(i,j) = theta(1)^2*exp(-|x[i,k]-x[j,k]|^2/(2*theta(... |
function [q3] = multiplyQuat(q1,q2)
%MULTIPLYQUAT function that multiplies 2 quaternions
%
% Inputs: q1: first quaternion (ORDER MATTERS)
% q2: Second quaternion (ORDER MATTERS)
%
% Output: q3: outcome quaternion
q3(1) = q1(1)*q2(1)-([q1(2);q1(3);q1(4)]'*[q2(2);q2(3);q2(4)... |
function [frms, mrms, rmsd] = gtsrms(mmd)
%最後の方のデータは切り捨て
l = length(mmd);
frms = cell(1);
mrms = cell(1);
rmsd = zeros(1,l)';
for i = 1:l
frms{i} = mirrms(mmd{i},'Frame');
mrms{i} = mirrms(mmd{i});
rmsd(i) = mirgetdata(mrms(i));
end |
function [varargout]=cons(algn,varargin);
% usage: [D,Dmat]=cons(algn);
%
% This function computes the conservation of amino acids at positions in a
% multiple sequence alignment (algn) (see tutorials, or Note 103). In
% addition, the function outputs a global measure of conservation of all
% amino acids at each pos... |
clc; clear all;
load fisheriris
|
function [Sout,phi] = CPE_PN_receiver(Sin,Stx,C,CPE)
% Last Update: 19/02/2018
% [1] Tobias Fehenberger et al, "Compensation of XPM Interference by Blind
%Tracking of the Nonlinear Phase in WDM Systems with QAM Input", in Proc.
%ECOC 2015, paper ID: 0361, 2015.
%% Input Parameters
[nPol,nSamples] = size(Sin);
nTap... |
% testing process
function test
% basic values
global numlines datalines currentimage
% parameters
curvesegmentthresh=16;
% see if using live data
% TEEDATA1/goodT - 3 errors on rotation into std orientation - 31 good
% Samples: 31 Mean: 2.1634 Max: 2.7836 Min: 1.0012
% TEEDATA1/badT - 12 trials: 4... |
function Simula_Circuito_Diodo()
% Paramentros del Cicuito
Vmax = 10; % Volts;
R = 1.8; % ohm
%tiempo de evaluaci?n
t = [0:0.001:0.1];
%Voltaje en funci ?on del tiempo v = Vmax*sin(377*t);
for k = 1:length(t)
I(k) = ReglaFalsa(@Circuito_Diodo, -Vmax/R, Vmax/R, [v(k), R]);
en... |
close all
clear all
clc
%% import data
%This dataset (2014) has a measurement for every 3 hour.
% column 1 - 6 is the year, month, date, hour, minute, sec
% voc_2016 = importdata('Mastdata_VOC_2016.txt');
% voc_2017 = importdata('Mastdata_VOC_2017.txt');
CS_file = load(['C:\Users\mette\Documents\MATLAB\Hyytiälä\Hyde... |
function [cloud, indexes] = readCloud(cloudName, filter)
% READCLOUD reads a pcd file and optionally trims it to 3 dimensions.
cloud = readPcd(['..' filesep 'data' filesep cloudName '.pcd']);
% Remove 4th dimension
cloud = cloud(:, 1:3);
if filter == true
indexes = all(cloud'<1);
cl... |
clear,clc,close all
%% Time specifications:
k=40; % number of period's
nrbits=k/4; % bits pear second
N=1000; % samples
F=40e3; % freq hz
T=1/F; % period
Fa=N/T; % samples per second
... |
function [rij, dir] = distancematrix(r1, r2, varargin)
%distance matrix Creates a matrix of the distances between points in vectors r1, and r2 and unit direction vectors
% Detailed explanation goes here
[na, dim] = size(r1);
[na2, ~] = size(r2);
for i = 1:na
for j = 1:na2
dr = 0;
for k = 1:dim
... |
isTraining=1;
isSubModOptimisiation=1;
vid = dir('../sumMe/videos/');
nVid=length(vid);
for i=2:nVid
temp = vid(i).name;
vidName = temp(1:length(temp)-4);
obj=VideoReader(temp);
frCount = floor(obj.Duration * obj.FrameRate);
try
calculateInterestingnessScore;
catch
display(vidName);
continue;
end
end |
% Generate random phrases, swapping out body terms and verbs
% Amy LaViers, Cat Maguire, and Catie Cuan
% The Robotics, Automation, and Dance (RAD) Lab Summer Exchange, July 2018
% Posted on GitHub October 24, 2019
clear all
verbs=['Watch '; 'Smells'; 'Leaves'; 'Put '; ' ';' ';' ';'Go ';'G... |
Met het statement 'axis equal' maak je de maatstreepjes
langs de assen van een grafiek allemaal even lang.
|
function [sol, w0, w, n_w, s_idx, m_idx, fun] = solve_SVN(X, Y, H, fun, C)
N = size(X,1);
[Hy, f, A, b, Aeq, beq] = built_quad_prog(Y, C);
H2 = -H.*Hy;
optim_ver = ver('optim');
optim_ver = str2double(optim_ver.Version);
if optim_ver >= 6
opts = optimset('Algorithm', 'interior-point-convex', 'MaxIter', 30, 'Disp... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Wasserstein Inverse covariance Shrinkage Estimator
% Viet Anh NGUYEN, Daniel KUHN, Peyman MOHAJERIN ESFAHANI
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Portfolio Optimization Application
%
clear all; close all; clc;
startu... |
function varargout = DeathClock_GUI(varargin)
% DEATHCLOCK_GUI MATLAB code for DeathClock_GUI.fig
% DEATHCLOCK_GUI, by itself, creates a new DEATHCLOCK_GUI or raises the existing
% singleton*.
%
% H = DEATHCLOCK_GUI returns the handle to a new DEATHCLOCK_GUI or the handle to
% the existing singleton... |
function [reginvmatrix] = createreginvmatrix(numPixels)
% Creates the Laplacian ID Matrix based on the numPixels^2.
%
% 2D Mexican Hat filter
% Ls = [0 -1 0
% -1 4 -1
% 0 -1 0];
% Edges have issues to deal with
L_Edge = 2:1:numPixels-1;
R_Edge = (numPixels^2)-(numPixels-2):1:(numPixels^2)-1;
T_Edge = numPix... |
function x = subgradient(A,x,t,P)
[~,n] = size(A);
e = zeros(n,1);
ind = x==max(x(:));
e(ind) = 1;
x = x - t*P*e;
end |
function [Q, T] = EBBM3D_ND2QP(Les, No)
%EBBM3D_ND2QP returns nodal to quadrature interpolation matrix and qp to
%nodal integration matrix
%
% USAGE:
% INPUTS:
% OUTPUTS:
[xi, w] = LGWT(No, -1, 1);
[xi, si] = sort(xi);
w = w(si);
Ne = length(Les);
Q = zeros(Ne*No*3, (Ne+1)*5);
T = zeros((Ne+1... |
function rhs=lotka_volterra_sindy_rhs(t,x,dummy,A_handle, param)
rhs = param*A_handle(x(1), x(2))';
|
function diffusion(x,y,c0)
xlim=[0 50];
ylim=[0 50];
C=zeros(50,50);
Cnew=zeros(50,50);
C(x,y)=c0;
DeltaT=0.1; %step of Time
D=0.1; %diffusion factor
gamma=8; %cAMP decay rate
DeltaX=1;
DeltaY=1;
test=1;
while test==1
for i=3:48
for j=3:48
% if C(i,j)<0
% ... |
function grid = boardToGrid(board)
[rows, cols] = size(board);
size_rows = rows * 100;
size_cols = cols * 100;
%read images
grid = imread('boardImage.jpg');
turn1 = imread('snail1.jpg');
turn2 = imread('snail2.jpg');
snail1_mark = imread('snail1_mark.jpg');
snail2_mark = imread(... |
function [ freqC,DistC ] = closeDecision( peaks,prev_hr)
% choose the peaks that be close to prev_hr
freqC = [];
peakC = [];
DistC = [];
for i = 1:size(peaks,2)
[f,p,d] = closeDecision_sub(peaks(:,i),prev_hr);
freqC = [freqC,f];
peakC = [peakC,p];
DistC = [DistC,d];
... |
function u = uq_sampleU(N, M, options)
%UQ_SAMPLEU(N, M, options) returns N samples from the M-dimensional
%uniform space [0,1]. The structure 'options' can be used to set some
%additional options, namely:
%
% Options.Method : allows to specify the sampling method. Possible
% values are 'MC' (default), 'grid', 'LHS... |
clc
clear all
clc
clear all
%%%% Set up scaling constant
% Define fundamental constants in S.I units. All energies are in eV from
% CODATA 2006 at http://physics.nist.gov/cuu/Constants/index.html
hbar=1.054571628E-34; %Planck's constant [Js]
m0=9.10938215E-31; %Free electron ma... |
function ID = STAR_NAME(Data, Pair,ac_er_ang, ac_er_dis,ID_known)
SizeD = size(Data);
m=0;
for i = ID_known+1:(SizeD(1)-1)
for j = i+1:SizeD(1)
m = m+1;
K = STAR_ID(Data,Pair,ac_er_ang, ac_er_dis,ID_known+1,i,j);
SK= size(K);
TriStar(1:SK(1),m,:) = K(:... |
function locationOfPole = findLocationOfPole()
load('/Users/adamyedidia/walls/src/pole_images/monitor_lines/b_dark/arr.mat')
obsPlane = arr;
obsPlaneSize = length(obsPlane);
scene = getMultiBarScene(obsPlaneSize);
locationOfPole = searchOverLocations(scene, obsPlane);
% dv = locationOfP... |
% shows percs LALALA
function [] = ShowPercs(Andrea, Davide, Emanuele, Model, ActualSpeaker, adjust)
%Create a custom colormap
%33 / x = 100 / 64 => x = 64/100*33
if adjust
max = ceil(64/100*(80-33));
min = 1;
else
max = ceil(64/100*80);
min = ceil(64/100*33);
end
cmap = zeros(64,3);
cmap(1:min,1) = 1... |
function [Left,Bottom,Top] = ENO_Interpolation_Stencil (N0, N5, M0, M5,...
Order, c1, c2, c2b)
Left = zeros(N5,M5);
Bottom = zeros(N5,M5);
Top = zeros(N5,M5);
% Determine Left most interpolating point with ENO approach
for j = M0:M5
Left(N0,j) = N0; Left(N5-Order+1:N5,j) = N5-Order;
for i = N0+1:N5-O... |
%
% SCROLLX - scroll a 2D data matrix in the X (first dimension) by a known number of pixels
%
% scroll_data = scrollX(data,pixels)
%
% data - input 2D data matrix
% pixels - number of pixels to scroll in X
% scroll_data - output 2D data matrix
%
%
function sp = scrol... |
%% total variation, primal
clear; close all; clc;
u = zeros(250,250);
u(:,100:150) = 15;
u(50:90,:) = 10;
u(101:150,:) = 15;
u(160:200,:) = 20;
for i = 1:250
for j = 1:100
u(i,j) = 2*i/50;
end
end
n = rand(size(u));
u = u + n.*2;
u = double(u);
u0 = u;
plotEnergy = zeros(1,10);
im = u;
im0 ... |
function [ ms_disagree ] = get_msdisagree( v, N )
%GET_MSDISAGREE Summary of this function goes here
% Detailed explanation goes here
[r c] = size(v);
dif_vg = zeros(1,r);
vg_g(1,:)=mean(v(1,:));
vg_g(2,:)=mean(v(2,:));
for k=1:N
dif_vg(:,k)=norm(vg_g-v(:,k)) .^2;
end
ms_disagree=mean(dif_vg);
e... |
classdef TrialStartBlock < WBTrial
methods
function start(this)
%this.flow.variable('BlockNum', 1);
doFMRI = this.flow.variable('forFMRI');
blockNum = this.flow.variable('BlockNum');
blockNum = blockNum + 1;
this.flow.variable('BlockNum'... |
function [ status_check ] = check_if_verified(possible_new_set, Lopt)
%[ status_check ] = check_if_verified(possible_new_set, Lopt)
%
%Check if a combination of constraints was already verified
%Inputs:
% possible_new_set - candidate set of constraints
%
% Lopt - list of already verified constraints
... |
function [ input ] = InputTerrain(filename, Trainingnum, TerrainWid, TerrainLen, ShowImg)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
A = imread(filename);
B = im2double(A); % change data type
[c1, c2, c3] = size(B);
% reshape the terrain height map into a 100 by 100 matrix
idx_ro... |
function [I,Ie] = sample_sinusoid(amplitude,taille,T0,theta,ratio)
fn = max(2* (1/T0) * cos(degtorad(theta)), 2 * (1/T0) * sin(degtorad(theta)));
I=sinusoid2d(amplitude, theta, taille, T0, 1);
Ie=sinusoid2d(amplitude, theta, taille, T0, 1 + floor(1/(ratio * fn)));
end |
close all; clear all; clc;
% get the list of pages
motors = dir('./motors/*.html');
num_motors = numel(motors);
%num_motors = 2;
% loop through the pages
num_unknown = 1; % just check these after other code finishes running
%T = table(Product_Number, Description, Voltage, Stall_torque, Resistance, Induct... |
classdef CCAUtil
methods(Static)
% Reference: "A probabilistic Interpretation of Canonical
% Correlation Analysis".
% Bach and Jordan 2006.
% THM 2:
% assuming generative model:
% z ~ N(0,Id) for min(d_1,d_2) > d >= 1,
% x_i|z ~ N(W_iz + mu_i, \Psi_i), i... |
function printable_vals = get_printable_vals()
printable_vals = make_printable_vals_struct( './aux/attack/printed-palette.png', 30 );
end |
function [header,headersize] = ReadAIHeader(file)
% ReadAIHeader: Read the header from raw waveform files (AI = analog input)
% [header,headersize] = ReadAIHeader(file)
% AI files are written either by (version 1) the
% LabVIEW VI 'create AI binary header.vi,' or
% (version 2) by C code.
% Other header creators are der... |
clear all
close all
clc
% to load different picture, change code in line 29
%% load camera parameters and distortion model
K = load('calibrations/K.txt');
projMat = load('calibrations/projectionmatrix.txt');
R_T = inv(K)*projMat;
R = R_T(1:3,1:3);
T = R_T(1:3,4);
focalLength = [K(1,1) K(2,2)];
% K transpose (MATLAB... |
function Distortion=DistortionHARHAR(T, EXP);
% DistortionHARHAR - Panel for the GUI to specify distortion tones.
% F=DistortionHARHAR(Title, EXP) returns a GUIpanel F allowing the
% user to specify if distortion tones. The Guipanel F has title Title.
% EXP is the experiment definition, from which the number o... |
function varian7TDicomConverter(dcmFileName, numberOfGradient)
% DICOM Converter for Varian 7T MR Scanner
%
% Scripted by Atsushi Yamada, PhD
% Assistant Professor
% Bio Medical Innovation Center and Department of Surgery
% Shiga University of Medical Science
%
% ************ Notification for Diffusion Toolkit *******... |
function [mean_avg_pre,eachPrecision] = meanAveragePrecision(allAccuracyArr)
mean_avg_pre = 0;
eachPrecision = Inf(1,1);
for i=1:1:size(allAccuracyArr,1)
temp_data = allAccuracyArr{i,1};
avgPrecision = 0;
for j = 1:1:size(temp_data,1)
avgPrecision = avgPrecision + temp_data(j,1)*temp_data(... |
function regData = regressSignal(inData, regSignal)
%REGRESSSIGNAL Regress one or more signals from input data
% This function performs signal regression on input data. This is useful for regressing nuisance
% signals (known to be artifactual or uninteresting) from data sets. The regression is performed
% in a ve... |
function[x_en_mm, y_en_mm] = convertir_px_a_mm_polinomio(datos_px, datos_py, lut)
% le tengo que dar aquello que yo quiero convertir, en pixels
datos = importdata(lut, '\t', 1);
datos = datos.data;
x = datos(:, 3);
y = datos(:, 4);
px = datos(:, 5);
py = datos(:, 6);
% ... |
function PDhistograms( P )
neuralData = {'m1','pmd'};
% plotHist = true;
%% set up time bins
f = @(t) (t/1000)-1.5;
metaData = P.Properties.UserData;
centerTimes = nanmean(metaData.regressionTimes,2);
t = f(1:length(P.sevenCycle));
vp = P{P.type=='vp','sevenCycle'};
vv = P{P.type=='vv','sevenCycle'};
% hacky way of f... |
function [lo_limit,hi_limit] = bandlimits(center_frequency,octave_width)
%[lo_limit,hi_limit] = bandlimits(center_frequency,octave_width)
%Returns the bandpass limits for a given center frequency and a given width in terms of octave
%Center frequency is in Hz
lo_limit = 2 * center_frequency / (1 + 2^octave_width)... |
function [theta, thetad] = annealModel(input, output, options, extIters, recVar, dynVar)
load(input);
Y = Y + sqrt(recVar)*randn(size(Y));
theta = [1 1 1];
thetad = ones(size(thetad));
if (recVar ~= 0)
for iters = 1:extIters
fprintf(2,'Iteration %d\n',iters);
lntheta = log(theta);
... |
function krPlotEyePosition(handles)
ai = handles.ai;
dio = handles.dio;
warning('off')
whichScreen = 2;
res = Screen('Resolution',whichScreen);
% now open up a second matlab figure to be used to view eye position
axes(handles.EyePosition);cla;
axis([-res.width/2 res.width/2 -res.height/2 res.height/2]);
hold on
rect... |
function flyTracks = calculateOccupancyStats(flyTracks, refOdor)
% Calculate occupancy times for flyTracks
%%%%%%%%%%%%%%%%%% Doesn't work for multiple odor pulses!!! %%%%%%%%%%%%%%%%%
firstOdorFrame = find(floor(flyTracks.relTimes) == (flyTracks.stim{2}(1) + flyTracks.chargeTime),1);
lastOdorFrame = find(ceil(flyTrac... |
clear
c=read_bf_file('csi.dat');
h=zeros(length(c),1);
for i=1:length(h)
h(i) = c{i}.csi(1,1,1)./c{i}.csi(1,1,1);
end |
clc
clear
%%
dem = xlsread('dataset25housesninemonths.xlsx',2,'B2:Z49');
Pg = xlsread('dataset25housesninemonths.xlsx',3,'B2:B49');
Solar = xlsread('dataset25housesninemonths.xlsx',5,'B2:Z49');
Wind = xlsread('dataset25housesninemonths.xlsx',4,'B2:Z49');
res=Wind+Solar;
alpha = xlsread('dataset25housesninemonth... |
function [net] = buildNetwork(images, labels)
%buildNetwork provides the interface to create a new MLP
%
%PARAMETERS
% images - the image dataset to analyze
% labels - image labels
%
%OUTPUT
% net - the basic neural net
% get size of output vector
[~, imgSize] = size(images);
nodes = imgSize;
... |
%% Description
% This code will implement forward feature selection in order to determine
% the simplest model that best describes neural spiking. First, the
% highest-performing single-variable model is identified. Then, the
% highest-perfmoring double-variable model that includes the
% single-variable model is identi... |
function S = makeforcecoefs(S, U, varargin)
% function S = makeforcecoefs(S, U, varargin)
% Converts forces and impulses in the S structure to force and impulse coefficients.
%
% Units:
% forcescale -> [g/cm^3] * [cm] * [cm/s]^2 = g cm / s^2 = dynes / cm
% S.Faxialtotcoef -> [dynes/cm] / [dynes/cm] = dimensionless
o... |
function playTexture_WarpedGrating
%play checkerboard with inverting polarity
%assumes normalized color
global Mstate screenPTR screenNum daq loopTrial
global Gtxtr Masktxtr %Created in makeTexture
global Stxtr %Created in makeSyncTexture
%get basic parameters
P = getParamStruct;
screenRes = Screen('Resolution',... |
clear all
close all
clc
%% generate square wave
Fs = 10000;
Ts = 1/Fs;
signalLength = 1;
time = 0:Ts:signalLength;
f = 1000/(2*pi);
x = square(1000*time); %Generate square wave of frequency, w = 2*pi*f = 1000
figure(1);
plot(time,x);grid on; %plot signal in time domain
axis([0 .05 -1.2 ... |
%Crea Ordenes
sellMiniIbex = sender.sell(symbol2 ,bidVolumemIbex ,bidPricemIbex,orderID);
orderID=orderID+1;
buyIbex= sender.buy(symbol1 ,askVolumeIbex ,askPriceIbex,orderID);
orderID=orderID+1;
%envia ordenes
%application.send(buyIbex,sessionId);%Envia orden a MEFF
%application.send(sellMiniIbex,sessionId);%Env... |
% Copyright 2018 - 2020, MIT Lincoln Laboratory
% SPDX-License-Identifier: X11
%%
function plotEncounterWithLimits(outputFolder, plotFigures, saveDirectory, numExamples, iniSettings)
% The purpose of this function is to plot the altitude and speed of
% generated encounters to check that they are within the desired min/... |
function [Cost] = fnCostComputation(x_traj,u_new,p_targets,dt,Q_f,R,Vx)
[~,Horizon] = size(x_traj);
Cost = 0;
[~,w] = size(p_targets);
p_target = p_targets(:,end);
Q(1,1) = 100;
Q(2,2) = 100;
Q(3,3) = 0;
for j =1:(Horizon-1)
% Find closet target
if w >= 3
if j < (Horizon-1) * (1 / lengt... |
function [ A ] = vec2sym( Avec )
%VEC2SYM Takes in Input a vector of elements of a symmetric matrix, and
%gives as output a symmetric n x n matrix
%ordered in the following way:
% |a1 |
% A_vec = [a1 a2 ... av]' --> A = |a2 \ |
% ... |
function result = find_template(image, template, scales, rotations, result_number)
% function result = find_template(image, template, scales, rotations,
% result_number)
% returns the bounding boxes of the best matches for the template in
% the image, after searching all specified ... |
classdef L2DataOpt < handle
%L2DATA L2数据的类,暂时只用于期权
% 程刚,20151108
%%
properties(SetAccess = 'public', GetAccess = 'public', Hidden = false)
code;
under;
S; % 实时更新
CP; % 1 - call, 2 - put
K;
T;
M; % Moneyness; % (S-K)+ 或 (K-S)+
l... |
data = readtable("gothenburg.csv");
%%
X = data.X;
Y = data.Y;
pop = data.Pop_500;
fsi = data.FSI_500;
gsi = data.GSI_500;
xRange = [min(X), max(X)];
yRange = [min(Y), max(Y)];
%% Visualize city
%file = 'TerrangkartanRaster_1701_3006/terrRast3006_6378585_290475.tif';
file = 'tatortRast3006_637... |
function dy = dynamo(t,y,coeffs)
m = coeffs(1);
g = coeffs(2);
r = coeffs(3);
f = coeffs(4);
dy = zeros(6,1);
dy(1) = r*(y(4)-y(1));
dy(2) = r*(y(3)-y(2));
dy(3) = y(1)*y(5) + m*y(2) - (1+m)*y(3);
dy(4) = y(2)*y(6) + m*y(1) - (1+m)*y(4);
dy(5) = g*(1-(1+m)*y(1)*y(3) + m*y(1)*y(2)) - f*y(5);
dy(6) = g*(1-(1+m)*y(2)*y... |
% script8_1.m, 底稿練習
clear %清除
x=linspace(-6,6,36); %建立向量x
y=linspace(-6,6,36); %建立向量y
[xx,yy]=meshgrid(x,y);
zz=yy./(xx.^2+yy.^2+1);
surf(xx,yy,zz); axis tight % 繪出 |
function hlines = PlotDots(x,Y,spacing)
% PlotDots: give user control over spacing of dotted lines
% hlines = PlotDots(x,Y,spacing)
% The one tricky part is that spacing has to be done in terms
% of normalized units, rather than physical units; therefore,
% you must set the axis limits to their final values BEFORE
% ca... |
function [ phase_shift ] = get_hilbert_phase_shift(trials, freq_min, freq_max, SamplingInterval)
%GET_HILBERT_PHASE_SHIFT Summary of this function goes here
% Detailed explanation goes here
phases_filtered = get_hilbert_phase(trials, freq_min, freq_max, SamplingInterval);
freq_mean = (freq_min + freq_max)/2;
% ph... |
function [rbest phi_best] = lonoisenoiseNorm(time,Fs,s)
matlabpool(8);
global minfreq
global maxfreq
global dur
global len
global range
global mag
global Fsamp
Fsamp = Fs;
prior = -inf;
minfreq = 2000;
maxfreq = 11000;
dur = time/1000; %now dur is in sec
len = round(dur*Fsamp); %number of s... |
function getDCM (data_path, sub_path, model)
% creates 6 models, model is one integer from 1 to 6
% data_path, data path for SPM file
% sub_path, sub director for DCM files
%--------------------------------------------------------------------------
spm('defaults','EEG');
% Data and analysis directories
%----... |
addpath /rota/Analysis/PS/osc2011
sig_fft3d 20121101 68450 t1=-0.1 t2=1.4 swapxy cbar=8 colors=WBR window=15000 fmax=2162.1 fmin=462.1 t0=8.183 sqrt=1 cutamp=0.3 flarm=1362.1
%ylim([-800 400])
print 20121101_68450.png -dpng
sig_fft3d 20121101 67934 t1=-0.1 t2=1.4 swapxy cbar=8 colors=WBR window=15000 fmax=2054.1 fmin=... |
%task5
clear;
im=imread('find_id.jpg');
load data_for_labC.mat;
percentage=[0.1 0.53];
% for i=1:1:5
% noiseimage=imnoise(im,'salt & pepper',percentage(i));
% ID2(i)= get_employees_ID_from_DB (noiseimage,employees_DB,eignfaces_blk);
% end
% disp(ID2);
noiseimage=imnoise(im,'salt & pepper',percentage(1));
ID... |
function [d_optim, phi_optim, var_res_optim, decision, pvalue, c_optim] = SETAR_FIT_D(y,p,c)
for d=1:5
c_optim(d,1) = SETAR_FIT(y, p, d);
[phi(:,d), ~ , var_res(d,1)] = SETAR(y,p,d,c_optim(d,1));
[decision(d,1), pvalue(d,1)] = TestSETAR(y,p,d,c_optim(d,1));
end
[~, index] = min(var_res);
d_optim = ... |
%> @file dataType.m
%> @brief Represents the allowable data type containers for use in K-Means
%> @details Provides an enumeration of data types to represent the avalailable type containers. Provides a method for converting these types into a human-readable string
%> @author Ben Nordin
%> @date 2011-09-01
% ===========... |
function z=fp_wft2f(type,f,sigmax,wxl,wxi,wxh,sigmay,wyl,wyi,wyh,thr)
%FUNCTION
% z=fp_wft2f(type,f,sigmax,wxl,wxi,wxh,sigmay,wyl,wyi,wyh,thr)
%
%PURPOSE
% 2-D WFT [Fourier version]: Fourier transform is used to compute
% convolutions.
%
%INPUT
% type: 'wff' or 'wfr'
% f: 2D input signal
% sigmax: s... |
n = 2000;
d = 500;
scl = 20;
X = rand(d,n);
mu1 = rand(d,1);
Sigma1 = rand(10*d,d)/scl;
Sigma1 = Sigma1'*Sigma1;
mu2 = rand(d,1);
Sigma2 = rand(10*d,d)/scl;
Sigma2 = Sigma2'*Sigma2;
% disp(['cond(Sigma1): ' num2str(cond(Sigma1))])
% disp(['det(Sigma1): ' num2str(det(Sigma1))])
I{1} = X;
I{2} = mu... |
clear all;
% Datapath = '../ForContextSwitchProject/DoubleCueDatabase/BPM1_3/ContextSwitchHalo/';
% ExptDates = {'2018-02-11','2018-02-12','2018-02-13', '2018-02-14', '2018-02-16'};
% ExptDates = {'2018-02-17','2018-02-18','2018-02-20','2018-02-22','2018-02-23','2018-02-24'};
Datapath = '/Users/rvrikhye/Dropbox (... |
% Fonction d'activation et cible pour la classification de signal
% ***************************************************************
disp('Fonction cible');
periode = 20;
nbrPeriode = 150;
[Cible,u] = genFctPer(periode,nbrPeriode,'Alternée');
T_tot = periode*nbrPeriode;
T_out = (1:T_tot);
T = length(T_out);
figCibl... |
function enum = enumerate(strings)
% Returns a struct, whose fields are the input strings and whose
% correspoding values are the numbers 1:numel(strings) so that
% enum.(strings{i}) = i for all i in 1:numel(strings). If any string is not
% a valid field name, it is made valid using genvarname(), therefore it is
%... |
%利用3σ准则准则剔除误差较大值
function[data]=Q1_step3(data)
[n,dim]=size(data);
for i=1:dim
vec=data(:,i); %取出一列数据
flag=1;
while(flag==1) %循环
flag=0;
NoNaN_vec=vec(~isnan(vec)); %取出非空元素
aa=mean(NoNaN_vec); %非空元素均值
sig=sqrt((1/(length(NoNaN_vec)-1))... |
function M=mandelbrot(cmin,cmax,hpx,niter)
vpx=round(hpx*abs(imag(cmax-cmin)/real(cmax-cmin)));
z=zeros(vpx,hpx);
[cRe,cIm]=meshgrid(linspace(real(cmin),real(cmax),hpx),
linspace(imag(cmin),imag(cmax),vpx));
c=cRe+i*cIm;
M=mjcore(z,c,niter);
endfunction
|
%% General setup
clear
my_dir = '~/Documents/Courses/OCN513/data/';
N = flipud(load([my_dir,'N.txt'])); % [1/s]
Nsq = N.^2; % [1/s^2]
M = 1 ./ Nsq; % [s^2]
[I,J] = size(M); % # of vertical levels, # of profiles
H = 4000; % [m]
z = linspace(-H,0,I)';
dz = z(2) - z(1);
%% Nsq profiles
plo... |
%% Advanced Topics in Surgical Robotics - B Term 2019
% Homework 1 - Problem 4 - Differential Kinematics of the C-arm
clear, clc, close all
%% *** DO NOT TOUCH THE CODE IN THIS SECTION - SKIP TO LINE 24 ***
% Create and display the kinematic chain
a4 = 0.3;
a5 = 1;
robot = SerialLink([...
PrismaticMDH('a', 0, '... |
% set variable subjNum to run ViewFlatROIs.m
% e.g.
% >> clx, subjNum=48; ViewFlatROIs
% or to save jpg to /raid/MRI/data/RETINOTOPY/jpegs/
% >> clx, writeOut=true; subjNum=48; ViewFlatROIs
% This should run as a function?
% v1 only wedge scans
% v2 wedge+ring
% v3 uses FindFMRIdata + does either Retinoto... |
function [presence, O_b, O_d, F] = createFibroPattern(mesh, density, params, Ps, offsets)
% This function takes a list of points and a set of parameters (listed
% below), and creates a pattern of fibrosis accordingly.
%
% Usage: presence = CreateFibroPattern(points, direction, density, params, Ps, offsets)
%
... |
function [centroids,idx] = runkmeans(X,initial_centroids,max_iters,plot_progress)
if ~exist('plot_progress', 'var') || isempty(plot_progress)
plot_progress = false;
end
if plot_progress
figure;
hold on;
end
[m n]=size(X);
K=size(initial_centroids,1);
centroids=initial_centroids;
previous_centroids=centro... |
function y = expBound(x, transform)
% EXPBOUND Constrains a parameter to be positive through exponentiation.
limVal = 36;
switch transform
case 'atox'
index = find(x<-limVal);
y(index) = eps;
x(index) = NaN;
index = find(x<limVal);
y(index) = exp(x(index));
x(index) = NaN;
index = find(~isnan(x));
i... |
function [x, y] = makeCheck(ix,iy)
global board
backup = board;
[mx, my] = find(~isnan(board(ix,iy).possible));
if isempty(mx)
x = NaN;
y = NaN;
board = backup;
return;
end
type = board(ix,iy).type;
team = board(ix,iy).team;
if team == us
other = them;
else
other = us;
end
good = 0;
for ii... |
% code to estimate out of sample
clear all
clc
% we read the true mean vector and covariance matrix
load mu.mat
load Sigma.mat
% we define certain variables
Sigmah=sqrtm(Sigma);
%invSigmah=inv(Sigmah);
N=10;
onevec=ones(N,1);
% sharpe ratio tangent% number of observations
theta2=mu'*(Sigma\mu);
% sharpe ratio hedge
sig... |
%% Basic Info
% 1/16th microstepping is effectivley the limit to conserve torque for most
% situations.
%
% http://reprap.org/wiki/Step_rates
% https://www.micromo.com/technical-library/stepper-motor-tutorials/microstepping-myths-and-realities
% https://duet3d.dozuki.com/Wiki/Choosing_and_connecting_stepper_motors
% ... |
population = 50;
generation = 250;
p_crossover = 0.6;
p_mutation = 0.25;
% generate init solution with polulation size
kp_range = [2, 18];
ti_range = [1.05, 9.42];
td_range = [0.26, 2.37];
kp_solution = transpose((kp_range(1,2) - kp_range(1,1)).*rand(population,1) + kp_range(1,1));
kp_solution = round(kp_solution, 2)... |
function [biny,sep]=en_runs_1sep(r,p,cbook,lenz,biny)
if lenz > 600
biny=[biny 0]; %flag length(z)>600
%separating r into rk and rw ------------------------------
n=hist(r,[1:max(r)]);
thd=find_thd(n,p); %thdddddddddddd=thd %%%%%%%%%%%%%%%%%%%%
bin = encode_stationary_source(thd,cbook); biny=[uint8(b... |
function fphys = matNdgConservativeNonhydrostaticUpdata(obj, physClass, fphys) %protected function in nonhydrostait
%> @brief Function to make the nonhydrostatic correction
%> @details
%> Function to make the nonhydrostatic correction
%> @param[in] physClass The hydrostatic solver
%> @param[in] fphys The fphys field
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.