text stringlengths 8 6.12M |
|---|
% MBLBM.M
% for Bloch equations window menu control
% Generated from mpmain
global mpgtype
% Set up for menu position and offset ********************************
mmgmincr = mmgmincr + 1 ;
mblnmxyoff = mmgmxyoff*mmgmincr ;
mblnmxypos = mmgmxypos + mblnmxyoff ;
figure('Position',mblnmxypos) ; % New menu window
% Clea... |
%% speed encoding per fish
idx_temp=Speed_encoders(2).idx;
ZS_temp=ZS2(idx_temp,:);
fish_temp=unique(idx_Fish(idx_temp));
ToPlot_slow=nan(length(idx_time_temp),length(unique(idx_Fish)),61,4);
idx_time_temp=[2 4 6 7];
for i=1:length(idx_time_temp)
for fish_nb=1:length(fish_temp)
ToPlot_slow(i,fish_nb,:... |
function loop=loop(tag)
oritemp_recommend=zeros(20);
aftert=zeros(1,20);
beforet=zeros(1,20);
ret=0;
temp_recommend=zeros(20);
convergence_set=zeros(20,20);
theset=zeros(20,20);
temp_RSL=RSL();
for i=1:20
if(i==1)
disp(['次數' num2str(i)] );
oritemp_recommend=originrecommend();
%loa... |
clear;
A=rand(100,30);
m=mean(mean(A));disp('平均值:');disp(m);
st=std(A,0,'all');disp('方差:');disp(st);
max=max(max(A));disp('max:');disp(max);
min=min(min(A));disp('min:');disp(min);
k=find(A>0.5);
[m,n]=size(k);
p=m*n/3000;disp('大于0.5的随机数的概率p:');disp(p); |
% MTLSLDTC.M
% expansion factor (editable test)
% Called by mtltm
mtlsldvs = get(mtlsldstr, 'String') ;
mtlsldv = str2num(mtlsldvs) ;
if isempty(mtlsldv) ; % Check for number
set(mtlsldstr, 'String','ERR', ...
'BackGroundColor','red') ;
return ;
end ;
if mtlsldv < 1 ; % Check for positive
set(mtlsldstr, 'String... |
function ySort = quickSort(y,x)
%Sorts a vector of elements y (e.g. spike counts, or spike times) based on
%the unique elements of an input vector "x" (e.g. stim conditions)
uX = unique(x);
nuX = numel(uX);
[nDim1,nDim2] = size(y);
if nDim2 == 1 %if dim 2 is singleton, properly align dimensions
nPts = nDim2;
... |
% base workspace exported at 05-Oct-2015 %
fid = double(3);
% Product1 workspace exported %
|
function [ ] = ej24b( )
close all;
N = 4;
M = 2;
imtikal = imread('.\images\halloween.jpg');
imtikalgray = rgb2gray(imtikal);
imtikals=edge(imtikalgray,'sobel');
imtikallapl=fspecial('log');
imtikall=imfilter(imtikalgray,imtikallapl);
imtikalc = edge(imtikalgray,'canny');
imtikalp = edge (imtikalgray,'prewitt');
fig... |
%*******************************************************************************
%* Program: exact_mhd_run.m
%* Description: Start up file to run a nonlinear Riemann sovler for
%* 1D Magnetohydrodynamic equations.
%* Author: Andrew Kercher
%----------------------------------------------------------------... |
function buttonHandle = makeButton(parent, name, position, fontSize, ...
funcNameHandle)
% To make code more readable use this funciton when setting up buttons
% parent is the tab or figure that the object is located on
% name is the text that will appear on the button in ''
% position is a 1x4 array [x y w h] whe... |
function y = squarethis (x)
y = x^2; |
addpath('../MRF/');
addpath('../Chan-Vese/');
loadDataFruitfly;
%generateData;
%Run MRF
edgeStruct = createImgStructure(X,nStates);
lambda = 1;
beta = 10;
% initialization
m = zeros(size(X,1),size(X,2));
m(10:size(X,1)-10,10:size(X,2)-10) = 1;
phi = m(:);
MuEst = [0,1];
SigmaEst = [0.1,0.1];
for i = 1:10
e... |
function P = gibbs_logpred(Adk,Bkw,...
I,D,K,W,di,wi,ci,citest,Id,Iw,Nd,alpha,beta);
% collapsed gibbs log predictive probabilities
Pdk = alpha + Adk;
ss = sum(Pdk,2);
Pdk = Pdk ./ ss(:,ones(1,K));
Pkw = beta + Bkw;
ss = sum(Pkw,2);
Pkw = Pkw ./ ss(:,ones(1,W));
Pi = zeros(I,1);
for ii = 1:I
Pi(ii) = Pdk(... |
function [signal,phaseatstart,newfreq] = phasereset_jz_steadybasefreq (time, fsample, wavefr, minfr, maxfr, startpos, resetpos, numones)
%
% Function generates signal composed of a single sinusoid whose phase is
% being reset. The frequency of the sinusoid is chosen randomly from a
% specified range [minfr, maxfr]. Th... |
clear; clc;
syms xi eta J y41 y12 x14 x21
N1=(1/4)*(1-xi)*(1-eta);
N2=(1/4)*(1+xi)*(1-eta);
N3=(1/4)*(1+xi)*(1+eta);
N4=(1/4)*(1-xi)*(1+eta);
N1x=(1/(8*J))*(y41*(eta-1)+y12*(xi-1));
N1y=(1/(8*J))*(x14*(eta-1)+x21*(xi-1));
N2x=(1/(8*J))*(y41*(-eta+1)+y12*(-xi-1));
N2y=(1/(8*J))*(x14*(-eta+1)+x21*(-xi-1));... |
clc;
clear all;
close all;
plotNum = 1;
input = imread('cat2_gray.png'); % 讀取題目圖片
subplot(2,2,plotNum);imshow(input);title('Input');plotNum=plotNum+1;
[M,N] = size(input);
input = im2double(input);
outputNoiseDithering = NoiseDithering(input);
outputNoiseDithering = im2uint8(outputNoiseDithering);
subplot(2,2,plotNum)... |
function [X0, X1] = point2radix2(x0,x1)
%计算2点的DFT
% 此处显示详细说明
X0 = x0 + x1;
X1 = x0 - x1;
end
|
%% this function is to generate all the possible transition probabilities sequence
% input: tranProb_value(all the possible transition probability value
% array) 1*M (M = the number of possible values of transition probability)
% output: tranProb_permu(all the possible transition probabilities
% sequence) N*M (N =... |
function [motor2,motor3,motor4,motor5] = gerador(num)
for i = 1:num
motor2(i) = randi([-90,90],1);
motor3(i) = randi([0,110],1);
if motor3(i) <= 90
motor4(i) = randi([-motor3(i),min([150,(150-motor3(i))])]);
motor5(i) = randi([max([-90,(-motor3(i)-motor4(i))]),min([11... |
clear;set(0,'defaultaxesfontsize',20);format long
%%% p15c.m Particle Filter (SIRS, OP), double-well
%% setup
J=1e4;% number of steps
alpha=2.5;% dynamics determined by alpha
gamma=.1;% observational noise variance is gamma^2
sigma=3e-1;% dynamics noise variance is sigma^2
m0=0; C0=1;% prior initial condition mean and ... |
function test_Afunc_circle
epsilon = 1e-10;
thetalist = [0 pi/10 pi/7 pi/5 pi/3 pi/2 3*pi/4];
% For a circle
m = 0;
for theta = thetalist
[A1, A2] = Afunc(m, theta);
assert(A1==1, ['A1 not calculated correctly for m = ' num2str(m) ...
' and theta = ' num2str(theta)]);
A2_check=exp(i*theta);
... |
function [P,K,V] = pca(Z,n)
% [P,K,V]=PCA(Z,n)
%
% P - Eigenvectors(sorted) of matrix Z. Each column represents an eigenvector.
% K - Eigenvalues (sorted) of matrix Z. It is a column vector.
% V - Variance explained by each eigenvalue. It is a column vector.
%
% Z - Matrix data with zero mean (each line points t... |
function userdata_saveT(t,data_dir,data_id,data_type)
filename = rawdata_getFileName(data_dir,data_id,data_type,'t');
save(filename,'t');
end |
run('reset_data_analysis_environment')
close all
load('initialG_DT_MB_all_precession_stats.mat');
%%
load('initialG_DT_MB_all_pre_collapse.mat');
EKIN_INF=1*1e3
PART_POP=find((alphas_Ekin>EKIN_INF).*(alphas_pos_z<0.2).*(alphas_pos_z>-0.2));
PART_POP=find((alphas_Ekin>EKIN_INF));
PICH_BIN_SIZE=0.05;
PITCH_BINS=(-... |
function [mlfcoeffs, R2] = mlffit1(XNodes, YDataPoints, mlfcoeffs0, Precision)
%
% Fitting data [XNodes, YDataPoints] by one-parameter Mittag-Leffler function
% y(t) = c*E_{alpha}(a*t^alpha)
%
% Output: mlfcoeffs(1) = alpha
% mlfcoeffs(2) = beta
% mlfcoeffs(3) = C
% mlfcoeffs(4) = a
%... |
%%
if exist('C:/Users/Yida Lin/Dropbox (Personal)/Sample Files/Real_Time_Phase_Evaluation/indices.mat', 'file')
load('C:/Users/Yida Lin/Dropbox (Personal)/Sample Files/Real_Time_Phase_Evaluation/indices.mat');
end
for RMSE_Phase_Threshold = 0.05 : 0.05 : 0.4
for nlopt_xtol_rel = 10.^[-6:4]
for iWndPRD... |
function T=Triangle3D(r,xdim,ydim,zdim,midy,midx,midz)
T=zeros(xdim,ydim,zdim);
for i = 1:xdim
for j = 1:ydim
for k = 1:zdim
x=i-xdim/2-midx;
y=j-ydim/2-midy;
z=k-round(zdim/2)-midz;
R=sqrt((x^2+y^2+z^2));
%disk
if((x^2+y^2+(z*xdim/zdim*2.5)^2)<r^2)
... |
function [JJ] = objective_function( ii,tmp_A,tmp_D1,tmp_D2,tmp_P,X,maxL,LABELS,lambda1,lambda2 ,label_data,per_D_size,M,m,F,mmm)
%UNTITLED 此处显示有关此函数的摘要
% 此处显示详细说明
tmp_A_1=tmp_A(:,1:size(label_data,2));%tmp_A_1是有标签数据的系数矩阵
M=mean(tmp_A_1,2);%有标签数据的系数的平均值
% X_size=zeros(1,maxL);
for j=1:maxL
c=tmp_A_1(:,LAB... |
% 17.06.16 - agh load existing transfer function data, fit using simple VE
% model
% r2: fit Loic's multiharmonic data
clear all, close all, warning off
addpath('~/Documents/postdoc/analysis')
addpath('../Step4_LielegOptimization_161207')
%datdir = '/Volumes/Hossein//PostdocJournal/Optical trap/Selected for Paper/';... |
function compile
% compile_cpp_files compiles the k4a3d mex MATLAB function.
% The C++ code is located in 1 file(s):
% K4a3d.cpp: MexFunction fastpointcloud adaptation recordings playback.
%
% Requirements:
% - Azure Kinect SDK 1.1.0. http://download.microsoft.com/download/E/B/D/EBDBB3C1-ED3F-4236-96D6-2BCB352F3710/... |
function [bands] = calcBandPower(dat,Fs, type)
bands = {};
if type ==0
for i = 1:size(dat,2)%petla po filmach
bands{i} = cell(size(dat{i},2),5);
for j = 1:size(dat{i},2) %petla po elektrodach
bands{i}{j,1} = {};
%filtrowanie i liczenie mocy
... |
function fig=stan_control_raster(COLORS)
% searches for mat files and associated log files, processes and copies to target directory
%
if nargin<1
COLORS='jet';
end
time_order=1e-2;
% get options
[options,dirs]=stan_preflight;
% all proc data goes into the same directory
option_names=fieldnames(options);
% which... |
% calculated process sensitivity through binning algorithm of case
%
function [S_cA_bin] = Process_sensitivity_B_c(c_t)
for iii = 1:100
clearvars a_index c_total var_t_c E_tb_c E_b_c;
N = 100*iii;
MB(1) = 0.5;
MB(2) = 0.5;
MA(1) = 0.5;
MA(2) = 0.5;
bin = 10;
for i = 1:21
... |
addpath(genpath('~/ADMMSoftmaxCode/')); % euler
clear all;
Ntrain = 40000; Nval = 10000; N = Ntrain + Nval; Ntest = 0.2*N;
[Dtrain, Ctrain, Dval, Cval, Dtest, Ctest] = setupMNIST2(N,Ntest);
% Dtrain, Ctrain = training data
% Dval, Cval = validation data
% Dtest, Ctest = testing data
Dtrain = reshape(Dtrain, 28*28,... |
%---------------User inputs-------------------------%
init_height = input('What is the initial height?: ');
init_velocity = input('What is the initial velocity?: ');
angle_degrees = input('Angle in degrees: ');
x_comp = input('x-component acceleration: ');
y_comp = input('y-component acceleration: ');
%----------... |
revdir = 'E:\imeka_data\imeka_florence\revEEG-fMRI_3mm_MB6_Series1201\revEEG-fMRI_3mm_MB6_Series1201' ; % directory with rev image
revname = 'Mag (0001)' ; % name of rev DICOM
forwarddir = 'E:\imeka_data\imeka_florence\EEG-fMRI_3mm_MB6_Series1101\EEG-fMRI_3mm_MB6_Series1101' ; % directory with fwd image
forwardname ... |
function [finalImage, meanColorLevel] = isolateChannel(channelName, image)
tempImage = image;
switch channelName
case 'r'
chIndex = 1;
tempImage(:, :, 2) = 0;
tempImage(:, :, 3) = 0;
case 'g'
chIndex = 2;
tempImage(:, :, 1) = 0;
... |
function [faults, indicies] = check_data( data_x, data_y, step, N_ma, threshold )
% Checks data for faults, checking every 'step' steps, and calculating
% fault based on last 'N_ma' number of moving average points. Triggers
% fault if above a certain threshold.
% Assumes data_x and data_y have same length.
% i... |
function outputImage = placeMonoOnRGB(baseImage, imageToPlace,x,y)
% places an RGB image onto another RGB-image
xSize = size(imageToPlace,2);
ySize = size(imageToPlace,1);
outputImage = baseImage;
imageToPlace = imageToPlace/max(imageToPlace(:));
outputImage((1+y):(y+ySize),(1+x):(x+xSize),1) = imageToPlace(:,:);... |
%==========================================================================
% The STRONG Algorithm
%==========================================================================
% DATE
% Feb 2017 (Updated in Dec 2019 by David Eckman)
%
% AUTHOR
% Xueqi Zhao and Naijia Dong
%
% REFE... |
function Img = RemoverCilios(MascaraExterna,InicioH)
Img = MascaraExterna;
[i,f] = size(MascaraExterna);
for a=2:i-1
for b=2:f-1
if a<InicioH
Img(a,b)=0;
else
Img(a,b)=MascaraExterna(a,b);
end
end
end |
% Parametres
R=1; % <Ohm>
L=0.5; % <Henry>
K=0.01; % <N.m.A^(-1)>
J=0.01; % <Kg.m^2.s^(-2)>
f=0.1; % <N.m.s>
tau_L=0; % <???> |
h= imread('.jpg'); %Input your image here
[r,c]=size(h);
subplot(1,2,1)
imhist(h)
title('Original histogram')
[counts,bin]=imhist(h);
Max = max(h(:));
Min = min(h(:));
mid = (Max+Min)/2;
fourth = (Min+mid)/2;
threef = (Max+mid)/2;
for i=1:1:r
for j=1:1:c
if h(i,j)== Min
h(i,j)= 0;
else... |
clear all,
clc,
%% CONSTANTES
format long;
global c;
c = 3e8;
%% Cargamos entorno de simulación -> TOA
[X_s,Y_s,Z_s,x,y,z] = Asturias_AD2_1;
Coord_pos = [ x' y' z'];
Coord_pos = Coord_pos';
%% Velocidades y aceleración de la trayectoria
v_xyz = zeros(3,length(Coord_pos(1,:)));
for j = 1:1:3
for i = 2:1:l... |
%function [reschangedPositions, resMatrix] = algorytmzmniejszajacyICzzastowowaniemdjikstry(A_begin, changePercentage, changePossibilityThreshold)
function [reschangedPositions, resMatrix] = algorytmzmniejszajacyICzzastowowaniemdjikstry(A_begin)
k = 5;
ic_minimal = 1/4;
k_min = 1.1;
changes_limit = 100;
A_min = A_beg... |
% ==================================
% switchcode.m
% A program created to control the ARDUINO microprocessor responsible for
% the manipulation of the visual stimuli along with the room lighting.
% by Jay H. Ravaliya
% ==================================
function time = switchcode(LSD, RSD, LOD, a)
switchPin = ... |
% ------------------------------------------------------------------------
% Copyright 2019 Michal Rabani
%
% Redistribution and use in source and binary forms, with or without modification,
% are permitted provided that the following conditions are met:
%
% 1. Redistributions of source code must retain the above cop... |
syms sx sy sz;
syms m n;
jv(1) = 1;
jv(2) = 0;
qv = 1;
m = 4;
n = 4;
d = '2d';
iterations = 5000;
statistics = 50;
limit = 200;
sq2 = zeros(1,m*n);
f_sq = zeros(1,m*n);
tic;
for mit = 1:statistics
[sx,sy,sz] = spin(jv,qv, iterations,limit,m,n,d,mit);
sq = plot_sq2(sx,sy,sz,mit); ... |
%Script to test linear solvers
%Load the library
[ret,warn] = loadlibrary('../Lib/liblinear_solvers','../Include/linear_solvers.h');
%Add the path to the matlab function that makes the call
addpath '../interface'
%Generate a random system
n = 5;
A = [[2,3,0,0,0];[3,0,4,0,6];[,0,-1,-3,2,0];[0,0,1,0,0];[0,4,2,0,1]];
b =... |
% Grid GLODAP data to AO
clear all
load ../ao
% Mapped GLODAP data are downloaded from original paper
PO4_init = ncread('GLODAPv2.2016b.PO4.nc','PO4'); % 360*180*33
lat_init = ncread('GLODAPv2.2016b.PO4.nc','lat'); % 180*1
lon_init = ncread('GLODAPv2.2016b.PO4.nc','lon'); % 360*1
depth_init = ncread('GLODAPv2.2016b.PO... |
% alphaEqn
% Implements Eqn. 23.4-17 from Fluent's User's Guide
phiVdrp=fvc_interpolate(assign(Vpq,arrayToField(1-cp),'*'), w, xC, xF).*Sf;
phiAlpha=phiVdrp+rhomPhi./fvc_interpolate(rhom,w,xC,xF);
% Assembling
disp('Assembling alphaGEqn')
[M, RHS] = fvm_ddt(constField(1,N),constField(1,N),alphag0,V,dt,1);
[A, ARHS]= ... |
function [leg_value1,leg_value2]=irtEdge(irt_img,y_line,min_leg_gradient)
line_irt = irt_img(y_line,:); %find the horinzontal value
leg_area = find(line_irt.*(line_irt>min_leg_gradient)); %to remove other than leg information
area_diff = [diff(leg_area),0];
leg_value1(1) = leg_area(1);
temp = leg_area(area_diff>1)... |
function [modelData] = jimenez_params(modelData)
%JIMENEZPARAMS Summary of this function goes here
% Detailed explanation goes here
% Parameters specific for the Jimenez model
modelData.KdY = 0.17; % Wake deflection recovery factor
modelData.useWakeAngle = true; % define initial wake angle (not determined by yaw ang... |
% evaluate Evaluate Curve at specified locations
%
% This method evaluates a Curve object at specified locations:
% >> y=evaluate(object,x);
% using the current basis parameters and scaling factors.
%
% See also Curve, fit, summarize
%
%
% created December 1, 2014 by Daniel Dolan (Sandia National Laboratories)
%
f... |
classdef Classifier < pipeline.AtomicPipelineStep
%CLASSIFIER Summary of this class goes here
% Detailed explanation goes here
properties
CrossvalParams
Repeat
end
methods
function obj = Classifier(varargin)
obj = obj@pipeline.AtomicPipelineStep(vararg... |
function r = mahaldis(mu,sigma, x)
%given mu and sigma, return Mahalanobis distance r
r=(x-mu)/sigma*(x-mu)';
end
|
function T = getSimResolutions(varargin)
% GETSIMRESOLUTIONS
%
% Description:
% Compare the resolution of the two systems
%
% Syntax:
% T = getSimResolutions(varargin)
%
% History:
% 10Feb2021 - SSP
% 19Feb2021 - SSP - Simplified inputs and outputs
% ------------... |
%% Clear
clc
clear
%% Audios originales
Fs=10000;
T=1/Fs;
L=9000;
t=(0:L-1)*T;
frec=Fs*(0:(L/2)-1)/L;
%% Tecla #1
fa=1209;
fb=697;
wa=2*pi*fa;
ya=sin(wa*t);
wb=2*pi*fb;
yb=sin(wb*t);
Y=ya+yb;
YF=fft(Y);
data1=abs(YF/L);
data2=2*data1(1:L/2);
%% Tecla #2
fa2=1336;
fb2=697;
wa2=2*pi*fa2;
ya2=sin(wa2*t);
wb2=2*pi... |
function ret = cd1(rbm_w, visible_data)
% <rbm_w> is a matrix of size <number of hidden units> by <number of visible units>
% <visible_data> is a (possibly but not necessarily binary) matrix of size <number of visible units> by <number of data cases>
% The returned value is the gradient approximation produced by CD-1. ... |
IMG_H = 20;
IMG_W = 50;
dim= 200;
addpath(genpath('sparse_coding'));
addpath('debug_img');
% % random dict
% randmatrix = randn(dims,IMG_H*IMG_W);
% l2norms = sqrt(sum(randmatrix.*randmatrix,2)+eps);
% randmatrix = randmatrix./repmat(l2norms,1,size(randmatrix,2));
% save([num2str(dim), '.mat'], 'randmatrix');
% % N... |
function mat = cmfratse(row, col, angle)
if row > col
col = row;
else
row = col;
end
row = row + 2;
col = col + 2;
mat = zeros(row, col);
m = -tand(angle);
a = round(col / 2);
b = round(row / 2);
if (angle >= 0 && angle <= 45) || (angle > 135 && angl... |
X = load('20news_train.data');
trainX = spconvert(X);
termfreq = sum(X,1);
[~, I] = sort(termfreq',1,'descend');
X = X(:,I);
trainX = trainX(:,1:5000); |
function rawADCValue = batchreadDPE128x64(serDPE, batch_read_parameters,n)
% Batch read a matrix is Raw ADC values from the DPE for 128x64 array.
% The only difference in this function is one extra bit as bottom flag to
% indicate the function is handling top 64x64 or bottom 64x64 part of the
% 128x64 array.
% serial ... |
function [tau, T] = method_4(B_xxx,B_xyx, B_yyy, maxfreqbins)
%Method 4 from Nikias(1988) paper.
%B_xxx is the cross-bispectrum from x, x, x
%B_xyx is the cross-bispectrum from x, y, x
%maxfreqbins is the total number of samples in the fourier transform array.
%It is equivalent to M_samples from the bispectrum function... |
% move to next device
% comment on stages:
% x: move chip up/down, positive dx <-> up <-> right arrow on
% keyboard for python GUI <-> smaller device index
% y: move chip towards/away from fiber, positive <-> closer <-> up
% arrow on keyboard
% z: move fiber up and down, positive ... |
function [position] = generatePositions(N,sz,w0,varargin)
% default cut-off of non-zero elements in psf
kernelSize = ceil(3*w0);
for ii = 1:2:length(varargin)
if any(strcmpi(varargin{ii},{'kernelSize'}))
if isnumeric(varargin{ii+1}) && varargin{ii+1} > 0
kernelSize = ceil(varargin{ii+1}*w0);
... |
function plotResultsKF(t,clean,signals,X_arr,add2title)
figure;
plot(t, clean.position,'g', 'LineWidth', 2,'DisplayName','clean signal');
hold on;
plot(t, X_arr(:, 1),'Color',[1 0.1 0.1], 'LineWidth', 2,'DisplayName','KF result');
if not(exist('add2title','var'))
add2title = '';
else
add2title = [add2title '... |
clear all
close all
% This was written as a script for the ease of convience in grading.
% The parameters below assume a tapered (small diameter at the bottom) cup with a hole in the center of the bottom
% with a circular cross section (circle hole)
g = 9.81; % m/s^2 , gravitational constant
% Parameters Needed ass... |
% setup Set up sinusoid domains
function object=setup(object)
end |
% Clear the workspace
close all;
clearvars;
sca;
% Here we call some default settings for setting up Psychtoolbox
PsychDefaultSetup(2);
% Get the screen numbers
screens = Screen('Screens');
% Draw to the external screen if avaliable
screenNumber = max(screens);
% Define black and white
white = WhiteIndex(screenNumb... |
% Marcos Paulo Cayres Rosa - 14/0027131
clc;
clear all;
close all;
% Período igual a 2/3
t = 0:0.001:(8/3);
x = 3*cos(3*pi*t + pi/3);
plot(t,x,'LineWidth',2);
xlabel('t');
ylabel('x(t)');
title('x(t) = 3*cos(3*pi*t + pi/3)','FontSize',12);
grid on; |
%===============================================
% Bruce Land -- Cornell University -- Oct 2010
%modified Sept 2011
%===============================================
% 1.1 version can accept numbers in the code up to +/-131071
% 1_11 version can accept numbers in the constant block up to +/-131071
% and gen... |
function [ydot] = fofy(t,y,u)
% parameters
npts=u(1);
dx=u(2);
visc=u(3);
visc_num=u(4);
coef=visc_num/dx^2;
% BC
g=exp(-t/(4*visc));
ydot(npts)=0; % set vector size
ydot(1)= g/(4*visc)/((1+g)^2);
% % function loop using central difference
for j=2:npts-1
ydot(j)= - y(j) * ( y(j+1)- y(... |
function Redraw(self)
%
% MClustMainWindow: redraw
MCD = MClust.GetData();
MCS = MClust.GetSettings();
set(self.LoadingEnginePulldown, 'String', self.LoadingEngines, 'Value', self.LoadingEngineValue);
self.FeatureListBoxes.SetLeftList(setdiff(MCS.FeaturesAvailable, MCS.FeaturesToUse));
self.FeatureListBoxes.SetRight... |
function varargout = DPABISurf_Vol2Surf(varargin)
%DPABISurf_Vol2Surf MATLAB code file for DPABISurf_Vol2Surf.fig
% DPABISurf_Vol2Surf, by itself, creates a new DPABISurf_Vol2Surf or raises the existing
% singleton*.
%
% H = DPABISurf_Vol2Surf returns the handle to a new DPABISurf_Vol2Surf or the handle ... |
function pick = nmsOverlap(iu, sc, overlapThresh)
% Non-maximum suppression.
% function pick = nmsOverlap(iu, sc, overlapThresh)
%
% Greedily select high-scoring detections and skip detections that are
% significantly covered by a previously selected detection. IU is the
% matrix that defines overlap between b... |
clc;
clear all;
close all;
kp=15;
ki=20;
st=15;
dt=0.01;
lp=st/dt;
xi=0;
y1=0;
y2=0;
for i=1:lp
r(i)=i*dt;
e=r(i)-y2;
xp=kp*e;
xi=xi+ki*e*dt;
u=xp+xi;
y1=y1+(2*u-y1)*dt;
y2=y2+(y1-10*y2)*dt;
y(i)=y2;
t(i)=i*dt;
te(i)=e;
end
s=tf('s');
sys=(kp+ki/s)... |
function z = mytest(x, y)
z = myfunc(x,y);
end
function z = myfunc(x,y)
z = x + y;
end
|
function [lonc,latc,cgdd,map,soilDepth,agz] = agrozones_Walden(PathName,fileID,byr,eyr,iprint)
PathName
fileID
month = ['jan';'feb';'mar';'apr';'may';'jun';'jul';'aug';'sep';'oct';'nov';'dec'];
% Reads in lat and lon
ncid = netcdf.open(char(strcat(PathName,fileID,month(4,:),'_tmax_run1.nc')),'NOWRITE');
lt ... |
close all
clc
clear
%/**
% Скрипт формирования усеченного множества сигналов
%*/
% path_to_results_RA = [pwd '/results/radioastronomy'];
% load([path_to_results_RA '/Radioastronomy_BoCsin.mat'], 'Radioastronomy_BoCsin');
% load([path_to_results_RA '/Radioastronomy_BoCcos.mat'], 'Radioastronomy_BoCcos');
% load([path_t... |
function dq = vel2dq(v)
% VEL2DQ Transforms a point velocity expressed in vector notation into
% its dual quaternion representation.
%
% DQ = VEL2DQ(V) transforms the point velocity, a vector V into a
% dual quaternion DQ. V is either a vector of size 3 (one single
% velocit... |
function data = fswWideScan(fsw, f_center, n_span, f_span, f_bw, isplot)
% FSW wide scan
% WTJ, 180619
if nargin < 6
isplot = false;
if nargin < 5
f_bw = 100e3;
if nargin < 4
f_span = 160e6;
end
end
end
fsw.bw(f_bw);
fsw.span(f_span);
fsw.center(f_center... |
%用户数50844,城市90632
%%算法流程:
%%1.新建一个变量dict,储存已经被用于聚类的地点
%%2.遍历地点
%%3.对于一个地点且地点不在dict里
%% 求出其与所有其他地点的Sd(l_i,l_j)---地点距离相似度
%% 求出该地点与其他地点的Sm(l_i,l_j)---语义相似度
%% 取出1000个与该地点相似度最高的地点
%%4.聚类地点成功,形成了“地点组”
%%5.对于任一用户
%% 对于任一地点组
%% 求出用户在该地点组的签到次数
%% 形成该用户的地点组向量
%%6.对于任一用户
%% 遍历所有其他用户
%% 求出S(u,v)
%% 根据S(u,v)的大小求出该... |
% TSLOADSESSIONS Load Session data into Experiment structure.
% TSLOADSESSIONS(NEWDIR) load the sessions from a directory specified by
% NEWDIR. NEWDIR denotes the directory to find files which contain
% session data. Modified by CRG 10/20/09. Also loads MedPC code files
% into the Experiment.Programs field.... |
function [My_pits,Selected_Pits,Statistics]=GoodPitsSelection(Intensity_G,Intensity_R)
%GOODPITSELECTION : Returns a cell array containing information of each pit
%regarding the green and red fluophores present in the pit (My_pits). Also
%returns a binary matrix where 1 means selected pit and 0 means not
%selected. The... |
% optimal step size ...............
function [ G_0, G_1, G_2, G_3 ] = optimal_multi(delta_x, Jacob, AAX, BBY, CXY, DXY, CLY , F_x, nbus, npq )
% delta_x ..............
% Jacob ..............
% AAX .............
% BBY .............
% F_x ... |
function n = get(s,prop_name,varargin)
%STREAMER/GET Returns object properties
% VALUE = GET(OBJ,PROP_NAME) returns an object property. PROP_NAME
% can be one of the following:
% 'SessionName' - name of session.
% 'Channel'- signal number inside the streamer file.
%
% Dependencies: None.
switch prop_n... |
function handle_surf = plot_surf(surf_filename, cfg)
% PLOT_SURF plots .pial or .mat surface data
% handles = plot_surf(surf_filename, cfg);
% All arguments are optional
% Type "help plot_defaults" to see cfg parameters
%% Load Defaults like electrode size, font color, etc.
if nargin < 1
s... |
%Update MOS scores in features.
close all
clear all
clc
load('Features/New_Peak_Delta/MOVs_Final_Anchor_Ref.mat')
load('../Subjective_Testing/Results_RMSE_no_outliers.mat')
% load('../Subjective_Testing/Results_v4_no_MOS_limiting.mat')
% This section updates the MOS
for n = 1:length(a)
MOVs(n,1) = a(n).mean_MOS_... |
%% Initialization
close all
clear all
%% Region of interest
% Hesch's gyrus / A1
roiname_a1_l = 'E:\DATA\KNO\PET\marsbar-aal\MNI_Heschl_L_roi.mat';
roiname_a1_r = 'E:\DATA\KNO\PET\marsbar-aal\MNI_Heschl_R_roi.mat';
% roiname_a1_l = 'E:\DATA\KNO\PET\marsbar-aal\MNI_Temporal_Sup_L_roi.mat';
% roiname_a1_r = '... |
function [Krod,Kbeam] = KrodKbeam(E,A,I,L,k1,k2)
%% Stiffness matrix for rod and beam element
Krod = (E*A/L)*(1i*k1*L/(1-exp(-1i*2*k1*L)))*[1+exp(-1i*2*k1*L) -2*exp(-1*k1*L);...
-2*exp(-1*k1*L) 1+exp(-1i*2*k1*L)];
% T1 = [ 1 1 ... |
function h = plotForwardLyapFun2D( nFig, fun_reverse, xLim, N, ccolour, numPoints, LineWidth )
%PLOTLYAPFUN Summary of this function goes here
% Detailed explanation goes here
%Options
if iscell(nFig)
figure(nFig{1}); hold all;
%set(gcf(), 'CurrentHandle', nFig{2})
axes(nFig{2});
else
figure(nFig); h... |
function [intermediateResult resultInfo]=do_FullJob(refDataInfo, commonData, precursorValues, precursorNames, indicators, x, y, nx, ny, ...
mathIndex, indoptrep, doSparse, doFilter)
% function [intermediateResult, resultInfo]=do_Job(refDataInfo, commonData, precursor, indicators, x, y, nx, ny, totalCells, ...
% ... |
% This document extract frames from a video and save frames as images
vid = VideoReader('RaceV05.mp4');
nFrames = 10000;
% vidWidth = vid.Width;
% vidHeight = vid.Height;
f1 = 0;
for f=1:nFrames
% if (mod(f,4)==0)
% f1 = f1+1;
thisframe=read(vid,f);
%thisfile=sprintf('C:\Users\lhuang28\Documen... |
function AddCLRS(infile1, infile2, outfile)
fid1 = fopen(infile1, 'r');
fid2 = fopen(infile2, 'r');
fidout = fopen(outfile, 'w');
clrs1 = cell2mat(textscan(fid1, '%f %f %f\n'));
clrs2 = cell2mat(textscan(fid2, '%f %f %f\n'));
fclose(fid1);
fclose(fid2);
clrs_out = (clrs1 + clrs2)/2;
clrs_out(sum(clrs1,2)==3,:) = clr... |
function A4_Gain3Ranges2_CombinedLJ3
%Step 4 Gain
%Plot gain differences
% 10 degree responses in condition 10, 30 and 50
% 30 degree responses in condition 30 and 50
close all
clear all
pa_datadir RG-LJ-2012-01-10
fnames = {'SS10LJ3'; 'SS30LJ3'; 'SS50LJ3'};
% end
h1 = plotga... |
function [ yi ] = Linear( x, y, xi )
%LINEAR interpolation
% yi=Linear(x,y,xi)
n = max([size(x, 2) size(x, 1)]);
if n ~= max([size(y, 2) size(y, 1)])
error('Where there is a wrong in size');
end
if (min([size(y, 2) size(y, 1)]) ~= 1 ...
|| min([size(x, 2) size(x, 1)]) ~= 1)
... |
function getTmin(sfg);
% This function prints the Tmin expression.
%
% T_min = max{T_opi/N_i}
% where - T_opi is the latency of the operations in loop i
% - N_i is the number of delay elements in loop i
[delayfree, loops, operands] = delayfreeloops(sfg);
if length(delayfree)
error('The signal flow graph co... |
classdef EdgeLookup
%EDGELOOKUP Edge lookup class.
% Author: Benedikt Staffler <benedikt.staffler@brain.mpg.de>
properties
eIdx
idStartIdx
exactPos = false;
end
methods
function obj = EdgeLookup(edges, exactPos)
if exist('exactPos', 'var') && ~is... |
% Given: Node,Edge,Face
% asembling of the global stiffness matrix (Neumann everywhere)
% K(nnode,nnode) and the right-hand-side vector (only body forces)
% K is in saddle-point form; kinematic pressure intruduced
% Stable discretization (Q2-Q1 Taylor-Hood elements) !!!
% --> C is the 22 matrix block
function [K,A,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.