text stringlengths 8 6.12M |
|---|
clear all;
clc;
load Kinect_grasping.dat
% time = mgdata(:, 1);
% x = Kinect_grasping(:, 2);
% y = Kinect_grasping(:, 3);
% z = Kinect_grasping(:, 4);
t=0:0.01:1;
x=[10*(6*t.^5-15*t.^4+10*t.^3)]';
y=[10*(6*t.^5-15*t.^4+10*t.^3)]';
z=[10*(6*t.^5-15*t.^4+10*t.^3)]';
vx=diff(x);vy=diff(y);vz=diff(z);
[X_F, X_est... |
classdef instr_KEITHLEY2015<instrument.PKeithley2015
%对外从操作的通一函数仅有生成函数和操作函数
%完成每个操作句柄的类内编号以及命名
properties
%ch_name operate_type 三者为拓展类函数的必备要素
name;
num = 1;
ch = {};
label = {};
operate_type = {};% 'read'/'set'/'both'/'ban' useless=ban
step =... |
% Pulisci
clc
clear
% Definizione del sistema
A = [
-1 0 0 0;
0 0 -1 0;
0 1 0 0;
0 0 0 -2
];
B = [ 0; 1; 0; 0 ];
C = [ 1 1 1 1 ];
D = 0;
% Trovare
%
% Poli controllabili
% Poli osservabili
% Polinomio caratteristico di controllo
%
sistema = ss(A, B, C, D);
% Grado del sis... |
function set_tick_timestamps(axes, use_milliseconds)
%% Find nice round numbers to use
number_of_ticks = 6;
x_lim = xlim(axes);
xrange = x_lim(2) - x_lim(1);
xrange = xrange / number_of_ticks;
nice = floor(log10(xrange));
frac = 1;
if nice > 1
frac = 4;
end
nice = round(xrange * frac / 10^nice) / frac * 10^nice;
... |
% sGMM - Gaussian Mixture Models
%
% Configuration / Parameters:
% config1 - Description (Dimension, Unit, Range, ...)
% config2 - Description (Dimension, Unit, Range, ...)
% config3 - Description (Dimension, Unit, Range, ...)
%
% Results / Outputs:
% output1 - Description (Dimension, Unit, Range, ...)
% ... |
function popresCorr = BatchJointCorrelationDec2(batch2p,Fcoherence)
SetDirs;
if nargin < 1
strlistvarname = {'2p data','electrophys data'};
[varnamesel,ok] = listdlg('ListString',strlistvarname, 'Name', 'dataset', 'SelectionMode', 'single', 'InitialValue', 1);
if ok && varnamesel == 1
batch2p = true... |
clear;clc
C=xlsread('ML_CH17_Excel.xlsx') %把Excel的檔案讀進來
sheet=1;
x1Range='A2:C3'; %指定要讀哪一個區域的資料
D=xlsread('ML_CH17_Excel.xlsx',sheet,x1Range)
E=xlsread('ML_CH17_Excel.xlsx','table2','A2:C3')
size(E)
E(:,2) %呼叫第2個column的資料
E(1,:) %呼叫第1個row的資料
[data1,text,all_data]=xlsread('ML_CH17_Excel.xlsx','table2')
%data1 資料
% text ... |
% mgstat_set_path : set path to all mGstat
%
% set path to :
% mGstat_Install_Dir/gstat
% mGstat_Install_Dir/snesim
% mGstat_Install_Dir/visim
% mGstat_Install_Dir/sgems
% mGstat_Install_Dir/misc
%
function mgstat_set_path;
ip=0;
ip=ip+1;P{ip}='';
ip=ip+1;P{ip}='gstat';
ip=ip+1;P{ip}='snesim';
... |
function trl = lock2din5(cfg);
hdr = read_header(cfg.dataset);
event = read_event(cfg.dataset);
trl = [];
begTime = cfg.trialdef.prestim;
stopTime = cfg.trialdef.poststim;
for i=1:length(event)
if strcmp(event(i).type, 'trigger')
% it is a trigger, see whether it has the right value
if strc... |
function p = predictOneVsAll(Thetas, X)
m = size(X, 1);
X = [ones(m, 1) X];
prob = sigmoid(X * Thetas');
[z, p] = max(prob, [], 2);
end |
classdef team_class
% This class encapsulates the "team" concept in FIRM
% (Feedback-controller-based Information-state RoadMap).
properties
ss; %joint state of entire team
mm; %joint motion model
om; %joint observation model
belief; %current state
agents; %al... |
% figure,hold on
% plot(5:10,a05(5:10),'b','Linewidth',4)
% plot(5:10,a03(5:10),'r','Linewidth',4)
% plot(5:10,a01(5:10),'g','Linewidth',4)
% % plot(5:10,a006(5:10),'k','Linewidth',4)
%
% plot(5:10,b05(5:10),'b-.','Linewidth',4)
% plot(5:10,b03(5:10),'r-.','Linewidth',4)
% plot(5:10,b01(5:10),'g-.','Linewidth',4)
% %... |
function plotResults(file1,file2)
% Plot the load test results against each other
% File1 is the RBP file and file 2 is the GCP file
figure(); hold on;
markers = {'-o','-x'};
files = {file1,file2};
for i=1:length(files)
data = csvread(files{i},1,0);
response = data(:,1);
throu... |
classdef MovieReader
% reader
properties
movieStream
end
methods
function obj = MovieReader()
%UNTITLED6 このクラスのインスタンスを作成
obj.Property1 = inputArg1 + inputArg2;
end
function outputArg = method1(obj,inputArg)
%METHOD1 こ... |
%==========================================================================
% SSY280 Model Predictive Control 2012
%
% Homework Assignment 2:
% MPC Control of a Linearized MIMO Well Stirred Chemical Reactor
% Revised 2013-02-10
%==========================================================================
%*****... |
function J=Cost_TTO(x,y,Omega,p)
J=0;
for i=1:max(size(Omega))
if isnan(Omega(i))==0
J = J +( Omega(i) - ( max( (p(1)*log((x(i))*atan2(x(i),y(i)))+p(2))*(-y(i)^2+p(3)) , 0) +eps ) ).^2 ;
end
end
end |
function [feat] = sortFeaturesSS_noAbs(features, p, sortOnScale)
if ~exist('sortOnScale','var')
sortOnScale = 0;
end
% warning('threshold hardcoded to zero here');
thrs = -Inf;
if exist('p','var')
if isfield(p,'nbFeat')
nbFeat = p.nbFeat;
end
end
feat = cell(1,size(features,2));
for i =... |
function distances = lambda_distances(lambdas, eval);
for index = (1:length(lambdas));
distances(index) = min(abs(diag(eval) - lambdas(index)))^2;
end
distances = mean(distances);
end
|
function assembleMI()
MItot = zeros(40,40);
MIshuffTot = zeros(40,40);
for metricN1=1:40
load(['MI4-',num2str(metricN1,'%02d'),'.mat']);
for metricN2 = metricN1:40
MItot(metricN1,metricN2) = MI(metricN1,metricN2);
MIshuffTot(metricN1,metricN2) = MIshuff(metricN1,metricN2);
MItot(metricN2,met... |
function params = getParams(whichTask,paramInput)
% Parameters for value-based decision making
% zbar = prior mean
% switchRate = Chance of switching attention at each time point
% Presence of switchRate input simulates attentional switches
params = struct;
params.zsRes = 0.05;
params.zbar = 0;
params.dt = 0.05;
param... |
function t=addEmpiricalRangingFailure(MONITOR_DATA, topology, t, epsilon, filters)
%this function takes the empirical ranging data from MONITOR_DATA, which is
%the format we used to collect the ultrasound ranging data, and topology,
%which is the format that we store the topology info in, and removes
%ranging estimates... |
function [data,time, saclocs, ex, ey] = krFullEyePosTrigs(ai, dur)
%% Initiate
preSampleRate = ai.SampleRate;
ai.SampleRate = 500000;
ai.SamplesPerTrigger = dur*ai.SampleRate;
%% Acquire Data
start(ai);
[data, time] = getdata(ai, ai.SampleRate*dur);
flushdata(ai);
stop(ai);
%% determine the number of saccades that ... |
function [left_vels, right_vels] = ...
generate_segment_wheel_trajectory( ...
omega_dx_prev, omega_dx_curr, omega_dx_next, ...
delta_x_delta_t, axel_len, max_accel_abs, ...
max_abs_wheel_speed, ...
max_end_left_speed, max_end_right_speed, ...
starting_left... |
function [H,h,S]=plot_info_venn(Hs,Hc,Hf,JE,JEtot,h);
%%
if nargin<6
h=figure();
else
figure(h);
end
% clf
xlim([-1.5 2.5])
axis equal, axis off
if nargin<1
% inputs: JE, JEtot, Hc, TCF,
JEtot=4.10;
JE=3.5;
Hc=1.9;
Hs=2;
Hf=3;
%checks Hc<Hf Hc<JE Hs<JE Hc+Hs>JE Hs... |
%==========================================================================
% MDR_distribution.m
% Author: Akira Nagamori
% Last update: 9/16/19
% Descriptions:
% - Create a distribution of contraction times with a prespecified range
% - Calculate f_half based on the relationship between contraction time and
% f_... |
conf = dsp2.config.load();
load_date_dir = '120117';
load_p = fullfile( conf.PATHS.analyses, 'behavior', 'trial_info', load_date_dir, 'behavior' );
plt_save_path = fullfile( conf.PATHS.plots, 'behavior', dsp2.process.format.get_date_dir() );
new_behav = dsp2.util.general.fload( fullfile(load_p, 'behavior.mat') );
new_... |
function data = flattenCell(data)
try
data = cellfun(@flattenCell,data,'un',0);
if any(cellfun(@iscell,data))
data = [data{:}];
end
catch
% a non-cell node, so simply return node data as-is
end
end
|
function [ct,sigma_new,eps_new,hvar_new,aux_var] = rmap_damage(eps_new,hvar_old,e_DatMatSet,...
e_VG)
%******************************************************************************************
%* RETTURN-MAPPING PARA COMPUTO DE FUERZA INTERNA Y MATRIZ TANGENTE: PLANE STRAIN - 3D *
%* MODELO DE DAŅO ESCALA... |
function[x,dermun,dermaj,derpus]=derfun11(a,b,h)
x=a:h:b;
n=length(x);
xx=a-h:h:b+h;
dermun=(feval('fun',x)-feval('fun',xx(1:end-2)))/h;
dermaj=(feval('fun',xx(3:end))-feval('fun',xx))/h;
derpus=(feval('fun',xx(3:end))-feval('fun',xx(1:end-2)))/h;
%fungsi yang dideferensialkan
function y=fun(x)
y=exp(-x.^2); |
function compareMnistPCA_LDA()
load('dataMNIST.mat');
%create PCA object -- use a reduced dataset having only 5000 samples
%for computational reasons ---
N = 200;
obj=myPCA(data.trainImages(:,1:N));
%project data2
[Dnew,~]=projectData(obj,data.testImages,3);
%visualize DO ... |
function FLAG=test_gpu(count,memorySize)
if nargin<2
memorySize=4e9;
end
if gpuDeviceCount>0
if nargin==1 && ~isempty(count)
gpuInfo=gpuDevice(count);
else
try
gpuInfo=gpuDevice();
catch
fprintf('gpuDevice() has error, skipped.\n');
g... |
function plot_trajectories(fig, trajectories, num_frames, fps, lim, opts)
num_points = length(trajectories);
d = size(trajectories(1).points, 2);
points = nan(num_frames, num_points, d);
for i = 1:num_points
points(trajectories(i).frames, i, :) = trajectories(i).points;
end
plot_movie(fig, points, f... |
function[Rdx,RdX,RdXt,Rdy,RdY,RdYt]=plsrd(E0,F0,T,h)
%E0 标准化之后的自变量数据
%F0 标准化之后的因变量数据
%T 自变量系统主成分得分矩阵
%h 用于建模的主成分个数
%Rdx 各主成分对某自变量的解释能力
%RdX 各个主成分对自变量组的解释能力
%RdXt 全部主成分对自变量组的累积解释能力
%Rdy 各个主成分对某因变量的解释能力
%RdY 各个主成分对因变量组的解释能力
%RdYt 全部主成分对因变量组的累积解释能力
% 成分对自变量解释能力分析
[nr,nx]=size(E0);
[nr,ny]=size(F0);
Rdx=zeros(nx,h);
t1=zer... |
% newstring = strrepMany(s1,s2,s3)
%
% Replaces multiple strings within string S1.
%
% If S2 but not S3 is a cell array (or, S3 is a cell array with 1 element),
% any instance of *any* of the elements of S2 will be replaced with S3.
% e.g. replacing both 'great' and 'good' in S1 with 'bad'
%
% If both S2 and ... |
classdef TrainOptions
properties (Access = public)
opt_alg = "LD_SLSQP"
opt_stopval = log(0)
opt_ftol_rel = 1e-3
opt_ftol_abs = 1e-3
opt_xtol_rel = 1e-4
opt_xtol_abs = 1e-4
opt_maxeval = 30
opt_maxtime = 1e2
verbose = 0
end
methods
... |
% Compute the error of a pose-pose constraint
% x1 3x1 vector (x,y,theta) of the first robot pose
% x2 3x1 vector (x,y,theta) of the second robot pose
% z 3x1 vector (x,y,theta) of the measurement
%
% You may use the functions v2t() and t2v() to compute
% a Homogeneous matrix out of a (x, y, theta) vector
% for computi... |
function solve(vawt)
%SOLVE VAWT solver.
%
% vawt.solve solves the whole wind turbine for the interference factor
% and the rest of variables and stores them to the solution and
% diagnostic structures.
%
% See also SOLVECASE, POSTPROCESS.
for iTSR = 1:vawt.NTSR
disp(['Solving VAWT with TSR =... |
function h_surf = gridplot(h, gd)
%grplot Plots the gridded data as a surface
%
% gridplot(h, gd) displays a regularly gridded data gd as a
% surface in the axes h. The h parameter is optional, and the surface is
% plotted in the current axes, if it is not assigned. The function returns
% the handle of the created pat... |
clear;clc;close all;
% Define start and stop times, set a dt to keep outputs at constant time
% interval
tstart = 0;
tfinal = 5;
dt = 0.01;
% Initialize state and contact mode
q0 = [-1;3];
dq0 = [5;0];
x0 = [q0;dq0];
contactMode = [];
% Tell ode45 what event function to use and set max step size to make sure
% we do... |
%function is making vector of incidence form path vector.
% Input:
% path - 1-dimention mass, which corresponds to number of nodes. in
% 2-dimentional case it response to few equal paths.
% net - information about net (origin, destination, time, flow)
% Ouptut:
% Incidence vectors. size(number of paths*number of ... |
clear all;
load('/Volumes/TOSHIBA/Seņales suizos tercero, cuarto, quinto y sexto escenario/Datos/Datos_raw/datos3.mat');
n=length(C3);
FS=100;
at=1/FS;
blksize=1024*2;
aidx = 1:blksize/2;
f = aidx / blksize * FS;
C3_apsd=cell(n,1);
for i=1:n;
N(i)=length(C3{i});
end
for i=1:n;
nblk(i) = floor( N(i) / blksize... |
[Q,x,t,cons] = roeFirstFlat(200,200);
t = 2*[0 10 20 30 45 60 75 90 100];
for i=1:9
subplot(3,3,i);
plot(x,Q(:,t(i)+1));str = sprintf('T = %f',2.5/200*t(i));title(str);%axis([0 10 1 1.2]);
xlabel('x');ylabel('Height h');
end
|
clear all
clc
% voltage readings by sensor
z = [.39, .50, .48, .29, .25, .32, .34, .48, .41, .45, .49];
z = z.';
% corrected state vectors
x = zeros(10,1);
% corrected error co-variance matrix
P = ones(10,1);
% predicted state vectors
x_p = zeros(10,1);
% predicted error co-variance matrix
P_p = zeros(10,1);
% varianc... |
function [time,sst,wind11,wind37,vapor,cloud,rain]=read_tmi_day_v4(data_file)
% [time,sst,wind11,wind37,vapor,cloud,rain]=read_tmi_day_v4(data_file);
%
% this subroutine reads compressed or uncompressed RSS TMI daily byte maps
% (version-4 data released Sepetember 2006)
%
% input arguments:
% data_file = the ful... |
function [stim, All_envs, ERBspace, Tones_f] = Stim_Bind_ABABA(Corr_inds, fs, f_start, f_end, Tones_num, ERB_spacing)
% IF ERB_spacing is given, that will be used instead of Tones_num
% This version of the binding stimulus will return one stim in ABAB format
T_a = 1.0; %Time of a part of the stimulus
... |
%% vgg / caffe spec
PJT_ROOT = '/works/neuraltalk/';
CAFFE_ROOT = '/works/caffe/';
addpath(genpath([CAFFE_ROOT 'matlab/']));
INPUT_IMG_LIST_FILENAME = 'tasks.txt';
MODEL_DEPLOY_FILENAME = sprintf('%s/models/vgg/vgg_layer16_deploy_feature.prototxt', CAFFE_ROOT);
MODEL_WEIGHT = sprintf('/%s/models/vgg/vgg_layer16.caffem... |
function residuals = pose_eval(acc_reading, vicon_reading, recovered)
[R, unR, H, unH] = utils;
N = size(acc_reading,1);
vicon_grav = zeros(N,3);
for i=1:N
vicon_grav(i,:) = (R(vicon_reading(i,4:6))\[0 0 -9.8]')';
end
residuals(1) = 0; % TODO
ang_errs = zeros(N, 1);
f... |
function [ T ] = rotx(theta)
% This function rotates a coordinate system by theta radians
% around the x-axis
T = [1 0 0;
0 cos(theta) -sin(theta);
0 sin(theta) cos(theta);];
end
|
function [theta, J_history] = gradientDescent(X, y, theta, alpha, num_iters)
%GRADIENTDESCENT Performs gradient descent to learn theta
% theta = GRADIENTDESCENT(X, y, theta, alpha, num_iters) updates theta by
% taking num_iters gradient steps with learning rate alpha
% Initialize some useful values
m = length(y);... |
function newlist = collapseSum(list)
% collapse a list aggregating the values
% list should contain names in first col and values on second.
newlist={};
tosearch = unique(list(:,1));
for i = 1:length(tosearch)
curName = tosearch(i);
ind = ismember(list(:,1), curName);
newlist(i,1) = tosearch... |
ImageMatrix = imread('calb2.jpg');
figure(1);
imagesc(ImageMatrix);
xinput=ginput(7);
|
clear
load remedial_reading_data
X = [remedial_reading_data(:,1:2)];
Y = remedial_reading_data(:,3);
[S] = subfnLogisticRegressStats(Y,X); |
function [masses_raw,X_raw,daughters_raw] = desiQQQImport(folder)
% desiQQQImport - read in QQQ data using Paolo's methodology. Note that
% this will only work on Windows machines with Visual Studio 2015
% installed. This will need to clarified and tested on various set ups.
% Simple Mac check
if ~ispc
error('Cann... |
% Use the two photos with the nearest expo to compute the result
% it "should" be better
% but it doesn't
% Using MTB to align images.
% Reference: Fast, Robust Image Registration for Compositing High Dynamic Range Photographs from Handheld Exposures
% ================================================================
%... |
function [m_VarAuxElem,m_VarHistElemNew] = ...
f_OperPosConvSDA_QuadQ1(uElem,xx,conec,m_VarHistElemNew,m_VarHistElemOld,EF_sidesCutCPF,...
m_VarAuxElem,m_CT,e_DatSet_iSet,e_VG,hvar_new,hvar_old)
iStep = e_VG.istep;
%
e_DatMat = e_DatSet_iSet.e_DatMat;
e_DatElem = e_DatSet_iSet.e_DatElem;
nElem = e_DatSet... |
function ShowHouseHess()
% function ShowHouseHess()
% Reduction to Hessenberg form via Householder
% GVL4: Algorithm 7.4.2
clc
fprintf('The Hessenberg Decomposition\n\n')
n = 6;
A = randn(n,n);
[U,H] = HouseHess(A);
fprintf('A = \n')
fprintfM('%7.3f',A)
fprintf('U = \n')
fprintfM('%7.3f',U)
fprintf('H = ... |
function p = predict(Theta1, Theta2, X)
%PREDICT Predict the label of an input given a trained neural network
% p = PREDICT(Theta1, Theta2, X) outputs the predicted label of X given the
% trained weights of a neural network (Theta1, Theta2)
% Useful values
m = size(X, 1);
num_labels = size(Theta2, 1);
% You need ... |
function [px,py] = workconfigspace(a1,a2,l1,l2,z1,z2,z3,z4,c1,c2,c3,c4)
% a1 and a2 are the angles
% l1 and l2 are the lengths
px=l1*cosd(a1)+l2*cosd(a1+a2-180);
py=l1*sind(a1)+l2*sind(a1+a2-180);
% px and py are the coordinates of the end effector
plot([0,px],[0,py])
% Quadrant checking for l1 and l2
switch ... |
function [x,y,mag, rest, ...
horiz_pos_tol, horiz_vel_tol, vert_pos_tol, ...
vert_vel_tol, angle_tol, angle_vel_tol] = ...
automation_setpoints(p, add_midpoints, midpoint_height, max_points)
% box_x_pos = (p.box_sequence - 1) * p.distance_between_boxes ...
% + p.first_box_to... |
function outCSI = PCA(inCSI,pcaConfig)
%% Principal Components Analysis for de-noising
% Input description:
% inCSI - a complex matrix with size of [packetNum, subcarrierNum*links]
% pcaConfig - a numeric array of pca parameters
% Output description:
% outCSI - a real matrix
%% Input pars... |
% Projet MQ19 / P18
clear all
close all
clc
g = 9.81 ;
rho_ac = 7850 ;
rho_be = 2500 ;
E_ac = 270e+9 ;
E_be = 30e+9;
%% Données géométriques
z_etage = [6.4*(0:1:7) 44.8*ones(1,88)+4.2*(1:1:88) 414.4*ones(1,6)+7*(1:1:6)];
% Super colonnes C1
% D1
C1.D1 = [2.4*ones(1,46) 2.2*ones(1,8) 2*ones(1,16) 1.8*ones... |
function y = di_pochhammer(x,n)
% di_pochhammer(x,n) returns digamma(x+n)-digamma(x),
% with special attention to the case n==0.
%
% di_pochhammer.c provides a faster implementation.
if issparse(n)
y = sparse(rows(n),cols(n));
else
y = zeros(size(n));
end
i = (n > 0);
if length(x) == 1
y(i) = digamma(x+n(i)) - ... |
function [ schedule,scheduletable ] = ScheduleFlush( taskDAG,nodeCount,localComPower, serverComList,serverCount,transRate,transData,computeCost,computeEnergy,transEnergy, schedule,scheduletable,schedulelength,computeStartup,searchStart,rankList,timeslot)
%ScheduleFlush 根据能耗限制、同一子任务上传过多处理器带来的不必要开销,进行调度策略的修改调整
% Algori... |
clc
close all
clear
%% load data
load('ECGdata.mat')
%% setup GAN training data
maxLabel = max(TrainingLabels);
numSamplesPerClass = zeros(1,maxLabel);
for i = 1:maxLabel
numSamplesPerClass(i) = sum(TrainingLabels == i);
end
maxSample = max(numSamplesPerClass);
numGanTrainingPerClass = zeros(1,maxLabel);
numSynthPe... |
function ConfigCRSParams
global configData;
% get saccade detection parameters
if (~isfield(configData,'CRSParams'))
txt=sprintf('CRS conversion parameters are currently not set.\nDo you want to load them from a file?');
ret=QuestDlg(txt,'Load CRS conversion parameters','Yes','No','No');
if (strcmp(ret,'Y... |
classdef dawmr < handle
% dawmr class:
% Kmeans-based Affinity graph generator
properties (Access = public)
verbose = 0;
rand_sampling = 0;
rand_ordering = [];
balance_train = 0;
balance_test = 0;
% 0 = no normalization
% 1 = scale to [0,1], assume min is already 0
% 2 =... |
function e_DatMatME = f_VarME(nomArchME,dirDat,m_ElemPGImpr)
%Se asume que el archivo de datos de la celda unitaria está en el mismo directorio el archivo de
%datos de la malla macro.
%Los datos de tiempo, ignora los leídos de este archivo (micro) y usa los leídos a nivel macro.
nomArchDat = [nomArchM... |
function [ orms ] = odd_rms( nn )
%ODD_RMS Summary of this function goes here
% Detailed explanation goes here
orms = sqrt(mean((1:2:2*nn-1).^2));
end
|
%% boeing
nodes = importdata('nodes.txt');
faces = importdata('faces.txt');
trimesh(faces,nodes(:,1),nodes(:,2),nodes(:,3),nodes(:,3)*0);
axis equal; axis tight
colormap gray
polyID = fopen('boeing.poly','w');
fprintf(polyID, '#Nodes\n');
fprintf(polyID, '%d 3 0 0\n', length(nodes));
for i = 1:length(nodes... |
%function prin_stress_example
sigmax=12000; sigmay=15000; tauxy=8000;
original_stress=[sigmax tauxy; tauxy sigmay];
[Vectors, Principal] = eig (original_stress); %Eigen value function in MATLAB
principal_stress = Principal %Principal stresses
Value = Vectors (2,1)/Vectors (1,1); % Slope of eigenvector is a ratio of ... |
%MLR with Categorical Predictor
EmployeesSalary = readtable('employees.xlsx');
summary(EmployeesSalary)
EmployeesSalary.LevelOfEmployee=categorical(EmployeesSalary.LevelOfEmployee);
class(EmployeesSalary.LevelOfEmployee)
figure()
gscatter(EmployeesSalary.YearsExperience, EmployeesSalary. Salary, EmployeesSalary.L... |
function rasterplot4(resp,cond1l0,cond2l0,cond1l1,cond2l1,ta)
binwidth = 30;
inds1l0 = find(cond1l0);
subplot(5,1,1)
hold on
for i = 1:length(inds1l0)
if ~isempty(find(resp(inds1l0(i),:)))
plot(find(resp(inds1l0(i),:)),i,'bo','MarkerSize',1.5,'MarkerFaceColor','b')
end
end
% axis([0, size(resp,2), 0, ... |
function [t,x] = Heun(f,t0,tf,x0,h)
t=t0:h:tf;
n=length(t)-1;
x=zeros(n+1,1); %reserva memoria para n elementos del vector x
x(1)=x0;
for i=1:n
k1=h*f(t(i),x(i));
k2=h*f(t(i)+h/3,x(i)+k1/3);
k3=h*f(t(i)+2*h/3,x(i)+2*k2/3);
x(i+1)=x(i)+(k1+3*k3)/4;
end
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%cub_info : Load data cub (format .pds)
%
%Description:
% Load a description file ( .lbl) of a cub
% give a struct usable by other cub_* functions like cub_read
%
%See also:
% cub_read cub_view
%
% version 1.05
%Author: Etienne de For... |
clear all
label = 'BDAC_N800_R92_r14_ps1_dimer_sep_1nm_Air_3D_785_';
savemap = 'TBDAC_N800_R92_r14_ps1_dimer_sep_1nm_Air_3D_785_E_particle';
cutoff = 2;
circlesize = 16;
fontsize = 45;
load(sprintf('%sfieldx.mat', label));
load(sprintf('%sfieldy.mat', label));
load(sprintf('%sfieldz.mat', label));
load(sprintf('%spos... |
function point_2d_vector = ...
Return_2d_point_from_index( reference_image , list_of_index )
%This function returns a list of the 3d points for the coressponding index
%point
%The input is the reference image, to get the size. Also the list of
%indices to be converted
%The output is a list of the 2d point... |
function f=pixtoim(pix_list,im_size,x_list,filter)
% Usage ... f=pixltoim(pix_list,im_size,x_list,filter)
%
% x_list=data (vector), pix_list=corresponding pixels(2 col)
% x_list and pix_list must be the same length
% x_list must be a vector and pix_list is a 2col vector
% filter is a binary vector which indicates inclu... |
function [signal_filtered, MPIparams] = extractData(signal, MPIparams, interp_fs, Bw, numHarmonics)
interp_coeff = interp_fs/MPIparams.fs;
t = (0:length(signal)-1)/MPIparams.fs; t_interp = (0:(length(signal)-2)*interp_coeff+1)/interp_fs;
signal = interp1(t, signal, t_interp, 'spline'); % interpolate the ... |
clear
addpath('../class')
close all
clf
global dobot;
global tftree;
tftree = rostf;
% Joint subscriber
jointSub = rossubscriber('/dobot_magician/state','dobot_magician/State',@convertJointAngleToTfCallback);
% Circle subscriber
circleSub = rossubscriber('/hough_circles/circles_float_array','std_msgs/Fl... |
%% -----BASIC OPERATIONS
PS1('>> ') %Changes the prompt to another one
help rand %Prints info about function rand
%% Variables
a = pi; %Semicolon supressing output
a % Simpleprint
disp(sprintf('2 decimals: %0.2f', a) % Proprint
%% Matrix
A = [1 2; 3 4; 5 6]
v = [1 2 3] %Row
v = [1; 2; 3] %Column
v = 1:0.1:2 %Autofill... |
function OutData = subfnPutDataIntoOutputStructure(OutData,Parameters,AnalysisParameters,IndicesForDataChunk)
% put the data into the output structure
Nvoxels = length(IndicesForDataChunk);
OutDataForProbesFlag = 0;
for i = 1:Nvoxels
if ~isempty(Parameters{i})
VoxelIndices(i) = 1;
ImageVoxelIndices... |
% Based on James Hays, Brown University
%This function will sample SIFT descriptors from the training images,
%cluster them with kmeans, and then return the cluster centers.
function vocab = build_vocabulary( image_paths, vocab_size )
for x = 1:length(image_paths) %loop through image paths
img = imread(image_pat... |
%% Meta Pipeline for running many simulations
path_simu = '/home/sebastian/Projects/niak_multiscale/local_test/many_pipe/';
if ~psom_exist(path_simu)
psom_mkdir(path_simu);
end
% Switch here: good/bad
simulation_be = 'bad';
%% Set Parameters
t = 100;
k = 16;
n = k^2;
% 6 steps each
param_prec = 2;
%range_fwhm = ... |
function [results, accuracy, delta]=SG_model_free(data)
warning off
% =========================================================================
% effect of ratings on force behaviour
% =========================================================================
fprintf('\n ==============================================... |
clear; close all; clc;
%% TEST
% Assert that LAR and LASSO are equal in cases where no variables are
% dropped
X = gallery('orthog',100,5);
X = X(:,2:6);
y = center(rand(100,1));
b_lar = lar(X,y);
b_lasso = lasso(X, y);
assert(norm(b_lar - b_lasso) < 1e-12)
|
clear,clc,close all;
tic;
% 2 dimension
% data = rand(100,2);
load('data1.mat','data');
[dataNum,dataDim] = size(data);
centerNum = 3;
% options = [2; % exponent for the partition matrix U
% 200; % max. number of iteration
% 1e-5; % min. amount of improvement
% ... |
clc;clear;close all;
%----------- load -----------%
map = openfig('testmap.fig','reuse');
load('testpoints');
load('radiomap_kalman');
apqty = 3;
k = 3;
result = cell(1,1);
%----------- wknn -----------%
testqty = size(testpoints, 2);
tempcell = cell(size(radiomap_kalman));
for i = 1:testqty
%----------- 计算欧式距离 ---... |
function X=shiftmat(X0,shifts,val)
X = mex_shiftmat(double(X0),double(round(shifts)),double(val));
|
function param = params()
param.K = 2;
param.archivo_imagen = 'CT.png';
param.max_iters = 90;
param.medida_distancia = 2;
end |
% 315CA Dinu Ion-Irinel
function out = bilinear_rotate_RGB (img, rotation_angle)
% =============================================== =======================
% Apply bilinear interpolation to rotate an RGB image at a given angle.
% =============================================== =======================
... |
clear all;
clc;
close all;
lambda = 8.0; % initial lambda value (assumed)
PD = 800; % total dispatched power
BB = [ 0 ; 0 ; 0 ]; % no transmission loss given
alpha = [ 500 400 200 ];
beta = [ 5.3 5.5 5.8 ];
gamma = [ 0.004 0.006 0.009 ];
X_limit=[200 450
150 350
... |
function [ TP, TN, NP, NN, OP, ON, PP, PN ] = analyze( labels, predictedLabels, analyzedLabel )
%ANALYZE Summary of this function goes here
% Detailed explanation goes here
[numberOfLabels] = numel(labels);
TP = 0; NP = 0; TN = 0; NN = 0;
predictedLabels = cellstr(predictedLabels);
analyzedLabel = cellstr(analyzedL... |
function [value discrete] = C(x)
%%%%%%%%%%%
%flow set of the hybrid automaton
%%%%%%%%%%%
tau = x(25);
T = 0.1;
if (tau >= 0 && tau <= T)
value = 1;
else
value = 0;
end
end
|
function newPos = DrawROI(handles,ROI,rcol)
h = imrect(handles.axes1, ROI);
title(handles.axes1, 'Update the ROI and double-click')
newPos = wait(h);
delete(h);
|
function calcEff(pfile)
sprec1(pfile,'com', 'N');
vname = dir('vol*.nii');
aslsub(vname(1).name);
lightbox('mean_phaseDiff')
figure
lightbox('mean_magDiff');
return |
function [shape] = EShape2Shape(obj,eshape)
%EShape2Shape Summary of this function goes here
% Detailed explanation goes here
dir = angle(eshape(1:2*obj.n_vert) + 1j*eshape(2*obj.n_vert+1:end));
shape = dir / obj.alpha_pi;
end
|
classdef NdgGaussQuadNonhydrostaticSolver1d < NdgAbstractNonhydrostaticSolver & ...
NdgGaussQuadWeakFormSolver
%NDGGAUSSQUADNONHYDROSTATICSOLVER 此处显示有关此类的摘要
% 此处显示详细说明
properties
end
methods
function obj = NdgGaussQuadNonhydrostaticSolver1d( physClass, meshUnion ... |
% author: Tyler Thompson
% date: 4/10/2019
% description: ECE4550 Matlab Assignment #3 Problem 2
clear;
close all;
% coefficents of transfer function
b = [0.15 0 -0.15];
a = [0.7 -0.5 1];
% print the frequency response equation to the console
fprintf("H(w) = [");
for i = 1:length(b)
if b(i) ~= 0
if i == 1
... |
function nii_mrnorm_batch;
%demo of aging toolbox
dir = '/Users/rorden/tut'; %location of images
ext = '.nii'; %file extension either .hdr or .nii
%next: list of anatomical, pathological and lesion images
%T1 = cellstr(strvcat('AS_T1','BF_T1','BS_T1','DC_T1','DV_T1','FJ_T1','HB_T1','JA_T1','JC_T1','JE_T1','JJ_T1','JY_T... |
function EulerInv = p_EulerInv(img,LUT)
% Calculate Euler characteristic for each octant and sum up
eulerChar = zeros(size(img,1),1);
% Octant SWU
n = ones(size(img,1),1);
n(img(:,25)==1) = bitor(n(img(:,25)==1),128);
n(img(:,26)==1) = bitor(n(img(:,26)==1),64);
n(img(:,16)==1) = bitor(n(img(:,16)==1),32);
n(img(:,17... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.